FIR serializer: throw exception on getting ConeIntegerLiteralType

This commit assumes that ILTs are forbidden
at the end of resolve, at least in public API
This commit is contained in:
Mikhail Glukhikh
2020-09-22 18:13:22 +03:00
parent 5a919cc827
commit 86d1a3be37
@@ -592,8 +592,7 @@ class FirElementSerializer private constructor(
} }
} }
is ConeDefinitelyNotNullType, is ConeDefinitelyNotNullType,
is ConeIntersectionType, is ConeIntersectionType -> {
is ConeIntegerLiteralType -> {
val approximatedType = if (toSuper) { val approximatedType = if (toSuper) {
typeApproximator.approximateToSuperType(type, TypeApproximatorConfiguration.PublicDeclaration) typeApproximator.approximateToSuperType(type, TypeApproximatorConfiguration.PublicDeclaration)
} else { } else {
@@ -604,6 +603,9 @@ class FirElementSerializer private constructor(
} }
return typeProto(approximatedType as ConeKotlinType) return typeProto(approximatedType as ConeKotlinType)
} }
is ConeIntegerLiteralType -> {
throw IllegalStateException("Integer literal types should not persist up to the serializer: ${type.render()}")
}
is ConeCapturedType -> { is ConeCapturedType -> {
throw IllegalStateException("Captured types should not persist up to the serializer: ${type.render()}") throw IllegalStateException("Captured types should not persist up to the serializer: ${type.render()}")
} }