mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-17 00:21:29 +00:00
FIR serializer: throw exception on getting ConeCapturedType
This commit assumes that captured types are forbidden at the end of resolve, at least in public API
This commit is contained in:
@@ -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}")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user