✓
Passing This code compiles and runs correctly.
Code
// Pins that a package reached as a DIRECTORY and as its own `index` FILE is
// ONE module, not two.
//
// `import mylib` resolves to the directory; `import mylib/helper` inside that
// directory's index makes the compiler synthesize an `mylib/index` import,
// which resolves to the FILE. Both name the same module, and dedup keyed on the
// resolved path, so the two spellings never matched and the package was
// imported twice.
//
// Module declarations are grouped by logical name and emitted into one Zig
// struct, so everything in index.kz was emitted twice: `duplicate struct member
// name 'std'` from the two copies of its host line — which reads like a
// submodule colliding with its parent and is nothing of the sort — plus a
// duplicate of every declaration under it.
//
// The sibling itself is reached twice too (as a directory submodule and as the
// explicit file import), so it pins the same property one level down.
~import mylib
~mylib:greet(n: 1)
~mylib/helper:helper-say(n: 2)
Actual
greet 1
helper 2
Expected output
greet 1
helper 2
Flows
flow ~greet click a branch to expand · @labels scroll to their anchor
greet (n: 1)
flow ~helper-say click a branch to expand · @labels scroll to their anchor
helper-say (n: 2)
Imported Files
// A sibling of the package index. Importing it from index.kz is what used to
// make the whole package arrive twice.
const std = @import("std");
~pub tor helper-say { n: i32 }
~proc helper-say|zig {
std.debug.print("helper {}\n", .{n});
}
// The package index, which imports its own sibling by qualified name. That
// import synthesizes an `mylib/index` file import behind the scenes — the same
// module the entry already reached as a directory.
~import mylib/helper
const std = @import("std");
~pub tor greet { n: i32 }
~proc greet|zig {
std.debug.print("greet {}\n", .{n});
}
Test Configuration
MUST_RUN