Add origin for generated jvm overloads and tweak equals methods to distinguish them
- KT-7586 Strange navigation issue #KT-7586 Fixed
This commit is contained in:
+1
-1
@@ -114,7 +114,7 @@ public class DefaultParameterValueSubstitutor(val state: GenerationState) {
|
||||
val flags = AsmUtil.getVisibilityAccessFlag(functionDescriptor) or (if (isStatic) Opcodes.ACC_STATIC else 0)
|
||||
val remainingParameters = getRemainingParameters(functionDescriptor.getOriginal(), substituteCount)
|
||||
val signature = typeMapper.mapSignature(functionDescriptor, context.getContextKind(), remainingParameters)
|
||||
val mv = classBuilder.newMethod(OtherOrigin(functionDescriptor), flags,
|
||||
val mv = classBuilder.newMethod(OtherOrigin(methodElement, functionDescriptor), flags,
|
||||
signature.getAsmMethod().getName(),
|
||||
signature.getAsmMethod().getDescriptor(),
|
||||
signature.getGenericsSignature(),
|
||||
|
||||
+11
-10
@@ -94,14 +94,6 @@ open public class KotlinLightMethodForDeclaration(
|
||||
}
|
||||
}
|
||||
|
||||
override fun isEquivalentTo(another: PsiElement?): Boolean {
|
||||
if (another is KotlinLightMethod && origin == another.getOrigin()) {
|
||||
return true
|
||||
}
|
||||
|
||||
return super<LightMethod>.isEquivalentTo(another)
|
||||
}
|
||||
|
||||
override fun getParameterList(): PsiParameterList = paramsList.getValue()!!
|
||||
|
||||
override fun getTypeParameterList(): PsiTypeParameterList? = typeParamsList.getValue()
|
||||
@@ -127,13 +119,22 @@ open public class KotlinLightMethodForDeclaration(
|
||||
return getTypeParameters().all { processor.execute(it, state) }
|
||||
}
|
||||
|
||||
override fun isEquivalentTo(another: PsiElement?): Boolean {
|
||||
if (another is KotlinLightMethod && origin == another.getOrigin() && delegate == another.getDelegate()) {
|
||||
return true
|
||||
}
|
||||
|
||||
return super<LightMethod>.isEquivalentTo(another)
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean =
|
||||
other is KotlinLightMethodForDeclaration &&
|
||||
getName() == other.getName() &&
|
||||
origin == other.origin &&
|
||||
getContainingClass() == other.getContainingClass()
|
||||
getContainingClass() == other.getContainingClass() &&
|
||||
delegate == other.getDelegate()
|
||||
|
||||
override fun hashCode(): Int = (getName().hashCode() * 31 + origin.hashCode()) * 31 + getContainingClass()!!.hashCode()
|
||||
override fun hashCode(): Int = ((getName().hashCode() * 31 + origin.hashCode()) * 31 + getContainingClass()!!.hashCode()) * 31 + delegate.hashCode()
|
||||
|
||||
override fun toString(): String = "KotlinLightMethodForDeclaration:" + getName()
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
class <!CONFLICTING_JVM_DECLARATIONS!>A<!> {
|
||||
[kotlin.jvm.overloads] fun foo(s: String = "") {
|
||||
class A {
|
||||
<!CONFLICTING_JVM_DECLARATIONS!>[kotlin.jvm.overloads] fun foo(s: String = "")<!> {
|
||||
}
|
||||
|
||||
<!CONFLICTING_JVM_DECLARATIONS!>fun foo()<!> {
|
||||
|
||||
Reference in New Issue
Block a user