FIR: consider the absence of type arguments when constructing GetClassCall type
This commit is contained in:
committed by
Mikhail Glukhikh
parent
a086d9f7df
commit
89c87f941f
+11
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user