From 83480b3a663fe87df3468e65f3b906ec5b6bb868 Mon Sep 17 00:00:00 2001 From: agra Date: Tue, 19 May 2026 12:46:53 +0300 Subject: [PATCH] ffi 1.2: parser coverage for #jni_call and #jni_static_call 99/99 regression tests pass (+ffi-jni-call-01-parse). Locks in the same parse-surface contract for the JNI intrinsics that ffi-objc-call-01-parse pins for the Obj-C side: #jni_call(*void)(null, null, "getWindow", "()Landroid/view/Window;"); #jni_static_call(s32)(null, null, "max", "(II)I", 3, 7); #jni_call(bool)(null, null, "isShown", "()Z"); All three lower through the shared `FfiIntrinsicCall` AST node added in 1.1; only the kind tag distinguishes them. `inline if false` keeps sema/codegen out of the picture until later phase-1 steps wire those in. --- examples/ffi-jni-call-01-parse.sx | 24 +++++++++++++++++++++++ tests/expected/ffi-jni-call-01-parse.exit | 1 + tests/expected/ffi-jni-call-01-parse.txt | 1 + 3 files changed, 26 insertions(+) create mode 100644 examples/ffi-jni-call-01-parse.sx create mode 100644 tests/expected/ffi-jni-call-01-parse.exit create mode 100644 tests/expected/ffi-jni-call-01-parse.txt diff --git a/examples/ffi-jni-call-01-parse.sx b/examples/ffi-jni-call-01-parse.sx new file mode 100644 index 0000000..2180082 --- /dev/null +++ b/examples/ffi-jni-call-01-parse.sx @@ -0,0 +1,24 @@ +// Phase 1 step 1.2 (PLAN-FFI.md): parser coverage for `#jni_call` +// and `#jni_static_call`. Same `#(ReturnT)(args...)` +// shape as `#objc_call`; lands green on the existing parse rule +// (Phase 1.1 added all three). +// +// `inline if false` suppresses sema/codegen — the lowering arrives +// in Phase 1.15+; this file pins the parse surface only. + +#import "modules/std.sx"; + +main :: () -> s32 { + inline if false { + // Instance method: env, target, name, sig, args... + #jni_call(*void)(null, null, "getWindow", "()Landroid/view/Window;"); + + // Static method: env, class, name, sig, args... + #jni_static_call(s32)(null, null, "max", "(II)I", 3, 7); + + // Returning a Java primitive (jboolean → sx bool). + #jni_call(bool)(null, null, "isShown", "()Z"); + } + print("parse-only ok\n"); + 0; +} diff --git a/tests/expected/ffi-jni-call-01-parse.exit b/tests/expected/ffi-jni-call-01-parse.exit new file mode 100644 index 0000000..573541a --- /dev/null +++ b/tests/expected/ffi-jni-call-01-parse.exit @@ -0,0 +1 @@ +0 diff --git a/tests/expected/ffi-jni-call-01-parse.txt b/tests/expected/ffi-jni-call-01-parse.txt new file mode 100644 index 0000000..2ef3b99 --- /dev/null +++ b/tests/expected/ffi-jni-call-01-parse.txt @@ -0,0 +1 @@ +parse-only ok