Files
Tianyu Geng 765cad8448 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.
2021-09-17 01:59:06 +03:00

36 lines
1.1 KiB
Plaintext
Vendored

FILE: importedReceiver.kt
public final fun <T> R|T|.foo(): R|kotlin/Unit| {
}
public abstract interface Your<R> : R|kotlin/Any| {
public open fun wat(): R|kotlin/Unit| {
}
public open fun <T> R|T|.watwat(): R|kotlin/Unit| {
}
}
public final object My : R|Your<kotlin/Double>| {
private constructor(): R|My| {
super<R|kotlin/Any|>()
}
public final fun <T> R|T|.bar(): R|kotlin/Unit| {
}
public final fun baz(): R|kotlin/Unit|
public final fun R|kotlin/Boolean|.gau(): R|kotlin/Unit| {
}
}
public final fun test(): R|kotlin/Unit| {
Int(42).R|/foo|<R|kotlin/Int|>()
String().R|/foo|<R|kotlin/String|>()
(Q|My|, Int(42)).R|/My.bar|<R|kotlin/Int|>()
(Q|My|, String()).R|/My.bar|<R|kotlin/String|>()
Q|My|.R|/My.baz|()
(Q|My|, Boolean(true)).R|/My.gau|()
Q|My|.R|SubstitutionOverride</My.wat: R|kotlin/Unit|>|()
(Q|My|, Boolean(false)).R|SubstitutionOverride</My.watwat: R|kotlin/Unit|>|<R|kotlin/Boolean|>()
}