diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt index b60b79d42b6..0de3210c7bc 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt @@ -41,6 +41,7 @@ import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.declarations.impl.IrFileImpl import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.impl.* +import org.jetbrains.kotlin.ir.symbols.IrClassSymbol import org.jetbrains.kotlin.ir.types.* import org.jetbrains.kotlin.ir.util.constructors import org.jetbrains.kotlin.ir.util.defaultType @@ -792,19 +793,23 @@ class Fir2IrVisitor( classifierStorage.getIrTypeParameterSymbol(argument.symbol, ConversionTypeContext.DEFAULT) } is FirResolvedQualifier -> { - val symbol = argument.symbol as? FirClassSymbol - ?: return getClassCall.convertWithOffsets { startOffset, endOffset -> - IrErrorCallExpressionImpl( - startOffset, endOffset, irType, "Resolved qualifier ${argument.render()} does not have correct symbol" - ) + when (val symbol = argument.symbol) { + is FirClassSymbol -> { + classifierStorage.getIrClassSymbol(symbol) } - classifierStorage.getIrClassSymbol(symbol) + is FirTypeAliasSymbol -> { + symbol.fir.expandedConeType.toIrClassSymbol() + } + else -> + return getClassCall.convertWithOffsets { startOffset, endOffset -> + IrErrorCallExpressionImpl( + startOffset, endOffset, irType, "Resolved qualifier ${argument.render()} does not have correct symbol" + ) + } + } } is FirClassReferenceExpression -> { - val type = argument.classTypeRef.coneTypeSafe() - (type?.lookupTag?.toSymbol(session) as? FirClassSymbol<*>)?.let { - classifierStorage.getIrClassSymbol(it) - } + argument.classTypeRef.coneTypeSafe().toIrClassSymbol() } else -> null } @@ -817,6 +822,11 @@ class Fir2IrVisitor( } } + private fun ConeClassLikeType?.toIrClassSymbol(): IrClassSymbol? = + (this?.lookupTag?.toSymbol(session) as? FirClassSymbol<*>)?.let { + classifierStorage.getIrClassSymbol(it) + } + override fun visitArrayOfCall(arrayOfCall: FirArrayOfCall, data: Any?): IrElement { return arrayOfCall.convertWithOffsets { startOffset, endOffset -> lateinit var elementType: IrType diff --git a/compiler/testData/codegen/box/casts/asThrowsNpe_1_4.kt b/compiler/testData/codegen/box/casts/asThrowsNpe_1_4.kt index 2daf77dfe24..e83aaa646e0 100644 --- a/compiler/testData/codegen/box/casts/asThrowsNpe_1_4.kt +++ b/compiler/testData/codegen/box/casts/asThrowsNpe_1_4.kt @@ -1,5 +1,4 @@ // !API_VERSION: LATEST -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM fun box(): String { diff --git a/compiler/testData/codegen/box/casts/functions/asFunKBig.kt b/compiler/testData/codegen/box/casts/functions/asFunKBig.kt index eb7b7f3af3d..0c170a05a5d 100644 --- a/compiler/testData/codegen/box/casts/functions/asFunKBig.kt +++ b/compiler/testData/codegen/box/casts/functions/asFunKBig.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: JS_IR // IGNORE_BACKEND: JS_IR_ES6 // TODO: muted automatically, investigate should it be ran for JS or not diff --git a/compiler/testData/codegen/box/casts/functions/reifiedAsFunKBig.kt b/compiler/testData/codegen/box/casts/functions/reifiedAsFunKBig.kt index d79f4f0c927..d780181d747 100644 --- a/compiler/testData/codegen/box/casts/functions/reifiedAsFunKBig.kt +++ b/compiler/testData/codegen/box/casts/functions/reifiedAsFunKBig.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: JS_IR // IGNORE_BACKEND: JS_IR_ES6 // TODO: muted automatically, investigate should it be ran for JS or not diff --git a/compiler/testData/codegen/box/nullCheckOptimization/exclExclThrowsNpe.kt b/compiler/testData/codegen/box/nullCheckOptimization/exclExclThrowsNpe.kt index 73d4e6f3539..39abb636c24 100644 --- a/compiler/testData/codegen/box/nullCheckOptimization/exclExclThrowsNpe.kt +++ b/compiler/testData/codegen/box/nullCheckOptimization/exclExclThrowsNpe.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM fun box(): String { diff --git a/compiler/testData/codegen/box/nullCheckOptimization/parameterNullCheckThrowsIae_1_3.kt b/compiler/testData/codegen/box/nullCheckOptimization/parameterNullCheckThrowsIae_1_3.kt index 8f822d7bc9a..9f9d9daf947 100644 --- a/compiler/testData/codegen/box/nullCheckOptimization/parameterNullCheckThrowsIae_1_3.kt +++ b/compiler/testData/codegen/box/nullCheckOptimization/parameterNullCheckThrowsIae_1_3.kt @@ -1,5 +1,4 @@ // !API_VERSION: 1.3 -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // FILE: A.java diff --git a/compiler/testData/codegen/box/nullCheckOptimization/parameterNullCheckThrowsNpe.kt b/compiler/testData/codegen/box/nullCheckOptimization/parameterNullCheckThrowsNpe.kt index 300599cf3be..d3b1d1f4add 100644 --- a/compiler/testData/codegen/box/nullCheckOptimization/parameterNullCheckThrowsNpe.kt +++ b/compiler/testData/codegen/box/nullCheckOptimization/parameterNullCheckThrowsNpe.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // FILE: A.java diff --git a/compiler/testData/codegen/box/reflection/classLiterals/reifiedTypeClassLiteral.kt b/compiler/testData/codegen/box/reflection/classLiterals/reifiedTypeClassLiteral.kt index dc4810b2a6e..8d929355fd1 100644 --- a/compiler/testData/codegen/box/reflection/classLiterals/reifiedTypeClassLiteral.kt +++ b/compiler/testData/codegen/box/reflection/classLiterals/reifiedTypeClassLiteral.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT diff --git a/compiler/testData/codegen/box/reflection/classes/nestedClasses.kt b/compiler/testData/codegen/box/reflection/classes/nestedClasses.kt index 3a2d3b8cfc4..e2f4d9fa6b6 100644 --- a/compiler/testData/codegen/box/reflection/classes/nestedClasses.kt +++ b/compiler/testData/codegen/box/reflection/classes/nestedClasses.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT diff --git a/compiler/testData/codegen/box/reflection/mapping/jvmStatic/companionObjectFunction.kt b/compiler/testData/codegen/box/reflection/mapping/jvmStatic/companionObjectFunction.kt index c1f607a29fe..d7e0d3aeccf 100644 --- a/compiler/testData/codegen/box/reflection/mapping/jvmStatic/companionObjectFunction.kt +++ b/compiler/testData/codegen/box/reflection/mapping/jvmStatic/companionObjectFunction.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT diff --git a/compiler/testData/codegen/box/reflection/noReflectAtRuntime/javaClass.kt b/compiler/testData/codegen/box/reflection/noReflectAtRuntime/javaClass.kt index 293eb521dea..07da9ee0eaf 100644 --- a/compiler/testData/codegen/box/reflection/noReflectAtRuntime/javaClass.kt +++ b/compiler/testData/codegen/box/reflection/noReflectAtRuntime/javaClass.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/reflection/noReflectAtRuntime/methodsFromAny/classReference.kt b/compiler/testData/codegen/box/reflection/noReflectAtRuntime/methodsFromAny/classReference.kt index cf01a2c94ad..6dc12d9422c 100644 --- a/compiler/testData/codegen/box/reflection/noReflectAtRuntime/methodsFromAny/classReference.kt +++ b/compiler/testData/codegen/box/reflection/noReflectAtRuntime/methodsFromAny/classReference.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/reflection/noReflectAtRuntime/simpleClassLiterals.kt b/compiler/testData/codegen/box/reflection/noReflectAtRuntime/simpleClassLiterals.kt index f1d51853eeb..dffd69ffd7e 100644 --- a/compiler/testData/codegen/box/reflection/noReflectAtRuntime/simpleClassLiterals.kt +++ b/compiler/testData/codegen/box/reflection/noReflectAtRuntime/simpleClassLiterals.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: NATIVE // WITH_RUNTIME