~
diff --git a/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.kt b/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.kt
index 8837c89..06711a0 100644
--- a/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.kt
+++ b/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.kt
@@ -642,7 +642,7 @@
fun typeId(type: KotlinType): Int = typeTable[type(type)]
- internal fun type(type: KotlinType): ProtoBuf.Type.Builder {
+ internal fun type(type: KotlinType, isFlexibleBound: Boolean = false): ProtoBuf.Type.Builder {
val builder = ProtoBuf.Type.newBuilder()
if (type.isError) {
@@ -653,8 +653,8 @@
if (type.isFlexible()) {
val flexibleType = type.asFlexibleType()
- val lowerBound = type(flexibleType.lowerBound)
- val upperBound = type(flexibleType.upperBound)
+ val lowerBound = type(flexibleType.lowerBound, isFlexibleBound = true)
+ val upperBound = type(flexibleType.upperBound, isFlexibleBound = true)
extension.serializeFlexibleType(flexibleType, lowerBound, upperBound)
if (useTypeTable()) {
lowerBound.flexibleUpperBoundId = typeTable[upperBound]
@@ -682,7 +682,7 @@
builder.typeParameter = getTypeParameterId(descriptor)
}
- if (type.unwrap() is DefinitelyNotNullType) {
+ if (type.unwrap() is DefinitelyNotNullType && !isFlexibleBound) {
metDefinitelyNotNullType = true
builder.flags = Flags.getTypeFlags(false, true)
}
diff --git a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/TypeDeserializer.kt b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/TypeDeserializer.kt
index 4064bcf..52b70c1 100644
--- a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/TypeDeserializer.kt
+++ b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/TypeDeserializer.kt
@@ -22,7 +22,6 @@
import org.jetbrains.kotlin.types.error.ErrorTypeKind
import org.jetbrains.kotlin.types.typeUtil.builtIns
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
-import java.util.*
private val EXPERIMENTAL_CONTINUATION_FQ_NAME = FqName("kotlin.coroutines.experimental.Continuation")
@@ -126,7 +125,9 @@
else ->
KotlinTypeFactory.simpleType(attributes, constructor, arguments, proto.nullable).let {
if (Flags.DEFINITELY_NOT_NULL_TYPE.get(proto.flags))
- DefinitelyNotNullType.makeDefinitelyNotNull(it) ?: error("null DefinitelyNotNullType for '$it'")
+ DefinitelyNotNullType.makeDefinitelyNotNull(
+ it, useCorrectedNullabilityForTypeParameters = true
+ ) ?: error("null DefinitelyNotNullType for '$it'")
else
it
}