test(ffi-linkage): xfail #foreign+postfix conflict diagnostic (Phase 4)

This commit is contained in:
agra
2026-06-14 15:37:25 +03:00
parent 5d4a2c26c1
commit dd927c2e94
4 changed files with 22 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
// 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 }

View File

@@ -0,0 +1 @@
1

View File

@@ -0,0 +1,5 @@
error: conflicting linkage: prefix '#foreign' cannot be combined with postfix 'export'; use either '#foreign' or postfix 'extern'/'export', not both
--> examples/1174-diagnostics-foreign-postfix-conflict.sx:11:39
|
11 | C :: #foreign #objc_class("NSObject") export {
| ^^^^^^