test(ffi-linkage): xfail #foreign+postfix conflict diagnostic (Phase 4)
This commit is contained in:
15
examples/1174-diagnostics-foreign-postfix-conflict.sx
Normal file
15
examples/1174-diagnostics-foreign-postfix-conflict.sx
Normal 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 }
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
1
|
||||||
@@ -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 {
|
||||||
|
| ^^^^^^
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
Reference in New Issue
Block a user