Add raw type comparison for Java (J2K mapping is taken into account)

NB: Java enhancement scope does not perform substitution, so we could
have some duplicates inside "type enhancement" testData

Related to KT-29937
This commit is contained in:
Mikhail Glukhikh
2019-03-12 11:09:42 +03:00
parent f5e2cd2ac4
commit 43d06f85e3
5 changed files with 47 additions and 5 deletions
@@ -14,4 +14,14 @@ import org.jetbrains.kotlin.name.ClassId
class FirClassSymbol(override val classId: ClassId) : ConeClassSymbol, AbstractFirBasedSymbol<FirRegularClass>() {
override fun toLookupTag(): ConeClassLikeLookupTag = ConeClassLikeLookupTagImpl(classId)
override fun equals(other: Any?): Boolean =
other is FirClassSymbol && classId == other.classId && fir == other.fir
override fun hashCode(): Int {
var result = 31
result = result * 19 + classId.hashCode()
result = result * 19 + fir.hashCode()
return result
}
}
@@ -16,6 +16,16 @@ class FirTypeAliasSymbol(
override val classId: ClassId
) : ConeTypeAliasSymbol, AbstractFirBasedSymbol<FirTypeAlias>() {
override fun toLookupTag(): ConeClassLikeLookupTag = TypeAliasLookupTagImpl(classId)
override fun equals(other: Any?): Boolean =
other is FirTypeAliasSymbol && classId == other.classId && fir == other.fir
override fun hashCode(): Int {
var result = 31
result = result * 19 + classId.hashCode()
result = result * 19 + fir.hashCode()
return result
}
}
class TypeAliasLookupTagImpl(
@@ -19,4 +19,12 @@ class FirTypeParameterSymbol : AbstractFirBasedSymbol<FirTypeParameter>(), ConeT
get() = this
override fun toLookupTag(): ConeTypeParameterLookupTag = this
override fun equals(other: Any?): Boolean {
return other is FirTypeParameterSymbol && fir == other.fir
}
override fun hashCode(): Int {
return fir.hashCode()
}
}