Don't skip constraints from equations with the kind equal

The problem was that we didn't incorporate T == Foo into K <: Inv<out T>.
 It happened because of optimisation that isn't applicable here as we
 already have projection in the initial type

 #KT-39777 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2020-06-23 12:56:12 +03:00
parent ab34f8c738
commit a5ae1b38b0
6 changed files with 57 additions and 3 deletions
@@ -0,0 +1,17 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun <K> materialize(): K = TODO()
class Foo
class Inv<T>
fun <T> test1(x: Inv<out T>) {}
fun <T> test2(x: Inv<in T>) {}
fun <T> test3(x: Inv<T>) {}
fun main() {
test1<Foo>(materialize())
test2<Foo>(materialize())
test3<Foo>(materialize())
}
@@ -0,0 +1,21 @@
package
public fun main(): kotlin.Unit
public fun </*0*/ K> materialize(): K
public fun </*0*/ T> test1(/*0*/ x: Inv<out T>): kotlin.Unit
public fun </*0*/ T> test2(/*0*/ x: Inv<in T>): kotlin.Unit
public fun </*0*/ T> test3(/*0*/ x: Inv<T>): kotlin.Unit
public final class Foo {
public constructor Foo()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class Inv</*0*/ T> {
public constructor Inv</*0*/ T>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}