Files
sx/examples/1141-diagnostics-reserved-name-type-decl.sx
agra 811a280517 refactor(ffi-linkage): Phase 9.3 — purge 'foreign' from comments (src caps + examples + docs)
src/: ~21 capital-Foreign comments the case-sensitive verify grep missed
(Foreign-class→Runtime-class, Foreign path→Runtime path, Foreign decls→Extern decls,
FOREIGN function→extern function) across calls/inst/ffi_objc/jni_descriptor/emit_llvm/
c_import/lower.*/ops. src 'foreign' now = ONLY the hash_foreign token + 4 rejection
messages (9.0-delete targets). examples/*.sx comments → extern/runtime-class (1219
stdout regen; KEPT 1176). docs/inline-asm-design + debugger purged. Comments only —
no build impact. 9.0 ratified: DELETE hash_foreign token next.
2026-06-15 10:52:56 +03:00

23 lines
915 B
Plaintext

// A reserved/builtin type-name spelling is rejected as the NAME of EVERY
// type-introducing `::` declaration too — struct, enum, union, error-set, and
// a typed constant — not just `:=` / value-const / function names (those are
// examples/1140). Each is a declaration-name binding site: a bare reserved
// spelling there mis-classifies and is rejected, exactly like `i2 := …`. The
// backtick escape (`` `i2 :: struct{…} ``, examples/0154) is the only way to
// spell these names in handwritten sx; `#import c` extern decls stay exempt
// (examples/1220).
//
// Regression (issue 0089 — attempt-4: 0076 holds across every decl kind).
// Expected: one error per declaration, each caret ON the declared name; exit 1.
#import "modules/std.sx";
i8 :: struct { v: i64; }
i16 :: enum { A; B; }
u16 :: union { a: i32; b: f32; }
u32 :: error { Bad, Empty }
i2 : i64 : 5;
main :: () -> i32 {
return 0;
}