[tests] Add test data for KT-43710
This commit is contained in:
committed by
Space Team
parent
8dbeb721a2
commit
04b05f7912
@@ -0,0 +1,33 @@
|
||||
// ISSUE: KT-43710
|
||||
|
||||
// IGNORE_LIGHT_ANALYSIS
|
||||
// IGNORE_BACKEND: ANY
|
||||
// REASON: red code (see corresponding diagnostic test)
|
||||
|
||||
fun box(): String {
|
||||
build {
|
||||
setTypeVariable(TargetType())
|
||||
letForTypeVariable { it.extensionProduceConcreteType() }
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class ConcreteType
|
||||
class TargetType
|
||||
class DifferentType
|
||||
|
||||
fun TargetType.extensionProduceConcreteType(): ConcreteType = ConcreteType()
|
||||
fun DifferentType.extensionProduceConcreteType(): ConcreteType = ConcreteType()
|
||||
|
||||
class Buildee<TV> {
|
||||
fun setTypeVariable(value: TV) { storage = value }
|
||||
fun letForTypeVariable(action: (TV) -> ConcreteType): ConcreteType = storage.let(action)
|
||||
private var storage: TV = TargetType() as TV
|
||||
}
|
||||
|
||||
fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> {
|
||||
return Buildee<PTV>().apply(instructions)
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// ISSUE: KT-43710
|
||||
// CHECK_TYPE_WITH_EXACT
|
||||
|
||||
fun test() {
|
||||
val buildee = build {
|
||||
setTypeVariable(TargetType())
|
||||
letForTypeVariable { it.<!OVERLOAD_RESOLUTION_AMBIGUITY!>extensionProduceConcreteType<!>() }
|
||||
}
|
||||
// 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<TargetType>>(buildee)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class ConcreteType
|
||||
class TargetType
|
||||
class DifferentType
|
||||
|
||||
fun TargetType.extensionProduceConcreteType(): ConcreteType = ConcreteType()
|
||||
fun DifferentType.extensionProduceConcreteType(): ConcreteType = ConcreteType()
|
||||
|
||||
class Buildee<TV> {
|
||||
fun setTypeVariable(value: TV) { storage = value }
|
||||
fun letForTypeVariable(action: (TV) -> ConcreteType): ConcreteType = storage.let(action)
|
||||
private var storage: TV = null!!
|
||||
}
|
||||
|
||||
fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> {
|
||||
return Buildee<PTV>().apply(instructions)
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// ISSUE: KT-43710
|
||||
// CHECK_TYPE_WITH_EXACT
|
||||
|
||||
fun test() {
|
||||
val buildee = build {
|
||||
setTypeVariable(TargetType())
|
||||
letForTypeVariable <!TYPE_MISMATCH("ConcreteType; Unit")!>{ <!STUB_TYPE_IN_RECEIVER_CAUSES_AMBIGUITY!>it<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE, OVERLOAD_RESOLUTION_AMBIGUITY, OVERLOAD_RESOLUTION_AMBIGUITY_BECAUSE_OF_STUB_TYPES!>extensionProduceConcreteType<!>() }<!>
|
||||
}
|
||||
// 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<TargetType>>(buildee)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class ConcreteType
|
||||
class TargetType
|
||||
class DifferentType
|
||||
|
||||
fun TargetType.extensionProduceConcreteType(): ConcreteType = ConcreteType()
|
||||
fun DifferentType.extensionProduceConcreteType(): ConcreteType = ConcreteType()
|
||||
|
||||
class Buildee<TV> {
|
||||
fun setTypeVariable(value: TV) { storage = value }
|
||||
fun letForTypeVariable(action: (TV) -> ConcreteType): ConcreteType = storage.let(action)
|
||||
private var storage: TV = null!!
|
||||
}
|
||||
|
||||
fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> {
|
||||
return Buildee<PTV>().apply(instructions)
|
||||
}
|
||||
Reference in New Issue
Block a user