Skip to content

Conversation

@cipheraxat
Copy link
Contributor

Fixes #1309

The issue was that super calls were blocked inside let expressions because:

  1. The compiler's isClassMemberScope() check didn't skip over lambda scopes created by let expressions
  2. The runtime's findSupermethod() didn't traverse past VmFunction owners to find the actual class prototype

Changes:

  • SymbolTable.java: Updated isClassMemberScope() to skip lambda scopes before checking if the parent is a class or module scope
  • InvokeSuperMethodNode.java: Updated findSupermethod() to skip VmFunction owners when looking for the class prototype

Added regression tests covering:

  • Super method calls inside let expressions
  • Super property access inside let expressions
  • Nested let expressions with super calls

Fixes apple#1309

The issue was that super calls were blocked inside let expressions because:
1. The compiler's isClassMemberScope() check didn't skip over lambda scopes
   created by let expressions
2. The runtime's findSupermethod() didn't traverse past VmFunction owners
   to find the actual class prototype

Changes:
- SymbolTable.java: Updated isClassMemberScope() to skip lambda scopes before
  checking if the parent is a class or module scope
- InvokeSuperMethodNode.java: Updated findSupermethod() to skip VmFunction
  owners when looking for the class prototype

Added regression tests covering:
- Super method calls inside let expressions
- Super property access inside let expressions
- Nested let expressions with super calls
Copy link
Member

@bioball bioball left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, great fix, thanks!

Looking for another thumb from either @HT154 or @stackoverflow

@bioball bioball merged commit 9d385f2 into apple:main Jan 10, 2026
17 checks passed
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.

Method supercall doesn't work inside let expression

3 participants