6e97f85863
For example,
KMemberFunction2<T, P1, P2, R> : KMemberFunction<T, R>
So for this inheritance the heuristic that was present ("take the last K type
parameters of the subclass, and substitute for K parameters of the superclass")
was wrong. The new heuristic for this case is: take type parameters with the
same names.
Also don't store "parameters" in a lazy value, since it's easy to compute and
it's computed practically every time anyway
24 lines
500 B
Kotlin
Vendored
24 lines
500 B
Kotlin
Vendored
// !CHECK_TYPE
|
|
|
|
import kotlin.reflect.*
|
|
|
|
class A {
|
|
fun foo() {}
|
|
fun bar(<!UNUSED_PARAMETER!>x<!>: Int) {}
|
|
fun baz() = "OK"
|
|
}
|
|
|
|
fun main() {
|
|
val x = A::foo
|
|
val y = A::bar
|
|
val z = A::baz
|
|
|
|
checkSubtype<KMemberFunction0<A, Unit>>(x)
|
|
checkSubtype<KMemberFunction1<A, Int, Unit>>(y)
|
|
checkSubtype<KMemberFunction0<A, String>>(z)
|
|
|
|
checkSubtype<KMemberFunction<A, Unit>>(x)
|
|
checkSubtype<KMemberFunction<A, Unit>>(y)
|
|
checkSubtype<KMemberFunction<A, String>>(z)
|
|
}
|