Fix cross-module diamond-extends interface silently corrupting data - #268
Merged
Merged
Conversation
interface Combined extends Left, Right (2+ extends targets) had two bugs: mlirGen(InterfaceDeclaration) re-running for an already-declared interface duplicated its extends list unboundedly (every other member-add is idempotent, this push_back wasn't), and the per-object vtable patch loop used a method's standalone virtualIndex instead of its offset within the combined vtable, mis-patching every method from the second extends target onward. Adds cross-module regression coverage for diamond extends (isolated) and multilevel+diamond together, extending the same-module coverage from #267 across the module boundary. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This was referenced Jul 20, 2026
ASDAlexander77
added a commit
that referenced
this pull request
Jul 20, 2026
Adds a cross-module test pair for `interface Combined extends A, B, C` to stress the vtable-offset accumulation and extends-dedup guard from PR #268 (which only had 2-target diamond coverage) at N=3. Verified via live debug trace that the fix generalizes correctly; full extends-interface test family (12 tests) passes. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
ASDAlexander77
added a commit
that referenced
this pull request
Jul 20, 2026
Adds a cross-module test pair for `interface Combined extends A, B, C` to stress the vtable-offset accumulation and extends-dedup guard from PR #268 (which only had 2-target diamond coverage) at N=3. Verified via live debug trace that the fix generalizes correctly; full extends-interface test family (12 tests) passes. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
interface Combined extends Left, Right(2+ extends targets, i.e. diamond) silently corrupted data cross-module, from two independent bugs:mlirGen(InterfaceDeclaration)can re-run for an already-declared interface; the heritage-clause loop unconditionally appended toextendson every run instead of guarding like every other member-add (getFieldIndex/getMethodIndexchecks), so the combined vtable's slot count multiplied without bound.virtualIndexinstead of its offset within the combined vtable, so every method from the second (or later)extendstarget got patched into the wrong slot.Test plan
export/import_object_literal_structural_typed_extends_interface_diamond.ts) and combined multilevel+diamond (export/import_object_literal_structural_typed_extends_interface_multilevel.ts), both compile+JIT variants, registered intest/tester/CMakeLists.txt.--emit=mlirdump before/after each fix (vtable slot count and patched slot indices).Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com