[LL FIR] rewrite LLFirSuperTypeTargetResolver
The previous implementation had issues with locks, publication and performance Also, this change fixed a problem with mixed cycle inheritance ^KT-56550 ^KTIJ-25430 Fixed ^KTIJ-23520 Fixed ^KT-57623 Fixed ^KTIJ-25372 Fixed ^KT-58357 Fixed
This commit is contained in:
committed by
Space Team
parent
09d17d88d7
commit
c2b09d3b1e
@@ -30,11 +30,13 @@ import org.jetbrains.kotlin.fir.declarations.utils.isInner
|
||||
import org.jetbrains.kotlin.fir.declarations.utils.modality
|
||||
import org.jetbrains.kotlin.fir.declarations.utils.visibility
|
||||
import org.jetbrains.kotlin.fir.moduleData
|
||||
import org.jetbrains.kotlin.fir.resolve.ScopeSession
|
||||
import org.jetbrains.kotlin.fir.resolve.fullyExpandedType
|
||||
import org.jetbrains.kotlin.fir.resolve.providers.FirProvider
|
||||
import org.jetbrains.kotlin.fir.resolve.providers.firProvider
|
||||
import org.jetbrains.kotlin.fir.resolve.toSymbol
|
||||
import org.jetbrains.kotlin.fir.resolve.transformers.resolveSupertypesInTheAir
|
||||
import org.jetbrains.kotlin.fir.resolve.transformers.FirSupertypeResolverVisitor
|
||||
import org.jetbrains.kotlin.fir.resolve.transformers.SupertypeComputationSession
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol
|
||||
import org.jetbrains.kotlin.fir.types.*
|
||||
import org.jetbrains.kotlin.name.*
|
||||
@@ -113,7 +115,7 @@ class FirJavaElementFinder(
|
||||
|
||||
val superTypeRefs = when {
|
||||
firClass.superTypeRefs.all { it is FirResolvedTypeRef } -> firClass.superTypeRefs
|
||||
else -> firClass.resolveSupertypesInTheAir(session)
|
||||
else -> firClass.resolveSupertypesOnAir(session)
|
||||
}
|
||||
|
||||
stub.addSupertypesReferencesLists(firClass, superTypeRefs, session)
|
||||
@@ -127,6 +129,13 @@ class FirJavaElementFinder(
|
||||
|
||||
}
|
||||
|
||||
private fun FirRegularClass.resolveSupertypesOnAir(session: FirSession): List<FirTypeRef> {
|
||||
val visitor = FirSupertypeResolverVisitor(session, SupertypeComputationSession(), ScopeSession())
|
||||
return visitor.withFile(session.firProvider.getFirClassifierContainerFile(this.symbol)) {
|
||||
visitor.resolveSpecificClassLikeSupertypes(this, superTypeRefs)
|
||||
}
|
||||
}
|
||||
|
||||
private fun FirSession.collectAllDependentSourceSessions(): List<FirSession> {
|
||||
val result = mutableListOf<FirSession>()
|
||||
collectAllDependentSourceSessionsTo(result)
|
||||
|
||||
Reference in New Issue
Block a user