[PR #797] [MERGED] Fix length of listings with computed index #741

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

📋 Pull Request Information

Original PR: https://github.com/apple/pkl/pull/797
Author: @odenix
Created: 11/10/2024
Status: Merged
Merged: 11/13/2024
Merged by: @holzensp

Base: mainHead: listing-length


📝 Commits (1)

  • 016caf9 Fix length of listings with computed index

📊 Changes

4 files changed (+241 additions, -5 deletions)

View changed files

📝 pkl-commons-test/src/main/kotlin/org/pkl/commons/test/FileTestUtils.kt (+8 -1)
📝 pkl-core/src/main/java/org/pkl/core/ast/expression/literal/EntriesLiteralNode.java (+5 -4)
📝 pkl-core/src/test/files/LanguageSnippetTests/input/api/listing.pkl (+60 -0)
📝 pkl-core/src/test/files/LanguageSnippetTests/output/api/listing.pcf (+168 -0)

📄 Description

Motivation:
The following expression evaluates to 2 instead of 1:
new Listing { "value" } { [0 + 0] = "override" }.length

Changes:

  • fix length computation in EntriesLiteralNode
  • improve api/listing tests
  • make snippet test failures diffable in IntelliJ

Result:


🔄 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/797 **Author:** [@odenix](https://github.com/odenix) **Created:** 11/10/2024 **Status:** ✅ Merged **Merged:** 11/13/2024 **Merged by:** [@holzensp](https://github.com/holzensp) **Base:** `main` ← **Head:** `listing-length` --- ### 📝 Commits (1) - [`016caf9`](https://github.com/apple/pkl/commit/016caf9d53c639653df3c3aeab36be4b480cdcab) Fix length of listings with computed index ### 📊 Changes **4 files changed** (+241 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `pkl-commons-test/src/main/kotlin/org/pkl/commons/test/FileTestUtils.kt` (+8 -1) 📝 `pkl-core/src/main/java/org/pkl/core/ast/expression/literal/EntriesLiteralNode.java` (+5 -4) 📝 `pkl-core/src/test/files/LanguageSnippetTests/input/api/listing.pkl` (+60 -0) 📝 `pkl-core/src/test/files/LanguageSnippetTests/output/api/listing.pcf` (+168 -0) </details> ### 📄 Description Motivation: The following expression evaluates to 2 instead of 1: `new Listing { "value" } { [0 + 0] = "override" }.length` Changes: - fix length computation in EntriesLiteralNode - improve `api/listing` tests - make snippet test failures diffable in IntelliJ Result: - fixes https://github.com/apple/pkl/issues/780 - improved dev experience in IntelliJ --- <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:28 +01:00
adam closed this issue 2025-12-30 01:26:28 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#741