Store type parameter names sometimes instead of ids
This helps to reuse instances of types when TypeTable is enabled in cases when
a file or a class contains a lot of functions with type parameters with the
same name (like Maps.kt in the stdlib with "Map<K, V>")
Original commit: 4c21142648
This commit is contained in:
@@ -344,6 +344,11 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
|
||||
if (old.typeParameter != new.typeParameter) return false
|
||||
}
|
||||
|
||||
if (old.hasTypeParameterName() != new.hasTypeParameterName()) return false
|
||||
if (old.hasTypeParameterName()) {
|
||||
if (!checkStringEquals(old.typeParameterName, new.typeParameterName)) return false
|
||||
}
|
||||
|
||||
if (old.getExtensionCount(JvmProtoBuf.typeAnnotation) != new.getExtensionCount(JvmProtoBuf.typeAnnotation)) return false
|
||||
|
||||
for(i in 0..old.getExtensionCount(JvmProtoBuf.typeAnnotation) - 1) {
|
||||
@@ -1024,6 +1029,10 @@ public fun ProtoBuf.Type.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (I
|
||||
hashCode = 31 * hashCode + typeParameter
|
||||
}
|
||||
|
||||
if (hasTypeParameterName()) {
|
||||
hashCode = 31 * hashCode + stringIndexes(typeParameterName)
|
||||
}
|
||||
|
||||
for(i in 0..getExtensionCount(JvmProtoBuf.typeAnnotation) - 1) {
|
||||
hashCode = 31 * hashCode + getExtension(JvmProtoBuf.typeAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user