Closed sylvainouel closed 3 hours ago
This seems like it could be related to some of my changes. I will try to take a look tomorrow.
This a regression from NET8, I also suspect the lowering changes being applied here. Even though the previous version was already optimized to Array.map, so it could be a different cause of the regression.
Here's a more minimal repro:
[|for x in [|1UL|] -> x|]
The same thing applies for unativeint
:
[|for x in [|1un|] -> x|]
The problem seems likely to be here
and here
I think we need to be emitting ldelem.i8
and ldelem.i
for uint64
and unativeint
, respectively. (And maybe likewise for stelem
?)
Even though the previous version was already optimized to Array.map
That was an intermediate optimization introduced in #16948, but superseded in #17067 in part to fix debug stepping in the loop body. SharpLab still has a preview version of 9 that doesn't include #17067, #17419, #17711.
Known workarounds changing the uint64 to int64 fixes it.
@sylvainouel Another workaround for the time being would be to set <LangVersion>8.0</LangVersion>
in your project file.
I opened a PR that I believe should fix this: #18081.
Thank you for this fix!
Repro steps
Copy/paste the following program in F# interactive:
It produces the following error:
error FS0192: internal error: Error in pass3 for type FSI_0003, error: ldelem
Expected behavior
I think it should build fine.
Actual behavior
internal error
Known workarounds changing the uint64 to int64 fixes it.
Related information
It used to work, it stopped working after upgrading to latest VS.
Operating system Windows 11
.NET Runtime kind (.NET Core, .NET Framework, Mono)
.NET 9