From b4ac2f5b5562fa40246c63559d717387bd248e7c Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Tue, 29 Sep 2020 14:49:28 -0700 Subject: [PATCH] FIR serializer: special handling of Continuation --- .../fir/serialization/FirElementSerializer.kt | 17 +++++++++++++---- .../equality/suspendConversion.kt | 1 - .../box/reified/reifiedIntersectionType.kt | 1 - 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirElementSerializer.kt b/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirElementSerializer.kt index 4358e9ca1b8..18f6ca1e15d 100644 --- a/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirElementSerializer.kt +++ b/compiler/fir/fir-serialization/src/org/jetbrains/kotlin/fir/serialization/FirElementSerializer.kt @@ -649,10 +649,19 @@ class FirElementSerializer private constructor( } private fun fillFromPossiblyInnerType(builder: ProtoBuf.Type.Builder, type: ConeClassLikeType) { - val classifierSymbol = type.lookupTag.toSymbol(session) ?: error("Can't lookup $type") - val classifier = classifierSymbol.fir - val classifierId = getClassifierId(classifier) - builder.className = classifierId + val classifierSymbol = type.lookupTag.toSymbol(session) + when { + classifierSymbol != null -> { + val classifier = classifierSymbol.fir + val classifierId = getClassifierId(classifier) + builder.className = classifierId + } + // Special case: `Continuation` can be added via [transformSuspendFunctionToRuntimeFunctionType] + type.lookupTag.classId == CONTINUATION_INTERFACE_CLASS_ID -> { + builder.className = stringTable.getQualifiedClassNameIndex(type.lookupTag.classId.asString(), isLocal = false) + } + else -> error("Can't lookup $type") + } for (projection in type.typeArguments) { builder.addArgument(typeArgument(projection)) diff --git a/compiler/testData/codegen/box/callableReference/equality/suspendConversion.kt b/compiler/testData/codegen/box/callableReference/equality/suspendConversion.kt index fa4a85ecd02..0c521662b72 100644 --- a/compiler/testData/codegen/box/callableReference/equality/suspendConversion.kt +++ b/compiler/testData/codegen/box/callableReference/equality/suspendConversion.kt @@ -1,5 +1,4 @@ // !LANGUAGE: +SuspendConversion -// IGNORE_BACKEND_FIR: JVM_IR // FILE: suspendCovnersion.kt fun checkNotEqual(x: Any, y: Any) { diff --git a/compiler/testData/codegen/box/reified/reifiedIntersectionType.kt b/compiler/testData/codegen/box/reified/reifiedIntersectionType.kt index dd69f3d6b86..4699e4cd252 100644 --- a/compiler/testData/codegen/box/reified/reifiedIntersectionType.kt +++ b/compiler/testData/codegen/box/reified/reifiedIntersectionType.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // KJS_WITH_FULL_RUNTIME // KT-37163