[PR #1383] Fix super method call inside let expression #1058

Open
opened 2025-12-30 01:28:33 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/apple/pkl/pull/1383
Author: @cipheraxat
Created: 12/22/2025
Status: 🔄 Open

Base: mainHead: fix/super-call-in-let-expression


📝 Commits (1)

  • 5a5adf3 Fix super method call inside let expression

📊 Changes

4 files changed (+52 additions, -0 deletions)

View changed files

📝 pkl-core/src/main/java/org/pkl/core/ast/builder/SymbolTable.java (+2 -0)
📝 pkl-core/src/main/java/org/pkl/core/ast/expression/member/InvokeSuperMethodNode.java (+3 -0)
pkl-core/src/test/files/LanguageSnippetTests/input/classes/supercallsInLet.pkl (+44 -0)
pkl-core/src/test/files/LanguageSnippetTests/output/classes/supercallsInLet.pcf (+3 -0)

📄 Description

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

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/apple/pkl/pull/1383 **Author:** [@cipheraxat](https://github.com/cipheraxat) **Created:** 12/22/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/super-call-in-let-expression` --- ### 📝 Commits (1) - [`5a5adf3`](https://github.com/apple/pkl/commit/5a5adf3e188fa97d805005369d35e803477461ea) Fix super method call inside let expression ### 📊 Changes **4 files changed** (+52 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `pkl-core/src/main/java/org/pkl/core/ast/builder/SymbolTable.java` (+2 -0) 📝 `pkl-core/src/main/java/org/pkl/core/ast/expression/member/InvokeSuperMethodNode.java` (+3 -0) ➕ `pkl-core/src/test/files/LanguageSnippetTests/input/classes/supercallsInLet.pkl` (+44 -0) ➕ `pkl-core/src/test/files/LanguageSnippetTests/output/classes/supercallsInLet.pcf` (+3 -0) </details> ### 📄 Description 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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 01:28:33 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#1058