From 28e6219b0bed5ccf96e5101d590d2350795f8b6b Mon Sep 17 00:00:00 2001 From: Alexey Tsvetkov Date: Mon, 28 Oct 2019 04:25:18 +0300 Subject: [PATCH] Fix proto comparison for fields mapped to type table --- .../incremental/ProtoCompareGenerated.kt | 320 +++++++++--------- .../incremental/protoDifferenceUtils.kt | 46 ++- .../metadata/DebugExtOptionsProtoBuf.java | 18 +- .../kotlin/metadata/DebugProtoBuf.java | 265 ++++++++------- core/metadata/src/ext_options.proto | 1 + core/metadata/src/metadata.proto | 30 +- .../protobuf/GenerateProtoBufCompare.kt | 23 +- .../AbstractProtoComparisonTest.kt | 14 +- 8 files changed, 407 insertions(+), 310 deletions(-) diff --git a/build-common/src/org/jetbrains/kotlin/incremental/ProtoCompareGenerated.kt b/build-common/src/org/jetbrains/kotlin/incremental/ProtoCompareGenerated.kt index 5a92813ffa2..ed116f8d293 100644 --- a/build-common/src/org/jetbrains/kotlin/incremental/ProtoCompareGenerated.kt +++ b/build-common/src/org/jetbrains/kotlin/incremental/ProtoCompareGenerated.kt @@ -30,12 +30,19 @@ import java.util.* /** This file is generated by org.jetbrains.kotlin.generators.protobuf.GenerateProtoBufCompare. DO NOT MODIFY MANUALLY */ -open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameResolver: NameResolver) { +open class ProtoCompareGenerated( + val oldNameResolver: NameResolver, + val newNameResolver: NameResolver, + oldTypeTable: ProtoBuf.TypeTable?, + newTypeTable: ProtoBuf.TypeTable? +) { private val strings = Interner() val oldStringIndexesMap: MutableMap = hashMapOf() val newStringIndexesMap: MutableMap = hashMapOf() val oldClassIdIndexesMap: MutableMap = hashMapOf() val newClassIdIndexesMap: MutableMap = hashMapOf() + val oldTypeTable: ProtoBuf.TypeTable = oldTypeTable ?: ProtoBuf.TypeTable.getDefaultInstance() + val newTypeTable: ProtoBuf.TypeTable = newTypeTable ?: ProtoBuf.TypeTable.getDefaultInstance() private val classIds = Interner() @@ -429,7 +436,7 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR if (old.hasReturnTypeId() != new.hasReturnTypeId()) return false if (old.hasReturnTypeId()) { - if (old.returnTypeId != new.returnTypeId) return false + if (!checkEquals(oldTypeTable.getType(old.returnTypeId), newTypeTable.getType(new.returnTypeId))) return false } if (!checkEqualsFunctionTypeParameter(old, new)) return false @@ -441,7 +448,7 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR if (old.hasReceiverTypeId() != new.hasReceiverTypeId()) return false if (old.hasReceiverTypeId()) { - if (old.receiverTypeId != new.receiverTypeId) return false + if (!checkEquals(oldTypeTable.getType(old.receiverTypeId), newTypeTable.getType(new.receiverTypeId))) return false } if (!checkEqualsFunctionValueParameter(old, new)) return false @@ -543,7 +550,7 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR if (old.hasReturnTypeId() != new.hasReturnTypeId()) return false if (old.hasReturnTypeId()) { - if (old.returnTypeId != new.returnTypeId) return false + if (!checkEquals(oldTypeTable.getType(old.returnTypeId), newTypeTable.getType(new.returnTypeId))) return false } if (!checkEqualsPropertyTypeParameter(old, new)) return false @@ -555,7 +562,7 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR if (old.hasReceiverTypeId() != new.hasReceiverTypeId()) return false if (old.hasReceiverTypeId()) { - if (old.receiverTypeId != new.receiverTypeId) return false + if (!checkEquals(oldTypeTable.getType(old.receiverTypeId), newTypeTable.getType(new.receiverTypeId))) return false } if (old.hasSetterValueParameter() != new.hasSetterValueParameter()) return false @@ -726,7 +733,7 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR if (old.hasUnderlyingTypeId() != new.hasUnderlyingTypeId()) return false if (old.hasUnderlyingTypeId()) { - if (old.underlyingTypeId != new.underlyingTypeId) return false + if (!checkEquals(oldTypeTable.getType(old.underlyingTypeId), newTypeTable.getType(new.underlyingTypeId))) return false } if (old.hasExpandedType() != new.hasExpandedType()) return false @@ -736,7 +743,7 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR if (old.hasExpandedTypeId() != new.hasExpandedTypeId()) return false if (old.hasExpandedTypeId()) { - if (old.expandedTypeId != new.expandedTypeId) return false + if (!checkEquals(oldTypeTable.getType(old.expandedTypeId), newTypeTable.getType(new.expandedTypeId))) return false } if (!checkEqualsTypeAliasAnnotation(old, new)) return false @@ -851,7 +858,7 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR if (old.hasFlexibleUpperBoundId() != new.hasFlexibleUpperBoundId()) return false if (old.hasFlexibleUpperBoundId()) { - if (old.flexibleUpperBoundId != new.flexibleUpperBoundId) return false + if (!checkEquals(oldTypeTable.getType(old.flexibleUpperBoundId), newTypeTable.getType(new.flexibleUpperBoundId))) return false } if (old.hasClassName() != new.hasClassName()) return false @@ -881,7 +888,7 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR if (old.hasOuterTypeId() != new.hasOuterTypeId()) return false if (old.hasOuterTypeId()) { - if (old.outerTypeId != new.outerTypeId) return false + if (!checkEquals(oldTypeTable.getType(old.outerTypeId), newTypeTable.getType(new.outerTypeId))) return false } if (old.hasAbbreviatedType() != new.hasAbbreviatedType()) return false @@ -891,7 +898,7 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR if (old.hasAbbreviatedTypeId() != new.hasAbbreviatedTypeId()) return false if (old.hasAbbreviatedTypeId()) { - if (old.abbreviatedTypeId != new.abbreviatedTypeId) return false + if (!checkEquals(oldTypeTable.getType(old.abbreviatedTypeId), newTypeTable.getType(new.abbreviatedTypeId))) return false } if (old.hasFlags() != new.hasFlags()) return false @@ -1073,7 +1080,7 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR if (old.hasTypeId() != new.hasTypeId()) return false if (old.hasTypeId()) { - if (old.typeId != new.typeId) return false + if (!checkEquals(oldTypeTable.getType(old.typeId), newTypeTable.getType(new.typeId))) return false } if (old.hasVarargElementType() != new.hasVarargElementType()) return false @@ -1083,7 +1090,7 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR if (old.hasVarargElementTypeId() != new.hasVarargElementTypeId()) return false if (old.hasVarargElementTypeId()) { - if (old.varargElementTypeId != new.varargElementTypeId) return false + if (!checkEquals(oldTypeTable.getType(old.varargElementTypeId), newTypeTable.getType(new.varargElementTypeId))) return false } if (old.getExtensionCount(JsProtoBuf.parameterAnnotation) != new.getExtensionCount(JsProtoBuf.parameterAnnotation)) { @@ -1263,7 +1270,7 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR if (old.hasTypeId() != new.hasTypeId()) return false if (old.hasTypeId()) { - if (old.typeId != new.typeId) return false + if (!checkEquals(oldTypeTable.getType(old.typeId), newTypeTable.getType(new.typeId))) return false } return true @@ -1335,7 +1342,7 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR if (old.hasIsInstanceTypeId() != new.hasIsInstanceTypeId()) return false if (old.hasIsInstanceTypeId()) { - if (old.isInstanceTypeId != new.isInstanceTypeId) return false + if (!checkEquals(oldTypeTable.getType(old.isInstanceTypeId), newTypeTable.getType(new.isInstanceTypeId))) return false } if (!checkEqualsExpressionAndArgument(old, new)) return false @@ -1399,7 +1406,7 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR if (old.supertypeIdCount != new.supertypeIdCount) return false for(i in 0..old.supertypeIdCount - 1) { - if (old.getSupertypeId(i) != new.getSupertypeId(i)) return false + if (!checkEquals(oldTypeTable.getType(old.getSupertypeId(i)), newTypeTable.getType(new.getSupertypeId(i)))) return false } return true @@ -1599,7 +1606,7 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR if (old.upperBoundIdCount != new.upperBoundIdCount) return false for(i in 0..old.upperBoundIdCount - 1) { - if (old.getUpperBoundId(i) != new.getUpperBoundId(i)) return false + if (!checkEquals(oldTypeTable.getType(old.getUpperBoundId(i)), newTypeTable.getType(new.getUpperBoundId(i)))) return false } return true @@ -1695,6 +1702,9 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR return true } + fun oldGetTypeById(id: Int): ProtoBuf.Type = oldTypeTable.getType(id) ?: error("Unknown type id: $id") + fun newGetTypeById(id: Int): ProtoBuf.Type = newTypeTable.getType(id) ?: error("Unknown type id: $id") + fun oldGetIndexOfString(index: Int): Int = getIndexOfString(index, oldStringIndexesMap, oldNameResolver) fun newGetIndexOfString(index: Int): Int = getIndexOfString(index, newStringIndexesMap, newNameResolver) @@ -1726,27 +1736,27 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR } } -fun ProtoBuf.Package.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { +fun ProtoBuf.Package.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int, typeById: (Int) -> ProtoBuf.Type): Int { var hashCode = 1 for(i in 0..functionCount - 1) { - hashCode = 31 * hashCode + getFunction(i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getFunction(i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..propertyCount - 1) { - hashCode = 31 * hashCode + getProperty(i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getProperty(i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..typeAliasCount - 1) { - hashCode = 31 * hashCode + getTypeAlias(i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getTypeAlias(i).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasTypeTable()) { - hashCode = 31 * hashCode + typeTable.hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + typeTable.hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasVersionRequirementTable()) { - hashCode = 31 * hashCode + versionRequirementTable.hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + versionRequirementTable.hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasExtension(JvmProtoBuf.packageModuleName)) { @@ -1754,7 +1764,7 @@ fun ProtoBuf.Package.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) } for(i in 0..getExtensionCount(JvmProtoBuf.packageLocalVariable) - 1) { - hashCode = 31 * hashCode + getExtension(JvmProtoBuf.packageLocalVariable, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(JvmProtoBuf.packageLocalVariable, i).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasExtension(JsProtoBuf.packageFqName)) { @@ -1772,7 +1782,7 @@ fun ProtoBuf.Package.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) return hashCode } -fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { +fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int, typeById: (Int) -> ProtoBuf.Type): Int { var hashCode = 1 if (hasFlags()) { @@ -1786,15 +1796,15 @@ fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> } for(i in 0..typeParameterCount - 1) { - hashCode = 31 * hashCode + getTypeParameter(i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getTypeParameter(i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..supertypeCount - 1) { - hashCode = 31 * hashCode + getSupertype(i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getSupertype(i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..supertypeIdCount - 1) { - hashCode = 31 * hashCode + getSupertypeId(i) + hashCode = 31 * hashCode + typeById(getSupertypeId(i)).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..nestedClassNameCount - 1) { @@ -1802,23 +1812,23 @@ fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> } for(i in 0..constructorCount - 1) { - hashCode = 31 * hashCode + getConstructor(i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getConstructor(i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..functionCount - 1) { - hashCode = 31 * hashCode + getFunction(i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getFunction(i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..propertyCount - 1) { - hashCode = 31 * hashCode + getProperty(i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getProperty(i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..typeAliasCount - 1) { - hashCode = 31 * hashCode + getTypeAlias(i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getTypeAlias(i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..enumEntryCount - 1) { - hashCode = 31 * hashCode + getEnumEntry(i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getEnumEntry(i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..sealedSubclassFqNameCount - 1) { @@ -1826,7 +1836,7 @@ fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> } if (hasTypeTable()) { - hashCode = 31 * hashCode + typeTable.hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + typeTable.hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..versionRequirementCount - 1) { @@ -1834,7 +1844,7 @@ fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> } if (hasVersionRequirementTable()) { - hashCode = 31 * hashCode + versionRequirementTable.hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + versionRequirementTable.hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasExtension(JvmProtoBuf.classModuleName)) { @@ -1842,7 +1852,7 @@ fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> } for(i in 0..getExtensionCount(JvmProtoBuf.classLocalVariable) - 1) { - hashCode = 31 * hashCode + getExtension(JvmProtoBuf.classLocalVariable, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(JvmProtoBuf.classLocalVariable, i).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasExtension(JvmProtoBuf.anonymousObjectOriginName)) { @@ -1850,7 +1860,7 @@ fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> } for(i in 0..getExtensionCount(JsProtoBuf.classAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(JsProtoBuf.classAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(JsProtoBuf.classAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasExtension(JsProtoBuf.classContainingFileId)) { @@ -1862,11 +1872,11 @@ fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> } for(i in 0..getExtensionCount(BuiltInsProtoBuf.classAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.classAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.classAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..getExtensionCount(KlibMetadataProtoBuf.classAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.classAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.classAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasExtension(KlibMetadataProtoBuf.classFile)) { @@ -1874,13 +1884,13 @@ fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> } if (hasExtension(KlibMetadataProtoBuf.classUniqId)) { - hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.classUniqId).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.classUniqId).hashCode(stringIndexes, fqNameIndexes, typeById) } return hashCode } -fun ProtoBuf.Function.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { +fun ProtoBuf.Function.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int, typeById: (Int) -> ProtoBuf.Type): Int { var hashCode = 1 if (hasFlags()) { @@ -1894,31 +1904,31 @@ fun ProtoBuf.Function.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) hashCode = 31 * hashCode + stringIndexes(name) if (hasReturnType()) { - hashCode = 31 * hashCode + returnType.hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + returnType.hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasReturnTypeId()) { - hashCode = 31 * hashCode + returnTypeId + hashCode = 31 * hashCode + typeById(returnTypeId).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..typeParameterCount - 1) { - hashCode = 31 * hashCode + getTypeParameter(i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getTypeParameter(i).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasReceiverType()) { - hashCode = 31 * hashCode + receiverType.hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + receiverType.hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasReceiverTypeId()) { - hashCode = 31 * hashCode + receiverTypeId + hashCode = 31 * hashCode + typeById(receiverTypeId).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..valueParameterCount - 1) { - hashCode = 31 * hashCode + getValueParameter(i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getValueParameter(i).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasTypeTable()) { - hashCode = 31 * hashCode + typeTable.hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + typeTable.hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..versionRequirementCount - 1) { @@ -1926,11 +1936,11 @@ fun ProtoBuf.Function.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) } if (hasContract()) { - hashCode = 31 * hashCode + contract.hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + contract.hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasExtension(JvmProtoBuf.methodSignature)) { - hashCode = 31 * hashCode + getExtension(JvmProtoBuf.methodSignature).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(JvmProtoBuf.methodSignature).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasExtension(JvmProtoBuf.lambdaClassOriginName)) { @@ -1938,7 +1948,7 @@ fun ProtoBuf.Function.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) } for(i in 0..getExtensionCount(JsProtoBuf.functionAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(JsProtoBuf.functionAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(JsProtoBuf.functionAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasExtension(JsProtoBuf.functionContainingFileId)) { @@ -1954,11 +1964,11 @@ fun ProtoBuf.Function.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) } for(i in 0..getExtensionCount(BuiltInsProtoBuf.functionAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.functionAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.functionAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..getExtensionCount(KlibMetadataProtoBuf.functionAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.functionAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.functionAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasExtension(KlibMetadataProtoBuf.functionFile)) { @@ -1966,13 +1976,13 @@ fun ProtoBuf.Function.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) } if (hasExtension(KlibMetadataProtoBuf.functionUniqId)) { - hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.functionUniqId).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.functionUniqId).hashCode(stringIndexes, fqNameIndexes, typeById) } return hashCode } -fun ProtoBuf.Property.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { +fun ProtoBuf.Property.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int, typeById: (Int) -> ProtoBuf.Type): Int { var hashCode = 1 if (hasFlags()) { @@ -1986,27 +1996,27 @@ fun ProtoBuf.Property.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) hashCode = 31 * hashCode + stringIndexes(name) if (hasReturnType()) { - hashCode = 31 * hashCode + returnType.hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + returnType.hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasReturnTypeId()) { - hashCode = 31 * hashCode + returnTypeId + hashCode = 31 * hashCode + typeById(returnTypeId).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..typeParameterCount - 1) { - hashCode = 31 * hashCode + getTypeParameter(i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getTypeParameter(i).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasReceiverType()) { - hashCode = 31 * hashCode + receiverType.hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + receiverType.hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasReceiverTypeId()) { - hashCode = 31 * hashCode + receiverTypeId + hashCode = 31 * hashCode + typeById(receiverTypeId).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasSetterValueParameter()) { - hashCode = 31 * hashCode + setterValueParameter.hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + setterValueParameter.hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasGetterFlags()) { @@ -2022,7 +2032,7 @@ fun ProtoBuf.Property.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) } if (hasExtension(JvmProtoBuf.propertySignature)) { - hashCode = 31 * hashCode + getExtension(JvmProtoBuf.propertySignature).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(JvmProtoBuf.propertySignature).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasExtension(JvmProtoBuf.flags)) { @@ -2030,19 +2040,19 @@ fun ProtoBuf.Property.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) } for(i in 0..getExtensionCount(JsProtoBuf.propertyAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(JsProtoBuf.propertyAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(JsProtoBuf.propertyAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..getExtensionCount(JsProtoBuf.propertyGetterAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(JsProtoBuf.propertyGetterAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(JsProtoBuf.propertyGetterAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..getExtensionCount(JsProtoBuf.propertySetterAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(JsProtoBuf.propertySetterAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(JsProtoBuf.propertySetterAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasExtension(JsProtoBuf.compileTimeValue)) { - hashCode = 31 * hashCode + getExtension(JsProtoBuf.compileTimeValue).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(JsProtoBuf.compileTimeValue).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasExtension(JsProtoBuf.propertyContainingFileId)) { @@ -2058,35 +2068,35 @@ fun ProtoBuf.Property.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) } for(i in 0..getExtensionCount(BuiltInsProtoBuf.propertyAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.propertyAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.propertyAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..getExtensionCount(BuiltInsProtoBuf.propertyGetterAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.propertyGetterAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.propertyGetterAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..getExtensionCount(BuiltInsProtoBuf.propertySetterAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.propertySetterAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.propertySetterAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasExtension(BuiltInsProtoBuf.compileTimeValue)) { - hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.compileTimeValue).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.compileTimeValue).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..getExtensionCount(KlibMetadataProtoBuf.propertyAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.propertyAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.propertyAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..getExtensionCount(KlibMetadataProtoBuf.propertyGetterAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.propertyGetterAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.propertyGetterAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..getExtensionCount(KlibMetadataProtoBuf.propertySetterAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.propertySetterAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.propertySetterAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasExtension(KlibMetadataProtoBuf.compileTimeValue)) { - hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.compileTimeValue).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.compileTimeValue).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasExtension(KlibMetadataProtoBuf.propertyFile)) { @@ -2094,13 +2104,13 @@ fun ProtoBuf.Property.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) } if (hasExtension(KlibMetadataProtoBuf.propertyUniqId)) { - hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.propertyUniqId).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.propertyUniqId).hashCode(stringIndexes, fqNameIndexes, typeById) } return hashCode } -fun ProtoBuf.TypeAlias.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { +fun ProtoBuf.TypeAlias.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int, typeById: (Int) -> ProtoBuf.Type): Int { var hashCode = 1 if (hasFlags()) { @@ -2110,27 +2120,27 @@ fun ProtoBuf.TypeAlias.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int hashCode = 31 * hashCode + stringIndexes(name) for(i in 0..typeParameterCount - 1) { - hashCode = 31 * hashCode + getTypeParameter(i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getTypeParameter(i).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasUnderlyingType()) { - hashCode = 31 * hashCode + underlyingType.hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + underlyingType.hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasUnderlyingTypeId()) { - hashCode = 31 * hashCode + underlyingTypeId + hashCode = 31 * hashCode + typeById(underlyingTypeId).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasExpandedType()) { - hashCode = 31 * hashCode + expandedType.hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + expandedType.hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasExpandedTypeId()) { - hashCode = 31 * hashCode + expandedTypeId + hashCode = 31 * hashCode + typeById(expandedTypeId).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..annotationCount - 1) { - hashCode = 31 * hashCode + getAnnotation(i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getAnnotation(i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..versionRequirementCount - 1) { @@ -2138,17 +2148,17 @@ fun ProtoBuf.TypeAlias.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int } if (hasExtension(KlibMetadataProtoBuf.typeAliasUniqId)) { - hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.typeAliasUniqId).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.typeAliasUniqId).hashCode(stringIndexes, fqNameIndexes, typeById) } return hashCode } -fun ProtoBuf.TypeTable.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { +fun ProtoBuf.TypeTable.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int, typeById: (Int) -> ProtoBuf.Type): Int { var hashCode = 1 for(i in 0..typeCount - 1) { - hashCode = 31 * hashCode + getType(i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getType(i).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasFirstNullable()) { @@ -2158,17 +2168,17 @@ fun ProtoBuf.TypeTable.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int return hashCode } -fun ProtoBuf.VersionRequirementTable.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { +fun ProtoBuf.VersionRequirementTable.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int, typeById: (Int) -> ProtoBuf.Type): Int { var hashCode = 1 for(i in 0..requirementCount - 1) { - hashCode = 31 * hashCode + getRequirement(i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getRequirement(i).hashCode(stringIndexes, fqNameIndexes, typeById) } return hashCode } -fun ProtoBuf.TypeParameter.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { +fun ProtoBuf.TypeParameter.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int, typeById: (Int) -> ProtoBuf.Type): Int { var hashCode = 1 hashCode = 31 * hashCode + id @@ -2184,41 +2194,41 @@ fun ProtoBuf.TypeParameter.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: } for(i in 0..upperBoundCount - 1) { - hashCode = 31 * hashCode + getUpperBound(i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getUpperBound(i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..upperBoundIdCount - 1) { - hashCode = 31 * hashCode + getUpperBoundId(i) + hashCode = 31 * hashCode + typeById(getUpperBoundId(i)).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..getExtensionCount(JvmProtoBuf.typeParameterAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(JvmProtoBuf.typeParameterAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(JvmProtoBuf.typeParameterAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..getExtensionCount(JsProtoBuf.typeParameterAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(JsProtoBuf.typeParameterAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(JsProtoBuf.typeParameterAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..getExtensionCount(BuiltInsProtoBuf.typeParameterAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.typeParameterAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.typeParameterAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..getExtensionCount(KlibMetadataProtoBuf.typeParameterAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.typeParameterAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.typeParameterAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasExtension(KlibMetadataProtoBuf.typeParamUniqId)) { - hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.typeParamUniqId).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.typeParamUniqId).hashCode(stringIndexes, fqNameIndexes, typeById) } return hashCode } -fun ProtoBuf.Type.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { +fun ProtoBuf.Type.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int, typeById: (Int) -> ProtoBuf.Type): Int { var hashCode = 1 for(i in 0..argumentCount - 1) { - hashCode = 31 * hashCode + getArgument(i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getArgument(i).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasNullable()) { @@ -2230,11 +2240,11 @@ fun ProtoBuf.Type.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> } if (hasFlexibleUpperBound()) { - hashCode = 31 * hashCode + flexibleUpperBound.hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + flexibleUpperBound.hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasFlexibleUpperBoundId()) { - hashCode = 31 * hashCode + flexibleUpperBoundId + hashCode = 31 * hashCode + typeById(flexibleUpperBoundId).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasClassName()) { @@ -2254,19 +2264,19 @@ fun ProtoBuf.Type.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> } if (hasOuterType()) { - hashCode = 31 * hashCode + outerType.hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + outerType.hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasOuterTypeId()) { - hashCode = 31 * hashCode + outerTypeId + hashCode = 31 * hashCode + typeById(outerTypeId).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasAbbreviatedType()) { - hashCode = 31 * hashCode + abbreviatedType.hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + abbreviatedType.hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasAbbreviatedTypeId()) { - hashCode = 31 * hashCode + abbreviatedTypeId + hashCode = 31 * hashCode + typeById(abbreviatedTypeId).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasFlags()) { @@ -2274,7 +2284,7 @@ fun ProtoBuf.Type.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> } for(i in 0..getExtensionCount(JvmProtoBuf.typeAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(JvmProtoBuf.typeAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(JvmProtoBuf.typeAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasExtension(JvmProtoBuf.isRaw)) { @@ -2282,21 +2292,21 @@ fun ProtoBuf.Type.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> } for(i in 0..getExtensionCount(JsProtoBuf.typeAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(JsProtoBuf.typeAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(JsProtoBuf.typeAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..getExtensionCount(BuiltInsProtoBuf.typeAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.typeAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.typeAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..getExtensionCount(KlibMetadataProtoBuf.typeAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.typeAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.typeAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } return hashCode } -fun ProtoBuf.Constructor.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { +fun ProtoBuf.Constructor.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int, typeById: (Int) -> ProtoBuf.Type): Int { var hashCode = 1 if (hasFlags()) { @@ -2304,7 +2314,7 @@ fun ProtoBuf.Constructor.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (I } for(i in 0..valueParameterCount - 1) { - hashCode = 31 * hashCode + getValueParameter(i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getValueParameter(i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..versionRequirementCount - 1) { @@ -2312,11 +2322,11 @@ fun ProtoBuf.Constructor.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (I } if (hasExtension(JvmProtoBuf.constructorSignature)) { - hashCode = 31 * hashCode + getExtension(JvmProtoBuf.constructorSignature).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(JvmProtoBuf.constructorSignature).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..getExtensionCount(JsProtoBuf.constructorAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(JsProtoBuf.constructorAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(JsProtoBuf.constructorAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasExtension(JavaClassProtoBuf.isPackagePrivateConstructor)) { @@ -2324,21 +2334,21 @@ fun ProtoBuf.Constructor.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (I } for(i in 0..getExtensionCount(BuiltInsProtoBuf.constructorAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.constructorAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.constructorAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..getExtensionCount(KlibMetadataProtoBuf.constructorAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.constructorAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.constructorAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasExtension(KlibMetadataProtoBuf.constructorUniqId)) { - hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.constructorUniqId).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.constructorUniqId).hashCode(stringIndexes, fqNameIndexes, typeById) } return hashCode } -fun ProtoBuf.EnumEntry.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { +fun ProtoBuf.EnumEntry.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int, typeById: (Int) -> ProtoBuf.Type): Int { var hashCode = 1 if (hasName()) { @@ -2346,15 +2356,15 @@ fun ProtoBuf.EnumEntry.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int } for(i in 0..getExtensionCount(JsProtoBuf.enumEntryAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(JsProtoBuf.enumEntryAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(JsProtoBuf.enumEntryAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..getExtensionCount(BuiltInsProtoBuf.enumEntryAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.enumEntryAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.enumEntryAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..getExtensionCount(KlibMetadataProtoBuf.enumEntryAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.enumEntryAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.enumEntryAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasExtension(KlibMetadataProtoBuf.enumEntryOrdinal)) { @@ -2362,25 +2372,25 @@ fun ProtoBuf.EnumEntry.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int } if (hasExtension(KlibMetadataProtoBuf.enumEntryUniqId)) { - hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.enumEntryUniqId).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.enumEntryUniqId).hashCode(stringIndexes, fqNameIndexes, typeById) } return hashCode } -fun ProtoBuf.Annotation.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { +fun ProtoBuf.Annotation.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int, typeById: (Int) -> ProtoBuf.Type): Int { var hashCode = 1 hashCode = 31 * hashCode + fqNameIndexes(id) for(i in 0..argumentCount - 1) { - hashCode = 31 * hashCode + getArgument(i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getArgument(i).hashCode(stringIndexes, fqNameIndexes, typeById) } return hashCode } -fun KlibMetadataProtoBuf.DescriptorUniqId.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { +fun KlibMetadataProtoBuf.DescriptorUniqId.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int, typeById: (Int) -> ProtoBuf.Type): Int { var hashCode = 1 hashCode = 31 * hashCode + index.hashCode() @@ -2388,7 +2398,7 @@ fun KlibMetadataProtoBuf.DescriptorUniqId.hashCode(stringIndexes: (Int) -> Int, return hashCode } -fun ProtoBuf.ValueParameter.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { +fun ProtoBuf.ValueParameter.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int, typeById: (Int) -> ProtoBuf.Type): Int { var hashCode = 1 if (hasFlags()) { @@ -2398,47 +2408,47 @@ fun ProtoBuf.ValueParameter.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: hashCode = 31 * hashCode + stringIndexes(name) if (hasType()) { - hashCode = 31 * hashCode + type.hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + type.hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasTypeId()) { - hashCode = 31 * hashCode + typeId + hashCode = 31 * hashCode + typeById(typeId).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasVarargElementType()) { - hashCode = 31 * hashCode + varargElementType.hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + varargElementType.hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasVarargElementTypeId()) { - hashCode = 31 * hashCode + varargElementTypeId + hashCode = 31 * hashCode + typeById(varargElementTypeId).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..getExtensionCount(JsProtoBuf.parameterAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(JsProtoBuf.parameterAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(JsProtoBuf.parameterAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..getExtensionCount(BuiltInsProtoBuf.parameterAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.parameterAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.parameterAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..getExtensionCount(KlibMetadataProtoBuf.parameterAnnotation) - 1) { - hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.parameterAnnotation, i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getExtension(KlibMetadataProtoBuf.parameterAnnotation, i).hashCode(stringIndexes, fqNameIndexes, typeById) } return hashCode } -fun ProtoBuf.Contract.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { +fun ProtoBuf.Contract.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int, typeById: (Int) -> ProtoBuf.Type): Int { var hashCode = 1 for(i in 0..effectCount - 1) { - hashCode = 31 * hashCode + getEffect(i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getEffect(i).hashCode(stringIndexes, fqNameIndexes, typeById) } return hashCode } -fun JvmProtoBuf.JvmMethodSignature.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { +fun JvmProtoBuf.JvmMethodSignature.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int, typeById: (Int) -> ProtoBuf.Type): Int { var hashCode = 1 if (hasName()) { @@ -2452,29 +2462,29 @@ fun JvmProtoBuf.JvmMethodSignature.hashCode(stringIndexes: (Int) -> Int, fqNameI return hashCode } -fun JvmProtoBuf.JvmPropertySignature.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { +fun JvmProtoBuf.JvmPropertySignature.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int, typeById: (Int) -> ProtoBuf.Type): Int { var hashCode = 1 if (hasField()) { - hashCode = 31 * hashCode + field.hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + field.hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasSyntheticMethod()) { - hashCode = 31 * hashCode + syntheticMethod.hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + syntheticMethod.hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasGetter()) { - hashCode = 31 * hashCode + getter.hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getter.hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasSetter()) { - hashCode = 31 * hashCode + setter.hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + setter.hashCode(stringIndexes, fqNameIndexes, typeById) } return hashCode } -fun ProtoBuf.Annotation.Argument.Value.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { +fun ProtoBuf.Annotation.Argument.Value.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int, typeById: (Int) -> ProtoBuf.Type): Int { var hashCode = 1 if (hasType()) { @@ -2506,11 +2516,11 @@ fun ProtoBuf.Annotation.Argument.Value.hashCode(stringIndexes: (Int) -> Int, fqN } if (hasAnnotation()) { - hashCode = 31 * hashCode + annotation.hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + annotation.hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..arrayElementCount - 1) { - hashCode = 31 * hashCode + getArrayElement(i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getArrayElement(i).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasArrayDimensionCount()) { @@ -2524,7 +2534,7 @@ fun ProtoBuf.Annotation.Argument.Value.hashCode(stringIndexes: (Int) -> Int, fqN return hashCode } -fun ProtoBuf.VersionRequirement.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { +fun ProtoBuf.VersionRequirement.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int, typeById: (Int) -> ProtoBuf.Type): Int { var hashCode = 1 if (hasVersion()) { @@ -2554,7 +2564,7 @@ fun ProtoBuf.VersionRequirement.hashCode(stringIndexes: (Int) -> Int, fqNameInde return hashCode } -fun ProtoBuf.Type.Argument.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { +fun ProtoBuf.Type.Argument.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int, typeById: (Int) -> ProtoBuf.Type): Int { var hashCode = 1 if (hasProjection()) { @@ -2562,27 +2572,27 @@ fun ProtoBuf.Type.Argument.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: } if (hasType()) { - hashCode = 31 * hashCode + type.hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + type.hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasTypeId()) { - hashCode = 31 * hashCode + typeId + hashCode = 31 * hashCode + typeById(typeId).hashCode(stringIndexes, fqNameIndexes, typeById) } return hashCode } -fun ProtoBuf.Annotation.Argument.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { +fun ProtoBuf.Annotation.Argument.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int, typeById: (Int) -> ProtoBuf.Type): Int { var hashCode = 1 hashCode = 31 * hashCode + stringIndexes(nameId) - hashCode = 31 * hashCode + value.hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + value.hashCode(stringIndexes, fqNameIndexes, typeById) return hashCode } -fun ProtoBuf.Effect.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { +fun ProtoBuf.Effect.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int, typeById: (Int) -> ProtoBuf.Type): Int { var hashCode = 1 if (hasEffectType()) { @@ -2590,11 +2600,11 @@ fun ProtoBuf.Effect.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) - } for(i in 0..effectConstructorArgumentCount - 1) { - hashCode = 31 * hashCode + getEffectConstructorArgument(i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getEffectConstructorArgument(i).hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasConclusionOfConditionalEffect()) { - hashCode = 31 * hashCode + conclusionOfConditionalEffect.hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + conclusionOfConditionalEffect.hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasKind()) { @@ -2604,7 +2614,7 @@ fun ProtoBuf.Effect.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) - return hashCode } -fun JvmProtoBuf.JvmFieldSignature.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { +fun JvmProtoBuf.JvmFieldSignature.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int, typeById: (Int) -> ProtoBuf.Type): Int { var hashCode = 1 if (hasName()) { @@ -2618,7 +2628,7 @@ fun JvmProtoBuf.JvmFieldSignature.hashCode(stringIndexes: (Int) -> Int, fqNameIn return hashCode } -fun ProtoBuf.Expression.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { +fun ProtoBuf.Expression.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int, typeById: (Int) -> ProtoBuf.Type): Int { var hashCode = 1 if (hasFlags()) { @@ -2634,19 +2644,19 @@ fun ProtoBuf.Expression.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (In } if (hasIsInstanceType()) { - hashCode = 31 * hashCode + isInstanceType.hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + isInstanceType.hashCode(stringIndexes, fqNameIndexes, typeById) } if (hasIsInstanceTypeId()) { - hashCode = 31 * hashCode + isInstanceTypeId + hashCode = 31 * hashCode + typeById(isInstanceTypeId).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..andArgumentCount - 1) { - hashCode = 31 * hashCode + getAndArgument(i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getAndArgument(i).hashCode(stringIndexes, fqNameIndexes, typeById) } for(i in 0..orArgumentCount - 1) { - hashCode = 31 * hashCode + getOrArgument(i).hashCode(stringIndexes, fqNameIndexes) + hashCode = 31 * hashCode + getOrArgument(i).hashCode(stringIndexes, fqNameIndexes, typeById) } return hashCode diff --git a/build-common/src/org/jetbrains/kotlin/incremental/protoDifferenceUtils.kt b/build-common/src/org/jetbrains/kotlin/incremental/protoDifferenceUtils.kt index 2e775a3bfd4..13951ced78d 100644 --- a/build-common/src/org/jetbrains/kotlin/incremental/protoDifferenceUtils.kt +++ b/build-common/src/org/jetbrains/kotlin/incremental/protoDifferenceUtils.kt @@ -82,9 +82,21 @@ abstract class DifferenceCalculator { val result = hashSetOf() val oldMap = - oldList.groupBy { it.getHashCode({ compareObject.oldGetIndexOfString(it) }, { compareObject.oldGetIndexOfClassId(it) }) } + oldList.groupBy { + it.getHashCode( + compareObject::oldGetIndexOfString, + compareObject::oldGetIndexOfClassId, + compareObject::oldGetTypeById + ) + } val newMap = - newList.groupBy { it.getHashCode({ compareObject.newGetIndexOfString(it) }, { compareObject.newGetIndexOfClassId(it) }) } + newList.groupBy { + it.getHashCode( + compareObject::newGetIndexOfString, + compareObject::newGetIndexOfClassId, + compareObject::newGetTypeById + ) + } val hashes = oldMap.keys + newMap.keys for (hash in hashes) { @@ -134,12 +146,12 @@ abstract class DifferenceCalculator { return oldNames.union(newNames) - oldNames.intersect(newNames) } - private fun MessageLite.getHashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int { + private fun MessageLite.getHashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int, typeTable: (Int) -> ProtoBuf.Type): Int { return when (this) { - is ProtoBuf.Constructor -> hashCode(stringIndexes, fqNameIndexes) - is ProtoBuf.Function -> hashCode(stringIndexes, fqNameIndexes) - is ProtoBuf.Property -> hashCode(stringIndexes, fqNameIndexes) - is ProtoBuf.TypeAlias -> hashCode(stringIndexes, fqNameIndexes) + is ProtoBuf.Constructor -> hashCode(stringIndexes, fqNameIndexes, typeTable) + is ProtoBuf.Function -> hashCode(stringIndexes, fqNameIndexes, typeTable) + is ProtoBuf.Property -> hashCode(stringIndexes, fqNameIndexes, typeTable) + is ProtoBuf.TypeAlias -> hashCode(stringIndexes, fqNameIndexes, typeTable) else -> error("Unknown message: $this") } } @@ -159,7 +171,12 @@ class DifferenceCalculatorForClass( private val oldData: ClassProtoData, private val newData: ClassProtoData ) : DifferenceCalculator() { - override val compareObject = ProtoCompareGenerated(oldData.nameResolver, newData.nameResolver) + override val compareObject = ProtoCompareGenerated( + oldNameResolver = oldData.nameResolver, + newNameResolver = newData.nameResolver, + oldTypeTable = oldData.proto.typeTableOrNull, + newTypeTable = newData.proto.typeTableOrNull + ) override fun difference(): Difference { val (oldProto, oldNameResolver) = oldData @@ -273,7 +290,12 @@ class DifferenceCalculatorForPackageFacade( private val oldData: PackagePartProtoData, private val newData: PackagePartProtoData ) : DifferenceCalculator() { - override val compareObject = ProtoCompareGenerated(oldData.nameResolver, newData.nameResolver) + override val compareObject = ProtoCompareGenerated( + oldNameResolver = oldData.nameResolver, + newNameResolver = newData.nameResolver, + oldTypeTable = oldData.proto.typeTableOrNull, + newTypeTable = newData.proto.typeTableOrNull + ) override fun difference(): Difference { val oldProto = oldData.proto @@ -322,3 +344,9 @@ class DifferenceCalculatorForPackageFacade( private val ProtoBuf.Class.isSealed: Boolean get() = ProtoBuf.Modality.SEALED == Flags.MODALITY.get(flags) + +val ProtoBuf.Class.typeTableOrNull: ProtoBuf.TypeTable? + get() = if (hasTypeTable()) typeTable else null + +val ProtoBuf.Package.typeTableOrNull: ProtoBuf.TypeTable? + get() = if (hasTypeTable()) typeTable else null \ No newline at end of file diff --git a/build-common/test/org/jetbrains/kotlin/metadata/DebugExtOptionsProtoBuf.java b/build-common/test/org/jetbrains/kotlin/metadata/DebugExtOptionsProtoBuf.java index 41630e35a41..7053af7a5d7 100644 --- a/build-common/test/org/jetbrains/kotlin/metadata/DebugExtOptionsProtoBuf.java +++ b/build-common/test/org/jetbrains/kotlin/metadata/DebugExtOptionsProtoBuf.java @@ -11,6 +11,7 @@ public final class DebugExtOptionsProtoBuf { registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable); registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.fqNameIdInTable); registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.stringIdInTable); + registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable); } public static final int SKIP_IN_COMPARISON_FIELD_NUMBER = 50000; /** @@ -56,6 +57,17 @@ public final class DebugExtOptionsProtoBuf { .newFileScopedGeneratedExtension( java.lang.Boolean.class, null); + public static final int TYPE_ID_IN_TABLE_FIELD_NUMBER = 50004; + /** + * extend .google.protobuf.FieldOptions { ... } + */ + public static final + org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension< + org.jetbrains.kotlin.protobuf.DescriptorProtos.FieldOptions, + java.lang.Boolean> typeIdInTable = org.jetbrains.kotlin.protobuf.GeneratedMessage + .newFileScopedGeneratedExtension( + java.lang.Boolean.class, + null); public static org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor getDescriptor() { @@ -73,8 +85,9 @@ public final class DebugExtOptionsProtoBuf { "rotobuf.FieldOptions\030\321\206\003 \001(\010:<\n\023fq_name_" + "id_in_table\022\035.google.protobuf.FieldOptio" + "ns\030\322\206\003 \001(\010:;\n\022string_id_in_table\022\035.googl" + - "e.protobuf.FieldOptions\030\323\206\003 \001(\010B\031B\027Debug" + - "ExtOptionsProtoBuf" + "e.protobuf.FieldOptions\030\323\206\003 \001(\010:9\n\020type_" + + "id_in_table\022\035.google.protobuf.FieldOptio", + "ns\030\324\206\003 \001(\010B\031B\027DebugExtOptionsProtoBuf" }; org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { @@ -93,6 +106,7 @@ public final class DebugExtOptionsProtoBuf { nameIdInTable.internalInit(descriptor.getExtensions().get(1)); fqNameIdInTable.internalInit(descriptor.getExtensions().get(2)); stringIdInTable.internalInit(descriptor.getExtensions().get(3)); + typeIdInTable.internalInit(descriptor.getExtensions().get(4)); org.jetbrains.kotlin.protobuf.DescriptorProtos.getDescriptor(); } diff --git a/build-common/test/org/jetbrains/kotlin/metadata/DebugProtoBuf.java b/build-common/test/org/jetbrains/kotlin/metadata/DebugProtoBuf.java index 390053af263..1ce356c1108 100644 --- a/build-common/test/org/jetbrains/kotlin/metadata/DebugProtoBuf.java +++ b/build-common/test/org/jetbrains/kotlin/metadata/DebugProtoBuf.java @@ -34331,115 +34331,117 @@ public final class DebugProtoBuf { "E\020\000\022\010\n\004CHAR\020\001\022\t\n\005SHORT\020\002\022\007\n\003INT\020\003\022\010\n\004LON" + "G\020\004\022\t\n\005FLOAT\020\005\022\n\n\006DOUBLE\020\006\022\013\n\007BOOLEAN\020\007\022", "\n\n\006STRING\020\010\022\t\n\005CLASS\020\t\022\010\n\004ENUM\020\n\022\016\n\nANNO" + - "TATION\020\013\022\t\n\005ARRAY\020\014\"\373\005\n\004Type\022>\n\010argument" + + "TATION\020\013\022\t\n\005ARRAY\020\014\"\223\006\n\004Type\022>\n\010argument" + "\030\002 \003(\0132,.org.jetbrains.kotlin.metadata.T" + "ype.Argument\022\027\n\010nullable\030\003 \001(\010:\005false\022+\n" + "\035flexible_type_capabilities_id\030\004 \001(\005B\004\230\265" + "\030\001\022A\n\024flexible_upper_bound\030\005 \001(\0132#.org.j" + - "etbrains.kotlin.metadata.Type\022\037\n\027flexibl" + - "e_upper_bound_id\030\010 \001(\005\022\030\n\nclass_name\030\006 \001" + - "(\005B\004\220\265\030\001\022\026\n\016type_parameter\030\007 \001(\005\022!\n\023type" + - "_parameter_name\030\t \001(\005B\004\210\265\030\001\022\035\n\017type_alia", - "s_name\030\014 \001(\005B\004\220\265\030\001\0227\n\nouter_type\030\n \001(\0132#" + - ".org.jetbrains.kotlin.metadata.Type\022\025\n\ro" + - "uter_type_id\030\013 \001(\005\022=\n\020abbreviated_type\030\r" + + "etbrains.kotlin.metadata.Type\022%\n\027flexibl" + + "e_upper_bound_id\030\010 \001(\005B\004\240\265\030\001\022\030\n\nclass_na" + + "me\030\006 \001(\005B\004\220\265\030\001\022\026\n\016type_parameter\030\007 \001(\005\022!" + + "\n\023type_parameter_name\030\t \001(\005B\004\210\265\030\001\022\035\n\017typ", + "e_alias_name\030\014 \001(\005B\004\220\265\030\001\0227\n\nouter_type\030\n" + " \001(\0132#.org.jetbrains.kotlin.metadata.Typ" + - "e\022\033\n\023abbreviated_type_id\030\016 \001(\005\022\r\n\005flags\030" + - "\001 \001(\005\032\322\001\n\010Argument\022P\n\nprojection\030\001 \001(\01627" + - ".org.jetbrains.kotlin.metadata.Type.Argu" + - "ment.Projection:\003INV\0221\n\004type\030\002 \001(\0132#.org" + - ".jetbrains.kotlin.metadata.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\003INV\020\002\022\010\n\004STAR\020\003*\005\010d\020\310\001\"\230\002\n\rTypeParame" + - "ter\022\n\n\002id\030\001 \002(\005\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\022\026\n\007r" + - "eified\030\003 \001(\010:\005false\022L\n\010variance\030\004 \001(\01625." + - "org.jetbrains.kotlin.metadata.TypeParame" + - "ter.Variance:\003INV\0228\n\013upper_bound\030\005 \003(\0132#" + - ".org.jetbrains.kotlin.metadata.Type\022\032\n\016u" + - "pper_bound_id\030\006 \003(\005B\002\020\001\"$\n\010Variance\022\006\n\002I" + - "N\020\000\022\007\n\003OUT\020\001\022\007\n\003INV\020\002*\005\010d\020\350\007\"\244\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\022D\n\016", - "type_parameter\030\005 \003(\0132,.org.jetbrains.kot" + - "lin.metadata.TypeParameter\0226\n\tsupertype\030" + - "\006 \003(\0132#.org.jetbrains.kotlin.metadata.Ty" + - "pe\022\030\n\014supertype_id\030\002 \003(\005B\002\020\001\022!\n\021nested_c" + - "lass_name\030\007 \003(\005B\006\020\001\210\265\030\001\022?\n\013constructor\030\010" + - " \003(\0132*.org.jetbrains.kotlin.metadata.Con" + - "structor\0229\n\010function\030\t \003(\0132\'.org.jetbrai" + - "ns.kotlin.metadata.Function\0229\n\010property\030" + - "\n \003(\0132\'.org.jetbrains.kotlin.metadata.Pr" + - "operty\022<\n\ntype_alias\030\013 \003(\0132(.org.jetbrai", - "ns.kotlin.metadata.TypeAlias\022<\n\nenum_ent" + - "ry\030\r \003(\0132(.org.jetbrains.kotlin.metadata" + - ".EnumEntry\022\'\n\027sealed_subclass_fq_name\030\020 " + - "\003(\005B\006\020\001\220\265\030\001\022<\n\ntype_table\030\036 \001(\0132(.org.je" + - "tbrains.kotlin.metadata.TypeTable\022\033\n\023ver" + - "sion_requirement\030\037 \003(\005\022Y\n\031version_requir" + - "ement_table\030 \001(\01326.org.jetbrains.kotlin" + - ".metadata.VersionRequirementTable\"x\n\004Kin" + - "d\022\t\n\005CLASS\020\000\022\r\n\tINTERFACE\020\001\022\016\n\nENUM_CLAS" + - "S\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*\006\010d\020" + - "\270\224\001\"\335\002\n\007Package\0229\n\010function\030\003 \003(\0132\'.org." + - "jetbrains.kotlin.metadata.Function\0229\n\010pr" + - "operty\030\004 \003(\0132\'.org.jetbrains.kotlin.meta" + - "data.Property\022<\n\ntype_alias\030\005 \003(\0132(.org." + - "jetbrains.kotlin.metadata.TypeAlias\022<\n\nt" + - "ype_table\030\036 \001(\0132(.org.jetbrains.kotlin.m" + - "etadata.TypeTable\022Y\n\031version_requirement" + - "_table\030 \001(\01326.org.jetbrains.kotlin.meta" + - "data.VersionRequirementTable*\005\010d\020\310\001\"Z\n\tT", - "ypeTable\0221\n\004type\030\001 \003(\0132#.org.jetbrains.k" + - "otlin.metadata.Type\022\032\n\016first_nullable\030\002 " + - "\001(\005:\002-1\"\214\001\n\013Constructor\022\020\n\005flags\030\001 \001(\005:\001" + - "6\022F\n\017value_parameter\030\002 \003(\0132-.org.jetbrai" + - "ns.kotlin.metadata.ValueParameter\022\033\n\023ver" + - "sion_requirement\030\037 \003(\005*\006\010d\020\270\224\001\"\232\004\n\010Funct" + - "ion\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\0228\n\013return_type\030\003" + - " \001(\0132#.org.jetbrains.kotlin.metadata.Typ" + - "e\022\026\n\016return_type_id\030\007 \001(\005\022D\n\016type_parame", - "ter\030\004 \003(\0132,.org.jetbrains.kotlin.metadat" + - "a.TypeParameter\022:\n\rreceiver_type\030\005 \001(\0132#" + - ".org.jetbrains.kotlin.metadata.Type\022\030\n\020r" + - "eceiver_type_id\030\010 \001(\005\022F\n\017value_parameter" + - "\030\006 \003(\0132-.org.jetbrains.kotlin.metadata.V" + - "alueParameter\022<\n\ntype_table\030\036 \001(\0132(.org." + - "jetbrains.kotlin.metadata.TypeTable\022\033\n\023v" + - "ersion_requirement\030\037 \003(\005\0229\n\010contract\030 \001" + - "(\0132\'.org.jetbrains.kotlin.metadata.Contr" + - "act*\006\010d\020\270\224\001\"\331\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\004name\030\002 " + - "\002(\005B\004\210\265\030\001\0228\n\013return_type\030\003 \001(\0132#.org.jet" + - "brains.kotlin.metadata.Type\022\026\n\016return_ty" + - "pe_id\030\t \001(\005\022D\n\016type_parameter\030\004 \003(\0132,.or" + - "g.jetbrains.kotlin.metadata.TypeParamete" + - "r\022:\n\rreceiver_type\030\005 \001(\0132#.org.jetbrains" + - ".kotlin.metadata.Type\022\030\n\020receiver_type_i" + - "d\030\n \001(\005\022M\n\026setter_value_parameter\030\006 \001(\0132" + - "-.org.jetbrains.kotlin.metadata.ValuePar" + - "ameter\022\024\n\014getter_flags\030\007 \001(\005\022\024\n\014setter_f", - "lags\030\010 \001(\005\022\033\n\023version_requirement\030\037 \003(\005*" + - "\006\010d\020\270\224\001\"\343\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\0221\n\004type\030\003 \001(\0132#" + - ".org.jetbrains.kotlin.metadata.Type\022\017\n\007t" + - "ype_id\030\005 \001(\005\022@\n\023vararg_element_type\030\004 \001(" + - "\0132#.org.jetbrains.kotlin.metadata.Type\022\036" + - "\n\026vararg_element_type_id\030\006 \001(\005*\005\010d\020\310\001\"\212\003" + - "\n\tTypeAlias\022\020\n\005flags\030\001 \001(\005:\0016\022\022\n\004name\030\002 " + - "\002(\005B\004\210\265\030\001\022D\n\016type_parameter\030\003 \003(\0132,.org." + - "jetbrains.kotlin.metadata.TypeParameter\022", - "<\n\017underlying_type\030\004 \001(\0132#.org.jetbrains" + - ".kotlin.metadata.Type\022\032\n\022underlying_type" + - "_id\030\005 \001(\005\022:\n\rexpanded_type\030\006 \001(\0132#.org.j" + - "etbrains.kotlin.metadata.Type\022\030\n\020expande" + - "d_type_id\030\007 \001(\005\022=\n\nannotation\030\010 \003(\0132).or" + + "e\022\033\n\router_type_id\030\013 \001(\005B\004\240\265\030\001\022=\n\020abbrev" + + "iated_type\030\r \001(\0132#.org.jetbrains.kotlin." + + "metadata.Type\022!\n\023abbreviated_type_id\030\016 \001" + + "(\005B\004\240\265\030\001\022\r\n\005flags\030\001 \001(\005\032\330\001\n\010Argument\022P\n\n" + + "projection\030\001 \001(\01627.org.jetbrains.kotlin." + + "metadata.Type.Argument.Projection:\003INV\0221" + + "\n\004type\030\002 \001(\0132#.org.jetbrains.kotlin.meta" + + "data.Type\022\025\n\007type_id\030\003 \001(\005B\004\240\265\030\001\"0\n\nProj", + "ection\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\"\234\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\007reified\030\003 \001(\010:\005fa" + + "lse\022L\n\010variance\030\004 \001(\01625.org.jetbrains.ko" + + "tlin.metadata.TypeParameter.Variance:\003IN" + + "V\0228\n\013upper_bound\030\005 \003(\0132#.org.jetbrains.k" + + "otlin.metadata.Type\022\036\n\016upper_bound_id\030\006 " + + "\003(\005B\006\020\001\240\265\030\001\"$\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\"\250\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\022D\n\016type_paramet" + + "er\030\005 \003(\0132,.org.jetbrains.kotlin.metadata" + + ".TypeParameter\0226\n\tsupertype\030\006 \003(\0132#.org." + + "jetbrains.kotlin.metadata.Type\022\034\n\014supert" + + "ype_id\030\002 \003(\005B\006\020\001\240\265\030\001\022!\n\021nested_class_nam" + + "e\030\007 \003(\005B\006\020\001\210\265\030\001\022?\n\013constructor\030\010 \003(\0132*.o" + + "rg.jetbrains.kotlin.metadata.Constructor" + + "\0229\n\010function\030\t \003(\0132\'.org.jetbrains.kotli" + + "n.metadata.Function\0229\n\010property\030\n \003(\0132\'." + + "org.jetbrains.kotlin.metadata.Property\022<", + "\n\ntype_alias\030\013 \003(\0132(.org.jetbrains.kotli" + + "n.metadata.TypeAlias\022<\n\nenum_entry\030\r \003(\013" + + "2(.org.jetbrains.kotlin.metadata.EnumEnt" + + "ry\022\'\n\027sealed_subclass_fq_name\030\020 \003(\005B\006\020\001\220" + + "\265\030\001\022<\n\ntype_table\030\036 \001(\0132(.org.jetbrains." + + "kotlin.metadata.TypeTable\022\033\n\023version_req" + + "uirement\030\037 \003(\005\022Y\n\031version_requirement_ta" + + "ble\030 \001(\01326.org.jetbrains.kotlin.metadat" + + "a.VersionRequirementTable\"x\n\004Kind\022\t\n\005CLA" + + "SS\020\000\022\r\n\tINTERFACE\020\001\022\016\n\nENUM_CLASS\020\002\022\016\n\nE", + "NUM_ENTRY\020\003\022\024\n\020ANNOTATION_CLASS\020\004\022\n\n\006OBJ" + + "ECT\020\005\022\024\n\020COMPANION_OBJECT\020\006*\006\010d\020\270\224\001\"\335\002\n\007" + + "Package\0229\n\010function\030\003 \003(\0132\'.org.jetbrain" + + "s.kotlin.metadata.Function\0229\n\010property\030\004" + + " \003(\0132\'.org.jetbrains.kotlin.metadata.Pro" + + "perty\022<\n\ntype_alias\030\005 \003(\0132(.org.jetbrain" + + "s.kotlin.metadata.TypeAlias\022<\n\ntype_tabl" + + "e\030\036 \001(\0132(.org.jetbrains.kotlin.metadata." + + "TypeTable\022Y\n\031version_requirement_table\030 " + + " \001(\01326.org.jetbrains.kotlin.metadata.Ver", + "sionRequirementTable*\005\010d\020\310\001\"Z\n\tTypeTable" + + "\0221\n\004type\030\001 \003(\0132#.org.jetbrains.kotlin.me" + + "tadata.Type\022\032\n\016first_nullable\030\002 \001(\005:\002-1\"" + + "\214\001\n\013Constructor\022\020\n\005flags\030\001 \001(\005:\0016\022F\n\017val" + + "ue_parameter\030\002 \003(\0132-.org.jetbrains.kotli" + + "n.metadata.ValueParameter\022\033\n\023version_req" + + "uirement\030\037 \003(\005*\006\010d\020\270\224\001\"\246\004\n\010Function\022\020\n\005f" + + "lags\030\t \001(\005:\0016\022\024\n\told_flags\030\001 \001(\005:\0016\022\022\n\004n" + + "ame\030\002 \002(\005B\004\210\265\030\001\0228\n\013return_type\030\003 \001(\0132#.o" + + "rg.jetbrains.kotlin.metadata.Type\022\034\n\016ret", + "urn_type_id\030\007 \001(\005B\004\240\265\030\001\022D\n\016type_paramete" + + "r\030\004 \003(\0132,.org.jetbrains.kotlin.metadata." + + "TypeParameter\022:\n\rreceiver_type\030\005 \001(\0132#.o" + + "rg.jetbrains.kotlin.metadata.Type\022\036\n\020rec" + + "eiver_type_id\030\010 \001(\005B\004\240\265\030\001\022F\n\017value_param" + + "eter\030\006 \003(\0132-.org.jetbrains.kotlin.metada" + + "ta.ValueParameter\022<\n\ntype_table\030\036 \001(\0132(." + + "org.jetbrains.kotlin.metadata.TypeTable\022" + + "\033\n\023version_requirement\030\037 \003(\005\0229\n\010contract" + + "\030 \001(\0132\'.org.jetbrains.kotlin.metadata.C", + "ontract*\006\010d\020\270\224\001\"\345\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\004nam" + + "e\030\002 \002(\005B\004\210\265\030\001\0228\n\013return_type\030\003 \001(\0132#.org" + + ".jetbrains.kotlin.metadata.Type\022\034\n\016retur" + + "n_type_id\030\t \001(\005B\004\240\265\030\001\022D\n\016type_parameter\030" + + "\004 \003(\0132,.org.jetbrains.kotlin.metadata.Ty" + + "peParameter\022:\n\rreceiver_type\030\005 \001(\0132#.org" + + ".jetbrains.kotlin.metadata.Type\022\036\n\020recei" + + "ver_type_id\030\n \001(\005B\004\240\265\030\001\022M\n\026setter_value_" + + "parameter\030\006 \001(\0132-.org.jetbrains.kotlin.m", + "etadata.ValueParameter\022\024\n\014getter_flags\030\007" + + " \001(\005\022\024\n\014setter_flags\030\010 \001(\005\022\033\n\023version_re" + + "quirement\030\037 \003(\005*\006\010d\020\270\224\001\"\357\001\n\016ValueParamet" + + "er\022\020\n\005flags\030\001 \001(\005:\0010\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001" + + "\0221\n\004type\030\003 \001(\0132#.org.jetbrains.kotlin.me" + + "tadata.Type\022\025\n\007type_id\030\005 \001(\005B\004\240\265\030\001\022@\n\023va" + + "rarg_element_type\030\004 \001(\0132#.org.jetbrains." + + "kotlin.metadata.Type\022$\n\026vararg_element_t" + + "ype_id\030\006 \001(\005B\004\240\265\030\001*\005\010d\020\310\001\"\226\003\n\tTypeAlias\022" + + "\020\n\005flags\030\001 \001(\005:\0016\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\022D\n", + "\016type_parameter\030\003 \003(\0132,.org.jetbrains.ko" + + "tlin.metadata.TypeParameter\022<\n\017underlyin" + + "g_type\030\004 \001(\0132#.org.jetbrains.kotlin.meta" + + "data.Type\022 \n\022underlying_type_id\030\005 \001(\005B\004\240" + + "\265\030\001\022:\n\rexpanded_type\030\006 \001(\0132#.org.jetbrai" + + "ns.kotlin.metadata.Type\022\036\n\020expanded_type" + + "_id\030\007 \001(\005B\004\240\265\030\001\022=\n\nannotation\030\010 \003(\0132).or" + "g.jetbrains.kotlin.metadata.Annotation\022\033" + "\n\023version_requirement\030\037 \003(\005*\005\010d\020\310\001\"&\n\tEn" + - "umEntry\022\022\n\004name\030\001 \001(\005B\004\210\265\030\001*\005\010d\020\310\001\"\225\003\n\022V" + + "umEntry\022\022\n\004name\030\001 \001(\005B\004\210\265\030\001*\005\010d\020\310\001\"\225\003\n\022V", "ersionRequirement\022\017\n\007version\030\001 \001(\005\022\024\n\014ve" + - "rsion_full\030\002 \001(\005\022M\n\005level\030\003 \001(\01627.org.je", + "rsion_full\030\002 \001(\005\022M\n\005level\030\003 \001(\01627.org.je" + "tbrains.kotlin.metadata.VersionRequireme" + "nt.Level:\005ERROR\022\022\n\nerror_code\030\004 \001(\005\022\025\n\007m" + "essage\030\005 \001(\005B\004\230\265\030\001\022e\n\014version_kind\030\006 \001(\016" + @@ -34447,9 +34449,9 @@ public final class DebugProtoBuf { "Requirement.VersionKind:\020LANGUAGE_VERSIO" + "N\"+\n\005Level\022\013\n\007WARNING\020\000\022\t\n\005ERROR\020\001\022\n\n\006HI" + "DDEN\020\002\"J\n\013VersionKind\022\024\n\020LANGUAGE_VERSIO" + - "N\020\000\022\024\n\020COMPILER_VERSION\020\001\022\017\n\013API_VERSION" + + "N\020\000\022\024\n\020COMPILER_VERSION\020\001\022\017\n\013API_VERSION", "\020\002\"a\n\027VersionRequirementTable\022F\n\013require" + - "ment\030\001 \003(\01321.org.jetbrains.kotlin.metada", + "ment\030\001 \003(\01321.org.jetbrains.kotlin.metada" + "ta.VersionRequirement\"\217\002\n\017PackageFragmen" + "t\022;\n\007strings\030\001 \001(\0132*.org.jetbrains.kotli" + "n.metadata.StringTable\022J\n\017qualified_name" + @@ -34457,9 +34459,9 @@ public final class DebugProtoBuf { "QualifiedNameTable\0227\n\007package\030\003 \001(\0132&.or" + "g.jetbrains.kotlin.metadata.Package\0223\n\005c" + "lass\030\004 \003(\0132$.org.jetbrains.kotlin.metada" + - "ta.Class*\005\010d\020\310\001\"A\n\010Contract\0225\n\006effect\030\001 " + + "ta.Class*\005\010d\020\310\001\"A\n\010Contract\0225\n\006effect\030\001 ", "\003(\0132%.org.jetbrains.kotlin.metadata.Effe" + - "ct\"\306\003\n\006Effect\022E\n\013effect_type\030\001 \001(\01620.org", + "ct\"\306\003\n\006Effect\022E\n\013effect_type\030\001 \001(\01620.org" + ".jetbrains.kotlin.metadata.Effect.Effect" + "Type\022N\n\033effect_constructor_argument\030\002 \003(" + "\0132).org.jetbrains.kotlin.metadata.Expres" + @@ -34467,27 +34469,27 @@ public final class DebugProtoBuf { "\030\003 \001(\0132).org.jetbrains.kotlin.metadata.E" + "xpression\022B\n\004kind\030\004 \001(\01624.org.jetbrains." + "kotlin.metadata.Effect.InvocationKind\"C\n" + - "\nEffectType\022\024\n\020RETURNS_CONSTANT\020\000\022\t\n\005CAL" + + "\nEffectType\022\024\n\020RETURNS_CONSTANT\020\000\022\t\n\005CAL", "LS\020\001\022\024\n\020RETURNS_NOT_NULL\020\002\"G\n\016Invocation" + - "Kind\022\020\n\014AT_MOST_ONCE\020\000\022\020\n\014EXACTLY_ONCE\020\001", - "\022\021\n\rAT_LEAST_ONCE\020\002\"\237\003\n\nExpression\022\020\n\005fl" + + "Kind\022\020\n\014AT_MOST_ONCE\020\000\022\020\n\014EXACTLY_ONCE\020\001" + + "\022\021\n\rAT_LEAST_ONCE\020\002\"\245\003\n\nExpression\022\020\n\005fl" + "ags\030\001 \001(\005:\0010\022!\n\031value_parameter_referenc" + "e\030\002 \001(\005\022O\n\016constant_value\030\003 \001(\01627.org.je" + "tbrains.kotlin.metadata.Expression.Const" + "antValue\022=\n\020is_instance_type\030\004 \001(\0132#.org" + - ".jetbrains.kotlin.metadata.Type\022\033\n\023is_in" + - "stance_type_id\030\005 \001(\005\022?\n\014and_argument\030\006 \003" + - "(\0132).org.jetbrains.kotlin.metadata.Expre" + - "ssion\022>\n\013or_argument\030\007 \003(\0132).org.jetbrai" + - "ns.kotlin.metadata.Expression\".\n\rConstan", - "tValue\022\010\n\004TRUE\020\000\022\t\n\005FALSE\020\001\022\010\n\004NULL\020\002*9\n" + - "\010Modality\022\t\n\005FINAL\020\000\022\010\n\004OPEN\020\001\022\014\n\010ABSTRA" + - "CT\020\002\022\n\n\006SEALED\020\003*b\n\nVisibility\022\014\n\010INTERN" + - "AL\020\000\022\013\n\007PRIVATE\020\001\022\r\n\tPROTECTED\020\002\022\n\n\006PUBL" + - "IC\020\003\022\023\n\017PRIVATE_TO_THIS\020\004\022\t\n\005LOCAL\020\005*Q\n\n" + - "MemberKind\022\017\n\013DECLARATION\020\000\022\021\n\rFAKE_OVER" + - "RIDE\020\001\022\016\n\nDELEGATION\020\002\022\017\n\013SYNTHESIZED\020\003B" + - "\017B\rDebugProtoBuf" + ".jetbrains.kotlin.metadata.Type\022!\n\023is_in" + + "stance_type_id\030\005 \001(\005B\004\240\265\030\001\022?\n\014and_argume" + + "nt\030\006 \003(\0132).org.jetbrains.kotlin.metadata", + ".Expression\022>\n\013or_argument\030\007 \003(\0132).org.j" + + "etbrains.kotlin.metadata.Expression\".\n\rC" + + "onstantValue\022\010\n\004TRUE\020\000\022\t\n\005FALSE\020\001\022\010\n\004NUL" + + "L\020\002*9\n\010Modality\022\t\n\005FINAL\020\000\022\010\n\004OPEN\020\001\022\014\n\010" + + "ABSTRACT\020\002\022\n\n\006SEALED\020\003*b\n\nVisibility\022\014\n\010" + + "INTERNAL\020\000\022\013\n\007PRIVATE\020\001\022\r\n\tPROTECTED\020\002\022\n" + + "\n\006PUBLIC\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\rFAK" + + "E_OVERRIDE\020\001\022\016\n\nDELEGATION\020\002\022\017\n\013SYNTHESI" + + "ZED\020\003B\017B\rDebugProtoBuf" }; org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { @@ -34654,20 +34656,35 @@ public final class DebugProtoBuf { registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.fqNameIdInTable); registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable); registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.stringIdInTable); + registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable); registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.fqNameIdInTable); registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable); registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.fqNameIdInTable); + registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable); + registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable); + registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable); + registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable); + registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable); + registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.fqNameIdInTable); + registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable); + registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable); registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable); registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.fqNameIdInTable); registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable); + registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable); + registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable); registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable); - registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.fqNameIdInTable); - registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable); - registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable); + registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable); + registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable); registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable); + registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable); + registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable); registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable); + registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable); + registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable); registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable); registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.stringIdInTable); + registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable); org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor .internalUpdateFileDescriptor(descriptor, registry); org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.getDescriptor(); diff --git a/core/metadata/src/ext_options.proto b/core/metadata/src/ext_options.proto index ed55fef0f38..67082267b08 100644 --- a/core/metadata/src/ext_options.proto +++ b/core/metadata/src/ext_options.proto @@ -25,4 +25,5 @@ extend google.protobuf.FieldOptions { optional bool name_id_in_table = 50001; optional bool fq_name_id_in_table = 50002; optional bool string_id_in_table = 50003; + optional bool type_id_in_table = 50004; } diff --git a/core/metadata/src/metadata.proto b/core/metadata/src/metadata.proto index b51ea7f69fc..8020f8237df 100644 --- a/core/metadata/src/metadata.proto +++ b/core/metadata/src/metadata.proto @@ -123,7 +123,7 @@ message Type { // When projection is STAR, no type is written, otherwise type must be specified optional Type type = 2; - optional int32 type_id = 3; + optional int32 type_id = 3 [(type_id_in_table) = true]; } repeated Argument argument = 2; @@ -135,7 +135,7 @@ message Type { optional int32 flexible_type_capabilities_id = 4 [(string_id_in_table) = true]; optional Type flexible_upper_bound = 5; - optional int32 flexible_upper_bound_id = 8; + optional int32 flexible_upper_bound_id = 8 [(type_id_in_table) = true]; // Only one of [class_name, type_parameter, type_parameter_name, type_alias_name] should be present @@ -150,10 +150,10 @@ message Type { // Outer type may be present only if class_name or type_alias_name is present optional Type outer_type = 10; - optional int32 outer_type_id = 11; + optional int32 outer_type_id = 11 [(type_id_in_table) = true]; optional Type abbreviated_type = 13; - optional int32 abbreviated_type_id = 14; + optional int32 abbreviated_type_id = 14 [(type_id_in_table) = true]; /* suspend @@ -178,7 +178,7 @@ message TypeParameter { optional Variance variance = 4 [default = INV]; repeated Type upper_bound = 5; - repeated int32 upper_bound_id = 6 [packed = true]; + repeated int32 upper_bound_id = 6 [packed = true, (type_id_in_table) = true]; extensions 100 to 999; } @@ -215,7 +215,7 @@ message Class { repeated TypeParameter type_parameter = 5; repeated Type supertype = 6; - repeated int32 supertype_id = 2 [packed = true]; + repeated int32 supertype_id = 2 [packed = true, (type_id_in_table) = true]; repeated int32 nested_class_name = 7 [packed = true, (name_id_in_table) = true]; @@ -294,12 +294,12 @@ message Function { required int32 name = 2 [(name_id_in_table) = true]; optional Type return_type = 3; - optional int32 return_type_id = 7; + optional int32 return_type_id = 7 [(type_id_in_table) = true]; repeated TypeParameter type_parameter = 4; optional Type receiver_type = 5; - optional int32 receiver_type_id = 8; + optional int32 receiver_type_id = 8 [(type_id_in_table) = true]; repeated ValueParameter value_parameter = 6; @@ -335,12 +335,12 @@ message Property { required int32 name = 2 [(name_id_in_table) = true]; optional Type return_type = 3; - optional int32 return_type_id = 9; + optional int32 return_type_id = 9 [(type_id_in_table) = true]; repeated TypeParameter type_parameter = 4; optional Type receiver_type = 5; - optional int32 receiver_type_id = 10; + optional int32 receiver_type_id = 10 [(type_id_in_table) = true]; optional ValueParameter setter_value_parameter = 6; @@ -377,10 +377,10 @@ message ValueParameter { required int32 name = 2 [(name_id_in_table) = true]; optional Type type = 3; - optional int32 type_id = 5; + optional int32 type_id = 5 [(type_id_in_table) = true]; optional Type vararg_element_type = 4; - optional int32 vararg_element_type_id = 6; + optional int32 vararg_element_type_id = 6 [(type_id_in_table) = true]; extensions 100 to 199; } @@ -397,10 +397,10 @@ message TypeAlias { repeated TypeParameter type_parameter = 3; optional Type underlying_type = 4; - optional int32 underlying_type_id = 5; + optional int32 underlying_type_id = 5 [(type_id_in_table) = true]; optional Type expanded_type = 6; - optional int32 expanded_type_id = 7; + optional int32 expanded_type_id = 7 [(type_id_in_table) = true]; repeated Annotation annotation = 8; @@ -557,7 +557,7 @@ message Expression { // present => this expression is IsInstancePredicate, with 'variableName' as LHS // and with type encoded in either one of next two fields as RHS. optional Type is_instance_type = 4; - optional int32 is_instance_type_id = 5; + optional int32 is_instance_type_id = 5 [(type_id_in_table) = true]; // non-empty => this expression is boolean formula of form 'andArguments[0] && andArguments[1] && ...' // Additionally, if first argument of formula is primitive expression (i.e. predicate or value), diff --git a/generators/tests/org/jetbrains/kotlin/generators/protobuf/GenerateProtoBufCompare.kt b/generators/tests/org/jetbrains/kotlin/generators/protobuf/GenerateProtoBufCompare.kt index 3ba65d03596..9fdf66db9e3 100644 --- a/generators/tests/org/jetbrains/kotlin/generators/protobuf/GenerateProtoBufCompare.kt +++ b/generators/tests/org/jetbrains/kotlin/generators/protobuf/GenerateProtoBufCompare.kt @@ -119,7 +119,14 @@ class GenerateProtoBufCompare { p.println("/** This file is generated by org.jetbrains.kotlin.generators.protobuf.GenerateProtoBufCompare. DO NOT MODIFY MANUALLY */") p.println() - p.println("open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameResolver: NameResolver) {") + p.println("open class ProtoCompareGenerated(") + p.pushIndent() + p.println("val oldNameResolver: NameResolver,") + p.println("val newNameResolver: NameResolver,") + p.println("oldTypeTable: ProtoBuf.TypeTable?,") + p.println("newTypeTable: ProtoBuf.TypeTable?") + p.popIndent() + p.println(") {") p.pushIndent() p.println("private val strings = Interner()") @@ -127,6 +134,8 @@ class GenerateProtoBufCompare { p.println("val $NEW_PREFIX${STRING_INDEXES_NAME}Map: MutableMap = hashMapOf()") p.println("val $OLD_PREFIX${CLASS_ID_INDEXES_NAME}Map: MutableMap = hashMapOf()") p.println("val $NEW_PREFIX${CLASS_ID_INDEXES_NAME}Map: MutableMap = hashMapOf()") + p.println("val oldTypeTable: ProtoBuf.TypeTable = oldTypeTable ?: ProtoBuf.TypeTable.getDefaultInstance()") + p.println("val newTypeTable: ProtoBuf.TypeTable = newTypeTable ?: ProtoBuf.TypeTable.getDefaultInstance()") p.println() p.println("private val classIds = Interner()") @@ -162,6 +171,10 @@ class GenerateProtoBufCompare { } fun generateAuxiliaryMethods(p: Printer) { + p.println("fun oldGetTypeById(id: Int): ProtoBuf.Type = oldTypeTable.getType(id) ?: error(\"Unknown type id: ${'$'}id\")") + p.println("fun newGetTypeById(id: Int): ProtoBuf.Type = newTypeTable.getType(id) ?: error(\"Unknown type id: ${'$'}id\")") + p.println() + p.println("fun oldGetIndexOfString(index: Int): Int = getIndexOfString(index, oldStringIndexesMap, oldNameResolver)") p.println("fun newGetIndexOfString(index: Int): Int = getIndexOfString(index, newStringIndexesMap, newNameResolver)") p.println() @@ -206,7 +219,7 @@ class GenerateProtoBufCompare { val extFields = extensions[descriptor]?.filter { !it.isSkip } ?: emptyList() p.println() - p.println("fun $typeName.$HASH_CODE_NAME(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {") + p.println("fun $typeName.$HASH_CODE_NAME(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int, typeById: (Int) -> ProtoBuf.Type): Int {") p.pushIndent() p.println("var $HASH_CODE_NAME = 1") @@ -426,6 +439,8 @@ class GenerateProtoBufCompare { private fun ifWithComparison(field: Descriptors.FieldDescriptor, expr: String, statement: String) = when { + field.options.getExtension(DebugExtOptionsProtoBuf.typeIdInTable) -> + "if (!$CHECK_EQUALS_NAME(oldTypeTable.getType(old.$expr), newTypeTable.getType(new.$expr))) $statement" field.options.getExtension(DebugExtOptionsProtoBuf.stringIdInTable) || field.options.getExtension(DebugExtOptionsProtoBuf.nameIdInTable) -> "if (!$CHECK_STRING_EQUALS_NAME(old.$expr, new.$expr)) $statement" @@ -449,6 +464,8 @@ class GenerateProtoBufCompare { private fun fieldToHashCode(field: Descriptors.FieldDescriptor, expr: String): String = when { + field.options.getExtension(DebugExtOptionsProtoBuf.typeIdInTable) -> + "typeById($expr).$HASH_CODE_NAME(stringIndexes, fqNameIndexes, typeById)" field.options.getExtension(DebugExtOptionsProtoBuf.stringIdInTable) || field.options.getExtension(DebugExtOptionsProtoBuf.nameIdInTable) -> "stringIndexes($expr)" @@ -459,7 +476,7 @@ class GenerateProtoBufCompare { field.javaType in JAVA_TYPES_WITH_INLINED_EQUALS -> "$expr.$HASH_CODE_NAME()" else -> - "$expr.$HASH_CODE_NAME(stringIndexes, fqNameIndexes)" + "$expr.$HASH_CODE_NAME(stringIndexes, fqNameIndexes, typeById)" } private val Descriptors.Descriptor.typeName: String diff --git a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/incremental/AbstractProtoComparisonTest.kt b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/incremental/AbstractProtoComparisonTest.kt index 9e1c15e1268..4065354f67c 100644 --- a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/incremental/AbstractProtoComparisonTest.kt +++ b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/incremental/AbstractProtoComparisonTest.kt @@ -58,10 +58,20 @@ abstract class AbstractProtoComparisonTest : TestWithWorkingDir() { val rawProtoDifference = when { oldData is ClassProtoData && newData is ClassProtoData -> { - ProtoCompareGenerated(oldData.nameResolver, newData.nameResolver).difference(oldData.proto, newData.proto) + ProtoCompareGenerated( + oldNameResolver = oldData.nameResolver, + newNameResolver = newData.nameResolver, + oldTypeTable = oldData.proto.typeTableOrNull, + newTypeTable = newData.proto.typeTableOrNull + ).difference(oldData.proto, newData.proto) } oldData is PackagePartProtoData && newData is PackagePartProtoData -> { - ProtoCompareGenerated(oldData.nameResolver, newData.nameResolver).difference(oldData.proto, newData.proto) + ProtoCompareGenerated( + oldNameResolver = oldData.nameResolver, + newNameResolver = newData.nameResolver, + oldTypeTable = oldData.proto.typeTableOrNull, + newTypeTable = newData.proto.typeTableOrNull + ).difference(oldData.proto, newData.proto) } else -> null }