FIR checker: substitute type parameters in dispatch receiver type
Consider the following code:
```
fun test(a: List<String>) {
a.first()
}
```
The dispatch receiver type of `first` in this case is `List<T>` before
this change. After this change, it's `List<String>`.
In addition, this change also replace the dispatch receiver type with
the more specific type if available. For example, consider the following
```
class MyList: ArrayList<String>()
fun test(a: MyList) {
a.get(0)
}
```
The dispatch receiver type of `get` is `MyList`, instead of
`ArrayList<String>`. That is, a fake override is created in this case.
This commit is contained in:
committed by
teamcityserver
parent
c047adbaec
commit
765cad8448
+1
-1
@@ -143,7 +143,7 @@ digraph flow_kt {
|
||||
color=blue
|
||||
64 [label="Enter loop condition"];
|
||||
65 [label="Access variable R|<local>/<iterator>|"];
|
||||
66 [label="Function call: R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()"];
|
||||
66 [label="Function call: R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/IntIterator.hasNext: R|kotlin/Boolean|>|()"];
|
||||
67 [label="Exit loop condition"];
|
||||
}
|
||||
subgraph cluster_20 {
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ FILE: flow.kt
|
||||
Boolean(true) -> {
|
||||
{
|
||||
lval <iterator>: R|kotlin/collections/IntIterator| = Int(0).R|kotlin/Int.rangeTo|(Int(0)).R|kotlin/ranges/IntProgression.iterator|()
|
||||
while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
|
||||
while(R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/IntIterator.hasNext: R|kotlin/Boolean|>|()) {
|
||||
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()
|
||||
R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user