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

A possible compiler bug in WasmGC backend #433

Open
FlammeShadow opened this issue Jan 20, 2025 · 1 comment
Open

A possible compiler bug in WasmGC backend #433

FlammeShadow opened this issue Jan 20, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@FlammeShadow
Copy link

FlammeShadow commented Jan 20, 2025

The following code cannot be built by WasmGC backend, but outputs K1(T1(12)) in Wasm backend.

enum Test {
  T1(Int)
  T2
  T3
} derive(Show)

type K1 Test derive(Show)

type K2 Test derive(Show)

struct S {
  a : K1?
  b : K2?
} derive(Show)

fn meth(self : S) -> Unit {
  match self.a {
    Some(K1(T1(_)) as a) => println(a)
    Some(K1(T2)) => println("T2")
  }
}

test {
  let s = { a: Some(T1(12)), b: Some(T2) }
  s.meth()
}

The code will be successfully compiled if we delete as a in Some(K1(T1(_)) as a) => println(a). Or it will report ICE:

Error: Moonc.Basic_hash_string.Key_not_found("$Test.K1")```
@Yu-zh
Copy link
Collaborator

Yu-zh commented Jan 20, 2025

Thanks for reporting the bug. We will have it fixed in the next release.

@peter-jerry-ye peter-jerry-ye added the bug Something isn't working label Jan 26, 2025
@peter-jerry-ye peter-jerry-ye added this to the Readthedocs 2025/02/10 milestone Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants