-
Notifications
You must be signed in to change notification settings - Fork 789
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
RFC FS-1033: Deprecate places where seq
can be omitted
#17772
RFC FS-1033: Deprecate places where seq
can be omitted
#17772
Conversation
❗ Release notes required
|
{ 1..10 }
as sequence expression{ 1;10 }
as sequence expression
59c5208
to
d643cfb
Compare
I am not 100% sure what exactly was approved in the comment, but I don't immediately see it as "let's allow omitting |
@vzarytovskii what I understood from Don’s comment was that we want to enforce the To do this we need to have valid code for Also note that To summarise my current approach is:
|
Hm, I've read it a bit differently -
I read it as - when we immediately pass it to collections, then we do not require "seq" (even for now illegal constructs), otherwise (if not passed to collections) we add a warning enforcing (suggesting really) to add "seq" to "{ x .. y }". But I have problems decoding the comment w.r.t. allowing other constructs to omit "seq" when not passed to collections (when returning or binding for example. |
what about |
That's what I understood. Show a diagnostic suggesting adding "seq" if it's not passed to collection. And allow other constructs only when passed to collections. I'd wait for other folks to read it through, I might be misunderstanding things. |
{ 1;10 }
as sequence expression{ start..finish }
and { start;finish }
using a warning
{ start..finish }
and { start;finish }
using a warning { start..finish } { start..step..finish }
c05956b
to
9c05432
Compare
9c05432
to
47b4ef0
Compare
{ start..finish } { start..step..finish }
seq
can be omitted
4fc0837
to
de89b44
Compare
I like the uniformity of us forcing to use |
@T-Gro @vzarytovskii Yeah a code fix is also part of my plan. As thing stand today we need to implement for each editor. I can do the VSCode and and maybe Rider if the F# team does the VS one.
Yeah it is approved. But if the F# team disagrees I please encourage to go through the lang suggestions and reject these or clarifies the state. Im happy to work together to get this through if that is really the intention. |
If the codefix will come within the same release window, all is good - I am approving. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work. Agree with the above, a code fix would be very beneficial here :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@T-Gro @psfinaki Is the expectation for the quick fix to be implemented as part of this PR of should we create a issue for it after this PR is merged.
@edgarfgp https://github.com/edgarfgp/fsharp/pull/8. SynExpr.shouldBeParenthesizedInContext
actually coming in useful :)
Add code fix for adding missing `seq` before `{…}`
d6126f7
to
da79570
Compare
da79570
to
9d24c54
Compare
Thanks @brianrourkeboll for the quick fix. |
Alrighty, brilliant job @brianrourkeboll also. Let's merge this all in :) Thanks both! |
Thanks @brianrourkeboll , @edgarfgp . (I assume the codefix should work in bulk mode, right?) |
It is already done. As part of this PR update all the instances mostly testing code.
Not sure why would not. But I do not have a Windows machine try this. But I assume there is a way to write a unit tests for this. |
@edgarfgp good, I was afraid there might be more :). |
It is a bulk fix, as per the code fix code, should be good :) |
Yes, although with the same limitations that (as far as I know) apply to all current F# code fixes: #16999 and the inability to handle nested instances of the same fix. fix_all_missing_seq.mp4 |
Description
Implements fsharp/fslang-suggestions#1033
Deprecate
{ start..finish }
and{ start..step..finish }
Before
To create a sequence, you can use
{ start..finish }
or{ start..finish..step }
.After
A new warning will be raised when using
{ start..finish }
or{ start..finish..step }
to create a sequence.To create a sequence, you need to use
seq { start..finish }
orseq { start..finish..step }
.Checklist
seq
can be omitted. fsharp/fslang-design#788AddMissingSeq
Thanks to Brian