9807c67ae4
If some java class has multiple supertypes then we need to collect overriddens from all those types directly, even if superTypeScope (which is FirTypeIntersectionScope in this case) returns only one symbol from one of this types (not intersection one) This is needed to proper enhancement in cases when some type occurs multiple times in supertypes graph with different nullability of arguments: class ConcurrentHashMap<K, V> : AbstractMap<K!, V!>, MutableMap<K, V> If we try to find method `get(key: K): V` supertype scope returns `AbstractMap.get(key: K!): V!` (because it actually overrides `MutableMap(key: K): V?`), but we need to get both symbols to properly enhance types for `ConcurrentHashMap.remove`
33 lines
773 B
Kotlin
Vendored
33 lines
773 B
Kotlin
Vendored
fun test1() {
|
|
val x: Int
|
|
val x$delegate: Lazy<Int> = lazy<Int>(initializer = local fun <anonymous>(): Int {
|
|
return 42
|
|
}
|
|
)
|
|
local get(): Int {
|
|
return x$delegate.getValue<Int>(thisRef = null, property = ::x)
|
|
}
|
|
|
|
println(message = <get-x>())
|
|
}
|
|
|
|
fun test2() {
|
|
var x: Int
|
|
val x$delegate: HashMap<String, Int> = hashMapOf<String, Int>()
|
|
local get(): Int {
|
|
return x$delegate.getValue<Int, Int>(thisRef = null, property = ::x)
|
|
}
|
|
local set(<set-?>: Int) {
|
|
x$delegate.setValue<Int>(thisRef = null, property = ::x, value = <set-?>)
|
|
}
|
|
|
|
<set-x>(<set-?> = 0)
|
|
{ // BLOCK
|
|
val <unary>: Int = <get-x>()
|
|
<set-x>(<set-?> = <unary>.inc())
|
|
<unary>
|
|
} /*~> Unit */
|
|
<set-x>(<set-?> = <get-x>().plus(other = 1))
|
|
}
|
|
|