[FIR] Get rid of ensureResolvedForCalls completely

The problem that this function has been solving (resolving declarations
to a somewhat adequate resolve phase) should be solved in another place;
moreover, right now it is the only scope that uses that function, which
is non-consistent
This commit is contained in:
Roman Golyshev
2022-06-01 00:23:11 +04:00
parent 01ce499bb2
commit 9fe0f055c5
2 changed files with 0 additions and 24 deletions
@@ -9,33 +9,12 @@ import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
import org.jetbrains.kotlin.fir.resolve.fullyExpandedType
import org.jetbrains.kotlin.fir.resolve.toSymbol
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
import org.jetbrains.kotlin.fir.symbols.ensureResolved
import org.jetbrains.kotlin.fir.types.ConeClassLikeType
import org.jetbrains.kotlin.fir.types.ConeKotlinType
import org.jetbrains.kotlin.fir.types.FirTypeRef
import org.jetbrains.kotlin.fir.types.coneTypeSafe
fun FirBasedSymbol<*>.ensureResolvedForCalls() {
if (fir.resolvePhase >= FirResolvePhase.DECLARATIONS) return
// val requiredPhase = when (fir) {
// is FirFunction, is FirProperty -> FirResolvePhase.CONTRACTS
// else -> FirResolvePhase.STATUS
// }
//
// if (requiredPhase == FirResolvePhase.CONTRACTS) {
// // Workaround for recursive contracts in CLI
// // Otherwise the assertion about presence of fir.session.phaseManager would fail
// // See org.jetbrains.kotlin.fir.FirOldFrontendDiagnosticsTestWithStdlibGenerated.Contracts.Dsl.Errors.testRecursiveContract
// if (fir.session.phaseManager == null) return
// }
val requiredPhase = FirResolvePhase.DECLARATIONS
ensureResolved(requiredPhase)
}
fun ConeKotlinType.ensureResolvedTypeDeclaration(
useSiteSession: FirSession,
requiredPhase: FirResolvePhase = FirResolvePhase.DECLARATIONS,
@@ -11,7 +11,6 @@ import org.jetbrains.kotlin.fir.declarations.FirResolvedImport
import org.jetbrains.kotlin.fir.declarations.utils.expandedConeType
import org.jetbrains.kotlin.fir.resolve.ScopeSession
import org.jetbrains.kotlin.fir.resolve.toSymbol
import org.jetbrains.kotlin.fir.resolve.transformers.ensureResolvedForCalls
import org.jetbrains.kotlin.fir.scopes.FirContainingNamesAwareScope
import org.jetbrains.kotlin.fir.scopes.unsubstitutedScope
import org.jetbrains.kotlin.fir.symbols.impl.*
@@ -67,7 +66,6 @@ abstract class FirAbstractImportingScope(
staticsScope.processFunctionsByName(importedName, processor)
} else if (importedName.isSpecial || importedName.identifier.isNotEmpty()) {
for (symbol in provider.getTopLevelFunctionSymbols(import.packageFqName, importedName)) {
symbol.ensureResolvedForCalls()
processor(symbol)
}
}
@@ -83,7 +81,6 @@ abstract class FirAbstractImportingScope(
staticsScope.processPropertiesByName(importedName, processor)
} else if (importedName.isSpecial || importedName.identifier.isNotEmpty()) {
for (symbol in provider.getTopLevelPropertySymbols(import.packageFqName, importedName)) {
symbol.ensureResolvedForCalls()
processor(symbol)
}
}