Files
kotlin-fork/compiler/fir/analysis-tests/testData/resolve/properties/javaAccessorsComplex.fir.txt
T
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

34 lines
1.1 KiB
Plaintext
Vendored

FILE: main.kt
public abstract interface KB<F> : R|kotlin/Any| {
public abstract override fun getFoo(): R|F|
public abstract override fun getBar(): R|F|
}
public abstract interface D1 : R|JA<kotlin/String>|, R|KB<kotlin/String>| {
}
public abstract interface E1 : R|D1| {
public abstract override fun getFoo(): R|kotlin/String|
public abstract override fun getBar(): R|kotlin/String|
}
public abstract interface D2 : R|KB<kotlin/String>|, R|JA<kotlin/String>| {
}
public abstract interface E2 : R|D2| {
public abstract override fun getFoo(): R|kotlin/String|
public abstract override fun getBar(): R|kotlin/String|
}
public final fun main(d1: R|D1|, e1: R|E1|, d2: R|D2|, e2: R|E2|): R|kotlin/Unit| {
R|<local>/d1|.R|/KB.foo|
R|<local>/d1|.<Unresolved name: bar>#
R|<local>/e1|.R|/E1.foo|
R|<local>/e1|.<Unresolved name: bar>#
R|<local>/d2|.R|/KB.foo|
R|<local>/d2|.<Unresolved name: bar>#
R|<local>/e2|.R|/E2.foo|
R|<local>/e2|.<Unresolved name: bar>#
}