-
Notifications
You must be signed in to change notification settings - Fork 794
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
Parens: miscellaneous fixes #16262
Parens: miscellaneous fixes #16262
Conversation
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.
Thanks! Tests are getting to about 2000 LOC, if you come up with any fresh thoughts on splitting them - go ahead :)
Fair enough :) I'll see if I can find time this week to open a test cleanup PR. |
Also, with the changes in #16248 and those in this PR applied, I can run the bulk fix on FSharp.Core and compile it with no errors or warnings—with the sole exception of this pair of parentheses in fsharp/src/FSharp.Core/local.fs Line 39 in d441308
Removing those parentheses results in:
(No line number is given, and there is no warning or error in VS.) The reason seems to have something to do with the fact that the array comprehension's target type is [|SR.GetString SR.notEnoughElements; index; box <| if index=1 then "element" else "elements" |] It only seems to affect FSharp.Core, though—the following (AST) compiles and runs as you would expect in any other context: let f x : obj array = [| "a"; 3; (if x = 1 then "element" else "elements") |]
printfn $"f 1 = %A{f 1}"
printfn $"f 2 = %A{f 2}"
let g x : obj array = [| "a"; 3; if x = 1 then "element" else "elements" |]
printfn $"g 1 = %A{g 1}"
printfn $"g 2 = %A{g 2}" Is there some special way that FSharp.Core is compiled that would affect the way that expression is compiled? Edit: there is. The error happens sometime during the Otherwise, I guess I can just never suggest removing parens from around potentially problematic expressions in sequential expressions, although it should be valid in general when the parenthesized expression is the last expression in the sequence (compare the logic in ocamlformat). |
Sure, this can be a followup.
This is awesome!
I guess it is worth creating a separate issue for this. Nothing comes to my mind on that, but this does not sound right or as anything I would want to happen in the compiler. |
Another followup to #16079.
SynExpr.Apply
in the middle of a chain of dot-gets in argument position (f (x.M.N().O)
).o.M((x = y))
).if
andthen
.… : ty
) in more places.()
→(())
required in certain scenarios #16254.new
) #16257.[x; (if y = 1 then 2 else 3); z]
).