Files
sx/examples/1174-diagnostics-foreign-postfix-conflict.sx

16 lines
698 B
Plaintext

// Phase 4 (FFI-linkage) interplay diagnostic: the prefix `#foreign` linkage
// modifier and the postfix `extern`/`export` keyword are two spellings of the
// same axis — combining them on one aggregate is contradictory (`#foreign`
// means import, `export` means define) or redundant (`#foreign … extern`).
// The parser rejects the combo at the postfix keyword instead of silently
// letting the postfix override `#foreign` (which previously surfaced as a
// confusing internal "compiler bug" diagnostic during class synthesis).
//
// Expected: one error caret on the `export` keyword; exit 1.
C :: #foreign #objc_class("NSObject") export {
alloc :: () -> *C;
}
main :: () -> i32 { 0 }