FIR: expect getClassLikeSymbolByFqName to return null for local classes

This commit is contained in:
Mikhail Glukhikh
2019-10-24 13:29:51 +03:00
parent a13ae08b52
commit 1e4f07ebc7
2 changed files with 5 additions and 9 deletions
@@ -342,18 +342,16 @@ class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransformer) :
val typeOfExpression = when (val lhs = transformedGetClassCall.argument) { val typeOfExpression = when (val lhs = transformedGetClassCall.argument) {
is FirResolvedQualifier -> { is FirResolvedQualifier -> {
val classId = lhs.classId val classId = lhs.classId
if (classId != null) { classId?.let { classId ->
val symbol = symbolProvider.getClassLikeSymbolByFqName(classId)!! val symbol = symbolProvider.getClassLikeSymbolByFqName(classId)
// TODO: Unify logic? // TODO: Unify logic?
symbol.constructType( symbol?.constructType(
Array(symbol.phasedFir.typeParameters.size) { Array(symbol.phasedFir.typeParameters.size) {
ConeStarProjection ConeStarProjection
}, },
isNullable = false isNullable = false
) )
} else { } ?: lhs.resultType.coneTypeUnsafe<ConeKotlinType>()
lhs.resultType.coneTypeUnsafe<ConeKotlinType>()
}
} }
else -> lhs.resultType.coneTypeUnsafe<ConeKotlinType>() else -> lhs.resultType.coneTypeUnsafe<ConeKotlinType>()
} }
@@ -27,9 +27,7 @@ abstract class FirAbstractImportingScope(
private fun getStaticsScope(classId: ClassId): FirScope? { private fun getStaticsScope(classId: ClassId): FirScope? {
provider.getClassUseSiteMemberScope(classId, session, scopeSession)?.let { return it } provider.getClassUseSiteMemberScope(classId, session, scopeSession)?.let { return it }
val symbol = provider.getClassLikeSymbolByFqName(classId) ?: return null
val symbol = provider.getClassLikeSymbolByFqName(classId) ?: error("No scope/symbol for $classId")
if (symbol is FirTypeAliasSymbol) { if (symbol is FirTypeAliasSymbol) {
val expansionSymbol = symbol.fir.expandedConeType?.lookupTag?.toSymbol(session) val expansionSymbol = symbol.fir.expandedConeType?.lookupTag?.toSymbol(session)
if (expansionSymbol != null) { if (expansionSymbol != null) {