FIR: Do not complete finally parts of try-finally
It's been processed via Body transformer explicitly
This commit is contained in:
+21
-8
@@ -555,19 +555,13 @@ class FirCallCompletionResultsWriterTransformer(
|
|||||||
val declaration = calleeReference?.candidate?.symbol?.fir as? FirSimpleFunction
|
val declaration = calleeReference?.candidate?.symbol?.fir as? FirSimpleFunction
|
||||||
|
|
||||||
if (calleeReference == null || declaration == null) {
|
if (calleeReference == null || declaration == null) {
|
||||||
syntheticCall.transformChildren(
|
transformSyntheticCallChildren(syntheticCall, data)
|
||||||
this,
|
|
||||||
data = data?.getExpectedType(syntheticCall)?.toExpectedType() ?: syntheticCall.typeRef.coneType.toExpectedType()
|
|
||||||
)
|
|
||||||
return syntheticCall.compose()
|
return syntheticCall.compose()
|
||||||
}
|
}
|
||||||
|
|
||||||
val typeRef = typeCalculator.tryCalculateReturnType(declaration)
|
val typeRef = typeCalculator.tryCalculateReturnType(declaration)
|
||||||
syntheticCall.replaceTypeRefWithSubstituted(calleeReference, typeRef)
|
syntheticCall.replaceTypeRefWithSubstituted(calleeReference, typeRef)
|
||||||
syntheticCall.transformChildren(
|
transformSyntheticCallChildren(syntheticCall, data)
|
||||||
this,
|
|
||||||
data = data?.getExpectedType(syntheticCall)?.toExpectedType() ?: syntheticCall.typeRef.coneType.toExpectedType()
|
|
||||||
)
|
|
||||||
|
|
||||||
return (syntheticCall.transformCalleeReference(
|
return (syntheticCall.transformCalleeReference(
|
||||||
StoreCalleeReference,
|
StoreCalleeReference,
|
||||||
@@ -575,6 +569,25 @@ class FirCallCompletionResultsWriterTransformer(
|
|||||||
) as D).compose()
|
) as D).compose()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private inline fun <reified D> transformSyntheticCallChildren(
|
||||||
|
syntheticCall: D,
|
||||||
|
data: ExpectedArgumentType?
|
||||||
|
) where D : FirResolvable, D : FirExpression {
|
||||||
|
val newData = data?.getExpectedType(syntheticCall)?.toExpectedType() ?: syntheticCall.typeRef.coneType.toExpectedType()
|
||||||
|
|
||||||
|
if (syntheticCall is FirTryExpression) {
|
||||||
|
syntheticCall.transformCalleeReference(this, newData)
|
||||||
|
syntheticCall.transformTryBlock(this, newData)
|
||||||
|
syntheticCall.transformCatches(this, newData)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
syntheticCall.transformChildren(
|
||||||
|
this,
|
||||||
|
data = newData
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
override fun <T> transformConstExpression(
|
override fun <T> transformConstExpression(
|
||||||
constExpression: FirConstExpression<T>,
|
constExpression: FirConstExpression<T>,
|
||||||
data: ExpectedArgumentType?,
|
data: ExpectedArgumentType?,
|
||||||
|
|||||||
Reference in New Issue
Block a user