roc-lang / roc

A fast, friendly, functional language.
https://roc-lang.org
Universal Permissive License v1.0
4.46k stars 312 forks source link

Upgrade to purity-inference roc panics with `Error in alias analysis` #7207

Open lukewilliamboswell opened 5 days ago

lukewilliamboswell commented 5 days ago

While upgrading basic-cli in this commit

$ roc examples/task-list.roc
🔨 Rebuilding platform...
thread 'main' panicked at crates/compiler/gen_llvm/src/llvm/build.rs:5748:19:
Error in alias analysis: error in module ModName("UserApp"), function definition FuncName("\x11\x00\x00\x00\x04\x00\x00\x80\xa2W\x01\xe0\x8b`\xe5 "), definition of value binding ValueId(42): expected type 'union { (union { ((heap_cell,), ()), (union { (), (), ((heap_cell,),), (), (), (), () },) },), ((),) }', found type 'union { ((heap_cell,), ()), (union { (), (), ((heap_cell,),), (), (), (), () },) }'
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
app [main!] { pf: platform "../platform/main.roc" }

import pf.Stdout

main! = \{} ->
    # Prints out each of the authors
    forEach! [ "Foo", "Bar", "Baz" ] Stdout.line!

forEach! : List a, (a => Result {} err) => Result {} err
forEach! = \l, f! ->
    when l is
        [] -> Ok {}
        [x, .. as xs] ->
            try f! x
            forEach! xs f!
lukewilliamboswell commented 5 days ago

Further simplification, gives similar error.

thread 'main' panicked at crates/compiler/gen_llvm/src/llvm/build.rs:5748:19:
Error in alias analysis: error in module ModName("UserApp"), function definition FuncName("\x11\x00\x00\x00\x04\x00\x00\x809\t\xc97\x96\xfd\xd8j"), definition of value binding ValueId(40): expected type 'union { (((heap_cell,), ()),), ((),) }', found type 'union { (), (), ((heap_cell,),), (), (), (), () }'
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
app [main!] { pf: platform "../platform/main.roc" }

import pf.Stdout

main! = \{} ->
    # Prints out each of the authors
    print! ["Foo", "Bar", "Baz"]

print! : List Str => Result {} _
print! = \authors ->
    when authors is
        [] -> Ok {}
        [author, .. as rest] ->
            try Stdout.line! author
            print! rest