[FIR2IR] Use a fully expanded type when generating IrClassReference
#KT-60639 Fixed
This commit is contained in:
@@ -28,6 +28,7 @@ import org.jetbrains.kotlin.fir.expressions.impl.FirElseIfTrueCondition
|
||||
import org.jetbrains.kotlin.fir.expressions.impl.FirUnitExpression
|
||||
import org.jetbrains.kotlin.fir.extensions.extensionService
|
||||
import org.jetbrains.kotlin.fir.references.*
|
||||
import org.jetbrains.kotlin.fir.resolve.fullyExpandedConeType
|
||||
import org.jetbrains.kotlin.fir.resolve.isIteratorNext
|
||||
import org.jetbrains.kotlin.fir.resolve.toSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||
@@ -1435,7 +1436,7 @@ class Fir2IrVisitor(
|
||||
classifierStorage.getIrClassSymbol(symbol)
|
||||
}
|
||||
is FirTypeAliasSymbol -> {
|
||||
symbol.fir.expandedConeType.toIrClassSymbol()
|
||||
symbol.fir.fullyExpandedConeType(session).toIrClassSymbol()
|
||||
}
|
||||
else ->
|
||||
return getClassCall.convertWithOffsets { startOffset, endOffset ->
|
||||
|
||||
+6
@@ -52175,6 +52175,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasObjectCallable.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasOnTypeAlias.kt")
|
||||
public void testTypeAliasOnTypeAlias() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasOnTypeAlias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasSecondaryConstructor.kt")
|
||||
public void testTypeAliasSecondaryConstructor() throws Exception {
|
||||
|
||||
+6
@@ -52175,6 +52175,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasObjectCallable.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasOnTypeAlias.kt")
|
||||
public void testTypeAliasOnTypeAlias() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasOnTypeAlias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasSecondaryConstructor.kt")
|
||||
public void testTypeAliasSecondaryConstructor() throws Exception {
|
||||
|
||||
@@ -10,8 +10,8 @@ import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
||||
import org.jetbrains.kotlin.fir.declarations.FirTypeAlias
|
||||
import org.jetbrains.kotlin.fir.declarations.utils.expandedConeType
|
||||
import org.jetbrains.kotlin.fir.resolve.substitution.AbstractConeSubstitutor
|
||||
import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirTypeAliasSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase
|
||||
import org.jetbrains.kotlin.fir.types.*
|
||||
import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
|
||||
import org.jetbrains.kotlin.fir.types.impl.ConeTypeParameterTypeImpl
|
||||
@@ -166,3 +166,7 @@ private fun mapTypeAliasArguments(
|
||||
|
||||
return substitutor.substituteOrSelf(resultingType)
|
||||
}
|
||||
|
||||
fun FirTypeAlias.fullyExpandedConeType(useSiteSession: FirSession): ConeClassLikeType? {
|
||||
return expandedConeType?.fullyExpandedType(useSiteSession)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
// ISSUE: KT-60639
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
interface A
|
||||
|
||||
typealias OtherA = A
|
||||
typealias OtherOtherA = OtherA
|
||||
|
||||
annotation class Ann(vararg val kClass: KClass<*>)
|
||||
|
||||
@Ann(A::class, OtherA::class, OtherOtherA::class)
|
||||
class Test {
|
||||
fun get() = "OK"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Test().get()
|
||||
}
|
||||
+6
@@ -49295,6 +49295,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasObjectCallable.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasOnTypeAlias.kt")
|
||||
public void testTypeAliasOnTypeAlias() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasOnTypeAlias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasSecondaryConstructor.kt")
|
||||
public void testTypeAliasSecondaryConstructor() throws Exception {
|
||||
|
||||
+6
@@ -52175,6 +52175,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasObjectCallable.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasOnTypeAlias.kt")
|
||||
public void testTypeAliasOnTypeAlias() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasOnTypeAlias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasSecondaryConstructor.kt")
|
||||
public void testTypeAliasSecondaryConstructor() throws Exception {
|
||||
|
||||
+6
@@ -52175,6 +52175,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasObjectCallable.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasOnTypeAlias.kt")
|
||||
public void testTypeAliasOnTypeAlias() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasOnTypeAlias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasSecondaryConstructor.kt")
|
||||
public void testTypeAliasSecondaryConstructor() throws Exception {
|
||||
|
||||
+5
@@ -42083,6 +42083,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasObjectCallable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeAliasOnTypeAlias.kt")
|
||||
public void testTypeAliasOnTypeAlias() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasOnTypeAlias.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeAliasSecondaryConstructor.kt")
|
||||
public void testTypeAliasSecondaryConstructor() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasSecondaryConstructor.kt");
|
||||
|
||||
+6
@@ -36215,6 +36215,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasObjectCallable.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasOnTypeAlias.kt")
|
||||
public void testTypeAliasOnTypeAlias() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasOnTypeAlias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasSecondaryConstructor.kt")
|
||||
public void testTypeAliasSecondaryConstructor() throws Exception {
|
||||
|
||||
+6
@@ -36215,6 +36215,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasObjectCallable.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasOnTypeAlias.kt")
|
||||
public void testTypeAliasOnTypeAlias() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasOnTypeAlias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasSecondaryConstructor.kt")
|
||||
public void testTypeAliasSecondaryConstructor() throws Exception {
|
||||
|
||||
+6
@@ -36215,6 +36215,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasObjectCallable.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasOnTypeAlias.kt")
|
||||
public void testTypeAliasOnTypeAlias() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasOnTypeAlias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasSecondaryConstructor.kt")
|
||||
public void testTypeAliasSecondaryConstructor() throws Exception {
|
||||
|
||||
+6
@@ -39661,6 +39661,12 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasObjectCallable.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasOnTypeAlias.kt")
|
||||
public void testTypeAliasOnTypeAlias() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasOnTypeAlias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasSecondaryConstructor.kt")
|
||||
public void testTypeAliasSecondaryConstructor() throws Exception {
|
||||
|
||||
+6
@@ -40687,6 +40687,12 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasObjectCallable.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasOnTypeAlias.kt")
|
||||
public void testTypeAliasOnTypeAlias() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasOnTypeAlias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasSecondaryConstructor.kt")
|
||||
public void testTypeAliasSecondaryConstructor() throws Exception {
|
||||
|
||||
+6
@@ -39149,6 +39149,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasObjectCallable.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasOnTypeAlias.kt")
|
||||
public void testTypeAliasOnTypeAlias() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasOnTypeAlias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasSecondaryConstructor.kt")
|
||||
public void testTypeAliasSecondaryConstructor() throws Exception {
|
||||
|
||||
+6
@@ -39662,6 +39662,12 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasObjectCallable.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasOnTypeAlias.kt")
|
||||
public void testTypeAliasOnTypeAlias() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasOnTypeAlias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasSecondaryConstructor.kt")
|
||||
public void testTypeAliasSecondaryConstructor() throws Exception {
|
||||
|
||||
Generated
+6
@@ -35885,6 +35885,12 @@ public class FirWasmCodegenBoxTestGenerated extends AbstractFirWasmCodegenBoxTes
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasObjectCallable.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasOnTypeAlias.kt")
|
||||
public void testTypeAliasOnTypeAlias() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasOnTypeAlias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasSecondaryConstructor.kt")
|
||||
public void testTypeAliasSecondaryConstructor() throws Exception {
|
||||
|
||||
Generated
+6
@@ -35885,6 +35885,12 @@ public class K1WasmCodegenBoxTestGenerated extends AbstractK1WasmCodegenBoxTest
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasObjectCallable.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasOnTypeAlias.kt")
|
||||
public void testTypeAliasOnTypeAlias() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/typealias/typeAliasOnTypeAlias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeAliasSecondaryConstructor.kt")
|
||||
public void testTypeAliasSecondaryConstructor() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user