debug: RED-pin for instance-body unbound-var bug
ail check returns ok for a program that references an unbound identifier inside an instance method's lambda body. The error surfaces later at ail build as a degraded mono-pass diagnostic (monomorphise_workspace: unknown identifier) without source location, symbol kind, or "did you mean" candidates. Cause: check_def at crates/ailang-check/src/lib.rs:1593 early- returns Ok(()) for Def::Instance without walking method bodies. The arm's comment promises instance-body typechecking from iter 22b.2; that wiring was never implemented. Only the workspace- load coherence checks (Orphan/Duplicate/MissingMethod) touch instance defs, and they inspect schema only, not the method- body identifier graph. This commit lands RED only. GREEN follows via implement mini- mode. Fixture: examples/bug_unbound_in_instance_method.ail RED test: crates/ail/tests/unbound_in_instance_method_pin.rs - check_fires_unbound_var_for_str_concat_in_instance_method_body - check_json_unbound_var_in_instance_method_body
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
(module bug_unbound_in_instance_method
|
||||
(class Describe
|
||||
(param a)
|
||||
(method describe
|
||||
(type (fn-type (params (borrow a)) (ret (con Str))))))
|
||||
(instance
|
||||
(class Describe)
|
||||
(type (con Int))
|
||||
(method describe
|
||||
(body
|
||||
(lam
|
||||
(params (typed n (con Int)))
|
||||
(ret (con Str))
|
||||
(body (app str_concat "n=" (app int_to_str n)))))))
|
||||
(fn main
|
||||
(type (fn-type (params) (ret (con Unit)) (effects IO)))
|
||||
(params)
|
||||
(body (do io/print_str (app describe 5)))))
|
||||
Reference in New Issue
Block a user