-
Notifications
You must be signed in to change notification settings - Fork 803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support more types in simple for-loops #18301
base: main
Are you sure you want to change the base?
Support more types in simple for-loops #18301
Conversation
❗ Release notes required
|
Since this does affect the language, the new fallback branch should be guarded with a LanguageFeature flag. This will also need same extension of the https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/loops-for-to-expression section of the docs (the "docs diff" can also be used as an RFC). Will there be limitations for |
It can also be a branch producing a recoverable error like "F# 10/preview is required". It would allow having a single branch in the checking logic, while also fail the build, effectively disallowing the new behavior in the older language versions. |
Indeed, |
Agreed.
Agreed.
Yeah. As-is, |
What will the user experience when using (existing integral |
It will tell the user that the type does not support the unary minus operator That is probably not ideal, since the user wrote If we wanted to emit an error more like " |
43cfc4b
to
52003a5
Compare
Hmm, it's not really that bad, though: > for n = 10uy downto 1uy do printfn $"{n}";;
for n = 10uy downto 1uy do printfn $"{n}";;
-------------^^^^^^
stdin(1,14): error FS0043: The type 'byte' does not support the operator '~-' |
52003a5
to
ef0b51a
Compare
...r.ComponentTests/EmittedIL/ForLoop/ForLoopByte.fs.RealInternalSignatureOff.OptimizeOn.il.bsl
Outdated
Show resolved
Hide resolved
aa173e2
to
f41a178
Compare
...r.ComponentTests/EmittedIL/ForLoop/ForLoopInt32.fs.RealInternalSignatureOn.OptimizeOn.il.bsl
Outdated
Show resolved
Hide resolved
f562133
to
3db879e
Compare
b123ad7
to
36a1ad4
Compare
Description
Examples
Checklist