When we introduced lazy listing/mapping typechecking, we widened an existing bug around resolving for-generator variables in https://github.com/apple/pkl/issues/741.
To prevent this bug from being widened, this introduces logic to eagerly evaluate any Listing<V> or Mapping<K, V> found in the iterable.
We're not sure what the best approach is yet to fix the bug. In the meantime, this prevents the existing bug from being any more prevalent than it currently is.
🔄 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/752
**Author:** [@bioball](https://github.com/bioball)
**Created:** 10/30/2024
**Status:** ✅ Merged
**Merged:** 10/31/2024
**Merged by:** [@bioball](https://github.com/bioball)
**Base:** `main` ← **Head:** `eager-check-iterables`
---
### 📝 Commits (7)
- [`c2f7879`](https://github.com/apple/pkl/commit/c2f787924ea802bf1017d0d70d9441b0cb4d041f) Minimize for-generator scoping bug
- [`a232865`](https://github.com/apple/pkl/commit/a23286553a2f8286366525bc0b3811fc59f23f9a) Use modifier to flag whether in iterable
- [`2020c7a`](https://github.com/apple/pkl/commit/2020c7ab835965591c276879d91524fa4d112559) Apply suggestions from code review
- [`3e00f3f`](https://github.com/apple/pkl/commit/3e00f3fb04a6e35f46c2eaca32a22deb286ae5db) Add isInIterable to Member
- [`aa38373`](https://github.com/apple/pkl/commit/aa38373640dd4ef32e52525320891bbd448a4f98) Cleanup
- [`48dd09d`](https://github.com/apple/pkl/commit/48dd09deed54d1e6ccd16c85337d58e7fd5d68a7) Run spotless apply
- [`76d0c70`](https://github.com/apple/pkl/commit/76d0c70126acb52f289154df21729b8ff83004e1) Don't consider spread members as in iterable
### 📊 Changes
**10 files changed** (+126 additions, -11 deletions)
<details>
<summary>View changed files</summary>
📝 `pkl-core/src/main/java/org/pkl/core/ast/VmModifier.java` (+7 -0)
📝 `pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java` (+24 -8)
📝 `pkl-core/src/main/java/org/pkl/core/ast/builder/SymbolTable.java` (+10 -0)
📝 `pkl-core/src/main/java/org/pkl/core/ast/member/Member.java` (+17 -0)
📝 `pkl-core/src/main/java/org/pkl/core/ast/member/ObjectMember.java` (+1 -0)
📝 `pkl-core/src/main/java/org/pkl/core/ast/member/PropertyTypeNode.java` (+16 -0)
📝 `pkl-core/src/main/java/org/pkl/core/ast/member/TypeCheckedPropertyNode.java` (+4 -2)
📝 `pkl-core/src/main/java/org/pkl/core/ast/member/TypedPropertyNode.java` (+4 -1)
➕ `pkl-core/src/test/files/LanguageSnippetTests/input/generators/forGeneratorNestedReference.pkl` (+33 -0)
➕ `pkl-core/src/test/files/LanguageSnippetTests/output/generators/forGeneratorNestedReference.pcf` (+10 -0)
</details>
### 📄 Description
When we introduced lazy listing/mapping typechecking, we widened an existing bug around resolving for-generator variables in https://github.com/apple/pkl/issues/741.
To prevent this bug from being widened, this introduces logic to eagerly evaluate any `Listing<V>` or `Mapping<K, V>` found in the iterable.
We're not sure what the best approach is yet to fix the bug. In the meantime, this prevents the existing bug from being any more prevalent than it currently is.
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/apple/pkl/pull/752
Author: @bioball
Created: 10/30/2024
Status: ✅ Merged
Merged: 10/31/2024
Merged by: @bioball
Base:
main← Head:eager-check-iterables📝 Commits (7)
c2f7879Minimize for-generator scoping buga232865Use modifier to flag whether in iterable2020c7aApply suggestions from code review3e00f3fAdd isInIterable to Memberaa38373Cleanup48dd09dRun spotless apply76d0c70Don't consider spread members as in iterable📊 Changes
10 files changed (+126 additions, -11 deletions)
View changed files
📝
pkl-core/src/main/java/org/pkl/core/ast/VmModifier.java(+7 -0)📝
pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java(+24 -8)📝
pkl-core/src/main/java/org/pkl/core/ast/builder/SymbolTable.java(+10 -0)📝
pkl-core/src/main/java/org/pkl/core/ast/member/Member.java(+17 -0)📝
pkl-core/src/main/java/org/pkl/core/ast/member/ObjectMember.java(+1 -0)📝
pkl-core/src/main/java/org/pkl/core/ast/member/PropertyTypeNode.java(+16 -0)📝
pkl-core/src/main/java/org/pkl/core/ast/member/TypeCheckedPropertyNode.java(+4 -2)📝
pkl-core/src/main/java/org/pkl/core/ast/member/TypedPropertyNode.java(+4 -1)➕
pkl-core/src/test/files/LanguageSnippetTests/input/generators/forGeneratorNestedReference.pkl(+33 -0)➕
pkl-core/src/test/files/LanguageSnippetTests/output/generators/forGeneratorNestedReference.pcf(+10 -0)📄 Description
When we introduced lazy listing/mapping typechecking, we widened an existing bug around resolving for-generator variables in https://github.com/apple/pkl/issues/741.
To prevent this bug from being widened, this introduces logic to eagerly evaluate any
Listing<V>orMapping<K, V>found in the iterable.We're not sure what the best approach is yet to fix the bug. In the meantime, this prevents the existing bug from being any more prevalent than it currently is.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.