[LL] retrieve fir from generated property of desugaring ++ operator
^ KTIJ-24385 Temp property to store receiver is generated for `a.b++` expression. If this property's psi corresponds to receiver expr, then FirProperty would be found by mapper if receiver is requested. It works unexpectedly, because FirProperty is normally not expected by expression. This change set fake sources for generated FirProperty, so it won't be found by source psi
This commit is contained in:
+12
@@ -202,6 +202,12 @@ public class Fe10IdeNormalAnalysisSourceModuleResolveCallTestGenerated extends A
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/annotationOnReceiver.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("arrayIncWithDotQualifier.kt")
|
||||
public void testArrayIncWithDotQualifier() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/arrayIncWithDotQualifier.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("arrayOfInAnnotation.kt")
|
||||
public void testArrayOfInAnnotation() throws Exception {
|
||||
@@ -502,6 +508,12 @@ public class Fe10IdeNormalAnalysisSourceModuleResolveCallTestGenerated extends A
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/implicitJavaConstuctorCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incWithDotQualifier.kt")
|
||||
public void testIncWithDotQualifier() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/incWithDotQualifier.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("indexedGet.kt")
|
||||
public void testIndexedGet() throws Exception {
|
||||
|
||||
+12
@@ -202,6 +202,12 @@ public class FirIdeNormalAnalysisSourceModuleResolveCallTestGenerated extends Ab
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/annotationOnReceiver.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("arrayIncWithDotQualifier.kt")
|
||||
public void testArrayIncWithDotQualifier() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/arrayIncWithDotQualifier.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("arrayOfInAnnotation.kt")
|
||||
public void testArrayOfInAnnotation() throws Exception {
|
||||
@@ -502,6 +508,12 @@ public class FirIdeNormalAnalysisSourceModuleResolveCallTestGenerated extends Ab
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/implicitJavaConstuctorCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incWithDotQualifier.kt")
|
||||
public void testIncWithDotQualifier() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/incWithDotQualifier.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("indexedGet.kt")
|
||||
public void testIndexedGet() throws Exception {
|
||||
|
||||
+12
@@ -202,6 +202,12 @@ public class FirStandaloneNormalAnalysisSourceModuleResolveCallTestGenerated ext
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/annotationOnReceiver.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("arrayIncWithDotQualifier.kt")
|
||||
public void testArrayIncWithDotQualifier() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/arrayIncWithDotQualifier.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("arrayOfInAnnotation.kt")
|
||||
public void testArrayOfInAnnotation() throws Exception {
|
||||
@@ -502,6 +508,12 @@ public class FirStandaloneNormalAnalysisSourceModuleResolveCallTestGenerated ext
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/implicitJavaConstuctorCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incWithDotQualifier.kt")
|
||||
public void testIncWithDotQualifier() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/incWithDotQualifier.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("indexedGet.kt")
|
||||
public void testIndexedGet() throws Exception {
|
||||
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
// IGNORE_FE10
|
||||
class F {
|
||||
val a = arrayOf(1, 2)
|
||||
fun handleLeftBracketInFragment() {
|
||||
foo().<expr>peek()</expr>.a[0]++
|
||||
}
|
||||
|
||||
fun foo() : F = F()
|
||||
fun peek() : F = this
|
||||
}
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = false
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = KtExplicitReceiverValue:
|
||||
expression = foo()
|
||||
isSafeNavigation = false
|
||||
type = F
|
||||
extensionReceiver = null
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
returnType = F
|
||||
symbol = /F.peek(<dispatch receiver>: F): F
|
||||
valueParameters = []
|
||||
callableIdIfNonLocal = /F.peek
|
||||
typeArgumentsMapping = {}
|
||||
argumentMapping = {}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// IGNORE_FE10
|
||||
class F {
|
||||
var a = 1
|
||||
fun handleLeftBracketInFragment() {
|
||||
foo().<expr>peek()</expr>.a++
|
||||
}
|
||||
|
||||
fun foo() : F = F()
|
||||
fun peek() : F = this
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = false
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = KtExplicitReceiverValue:
|
||||
expression = foo()
|
||||
isSafeNavigation = false
|
||||
type = F
|
||||
extensionReceiver = null
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
returnType = F
|
||||
symbol = /F.peek(<dispatch receiver>: F): F
|
||||
valueParameters = []
|
||||
callableIdIfNonLocal = /F.peek
|
||||
typeArgumentsMapping = {}
|
||||
argumentMapping = {}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class FF {
|
||||
fun handleLeftBracketInFragment() {
|
||||
<expr>peek()</expr>.braceBalance++
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
KT element: KtCallExpression
|
||||
FIR element: FirFunctionCallImpl
|
||||
FIR source kind: KtRealSourceElementKind
|
||||
|
||||
FIR element rendered:
|
||||
<Unresolved name: peek>#()
|
||||
+6
@@ -619,6 +619,12 @@ public class OutOfContentRootGetOrBuildFirTestGenerated extends AbstractOutOfCon
|
||||
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/qualifiedExpressions/middlePartOfQualifiedCallWithNestedClasses.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("qualifiedPartOfQualifiedCallUnresolved.kt")
|
||||
public void testQualifiedPartOfQualifiedCallUnresolved() throws Exception {
|
||||
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/qualifiedExpressions/qualifiedPartOfQualifiedCallUnresolved.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("qualifiedPartOfQualifiedCallWithNestedClasses.kt")
|
||||
public void testQualifiedPartOfQualifiedCallWithNestedClasses() throws Exception {
|
||||
|
||||
+6
@@ -619,6 +619,12 @@ public class SourceGetOrBuildFirTestGenerated extends AbstractSourceGetOrBuildFi
|
||||
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/qualifiedExpressions/middlePartOfQualifiedCallWithNestedClasses.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("qualifiedPartOfQualifiedCallUnresolved.kt")
|
||||
public void testQualifiedPartOfQualifiedCallUnresolved() throws Exception {
|
||||
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/qualifiedExpressions/qualifiedPartOfQualifiedCallUnresolved.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("qualifiedPartOfQualifiedCallWithNestedClasses.kt")
|
||||
public void testQualifiedPartOfQualifiedCallWithNestedClasses() throws Exception {
|
||||
|
||||
+1
-2
@@ -703,7 +703,6 @@ abstract class BaseFirBuilder<T>(val baseSession: FirSession, val context: Conte
|
||||
prefix: Boolean,
|
||||
convert: T.() -> FirExpression
|
||||
): FirExpression {
|
||||
val argumentReceiver = receiverForOperation.receiverExpression // a
|
||||
return buildBlockProbablyUnderSafeCall(
|
||||
receiverForOperation,
|
||||
convert,
|
||||
@@ -720,7 +719,7 @@ abstract class BaseFirBuilder<T>(val baseSession: FirSession, val context: Conte
|
||||
|
||||
val argumentReceiverVariable = generateTemporaryVariable(
|
||||
baseModuleData,
|
||||
argumentReceiver?.toFirSourceElement(),
|
||||
desugaredSource,
|
||||
SpecialNames.RECEIVER,
|
||||
initializer = receiverFir,
|
||||
).also { statements += it }
|
||||
|
||||
Reference in New Issue
Block a user