Skip to content
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

Array expression fails to compile due to internal error #18134

Open
sangkilc opened this issue Dec 13, 2024 · 1 comment
Open

Array expression fails to compile due to internal error #18134

sangkilc opened this issue Dec 13, 2024 · 1 comment

Comments

@sangkilc
Copy link

sangkilc commented Dec 13, 2024

Some array expressions fail to compile with the following error message: Error in pass3 for type Program, error: ldelem. This is easily reproduced with the latest F# 9 (.NET 9) on Windows.

Repro steps

let arr1 = [| 0; 1; 2; 3 |]
let arr2 = [| 0UL; 1UL; 2UL; 3UL |]
let wrap x = [| x |]
let good = [| for a in arr1 do wrap a |]
let bad = [| for a in arr2 do wrap a |] // this is causing the prob

When copy-paste the above code to dotnet fsi, the last line produces the error:

> let bad = [| for a in arr2 do wrap a |];;


error FS0192: internal error: Error in pass3 for type <StartupCode$FSI_0003>.$FSI_0003, error: ldelem

Expected behavior

It should compile.

Actual behavior

Internal error

Known workarounds

By using F# 8 (.NET 8) the same code compiles:

> let arr1 = [| 0; 1; 2; 3 |]
- let arr2 = [| 0UL; 1UL; 2UL; 3UL |]
- let wrap x = [| x |]
- let good = [| for a in arr1 do wrap a |]
- let bad = [| for a in arr2 do wrap a |];;
val arr1: int array = [|0; 1; 2; 3|]
val arr2: uint64 array = [|0UL; 1UL; 2UL; 3UL|]
val wrap: x: 'a -> 'a array
val good: int array array = [|[|0|]; [|1|]; [|2|]; [|3|]|]
val bad: uint64 array array = [|[|0UL|]; [|1UL|]; [|2UL|]; [|3UL|]|]

Related information

I'm using the latest .NET 9 (VS 17.12.3) on Windows.

.NET SDK:
 Version:           9.0.101
 Commit:            eedb237549
 Workload version:  9.0.100-manifests.4a280210
 MSBuild version:   17.12.12+1cce77968
@brianrourkeboll
Copy link
Contributor

I think this is the same as #18066, fixed in #18081. It should (hopefully) be in 9.0.200.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: New
Development

No branches or pull requests

2 participants