Files
sx/examples/59-err-bad-variant.sx
agra 1c32d54e01 ios + ir cleanup
- ios: --target ios/ios-sim shorthands, iOS SDK auto-discovery,
  #framework directive + BuildOptions.add_framework hook,
  .app bundle + Info.plist + codesign (ad-hoc and real),
  --codesign-identity/--provisioning-profile/--entitlements flags,
  modules/std/{objc,uikit}.sx, dynamic class registration,
  typed objc_msgSend cast pattern, UIApplicationMain handoff,
  UIWindow scene attach. Runs on iPhone hardware.
- ir: silent .s64 defaults → loud diagnostics,
  resolveReturnType infers from body, sub-byte int sizes match LLVM,
  tuple type interning includes names, compile errors exit 1
- issue-NNNN convention: resolved bugs rename to focused features
- 50 regression tests passing
2026-05-17 13:19:08 +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");
}
}