Ignore special resolved calls for 'when' in PSI unifier.

This commit is contained in:
Dmitry Petrov
2016-01-21 17:16:22 +03:00
parent a33c840939
commit 55b7e4bbf0
@@ -355,19 +355,18 @@ class KotlinPsiUnifier(
return (sortTypes(types1).zip(sortTypes(types2))).all { matchTypes(it.first, it.second) == MATCHED } return (sortTypes(types1).zip(sortTypes(types2))).all { matchTypes(it.first, it.second) == MATCHED }
} }
private fun KtElement.shouldIgnoreResolvedCall(): Boolean { private fun KtElement.shouldIgnoreResolvedCall() = when (this) {
return when { is KtConstantExpression -> true
this is KtConstantExpression -> true is KtOperationReferenceExpression -> getReferencedNameElementType() == KtTokens.EXCLEXCL
this is KtOperationReferenceExpression -> getReferencedNameElementType() == KtTokens.EXCLEXCL is KtIfExpression -> true
this is KtIfExpression -> true is KtWhenExpression -> true
this is KtUnaryExpression -> when (operationReference.getReferencedNameElementType()) { is KtUnaryExpression -> when (operationReference.getReferencedNameElementType()) {
KtTokens.EXCLEXCL, KtTokens.PLUSPLUS, KtTokens.MINUSMINUS -> true KtTokens.EXCLEXCL, KtTokens.PLUSPLUS, KtTokens.MINUSMINUS -> true
else -> false
}
this is KtBinaryExpression -> operationReference.getReferencedNameElementType() == KtTokens.ELVIS
this is KtThisExpression -> true
else -> false else -> false
} }
is KtBinaryExpression -> operationReference.getReferencedNameElementType() == KtTokens.ELVIS
is KtThisExpression -> true
else -> false
} }
private fun KtBinaryExpression.matchComplexAssignmentWithSimple(simple: KtBinaryExpression): Status? { private fun KtBinaryExpression.matchComplexAssignmentWithSimple(simple: KtBinaryExpression): Status? {