Add this as a self type (#1708)

This commit is contained in:
Jen Basch
2026-09-02 09:04:15 -07:00
committed by GitHub
parent 1208fa9438
commit 2b697015c7
305 changed files with 1487 additions and 561 deletions
@@ -751,6 +751,12 @@ class JavaCodeGenerator(
when (this) {
PType.UNKNOWN -> OBJECT.nullableIf(nullable)
PType.NOTHING -> TypeName.VOID
PType.MODULE,
PType.THIS ->
// TODO: support self types: `class Foo<T extends Foo<T>>`
throw JavaCodeGeneratorException(
"Pkl `${this}` types are not supported by the Java code generator."
)
is PType.StringLiteral -> STRING.nullableIf(nullable)
is PType.Class -> {
// if in doubt, spell it out