diff --git a/docs/modules/release-notes/pages/0.31.adoc b/docs/modules/release-notes/pages/0.31.adoc index 17e9fbcd..082b67da 100644 --- a/docs/modules/release-notes/pages/0.31.adoc +++ b/docs/modules/release-notes/pages/0.31.adoc @@ -99,7 +99,7 @@ To learn more about this feature, consult https://github.com/apple/pkl-evolution [[cli-framework]] === CLI Framework -Pkl 0.31 introduces a new framework for implementing CLI tools in Pkl (pr:https://github.com/apple/pkl/pull/1367[], pr:https://github.com/apple/pkl/pull/1431[], pr:https://github.com/apple/pkl/pull/1432[], pr:https://github.com/apple/pkl/pull/1436[], pr:https://github.com/apple/pkl/pull/1440[]). +Pkl 0.31 introduces a new framework for implementing CLI tools in Pkl (pr:https://github.com/apple/pkl/pull/1367[], pr:https://github.com/apple/pkl/pull/1431[], pr:https://github.com/apple/pkl/pull/1432[], pr:https://github.com/apple/pkl/pull/1436[], pr:https://github.com/apple/pkl/pull/1440[], pr:https://github.com/apple/pkl/pull/1444[]). The framework provides a way to build command line tools with user experience idioms that will be immediately familiar to users. CLI tools implemented in Pkl have largely the same capabilities as normal Pkl evaluation (i.e. writing to standard output and files), but this may be extended using xref:language-reference:index.adoc#external-readers[external readers]. @@ -339,6 +339,7 @@ The following bugs have been fixed. * A possible race condition involving symlinks could bypass `--root-dir` during module and resource reading (pr:https://github.com/apple/pkl/pull/1426[]). * `pkl format` produces internal stack traces when lexing fails (pr:https://github.com/apple/pkl/pull/1430[]). * `super` access expressions are parsed incorrectly inside the spread operator (pr:https://github.com/apple/pkl/pull/1364[]). +* Modules and resources with `jar:file:` URIs were not properly sandboxed by `--root-dir` (pr:https://github.com/apple/pkl/pull/1442[]). == Contributors [small]#🙏# diff --git a/pkl-core/src/main/java/org/pkl/core/runtime/CommandSpecParser.java b/pkl-core/src/main/java/org/pkl/core/runtime/CommandSpecParser.java index c584788c..0c677556 100644 --- a/pkl-core/src/main/java/org/pkl/core/runtime/CommandSpecParser.java +++ b/pkl-core/src/main/java/org/pkl/core/runtime/CommandSpecParser.java @@ -513,12 +513,6 @@ public final class CommandSpecParser { var typeNode = resolved.getFirst(); isNullable = resolved.getSecond(); defaultValue = CommandSpecParser.this.getDefaultValue(prop, requireExplicitDefault); - if (isNullable && defaultValue != null) { - throw exceptionBuilder() - .evalError("commandOptionTypeNullableWithDefaultValue", prop.getName()) - .withSourceSection(prop.getHeaderSection()) - .build(); - } resolve(prop, typeNode); return this; diff --git a/pkl-core/src/main/resources/org/pkl/core/errorMessages.properties b/pkl-core/src/main/resources/org/pkl/core/errorMessages.properties index f0b13cbb..e9a4147e 100644 --- a/pkl-core/src/main/resources/org/pkl/core/errorMessages.properties +++ b/pkl-core/src/main/resources/org/pkl/core/errorMessages.properties @@ -1098,11 +1098,6 @@ Found both `@Flag` and `@Argument` annotations for options property `{0}`.\n\ \n\ Only one option type may be specified. -commandOptionTypeNullableWithDefaultValue=\ -Unexpected option property `{0}` with nullable type and default value.\n\ -\n\ -Options with default values must not be nullable. - commandOptionUnsupportedType=\ Command option property `{0}` has unsupported {1}type `{2}`. diff --git a/pkl-core/src/test/kotlin/org/pkl/core/runtime/CommandSpecParserTest.kt b/pkl-core/src/test/kotlin/org/pkl/core/runtime/CommandSpecParserTest.kt index ce30df00..bafbd485 100644 --- a/pkl-core/src/test/kotlin/org/pkl/core/runtime/CommandSpecParserTest.kt +++ b/pkl-core/src/test/kotlin/org/pkl/core/runtime/CommandSpecParserTest.kt @@ -292,26 +292,6 @@ class CommandSpecParserTest { assertThat(exc.message).contains("No type annotation found for `foo` property.") } - @Test - fun `nullable option with default not allowed`() { - val moduleUri = - writePklFile( - "cmd.pkl", - renderOptions + - """ - class Options { - foo: String? = "bar" - } - """ - .trimIndent(), - ) - - val exc = assertThrows { parse(moduleUri) } - assertThat(exc.message).contains("foo: String? = \"bar\"") - assertThat(exc.message) - .contains("Unexpected option property `foo` with nullable type and default value") - } - @Test fun `option with union type containing non-string-literals`() { val moduleUri =