mirror of
https://github.com/apple/pkl.git
synced 2026-01-13 15:13:38 +01:00
[PR #697] [MERGED] Fix double unary minus #677
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/apple/pkl/pull/697
Author: @HT154
Created: 10/16/2024
Status: ✅ Merged
Merged: 10/17/2024
Merged by: @bioball
Base:
main← Head:double-invert-fix📝 Commits (1)
518a832Fix double unary minus📊 Changes
5 files changed (+16 additions, -4 deletions)
View changed files
📝
pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java(+4 -4)📝
pkl-core/src/test/files/LanguageSnippetTests/input/basic/float.pkl(+4 -0)📝
pkl-core/src/test/files/LanguageSnippetTests/input/basic/int.pkl(+4 -0)📝
pkl-core/src/test/files/LanguageSnippetTests/output/basic/float.pcf(+2 -0)📝
pkl-core/src/test/files/LanguageSnippetTests/output/basic/int.pcf(+2 -0)📄 Description
If
AstBuilderis processingUnaryMinus -> [Parenthesized]* -> UnaryMinus -> IntLiteral, the "inner"UnaryMinushelpfully defers inversion to theIntLiteraland returns it directly. The "outer"UnaryMinus, none the wiser, then does the exact same thing. There needs to be a way to force only the inner-mostUnaryMinusto delegate to the literal node, which seems tricky in context.This is my naive attempt at that, but this feels messy. More than happy to take suggestions on a better way to do this!
Resolves #650
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.