diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/FirTypeUtils.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/FirTypeUtils.kt index d3f114085c1..d0f4e6af615 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/FirTypeUtils.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/FirTypeUtils.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.fir.types import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall import org.jetbrains.kotlin.fir.expressions.FirConstKind +import org.jetbrains.kotlin.fir.render import org.jetbrains.kotlin.fir.symbols.StandardClassIds import org.jetbrains.kotlin.fir.types.impl.FirImplicitBuiltinTypeRef import org.jetbrains.kotlin.name.ClassId @@ -23,7 +24,9 @@ inline fun FirTypeRef.coneTypeSafe(): T? { return (this as? FirResolvedTypeRef)?.type as? T } -inline val FirTypeRef.coneType: ConeKotlinType get() = coneTypeUnsafe() +inline val FirTypeRef.coneType: ConeKotlinType + get() = coneTypeSafe() + ?: error("Expected FirResolvedTypeRef with ConeKotlinType but was ${this::class.simpleName} ${render()}") val FirTypeRef.isAny: Boolean get() = isBuiltinType(StandardClassIds.Any, false) val FirTypeRef.isNullableAny: Boolean get() = isBuiltinType(StandardClassIds.Any, true)