[FIR TEST] Add test on qualifier resolve priority (corner case)
This commit is contained in:
@@ -29,6 +29,6 @@ class E {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun main() {
|
fun main() {
|
||||||
E.f() // Resolves to (2)
|
E.f() // Resolves to (2) in old FE (to (1) in FIR with object implicit invoke support)
|
||||||
E.f.invoke() // Resolves to (1)
|
E.f.invoke() // Resolves to (1)
|
||||||
}
|
}
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
class AHolder(val a: Int)
|
||||||
|
|
||||||
|
class F {
|
||||||
|
object foo { // (1)
|
||||||
|
val a: Int = 42
|
||||||
|
}
|
||||||
|
companion object { // (2)
|
||||||
|
val foo: AHolder = AHolder(52)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class FF {
|
||||||
|
object foo {} // (1)
|
||||||
|
companion object { // (2)
|
||||||
|
val foo: AHolder = AHolder(52)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
F.foo.a // (1) everywhere
|
||||||
|
F.foo // (2) in old FE, (1) in FIR
|
||||||
|
// Why companion?
|
||||||
|
with(F.foo) {
|
||||||
|
a // (2) in old FE, (1) in FIR
|
||||||
|
}
|
||||||
|
FF.foo.<!UNRESOLVED_REFERENCE!>a<!> // (1) everywhere
|
||||||
|
// Why not companion
|
||||||
|
}
|
||||||
+68
@@ -0,0 +1,68 @@
|
|||||||
|
FILE: qualifierPriority.kt
|
||||||
|
public final class AHolder : R|kotlin/Any| {
|
||||||
|
public constructor(a: R|kotlin/Int|): R|AHolder| {
|
||||||
|
super<R|kotlin/Any|>()
|
||||||
|
}
|
||||||
|
|
||||||
|
public final val a: R|kotlin/Int| = R|<local>/a|
|
||||||
|
public get(): R|kotlin/Int|
|
||||||
|
|
||||||
|
}
|
||||||
|
public final class F : R|kotlin/Any| {
|
||||||
|
public constructor(): R|F| {
|
||||||
|
super<R|kotlin/Any|>()
|
||||||
|
}
|
||||||
|
|
||||||
|
public final object foo : R|kotlin/Any| {
|
||||||
|
private constructor(): R|F.foo| {
|
||||||
|
super<R|kotlin/Any|>()
|
||||||
|
}
|
||||||
|
|
||||||
|
public final val a: R|kotlin/Int| = Int(42)
|
||||||
|
public get(): R|kotlin/Int|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public final companion object Companion : R|kotlin/Any| {
|
||||||
|
private constructor(): R|F.Companion| {
|
||||||
|
super<R|kotlin/Any|>()
|
||||||
|
}
|
||||||
|
|
||||||
|
public final val foo: R|AHolder| = R|/AHolder.AHolder|(Int(52))
|
||||||
|
public get(): R|AHolder|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public final class FF : R|kotlin/Any| {
|
||||||
|
public constructor(): R|FF| {
|
||||||
|
super<R|kotlin/Any|>()
|
||||||
|
}
|
||||||
|
|
||||||
|
public final object foo : R|kotlin/Any| {
|
||||||
|
private constructor(): R|FF.foo| {
|
||||||
|
super<R|kotlin/Any|>()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public final companion object Companion : R|kotlin/Any| {
|
||||||
|
private constructor(): R|FF.Companion| {
|
||||||
|
super<R|kotlin/Any|>()
|
||||||
|
}
|
||||||
|
|
||||||
|
public final val foo: R|AHolder| = R|/AHolder.AHolder|(Int(52))
|
||||||
|
public get(): R|AHolder|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public final fun main(): R|kotlin/Unit| {
|
||||||
|
Q|F.foo|.R|/F.foo.a|
|
||||||
|
Q|F.foo|
|
||||||
|
R|kotlin/with|<R|F.foo|, R|kotlin/Int|>(Q|F.foo|, <L> = with@fun R|F.foo|.<anonymous>(): R|kotlin/Int| <kind=EXACTLY_ONCE> {
|
||||||
|
^ this@R|special/anonymous|.R|/F.foo.a|
|
||||||
|
}
|
||||||
|
)
|
||||||
|
Q|FF.foo|.<Unresolved name: a>#
|
||||||
|
}
|
||||||
Generated
+5
@@ -685,6 +685,11 @@ public class FirDiagnosticsWithStdlibTestGenerated extends AbstractFirDiagnostic
|
|||||||
runTest("compiler/fir/resolve/testData/resolveWithStdlib/problems/KJKComplexHierarchyNestedLoop.kt");
|
runTest("compiler/fir/resolve/testData/resolveWithStdlib/problems/KJKComplexHierarchyNestedLoop.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("qualifierPriority.kt")
|
||||||
|
public void testQualifierPriority() throws Exception {
|
||||||
|
runTest("compiler/fir/resolve/testData/resolveWithStdlib/problems/qualifierPriority.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("weakHashMap.kt")
|
@TestMetadata("weakHashMap.kt")
|
||||||
public void testWeakHashMap() throws Exception {
|
public void testWeakHashMap() throws Exception {
|
||||||
runTest("compiler/fir/resolve/testData/resolveWithStdlib/problems/weakHashMap.kt");
|
runTest("compiler/fir/resolve/testData/resolveWithStdlib/problems/weakHashMap.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user