FIR: Fix label/receiver for lambda within infix calls

While this fix only changes label name, it's important for proper
lambda resolution because receiver is set for a lambda
only in presence of a label

This commit fixes a lot of checkType calls in diagnostic tests
This commit is contained in:
Denis Zharkov
2020-04-15 10:59:44 +03:00
parent 65e444a39c
commit 6fdbc38cf1
14 changed files with 117 additions and 13 deletions
@@ -0,0 +1,14 @@
class A {
fun bar() {}
}
infix fun (() -> Unit).foo(x: A.() -> Unit) {}
fun main() {
{
return@foo
} foo {
bar()
return@foo
}
}
@@ -0,0 +1,22 @@
FILE: labelAndReceiverForInfix.kt
public final class A : R|kotlin/Any| {
public constructor(): R|A| {
super<R|kotlin/Any|>()
}
public final fun bar(): R|kotlin/Unit| {
}
}
public final infix fun R|() -> kotlin/Unit|.foo(x: R|A.() -> kotlin/Unit|): R|kotlin/Unit| {
}
public final fun main(): R|kotlin/Unit| {
foo@fun <anonymous>(): R|kotlin/Unit| {
^@foo Unit
}
.R|/foo|(foo@fun R|A|.<anonymous>(): R|kotlin/Unit| {
this@R|special/anonymous|.R|/A.bar|()
^@foo Unit
}
)
}
@@ -228,6 +228,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
runTest("compiler/fir/analysis-tests/testData/resolve/javaStaticScopeInheritance.kt");
}
@TestMetadata("labelAndReceiverForInfix.kt")
public void testLabelAndReceiverForInfix() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/labelAndReceiverForInfix.kt");
}
@TestMetadata("lambdaArgInScopeFunction.kt")
public void testLambdaArgInScopeFunction() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/lambdaArgInScopeFunction.kt");
@@ -228,6 +228,11 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
runTest("compiler/fir/analysis-tests/testData/resolve/javaStaticScopeInheritance.kt");
}
@TestMetadata("labelAndReceiverForInfix.kt")
public void testLabelAndReceiverForInfix() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/labelAndReceiverForInfix.kt");
}
@TestMetadata("lambdaArgInScopeFunction.kt")
public void testLambdaArgInScopeFunction() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/lambdaArgInScopeFunction.kt");