[FIR] Only take receiver on lambda if present

^KTIJ-25127 fixed
This commit is contained in:
Egor Kulikov
2023-05-22 17:48:19 +02:00
committed by Space Team
parent f149b69df5
commit 1d8eb6dc9e
5 changed files with 24 additions and 1 deletions
@@ -425,7 +425,7 @@ internal class KtFirCallResolver(
dispatchReceiverValue =
KtExplicitReceiverValue(explicitReceiverPsi, dispatchReceiver.typeRef.coneType.asKtType(), false, token)
if (firstArgIsExtensionReceiver) {
extensionReceiverValue = (fir as FirFunctionCall).arguments.first().toKtReceiverValue()
extensionReceiverValue = (fir as FirFunctionCall).arguments.firstOrNull()?.toKtReceiverValue()
} else {
extensionReceiverValue = extensionReceiver.toKtReceiverValue()
}
@@ -0,0 +1,5 @@
class SomeTest
fun dslSpeedTest(f2: SomeTest.() -> Unit) {
<expr>f2()</expr>
}
@@ -0,0 +1,6 @@
KT element: KtCallExpression
FIR element: FirImplicitInvokeCallImpl
FIR source kind: KtRealSourceElementKind
FIR element rendered:
R|<local>/f2|.R|SubstitutionOverride<kotlin/Function1.invoke: R|kotlin/Unit|><Inapplicable(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR): kotlin/Function1.invoke>#|()
@@ -359,6 +359,12 @@ public class OutOfContentRootGetOrBuildFirTestGenerated extends AbstractOutOfCon
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/invokeCallArgumentList.kt");
}
@Test
@TestMetadata("noReceiverOnLambda.kt")
public void testNoReceiverOnLambda() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/noReceiverOnLambda.kt");
}
@Test
@TestMetadata("qualifiedCallInsidePropertyInsideConstructor.kt")
public void testQualifiedCallInsidePropertyInsideConstructor() throws Exception {
@@ -359,6 +359,12 @@ public class SourceGetOrBuildFirTestGenerated extends AbstractSourceGetOrBuildFi
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/invokeCallArgumentList.kt");
}
@Test
@TestMetadata("noReceiverOnLambda.kt")
public void testNoReceiverOnLambda() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/noReceiverOnLambda.kt");
}
@Test
@TestMetadata("qualifiedCallInsidePropertyInsideConstructor.kt")
public void testQualifiedCallInsidePropertyInsideConstructor() throws Exception {