Skip to content

Commit

Permalink
Only call getNameAsSafeName on instances of KtNamedDeclaration
Browse files Browse the repository at this point in the history
  • Loading branch information
3flex committed Nov 26, 2023
1 parent 9d870da commit 1649b80
Showing 1 changed file with 2 additions and 0 deletions.
Expand Up @@ -15,6 +15,7 @@ import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl.WithDe
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.psi.KtCallExpression
import org.jetbrains.kotlin.psi.KtLambdaExpression
import org.jetbrains.kotlin.psi.KtNamedDeclaration
import org.jetbrains.kotlin.psi.KtQualifiedExpression
import org.jetbrains.kotlin.psi.KtSafeQualifiedExpression
import org.jetbrains.kotlin.psi.KtSimpleNameExpression
Expand Down Expand Up @@ -106,6 +107,7 @@ private fun canBeReplacedWithCall(lambdaExpr: KtLambdaExpression?): Boolean {
} else {
lambdaParameter.destructuringDeclaration?.entries.orEmpty()
.plus(lambdaParameter)
.filterIsInstance<KtNamedDeclaration>()
.map { it.nameAsSafeName.asString() }
}
return lambdaParameterNames.any { receiver.textMatches(it) }
Expand Down

0 comments on commit 1649b80

Please sign in to comment.