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}")
}
}
@@ -1,3 +1,4 @@
// IGNORE_BACKEND_FIR: JVM_IR
// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST
fun <R> foo(f: () -> R): R = f()
@@ -1,3 +1,4 @@
// IGNORE_BACKEND_FIR: JVM_IR
// !LANGUAGE: +StrictJavaNullabilityAssertions
// TARGET_BACKEND: JVM
// SKIP_JDK6
+1
View File
@@ -1,3 +1,4 @@
// IGNORE_BACKEND_FIR: JVM_IR
class A (val p: String, p1: String, p2: String) {
var cond1 :String = ""
@@ -1,3 +1,4 @@
// IGNORE_BACKEND_FIR: JVM_IR
interface In<in E>
class A : In<A>
class B : In<B>