[Analysis API] implement an API to get a substitution based on an inheritance relationship between classes

^KT-62090 fixed
This commit is contained in:
Ilya Kirillov
2023-09-20 22:34:44 +02:00
committed by Space Team
parent 49cfbb0576
commit 15e4cbc10d
33 changed files with 716 additions and 2 deletions
@@ -0,0 +1,10 @@
// WITH_STDLIB
class A<caret_base>A : BB<Int, String>
class BB<S, T> : CC<S, T, List<T>>
class C<caret_super>C<X, Y, Z> {
fun foo(): kotlin.Triple<X, Y, Z>
}
@@ -0,0 +1,3 @@
Substitutor: <map substitutor: {X = S, Y = T, Z = kotlin/collections/List<T>}> then <map substitutor: {S = kotlin/Int, T = kotlin/String}>
Substituted callables:
foo(): Triple<Int, String, List<String>>
@@ -0,0 +1,6 @@
class A<caret_base>A : BB<Int, String>
class BB<S, T> : CC<S, T, List<T>>
class C<caret_super>CC<X, Y, Z> : AA
@@ -0,0 +1,8 @@
// WITH_STDLIB
class A<caret_base>A<T, S> : BB<List<T>, Map<S, Int>, S>
class B<caret_super>B<Q, R, T> {
fun foo(): kotlin.Triple<Q, R, T>
}
@@ -0,0 +1,3 @@
Substitutor: <map substitutor: {Q = kotlin/collections/List<T>, R = kotlin/collections/Map<S, kotlin/Int>, T = S}>
Substituted callables:
foo(): Triple<List<T>, Map<S, Int>, S>
@@ -0,0 +1,8 @@
// WITH_STDLIB
class A<caret_base>A : BB<Int>
class B<caret_super>B<S> {
fun foo(): List<S>
}
@@ -0,0 +1,3 @@
Substitutor: <map substitutor: {S = kotlin/Int}>
Substituted callables:
foo(): List<Int>
@@ -0,0 +1,6 @@
class A<caret_base>A<T> : BB<T>
class B<caret_super>B<S> {
fun foo(): S
}
@@ -0,0 +1,3 @@
Substitutor: <map substitutor: {S = T}>
Substituted callables:
foo(): T
@@ -0,0 +1,6 @@
class A<caret_base>A : BB<Int>
class B<caret_super>B<S : String> {
fun foo(): S
}
@@ -0,0 +1,3 @@
Substitutor: <map substitutor: {S = kotlin/Int}>
Substituted callables:
foo(): Int
@@ -0,0 +1,6 @@
class A<caret_base>A : BB<Int, String>
class B<caret_super>B<S> {
fun foo(): S
}
@@ -0,0 +1,7 @@
// WITH_STDLIB
class A<caret_base>A : BB<Int, String>
class B<caret_super>B<S, Q, U> {
fun foo(): Triple<S, Q, U>
}
@@ -0,0 +1,7 @@
class A<caret_base>A : BB<Int>, BB<String>
class B<caret_super>B<S> {
fun foo(): Triple<S>
}
@@ -0,0 +1,3 @@
Substitutor: <map substitutor: {S = kotlin/Int}>
Substituted callables:
foo(): Triple<S>
@@ -0,0 +1,7 @@
// WITH_STDLIB
class A<caret_base>A<caret_super>A : BB<Int, String>
class BB<S, T> : CC<S, T, List<T>> {
fun foo(): Triple<S, T>
}
@@ -0,0 +1 @@
Substitutor: <empty substitutor>