Support more types in simple for-loops#18301
Support more types in simple for-loops#18301brianrourkeboll wants to merge 3 commits intodotnet:mainfrom
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
aa173e2 to
f41a178
Compare
f562133 to
3db879e
Compare
b123ad7 to
36a1ad4
Compare
Description
Examples
Checklist