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.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
// Own-wins for ENUM-PAYLOAD type registration over a NAMESPACED import.
|
||||
// Regression (issue 0132, broader class).
|
||||
//
|
||||
// `#import "modules/std.sx"` carries the stdlib `event.Event` struct — it is
|
||||
// NAMESPACED (reachable only as `event.Event`), never flat-visible. This file
|
||||
// ALSO authors its OWN `Event :: struct { code }`, used as the payload of the
|
||||
// enum `Wrap`. The payload type name `Event` must resolve at REGISTRATION to
|
||||
// THIS file's own `Event` (which has `code`), not the namespaced stdlib struct.
|
||||
//
|
||||
// Fail-before: `registerEnumDecl` built the tagged-union body through the
|
||||
// stateless `type_bridge.buildEnumInfo`, whose flat `findByName` picked the
|
||||
// wrong same-name author — `got`'s payload became the stdlib `Event`, so
|
||||
// `e.code` errored "field 'code' not found on type 'Event'". Fixed by threading
|
||||
// the visibility-aware resolver (`*Lowering` as the `resolveInner` hook) through
|
||||
// `buildEnumInfo` / `buildUnionInfo`, matching what `registerStructDecl` already
|
||||
// does for struct fields.
|
||||
|
||||
#import "modules/std.sx";
|
||||
|
||||
Event :: struct { code: i64; }
|
||||
Wrap :: enum { none; got: Event; }
|
||||
|
||||
main :: () {
|
||||
w : Wrap = .got(.{ code = 7 });
|
||||
if w == {
|
||||
case .got: (e) { print("code={}\n", e.code); }
|
||||
case .none: print("none\n");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user