-
Notifications
You must be signed in to change notification settings - Fork 822
Array comprehension no longer compiles on rc1 #17708
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
Comments
This must be from one of my PRs. I will look into this. |
Should fix it |
It looks like this only happens when the This compiles: let arr = [| for _group in Array.groupBy id [||] do 0 |] |
It's this |
@brianrourkeboll wildcard
|
...The real problem is actually a very simple one: I neglected to bind That means that the source array expression is evaluated multiple times (🤦♂️🤦♂️🤦♂️):
and
The equivalent optimization for lists does not have this problem, because it was already binding fsharp/src/Compiler/Optimize/LowerComputedCollections.fs Lines 291 to 297 in aea757f
Luckily, this is a very easy problem to fix. Because I originally thought that this issue was related to pattern-matching and wildcards, I also found and have fixes for two issues related to those. I'll be updating my PR once I have the baselines updated... |
Thank you @sayurin for trying out the release candidate today and opening this issue so that I could fix it! |
Please provide a succinct description of the issue.
Repro steps
Following code causes compile error on .NET 9 RC1.
Expected behavior
.NET 8 can compile it, successfully.
Actual behavior
.NET 9 RC1 fails with following error.
Known workarounds
split it.
Related information
Provide any related information (optional):
The text was updated successfully, but these errors were encountered: