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
Selective imports are not selective: use m.X makes every public name of m visible #1744
Spec: §18.2 — "Names are imported with use" (use std.collections.{HashMap, HashSet}, use math.vector.{Vec3, dot, cross}); a named import introduces the names it selects.
Repro (base = branch gen-push-impl d06b5bc release binary; installed main the same):
sa.w
pub let X = 1
pub let Y = 5
pub fn fy() -> i32: 6
s1.w
use sa.X
fn main:
print(Y)
print(fy())
Actual: prints 5 and 6. Resolve maps use sa.X to an import edge to sa.w and Sema's visibility (module_is_visible_from_current / decl_visible_from_current) asks only whether the module is imported, so the selection is ignored.
Expected:Y and fy are not visible — an error naming the named import and the spelling that brings them in (use sa.{X, Y, fy} or use sa).
Note: on branch ruled-fixes (#1221) Resolve now records each import's selection (ResolvedImport.selected → Sema.module_import_selected), and precedence between colliding module values uses it; general visibility still ignores it. Enforcing it everywhere may turn existing programs (and the compiler tree) that lean on the leak into errors, so it wants a sweep of the corpora first.
Activity
Sema: a named import introduces only the names it selects (#1744)
Type checker: D74 entry sources and chain moves, field-view bindings (w…