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:
agra
2026-05-20 10:06:22 +03:00
parent a703eeec2a
commit 0ed4799f5f
3 changed files with 22 additions and 0 deletions

View 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;
}

View File

@@ -0,0 +1 @@
1

View File

@@ -0,0 +1 @@
/Users/agra/projects/sx/examples/ffi-jni-class-06-desc.sx:14:41: error: expected ';'