[FIR] Unwrap named arguments during contracts verification
^KT-64501 Fixed
This commit is contained in:
committed by
Space Team
parent
6031f80e01
commit
de9826683e
+1
-1
@@ -9,7 +9,7 @@ inline fun myRun(f: () -> Unit) {
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
inline fun test_1(g: () -> Unit) {
|
||||
<!WRONG_INVOCATION_KIND!>contract { callsInPlace(g, InvocationKind.EXACTLY_ONCE) }<!>
|
||||
contract { callsInPlace(g, InvocationKind.EXACTLY_ONCE) }
|
||||
myRun(f = g)
|
||||
}
|
||||
|
||||
|
||||
+5
-2
@@ -200,7 +200,8 @@ object FirCallsEffectAnalyzer : FirControlFlowChecker() {
|
||||
}
|
||||
|
||||
for (arg in node.fir.argumentList.arguments) {
|
||||
data.checkExpressionForLeakedSymbols(arg) {
|
||||
val unwrappedArg = arg.unwrapArgument()
|
||||
data.checkExpressionForLeakedSymbols(unwrappedArg) {
|
||||
node.fir.getArgumentCallsEffect(arg) == null
|
||||
}
|
||||
}
|
||||
@@ -307,7 +308,9 @@ object FirCallsEffectAnalyzer : FirControlFlowChecker() {
|
||||
return this is FirAnonymousFunction && this.isLambda && this.invocationKind != null
|
||||
}
|
||||
|
||||
private fun FirExpression?.toQualifiedReference(): FirReference? = (this as? FirQualifiedAccessExpression)?.calleeReference
|
||||
private fun FirExpression?.toQualifiedReference(): FirReference? {
|
||||
return (this?.unwrapArgument() as? FirQualifiedAccessExpression)?.calleeReference
|
||||
}
|
||||
|
||||
private fun referenceToSymbol(reference: FirReference?): FirBasedSymbol<*>? = when (reference) {
|
||||
is FirResolvedNamedReference -> reference.resolvedSymbol
|
||||
|
||||
Reference in New Issue
Block a user