[tests] Add test data for KT-60447
This commit is contained in:
committed by
Space Team
parent
7a254cab9a
commit
7dc3ed61c0
@@ -0,0 +1,33 @@
|
|||||||
|
// ISSUE: KT-60447
|
||||||
|
|
||||||
|
// IGNORE_LIGHT_ANALYSIS
|
||||||
|
// IGNORE_BACKEND: ANY
|
||||||
|
// REASON: red code (see corresponding diagnostic test)
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val buildee = build {
|
||||||
|
class ConcreteType
|
||||||
|
class TargetType {
|
||||||
|
fun consumeConcreteType(value: ConcreteType) {}
|
||||||
|
}
|
||||||
|
setTypeVariableProducerFunction { TargetType() }
|
||||||
|
setTypeVariableConsumerFunction { it.consumeConcreteType(ConcreteType()) }
|
||||||
|
}
|
||||||
|
val targetType = buildee.typeVariableProducer()
|
||||||
|
buildee.typeVariableConsumer(targetType)
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Buildee<TV> {
|
||||||
|
var typeVariableConsumer: (TV) -> Unit = {}
|
||||||
|
var typeVariableProducer: () -> TV = { null!! }
|
||||||
|
fun setTypeVariableConsumerFunction(consumer: (TV) -> Unit) { typeVariableConsumer = consumer }
|
||||||
|
fun setTypeVariableProducerFunction(producer: () -> TV) { typeVariableProducer = producer }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> {
|
||||||
|
return Buildee<PTV>().apply(instructions)
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
// ISSUE: KT-60447
|
||||||
|
|
||||||
|
// IGNORE_LIGHT_ANALYSIS
|
||||||
|
// IGNORE_BACKEND: ANY
|
||||||
|
// REASON: red code (see corresponding diagnostic test)
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val buildee = build {
|
||||||
|
setTypeVariableProducerFunction { TargetType() }
|
||||||
|
setTypeVariableConsumerFunction { it.consumeConcreteType(ConcreteType()) }
|
||||||
|
}
|
||||||
|
val targetType = buildee.typeVariableProducer()
|
||||||
|
buildee.typeVariableConsumer(targetType)
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class ConcreteType
|
||||||
|
class TargetType {
|
||||||
|
fun consumeConcreteType(value: ConcreteType) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Buildee<TV> {
|
||||||
|
var typeVariableConsumer: (TV) -> Unit = {}
|
||||||
|
var typeVariableProducer: () -> TV = { null!! }
|
||||||
|
fun setTypeVariableConsumerFunction(consumer: (TV) -> Unit) { typeVariableConsumer = consumer }
|
||||||
|
fun setTypeVariableProducerFunction(producer: () -> TV) { typeVariableProducer = producer }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> {
|
||||||
|
return Buildee<PTV>().apply(instructions)
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
// ISSUE: KT-60447
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
val buildee = build {
|
||||||
|
class ConcreteType
|
||||||
|
class TargetType {
|
||||||
|
fun consumeConcreteType(value: ConcreteType) {}
|
||||||
|
fun targetTypeMemberFunction() {}
|
||||||
|
}
|
||||||
|
setTypeVariableProducerFunction { TargetType() }
|
||||||
|
setTypeVariableConsumerFunction { it.<!UNRESOLVED_REFERENCE!>consumeConcreteType<!>(ConcreteType()) }
|
||||||
|
}
|
||||||
|
// local class equality check — turns unexpected compile-time behavior into red code
|
||||||
|
// considered to be non-user-reproducible code for the purposes of these tests
|
||||||
|
buildee.typeVariableProducer().targetTypeMemberFunction()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Buildee<TV> {
|
||||||
|
var typeVariableConsumer: (TV) -> Unit = {}
|
||||||
|
var typeVariableProducer: () -> TV = { null!! }
|
||||||
|
fun setTypeVariableConsumerFunction(consumer: (TV) -> Unit) { typeVariableConsumer = consumer }
|
||||||
|
fun setTypeVariableProducerFunction(producer: () -> TV) { typeVariableProducer = producer }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> {
|
||||||
|
return Buildee<PTV>().apply(instructions)
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
// ISSUE: KT-60447
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
val buildee = build {
|
||||||
|
class ConcreteType
|
||||||
|
class TargetType {
|
||||||
|
fun consumeConcreteType(value: ConcreteType) {}
|
||||||
|
fun targetTypeMemberFunction() {}
|
||||||
|
}
|
||||||
|
setTypeVariableProducerFunction { TargetType() }
|
||||||
|
setTypeVariableConsumerFunction { it.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE, DEBUG_INFO_UNRESOLVED_WITH_TARGET, UNRESOLVED_REFERENCE!>consumeConcreteType<!>(ConcreteType()) }
|
||||||
|
}
|
||||||
|
// local class equality check — turns unexpected compile-time behavior into red code
|
||||||
|
// considered to be non-user-reproducible code for the purposes of these tests
|
||||||
|
buildee.typeVariableProducer().targetTypeMemberFunction()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Buildee<TV> {
|
||||||
|
var typeVariableConsumer: (TV) -> Unit = {}
|
||||||
|
var typeVariableProducer: () -> TV = { null!! }
|
||||||
|
fun setTypeVariableConsumerFunction(consumer: (TV) -> Unit) { typeVariableConsumer = consumer }
|
||||||
|
fun setTypeVariableProducerFunction(producer: () -> TV) { typeVariableProducer = producer }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> {
|
||||||
|
return Buildee<PTV>().apply(instructions)
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
// ISSUE: KT-60447
|
||||||
|
// CHECK_TYPE_WITH_EXACT
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
val buildee = build {
|
||||||
|
setTypeVariableProducerFunction { TargetType() }
|
||||||
|
setTypeVariableConsumerFunction { it.<!UNRESOLVED_REFERENCE!>consumeConcreteType<!>(ConcreteType()) }
|
||||||
|
}
|
||||||
|
// 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 {
|
||||||
|
fun consumeConcreteType(value: ConcreteType) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Buildee<TV> {
|
||||||
|
var typeVariableConsumer: (TV) -> Unit = {}
|
||||||
|
var typeVariableProducer: () -> TV = { null!! }
|
||||||
|
fun setTypeVariableConsumerFunction(consumer: (TV) -> Unit) { typeVariableConsumer = consumer }
|
||||||
|
fun setTypeVariableProducerFunction(producer: () -> TV) { typeVariableProducer = producer }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> {
|
||||||
|
return Buildee<PTV>().apply(instructions)
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
// ISSUE: KT-60447
|
||||||
|
// CHECK_TYPE_WITH_EXACT
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
val buildee = build {
|
||||||
|
setTypeVariableProducerFunction { TargetType() }
|
||||||
|
setTypeVariableConsumerFunction { it.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE, DEBUG_INFO_UNRESOLVED_WITH_TARGET, UNRESOLVED_REFERENCE!>consumeConcreteType<!>(ConcreteType()) }
|
||||||
|
}
|
||||||
|
// 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 {
|
||||||
|
fun consumeConcreteType(value: ConcreteType) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Buildee<TV> {
|
||||||
|
var typeVariableConsumer: (TV) -> Unit = {}
|
||||||
|
var typeVariableProducer: () -> TV = { null!! }
|
||||||
|
fun setTypeVariableConsumerFunction(consumer: (TV) -> Unit) { typeVariableConsumer = consumer }
|
||||||
|
fun setTypeVariableProducerFunction(producer: () -> TV) { typeVariableProducer = producer }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> {
|
||||||
|
return Buildee<PTV>().apply(instructions)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user