Commit Graph
959 Commits
Author SHA1 Message Date
Islon Scherer 434f699887 Add limits to parser recursion (#1918) 2026-10-27 16:57:36 +01:00
Jen Basch 3e703995ca Add user generic methods (#1849) 2026-10-27 07:44:03 -07:00
Jen Basch 21d278eba5 Add user generic methods (#1849) 2026-10-27 07:17:08 -07:00
Islon Scherer 939e844c03 Add pkl:syntax stdlib module (#1821) 2026-10-23 15:51:22 +02:00
Jen Basch 0cb9843af7 Fix module type check defined in parent member bodies (#1936) 2026-10-22 12:00:49 -07:00
Jen Basch 05d8e88592 Fix checking of subscript key types references to Map/Mapping (#1933) 2026-10-22 17:01:46 +00:00
Daniel Chao dd026c7023 Minimize thrown IllegalStateException when profiling (#1931)
Sometimes we see a thrown IllegalStateException when CPU profiling,
where the underlying cause is a ConcurrentModificationException in
the underlying GraalVM internals.

This attempts to minimize the chances of this exception being thrown
by starting proiling after the evaluator and its context have been
created.
2026-10-22 09:44:10 -07:00
Aashish Mahato dd83b9ab4f Fix hashCode/equals inconsistency for negative zero in Duration and DataSize (#1932) 2026-10-22 09:07:34 -07:00
Daniel Chao 3f5797de6f Fix changelog links (#1929) 2026-10-21 15:32:55 -07:00
Daniel Chao ac0d9f1d31 Run GitHub release in parallel with Maven (#1928) 2026-10-21 15:09:53 -07:00
Jen Basch 95d7a4bcc9 Prepare 0.32.2 release (#1924) (#1926) 2026-10-21 14:12:21 -07:00
Jen Basch 23897fd8c3 Remove extra checkout from java executable build jobs (#1925) 2026-10-21 20:35:39 +00:00
Jen Basch f7adfceaeb Update bundled CA certs (#1923) 2026-10-21 16:45:39 +00:00
Daniel Chao a06684b2c0 Improve error message thrown for "cannot instantiate" (#1916)
If the parent comes from an implicit node (e.g. read super entry node),
Pkl will currently bury its source section when rendering the error
message.
2026-10-20 08:42:18 -07:00
Goutam Adwant ce977f1ffe Fix parameterized type checks in alias constraints (#1906)
Fixes an issue where a constraint inside a typealias that writes to frame slots is unable to resolve type arguments.
2026-10-19 23:29:30 +00:00
Daniel Chao 08f0c3781b Improve error messages when typealiases fail to check (#1914)
This adds the typealias' usage site to the stack frame.
2026-10-19 12:34:04 -07:00
Daniel Chao 97c73e7c28 Fix qualified type resolution (#1915)
Fixes an issue where `GetModuleOwnerNode` resolves to levelsUp == 0,
but its enclosing owner is a parse-time invisible scope.
2026-10-19 12:23:38 -07:00
Sam Gammon 78c0ebce9d Add summaries and groups to gradle tasks (#190)
Fixes and closes apple/pkl#188 by adding task names and groups to
major Pkl Gradle Plugin tasks

Signed-off-by: Sam Gammon <sam@elide.ventures>
2026-10-18 16:48:20 +00:00
Daniel Chao ef5e34c210 Fix failing Windows build (#1912)
This test is failing, but is also moot now because file URIs now
forbid authority components.
2026-10-16 19:18:11 +00:00
Aagam Shah e18d962033 Force the returned value in test.catch() and test.catchOrNull() (#1910) 2026-10-16 12:02:33 -07:00
9f79fe47da Replace VmObjectLike.iterateMemberValues() with VmObjectCursor (#1879)
Motivation:
- VmObjectLike.iterateMemberValues() is an internal iterator whose loop body is a Java lambda.
  It suffers from the following limitations:
  - `continue` and `break` cannot be used.
  - `return` becomes an (awkward) replacement for `continue` and `break`.
    It cannot be used to return from the enclosing method.
  - Mutating variables requires hoisting them (MutableBoolean, etc.).
  - Node.execute() calls are very slow because they are behind a Truffle boundary.
  - Callers of iterateMemberValues() do not specify what and how they want to iterate.
    This obscures the iteration code and makes it difficult (often impossible) to optimize.

Changes:
- Add interface VmObjectCursor, an external iterator that iterates over VmObject members.
  Its design is inspired by org.graalvm.collections.MapCursor.
- Add VmObjectCursor implementations specialized for different members, VmObject subclasses, and cursor options.
- Replace VmObjectLike.iterateMemberValues() with the following methods that return VmObjectCursor:
  - properties()
  - properties(CursorOption)
  - elements()
  - elements(CursorOption)
  - entries()
  - entries(CursorOption)
  - members
  - members(CursorOption)
- Replace all usages of iterateMemberValues() with one of the above methods.
  Before: object.iterateMembersValues((key, member, value) -> { if (member.isProp()) {...} });
  After : for (var cursor = object.properties(); cursor.advance(); ) {...}

Result:
- Iteration code is much simpler and clearer.
- Iteration code that calls Node.execute() is much faster because it is no longer behind a Truffle boundary.
- Other iteration code is potentially faster and can be better optimized in the future.

Co-authored-by: translatenix <119817707+translatenix@users.noreply.github.com>
Co-authored-by: Jen Basch <jbasch94@gmail.com>
2026-10-16 17:47:18 +00:00
Islon Scherer b97abe13bc Fix formatter instability (#1911) 2026-10-16 17:32:49 +02:00
Daniel Chao fe96e0b1b0 Bump Gradle to 9.8.1 (#1904) 2026-10-15 21:00:04 -07:00
Carpe-WangandJen Basch eff9a9e164 [fix] Add support for handling remote file URIs. (#629)
Co-authored-by: Jen Basch <jbasch@apple.com>
2026-10-15 14:05:46 -07:00
Maycon Campos 8399f11186 Document public module APIs (#1813) 2026-10-15 13:27:05 -07:00
Aagam ShahandJen Basch 6811abf11c feat: don't truncate pkldoc module names that lack the package prefix (#1909)
Co-authored-by: Jen Basch <jbasch@apple.com>
2026-10-15 11:36:44 -07:00
f96fba00e1 Add a CPU profiler (#1823)
This introduces a way to run CPU profiling.

The profiler produces output in pprof format.

CLI users can enable CPU profiling via command line flags.
Profiling is otherwise not offered as an API.

Co-authored-by: Jen Basch <jbasch94@gmail.com>
Co-authored-by: Islon Scherer <islonscherer@gmail.com>
2026-10-15 15:57:55 +00:00
Daniel ChaoandJen Basch d062312df9 Add sourceBundle task to download and prepare source bundles (#1902)
* Add tasks to generate source jars for java executables

* native source bundles

* source bundles in separate plugin

* Wire up sourceBundle task

* Produce bundles on a per-variant basis (Java fat jar, each native variant)
* Introduce `pklNativeSourceBundle` and `pklJvmSourceBundle` plugins for handling fat jar vs. GraalVM bits
* Download compiled classes list, and exclude Java sources for executable stuff specifically
* Include native sources when appropriate (GraalVM, JDK, zlib, musl, libpkl)

---------

Co-authored-by: Jen Basch <jbasch@apple.com>
2026-10-14 10:03:45 -07:00
Alexandre Kohler f4ad0da658 Fix lookaround regexes in String.lastIndexOf and replaceLast (#1908) 2026-10-13 11:32:12 -07:00
Daniel Chao 88a50d167e Add support for customizing spring boot ConfigurationProperties (#1897)
This adds an option which allows users to control exactly how
`@ConfigurationProperties` annotations are attached to classes.

This helps when:

* Spring Boot users don't have a single root class, but multiple
  classes that are injected in disparate places
* Pkl's module structure doesn't match the resulting `.properties`
  layout
2026-10-08 20:42:59 +00:00
Daniel Chao f973fd6717 Change how VmValueRenderer renders Typed values (#1412)
This changes it to render the qualified name instead of the simple name.

* Module classes render the module name
* Classes within module render the module name and the class name joined by `#`
* Rendering of members of `pkl:base` does not change

For example:

* `new k8s.core.v1.Service {}` instead of `new ModuleClass {}`.
* `new k8s.core.v1.Service#ServiceSpec {}` instead of `new ServiceSpec {}`
* `new pkl.Project {}` instead of `new ModuleClass {}`

This affects the following:

* `toString()`
* `trace()`
* Error messages
* REPL
2026-10-08 13:32:26 -07:00
Vladimir Matveev 66fb5c133b Module cache directory propagation (#1900)
Currently the module cache directory in CLI commands (and thus in Gradle tasks, since they use CLI commands under the hood) is only used for the "primary" task. For example, for an eval command, the module cache directory will be used for the evaluation of the target module.

However, most commands also work with projects, and for projects the `PklProject` file must be evaluated. This is done via `Project.loadFromPath`, which internally builds an evaluator with the default module cache path. Therefore, all evaluations of project manifests always use default cache path instead of whatever is configured through the CLI option/Gradle task property. This, in turn, may result in unexpected behavior: in general, the user would expect that if they specify the cache directory, it will be used for all evaluations (e.g. when they pre-populate the cache and expect evaluations to work offline).

The same is true for settings evaluation, although for settings it is significantly less important since settings scripts can't have remote dependencies.

This PR propagates cache path into the project evaluator (as well as the settings evaluator, for consistency). This will result in the user-specified cache directory being used for `PklProject` evaluations as well.
2026-10-07 13:58:40 -07:00
Daniel Chao 1a3d7a1a76 Produce compiled classes list (#1898)
This adjusts Gradle logic so that it produces a list of compiled classes
in each of the various native image builds.
2026-10-06 15:18:20 -07:00
Islon Scherer 862c61f2e2 Add net stdlib module with URL support (#1834) 2026-10-06 15:23:32 +02:00
Daniel Chao dbcecd9677 Fix decoding of pkl-binary into Java Pattern (#1895)
Patterns that originate from the language runtime will add
`Pattern.UNICODE_CHARACTER_CLASS | Pattern.UNICODE_CASE` as implicit
regex flags, so we need to do the same on the binary decoding side.
2026-10-05 09:09:30 -07:00
Daniel Chao ba25f4820c Perf improvements for String.endWith(Regex) (#1884)
* Compute a derived regex expression with `\z` anchor
* Ensure derived regex can't be messed up with comments (in extended mode) or quote start

Follow up to #1880
2026-10-05 09:09:03 -07:00
Jen Basch adaafc4045 Fix external reader process leak in pkl-server (#1885) 2026-10-02 14:16:25 -07:00
Daniel Chao 82fe176c69 Improve cases where type nodes can turn into TypeNode.UnionOfStringLiterals (#1875)
This adds logic to UnresolvedTypeNode to create a `UnionOfStringLiterals`
type node if a member is a typealias who is a string or a string literal union.

Also, this fixes an issue where marking a duplicate string literal with the
default marker throws an index out of bounds exception.
2026-10-02 09:16:25 -07:00
dependabot[bot]andJen Basch 6423b2add5 Bump commonMark from 0.29.0 to 0.30.0 (#1887)
* Bump commonMark from 0.29.0 to 0.30.0

Bumps `commonMark` from 0.29.0 to 0.30.0.

Updates `org.commonmark:commonmark` from 0.29.0 to 0.30.0
- [Release notes](https://github.com/commonmark/commonmark-java/releases)
- [Changelog](https://github.com/commonmark/commonmark-java/blob/main/CHANGELOG.md)
- [Commits](https://github.com/commonmark/commonmark-java/compare/commonmark-parent-0.29.0...commonmark-parent-0.30.0)

Updates `org.commonmark:commonmark-ext-gfm-tables` from 0.29.0 to 0.30.0
- [Release notes](https://github.com/commonmark/commonmark-java/releases)
- [Changelog](https://github.com/commonmark/commonmark-java/blob/main/CHANGELOG.md)
- [Commits](https://github.com/commonmark/commonmark-java/compare/commonmark-parent-0.29.0...commonmark-parent-0.30.0)

---
updated-dependencies:
- dependency-name: org.commonmark:commonmark
  dependency-version: 0.30.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: org.commonmark:commonmark-ext-gfm-tables
  dependency-version: 0.30.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* implement missing method

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jen Basch <jbasch@apple.com>
2026-10-01 18:25:05 +00:00
dependabot[bot] b9dd3c4de1 Bump junit from 6.1.1 to 6.1.3 (#1890)
Bumps `junit` from 6.1.1 to 6.1.3.

Updates `org.junit.jupiter:junit-jupiter-api` from 6.1.1 to 6.1.3
- [Release notes](https://github.com/junit-team/junit-framework/releases)
- [Commits](https://github.com/junit-team/junit-framework/compare/r6.1.1...r6.1.3)

Updates `org.junit.jupiter:junit-jupiter-engine` from 6.1.1 to 6.1.3
- [Release notes](https://github.com/junit-team/junit-framework/releases)
- [Commits](https://github.com/junit-team/junit-framework/compare/r6.1.1...r6.1.3)

Updates `org.junit.jupiter:junit-jupiter-params` from 6.1.1 to 6.1.3
- [Release notes](https://github.com/junit-team/junit-framework/releases)
- [Commits](https://github.com/junit-team/junit-framework/compare/r6.1.1...r6.1.3)

Updates `org.junit.platform:junit-platform-launcher` from 6.1.1 to 6.1.3
- [Release notes](https://github.com/junit-team/junit-framework/releases)
- [Commits](https://github.com/junit-team/junit-framework/compare/r6.1.1...r6.1.3)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter-api
  dependency-version: 6.1.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: org.junit.jupiter:junit-jupiter-engine
  dependency-version: 6.1.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: org.junit.jupiter:junit-jupiter-params
  dependency-version: 6.1.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: org.junit.platform:junit-platform-launcher
  dependency-version: 6.1.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-01 09:26:31 -07:00
dependabot[bot] d4dac43e30 Bump gradle/actions/dependency-submission from 6.1.0 to 6.3.0 (#1892)
Bumps [gradle/actions/dependency-submission](https://github.com/gradle/actions) from 6.1.0 to 6.3.0.
- [Release notes](https://github.com/gradle/actions/releases)
- [Commits](https://github.com/gradle/actions/compare/50e97c2cd7a37755bbfafc9c5b7cafaece252f6e...9c971963bec38e04b3d30dcc455b5382be2fdbfb)

---
updated-dependencies:
- dependency-name: gradle/actions/dependency-submission
  dependency-version: 6.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-01 09:05:54 -07:00
dependabot[bot] 15c070621e Bump the first-party group across 1 directory with 2 updates (#1886)
Bumps the first-party group with 2 updates in the / directory: [actions/checkout](https://github.com/actions/checkout) and [actions/setup-java](https://github.com/actions/setup-java).


Updates `actions/checkout` from 6.0.3 to 6.1.0
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/df4cb1c069e1874edd31b4311f1884172cec0e10...d23441a48e516b6c34aea4fa41551a30e30af803)

Updates `actions/setup-java` from 5.5.0 to 5.7.0
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](https://github.com/actions/setup-java/compare/0f481fcb613427c0f801b606911222b5b6f3083a...b6effb05e454b25005698d916606bdc6ffcbf961)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 6.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: first-party
- dependency-name: actions/setup-java
  dependency-version: 5.7.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: first-party
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-01 08:49:10 -07:00
dependabot[bot] 74c5ded7db Bump slf4j from 2.0.18 to 2.0.20 (#1888)
Bumps `slf4j` from 2.0.18 to 2.0.20.

Updates `org.slf4j:slf4j-api` from 2.0.18 to 2.0.20

Updates `org.slf4j:slf4j-simple` from 2.0.18 to 2.0.20

---
updated-dependencies:
- dependency-name: org.slf4j:slf4j-api
  dependency-version: 2.0.20
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: org.slf4j:slf4j-simple
  dependency-version: 2.0.20
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-01 08:45:52 -07:00
dependabot[bot] a5bcacf91d Bump jline from 4.3.1 to 4.4.6 (#1889)
Bumps `jline` from 4.3.1 to 4.4.6.

Updates `org.jline:jline-reader` from 4.3.1 to 4.4.6
- [Release notes](https://github.com/jline/jline3/releases)
- [Commits](https://github.com/jline/jline3/compare/4.3.1...4.4.6)

Updates `org.jline:jline-terminal` from 4.3.1 to 4.4.6
- [Release notes](https://github.com/jline/jline3/releases)
- [Commits](https://github.com/jline/jline3/compare/4.3.1...4.4.6)

Updates `org.jline:jline-terminal-jni` from 4.3.1 to 4.4.6
- [Release notes](https://github.com/jline/jline3/releases)
- [Commits](https://github.com/jline/jline3/compare/4.3.1...4.4.6)

---
updated-dependencies:
- dependency-name: org.jline:jline-reader
  dependency-version: 4.4.6
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: org.jline:jline-terminal
  dependency-version: 4.4.6
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: org.jline:jline-terminal-jni
  dependency-version: 4.4.6
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-01 08:43:35 -07:00
dependabot[bot] d839bff713 Bump the codeql group with 2 updates (#1891)
Bumps the codeql group with 2 updates: [github/codeql-action/analyze](https://github.com/github/codeql-action) and [github/codeql-action/init](https://github.com/github/codeql-action).


Updates `github/codeql-action/analyze` from 4.36.3 to 4.38.2
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/54f647b7e1bb85c95cddabcd46b0c578ec92bc1a...2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2)

Updates `github/codeql-action/init` from 4.36.3 to 4.38.2
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/54f647b7e1bb85c95cddabcd46b0c578ec92bc1a...2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2)

---
updated-dependencies:
- dependency-name: github/codeql-action/analyze
  dependency-version: 4.38.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: codeql
- dependency-name: github/codeql-action/init
  dependency-version: 4.38.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: codeql
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-01 08:36:56 -07:00
Rushikesh 5747506f3a Suppress pkl-gradle POM metadata warning (#1807) 2026-09-30 09:43:59 -07:00
Daniel Chao b8c7a42318 Make typechecking more PE friendly (#1871)
This makes various improvements to help truffle do partial
evaluation of code related to typechecking.

* Split `UnionTypeNode` into `UnionTypeNodeExploded` and
 `UnionTypeNodeLooped` to avoid gigantic graphs. This especially helps
  in the case of typealiases, because they are inlined into their usage
  sites.

* Move constraint-failure exception construction in
  `TypeConstraintNode` behind `@TruffleBoundary` helper methods
  instead of `transferToInterpreterAndInvalidate`, since building the
  exception is a rare, off-hot-path operation.

* Move `ClassNode`'s one-time class-initialization logic behind a
  `@TruffleBoundary` method (`initClass`), store `VmLanguage` as a
  field instead of recomputing it via `VmLanguage.get(this)`, and use
  `transferToInterpreterAndInvalidate` since class init never needs to
  re-run on the compiled path.

* Pass `VmLanguage` explicitly into `TypeTestNode` and `ClassNode`
  (via `AstBuilder`) rather than resolving it with
  `VmLanguage.get(this)` on a hot path.

* Fix various issues where the partial evaluator determines that a frame
  should have been materialized but was not.

* Pre-initialize call targets in `ObjectMember.setMemberNode()` and
  `FunctionLiteralNode` so the first invocation doesn't trigger a
  compilation invalidation.

* Fix truffle node tree issues (don't mark `@RootNode` as child,
  deepCopy instead of passing an already adopted node).

* Remove unnecessary interpreter transfers when throwing type mismatch exceptions
2026-09-30 07:16:54 -07:00
Alexandre Kohler 8331570aaf Fix String.endsWith for overlapping regex matches (#1880) 2026-09-29 21:52:12 -07:00
Jen Basch 1271da2741 Fixes to commands where (sub)commands never extend pkl:Command (#1882) 2026-09-29 23:19:28 +00:00
apple-ospo[bot] e83d8fa14b Replace repo-level CODE_OF_CONDUCT file with the inherited org-wide Code of Conduct in .github repo. (#1878)
Co-authored-by: apple-ospo[bot] <326325757+apple-ospo[bot]@users.noreply.github.com>
2026-09-25 10:51:20 -07:00