FIR serializer: consider exotic types as errors (breaks 4 BB tests)

This commit is contained in:
Mikhail Glukhikh
2020-04-21 19:22:47 +03:00
parent ec7522c675
commit a545ec41a0
5 changed files with 6 additions and 20 deletions
@@ -550,10 +550,6 @@ class FirElementSerializer private constructor(
val builder = ProtoBuf.Type.newBuilder()
when (type) {
is ConeIntegerLiteralType -> {
// Questionable, I'm not sure we should expect this type here
return typeProto(type.getApproximatedType())
}
is ConeKotlinErrorType -> {
extension.serializeErrorType(type, builder)
return builder
@@ -569,20 +565,6 @@ class FirElementSerializer private constructor(
}
return lowerBound
}
is ConeCapturedType -> {
val lowerType = type.lowerType
return if (lowerType != null) {
typeProto(lowerType)
} else {
typeProto(type.constructor.supertypes!!.first())
}
}
is ConeDefinitelyNotNullType -> {
return typeProto(type.original)
}
is ConeIntersectionType -> {
return typeProto(type.intersectedTypes.first())
}
is ConeClassLikeType -> {
if (type.isSuspendFunctionType(session)) {
val runtimeFunctionType = transformSuspendFunctionToRuntimeFunctionType(type)
@@ -600,8 +582,8 @@ class FirElementSerializer private constructor(
builder.typeParameter = getTypeParameterId(typeParameter)
}
}
is ConeLookupTagBasedType, is ConeStubType -> {
throw AssertionError("Should not be here")
else -> {
throw AssertionError("Should not be here: ${type::class.java}")
}
}