You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Imported type aliases in struct fields pass 'with check' but fail codegen with 'unresolved type' #31
A type alias imported from another module works in function signatures, but if you use that imported alias as a struct field type, with check says ok and with run fails during codegen:
error: unresolved type for field 'device' in struct 'Pair'
error: code generation failed
error: run failed
Minimal repro
mkdir -p /tmp/wbug/lib/demo
cat > /tmp/wbug/lib/demo/core.w <<'EOF'pub type Device = i64EOF
cat > /tmp/wbug/lib/demo/program.w <<'EOF'use demo.coretype Pair = { device: Device,}pub fn ok(device: Device) -> bool: let pair = Pair { device } pair.device == deviceEOF
cat > /tmp/wbug/main.w <<'EOF'use demo.programfn main: assert(ok(7))EOFcd /tmp/wbug && with check main.w # says okcd /tmp/wbug && with run main.w # fails in codegen
Control case
The same pattern works if the alias is defined in the same file instead of imported:
type Device = i64
type Pair = {
device: Device,
}
fn main:
let pair = Pair { device: 7 }
assert(pair.device == 7)
That checks and runs successfully.
Expected behavior
Imported aliases should lower exactly like local aliases. The repro above should compile and run.
If there is some unsupported case here, the compiler should reject it during with check with a precise diagnostic instead of reaching codegen and reporting unresolved type.
Why this matters
This blocks any library that exposes opaque handles as public aliases in one module and then uses those aliases in runtime structs in another module. Crux uses this pattern for Device, Program, Stream, and similar handle types.
Activity
Resolve imported aliases in aggregate field codegen
Discriminants are i64 end to end: Sema computes them from the literal…
Discriminants are i64 end to end: Sema computes them from the literal…
Discriminants are i64 end to end: Sema computes them from the literal…
Fix resolution audit heap construction for fewer than two spans
analyze: audit:resolution phase 1 — every MIR callee agrees with Sema…