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
@@ -461,8 +461,8 @@ KtFirFunctionSymbol:
|
||||
annotatedType: [] kotlin/Boolean
|
||||
annotationClassIds: []
|
||||
annotations: []
|
||||
callableIdIfNonLocal: kotlin/collections/List.isEmpty
|
||||
dispatchType: kotlin/collections/List<E>
|
||||
callableIdIfNonLocal: kotlin/collections/MutableList.isEmpty
|
||||
dispatchType: kotlin/collections/MutableList<E>
|
||||
hasStableParameterNames: true
|
||||
isExtension: false
|
||||
isExternal: false
|
||||
@@ -538,11 +538,11 @@ KtFirKotlinPropertySymbol:
|
||||
annotatedType: [] kotlin/Int
|
||||
annotationClassIds: []
|
||||
annotations: []
|
||||
callableIdIfNonLocal: kotlin/collections/List.size
|
||||
dispatchType: kotlin/collections/List<E>
|
||||
getter: KtFirPropertyGetterSymbol(<getter>)
|
||||
callableIdIfNonLocal: kotlin/collections/MutableList.size
|
||||
dispatchType: kotlin/collections/MutableList<E>
|
||||
getter: null
|
||||
hasBackingField: false
|
||||
hasGetter: true
|
||||
hasGetter: false
|
||||
hasSetter: false
|
||||
initializer: null
|
||||
isConst: false
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
Resolved to:
|
||||
0: (in kotlin.collections.IntIterator) operator fun next(): kotlin.Int
|
||||
1: (in kotlin.collections.Iterator) operator fun hasNext(): kotlin.Boolean
|
||||
2: (in kotlin.ranges.IntProgression) open operator fun iterator(): kotlin.collections.IntIterator
|
||||
0: (in kotlin.collections.IntIterator) abstract operator fun hasNext(): kotlin.Boolean
|
||||
1: (in kotlin.collections.IntIterator) operator fun next(): kotlin.Int
|
||||
2: (in kotlin.ranges.IntProgression) open operator fun iterator(): kotlin.collections.IntIterator
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
Resolved to:
|
||||
0: (in kotlin.collections.CharIterator) operator fun next(): kotlin.Char
|
||||
1: (in kotlin.collections.Iterator) operator fun hasNext(): kotlin.Boolean
|
||||
2: (in kotlin.text) operator fun kotlin.CharSequence.iterator(): kotlin.collections.CharIterator
|
||||
0: (in kotlin.collections.CharIterator) abstract operator fun hasNext(): kotlin.Boolean
|
||||
1: (in kotlin.collections.CharIterator) operator fun next(): kotlin.Char
|
||||
2: (in kotlin.text) operator fun kotlin.CharSequence.iterator(): kotlin.collections.CharIterator
|
||||
Reference in New Issue
Block a user