diff --git a/build-common/src/org/jetbrains/kotlin/incremental/ProtoCompareGenerated.kt b/build-common/src/org/jetbrains/kotlin/incremental/ProtoCompareGenerated.kt
index ca77fca2832..adb3f01e1e2 100644
--- a/build-common/src/org/jetbrains/kotlin/incremental/ProtoCompareGenerated.kt
+++ b/build-common/src/org/jetbrains/kotlin/incremental/ProtoCompareGenerated.kt
@@ -488,6 +488,11 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
if (old.abbreviatedTypeId != new.abbreviatedTypeId) return false
}
+ if (old.hasFlags() != new.hasFlags()) return false
+ if (old.hasFlags()) {
+ if (old.flags != new.flags) return false
+ }
+
if (old.getExtensionCount(JvmProtoBuf.typeAnnotation) != new.getExtensionCount(JvmProtoBuf.typeAnnotation)) return false
for(i in 0..old.getExtensionCount(JvmProtoBuf.typeAnnotation) - 1) {
@@ -1361,6 +1366,10 @@ fun ProtoBuf.Type.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) ->
hashCode = 31 * hashCode + abbreviatedTypeId
}
+ if (hasFlags()) {
+ hashCode = 31 * hashCode + flags
+ }
+
for(i in 0..getExtensionCount(JvmProtoBuf.typeAnnotation) - 1) {
hashCode = 31 * hashCode + getExtension(JvmProtoBuf.typeAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
diff --git a/build-common/test/org/jetbrains/kotlin/serialization/DebugProtoBuf.java b/build-common/test/org/jetbrains/kotlin/serialization/DebugProtoBuf.java
index 2fc5207b0d3..af748604dc1 100644
--- a/build-common/test/org/jetbrains/kotlin/serialization/DebugProtoBuf.java
+++ b/build-common/test/org/jetbrains/kotlin/serialization/DebugProtoBuf.java
@@ -5509,6 +5509,23 @@ public final class DebugProtoBuf {
* optional int32 abbreviated_type_id = 14;
*/
int getAbbreviatedTypeId();
+
+ /**
+ * optional int32 flags = 1;
+ *
+ *
+ *suspend + *+ */ + boolean hasFlags(); + /** + *
optional int32 flags = 1;
+ *
+ * + *suspend + *+ */ + int getFlags(); } /** * Protobuf type {@code org.jetbrains.kotlin.serialization.Type} @@ -5563,6 +5580,11 @@ public final class DebugProtoBuf { } break; } + case 8: { + bitField0_ |= 0x00001000; + flags_ = input.readInt32(); + break; + } case 18: { if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { argument_ = new java.util.ArrayList
optional int32 flags = 1;
+ *
+ * + *suspend + *+ */ + public boolean hasFlags() { + return ((bitField0_ & 0x00001000) == 0x00001000); + } + /** + *
optional int32 flags = 1;
+ *
+ * + *suspend + *+ */ + public int getFlags() { + return flags_; + } + private void initFields() { argument_ = java.util.Collections.emptyList(); nullable_ = false; @@ -6826,6 +6871,7 @@ public final class DebugProtoBuf { outerTypeId_ = 0; abbreviatedType_ = org.jetbrains.kotlin.serialization.DebugProtoBuf.Type.getDefaultInstance(); abbreviatedTypeId_ = 0; + flags_ = 0; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { @@ -6871,6 +6917,9 @@ public final class DebugProtoBuf { org.jetbrains.kotlin.protobuf.GeneratedMessage .ExtendableMessage
optional int32 flags = 1;
+ *
+ * + *suspend + *+ */ + public boolean hasFlags() { + return ((bitField0_ & 0x00002000) == 0x00002000); + } + /** + *
optional int32 flags = 1;
+ *
+ * + *suspend + *+ */ + public int getFlags() { + return flags_; + } + /** + *
optional int32 flags = 1;
+ *
+ * + *suspend + *+ */ + public Builder setFlags(int value) { + bitField0_ |= 0x00002000; + flags_ = value; + onChanged(); + return this; + } + /** + *
optional int32 flags = 1;
+ *
+ * + *suspend + *+ */ + public Builder clearFlags() { + bitField0_ = (bitField0_ & ~0x00002000); + flags_ = 0; + onChanged(); + return this; + } + // @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.serialization.Type) } @@ -27159,7 +27269,7 @@ public final class DebugProtoBuf { "\n\004BYTE\020\000\022\010\n\004CHAR\020\001\022\t\n\005SHORT\020\002\022\007\n\003INT\020\003\022\010" + "\n\004LONG\020\004\022\t\n\005FLOAT\020\005\022\n\n\006DOUBLE\020\006\022\013\n\007BOOLE", "AN\020\007\022\n\n\006STRING\020\010\022\t\n\005CLASS\020\t\022\010\n\004ENUM\020\n\022\016\n" + - "\nANNOTATION\020\013\022\t\n\005ARRAY\020\014\"\212\006\n\004Type\022C\n\010arg" + + "\nANNOTATION\020\013\022\t\n\005ARRAY\020\014\"\231\006\n\004Type\022C\n\010arg" + "ument\030\002 \003(\01321.org.jetbrains.kotlin.seria" + "lization.Type.Argument\022\027\n\010nullable\030\003 \001(\010" + ":\005false\022+\n\035flexible_type_capabilities_id" + @@ -27173,115 +27283,115 @@ public final class DebugProtoBuf { "ialization.Type\022\025\n\router_type_id\030\013 \001(\005\022B" + "\n\020abbreviated_type\030\r \001(\0132(.org.jetbrains" + ".kotlin.serialization.Type\022\033\n\023abbreviate" + - "d_type_id\030\016 \001(\005\032\334\001\n\010Argument\022U\n\nprojecti" + - "on\030\001 \001(\0162<.org.jetbrains.kotlin.serializ" + - "ation.Type.Argument.Projection:\003INV\0226\n\004t" + - "ype\030\002 \001(\0132(.org.jetbrains.kotlin.seriali" + - "zation.Type\022\017\n\007type_id\030\003 \001(\005\"0\n\nProjecti", - "on\022\006\n\002IN\020\000\022\007\n\003OUT\020\001\022\007\n\003INV\020\002\022\010\n\004STAR\020\003*\005" + - "\010d\020\310\001\"\236\002\n\rTypeParameter\022\n\n\002id\030\001 \002(\005\022\022\n\004n" + - "ame\030\002 \002(\005B\004\210\265\030\001\022\026\n\007reified\030\003 \001(\010:\005false\022" + - "Q\n\010variance\030\004 \001(\0162:.org.jetbrains.kotlin" + - ".serialization.TypeParameter.Variance:\003I" + - "NV\022=\n\013upper_bound\030\005 \003(\0132(.org.jetbrains." + - "kotlin.serialization.Type\022\026\n\016upper_bound" + - "_id\030\006 \003(\005\"$\n\010Variance\022\006\n\002IN\020\000\022\007\n\003OUT\020\001\022\007" + - "\n\003INV\020\002*\005\010d\020\350\007\"\236\007\n\005Class\022\020\n\005flags\030\001 \001(\005:" + - "\0016\022\025\n\007fq_name\030\003 \002(\005B\004\220\265\030\001\022#\n\025companion_o", - "bject_name\030\004 \001(\005B\004\210\265\030\001\022I\n\016type_parameter" + - "\030\005 \003(\01321.org.jetbrains.kotlin.serializat" + - "ion.TypeParameter\022;\n\tsupertype\030\006 \003(\0132(.o" + - "rg.jetbrains.kotlin.serialization.Type\022\030" + - "\n\014supertype_id\030\002 \003(\005B\002\020\001\022!\n\021nested_class" + - "_name\030\007 \003(\005B\006\020\001\210\265\030\001\022D\n\013constructor\030\010 \003(\013" + - "2/.org.jetbrains.kotlin.serialization.Co" + - "nstructor\022>\n\010function\030\t \003(\0132,.org.jetbra" + - "ins.kotlin.serialization.Function\022>\n\010pro" + - "perty\030\n \003(\0132,.org.jetbrains.kotlin.seria", - "lization.Property\022A\n\ntype_alias\030\013 \003(\0132-." + - "org.jetbrains.kotlin.serialization.TypeA" + - "lias\022A\n\nenum_entry\030\r \003(\0132-.org.jetbrains" + - ".kotlin.serialization.EnumEntry\022A\n\ntype_" + - "table\030\036 \001(\0132-.org.jetbrains.kotlin.seria" + - "lization.TypeTable\022\027\n\017sinceKotlinInfo\030\037 " + - "\001(\005\022Y\n\027since_kotlin_info_table\030 \001(\01328.o" + - "rg.jetbrains.kotlin.serialization.SinceK" + - "otlinInfoTable\"x\n\004Kind\022\t\n\005CLASS\020\000\022\r\n\tINT" + - "ERFACE\020\001\022\016\n\nENUM_CLASS\020\002\022\016\n\nENUM_ENTRY\020\003", - "\022\024\n\020ANNOTATION_CLASS\020\004\022\n\n\006OBJECT\020\005\022\024\n\020CO" + - "MPANION_OBJECT\020\006*\005\010d\020\310\001\"\361\002\n\007Package\022>\n\010f" + - "unction\030\003 \003(\0132,.org.jetbrains.kotlin.ser" + - "ialization.Function\022>\n\010property\030\004 \003(\0132,." + - "org.jetbrains.kotlin.serialization.Prope" + - "rty\022A\n\ntype_alias\030\005 \003(\0132-.org.jetbrains." + - "kotlin.serialization.TypeAlias\022A\n\ntype_t" + - "able\030\036 \001(\0132-.org.jetbrains.kotlin.serial" + - "ization.TypeTable\022Y\n\027since_kotlin_info_t" + - "able\030 \001(\01328.org.jetbrains.kotlin.serial", - "ization.SinceKotlinInfoTable*\005\010d\020\310\001\"_\n\tT" + - "ypeTable\0226\n\004type\030\001 \003(\0132(.org.jetbrains.k" + - "otlin.serialization.Type\022\032\n\016first_nullab" + - "le\030\002 \001(\005:\002-1\"\214\001\n\013Constructor\022\020\n\005flags\030\001 " + - "\001(\005:\0016\022K\n\017value_parameter\030\002 \003(\01322.org.je" + - "tbrains.kotlin.serialization.ValueParame" + - "ter\022\027\n\017sinceKotlinInfo\030\037 \001(\005*\005\010d\020\310\001\"\363\003\n\010" + - "Function\022\020\n\005flags\030\t \001(\005:\0016\022\024\n\told_flags\030" + - "\001 \001(\005:\0016\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\022=\n\013return_t" + - "ype\030\003 \001(\0132(.org.jetbrains.kotlin.seriali", - "zation.Type\022\026\n\016return_type_id\030\007 \001(\005\022I\n\016t" + - "ype_parameter\030\004 \003(\01321.org.jetbrains.kotl" + - "in.serialization.TypeParameter\022?\n\rreceiv" + - "er_type\030\005 \001(\0132(.org.jetbrains.kotlin.ser" + - "ialization.Type\022\030\n\020receiver_type_id\030\010 \001(" + - "\005\022K\n\017value_parameter\030\006 \003(\01322.org.jetbrai" + - "ns.kotlin.serialization.ValueParameter\022A" + - "\n\ntype_table\030\036 \001(\0132-.org.jetbrains.kotli" + - "n.serialization.TypeTable\022\027\n\017sinceKotlin" + - "Info\030\037 \001(\005*\005\010d\020\310\001\"\350\003\n\010Property\022\022\n\005flags\030", - "\013 \001(\005:\003518\022\027\n\told_flags\030\001 \001(\005:\0042054\022\022\n\004n" + - "ame\030\002 \002(\005B\004\210\265\030\001\022=\n\013return_type\030\003 \001(\0132(.o" + - "rg.jetbrains.kotlin.serialization.Type\022\026" + - "\n\016return_type_id\030\t \001(\005\022I\n\016type_parameter" + - "\030\004 \003(\01321.org.jetbrains.kotlin.serializat" + - "ion.TypeParameter\022?\n\rreceiver_type\030\005 \001(\013" + - "2(.org.jetbrains.kotlin.serialization.Ty" + - "pe\022\030\n\020receiver_type_id\030\n \001(\005\022R\n\026setter_v" + - "alue_parameter\030\006 \001(\01322.org.jetbrains.kot" + - "lin.serialization.ValueParameter\022\024\n\014gett", - "er_flags\030\007 \001(\005\022\024\n\014setter_flags\030\010 \001(\005\022\027\n\017" + - "sinceKotlinInfo\030\037 \001(\005*\005\010d\020\310\001\"\355\001\n\016ValuePa" + - "rameter\022\020\n\005flags\030\001 \001(\005:\0010\022\022\n\004name\030\002 \002(\005B" + - "\004\210\265\030\001\0226\n\004type\030\003 \001(\0132(.org.jetbrains.kotl" + - "in.serialization.Type\022\017\n\007type_id\030\005 \001(\005\022E" + - "\n\023vararg_element_type\030\004 \001(\0132(.org.jetbra" + - "ins.kotlin.serialization.Type\022\036\n\026vararg_" + - "element_type_id\030\006 \001(\005*\005\010d\020\310\001\"\232\003\n\tTypeAli" + - "as\022\020\n\005flags\030\001 \001(\005:\0016\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001" + - "\022I\n\016type_parameter\030\003 \003(\01321.org.jetbrains", - ".kotlin.serialization.TypeParameter\022A\n\017u" + - "nderlying_type\030\004 \001(\0132(.org.jetbrains.kot" + - "lin.serialization.Type\022\032\n\022underlying_typ" + - "e_id\030\005 \001(\005\022?\n\rexpanded_type\030\006 \001(\0132(.org." + - "jetbrains.kotlin.serialization.Type\022\030\n\020e" + - "xpanded_type_id\030\007 \001(\005\022B\n\nannotation\030\010 \003(" + - "\0132..org.jetbrains.kotlin.serialization.A" + - "nnotation\022\027\n\017sinceKotlinInfo\030\037 \001(\005*\005\010d\020\310" + - "\001\"&\n\tEnumEntry\022\022\n\004name\030\001 \001(\005B\004\210\265\030\001*\005\010d\020\310" + - "\001\"\341\001\n\017SinceKotlinInfo\022\017\n\007version\030\001 \001(\005\022\024", - "\n\014version_full\030\002 \001(\005\022O\n\005level\030\003 \001(\01629.or" + - "g.jetbrains.kotlin.serialization.SinceKo" + - "tlinInfo.Level:\005ERROR\022\022\n\nerror_code\030\004 \001(" + - "\005\022\025\n\007message\030\005 \001(\005B\004\230\265\030\001\"+\n\005Level\022\013\n\007WAR" + - "NING\020\000\022\t\n\005ERROR\020\001\022\n\n\006HIDDEN\020\002\"Y\n\024SinceKo" + - "tlinInfoTable\022A\n\004info\030\001 \003(\01323.org.jetbra" + - "ins.kotlin.serialization.SinceKotlinInfo" + - "*9\n\010Modality\022\t\n\005FINAL\020\000\022\010\n\004OPEN\020\001\022\014\n\010ABS" + - "TRACT\020\002\022\n\n\006SEALED\020\003*b\n\nVisibility\022\014\n\010INT" + - "ERNAL\020\000\022\013\n\007PRIVATE\020\001\022\r\n\tPROTECTED\020\002\022\n\n\006P", - "UBLIC\020\003\022\023\n\017PRIVATE_TO_THIS\020\004\022\t\n\005LOCAL\020\005*" + - "Q\n\nMemberKind\022\017\n\013DECLARATION\020\000\022\021\n\rFAKE_O" + - "VERRIDE\020\001\022\016\n\nDELEGATION\020\002\022\017\n\013SYNTHESIZED" + - "\020\003B\017B\rDebugProtoBuf" + "d_type_id\030\016 \001(\005\022\r\n\005flags\030\001 \001(\005\032\334\001\n\010Argum" + + "ent\022U\n\nprojection\030\001 \001(\0162<.org.jetbrains." + + "kotlin.serialization.Type.Argument.Proje" + + "ction:\003INV\0226\n\004type\030\002 \001(\0132(.org.jetbrains" + + ".kotlin.serialization.Type\022\017\n\007type_id\030\003 ", + "\001(\005\"0\n\nProjection\022\006\n\002IN\020\000\022\007\n\003OUT\020\001\022\007\n\003IN" + + "V\020\002\022\010\n\004STAR\020\003*\005\010d\020\310\001\"\236\002\n\rTypeParameter\022\n" + + "\n\002id\030\001 \002(\005\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\022\026\n\007reifie" + + "d\030\003 \001(\010:\005false\022Q\n\010variance\030\004 \001(\0162:.org.j" + + "etbrains.kotlin.serialization.TypeParame" + + "ter.Variance:\003INV\022=\n\013upper_bound\030\005 \003(\0132(" + + ".org.jetbrains.kotlin.serialization.Type" + + "\022\026\n\016upper_bound_id\030\006 \003(\005\"$\n\010Variance\022\006\n\002" + + "IN\020\000\022\007\n\003OUT\020\001\022\007\n\003INV\020\002*\005\010d\020\350\007\"\236\007\n\005Class\022" + + "\020\n\005flags\030\001 \001(\005:\0016\022\025\n\007fq_name\030\003 \002(\005B\004\220\265\030\001", + "\022#\n\025companion_object_name\030\004 \001(\005B\004\210\265\030\001\022I\n" + + "\016type_parameter\030\005 \003(\01321.org.jetbrains.ko" + + "tlin.serialization.TypeParameter\022;\n\tsupe" + + "rtype\030\006 \003(\0132(.org.jetbrains.kotlin.seria" + + "lization.Type\022\030\n\014supertype_id\030\002 \003(\005B\002\020\001\022" + + "!\n\021nested_class_name\030\007 \003(\005B\006\020\001\210\265\030\001\022D\n\013co" + + "nstructor\030\010 \003(\0132/.org.jetbrains.kotlin.s" + + "erialization.Constructor\022>\n\010function\030\t \003" + + "(\0132,.org.jetbrains.kotlin.serialization." + + "Function\022>\n\010property\030\n \003(\0132,.org.jetbrai", + "ns.kotlin.serialization.Property\022A\n\ntype" + + "_alias\030\013 \003(\0132-.org.jetbrains.kotlin.seri" + + "alization.TypeAlias\022A\n\nenum_entry\030\r \003(\0132" + + "-.org.jetbrains.kotlin.serialization.Enu" + + "mEntry\022A\n\ntype_table\030\036 \001(\0132-.org.jetbrai" + + "ns.kotlin.serialization.TypeTable\022\027\n\017sin" + + "ceKotlinInfo\030\037 \001(\005\022Y\n\027since_kotlin_info_" + + "table\030 \001(\01328.org.jetbrains.kotlin.seria" + + "lization.SinceKotlinInfoTable\"x\n\004Kind\022\t\n" + + "\005CLASS\020\000\022\r\n\tINTERFACE\020\001\022\016\n\nENUM_CLASS\020\002\022", + "\016\n\nENUM_ENTRY\020\003\022\024\n\020ANNOTATION_CLASS\020\004\022\n\n" + + "\006OBJECT\020\005\022\024\n\020COMPANION_OBJECT\020\006*\005\010d\020\310\001\"\361" + + "\002\n\007Package\022>\n\010function\030\003 \003(\0132,.org.jetbr" + + "ains.kotlin.serialization.Function\022>\n\010pr" + + "operty\030\004 \003(\0132,.org.jetbrains.kotlin.seri" + + "alization.Property\022A\n\ntype_alias\030\005 \003(\0132-" + + ".org.jetbrains.kotlin.serialization.Type" + + "Alias\022A\n\ntype_table\030\036 \001(\0132-.org.jetbrain" + + "s.kotlin.serialization.TypeTable\022Y\n\027sinc" + + "e_kotlin_info_table\030 \001(\01328.org.jetbrain", + "s.kotlin.serialization.SinceKotlinInfoTa" + + "ble*\005\010d\020\310\001\"_\n\tTypeTable\0226\n\004type\030\001 \003(\0132(." + + "org.jetbrains.kotlin.serialization.Type\022" + + "\032\n\016first_nullable\030\002 \001(\005:\002-1\"\214\001\n\013Construc" + + "tor\022\020\n\005flags\030\001 \001(\005:\0016\022K\n\017value_parameter" + + "\030\002 \003(\01322.org.jetbrains.kotlin.serializat" + + "ion.ValueParameter\022\027\n\017sinceKotlinInfo\030\037 " + + "\001(\005*\005\010d\020\310\001\"\363\003\n\010Function\022\020\n\005flags\030\t \001(\005:\001" + + "6\022\024\n\told_flags\030\001 \001(\005:\0016\022\022\n\004name\030\002 \002(\005B\004\210" + + "\265\030\001\022=\n\013return_type\030\003 \001(\0132(.org.jetbrains", + ".kotlin.serialization.Type\022\026\n\016return_typ" + + "e_id\030\007 \001(\005\022I\n\016type_parameter\030\004 \003(\01321.org" + + ".jetbrains.kotlin.serialization.TypePara" + + "meter\022?\n\rreceiver_type\030\005 \001(\0132(.org.jetbr" + + "ains.kotlin.serialization.Type\022\030\n\020receiv" + + "er_type_id\030\010 \001(\005\022K\n\017value_parameter\030\006 \003(" + + "\01322.org.jetbrains.kotlin.serialization.V" + + "alueParameter\022A\n\ntype_table\030\036 \001(\0132-.org." + + "jetbrains.kotlin.serialization.TypeTable" + + "\022\027\n\017sinceKotlinInfo\030\037 \001(\005*\005\010d\020\310\001\"\350\003\n\010Pro", + "perty\022\022\n\005flags\030\013 \001(\005:\003518\022\027\n\told_flags\030\001" + + " \001(\005:\0042054\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\022=\n\013return" + + "_type\030\003 \001(\0132(.org.jetbrains.kotlin.seria" + + "lization.Type\022\026\n\016return_type_id\030\t \001(\005\022I\n" + + "\016type_parameter\030\004 \003(\01321.org.jetbrains.ko" + + "tlin.serialization.TypeParameter\022?\n\rrece" + + "iver_type\030\005 \001(\0132(.org.jetbrains.kotlin.s" + + "erialization.Type\022\030\n\020receiver_type_id\030\n " + + "\001(\005\022R\n\026setter_value_parameter\030\006 \001(\01322.or" + + "g.jetbrains.kotlin.serialization.ValuePa", + "rameter\022\024\n\014getter_flags\030\007 \001(\005\022\024\n\014setter_" + + "flags\030\010 \001(\005\022\027\n\017sinceKotlinInfo\030\037 \001(\005*\005\010d" + + "\020\310\001\"\355\001\n\016ValueParameter\022\020\n\005flags\030\001 \001(\005:\0010" + + "\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\0226\n\004type\030\003 \001(\0132(.org" + + ".jetbrains.kotlin.serialization.Type\022\017\n\007" + + "type_id\030\005 \001(\005\022E\n\023vararg_element_type\030\004 \001" + + "(\0132(.org.jetbrains.kotlin.serialization." + + "Type\022\036\n\026vararg_element_type_id\030\006 \001(\005*\005\010d" + + "\020\310\001\"\232\003\n\tTypeAlias\022\020\n\005flags\030\001 \001(\005:\0016\022\022\n\004n" + + "ame\030\002 \002(\005B\004\210\265\030\001\022I\n\016type_parameter\030\003 \003(\0132", + "1.org.jetbrains.kotlin.serialization.Typ" + + "eParameter\022A\n\017underlying_type\030\004 \001(\0132(.or" + + "g.jetbrains.kotlin.serialization.Type\022\032\n" + + "\022underlying_type_id\030\005 \001(\005\022?\n\rexpanded_ty" + + "pe\030\006 \001(\0132(.org.jetbrains.kotlin.serializ" + + "ation.Type\022\030\n\020expanded_type_id\030\007 \001(\005\022B\n\n" + + "annotation\030\010 \003(\0132..org.jetbrains.kotlin." + + "serialization.Annotation\022\027\n\017sinceKotlinI" + + "nfo\030\037 \001(\005*\005\010d\020\310\001\"&\n\tEnumEntry\022\022\n\004name\030\001 " + + "\001(\005B\004\210\265\030\001*\005\010d\020\310\001\"\341\001\n\017SinceKotlinInfo\022\017\n\007", + "version\030\001 \001(\005\022\024\n\014version_full\030\002 \001(\005\022O\n\005l" + + "evel\030\003 \001(\01629.org.jetbrains.kotlin.serial" + + "ization.SinceKotlinInfo.Level:\005ERROR\022\022\n\n" + + "error_code\030\004 \001(\005\022\025\n\007message\030\005 \001(\005B\004\230\265\030\001\"" + + "+\n\005Level\022\013\n\007WARNING\020\000\022\t\n\005ERROR\020\001\022\n\n\006HIDD" + + "EN\020\002\"Y\n\024SinceKotlinInfoTable\022A\n\004info\030\001 \003" + + "(\01323.org.jetbrains.kotlin.serialization." + + "SinceKotlinInfo*9\n\010Modality\022\t\n\005FINAL\020\000\022\010" + + "\n\004OPEN\020\001\022\014\n\010ABSTRACT\020\002\022\n\n\006SEALED\020\003*b\n\nVi" + + "sibility\022\014\n\010INTERNAL\020\000\022\013\n\007PRIVATE\020\001\022\r\n\tP", + "ROTECTED\020\002\022\n\n\006PUBLIC\020\003\022\023\n\017PRIVATE_TO_THI" + + "S\020\004\022\t\n\005LOCAL\020\005*Q\n\nMemberKind\022\017\n\013DECLARAT" + + "ION\020\000\022\021\n\rFAKE_OVERRIDE\020\001\022\016\n\nDELEGATION\020\002" + + "\022\017\n\013SYNTHESIZED\020\003B\017B\rDebugProtoBuf" }; org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { @@ -27337,7 +27447,7 @@ public final class DebugProtoBuf { internal_static_org_jetbrains_kotlin_serialization_Type_fieldAccessorTable = new org.jetbrains.kotlin.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_org_jetbrains_kotlin_serialization_Type_descriptor, - new java.lang.String[] { "Argument", "Nullable", "FlexibleTypeCapabilitiesId", "FlexibleUpperBound", "FlexibleUpperBoundId", "ClassName", "TypeParameter", "TypeParameterName", "TypeAliasName", "OuterType", "OuterTypeId", "AbbreviatedType", "AbbreviatedTypeId", }); + new java.lang.String[] { "Argument", "Nullable", "FlexibleTypeCapabilitiesId", "FlexibleUpperBound", "FlexibleUpperBoundId", "ClassName", "TypeParameter", "TypeParameterName", "TypeAliasName", "OuterType", "OuterTypeId", "AbbreviatedType", "AbbreviatedTypeId", "Flags", }); internal_static_org_jetbrains_kotlin_serialization_Type_Argument_descriptor = internal_static_org_jetbrains_kotlin_serialization_Type_descriptor.getNestedTypes().get(0); internal_static_org_jetbrains_kotlin_serialization_Type_Argument_fieldAccessorTable = new diff --git a/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.kt b/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.kt index 1dc2f80b1d7..4ad03bce4ca 100644 --- a/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.kt +++ b/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.kt @@ -17,6 +17,8 @@ package org.jetbrains.kotlin.serialization import org.jetbrains.kotlin.builtins.KotlinBuiltIns +import org.jetbrains.kotlin.builtins.functions.FunctionClassDescriptor +import org.jetbrains.kotlin.builtins.getFunctionalClassKind import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.descriptors.annotations.Annotated import org.jetbrains.kotlin.name.Name @@ -25,6 +27,7 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.DescriptorUtils.isEnumEntry import org.jetbrains.kotlin.resolve.MemberComparator import org.jetbrains.kotlin.resolve.constants.NullValue +import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns import org.jetbrains.kotlin.types.* import org.jetbrains.kotlin.utils.Interner import java.io.ByteArrayOutputStream @@ -455,12 +458,25 @@ class DescriptorSerializer private constructor( } private fun fillFromPossiblyInnerType(builder: ProtoBuf.Type.Builder, type: PossiblyInnerType) { - val classifierDescriptor = type.classifierDescriptor + val classifierDescriptor: ClassifierDescriptorWithTypeParameters + val isSuspendType: Boolean + + val originalClassifierDescriptor = type.classifierDescriptor + if (originalClassifierDescriptor.getFunctionalClassKind() == FunctionClassDescriptor.Kind.SuspendFunction) { + classifierDescriptor = originalClassifierDescriptor.builtIns.getFunction(originalClassifierDescriptor.declaredTypeParameters.size) + isSuspendType = true + } + else { + classifierDescriptor = originalClassifierDescriptor + isSuspendType = false + } + val classifierId = getClassifierId(classifierDescriptor) when (classifierDescriptor) { is ClassDescriptor -> builder.className = classifierId is TypeAliasDescriptor -> builder.typeAliasName = classifierId } + builder.flags = Flags.getTypeFlags(isSuspendType) for (projection in type.arguments) { builder.addArgument(typeArgument(projection)) diff --git a/compiler/testData/diagnostics/tests/coroutines/suspendFunctionType/modifierApplicability.kt b/compiler/testData/diagnostics/tests/coroutines/suspendFunctionType/modifierApplicability.kt index ff57cf96d2a..4ac9140a271 100644 --- a/compiler/testData/diagnostics/tests/coroutines/suspendFunctionType/modifierApplicability.kt +++ b/compiler/testData/diagnostics/tests/coroutines/suspendFunctionType/modifierApplicability.kt @@ -11,7 +11,7 @@ typealias Test4 = suspend Action typealias Test5 = List
optional int32 abbreviated_type_id = 14;
*/
int getAbbreviatedTypeId();
+
+ /**
+ * optional int32 flags = 1;
+ *
+ * + *suspend + *+ */ + boolean hasFlags(); + /** + *
optional int32 flags = 1;
+ *
+ * + *suspend + *+ */ + int getFlags(); } /** * Protobuf type {@code org.jetbrains.kotlin.serialization.Type} @@ -4541,6 +4558,11 @@ public final class ProtoBuf { } break; } + case 8: { + bitField0_ |= 0x00001000; + flags_ = input.readInt32(); + break; + } case 18: { if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { argument_ = new java.util.ArrayList
optional int32 flags = 1;
+ *
+ * + *suspend + *+ */ + public boolean hasFlags() { + return ((bitField0_ & 0x00001000) == 0x00001000); + } + /** + *
optional int32 flags = 1;
+ *
+ * + *suspend + *+ */ + public int getFlags() { + return flags_; + } + private void initFields() { argument_ = java.util.Collections.emptyList(); nullable_ = false; @@ -5615,6 +5660,7 @@ public final class ProtoBuf { outerTypeId_ = 0; abbreviatedType_ = org.jetbrains.kotlin.serialization.ProtoBuf.Type.getDefaultInstance(); abbreviatedTypeId_ = 0; + flags_ = 0; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { @@ -5660,6 +5706,9 @@ public final class ProtoBuf { org.jetbrains.kotlin.protobuf.GeneratedMessageLite .ExtendableMessage
optional int32 flags = 1;
+ *
+ * + *suspend + *+ */ + public boolean hasFlags() { + return ((bitField0_ & 0x00002000) == 0x00002000); + } + /** + *
optional int32 flags = 1;
+ *
+ * + *suspend + *+ */ + public int getFlags() { + return flags_; + } + /** + *
optional int32 flags = 1;
+ *
+ * + *suspend + *+ */ + public Builder setFlags(int value) { + bitField0_ |= 0x00002000; + flags_ = value; + + return this; + } + /** + *
optional int32 flags = 1;
+ *
+ * + *suspend + *+ */ + public Builder clearFlags() { + bitField0_ = (bitField0_ & ~0x00002000); + flags_ = 0; + + return this; + } + // @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.serialization.Type) } 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 6cbc6a5c1a7..9a57008a8dc 100644 --- a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/TypeDeserializer.kt +++ b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/TypeDeserializer.kt @@ -16,11 +16,14 @@ package org.jetbrains.kotlin.serialization.deserialization +import org.jetbrains.kotlin.builtins.functions.BuiltInFictitiousFunctionClassFactory import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.ClassifierDescriptor import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor import org.jetbrains.kotlin.descriptors.annotations.AnnotationWithTarget import org.jetbrains.kotlin.descriptors.annotations.Annotations +import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns +import org.jetbrains.kotlin.serialization.Flags import org.jetbrains.kotlin.serialization.ProtoBuf import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedAnnotationsWithPossibleTargets import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedTypeParameterDescriptor @@ -105,8 +108,13 @@ class TypeDeserializer( private fun typeConstructor(proto: ProtoBuf.Type): TypeConstructor = when { proto.hasClassName() -> { - classDescriptors(proto.className)?.typeConstructor - ?: c.components.notFoundClasses.getClass(proto, c.nameResolver, c.typeTable) + if (Flags.SUSPEND_TYPE.get(proto.flags)) { + getSuspendFunctionTypeConstructor(proto) + } + else { + classDescriptors(proto.className)?.typeConstructor + ?: c.components.notFoundClasses.getClass(proto, c.nameResolver, c.typeTable) + } } proto.hasTypeParameter() -> typeParameterTypeConstructor(proto.typeParameter) @@ -124,6 +132,16 @@ class TypeDeserializer( else -> ErrorUtils.createErrorTypeConstructor("Unknown type") } + private fun getSuspendFunctionTypeConstructor(proto: ProtoBuf.Type): TypeConstructor { + val classId = c.nameResolver.getClassId(proto.className) + val arity = BuiltInFictitiousFunctionClassFactory.getFunctionalClassArity(classId.shortClassName.asString(), classId.packageFqName) + + return if (arity != null) + c.containingDeclaration.builtIns.getSuspendFunction(arity - 1).typeConstructor + else + ErrorUtils.createErrorTypeConstructor("Class is not a FunctionN ${classId.asString()}") + } + private fun typeParameterTypeConstructor(typeParameterId: Int): TypeConstructor? = typeParameterDescriptors.get(typeParameterId)?.typeConstructor ?: parent?.typeParameterTypeConstructor(typeParameterId) diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/TypeClsStubBuilder.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/TypeClsStubBuilder.kt index 6cbf67bc893..bbcc37bcf47 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/TypeClsStubBuilder.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/TypeClsStubBuilder.kt @@ -127,9 +127,8 @@ class TypeClsStubBuilder(private val c: ClsStubBuilderContext) { if (!type.hasClassName() && !type.hasTypeAliasName()) return emptySet() val result = hashSetOf