K2: add test for KT-56520, case (4), callable references (bound)
In this test, things work in the similar way as in constructors case (2). K1 resolves the explicit receiver HashMap<String, String>() to kotlin.collections.HashMap /* = java.util.HashMap */. K2 does the similar, but fun processConstructors from ConstructorProcessing.kt makes a type alias substitution, so in fact constructor of expanded java.util.HashMap is processed. Pay attention that both frontends ignore some.HashMap and java.util.HashMap due to ambiguous classifiers in explicit star importing scope. See FirScope.processConstructorsByName in ConstructorProcessing.kt
This commit is contained in:
committed by
Space Team
parent
168717b811
commit
f0058ee0d8
+4
@@ -0,0 +1,4 @@
|
||||
FILE: test.kt
|
||||
public final fun test(): R|kotlin/reflect/KProperty0<kotlin/Int>| {
|
||||
^test R|java/util/HashMap.HashMap|<R|kotlin/String|, R|kotlin/String|>()::R|SubstitutionOverride<java/util/HashMap.size: R|kotlin/Int|>|
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// FIR_IDENTICAL
|
||||
// ISSUE: KT-56520 (case 4, bound)
|
||||
// FIR_DUMP
|
||||
// FULL_JDK
|
||||
|
||||
// FILE: some/HashMap.java
|
||||
|
||||
package some;
|
||||
|
||||
public class HashMap<K, V> extends java.util.HashMap<K, V> {}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
import java.util.*
|
||||
import some.*
|
||||
|
||||
fun test() =
|
||||
// Ok in both K1 & K2.
|
||||
// K1 & K2 resolve this to kotlin.collections.HashMap.
|
||||
HashMap<String, String>()::size
|
||||
Reference in New Issue
Block a user