[PR #319] [MERGED] Fix amending module with abstract class #497

Closed
opened 2025-12-30 01:24:58 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/apple/pkl/pull/319
Author: @bioball
Created: 3/14/2024
Status: Merged
Merged: 3/15/2024
Merged by: @bioball

Base: mainHead: fix-abstract-class


📝 Commits (1)

  • b9776f1 Fix amending module with abstract class

📊 Changes

5 files changed (+28 additions, -2 deletions)

View changed files

📝 pkl-core/src/main/java/org/pkl/core/ast/VmModifier.java (+8 -0)
📝 pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java (+6 -2)
pkl-core/src/test/files/LanguageSnippetTests/input-helper/modules/Birds.pkl (+12 -0)
pkl-core/src/test/files/LanguageSnippetTests/input/modules/amendModule6.pkl (+1 -0)
pkl-core/src/test/files/LanguageSnippetTests/output/modules/amendModule6.pcf (+1 -0)

📄 Description

This fixes an assertion error that gets thrown if:

  1. A module declares a class as abstract
  2. An amending module does not instantiate a value that is an instance of that class
  3. Java assertions are turned on

Underneath the hood, the modifiers of the class/typelias object member is considered different from the modifiers on the VmClass/VmTypeAlias values.

The object model skips forcing any explicitly members that are explicitly declared hidden, abstract, or local.
However, it should evaluate any abstract classes found in a module. So, it's incorrect to apply the same modifiers on the class to the object member.


🔄 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/319 **Author:** [@bioball](https://github.com/bioball) **Created:** 3/14/2024 **Status:** ✅ Merged **Merged:** 3/15/2024 **Merged by:** [@bioball](https://github.com/bioball) **Base:** `main` ← **Head:** `fix-abstract-class` --- ### 📝 Commits (1) - [`b9776f1`](https://github.com/apple/pkl/commit/b9776f1902bee7bab131e673796b89b262bffcf8) Fix amending module with abstract class ### 📊 Changes **5 files changed** (+28 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `pkl-core/src/main/java/org/pkl/core/ast/VmModifier.java` (+8 -0) 📝 `pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java` (+6 -2) ➕ `pkl-core/src/test/files/LanguageSnippetTests/input-helper/modules/Birds.pkl` (+12 -0) ➕ `pkl-core/src/test/files/LanguageSnippetTests/input/modules/amendModule6.pkl` (+1 -0) ➕ `pkl-core/src/test/files/LanguageSnippetTests/output/modules/amendModule6.pcf` (+1 -0) </details> ### 📄 Description This fixes an assertion error that gets thrown if: 1. A module declares a class as abstract 2. An amending module does not instantiate a value that is an instance of that class 3. Java assertions are turned on Underneath the hood, the modifiers of the class/typelias object member is considered different from the modifiers on the VmClass/VmTypeAlias values. The object model skips forcing any explicitly members that are explicitly declared hidden, abstract, or local. However, it _should_ evaluate any abstract classes found in a module. So, it's incorrect to apply the same modifiers on the class to the object member. --- <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:24:58 +01:00
adam closed this issue 2025-12-30 01:24:58 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#497