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
Struct literal defaults resolve in the literal's module, not the type's: ActionFrame {} needs use game for a default's V2 #2400
A struct literal that relies on field defaults fails to compile in a module that does not import the types those defaults mention, even though the defaults are written in the defining module.
In WIPE, src/controls.w declares:
use game // V2
pub type ActionFrame {
id: u64 = 0,
motion: V2 = V2 {}, aim: V2 = V2 {},
held: u32 = 0, pressed: u32 = 0,
} with Copy
src/steam_uat.w imports controls but not game, and writes var frame = ActionFrame {}. The compiler reports:
error: unknown type 'V2' in struct literal
error: unknown type 'V2' in struct literal
Adding use game to steam_uat.w makes it compile, although steam_uat.w never names V2.
Expected
A field default is part of the type's definition, so it should resolve in the scope of the module that defines the type (controls.w, where V2 is in scope), not in the scope of each literal that omits the field. A caller should not have to know which types a default expression mentions.
Where
With: nightly-20261003-local-1-074a38b8fd81 on macOS (the compiler WIPE builds with on 2026-10-13).
WIPE: withlang-dev/wipe, commit after "Steam Input proper" (src/controls.w, src/steam_uat.w).
Fixed on main (b050a01, PR #2587, stack #2588): one commit with the fixture test/behavior/behav_2400_field_default_in_declaring_module.w, which failed before the fix and passes after; battery GREEN on the stack top 077d684 (669 s, pinned seed nightly-20261023-local-1).
Activity
A field's default is checked in its declaring module at every literal (…
Six fixes from the issue backlog: #2545, #2524, #2334, #2325, #2443, #…
ehartford commentedon Oct 23, 2026
Fixed on main (b050a01, PR #2587, stack #2588): one commit with the fixture
test/behavior/behav_2400_field_default_in_declaring_module.w, which failed before the fix and passes after; battery GREEN on the stack top 077d684 (669 s, pinned seed nightly-20261023-local-1).