Files
sx/examples/modules/0761-modules-imported-generic-undeclared-field.sx
agra 66bdc70bf1 test: group examples into per-category folders
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.
2026-06-21 14:41:34 +03:00

20 lines
856 B
Plaintext

// A genuinely-undeclared type in an IMPORTED GENERIC struct field must emit
// "unknown type" even when the struct is instantiated from the main file —
// 0759 only covered a non-generic imported struct instantiated in-module.
// Before the fix the generic template's fields resolved in the main-file
// instantiation context, so the leaf trusted them as main-file decls and
// silently stubbed `Missing` (the program compiled and printed `b.x`). The
// template's fields now resolve in the template's own source context, so the
// undeclared name surfaces.
//
// Expected: `error: unknown type 'Missing'` pointing into lib.sx; exit 1.
// Regression (stdlib E3).
#import "modules/std.sx";
#import "0761-modules-imported-generic-undeclared-field/lib.sx";
main :: () -> i32 {
b : Bad(i32) = .{ x = 1, y = 2 };
print("{}\n", b.x);
return 0;
}