Files
kotlin-fork/compiler/testData/diagnostics/tests/multimodule/duplicateMethod/functionGenericsInParamsBoundsMismatch.kt
T
Andrey Breslav 204fa76691 When checking overrides, compare methods structurally
Because they may come from different copies of the same class from different modules
2014-06-02 22:05:28 +04:00

40 lines
643 B
Kotlin

// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL
// MODULE: m1
// FILE: a.kt
package p
public trait B {
public fun <T> foo(a: T): B?
}
// MODULE: m2(m1)
// FILE: b.kt
package p
public trait C : B {
override fun <T> foo(a: T): B?
}
// MODULE: m3
// FILE: b.kt
package p
public trait Tr
public trait B {
public fun <T: Tr?> foo(a: T): B?
}
// MODULE: m4(m3, m2)
// FILE: c.kt
import p.*
fun test(b: B?) {
if (b is C) {
// hard to find parameters for an ambiguous call, so we rely on NONE_APPLICABLE here
// as opposed to diagnostics for a single unmatched candidate
b?.<!NONE_APPLICABLE!>foo<!>()
}
}