Context
Attempted fix for #640 Step 3b (setInterval capture segfault) in PR #644 — closed.
Real root cause (not as #640 describes): captured class instance in a closure loses its concrete class name → capturedVar.field can't find GEP → final load uses field's nominal type against whatever alloca holds. Pointer-typed fields segfault; number fields silently return garbage.
Minimal repro:
class T { h: string = "hello"; }
const t = new T();
setTimeout(() => { console.log(t.h); }, 10);
Prints garbage on main.
Attempted fix (failed)
Plumb concreteClass through ClosureAnalyzer + generateArrowFunction, re-bind captured locals with createClassMetadata instead of plain defineVariable (~60 LOC diff across 8 files).
Failed on stage1/2 regression: fixture semantic/binary-type-in-function (rejects "hello" - 5 with "cannot use '-' between 'string' and 'number'") started passing silently — no compile error emitted. Stage1 compiler built from modified source lost the binary-type-mismatch check somewhere in the re-bind path.
Next
Needs someone to diagnose why the re-bind logic in variable-allocator.ts/closure-analyzer.ts interacts with semantic binary-type checking. Likely the re-bind overwrites type metadata the type-inference pass depended on.
Branch step3b-setinterval-segfault closed; diff available via PR #644 history.
Blocks: #640 Step 3b completion.
Context
Attempted fix for #640 Step 3b (setInterval capture segfault) in PR #644 — closed.
Real root cause (not as #640 describes): captured class instance in a closure loses its concrete class name →
capturedVar.fieldcan't find GEP → final load uses field's nominal type against whatever alloca holds. Pointer-typed fields segfault; number fields silently return garbage.Minimal repro:
Prints garbage on main.
Attempted fix (failed)
Plumb
concreteClassthroughClosureAnalyzer+generateArrowFunction, re-bind captured locals withcreateClassMetadatainstead of plaindefineVariable(~60 LOC diff across 8 files).Failed on stage1/2 regression: fixture
semantic/binary-type-in-function(rejects"hello" - 5with "cannot use '-' between 'string' and 'number'") started passing silently — no compile error emitted. Stage1 compiler built from modified source lost the binary-type-mismatch check somewhere in the re-bind path.Next
Needs someone to diagnose why the re-bind logic in
variable-allocator.ts/closure-analyzer.tsinteracts with semantic binary-type checking. Likely the re-bind overwrites type metadata the type-inference pass depended on.Branch
step3b-setinterval-segfaultclosed; diff available via PR #644 history.Blocks: #640 Step 3b completion.