Files
kotlin-fork/compiler/testData/diagnostics/tests/inference/constraints/kt6320.kt
T
Ilya Chernikov 70c89a28e1 Stop subtyping constraint search if equality constraints for...
all not fixed type vars are found
#KT-35626 fixed
2020-03-12 08:02:45 +01:00

21 lines
593 B
Kotlin
Vendored

// !WITH_NEW_INFERENCE
// !DIAGNOSTICS: -UNUSED_VARIABLE
// AssertionError in ConstraintSystem(The constraint shouldn't contain different type variables on both sides: Y <: X)
class A<X, Y : X>
class B<X, Y : X>(<!UNUSED_PARAMETER!>foo<!>: A<X, Y>) {
fun test1(a: A<X, Y>) {
B(a)
val b: B<X, Y> = B(a)
// crash here
}
}
class C<X, Z, Y : X>
class D<X, Z, Y : X>(<!UNUSED_PARAMETER!>foo<!>: C<X, Z, Y>) {
fun test(a: C<Y, Y, Y>) {
val d: D<X, Y, Y> = <!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>D(a)<!>
}
}