FIR: add meaningful error message when type ref is unresolved
This commit is contained in:
@@ -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 <reified T : ConeKotlinType> 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)
|
||||
|
||||
Reference in New Issue
Block a user