Skip to content

toTyped ignores default values in class #768

@holzensp

Description

@holzensp

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions