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.
This commit is contained in:
@@ -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"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user