From 55b7e4bbf0877abe28422a519be43f8960492832 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Thu, 21 Jan 2016 17:16:22 +0300 Subject: [PATCH] Ignore special resolved calls for 'when' in PSI unifier. --- .../psi/patternMatching/KotlinPsiUnifier.kt | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/idea/ide-common/src/org/jetbrains/kotlin/idea/util/psi/patternMatching/KotlinPsiUnifier.kt b/idea/ide-common/src/org/jetbrains/kotlin/idea/util/psi/patternMatching/KotlinPsiUnifier.kt index a602f9c914f..6db945e1189 100644 --- a/idea/ide-common/src/org/jetbrains/kotlin/idea/util/psi/patternMatching/KotlinPsiUnifier.kt +++ b/idea/ide-common/src/org/jetbrains/kotlin/idea/util/psi/patternMatching/KotlinPsiUnifier.kt @@ -355,19 +355,18 @@ class KotlinPsiUnifier( return (sortTypes(types1).zip(sortTypes(types2))).all { matchTypes(it.first, it.second) == MATCHED } } - private fun KtElement.shouldIgnoreResolvedCall(): Boolean { - return when { - this is KtConstantExpression -> true - this is KtOperationReferenceExpression -> getReferencedNameElementType() == KtTokens.EXCLEXCL - this is KtIfExpression -> true - this is KtUnaryExpression -> when (operationReference.getReferencedNameElementType()) { - KtTokens.EXCLEXCL, KtTokens.PLUSPLUS, KtTokens.MINUSMINUS -> true - else -> false - } - this is KtBinaryExpression -> operationReference.getReferencedNameElementType() == KtTokens.ELVIS - this is KtThisExpression -> true + private fun KtElement.shouldIgnoreResolvedCall() = when (this) { + is KtConstantExpression -> true + is KtOperationReferenceExpression -> getReferencedNameElementType() == KtTokens.EXCLEXCL + is KtIfExpression -> true + is KtWhenExpression -> true + is KtUnaryExpression -> when (operationReference.getReferencedNameElementType()) { + KtTokens.EXCLEXCL, KtTokens.PLUSPLUS, KtTokens.MINUSMINUS -> true else -> false } + is KtBinaryExpression -> operationReference.getReferencedNameElementType() == KtTokens.ELVIS + is KtThisExpression -> true + else -> false } private fun KtBinaryExpression.matchComplexAssignmentWithSimple(simple: KtBinaryExpression): Status? {