From aa0c2ddea5ff5e7386711d3361c2f3822b074c5f Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Fri, 19 Nov 2021 20:01:03 +0300 Subject: [PATCH] JVM_IR fix nullability of special bridge return type --- .../kotlin/backend/jvm/ir/JvmIrTypeUtils.kt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/ir/JvmIrTypeUtils.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/ir/JvmIrTypeUtils.kt index b593b5b8dd8..5fe58d4826e 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/ir/JvmIrTypeUtils.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/ir/JvmIrTypeUtils.kt @@ -131,10 +131,15 @@ fun IrType.eraseToScope(scopeOwner: IrTypeParametersContainer): IrType = fun IrType.eraseToScope(visibleTypeParameters: Set): IrType { require(this is IrSimpleType) { error("Unexpected IrType kind: ${render()}") } return when (classifier) { - is IrClassSymbol -> IrSimpleTypeImpl( - classifier, hasQuestionMark, arguments.map { it.eraseToScope(visibleTypeParameters) }, annotations - ) - is IrTypeParameterSymbol -> if (classifier.owner in visibleTypeParameters) this else upperBound + is IrClassSymbol -> + IrSimpleTypeImpl( + classifier, hasQuestionMark, arguments.map { it.eraseToScope(visibleTypeParameters) }, annotations + ) + is IrTypeParameterSymbol -> + if (classifier.owner in visibleTypeParameters) + this + else + upperBound.withHasQuestionMark(this.hasQuestionMark) else -> error("unknown IrType classifier kind: ${classifier.owner.render()}") } }