Files
sx/src/root.zig
agra ff9cb50079 refactor(imports): retain dup same-name fn authors + build identity indexes [0102a]
First of four fix-0102 sub-steps. Purely additive: retains data that the
flat/directory merge currently first-wins-drops and builds two identity
indexes for later bare-name disambiguation (fix-0102c). No resolution
change — the existing first-wins bare path still wins; suite unchanged.

- mergeFlat + directory merge: stop dropping a same-name FUNCTION authored
  by a different module/file. Non-function decls keep first-wins dedup; node
  identity dedup is untouched.
- flat_import_graph: a flat-only subset of import_graph, recording an edge
  only for a bare `#import` (imp.name == null), never a namespaced
  `ns :: #import`. Threaded through resolveImports/resolveDirectoryImport
  and into ProgramIndex.
- module_fns (path -> name -> *const FnDecl): per-module authored-function
  index mirroring module_scopes, built in core.zig from the main module +
  cache. Same-name cross-module authors stay distinct under their own paths.
- imports.test.zig: asserts both a.sx/b.sx greet authors are retained in
  module_fns and in the global flat list, and that flat_import_graph
  excludes the namespaced edge while import_graph includes it.

Gate (this worktree): zig build, zig build test (398/398),
bash tests/run_examples.sh (457 passed) all green.
2026-06-06 11:27:11 +03:00

46 lines
1.9 KiB
Zig

pub const llvm_api = @import("llvm_api.zig");
pub const token = @import("token.zig");
pub const lexer = @import("lexer.zig");
pub const ast = @import("ast.zig");
pub const parser = @import("parser.zig");
pub const print = @import("print.zig");
pub const types = @import("types.zig");
pub const target = @import("target.zig");
pub const builtins = @import("builtins.zig");
pub const errors = @import("errors.zig");
pub const errors_tests = @import("errors.test.zig");
pub const trace_runtime_tests = @import("runtime_trace.test.zig");
pub const sema = @import("sema.zig");
pub const sema_tests = @import("sema.test.zig");
pub const imports = @import("imports.zig");
pub const imports_tests = @import("imports.test.zig");
pub const core = @import("core.zig");
pub const c_import = @import("c_import.zig");
pub const ir = @import("ir/ir.zig");
pub const lsp = struct {
pub const server = @import("lsp/server.zig");
pub const transport = @import("lsp/transport.zig");
pub const types = @import("lsp/types.zig");
pub const document = @import("lsp/document.zig");
pub const document_tests = @import("lsp/document.test.zig");
pub const corpus_sweep_tests = @import("lsp/corpus_sweep.test.zig");
};
test {
// Discover every test in the module graph so `zig build test` actually
// runs them. Without this, the test binary finds no `test` blocks at the
// root and trivially "passes" while exercising nothing. Nested barrels
// (e.g. ir/ir.zig) carry their own `test { refAllDecls }`, so this chains
// into them.
@import("std").testing.refAllDecls(@This());
// refAllDecls only reaches the top-level decls; the `lsp` files live one
// struct deeper, so reference them directly to pull in their tests.
_ = lsp.server;
_ = lsp.document;
_ = lsp.document_tests;
_ = lsp.corpus_sweep_tests;
_ = lsp.types;
_ = lsp.transport;
}