From cbc9d0862388819a1df2dbbe8c991aaae77869ee Mon Sep 17 00:00:00 2001 From: Tianyu Geng Date: Mon, 11 Oct 2021 13:51:22 -0700 Subject: [PATCH] FIR: [code clean up] force custom hashcode/equals for FirSourceElement --- .../tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt index a9d38bf63f0..d778724cba6 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt @@ -197,6 +197,12 @@ sealed class FirSourceElement { abstract val kind: FirSourceElementKind abstract val lighterASTNode: LighterASTNode abstract val treeStructure: FlyweightCapableTreeStructure + + /** Implementation must compute the hashcode from the source element. */ + abstract override fun hashCode(): Int + + /** Elements of the same source should be considered equal. */ + abstract override fun equals(other: Any?): Boolean } // NB: in certain situations, psi.node could be null