Conversation
psfinaki
left a comment
There was a problem hiding this comment.
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.Applyin the middle of a chain of dot-gets in argument position (f (x.M.N().O)).o.M((x = y))).ifandthen.… : ty) in more places.()→(())required in certain scenarios #16254.new) #16257.[x; (if y = 1 then 2 else 3); z]).