From 533ed5c6225a2ffeab4ed08b9f7c71e072206581 Mon Sep 17 00:00:00 2001 From: Nikolay Lunyak Date: Wed, 3 Jan 2024 13:56:29 +0200 Subject: [PATCH] [FIR] Unwrap typealias-bounds in FirTypeParameterBoundsChecker This change makes sure the test introduced in the previous commit doesn't crash the compiler. ^KT-64644 Fixed --- .../src/org/jetbrains/kotlin/fir/types/TypeUtils.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/TypeUtils.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/TypeUtils.kt index 979aabbb57b..34f4bfe12b5 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/TypeUtils.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/TypeUtils.kt @@ -561,13 +561,14 @@ fun ConeKotlinType.canHaveSubtypes(session: FirSession): Boolean { if (this.isMarkedNullable) { return true } - val classSymbol = toRegularClassSymbol(session) ?: return true + val expandedType = fullyExpandedType(session) + val classSymbol = expandedType.toSymbol(session) as? FirRegularClassSymbol ?: return true if (classSymbol.isEnumClass || classSymbol.isExpect || classSymbol.modality != Modality.FINAL) { return true } classSymbol.typeParameterSymbols.forEachIndexed { idx, typeParameterSymbol -> - val typeProjection = typeArguments[idx] + val typeProjection = expandedType.typeArguments[idx] if (typeProjection.isStarProjection) { return true