[PR #716] [MERGED] Produce more helpful output when module output is overwritten #691

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

📋 Pull Request Information

Original PR: https://github.com/apple/pkl/pull/716
Author: @HT154
Created: 10/20/2024
Status: Merged
Merged: 10/24/2024
Merged by: @bioball

Base: mainHead: handle-overridden-module-output


📝 Commits (3)

  • 49b1f2b Produce more helpful output when module output is overwritten
  • 91e7d8f Update EvaluatorImpl.java
  • 07bdf17 Move snippet tests to errors, avoid reusing moduleOutputValueTypeMismatch

📊 Changes

9 files changed (+64 additions, -7 deletions)

View changed files

📝 pkl-core/src/main/java/org/pkl/core/EvaluatorImpl.java (+32 -5)
📝 pkl-core/src/main/java/org/pkl/core/PClassInfo.java (+3 -0)
📝 pkl-core/src/main/resources/org/pkl/core/errorMessages.properties (+2 -2)
pkl-core/src/test/files/LanguageSnippetTests/input/errors/invalidOutput1.pkl (+1 -0)
pkl-core/src/test/files/LanguageSnippetTests/input/errors/invalidOutput2.pkl (+3 -0)
pkl-core/src/test/files/LanguageSnippetTests/input/errors/invalidOutput3.pkl (+1 -0)
pkl-core/src/test/files/LanguageSnippetTests/output/errors/invalidOutput1.err (+6 -0)
pkl-core/src/test/files/LanguageSnippetTests/output/errors/invalidOutput2.err (+6 -0)
pkl-core/src/test/files/LanguageSnippetTests/output/errors/invalidOutput3.err (+10 -0)

📄 Description

Evaluating this module:

output: String = "abc"

Now produces

–– Pkl Error ––
Expected `output` of module `file:///$snippetsDir/input/modules/invalidOutput1.pkl` to be of type `ModuleOutput`, but got type `String`.

x | output: String = "abc"
                     ^^^^^
at output (file:///$snippetsDir/input/modules/invalidOutput1.pkl)

Resolves #709


🔄 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/716 **Author:** [@HT154](https://github.com/HT154) **Created:** 10/20/2024 **Status:** ✅ Merged **Merged:** 10/24/2024 **Merged by:** [@bioball](https://github.com/bioball) **Base:** `main` ← **Head:** `handle-overridden-module-output` --- ### 📝 Commits (3) - [`49b1f2b`](https://github.com/apple/pkl/commit/49b1f2bfe5edc1cf235248a9f5ba5e5bbb570b0e) Produce more helpful output when module output is overwritten - [`91e7d8f`](https://github.com/apple/pkl/commit/91e7d8f5fcd068fcfbef8f5f3ccd20af7ee0b4e4) Update EvaluatorImpl.java - [`07bdf17`](https://github.com/apple/pkl/commit/07bdf173e7e02c0c310960be3e03fdc24ef7c120) Move snippet tests to errors, avoid reusing moduleOutputValueTypeMismatch ### 📊 Changes **9 files changed** (+64 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `pkl-core/src/main/java/org/pkl/core/EvaluatorImpl.java` (+32 -5) 📝 `pkl-core/src/main/java/org/pkl/core/PClassInfo.java` (+3 -0) 📝 `pkl-core/src/main/resources/org/pkl/core/errorMessages.properties` (+2 -2) ➕ `pkl-core/src/test/files/LanguageSnippetTests/input/errors/invalidOutput1.pkl` (+1 -0) ➕ `pkl-core/src/test/files/LanguageSnippetTests/input/errors/invalidOutput2.pkl` (+3 -0) ➕ `pkl-core/src/test/files/LanguageSnippetTests/input/errors/invalidOutput3.pkl` (+1 -0) ➕ `pkl-core/src/test/files/LanguageSnippetTests/output/errors/invalidOutput1.err` (+6 -0) ➕ `pkl-core/src/test/files/LanguageSnippetTests/output/errors/invalidOutput2.err` (+6 -0) ➕ `pkl-core/src/test/files/LanguageSnippetTests/output/errors/invalidOutput3.err` (+10 -0) </details> ### 📄 Description Evaluating this module: ```pkl output: String = "abc" ``` Now produces ``` –– Pkl Error –– Expected `output` of module `file:///$snippetsDir/input/modules/invalidOutput1.pkl` to be of type `ModuleOutput`, but got type `String`. x | output: String = "abc" ^^^^^ at output (file:///$snippetsDir/input/modules/invalidOutput1.pkl) ``` Resolves #709 --- <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:26:10 +01:00
adam closed this issue 2025-12-30 01:26:10 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#691