mirror of
https://github.com/apple/pkl.git
synced 2026-01-11 14:20:35 +01:00
[PR #1384] Implement power assertions #1059
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/1384
Author: @bioball
Created: 12/23/2025
Status: 🔄 Open
Base:
main← Head:power-asserts📝 Commits (1)
25cf821Implement power assertions📊 Changes
93 files changed (+1694 additions, -216 deletions)
View changed files
📝
pkl-cli/src/main/kotlin/org/pkl/cli/CliTestRunner.kt(+1 -0)📝
pkl-cli/src/test/kotlin/org/pkl/cli/CliTestRunnerTest.kt(+35 -24)📝
pkl-core/src/main/java/org/pkl/core/ast/ExpressionNode.java(+23 -2)📝
pkl-core/src/main/java/org/pkl/core/ast/expression/binary/ComparatorNode.java(+3 -2)📝
pkl-core/src/main/java/org/pkl/core/ast/expression/binary/GreaterThanNode.java(+9 -1)📝
pkl-core/src/main/java/org/pkl/core/ast/expression/binary/LessThanNode.java(+9 -1)📝
pkl-core/src/main/java/org/pkl/core/ast/expression/member/InvokeMethodVirtualNode.java(+9 -0)📝
pkl-core/src/main/java/org/pkl/core/ast/frame/WriteFrameSlotNode.java(+6 -1)📝
pkl-core/src/main/java/org/pkl/core/ast/internal/BlackholeNode.java(+6 -1)📝
pkl-core/src/main/java/org/pkl/core/ast/internal/GetClassNode.java(+9 -1)➕
pkl-core/src/main/java/org/pkl/core/ast/internal/SyntheticNode.java(+29 -0)📝
pkl-core/src/main/java/org/pkl/core/ast/lambda/ApplyVmFunction1Node.java(+5 -0)📝
pkl-core/src/main/java/org/pkl/core/ast/type/TypeConstraintNode.java(+19 -3)📝
pkl-core/src/main/java/org/pkl/core/ast/type/TypeNode.java(+27 -11)📝
pkl-core/src/main/java/org/pkl/core/ast/type/VmTypeMismatchException.java(+44 -24)📝
pkl-core/src/main/java/org/pkl/core/repl/ReplServer.java(+2 -1)➕
pkl-core/src/main/java/org/pkl/core/runtime/PklTags.java(+27 -0)➕
pkl-core/src/main/java/org/pkl/core/runtime/PowerAssertions.java(+493 -0)📝
pkl-core/src/main/java/org/pkl/core/runtime/TestRunner.java(+26 -6)📝
pkl-core/src/main/java/org/pkl/core/runtime/VmBugException.java(+9 -5)...and 73 more files
📄 Description
This adds power assertions to Pkl!
This implements the SPICE described in https://github.com/apple/pkl-evolution/pull/29
This follows the power assertions style of reporting also found in
Groovy, Kotlin, and others.
List(1, 2)are also consideredliterals
Power assertions are added to:
Power assertions are implemented as a truffle instrument to observe execution.
When an assertion fails, the instrument is created and the assertion is run again to observe facts.
This incurs runtime overhead to collect facts, but has no impact on code in the non-error case.
Samples:
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.