Files
sx/examples/diagnostics/1103-diagnostics-err-bad-variant.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

23 lines
610 B
Plaintext

// A match arm with a variant name that doesn't exist on the subject's
// enum/tagged-union produces `error: no variant 'X' on type 'Y'` instead of
// falling back to the arm index (which used to cause duplicate switch cases
// and LLVM verification failures).
#import "modules/std.sx";
Shape :: enum {
circle: f32;
rect: struct { w, h: f32; };
none;
}
main :: () {
s :Shape = .circle(3.14);
if s == {
case .circle: (r) { print("r={}\n", r); }
case .Bogus: (x) { print("bogus={}\n", x); }
case .none: print("none\n");
case .rect: print("rect\n");
}
}