pkl
pkl copied to clipboard
`toTyped` ignores default values in class
Given
class Bird {
name: String = "DEFAULT"
colloquialName: String = name
}
evaluating
new Dynamic { name = "Pigeon" }.toTyped(Bird)
results in
new Bird {
name = "Pigeon"
colloquialName = "DEFAULT" // <- unexpected
}
The same holds for the toTyped definition on Map, so the following produces the same result:
new Dynamic { name = "Pigeon" }.toMap().toTyped(Bird)