[tests] Add test data for KT-63733
This commit is contained in:
committed by
Space Team
parent
a836e94619
commit
2bcaa3eb8f
@@ -0,0 +1,35 @@
|
|||||||
|
// ISSUE: KT-63733
|
||||||
|
|
||||||
|
// IGNORE_LIGHT_ANALYSIS
|
||||||
|
// IGNORE_BACKEND: ANY
|
||||||
|
// REASON: red code (see corresponding diagnostic test)
|
||||||
|
|
||||||
|
fun BoundedBuildee<TargetType>.setBoundedTypeVariable(arg: DifferentType) {}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
boundedBuild<TargetType> {
|
||||||
|
setBoundedTypeVariable(TargetType())
|
||||||
|
setBoundedTypeVariable(DifferentType())
|
||||||
|
}
|
||||||
|
boundedBuild {
|
||||||
|
setBoundedTypeVariable(TargetType())
|
||||||
|
setBoundedTypeVariable(DifferentType())
|
||||||
|
}
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
open class TargetTypeBase
|
||||||
|
class TargetType: TargetTypeBase()
|
||||||
|
class DifferentType
|
||||||
|
|
||||||
|
class BoundedBuildee<BTV: TargetTypeBase> {
|
||||||
|
fun setBoundedTypeVariable(value: BTV) { storage = value }
|
||||||
|
private var storage: BTV = TargetType() as BTV
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <PBTV: TargetTypeBase> boundedBuild(instructions: BoundedBuildee<PBTV>.() -> Unit): BoundedBuildee<PBTV> {
|
||||||
|
return BoundedBuildee<PBTV>().apply(instructions)
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
// ISSUE: KT-63733
|
||||||
|
// CHECK_TYPE_WITH_EXACT
|
||||||
|
|
||||||
|
fun BoundedBuildee<TargetType>.setBoundedTypeVariable(arg: DifferentType) {}
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
boundedBuild<TargetType> {
|
||||||
|
setBoundedTypeVariable(TargetType())
|
||||||
|
setBoundedTypeVariable(DifferentType())
|
||||||
|
}
|
||||||
|
val buildee = <!NEW_INFERENCE_ERROR!>boundedBuild {
|
||||||
|
setBoundedTypeVariable(TargetType())
|
||||||
|
setBoundedTypeVariable(DifferentType())
|
||||||
|
}<!>
|
||||||
|
// 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<BoundedBuildee<TargetType>>(<!ARGUMENT_TYPE_MISMATCH("BoundedBuildee<TargetType>; BoundedBuildee<kotlin.Any>")!>buildee<!>)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
open class TargetTypeBase
|
||||||
|
class TargetType: TargetTypeBase()
|
||||||
|
class DifferentType
|
||||||
|
|
||||||
|
class BoundedBuildee<BTV: TargetTypeBase> {
|
||||||
|
fun setBoundedTypeVariable(value: BTV) { storage = value }
|
||||||
|
private var storage: BTV = null!!
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <PBTV: TargetTypeBase> boundedBuild(instructions: BoundedBuildee<PBTV>.() -> Unit): BoundedBuildee<PBTV> {
|
||||||
|
return BoundedBuildee<PBTV>().apply(instructions)
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
// ISSUE: KT-63733
|
||||||
|
// CHECK_TYPE_WITH_EXACT
|
||||||
|
|
||||||
|
fun BoundedBuildee<TargetType>.setBoundedTypeVariable(arg: DifferentType) {}
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
boundedBuild<TargetType> {
|
||||||
|
setBoundedTypeVariable(TargetType())
|
||||||
|
setBoundedTypeVariable(DifferentType())
|
||||||
|
}
|
||||||
|
val buildee = boundedBuild {
|
||||||
|
setBoundedTypeVariable(TargetType())
|
||||||
|
setBoundedTypeVariable(<!TYPE_MISMATCH("TargetTypeBase; DifferentType")!>DifferentType()<!>)
|
||||||
|
}
|
||||||
|
// 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<BoundedBuildee<TargetType>>(<!TYPE_MISMATCH("BoundedBuildee<TargetType>; BoundedBuildee<Any>"), TYPE_MISMATCH("BoundedBuildee<Any>; BoundedBuildee<TargetType>")!>buildee<!>)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
open class TargetTypeBase
|
||||||
|
class TargetType: TargetTypeBase()
|
||||||
|
class DifferentType
|
||||||
|
|
||||||
|
class BoundedBuildee<BTV: TargetTypeBase> {
|
||||||
|
fun setBoundedTypeVariable(value: BTV) { storage = value }
|
||||||
|
private var storage: BTV = null!!
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <PBTV: TargetTypeBase> boundedBuild(instructions: BoundedBuildee<PBTV>.() -> Unit): BoundedBuildee<PBTV> {
|
||||||
|
return BoundedBuildee<PBTV>().apply(instructions)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user