[PR #1180] Fix cyclic dependencies bug #930

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

📋 Pull Request Information

Original PR: https://github.com/apple/pkl/pull/1180
Author: @stackoverflow
Created: 8/20/2025
Status: 🔄 Open

Base: mainHead: fix-cyclic-dependencies


📝 Commits (7)

  • 2d4f6bc Fix cyclic dependencies bug
  • 38c1873 Revert "Fix cyclic dependencies bug"
  • 70c34b0 Properly fix not initialized cyclical dependencies for amending modules.
  • 4e1a856 Spotless
  • bd74777 Fix review remarks
  • b68bfff Fix errors
  • cb8059f Throw on uninitialized module

📊 Changes

18 files changed (+143 additions, -9 deletions)

View changed files

📝 pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java (+28 -2)
📝 pkl-core/src/main/java/org/pkl/core/ast/expression/literal/AmendModuleNode.java (+12 -4)
📝 pkl-core/src/main/java/org/pkl/core/ast/member/ClassNode.java (+4 -1)
📝 pkl-core/src/main/java/org/pkl/core/ast/type/ResolveDeclaredTypeNode.java (+30 -1)
📝 pkl-core/src/main/java/org/pkl/core/runtime/ModuleInfo.java (+30 -0)
📝 pkl-core/src/main/java/org/pkl/core/runtime/VmLanguage.java (+4 -0)
📝 pkl-core/src/main/java/org/pkl/core/runtime/VmTyped.java (+5 -1)
📝 pkl-core/src/main/resources/org/pkl/core/errorMessages.properties (+3 -0)
pkl-core/src/test/files/LanguageSnippetTests/input-helper/cycles/Foo.pkl (+5 -0)
pkl-core/src/test/files/LanguageSnippetTests/input-helper/cycles/Qux.pkl (+3 -0)
pkl-core/src/test/files/LanguageSnippetTests/input-helper/cycles/amendsFoo.pkl (+1 -0)
pkl-core/src/test/files/LanguageSnippetTests/input-helper/cycles/amendsFooLv2.pkl (+1 -0)
pkl-core/src/test/files/LanguageSnippetTests/input/errors/cyclicalAmendsType.pkl (+3 -0)
pkl-core/src/test/files/LanguageSnippetTests/input/modules/cycles.pkl (+3 -0)
pkl-core/src/test/files/LanguageSnippetTests/input/modules/cycles2.pkl (+3 -0)
pkl-core/src/test/files/LanguageSnippetTests/output/errors/cyclicalAmendsType.err (+6 -0)
pkl-core/src/test/files/LanguageSnippetTests/output/modules/cycles.pcf (+1 -0)
pkl-core/src/test/files/LanguageSnippetTests/output/modules/cycles2.pcf (+1 -0)

📄 Description

In some very specific scenarios cyclic dependencies may lead to a null pointer due to the module not being properly initialized.
Fixes #1183.


🔄 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/1180 **Author:** [@stackoverflow](https://github.com/stackoverflow) **Created:** 8/20/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix-cyclic-dependencies` --- ### 📝 Commits (7) - [`2d4f6bc`](https://github.com/apple/pkl/commit/2d4f6bc52bd95662e45e935ce633b7fa6c2ddc41) Fix cyclic dependencies bug - [`38c1873`](https://github.com/apple/pkl/commit/38c1873d0e36d269d569f4b518ca9475c948635a) Revert "Fix cyclic dependencies bug" - [`70c34b0`](https://github.com/apple/pkl/commit/70c34b07304fc21cbf04240c27e5978adefa018c) Properly fix not initialized cyclical dependencies for amending modules. - [`4e1a856`](https://github.com/apple/pkl/commit/4e1a85662e6403d80da5d0c16c221006086040aa) Spotless - [`bd74777`](https://github.com/apple/pkl/commit/bd747770478fe033de158eb2116b86d596665c06) Fix review remarks - [`b68bfff`](https://github.com/apple/pkl/commit/b68bfff4ae6538fc294c3b0645c3e2c8c0a046f6) Fix errors - [`cb8059f`](https://github.com/apple/pkl/commit/cb8059fc85a00bf2cc77ba285bee078de72d15b3) Throw on uninitialized module ### 📊 Changes **18 files changed** (+143 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java` (+28 -2) 📝 `pkl-core/src/main/java/org/pkl/core/ast/expression/literal/AmendModuleNode.java` (+12 -4) 📝 `pkl-core/src/main/java/org/pkl/core/ast/member/ClassNode.java` (+4 -1) 📝 `pkl-core/src/main/java/org/pkl/core/ast/type/ResolveDeclaredTypeNode.java` (+30 -1) 📝 `pkl-core/src/main/java/org/pkl/core/runtime/ModuleInfo.java` (+30 -0) 📝 `pkl-core/src/main/java/org/pkl/core/runtime/VmLanguage.java` (+4 -0) 📝 `pkl-core/src/main/java/org/pkl/core/runtime/VmTyped.java` (+5 -1) 📝 `pkl-core/src/main/resources/org/pkl/core/errorMessages.properties` (+3 -0) ➕ `pkl-core/src/test/files/LanguageSnippetTests/input-helper/cycles/Foo.pkl` (+5 -0) ➕ `pkl-core/src/test/files/LanguageSnippetTests/input-helper/cycles/Qux.pkl` (+3 -0) ➕ `pkl-core/src/test/files/LanguageSnippetTests/input-helper/cycles/amendsFoo.pkl` (+1 -0) ➕ `pkl-core/src/test/files/LanguageSnippetTests/input-helper/cycles/amendsFooLv2.pkl` (+1 -0) ➕ `pkl-core/src/test/files/LanguageSnippetTests/input/errors/cyclicalAmendsType.pkl` (+3 -0) ➕ `pkl-core/src/test/files/LanguageSnippetTests/input/modules/cycles.pkl` (+3 -0) ➕ `pkl-core/src/test/files/LanguageSnippetTests/input/modules/cycles2.pkl` (+3 -0) ➕ `pkl-core/src/test/files/LanguageSnippetTests/output/errors/cyclicalAmendsType.err` (+6 -0) ➕ `pkl-core/src/test/files/LanguageSnippetTests/output/modules/cycles.pcf` (+1 -0) ➕ `pkl-core/src/test/files/LanguageSnippetTests/output/modules/cycles2.pcf` (+1 -0) </details> ### 📄 Description In some very specific scenarios cyclic dependencies may lead to a null pointer due to the module not being properly initialized. Fixes #1183. --- <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:27:48 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#930