Uast: UastFakeLightMethod equality fix (KT-37200)
This commit is contained in:
@@ -185,6 +185,23 @@ private class UastFakeLightMethod(private val original: KtFunction, containingCl
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getParent(): PsiElement? = containingClass
|
override fun getParent(): PsiElement? = containingClass
|
||||||
|
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (this === other) return true
|
||||||
|
if (javaClass != other?.javaClass) return false
|
||||||
|
|
||||||
|
other as UastFakeLightMethod
|
||||||
|
|
||||||
|
if (original != other.original) return false
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int {
|
||||||
|
var result = super.hashCode()
|
||||||
|
result = 31 * result + original.hashCode()
|
||||||
|
return result
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class KotlinUMethodWithFakeLightDelegate(val original: KtFunction, containingLightClass: PsiClass, givenParent: UElement?) :
|
class KotlinUMethodWithFakeLightDelegate(val original: KtFunction, containingLightClass: PsiClass, givenParent: UElement?) :
|
||||||
|
|||||||
@@ -188,6 +188,23 @@ private class UastFakeLightMethod(private val original: KtFunction, containingCl
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getParent(): PsiElement? = containingClass
|
override fun getParent(): PsiElement? = containingClass
|
||||||
|
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (this === other) return true
|
||||||
|
if (javaClass != other?.javaClass) return false
|
||||||
|
|
||||||
|
other as UastFakeLightMethod
|
||||||
|
|
||||||
|
if (original != other.original) return false
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int {
|
||||||
|
var result = super.hashCode()
|
||||||
|
result = 31 * result + original.hashCode()
|
||||||
|
return result
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class KotlinUMethodWithFakeLightDelegate(val original: KtFunction, containingLightClass: PsiClass, givenParent: UElement?) :
|
class KotlinUMethodWithFakeLightDelegate(val original: KtFunction, containingLightClass: PsiClass, givenParent: UElement?) :
|
||||||
|
|||||||
@@ -638,6 +638,9 @@ class KotlinUastApiTest : AbstractKotlinUastTest() {
|
|||||||
function10 -> PsiType:T
|
function10 -> PsiType:T
|
||||||
function11 -> PsiType:T
|
function11 -> PsiType:T
|
||||||
""".trimIndent(), methods.joinToString("\n") { m -> m.name + " -> " + m.returnType.toString() })
|
""".trimIndent(), methods.joinToString("\n") { m -> m.name + " -> " + m.returnType.toString() })
|
||||||
|
for (method in methods.drop(3)) {
|
||||||
|
assertEquals("assert return types comparable for '${method.name}'", method.returnType, method.returnType)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user