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

Error in alias analysis #18

Open
lorentzlasson opened this issue Jan 5, 2024 · 1 comment
Open

Error in alias analysis #18

lorentzlasson opened this issue Jan 5, 2024 · 1 comment

Comments

@lorentzlasson
Copy link

lorentzlasson commented Jan 5, 2024

When I run this (with latest source or 0.1 release)

app "repro"
    packages {
        # pf: "../basic-webserver/platform/main.roc",
        pf: "https://github.com/roc-lang/basic-webserver/releases/download/0.1/dCL3KsovvV-8A5D_W_0X_abynkcRcoAngsgF0xtvQsk.tar.br",
    }
    imports [
        pf.Task.{ Task },
        pf.Stdout,

        # Unused but needed to build
        pf.Http,
    ]

    provides [main] to pf

main = \_ ->
    when A is
        A ->
            {} <- Stdout.line "" |> Task.await
            respond

        _ ->
            respond

respond =
    Task.ok {
        status: 200,
        headers: [],
        body: [],
    }

I get this

$ RUST_BACKTRACE=full roc build repro.roc

── UNUSED IMPORT ─────────────────────────────────────────────────── repro.roc ─

Nothing from Http is used in this module.

11│          pf.Http,
             ^^^^^^^

Since Http isn't used, you don't need to import it.

────────────────────────────────────────────────────────────────────────────────

thread 'main' panicked at 'Error in alias analysis: error in module ModName("UserApp"), function definition FuncName("\x12\x00\x00\x00\x02\x00\x00\x00B\xf6\xc1\x05.\xbf\xec\xc7"), definition of value binding ValueId(3): could not find func in module ModName("UserApp") with name FuncName("%\x00\x00\x00\x04\x00\x00\x00B\xf6\xc1\x05.\xbf\xec\xc7")', crates/compiler/gen_llvm/src/llvm/build.rs:5743:19
stack backtrace:
   0:     0x555b894dded3 - <unknown>
   1:     0x555b8884717f - <unknown>
   2:     0x555b894d98a7 - <unknown>
   3:     0x555b894ddca5 - <unknown>
   4:     0x555b894df860 - <unknown>
   5:     0x555b894df624 - <unknown>
   6:     0x555b894dfd69 - <unknown>
   7:     0x555b894dfc74 - <unknown>
   8:     0x555b894de526 - <unknown>
   9:     0x555b894df9f2 - <unknown>
  10:     0x555b88746ea3 - <unknown>
  11:     0x555b88d7ee6c - <unknown>
  12:     0x555b88d78068 - <unknown>
  13:     0x555b88a43ccf - <unknown>
  14:     0x555b88a48319 - <unknown>
  15:     0x555b88a4705c - <unknown>
  16:     0x555b88b33d40 - <unknown>
  17:     0x555b88a15949 - <unknown>
  18:     0x555b88a094d3 - <unknown>
  19:     0x555b88a094f3 - <unknown>
  20:     0x555b894d0a45 - <unknown>
  21:     0x555b88a17d05 - <unknown>
  22:     0x7fb2b4229d90 - __libc_start_call_main
                               at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
  23:     0x7fb2b4229e40 - __libc_start_main_impl
                               at ./csu/../csu/libc-start.c:392:3
  24:     0x555b887dbe3e - <unknown>
  25:                0x0 - <unknown>

But if I remove the stdout line

@@ -16,7 +16,7 @@ app "repro"
 main = \_ ->
     when A is
         A ->
-            {} <- Stdout.line "" |> Task.await
+            # {} <- Stdout.line "" |> Task.await
             respond

         _ ->

or if I inline one of the task (which one doesn't matter)

@@ -20,7 +20,11 @@ main = \_ ->
             respond

         _ ->
-            respond
+            Task.ok {
+                status: 200,
+                headers: [],
+                body: [],
+            }

it compiles.

This is the minimal example I can come up with. Not sure if issues belongs here or for the compiler, but I haven't been able to repro with the basic-cli platform.

I am on ubuntu 22

@Anton-4
Copy link
Collaborator

Anton-4 commented Jan 5, 2024

Thanks for reporting @lorentzlasson!
This should be roc-lang/roc#5701 but we can leave this open to make sure this is also fixed when 5701 is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants