Move examples/*.sx and their expected/ snapshots into per-category subfolders (examples/<category>/...). Folder = leading filename token, with ffi-objc/ffi-jni kept whole; filenames are unchanged. The corpus runner and LSP sweep now discover each category's expected/ dir, while issues/ stays flat. Example 1058's repo-root-relative companion import is made file-relative. Path strings embedded in 164 snapshots were regenerated (path-only changes). Test-layout docs in CLAUDE.md updated.
30 lines
1.2 KiB
Plaintext
30 lines
1.2 KiB
Plaintext
// Regression test for issue-0039 — directory-import scan order.
|
|
//
|
|
// When a directory is imported, the resolver iterates files
|
|
// alphabetically. Inside the directory, `aaa_uses.sx` comes BEFORE
|
|
// `types.sx` but its `make_my` returns `MyEnum` (defined in
|
|
// `types.sx`). The combined directory module must put `aaa_uses.sx`'s
|
|
// transitive imports (which include `MyEnum`) into the global scan
|
|
// stream BEFORE `aaa_uses.sx`'s own decls so the tagged_union for
|
|
// MyEnum is registered before `make_my`'s return type is resolved.
|
|
//
|
|
// Pre-fix, the dir-import implementation appended each file's
|
|
// `own_decls` before its `decls`, which inverted that order and
|
|
// caused `MyEnum` to be registered as a placeholder struct via the
|
|
// `resolveTypeName` fallback. The later `enum_decl` scan then
|
|
// short-circuited via `findByName` and never upgraded the placeholder
|
|
// to the real tagged_union, surfacing as "cannot infer enum type
|
|
// for '.b'" at the `return .b(42)` site.
|
|
|
|
#import "modules/std.sx";
|
|
#import "0707-modules-import-dir-scan-order";
|
|
|
|
main :: () -> i32 {
|
|
e := make_my();
|
|
if e == {
|
|
case .a: { print("a\n"); }
|
|
case .b: (v) { print("b={}\n", v); }
|
|
}
|
|
0
|
|
}
|