FIR: Add test case for qualifier-based call resolution

This commit is contained in:
Denis Zharkov
2020-04-16 15:08:30 +03:00
parent 6fdbc38cf1
commit 477e8bbcd4
5 changed files with 100 additions and 1 deletions
@@ -29,6 +29,7 @@ class E {
}
fun main() {
E.f // Resolves to (2) in old FE (Resolves to (1) in FIR)
E.f() // Resolves to (2) in old FE (Resolves to (1) in FIR)
E.f.invoke() // Resolves to (1)
E.f.invoke() // Resolves to (1) in old FE and FIR
}
@@ -74,6 +74,7 @@ FILE: invokePriority.kt
}
public final fun main(): R|kotlin/Unit| {
Q|E.f|
Q|E.f|.R|/E.f.invoke|()
Q|E.f|.R|/E.f.invoke|()
}
@@ -0,0 +1,24 @@
class AHolder(val a: Int)
class E {
object foo { // (1)
val a: Int = 42
}
companion object { // (2)
val foo: AHolder = AHolder(52)
}
}
class EE {
object foo {} // (1)
companion object { // (2)
val foo: AHolder = AHolder(52)
}
}
fun main() {
E.foo.a // (1) in old FE and FIR
E.foo // (2) !!! in old FE, (1) in FIR
with(E.foo) {
a // (2) in old FE, (1) in FIR
}
EE.foo.<!UNRESOLVED_REFERENCE!>a<!> // (1) !!! in old FE and FIR
}
@@ -0,0 +1,68 @@
FILE: invokePriorityComplex.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 E : R|kotlin/Any| {
public constructor(): R|E| {
super<R|kotlin/Any|>()
}
public final object foo : R|kotlin/Any| {
private constructor(): R|E.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|E.Companion| {
super<R|kotlin/Any|>()
}
public final val foo: R|AHolder| = R|/AHolder.AHolder|(Int(52))
public get(): R|AHolder|
}
}
public final class EE : R|kotlin/Any| {
public constructor(): R|EE| {
super<R|kotlin/Any|>()
}
public final object foo : R|kotlin/Any| {
private constructor(): R|EE.foo| {
super<R|kotlin/Any|>()
}
}
public final companion object Companion : R|kotlin/Any| {
private constructor(): R|EE.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|E.foo|.R|/E.foo.a|
Q|E.foo|
R|kotlin/with|<R|E.foo|, R|kotlin/Int|>(Q|E.foo|, <L> = with@fun R|E.foo|.<anonymous>(): R|kotlin/Int| <kind=EXACTLY_ONCE> {
^ this@R|special/anonymous|.R|/E.foo.a|
}
)
Q|EE.foo|.<Unresolved name: a>#
}
@@ -868,6 +868,11 @@ public class FirDiagnosticsWithStdlibTestGenerated extends AbstractFirDiagnostic
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/invokePriority.kt");
}
@TestMetadata("invokePriorityComplex.kt")
public void testInvokePriorityComplex() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/invokePriorityComplex.kt");
}
@TestMetadata("KJKComplexHierarchyNestedLoop.kt")
public void testKJKComplexHierarchyNestedLoop() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/KJKComplexHierarchyNestedLoop.kt");