ffi 2.6 xfail: #desc("(Sig)Ret") per-method JNI descriptor override
`weirdMethod :: (self: *Self) -> s32 #desc("()I");` should parse,
today's 2.5 parser expects `;` immediately after the return type
and errors at the `#desc` token. The make-green follow-up adds a
`hash_desc` lexer token and threads an optional `desc_override`
field through `JniMethodDecl`.
This commit is contained in:
20
examples/ffi-jni-class-06-desc.sx
Normal file
20
examples/ffi-jni-class-06-desc.sx
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
// Phase 2 step 2.6 (PLAN-FFI.md): xfail then green for the
|
||||||
|
// `#desc("(Sig)Ret")` per-method JNI-descriptor override.
|
||||||
|
//
|
||||||
|
// The default descriptor is derived from sx types (Phase 2.8); `#desc`
|
||||||
|
// is the escape hatch when the auto-derived signature doesn't match
|
||||||
|
// (e.g., synthetic methods, ambiguous overloads, accessing JNI
|
||||||
|
// internals). It appears trailing the method's return type, before
|
||||||
|
// the terminating `;`. Today the parser expects `;` immediately after
|
||||||
|
// the return type and errors at the `#desc` token.
|
||||||
|
|
||||||
|
#import "modules/std.sx";
|
||||||
|
|
||||||
|
Foo :: #jni_class("com/example/Foo") {
|
||||||
|
weirdMethod :: (self: *Self) -> s32 #desc("()I");
|
||||||
|
}
|
||||||
|
|
||||||
|
main :: () -> s32 {
|
||||||
|
print("parse-only ok\n");
|
||||||
|
0;
|
||||||
|
}
|
||||||
1
tests/expected/ffi-jni-class-06-desc.exit
Normal file
1
tests/expected/ffi-jni-class-06-desc.exit
Normal file
@@ -0,0 +1 @@
|
|||||||
|
1
|
||||||
1
tests/expected/ffi-jni-class-06-desc.txt
Normal file
1
tests/expected/ffi-jni-class-06-desc.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/Users/agra/projects/sx/examples/ffi-jni-class-06-desc.sx:14:41: error: expected ';'
|
||||||
Reference in New Issue
Block a user