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
Vendored
+2
-2
@@ -100,7 +100,7 @@ FILE: implicitReceivers.kt
|
||||
public final fun R|kotlin/Any|.test_5(): R|kotlin/Int| {
|
||||
^test_5 when () {
|
||||
(this@R|/test_5| is R|kotlin/collections/List<*>|) -> {
|
||||
this@R|/test_5|.R|kotlin/collections/List.size|
|
||||
this@R|/test_5|.R|SubstitutionOverride<kotlin/collections/List.size: R|kotlin/Int|>|
|
||||
}
|
||||
(this@R|/test_5| is R|kotlin/String|) -> {
|
||||
this@R|/test_5|.R|kotlin/String.length|
|
||||
@@ -113,7 +113,7 @@ FILE: implicitReceivers.kt
|
||||
}
|
||||
public final fun R|kotlin/Any|.test_6(): R|kotlin/Unit| {
|
||||
(this@R|/test_6| as R|kotlin/collections/List<*>|)
|
||||
this@R|/test_6|.R|kotlin/collections/List.size|
|
||||
this@R|/test_6|.R|SubstitutionOverride<kotlin/collections/List.size: R|kotlin/Int|>|
|
||||
(this@R|/test_6| as R|kotlin/String|)
|
||||
this@R|/test_6|.R|kotlin/String.length|
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user