ffi 2.6 green: #jni_method_descriptor("(Sig)Ret") override

New `hash_jni_method_descriptor` lexer token + LSP keyword
classification. `JniMethodDecl` gains `desc_override: ?[]const u8`.
parseJniClassDecl accepts an optional `#jni_method_descriptor("...")`
clause between the return type and the terminating `;`, stashing the
literal as the override. Auto-derivation in Phase 2.8 will treat
this as the precedence override when present.

The 2.6 xfail commit (0ed4799) used the working name `#desc` in its
test file; this commit renames to `#jni_method_descriptor` for
parallel naming with the rest of the FFI directive set (`#jni_call`,
`#jni_class`, `#jni_env`, ...). Test snapshot flips xfail → green.

125/125 examples green.
This commit is contained in:
agra
2026-05-20 10:10:23 +03:00
parent 0ed4799f5f
commit 11021d800d
8 changed files with 29 additions and 10 deletions

View File

@@ -1,17 +1,17 @@
// Phase 2 step 2.6 (PLAN-FFI.md): xfail then green for the
// `#desc("(Sig)Ret")` per-method JNI-descriptor override.
// `#jni_method_descriptor("(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.
// The default descriptor is derived from sx types (Phase 2.8); this
// directive 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 `;`.
#import "modules/std.sx";
Foo :: #jni_class("com/example/Foo") {
weirdMethod :: (self: *Self) -> s32 #desc("()I");
weirdMethod :: (self: *Self) -> s32 #jni_method_descriptor("()I");
}
main :: () -> s32 {