Skip to content

Fix super[i] index-signature access (unreachable + missing isSuperClass)#282

Merged
ASDAlexander77 merged 1 commit into
mainfrom
fix/super-index-access-gap
Jul 22, 2026
Merged

Fix super[i] index-signature access (unreachable + missing isSuperClass)#282
ASDAlexander77 merged 1 commit into
mainfrom
fix/super-index-access-gap

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

Summary

  • super[i] (index-signature access through super) hit llvm_unreachable("not implemented (ElementAccessExpression)") - the super-specific branch of element-access codegen only ever handled a constant string index (super["name"]), with no fallback to route a real/computed index into ClassIndexAccess the way ordinary t[i] access already does.
  • Fixing that exposed the second, originally-suspected bug: ClassIndexAccess never took an isSuperClass parameter at all (a stale // TODO: why isSuperClass is not used here? comment sat right above its declaration), so once super[i] reached it, thisValue was never repaired via getThisRefOfClass the way ClassMethodAccess/ClassAccessorAccess already do (the same class of bug PR Fix cross-module super-accessor crash and add class coverage #278 fixed for super.<accessor>).
  • Added a same-file regression test (00class_indexer_super.ts) covering an overridden indexer calling back into the base via super[i] / super[i] = value.

Test plan

  • ctest -C Debug -R class-indexer - 4/4 pass (including the new -super test, compile + jit tiers)
  • Full suite ctest -C Debug -j8 - 793/793 pass, no regressions

super[i] hit llvm_unreachable: the ElementAccessExpression codegen's
super-specific branch only handled a constant string index, with no
fallback to route a real (non-constant) index into ClassIndexAccess the
way ordinary t[i] access already does. Fixing that exposed the second,
originally-suspected bug: ClassIndexAccess never took isSuperClass, so
`super[i]`'s thisValue was never repaired via getThisRefOfClass the way
ClassMethodAccess/ClassAccessorAccess already do (same class of bug PR
#278 fixed for super.<accessor>).

Adds a same-file regression test (00class_indexer_super.ts) covering an
overridden indexer calling back into the base via super[i]/super[i] = v.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@ASDAlexander77
ASDAlexander77 merged commit 0b9459c into main Jul 22, 2026
2 checks passed
@ASDAlexander77
ASDAlexander77 deleted the fix/super-index-access-gap branch July 22, 2026 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant