Fix transpiler append! emit for mutable globals + run_with_io error recovery
The transpiler's append! emit path didn't check ml-is-mutable-global?, so (append! *provide-batch-queue* sub) wrote to a dead local variable instead of the global _ref. This caused the combined test suite hang — fire-provide-subscribers was silently broken before the local-ref shadow removal, and now correctly modifies the global batch queue. Also adds run_with_io error-to-raise conversion (kont_has_handler guard) so native Eval_errors can be caught by CEK guard/handler-bind when running through the test runner's IO-aware step loop. 2798/2800 tests pass. 2 foreign-type-checking failures remain: guard can't catch Eval_error from native fns called through cek_run_iterative (the handler dispatch itself uses cek_call which re-enters cek_run_iterative, creating an infinite loop). Fix requires spec-level change: make (error) use CEK raise instead of host-error. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -834,30 +834,40 @@
|
||||
(ml-emit-map-dict args set-vars)
|
||||
(= op "append!")
|
||||
(let
|
||||
((target (nth args 0))
|
||||
((target (symbol-name (nth expr 1)))
|
||||
(item-expr (ml-expr-inner (nth args 1) set-vars)))
|
||||
(if
|
||||
(and
|
||||
(= (type-of target) "symbol")
|
||||
(some
|
||||
(fn (v) (= v (ml-mangle (symbol-name target))))
|
||||
set-vars))
|
||||
(ml-is-mutable-global? target)
|
||||
(let
|
||||
((mangled (ml-mangle (symbol-name target))))
|
||||
((mangled (ml-mangle target)))
|
||||
(str
|
||||
"("
|
||||
mangled
|
||||
" := sx_append_b !"
|
||||
"ref := sx_append_b !"
|
||||
mangled
|
||||
" "
|
||||
"ref "
|
||||
item-expr
|
||||
"; Nil)"))
|
||||
(str
|
||||
"(sx_append_b "
|
||||
(ml-expr-inner target set-vars)
|
||||
" "
|
||||
item-expr
|
||||
")")))
|
||||
(if
|
||||
(and
|
||||
(= (type-of (nth expr 1)) "symbol")
|
||||
(some (fn (v) (= v (ml-mangle target))) set-vars))
|
||||
(let
|
||||
((mangled (ml-mangle target)))
|
||||
(str
|
||||
"("
|
||||
mangled
|
||||
" := sx_append_b !"
|
||||
mangled
|
||||
" "
|
||||
item-expr
|
||||
"; Nil)"))
|
||||
(str
|
||||
"(sx_append_b "
|
||||
(ml-expr-inner (nth expr 1) set-vars)
|
||||
" "
|
||||
item-expr
|
||||
")"))))
|
||||
(= op "dict-set!")
|
||||
(str
|
||||
"(sx_dict_set_b "
|
||||
|
||||
Reference in New Issue
Block a user