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) {
|
val typeOfExpression = when (val lhs = transformedGetClassCall.argument) {
|
||||||
is FirResolvedQualifier -> {
|
is FirResolvedQualifier -> {
|
||||||
val symbol = lhs.symbol
|
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) {
|
if (typeRef != null) {
|
||||||
lhs.replaceTypeRef(buildResolvedTypeRef { type = typeRef })
|
lhs.replaceTypeRef(buildResolvedTypeRef { type = typeRef })
|
||||||
typeRef
|
typeRef
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// !LANGUAGE: +BareArrayClassLiteral
|
// !LANGUAGE: +BareArrayClassLiteral
|
||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val x = Array(1) { Any() }
|
val x = Array(1) { Any() }
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// !LANGUAGE: +BareArrayClassLiteral
|
// !LANGUAGE: +BareArrayClassLiteral
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// WITH_REFLECT
|
// WITH_REFLECT
|
||||||
|
|||||||
Reference in New Issue
Block a user