Fix exception when Java class has different methods with same erasure

^KT-36856 Fixed
This commit is contained in:
Denis Zharkov
2020-02-20 13:06:41 +03:00
parent 7efb32628e
commit 071149e0fb
8 changed files with 80 additions and 23 deletions
+19
View File
@@ -0,0 +1,19 @@
// !CHECK_TYPE
// FILE: Test.java
public class Test {
public <T> T with(Foo<T> matcher) {
return null;
}
public boolean with(Foo<Boolean> matcher) {
return false;
}
}
// FILE: main.kt
class Foo<T>
fun main(foo1: Foo<Boolean>, foo2: Foo<String>) {
val x = object : Test() {} // FE exception is thrown here
x.with(foo1) checkType { <!UNRESOLVED_REFERENCE!>_<!><Boolean>() }
x.with(foo2) checkType { <!UNRESOLVED_REFERENCE!>_<!><String>() }
}
+20
View File
@@ -0,0 +1,20 @@
// !CHECK_TYPE
// FILE: Test.java
public class Test {
public <T> T with(Foo<T> matcher) {
return null;
}
public boolean with(Foo<Boolean> matcher) {
return false;
}
}
// FILE: main.kt
class Foo<T>
fun main(foo1: Foo<Boolean>, foo2: Foo<String>) {
val x = object : Test() {} // FE exception is thrown here
x.with(foo1) checkType { _<Boolean>() }
x.with(foo2) checkType { _<String>() }
}
+19
View File
@@ -0,0 +1,19 @@
package
public fun main(/*0*/ foo1: Foo<kotlin.Boolean>, /*1*/ foo2: Foo<kotlin.String>): kotlin.Unit
public final class Foo</*0*/ T> {
public constructor Foo</*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
}
public open class Test {
public constructor Test()
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 open fun </*0*/ T : kotlin.Any!> with(/*0*/ matcher: Foo<T!>!): T!
public open fun with(/*0*/ matcher: Foo<kotlin.Boolean!>!): kotlin.Boolean
}