[IR] Deserialize annotation classes as open
Compiler backend relies on the fact that all annotation classes have
OPEN modality. This is not the case for libraries that were compiled
before 1.6.20. 948dc4f3 fixes compatibility for Lazy IR, here we do the
same for IR deserializer.
^KT-51302 fixed
This commit is contained in:
+9
-1
@@ -12,7 +12,9 @@ import org.jetbrains.kotlin.backend.common.serialization.linkerissues.checkError
|
||||
import org.jetbrains.kotlin.backend.common.serialization.linkerissues.checkSymbolType
|
||||
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration.DeclaratorCase.*
|
||||
import org.jetbrains.kotlin.backend.common.serialization.proto.IrType.KindCase.*
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.descriptors.InlineClassRepresentation
|
||||
import org.jetbrains.kotlin.descriptors.Modality
|
||||
import org.jetbrains.kotlin.ir.IrBuiltIns
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
@@ -308,6 +310,12 @@ class IrDeclarationDeserializer(
|
||||
checkSymbolType<IrClassSymbol>(symbol)
|
||||
|
||||
val flags = ClassFlags.decode(fcode)
|
||||
// Similar to 948dc4f3, compatibility hack for libs that were generated before 1.6.20.
|
||||
val effectiveModality = if (flags.kind == ClassKind.ANNOTATION_CLASS) {
|
||||
Modality.OPEN
|
||||
} else {
|
||||
flags.modality
|
||||
}
|
||||
symbolTable.declareClass(signature, { symbol }) {
|
||||
irFactory.createClass(
|
||||
startOffset, endOffset, origin,
|
||||
@@ -315,7 +323,7 @@ class IrDeclarationDeserializer(
|
||||
deserializeName(proto.name),
|
||||
flags.kind,
|
||||
flags.visibility,
|
||||
flags.modality,
|
||||
effectiveModality,
|
||||
flags.isCompanion,
|
||||
flags.isInner,
|
||||
flags.isData,
|
||||
|
||||
Reference in New Issue
Block a user