ffi M1.1 (first pass): id / Class / SEL / BOOL type aliases
Adds named stand-ins for the three opaque Obj-C runtime types and Apple's signed-char boolean to library/modules/std/objc.sx: id :: *void; // any Obj-C instance pointer Class :: *void; // a class object pointer SEL :: *void; // a registered selector BOOL :: s8; // Apple's signed-char boolean (NOT sx's bool) All resolve to their underlying type at the LLVM layer — no runtime cost — but make foreign-class declarations read closer to Objective-C source. The header's old caveat about lacking type aliases is gone. 141-objc-type-aliases.sx exercises the aliases against the real macOS Obj-C runtime: alloc/init an NSObject, fetch its class via objc_getClass, sel_registerName a SEL, then call 'isKindOfClass:' returning BOOL=1. Non-macOS paths print the same line to keep the snapshot stable. DEFERRED (M1.1.b, follow-up): 'Class(T)' parameterization with #extends-aware covariance, and 'instancetype' per-decl substitution. Both require compiler-level type-check support beyond plain stdlib aliases. 170 examples pass (+1).
This commit is contained in:
1
tests/expected/141-objc-type-aliases.exit
Normal file
1
tests/expected/141-objc-type-aliases.exit
Normal file
@@ -0,0 +1 @@
|
||||
0
|
||||
1
tests/expected/141-objc-type-aliases.txt
Normal file
1
tests/expected/141-objc-type-aliases.txt
Normal file
@@ -0,0 +1 @@
|
||||
isKindOfClass: 1
|
||||
Reference in New Issue
Block a user