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 2c0e35f72cf..03f9f5d15c3 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 @@ -552,7 +552,6 @@ class FirElementSerializer private constructor( private fun typeProto(typeRef: FirTypeRef, toSuper: Boolean = false): ProtoBuf.Type.Builder { val approximatedType = when (typeRef.coneType) { is ConeIntegerLiteralType, - is ConeCapturedType, is ConeDefinitelyNotNullType, is ConeIntersectionType -> typeRef.approximated(typeApproximator, toSuper) @@ -599,7 +598,6 @@ class FirElementSerializer private constructor( builder.typeParameter = getTypeParameterId(typeParameter) } } - is ConeCapturedType, is ConeDefinitelyNotNullType, is ConeIntersectionType, is ConeIntegerLiteralType -> { @@ -609,6 +607,9 @@ class FirElementSerializer private constructor( } return typeProto(approximatedType as ConeKotlinType) } + is ConeCapturedType -> { + throw IllegalStateException("Captured types should not persist up to the serializer: ${type.render()}") + } else -> { throw AssertionError("Should not be here: ${type::class.java}") }