// ISSUE: KT-63841 // CHECK_TYPE_WITH_EXACT class TargetType { fun targetTypeMemberFunction() {} } class DifferentType fun test() { val targetTypeBuildee = build { var variable = getTypeVariable() variable = TargetType() variable.targetTypeMemberFunction() } // exact type equality check — turns unexpected compile-time behavior into red code // considered to be non-user-reproducible code for the purposes of these tests checkExactType>(; Buildee"), TYPE_MISMATCH("Buildee; Buildee")!>targetTypeBuildee) val differentTypeBuildee = build { var variable = getTypeVariable() variable = DifferentType() variable.targetTypeMemberFunction() } // exact type equality check — turns unexpected compile-time behavior into red code // considered to be non-user-reproducible code for the purposes of these tests checkExactType>(differentTypeBuildee) val anyBuildee = build { var variable = getTypeVariable() variable = TargetType() variable.targetTypeMemberFunction() variable = DifferentType() variable.targetTypeMemberFunction() variable = TargetType() variable.targetTypeMemberFunction() } // exact type equality check — turns unexpected compile-time behavior into red code // considered to be non-user-reproducible code for the purposes of these tests checkExactType>(; Buildee"), TYPE_MISMATCH("Buildee; Buildee")!>anyBuildee) } class Buildee { fun getTypeVariable(): TV = storage private var storage: TV = null!! } fun build(instructions: Buildee.() -> Unit): Buildee { return Buildee().apply(instructions) }