From 86d1a3be379641c95eee905436857cf7db4070ae Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 22 Sep 2020 18:13:22 +0300 Subject: [PATCH] FIR serializer: throw exception on getting ConeIntegerLiteralType This commit assumes that ILTs are forbidden at the end of resolve, at least in public API --- .../kotlin/fir/serialization/FirElementSerializer.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirElementSerializer.kt b/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirElementSerializer.kt index d6d8d0cc3e2..4358e9ca1b8 100644 --- a/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirElementSerializer.kt +++ b/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirElementSerializer.kt @@ -592,8 +592,7 @@ class FirElementSerializer private constructor( } } is ConeDefinitelyNotNullType, - is ConeIntersectionType, - is ConeIntegerLiteralType -> { + is ConeIntersectionType -> { val approximatedType = if (toSuper) { typeApproximator.approximateToSuperType(type, TypeApproximatorConfiguration.PublicDeclaration) } else { @@ -604,6 +603,9 @@ class FirElementSerializer private constructor( } return typeProto(approximatedType as ConeKotlinType) } + is ConeIntegerLiteralType -> { + throw IllegalStateException("Integer literal types should not persist up to the serializer: ${type.render()}") + } is ConeCapturedType -> { throw IllegalStateException("Captured types should not persist up to the serializer: ${type.render()}") }