Fix type argument substitution bug in KFunction construction
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
This commit is contained in:
+4
@@ -16,4 +16,8 @@ fun main() {
|
||||
checkSubtype<KExtensionFunction0<A, Unit>>(x)
|
||||
checkSubtype<KExtensionFunction1<A, Int, Unit>>(y)
|
||||
checkSubtype<KExtensionFunction0<A, String>>(z)
|
||||
|
||||
checkSubtype<KExtensionFunction<A, Unit>>(x)
|
||||
checkSubtype<KExtensionFunction<A, Unit>>(y)
|
||||
checkSubtype<KExtensionFunction<A, String>>(z)
|
||||
}
|
||||
|
||||
+4
@@ -16,4 +16,8 @@ fun main() {
|
||||
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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user