Analysis API: fix call resolve inside plusAssign target
^KT-50864 fixed
This commit is contained in:
committed by
TeamCityServer
parent
db1dedc9fe
commit
3b943706d8
+16
@@ -771,4 +771,20 @@ public class Fe10ResolveCallTestGenerated extends AbstractResolveCallTest {
|
||||
public void testVariableWithMemberInvoke() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/variableWithMemberInvoke.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/components/callResolver/resolveCall/assignments")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Assignments {
|
||||
@Test
|
||||
public void testAllFilesPresentInAssignments() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/callResolver/resolveCall/assignments"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("insidePlusAssignTarget.kt")
|
||||
public void testInsidePlusAssignTarget() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/assignments/insidePlusAssignTarget.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+16
@@ -771,4 +771,20 @@ public class FirResolveCallTestGenerated extends AbstractResolveCallTest {
|
||||
public void testVariableWithMemberInvoke() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/variableWithMemberInvoke.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/components/callResolver/resolveCall/assignments")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Assignments {
|
||||
@Test
|
||||
public void testAllFilesPresentInAssignments() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/callResolver/resolveCall/assignments"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("insidePlusAssignTarget.kt")
|
||||
public void testInsidePlusAssignTarget() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/assignments/insidePlusAssignTarget.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// WITH_STDLIB
|
||||
|
||||
fun foo(x: MutableMap<Int, MutableList<String>>) {
|
||||
x.getOrPut(1) { <expr>mutableListOf</expr><String>() } += "str"
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = false
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = null
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
returnType = kotlin.collections.MutableList<kotlin.String>
|
||||
symbol = kotlin/collections/mutableListOf(): kotlin.collections.MutableList<T>
|
||||
valueParameters = []
|
||||
argumentMapping = {}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
KT element: KtNameReferenceExpression
|
||||
FIR element: FirPropertyAccessExpressionImpl
|
||||
FIR source kind: DesugaredCompoundAssignment
|
||||
FIR source kind: KtRealSourceElementKind
|
||||
|
||||
FIR element rendered:
|
||||
R|<local>/l|
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// WITH_STDLIB
|
||||
// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtCallExpression
|
||||
|
||||
fun foo(x: MutableMap<Int, MutableList<String>>) {
|
||||
x.getOrPut(1) { <expr>mutableListOf<String>()</expr> } += "str"
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
KT element: KtCallExpression
|
||||
FIR element: FirFunctionCallImpl
|
||||
FIR source kind: KtRealSourceElementKind
|
||||
|
||||
FIR element rendered:
|
||||
R|kotlin/collections/mutableListOf|<R|kotlin/String|>()
|
||||
+6
@@ -279,6 +279,12 @@ public class GetOrBuildFirTestGenerated extends AbstractGetOrBuildFirTest {
|
||||
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/ifExpression.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("insidePlusAssignTarget.kt")
|
||||
public void testInsidePlusAssignTarget() throws Exception {
|
||||
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/insidePlusAssignTarget.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("intLiteral.kt")
|
||||
public void testIntLiteral() throws Exception {
|
||||
|
||||
+7
-9
@@ -8,7 +8,6 @@ package org.jetbrains.kotlin.fir.builder
|
||||
import com.intellij.psi.tree.IElementType
|
||||
import org.jetbrains.kotlin.*
|
||||
import org.jetbrains.kotlin.KtNodeTypes.*
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.descriptors.Modality
|
||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||
import org.jetbrains.kotlin.fir.*
|
||||
@@ -919,14 +918,13 @@ abstract class BaseFirBuilder<T>(val baseSession: FirSession, val context: Conte
|
||||
return buildAssignmentOperatorStatement {
|
||||
source = baseSource
|
||||
this.operation = operation
|
||||
leftArgument = withDefaultSourceElementKind(KtFakeSourceElementKind.DesugaredCompoundAssignment) {
|
||||
this@generateAssignment?.convert()
|
||||
} ?: buildErrorExpression {
|
||||
source = null
|
||||
diagnostic = ConeSimpleDiagnostic(
|
||||
"Unsupported left value of assignment: ${baseSource?.psi?.text}", DiagnosticKind.ExpressionExpected
|
||||
)
|
||||
}
|
||||
leftArgument = this@generateAssignment?.convert()
|
||||
?: buildErrorExpression {
|
||||
source = null
|
||||
diagnostic = ConeSimpleDiagnostic(
|
||||
"Unsupported left value of assignment: ${baseSource?.psi?.text}", DiagnosticKind.ExpressionExpected
|
||||
)
|
||||
}
|
||||
rightArgument = value
|
||||
this.annotations += annotations
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user