Check for the presence of dispatch receiver too in isEqualsDescriptor()
Otherwise, top-level function with the name 'equals' and suitable signature will be (erroneously) treated as true 'equals' invocation, leading to further exception (see EA-126602)
This commit is contained in:
@@ -87,7 +87,7 @@ fun DeclarationDescriptor.isCallsInPlaceEffectDescriptor(): Boolean = equalsDslD
|
||||
fun DeclarationDescriptor.isInvocationKindEnum(): Boolean = equalsDslDescriptor(INVOCATION_KIND_ENUM)
|
||||
|
||||
fun DeclarationDescriptor.isEqualsDescriptor(): Boolean =
|
||||
this is FunctionDescriptor && this.name == Name.identifier("equals") && // fast checks
|
||||
this is FunctionDescriptor && this.name == Name.identifier("equals") && dispatchReceiverParameter != null && // fast checks
|
||||
this.returnType?.isBoolean() == true && this.valueParameters.singleOrNull()?.type?.isNullableAny() == true // signature matches
|
||||
|
||||
internal fun ResolvedCall<*>.firstArgumentAsExpressionOrNull(): KtExpression? =
|
||||
|
||||
Reference in New Issue
Block a user