[PR #1137] [MERGED] SPICE-0019: Allow trailing commas in comma-separated syntax elements #909

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

📋 Pull Request Information

Original PR: https://github.com/apple/pkl/pull/1137
Author: @HT154
Created: 7/22/2025
Status: Merged
Merged: 8/21/2025
Merged by: @bioball

Base: mainHead: trailing-commas


📝 Commits (1)

  • fb79318 Allow trailing commas in comma-separated syntax elements

📊 Changes

10 files changed (+370 additions, -13 deletions)

View changed files

📝 .idea/codeStyles/Project.xml (+1 -0)
pkl-core/src/test/files/LanguageSnippetTests/input/parser/constraintsTrailingComma.pkl (+9 -0)
pkl-core/src/test/files/LanguageSnippetTests/input/parser/lambdaTrailingCommas.pkl (+43 -0)
pkl-core/src/test/files/LanguageSnippetTests/input/parser/methodTrailingCommas.pkl (+157 -0)
pkl-core/src/test/files/LanguageSnippetTests/input/parser/trailingCommas.pkl (+3 -0)
pkl-core/src/test/files/LanguageSnippetTests/output/parser/constraintsTrailingComma.pcf (+3 -0)
pkl-core/src/test/files/LanguageSnippetTests/output/parser/methodTrailingCommas.pcf (+36 -0)
pkl-core/src/test/files/LanguageSnippetTests/output/parser/trailingCommas.pcf (+3 -0)
pkl-core/src/test/kotlin/org/pkl/core/parser/TrailingCommasTest.kt (+82 -0)
📝 pkl-parser/src/main/java/org/pkl/parser/Parser.java (+33 -13)

📄 Description

Implements https://github.com/apple/pkl-evolution/pull/21

This changes Pkl's grammar but is not breaking. It only admits inputs that were previously invalid.

Covers these syntax elements:

  • Function parameter lists (method definitions) - tested in parser/methodTrailingCommas.pkl
  • Argument lists (method calls) - tested in parser/methodTrailingCommas.pkl
  • Type argument lists (in declared type names) - tested in parser/trailingCommas.pkl
  • Type parameter lists (in class/module headers) - tested in parser/trailingCommas.pkl
  • Type constraint lists - tested in parser/constraintsTrailingComma.pkl
  • Function type parameter lists (function type annotations) - tested in parser/lambdaTrailingCommas.pkl
  • Object body parameter lists (sugar'd lambdas) - tested in parser/lambdaTrailingCommas.pkl

Resolves #1132


🔄 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/1137 **Author:** [@HT154](https://github.com/HT154) **Created:** 7/22/2025 **Status:** ✅ Merged **Merged:** 8/21/2025 **Merged by:** [@bioball](https://github.com/bioball) **Base:** `main` ← **Head:** `trailing-commas` --- ### 📝 Commits (1) - [`fb79318`](https://github.com/apple/pkl/commit/fb79318d8befa5b6015e273485021bf1de7412d1) Allow trailing commas in comma-separated syntax elements ### 📊 Changes **10 files changed** (+370 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `.idea/codeStyles/Project.xml` (+1 -0) ➕ `pkl-core/src/test/files/LanguageSnippetTests/input/parser/constraintsTrailingComma.pkl` (+9 -0) ➕ `pkl-core/src/test/files/LanguageSnippetTests/input/parser/lambdaTrailingCommas.pkl` (+43 -0) ➕ `pkl-core/src/test/files/LanguageSnippetTests/input/parser/methodTrailingCommas.pkl` (+157 -0) ➕ `pkl-core/src/test/files/LanguageSnippetTests/input/parser/trailingCommas.pkl` (+3 -0) ➕ `pkl-core/src/test/files/LanguageSnippetTests/output/parser/constraintsTrailingComma.pcf` (+3 -0) ➕ `pkl-core/src/test/files/LanguageSnippetTests/output/parser/methodTrailingCommas.pcf` (+36 -0) ➕ `pkl-core/src/test/files/LanguageSnippetTests/output/parser/trailingCommas.pcf` (+3 -0) ➕ `pkl-core/src/test/kotlin/org/pkl/core/parser/TrailingCommasTest.kt` (+82 -0) 📝 `pkl-parser/src/main/java/org/pkl/parser/Parser.java` (+33 -13) </details> ### 📄 Description Implements https://github.com/apple/pkl-evolution/pull/21 This changes Pkl's grammar but is not breaking. It only admits inputs that were previously invalid. Covers these syntax elements: - Function parameter lists (method definitions) - tested in `parser/methodTrailingCommas.pkl` - Argument lists (method calls) - tested in `parser/methodTrailingCommas.pkl` - Type argument lists (in declared type names) - tested in `parser/trailingCommas.pkl` - Type parameter lists (in class/module headers) - tested in `parser/trailingCommas.pkl` - Type constraint lists - tested in `parser/constraintsTrailingComma.pkl` - Function type parameter lists (function type annotations) - tested in `parser/lambdaTrailingCommas.pkl ` - Object body parameter lists (sugar'd lambdas) - tested in `parser/lambdaTrailingCommas.pkl` Resolves #1132 --- <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:41 +01:00
adam closed this issue 2025-12-30 01:27:42 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#909