Value-const SELECTION was source-aware for emission/folding (F2/R1/F1), but expression TYPE inference still read the global last-wins `module_const_map`, so an inferred return type / coercion on a same-name const borrowed another module's const TYPE (mixed-type same-name consts were never exercised by the attempt-1 same-typed goldens). - expr_typer.zig: the `.identifier` const path now selects via the source-aware `selectModuleConst` (own-wins / one-flat-visible) instead of the global `module_const_map`. The global map still gates "is this a const name?"; an unpartitioned registration-only author emits its global type, and an ambiguous bare reference yields `.unresolved` (the emission path diagnoses loudly). - lower.zig: expose `selectModuleConst` so the type-inference path shares the one author selector emission/folding already use. Audited every `module_const_map` read: emission (4102) and global-init copy (1447) were already source-aware (attempt-1); the binds-a-value predicate (6400) is a boolean, not a type read; the in-`selectModuleConst` read (13842) is the unwired fallback. No sibling inference site leaks. examples: 0793 mixed-type own-wins inference (A's `K:s32` yields `1`, not the global `f64`'s `1.000000`); 0794 mixed-type bare → loud ambiguous (exit 1), the inference change does not mask the ambiguity. Prior E5 surfaces (0786-0792), the 0105 set (0752-0758), E1-E4 type surfaces (0763-0785) and FFI byte-identical; 533 markers green.
16 lines
770 B
Plaintext
16 lines
770 B
Plaintext
// issue 0105 / F4 — same-name VALUE const with DIFFERENT declared TYPES across
|
|
// two flat-imported modules (A: `s32`, B: `f64`), referenced bare at a mixed-type
|
|
// site. A bare `K` here is genuinely ambiguous — there are ≥2 flat-visible same-
|
|
// name authors — so it must diagnose loudly (exit 1), exactly as the same-typed
|
|
// 0787 does. The type-inference change must NOT mask the ambiguity (inferring
|
|
// `.unresolved` for the ambiguous reference) — the emission path still fires the
|
|
// loud author-count diagnostic regardless of the consts' declared types.
|
|
#import "modules/std.sx";
|
|
#import "0794-modules-same-name-const-type-ambiguous/a.sx";
|
|
#import "0794-modules-same-name-const-type-ambiguous/b.sx";
|
|
|
|
main :: () -> s32 {
|
|
print("K={}\n", K);
|
|
0
|
|
}
|