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
D114-exposed: an untyped const used in an imported module loses its type context when the root declares a global of the same name #2333
// owner.w
pub const A = 10
const B = 3
pub fn f() -> i32: A * B
// main2.w
use owner
let A = 5
fn main:
print(f() + A)
Actual: owner.w:3:20: implicit integer narrowing or sign change from isize to i32 on A * B.
Expected: A * B is typed i32 by the declared return; prints 35.
Narrowed (lldb + variants):
Without the root global (main1), or with a differently named root global (let Z = 5), or with let A = 5 as a local inside main: no error.
check_untyped_const_use runs for both uses in owner.w (untyped path taken), but ty stays the declared default (isize): no expected type reaches it.
check_fn_body_with_sig_at gives f (sig 655) body_expected_ret = i32 both times it is checked; the lost demand is between there and the operand. Not yet located at the line.
On main the default literal type was i32, so the missing context was invisible. Found by the D114 behavior-test sweep; the #1703 fixture was restored to plain let globals (: i32), which tests displaced globals without this path.
Fixed on branch d115-d120 (commit b8ce24c, stacked for the next battery): untyped_const_init_depth now follows the displaced record whose path is the current module, so a module's own untyped constant that a same-named root declaration displaced (registered under its $in$ identity) is found from the module's bare name. Fixture: test/behavior/behav_2333_displaced_untyped_const.w with test/behavior/lib/displaced_const_owner.w (prints 35).
Fixed on branch d115-d120 (commit b8ce24c, stacked for the next battery): untyped_const_init_depth follows the displaced record whose path is the current module, so a module's own untyped constant that a same-named root declaration displaced (registered under its $in$ identity) is found from the module's bare name. Fixture: test/behavior/behav_2333_displaced_untyped_const.w with test/behavior/lib/displaced_const_owner.w (prints 35).
Activity
ehartford commentedon Oct 11, 2026
Fixed on branch d115-d120 (commit b8ce24c, stacked for the next battery):
untyped_const_init_depthnow follows the displaced record whose path is the current module, so a module's own untyped constant that a same-named root declaration displaced (registered under its$in$identity) is found from the module's bare name. Fixture: test/behavior/behav_2333_displaced_untyped_const.w with test/behavior/lib/displaced_const_owner.w (prints 35).ehartford commentedon Oct 11, 2026
Fixed on branch d115-d120 (commit b8ce24c, stacked for the next battery):
untyped_const_init_depthfollows the displaced record whose path is the current module, so a module's own untyped constant that a same-named root declaration displaced (registered under its$in$identity) is found from the module's bare name. Fixture: test/behavior/behav_2333_displaced_untyped_const.w with test/behavior/lib/displaced_const_owner.w (prints 35).D114/D128 gaps (#2333, #2336, #2343), D111 clones (#2271), D115 Amend…
ehartford commentedon Oct 11, 2026
Merged to main in e4861e1 (#2349), battery green.