[FIR TEST] Add example with invoke priority inconsistent with old FE

This commit is contained in:
Mikhail Glukhikh
2020-02-07 18:17:41 +03:00
parent 232efa6303
commit 2c918d2787
3 changed files with 70 additions and 0 deletions
@@ -0,0 +1,20 @@
class A {
fun bar() {
val foo: String.() -> Unit = {} // (1)
fun String.foo(): Unit {} // (2)
"1".foo() // resolves to (2)
with("2") {
foo() // BUG: resolves to (1) in old FE, but to (2) in FIR
}
}
}
class B {
val foo: String.() -> Unit = {} // (1)
fun String.foo(): Unit {} // (2)
fun bar() {
"1".foo() // resolves to (2)
with("2") {
foo() // resolves to (2)
}
}
}
@@ -0,0 +1,45 @@
FILE: invokePriority.kt
public final class A : R|kotlin/Any| {
public constructor(): R|A| {
super<R|kotlin/Any|>()
}
public final fun bar(): R|kotlin/Unit| {
lval foo: R|kotlin/String.() -> kotlin/Unit| = fun R|kotlin/String|.<anonymous>(): R|kotlin/Unit| {
Unit
}
local final fun R|kotlin/String|.foo(): R|kotlin/Unit| {
}
String(1).R|<local>/foo|()
R|kotlin/with|<R|kotlin/String|, R|kotlin/Unit|>(String(2), <L> = with@fun R|kotlin/String|.<anonymous>(): R|kotlin/Unit| <kind=EXACTLY_ONCE> {
this@R|special/anonymous|.R|<local>/foo|()
}
)
}
}
public final class B : R|kotlin/Any| {
public constructor(): R|B| {
super<R|kotlin/Any|>()
}
public final val foo: R|kotlin/String.() -> kotlin/Unit| = fun R|kotlin/String|.<anonymous>(): R|kotlin/Unit| {
Unit
}
public get(): R|kotlin/String.() -> kotlin/Unit|
public final fun R|kotlin/String|.foo(): R|kotlin/Unit| {
}
public final fun bar(): R|kotlin/Unit| {
(this@R|/B|, String(1)).R|/B.foo|()
R|kotlin/with|<R|kotlin/String|, R|kotlin/Unit|>(String(2), <L> = with@fun R|kotlin/String|.<anonymous>(): R|kotlin/Unit| <kind=EXACTLY_ONCE> {
(this@R|/B|, this@R|special/anonymous|).R|/B.foo|()
}
)
}
}
@@ -642,6 +642,11 @@ public class FirDiagnosticsWithStdlibTestGenerated extends AbstractFirDiagnostic
runTest("compiler/fir/resolve/testData/resolve/stdlib/problems/inapplicableRemoveAll.kt");
}
@TestMetadata("invokePriority.kt")
public void testInvokePriority() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/stdlib/problems/invokePriority.kt");
}
@TestMetadata("KJKComplexHierarchyNestedLoop.kt")
public void testKJKComplexHierarchyNestedLoop() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/stdlib/problems/KJKComplexHierarchyNestedLoop.kt");