PSI Unifier: Fix matching of this-expressions
#KT-8293 Fixed
This commit is contained in:
+9
@@ -365,6 +365,7 @@ class KotlinPsiUnifier(
|
||||
else -> false
|
||||
}
|
||||
this is KtBinaryExpression -> operationReference.getReferencedNameElementType() == KtTokens.ELVIS
|
||||
this is KtThisExpression -> true
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
@@ -423,6 +424,12 @@ class KotlinPsiUnifier(
|
||||
return matchDescriptors(d1, d2)
|
||||
}
|
||||
|
||||
private fun matchThisExpressions(e1: KtThisExpression, e2: KtThisExpression): Boolean {
|
||||
val d1 = e1.bindingContext[BindingContext.REFERENCE_TARGET, e1.instanceReference]
|
||||
val d2 = e2.bindingContext[BindingContext.REFERENCE_TARGET, e2.instanceReference]
|
||||
return matchDescriptors(d1, d2)
|
||||
}
|
||||
|
||||
private fun matchDestructuringDeclarations(e1: KtDestructuringDeclaration, e2: KtDestructuringDeclaration): Boolean {
|
||||
val entries1 = e1.entries
|
||||
val entries2 = e2.entries
|
||||
@@ -694,6 +701,8 @@ class KotlinPsiUnifier(
|
||||
e1 is KtCallableReferenceExpression && e2 is KtCallableReferenceExpression ->
|
||||
if (matchCallableReferences(e1, e2)) MATCHED else UNMATCHED
|
||||
|
||||
e1 is KtThisExpression && e2 is KtThisExpression -> if (matchThisExpressions(e1, e2)) MATCHED else UNMATCHED
|
||||
|
||||
else ->
|
||||
matchCalls(e1, e2)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user