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
Two modules that each c_import: the root's c_import expansion binds the other module's private C scalar aliases (c_uint, c_ulonglong) #1372
Found while sweeping for #1362. Pre-existing on the #1364 branch's stage2 (a9b7fc3) and on the installed compiler.
A program whose root module and an imported module each use c_import(...) does not compile: the root's c_import expansion references the C scalar aliases (c_uint, c_ulonglong, ...) and they resolve to the imported module's private copies.
// cu.w
use c_import("<stdio.h>")
pub fn greet() -> str: "hi"
// m.w
use cu
use c_import("<stdlib.h>")
fn main:
print(greet())
print(f"{abs(-3)}")
with run m.w:
error: symbol 'c_ulonglong' is private to module 'cu.w'
--> <c_import <stdlib.h>>:10:46
10 | type __darwin_arm_exception_state64 { __far: c_ulonglong = 0, __esr: c_uint = 0, __exception: c_uint = 0 }
Expected: each module's c_import surface is its own (the root sees its own c_uint); both programs compile (m.w without use cu runs and prints 3).
With the #1362 gate fix the diagnostic changes to 'c_uint' requires an explicit import (§18.1); add: use std.re.defs.c_uint: once cu.w's copy is invisible, the only other candidate is the pcre2 corpus's alias, which used to leak through the prelude. That fix-it is wrong for this program; the defect is the missing root-module alias. Legacy repro in-tree: tests/cimport_scope/test_own_ci.w (fails before and after).
Activity
Sema/Frontend: bundle internals need a `use` (§18.2); a bundle interf…
Sema/Frontend: bundle internals need a `use` (§18.2); a bundle interf…
Sema/Frontend: bundle internals need a `use` (§18.2); a bundle interf…
Sema/Frontend: engine corpora never ambient (§18.2); bundle interface…
Sema: a module that uses c_import resolves the program's C types as i…
Sema: a module that uses c_import resolves the program's C types as i…