[IR] Fix undeterministic order in signature clash reporting
This commit is contained in:
+4
-4
@@ -22,8 +22,8 @@ class JvmSignatureClashDetector(
|
|||||||
private val type: Type,
|
private val type: Type,
|
||||||
private val context: JvmBackendContext
|
private val context: JvmBackendContext
|
||||||
) {
|
) {
|
||||||
private val methodsBySignature = HashMap<RawSignature, MutableSet<IrFunction>>()
|
private val methodsBySignature = LinkedHashMap<RawSignature, MutableSet<IrFunction>>()
|
||||||
private val fieldsBySignature = HashMap<RawSignature, MutableSet<IrField>>()
|
private val fieldsBySignature = LinkedHashMap<RawSignature, MutableSet<IrField>>()
|
||||||
|
|
||||||
fun trackField(irField: IrField, rawSignature: RawSignature) {
|
fun trackField(irField: IrField, rawSignature: RawSignature) {
|
||||||
fieldsBySignature.getOrPut(rawSignature) { SmartSet.create() }.add(irField)
|
fieldsBySignature.getOrPut(rawSignature) { SmartSet.create() }.add(irField)
|
||||||
@@ -49,7 +49,7 @@ class JvmSignatureClashDetector(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getOverriddenFunctions(irFunction: IrSimpleFunction): Set<IrFunction> {
|
private fun getOverriddenFunctions(irFunction: IrSimpleFunction): Set<IrFunction> {
|
||||||
val result = HashSet<IrFunction>()
|
val result = LinkedHashSet<IrFunction>()
|
||||||
collectOverridesOf(irFunction, result)
|
collectOverridesOf(irFunction, result)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
@@ -146,7 +146,7 @@ class JvmSignatureClashDetector(
|
|||||||
irDeclarations: Collection<IrDeclaration>,
|
irDeclarations: Collection<IrDeclaration>,
|
||||||
conflictingJvmDeclarationsData: ConflictingJvmDeclarationsData
|
conflictingJvmDeclarationsData: ConflictingJvmDeclarationsData
|
||||||
) {
|
) {
|
||||||
val psiElements = irDeclarations.mapNotNullTo(HashSet()) { it.getElementForDiagnostics() }
|
val psiElements = irDeclarations.mapNotNullTo(LinkedHashSet()) { it.getElementForDiagnostics() }
|
||||||
for (psiElement in psiElements) {
|
for (psiElement in psiElements) {
|
||||||
context.psiErrorBuilder.at(psiElement)
|
context.psiErrorBuilder.at(psiElement)
|
||||||
.report(diagnosticFactory1, conflictingJvmDeclarationsData)
|
.report(diagnosticFactory1, conflictingJvmDeclarationsData)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:1:7: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$cp()I):
|
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:1:7: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$p(LA;)I):
|
||||||
fun `access$getFoo$cp`(): Int defined in A
|
fun `access$getFoo$p`(`$this`: A): Int defined in A
|
||||||
fun `access$getFoo$cp`(): Int defined in A
|
fun `access$getFoo$p`(a: A): Int defined in A
|
||||||
class A {
|
class A {
|
||||||
^
|
^
|
||||||
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:1:7: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$p(LA;I)V):
|
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:1:7: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$p(LA;I)V):
|
||||||
@@ -8,16 +8,16 @@ compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:1:7: e
|
|||||||
fun `access$setFoo$p`(a: A, d: Int): Unit defined in A
|
fun `access$setFoo$p`(a: A, d: Int): Unit defined in A
|
||||||
class A {
|
class A {
|
||||||
^
|
^
|
||||||
|
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:1:7: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$cp()I):
|
||||||
|
fun `access$getFoo$cp`(): Int defined in A
|
||||||
|
fun `access$getFoo$cp`(): Int defined in A
|
||||||
|
class A {
|
||||||
|
^
|
||||||
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:1:7: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$cp(I)V):
|
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:1:7: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$cp(I)V):
|
||||||
fun `access$setFoo$cp`(`<set-?>`: Int): Unit defined in A
|
fun `access$setFoo$cp`(`<set-?>`: Int): Unit defined in A
|
||||||
fun `access$setFoo$cp`(d: Int): Unit defined in A
|
fun `access$setFoo$cp`(d: Int): Unit defined in A
|
||||||
class A {
|
class A {
|
||||||
^
|
^
|
||||||
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:1:7: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$p(LA;)I):
|
|
||||||
fun `access$getFoo$p`(`$this`: A): Int defined in A
|
|
||||||
fun `access$getFoo$p`(a: A): Int defined in A
|
|
||||||
class A {
|
|
||||||
^
|
|
||||||
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:5:5: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$p(LA;)I):
|
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:5:5: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$p(LA;)I):
|
||||||
fun `access$getFoo$p`(`$this`: A): Int defined in A
|
fun `access$getFoo$p`(`$this`: A): Int defined in A
|
||||||
fun `access$getFoo$p`(a: A): Int defined in A
|
fun `access$getFoo$p`(a: A): Int defined in A
|
||||||
|
|||||||
+10
-10
@@ -1,3 +1,13 @@
|
|||||||
|
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:1:7: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$p(LA;)I):
|
||||||
|
fun `access$getFoo$p`(`$this`: A): Int defined in A
|
||||||
|
fun `access$getFoo$p`(a: A): Int defined in A
|
||||||
|
class A {
|
||||||
|
^
|
||||||
|
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:1:7: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$p(LA;I)V):
|
||||||
|
fun `access$setFoo$p`(`$this`: A, `<set-?>`: Int): Unit defined in A
|
||||||
|
fun `access$setFoo$p`(a: A, d: Int): Unit defined in A
|
||||||
|
class A {
|
||||||
|
^
|
||||||
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:1:7: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo(LA;)I):
|
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:1:7: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo(LA;)I):
|
||||||
fun `access$getFoo`(`$this`: A): Int defined in A
|
fun `access$getFoo`(`$this`: A): Int defined in A
|
||||||
fun `access$getFoo`(a: A): Int defined in A
|
fun `access$getFoo`(a: A): Int defined in A
|
||||||
@@ -8,16 +18,6 @@ compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:1:7:
|
|||||||
fun `access$setFoo`(a: A, d: Int): Unit defined in A
|
fun `access$setFoo`(a: A, d: Int): Unit defined in A
|
||||||
class A {
|
class A {
|
||||||
^
|
^
|
||||||
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:1:7: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$p(LA;I)V):
|
|
||||||
fun `access$setFoo$p`(`$this`: A, `<set-?>`: Int): Unit defined in A
|
|
||||||
fun `access$setFoo$p`(a: A, d: Int): Unit defined in A
|
|
||||||
class A {
|
|
||||||
^
|
|
||||||
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:1:7: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$p(LA;)I):
|
|
||||||
fun `access$getFoo$p`(`$this`: A): Int defined in A
|
|
||||||
fun `access$getFoo$p`(a: A): Int defined in A
|
|
||||||
class A {
|
|
||||||
^
|
|
||||||
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:5:5: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$p(LA;)I):
|
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:5:5: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$p(LA;)I):
|
||||||
fun `access$getFoo$p`(`$this`: A): Int defined in A
|
fun `access$getFoo$p`(`$this`: A): Int defined in A
|
||||||
fun `access$getFoo$p`(a: A): Int defined in A
|
fun `access$getFoo$p`(a: A): Int defined in A
|
||||||
|
|||||||
+10
-10
@@ -3,6 +3,16 @@ compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:14:7: error: accide
|
|||||||
fun `access$foo`(`$this`: Derived): Unit defined in Derived
|
fun `access$foo`(`$this`: Derived): Unit defined in Derived
|
||||||
class Derived : Base() {
|
class Derived : Base() {
|
||||||
^
|
^
|
||||||
|
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:14:7: error: accidental override: The following declarations have the same JVM signature (access$getBar$p(LDerived;)I):
|
||||||
|
fun `access$getBar$p`(d: Derived): Int defined in Derived
|
||||||
|
fun `access$getBar$p`(`$this`: Derived): Int defined in Derived
|
||||||
|
class Derived : Base() {
|
||||||
|
^
|
||||||
|
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:14:7: error: accidental override: The following declarations have the same JVM signature (access$getBaz$p(LDerived;)I):
|
||||||
|
fun `access$getBaz$p`(d: Derived): Int defined in Derived
|
||||||
|
fun `access$getBaz$p`(`$this`: Derived): Int defined in Derived
|
||||||
|
class Derived : Base() {
|
||||||
|
^
|
||||||
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:14:7: error: accidental override: The following declarations have the same JVM signature (access$getBoo$p(LDerived;)I):
|
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:14:7: error: accidental override: The following declarations have the same JVM signature (access$getBoo$p(LDerived;)I):
|
||||||
fun `access$getBoo$p`(d: Derived): Int defined in Derived
|
fun `access$getBoo$p`(d: Derived): Int defined in Derived
|
||||||
fun `access$getBoo$p`(`$this`: Derived): Int defined in Derived
|
fun `access$getBoo$p`(`$this`: Derived): Int defined in Derived
|
||||||
@@ -13,19 +23,9 @@ compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:14:7: error: accide
|
|||||||
fun `access$setBar$p`(`$this`: Derived, `<set-?>`: Int): Unit defined in Derived
|
fun `access$setBar$p`(`$this`: Derived, `<set-?>`: Int): Unit defined in Derived
|
||||||
class Derived : Base() {
|
class Derived : Base() {
|
||||||
^
|
^
|
||||||
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:14:7: error: accidental override: The following declarations have the same JVM signature (access$getBar$p(LDerived;)I):
|
|
||||||
fun `access$getBar$p`(d: Derived): Int defined in Derived
|
|
||||||
fun `access$getBar$p`(`$this`: Derived): Int defined in Derived
|
|
||||||
class Derived : Base() {
|
|
||||||
^
|
|
||||||
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:14:7: error: accidental override: The following declarations have the same JVM signature (access$setBar1$p(LDerived;I)V):
|
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:14:7: error: accidental override: The following declarations have the same JVM signature (access$setBar1$p(LDerived;I)V):
|
||||||
fun `access$setBar1$p`(d: Derived, i: Int): Unit defined in Derived
|
fun `access$setBar1$p`(d: Derived, i: Int): Unit defined in Derived
|
||||||
fun `access$setBar1$p`(`$this`: Derived, `<set-?>`: Int): Unit defined in Derived
|
fun `access$setBar1$p`(`$this`: Derived, `<set-?>`: Int): Unit defined in Derived
|
||||||
class Derived : Base() {
|
class Derived : Base() {
|
||||||
^
|
^
|
||||||
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:14:7: error: accidental override: The following declarations have the same JVM signature (access$getBaz$p(LDerived;)I):
|
|
||||||
fun `access$getBaz$p`(d: Derived): Int defined in Derived
|
|
||||||
fun `access$getBaz$p`(`$this`: Derived): Int defined in Derived
|
|
||||||
class Derived : Base() {
|
|
||||||
^
|
|
||||||
COMPILATION_ERROR
|
COMPILATION_ERROR
|
||||||
|
|||||||
Reference in New Issue
Block a user