Extract effect from lambda argument if it is in parentheses

Otherwise, contracts on the parameter have no effect.
 #KT-42044 Fixed
 #KT-26229 Fixed
This commit is contained in:
Ilmir Usmanov
2020-10-11 20:07:05 +02:00
parent df64bb3eb7
commit 3b5706972e
15 changed files with 79 additions and 76 deletions
@@ -242,7 +242,10 @@ class EffectsExtractingVisitor(
private fun ValueArgument.toComputation(): Computation? {
return when (this) {
is KtLambdaArgument -> getLambdaExpression()?.let { ESLambda(it) }
is KtValueArgument -> getArgumentExpression()?.let { extractOrGetCached(it) }
is KtValueArgument -> getArgumentExpression()?.let {
if (it is KtLambdaExpression) ESLambda(it)
else extractOrGetCached(it)
}
else -> null
}
}