-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.
Milestone
Description
Zig Version
0.10.0-dev.4213+91b05ad47
Steps to Reproduce
Compile test program with zig test name_resolution_error/file_1.zig.
Three files to reproduce:
name_resolution_error/imports.zig:
const file_0 = @import("./file_0.zig");
const file_1 = @import("./file_1.zig");
pub usingnamespace file_0;
pub usingnamespace file_1;name_resolution_error/file_0.zig:
pub const A = struct {};name_resolution_error/file_1.zig:
const imports = @import("./imports.zig");
const A = struct {};
test {
_ = @as(imports.A, undefined);
}Expected Behavior
Public A declared in file_0 is resolved unambiguously via imports namespace. As with stage 1:
$ zig test -fstage1 name_resolution_error/file_1.zig
All 1 tests passed.
Namespace name_resolution_error/imports.zig behaviour equivalent to:
const file_0 = @import("./file_0.zig");
const file_1 = @import("./file_1.zig");
pub const A = file_0.A;Actual Behavior
As is, private A declared in file_1 exposed by imports:
$ zig test name_resolution_error/file_1.zig
name_resolution_error/file_1.zig:7:20: error: ambiguous reference
_ = @as(imports.A, undefined);
~~~~~~~^~
name_resolution_error/file_0.zig:4:5: note: declared here
pub const A = struct {};
~~~~^~~~~~~~~~~~~~~~~~~
name_resolution_error/file_1.zig:4:1: note: declared here
const A = struct {};
^~~~~~~~~~~~~~~~~~~
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.