Allow command options to have nullable types and default values (#1444)

This commit is contained in:
Jen Basch authored and GitHub committed 2026-02-26 08:34:46 -08:00
1 parent 3ef065b6b6
commit 4cf2a1b42c
4 files changed
+2 -32

No files matched your search

@@ -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<PklException> { 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 =