Analysis API: do not consider ValidityToken when comparing symbols and types
Symbols with the same FirDeclaration may come from the different analysis sessions
This commit is contained in:
+2
-2
@@ -139,8 +139,8 @@ internal class KtFirScopeProvider(
|
||||
project,
|
||||
builder,
|
||||
token,
|
||||
analysisSession.searchScope,
|
||||
analysisSession.targetPlatform
|
||||
GlobalSearchScope.allScope(project), // TODO
|
||||
analysisSession.targetPlatform,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -26,11 +26,10 @@ internal interface KtFirSymbol<out F : FirDeclaration> : KtSymbol, ValidityToken
|
||||
|
||||
internal fun KtFirSymbol<*>.symbolEquals(other: Any?): Boolean {
|
||||
if (other !is KtFirSymbol<*>) return false
|
||||
if (this.token != other.token) return false
|
||||
return this.firRef == other.firRef
|
||||
}
|
||||
|
||||
internal fun KtFirSymbol<*>.symbolHashCode(): Int = firRef.hashCode() * 31 + token.hashCode()
|
||||
internal fun KtFirSymbol<*>.symbolHashCode(): Int = firRef.hashCode()
|
||||
|
||||
internal tailrec fun FirDeclaration.ktSymbolOrigin(): KtSymbolOrigin = when (origin) {
|
||||
FirDeclarationOrigin.Source -> {
|
||||
|
||||
+1
-2
@@ -30,11 +30,10 @@ internal interface KtFirType : ValidityTokenOwner {
|
||||
|
||||
private fun KtFirType.typeEquals(other: Any?): Boolean {
|
||||
if (other !is KtFirType) return false
|
||||
if (this.token != other.token) return false
|
||||
return this.coneType == other.coneType
|
||||
}
|
||||
|
||||
private fun KtFirType.typeHashcode(): Int = token.hashCode() * 31 + coneType.hashCode()
|
||||
private fun KtFirType.typeHashcode(): Int = coneType.hashCode()
|
||||
|
||||
internal class KtFirUsualClassType(
|
||||
override val coneType: ConeClassLikeTypeImpl,
|
||||
|
||||
+2
-2
@@ -47,9 +47,9 @@ class KtAnalysisSessionFe10BindingHolder private constructor(
|
||||
|
||||
companion object {
|
||||
@InvalidWayOfUsingAnalysisSession
|
||||
fun create(firResolveState: FirModuleResolveState, token: ValidityToken, ktElement: KtElement): KtAnalysisSessionFe10BindingHolder {
|
||||
fun create(firResolveState: FirModuleResolveState, token: ValidityToken, @Suppress("UNUSED_PARAMETER") ktElement: KtElement): KtAnalysisSessionFe10BindingHolder {
|
||||
@Suppress("DEPRECATION")
|
||||
val firAnalysisSession = KtFirAnalysisSession.createAnalysisSessionByResolveState(firResolveState, token, ktElement)
|
||||
val firAnalysisSession = KtFirAnalysisSession.createAnalysisSessionByResolveState(firResolveState, token)
|
||||
return KtAnalysisSessionFe10BindingHolder(firAnalysisSession)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user