FIR: consider the absence of type arguments when constructing GetClassCall type

This commit is contained in:
Jinseong Jeon
2020-06-04 11:33:47 -07:00
committed by Mikhail Glukhikh
parent a086d9f7df
commit 89c87f941f
3 changed files with 11 additions and 3 deletions
@@ -548,7 +548,17 @@ open class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransform
val typeOfExpression = when (val lhs = transformedGetClassCall.argument) {
is FirResolvedQualifier -> {
val symbol = lhs.symbol
val typeRef = symbol?.constructType(lhs.typeArguments.map { it.toConeTypeProjection() }.toTypedArray(), isNullable = false)
val typeArguments: Array<ConeTypeProjection> =
if (lhs.typeArguments.isNotEmpty()) {
// If type arguments exist, use them to construct the type of the expression.
lhs.typeArguments.map { it.toConeTypeProjection() }.toTypedArray()
} else {
// Otherwise, prepare the star projections as many as the size of type parameters.
Array((symbol?.phasedFir as? FirTypeParameterRefsOwner)?.typeParameters?.size ?: 0) {
ConeStarProjection
}
}
val typeRef = symbol?.constructType(typeArguments, isNullable = false)
if (typeRef != null) {
lhs.replaceTypeRef(buildResolvedTypeRef { type = typeRef })
typeRef