Commit Graph

651 Commits

Author SHA1 Message Date
Jen Basch a9c890e2f9 Do not activate power assertions when a single union member containing a type constraint fails (#1462)
Prior to this change, this code would activate powers assertions /
instrumentation permanently:
```pkl
foo: String(contains("a")) | String(contains("b")) = "boo"
```

This is because the `contains("a")` constraint would fail, triggering
power assertions, but the subsequent check of the union's
`contains("b")` branch would succeed.
As observed in #1419, once instrumentation is enabled, all subsequent
evaluation slows significantly.
As with #1419, the fix here is to disable power assertions via
`VmLocalContext` until we know that all union members failed type
checking; then, each member is re-executed with power assertions allowed
to provide the improved user-facing error.
2026-03-25 11:52:37 -07:00
Jen Basch f23c37a993 Prevent --multiple-file-output-path writes from following symlinks outside the target directory (#1467) 2026-03-25 11:50:20 -07:00
Jen Basch cdc6fa8aec Prevent I/O when checking UNC paths against --root-dir (#1466)
Test on [windows] please
2026-03-25 11:40:51 -07:00
Jen Basch 1104f12362 Allow custom/external resources to be "not found" (#1471)
This allows custom/external resources to produce `null` values for
nullable reads (`read?`)

Ref: https://github.com/apple/pkl-go/issues/157
2026-03-24 12:43:44 -07:00
Jen Basch cce84d7ccc Correct SecurityManager check for HTTP(S) module URIs (#1463) 2026-03-23 07:43:07 -07:00
Jen Basch a6db476c70 Fix module reflection when instrumentation is active (#1464) 2026-03-23 07:42:40 -07:00
splint-disk-8i 3f3271d3b1 Update deprecated OpenJDK links in DEVELOPMENT.adoc (#1468)
Fixes broken links and grammar in DEVELOPMENT.adoc:

- Mailing list URL: openjdk.java.net → openjdk.org (old domain returns
301)
- Truffle FAQ link: old OpenJDK wiki is gone (404) — replaced with
current GraalVM Truffle docs
- Grammar: "enables to run" → "enables you to run"
- Grammar: "jenv use specific" → "jenv uses specific"
2026-03-16 10:27:12 -07:00
dependabot[bot] 46da9cb33a Bump actions/create-github-app-token from 2.2.1 to 2.2.2 (#1469) 2026-03-16 09:55:09 -07:00
Jen Basch 3eda3b197e Bump pkl.impl.ghactions to version 1.5.0 (#1460) 2026-03-03 17:59:39 -08:00
Jen Basch 0e685591eb Respect --omit-project-settings for all evaluator options (#1459) 2026-03-03 16:23:42 -08:00
dependabot[bot] 51bb1a5c7e Bump gradle/actions from 5.0.1 to 5.0.2 (#1456) 2026-03-02 09:00:50 -08:00
layla 7c5a80a584 Fix typo: recieve to receive (#1455) 2026-03-01 13:43:29 -08:00
Kushal Pisavadia f9b880be85 Fix command typealias unwrapping in resolveType (#1449)
The loop unwraps nullables and constraints but breaks straight away
after a `typealias`. This means the nullable is missed. Removing the
`break` fixes it.

## Exception

```
org.pkl.core.PklException: –– Pkl Error ––
Command option property `foo` has unsupported type `String?`.

11 | foo: OptionalString
     ^^^^^^^^^^^^^^^^^^^
at <unknown> (file:///var/folders/xh/lmp1n6qj4m13t53cfmbqnkwh0000gn/T/junit-1378070630576324311/cmd.pkl)

Use a supported type or define a transformEach and/or transformAll function
```
2026-02-27 13:33:00 -08:00
Jen Basch 7119526245 Fix typo in 0.31 release notes (#1450) 2026-02-27 13:18:10 -08:00
Kushal Pisavadia 64ea7951db Fix stream double-consumption in CommandSpecParser (#1448)
The `choices` stream was consumed eagerly for metavar construction, then
captured in a lambda for later validation—which promptly fell over with
`IllegalStateException`. Materialise to a `List` straightaway.
2026-02-27 10:04:32 +00:00
Islon Scherer cac3e483b5 Start next dev iteration 2026-02-26 09:51:27 -08:00
Islon Scherer 4d35f18309 Prepare 0.31.0 release 2026-02-26 09:51:27 -08:00
Jen Basch 4cf2a1b42c Allow command options to have nullable types and default values (#1444) 2026-02-26 08:34:46 -08:00
Jen Basch 3ef065b6b6 Correct --root-dir check to also work for jar:file: URIs (#1442) 2026-02-25 10:57:01 -08:00
Jen Basch be21c34938 Allow command transformAll functions to perform imports (#1440) 2026-02-25 08:03:53 -08:00
Jen Basch 2e4d73b957 Fix regression in CLI error handling when project loading fails (#1439) 2026-02-25 01:28:05 -08:00
Jen Basch 28b09134d7 Add release notes for 0.31 (#1438) 2026-02-24 08:56:16 -08:00
Jen Basch 4611d181a8 Remove broken Collection.transpose method (#1437) 2026-02-24 08:09:52 -08:00
Jen Basch 12915f520f Fix command error and import handling (#1436) 2026-02-24 08:09:25 -08:00
Jen Basch 2ec0baad53 Allow referring to remote project dependencies on the CLI with @-notation (#1434) 2026-02-23 08:52:56 -08:00
dependabot[bot] 77395a86f4 Bump EnricoMi/publish-unit-test-result-action from 2.22.0 to 2.23.0 (#1435) 2026-02-23 08:51:04 -08:00
Jen Basch a5dc91f0a5 Command flag behavior improvements (#1432)
* Forbid overlap of built-in and command-defined flag names 
* Allow interleaving built-in and command-defined flags on the command
line
* List abbreviated flag names first, matching the behavior of built-in
flags
2026-02-20 12:00:18 -08:00
Jen Basch 08712e8b26 Fix display of evaluation errors thrown by command convert/transformAll (#1431) 2026-02-20 07:51:33 -08:00
Jen Basch e07868b404 Handle lexer errors in pkl format (#1430)
Resolves #1421
2026-02-19 10:00:00 -08:00
Jen Basch 72a57af164 SPICE-0025: pkl run CLI framework (#1367) 2026-02-12 07:53:02 -08:00
Jen Basch 63a20dd453 Improve org.pkl.formatter.Formatter JVM API (#1428)
Makes for less fussing around to consume this API from the Gradle side
2026-02-11 09:22:42 -08:00
Islon Scherer 60f628eb36 Fix possible race condition during module and resource reading (#1426) 2026-02-11 11:18:11 +01:00
Jen Basch 817e433a7f Document annotations and annotation converters (#1427) 2026-02-09 10:19:47 -08:00
Islon Scherer 08d8c8ec7a Improve import formatting (#1424) 2026-02-06 17:57:50 +01:00
Jen Basch effa4844e6 Bump pkl.impl.ghactions to version 1.3.5 (#1422) 2026-02-06 08:43:45 -08:00
Islon Scherer f0449c8330 Add flag to turn power assertions on/off (#1419) 2026-02-03 09:35:16 +01:00
dependabot[bot] 7b7b51c0ae Bump gradle/actions from 5.0.0 to 5.0.1 (#1420)
Bumps [gradle/actions](https://github.com/gradle/actions) from 5.0.0 to
5.0.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/gradle/actions/releases">gradle/actions's
releases</a>.</em></p>
<blockquote>
<h2>v5.0.1</h2>
<h2>What's Changed</h2>
<ul>
<li>Bump <code>npm</code> code dependency versions</li>
<li>Bump Gradle versions used in sample builds</li>
<li>Bump dependencies versions in Gradle sample builds</li>
<li>Bump GitHub actions used for build and test</li>
<li>Update known wrapper checksums to include Gradle 9.2+</li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/gradle/actions/compare/v5.0.0...v5.0.1">https://github.com/gradle/actions/compare/v5.0.0...v5.0.1</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/gradle/actions/commit/f29f5a9d7b09a7c6b29859002d29d24e1674c884"><code>f29f5a9</code></a>
Attempt to fix flaky caching tests (<a
href="https://redirect.github.com/gradle/actions/issues/836">#836</a>)</li>
<li><a
href="https://github.com/gradle/actions/commit/8c7f3ffba4042e38a9b017ec1433452e674e4403"><code>8c7f3ff</code></a>
Bump to v1.4.1 of the dependency-submission plugin</li>
<li><a
href="https://github.com/gradle/actions/commit/85e9805d21cf3b1d1c54c470ae15083df20e00ed"><code>85e9805</code></a>
[bot] Update dist directory</li>
<li><a
href="https://github.com/gradle/actions/commit/acb81f1e15dbc4ea06da2aa52ac9a056747ba8cf"><code>acb81f1</code></a>
Bump the npm-dependencies group across 1 directory with 8 updates (<a
href="https://redirect.github.com/gradle/actions/issues/821">#821</a>)</li>
<li><a
href="https://github.com/gradle/actions/commit/00660c8721edeac5845b81ab1a2d47af4de1e150"><code>00660c8</code></a>
Bump github/codeql-action from 4.31.10 to 4.32.0 in the github-actions
group ...</li>
<li><a
href="https://github.com/gradle/actions/commit/d498ad3b5f3030c0feb2913ae7059605e5d4de40"><code>d498ad3</code></a>
[bot] Update dist directory</li>
<li><a
href="https://github.com/gradle/actions/commit/de83f3396312260c9a3dfc1d77ee4b6f2361eb9a"><code>de83f33</code></a>
Update Gradle version and Gradle dependencies (<a
href="https://redirect.github.com/gradle/actions/issues/834">#834</a>)</li>
<li><a
href="https://github.com/gradle/actions/commit/baabf402fa7896574cf6caf18668d5509e3ce8ef"><code>baabf40</code></a>
Bump the github-actions group across 2 directories with 5 updates</li>
<li><a
href="https://github.com/gradle/actions/commit/69353a9e141a8a7865bcbf48a099ad644e9adf2f"><code>69353a9</code></a>
Bump the gradle group across 1 directory with 4 updates</li>
<li><a
href="https://github.com/gradle/actions/commit/221c7f4dbd2468936638e2ba4fe1d987ce3bbe0d"><code>221c7f4</code></a>
Update known wrapper checksums</li>
<li>Additional commits viewable in <a
href="https://github.com/gradle/actions/compare/4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2...f29f5a9d7b09a7c6b29859002d29d24e1674c884">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=gradle/actions&package-manager=github_actions&previous-version=5.0.0&new-version=5.0.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-02 09:39:13 -08:00
dependabot[bot] a2bfbd72a7 Bump actions/checkout from 6.0.1 to 6.0.2 (#1417) 2026-01-26 09:04:22 -08:00
dependabot[bot] 11b65e4d7a Bump actions/setup-java from 5.1.0 to 5.2.0 (#1416) 2026-01-26 08:55:53 -08:00
Jen Basch 73264e8fd1 SPICE-0024: Annotation converters (#1333)
This enables defining declarative key and/or value transformations in
cases where neither `Class`- nor path-based converters can be applied
gracefully. It is also the only way to express transforming the
resulting property names in `Typed` objects without applying a converter
to the entire containing type, which is cumbersome at best.

SPICE: https://github.com/apple/pkl-evolution/pull/26
2026-01-23 12:44:41 -08:00
Daniel Chao ed0cad668f Fix Function.toString (#1411)
Fixes an issue where the underlying default Java toString() is leaking
through
2026-01-21 07:29:58 -08:00
Daniel Chao 03a7676e64 Implement power assertions (#1384)
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.

* Literal values are not emitted in the diagram
* Stdlib constructors of literals like `List(1, 2)` are also considered
  literals

Power assertions are added to:

* Failing type constraints
* Failing test facts

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.

---------

Co-authored-by: Islon Scherer <islonscherer@gmail.com>
2026-01-20 21:41:33 -08:00
Daniel Chao 3cd294b62a Add 'let' to list of control keywords (#1409)
Small improvement to syntax highlighting
2026-01-19 20:00:21 -08:00
Jen Basch f6cfc82201 Bump pkl.impl.ghactions to version 1.3.3 (#1408)
Updates pkl.impl.ghactions package to version 1.3.3
2026-01-15 12:06:56 -08:00
Jen Basch fd66438828 Bump pkl.impl.ghactions to version 1.3.2 (#1403)
Updates pkl.impl.ghactions package to version 1.3.2
2026-01-12 18:01:46 -08:00
Daniel Chao b4bd292511 Handle IOException when creating PklProject.deps.json (#1405)
Fixes an issue that otherwise bubbles up as "An unexpected error has
occured".
2026-01-12 15:08:38 -08:00
Daniel Chao f1c71bc9bb Emit error stack trace on non Pkl exceptions (#1402)
If the thrown error is not a Pkl exception, some internal error
occurred, and we need to emit the stack trace for visibility.
2026-01-12 13:45:39 -08:00
Akshat Anand 9d385f2194 Fix super method call inside let expression (#1383)
Fixes #1309

The issue was that super calls were blocked inside let expressions
because:
1. The compiler's isClassMemberScope() check didn't skip over lambda
scopes created by let expressions
2. The runtime's findSupermethod() didn't traverse past VmFunction
owners to find the actual class prototype

Changes:
- SymbolTable.java: Updated isClassMemberScope() to skip lambda scopes
before checking if the parent is a class or module scope
- InvokeSuperMethodNode.java: Updated findSupermethod() to skip
VmFunction owners when looking for the class prototype

Added regression tests covering:
- Super method calls inside let expressions
- Super property access inside let expressions
- Nested let expressions with super calls

---------

Co-authored-by: Jen Basch <jbasch@apple.com>
2026-01-09 19:59:20 -08:00
Jen Basch 3595c03078 Fix spotless ratcheting on release branches (#1401) 2026-01-09 14:18:18 -08:00
Jen Basch 9b6f72d5d0 Fix doc links from pkl:base to pkl:math (#1400) 2026-01-09 11:30:56 -08:00