KT-10460: use unsubstituted descriptors

while comparing overloaded generic functions  for specificity.
This commit is contained in:
Dmitry Petrov
2016-01-14 19:02:56 +03:00
parent d21ce08548
commit a073f29006
14 changed files with 111 additions and 26 deletions
@@ -0,0 +1,11 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -REDUNDANT_PROJECTION
class In<in T>() {
fun f(t : T) {}
fun f(t : Int) = t
}
fun test1(x: In<String>): Unit = x.f("1")
fun test2(x: In<in String>): Unit = x.f("1")
fun test3(x: In<<!CONFLICTING_PROJECTION!>out<!> String>): Unit = x.<!NONE_APPLICABLE!>f<!>("1")
fun test4(x: In<*>): Unit = x.<!NONE_APPLICABLE!>f<!>("1")
@@ -0,0 +1,15 @@
package
public fun test1(/*0*/ x: In<kotlin.String>): kotlin.Unit
public fun test2(/*0*/ x: In<in kotlin.String>): kotlin.Unit
public fun test3(/*0*/ x: In<out kotlin.String>): kotlin.Unit
public fun test4(/*0*/ x: In<*>): kotlin.Unit
public final class In</*0*/ in T> {
public constructor In</*0*/ in T>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final fun f(/*0*/ t: T): kotlin.Unit
public final fun f(/*0*/ t: kotlin.Int): kotlin.Int
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,9 @@
interface AutoCloseable
interface Closeable : AutoCloseable
fun <T1 : AutoCloseable, R1> T1.myUse(f: (T1) -> R1): R1 = f(this)
fun <T2 : Closeable, R2> T2.myUse(f: (T2) -> R2): R2 = f(this)
fun test1(x: Closeable) = x.myUse { 42 }
fun test2(x: Closeable) = x.myUse<Closeable, Int> { 42 }
fun test3(x: Closeable) = x.myUse<<!UPPER_BOUND_VIOLATED!>AutoCloseable<!>, Int> { 42 } // TODO KT-10681
@@ -0,0 +1,19 @@
package
public fun test1(/*0*/ x: Closeable): kotlin.Int
public fun test2(/*0*/ x: Closeable): kotlin.Int
public fun test3(/*0*/ x: Closeable): kotlin.Int
public fun </*0*/ T1 : AutoCloseable, /*1*/ R1> T1.myUse(/*0*/ f: (T1) -> R1): R1
public fun </*0*/ T2 : Closeable, /*1*/ R2> T2.myUse(/*0*/ f: (T2) -> R2): R2
public interface AutoCloseable {
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 interface Closeable : AutoCloseable {
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
}