[FIR-TEST] Add test with problem with default java importing scope
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
// FILE: util/HashMap.java
|
||||
|
||||
package util;
|
||||
|
||||
public class HashMap<K, V> extends java.util.HashMap<K, V> {}
|
||||
|
||||
// FILE: foo/ArrayList.java
|
||||
|
||||
package foo;
|
||||
|
||||
public class ArrayList<T> extends java.util.ArrayList<T> {}
|
||||
|
||||
// FILE: LinkedList.kt
|
||||
|
||||
package foo
|
||||
|
||||
class LinkedList<T> : java.util.LinkedList<T>()
|
||||
|
||||
// FILE: HashSet.kt
|
||||
|
||||
package util
|
||||
|
||||
class HashSet<T> : java.util.HashSet<T>
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
package foo
|
||||
|
||||
import util.HashMap
|
||||
import util.HashSet
|
||||
|
||||
class LinkedHashMap<K, V> : java.util.LinkedHashMap<K, V>()
|
||||
|
||||
fun test_1() {
|
||||
val map = <!AMBIGUITY!>HashMap<!><Int, Int>() // <- should be util.HashMap
|
||||
}
|
||||
|
||||
fun test_2() {
|
||||
val set = <!AMBIGUITY!>HashSet<!><Int>() // <- should be util.HashSet
|
||||
}
|
||||
|
||||
fun test_3() {
|
||||
val list = <!AMBIGUITY!>ArrayList<!><Int>() // <- should be foo.ArrayList
|
||||
}
|
||||
|
||||
fun test_4() {
|
||||
val list = LinkedList<Int>() // <- should be foo.LinkedList
|
||||
}
|
||||
|
||||
fun test_5() {
|
||||
val map = LinkedHashMap<Int, Int>() // should be foo.LinkedHashMap
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
FILE: LinkedList.kt
|
||||
public final class LinkedList<T> : R|class error: Symbol not found, for `java.util.LinkedList<R|T|>`| {
|
||||
public constructor<T>(): R|foo/LinkedList<T>| {
|
||||
super<R|class error: Symbol not found, for `java.util.LinkedList<R|T|>`|>()
|
||||
}
|
||||
|
||||
}
|
||||
FILE: HashSet.kt
|
||||
public final class HashSet<T> : R|java/util/HashSet<T>| {
|
||||
public constructor<T>(): R|util/HashSet<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
FILE: main.kt
|
||||
public final class LinkedHashMap<K, V> : R|class error: Symbol not found, for `java.util.LinkedHashMap<R|K|, R|V|>`| {
|
||||
public constructor<K, V>(): R|foo/LinkedHashMap<K, V>| {
|
||||
super<R|class error: Symbol not found, for `java.util.LinkedHashMap<R|K|, R|V|>`|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test_1(): R|kotlin/Unit| {
|
||||
lval map: <ERROR TYPE REF: Ambiguity: HashMap, [util/HashMap.HashMap, java/util/HashMap.HashMap]> = <Ambiguity: HashMap, [util/HashMap.HashMap, java/util/HashMap.HashMap]>#<R|kotlin/Int|, R|kotlin/Int|>()
|
||||
}
|
||||
public final fun test_2(): R|kotlin/Unit| {
|
||||
lval set: <ERROR TYPE REF: Ambiguity: HashSet, [util/HashSet.HashSet, java/util/HashSet.HashSet]> = <Ambiguity: HashSet, [util/HashSet.HashSet, java/util/HashSet.HashSet]>#<R|kotlin/Int|>()
|
||||
}
|
||||
public final fun test_3(): R|kotlin/Unit| {
|
||||
lval list: <ERROR TYPE REF: Ambiguity: ArrayList, [foo/ArrayList.ArrayList, java/util/ArrayList.ArrayList]> = <Ambiguity: ArrayList, [foo/ArrayList.ArrayList, java/util/ArrayList.ArrayList]>#<R|kotlin/Int|>()
|
||||
}
|
||||
public final fun test_4(): R|kotlin/Unit| {
|
||||
lval list: R|foo/LinkedList<kotlin/Int>| = R|foo/LinkedList.LinkedList|<R|kotlin/Int|>()
|
||||
}
|
||||
public final fun test_5(): R|kotlin/Unit| {
|
||||
lval map: R|foo/LinkedHashMap<kotlin/Int, kotlin/Int>| = R|foo/LinkedHashMap.LinkedHashMap|<R|kotlin/Int|, R|kotlin/Int|>()
|
||||
}
|
||||
+5
@@ -873,6 +873,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
|
||||
runTest("compiler/fir/resolve/testData/resolve/problems/asImports.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("defaultJavaImportHiding.kt")
|
||||
public void testDefaultJavaImportHiding() throws Exception {
|
||||
runTest("compiler/fir/resolve/testData/resolve/problems/defaultJavaImportHiding.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("definitelyNotNullAmbiguity.kt")
|
||||
public void testDefinitelyNotNullAmbiguity() throws Exception {
|
||||
runTest("compiler/fir/resolve/testData/resolve/problems/definitelyNotNullAmbiguity.kt");
|
||||
|
||||
Reference in New Issue
Block a user