From 886626a64e4c64b46d8382d95ab1d0ff7b739fe9 Mon Sep 17 00:00:00 2001 From: bigmerge Date: Mon, 17 Aug 2026 08:40:10 -0500 Subject: [PATCH] seam refusal + control tests: a runtime binding can short-circuit Prediction 3 was FALSE. I expected refusal to be impossible through the seam because the entry indirection discarded its return. One line: { el_val_t __s = el_seam_run(EL_STR(f), 0, 0); if (__s) return __s; } work() returns 7; bound to a refusing construct AFTER the build it returns 42. So three of the five compile-time kinds are runtime-bindable: entry injection, exit injection, and refusal. wraps_body needs invocation control and prohibits_outside is compile-time by nature. 104/104 native compiler tests pass. --- lang/el-compiler/src/codegen.el | 2 +- lang/tests/native/test_compiler.el | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/lang/el-compiler/src/codegen.el b/lang/el-compiler/src/codegen.el index 2eac94a..5fd5761 100644 --- a/lang/el-compiler/src/codegen.el +++ b/lang/el-compiler/src/codegen.el @@ -3208,7 +3208,7 @@ fn cg_entry_seam(stmt: Map, fn_name: String) -> Void { // RUNTIME SEAM: codegen cannot know which constructs will be bound to this // fn after the binary exists, so the indirection is unconditional. What // applies is resolved at execution against a table written later. - emit_line(" el_seam_run(EL_STR(" + c_str_lit(fn_name) + "), 0, 0);") + emit_line(" { el_val_t __s = el_seam_run(EL_STR(" + c_str_lit(fn_name) + "), 0, 0); if (__s) return __s; }") let gdl = stmt["decorators"] let n_gdl: Int = native_list_len(gdl) let gi = 0 diff --git a/lang/tests/native/test_compiler.el b/lang/tests/native/test_compiler.el index ed4ee1b..03988ec 100644 --- a/lang/tests/native/test_compiler.el +++ b/lang/tests/native/test_compiler.el @@ -903,3 +903,24 @@ test "seeded-vbd-prohibition-still-enforced" { let out: String = compile_capture(src) assert str_contains(out, "may only be called from an @manager fn"), "the compiled-in core prohibition survives being declared rather than branched" } + +// ── Runtime seam ───────────────────────────────────────────────────────────── +// +// CONTROL for the finding that a crossing can be resolved at execution rather +// than at emission. Codegen emits one unconditional indirection per fn; which +// constructs apply is read from a table written after the binary exists. + +test "seam-indirection-emitted-on-every-fn" { + let src: String = "fn a() -> Int { return 1 }\nfn b() -> Int { return 2 }" + let out: String = compile_capture(src) + assert str_contains(out, "el_seam_run(EL_STR(\"a\"), 0, 0);"), "fn a carries the indirection" + assert str_contains(out, "el_seam_run(EL_STR(\"b\"), 0, 0);"), "fn b carries the indirection" +} + +test "seam-emitted-without-any-decorator" { + // The point of the seam: source need not mention a construct at all. + let src: String = "fn undecorated() -> Int { return 1 }" + let out: String = compile_capture(src) + assert str_contains(out, "el_seam_run"), "an undecorated fn is still bindable at runtime" + assert !str_contains(out, "engram_boundary_beat"), "and nothing is inlined for it" +}