[klib] Fix NIE when showing signature clash diagnostics on properties
The issue was that when rendering declarations in the `CONFLICTING_KLIB_SIGNATURES_DATA` diagnostics, we sort them using `MemberComparator`. That comparator falls back to comparing declarations' renders if all previous checks were unsuccessful (and in case of almost identical properties they are). The renderer that the comparator uses also renders the properties' backing field annotations, for which it calls `PropertyDescriptor#getBackingField`. That method wasn't implemented in IR-based descriptors. This is fixed by returning an instance of the new `IrBasedBackingFieldDescriptor` class from that method. ^KT-65551 Fixed
This commit is contained in:
committed by
Space Team
parent
9688c3e761
commit
d80a67652f
@@ -7,9 +7,18 @@ class A {
|
||||
fun foo(): Int = 0
|
||||
}
|
||||
|
||||
var myVal: Long = 0L
|
||||
|
||||
@Deprecated("This function moved to the 'lib' module", level = DeprecationLevel.HIDDEN)
|
||||
fun movedToLib() {}
|
||||
|
||||
@Deprecated("", level = DeprecationLevel.HIDDEN)
|
||||
var myVal: Int = 0
|
||||
|
||||
@Deprecated("", level = DeprecationLevel.HIDDEN)
|
||||
val myVal: String
|
||||
get() = ""
|
||||
|
||||
fun main() {
|
||||
println(A().foo())
|
||||
movedToLib()
|
||||
|
||||
+46
@@ -8,4 +8,50 @@ native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/main.kt:7:
|
||||
fun foo(): kotlin.Int defined in com.example.klib.serialization.diagnostics.A
|
||||
fun foo(): Int = 0
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/main.kt:10:1: error: platform declaration clash: The following declarations have the same IR signature (com.example.klib.serialization.diagnostics/myVal|{}myVal[0]):
|
||||
val myVal: kotlin.String defined in com.example.klib.serialization.diagnostics
|
||||
var myVal: kotlin.Int defined in com.example.klib.serialization.diagnostics
|
||||
var myVal: kotlin.Long defined in com.example.klib.serialization.diagnostics
|
||||
var myVal: Long = 0L
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/main.kt:10:1: error: platform declaration clash: The following declarations have the same IR signature ([ com.example.klib.serialization.diagnostics/myVal|{}myVal[0] <- Local[<BF>|FIELD PROPERTY_BACKING_FIELD name:myVal type:kotlin.Long visibility:private [static]] ]):
|
||||
var myVal: kotlin.Int defined in com.example.klib.serialization.diagnostics
|
||||
var myVal: kotlin.Long defined in com.example.klib.serialization.diagnostics
|
||||
var myVal: Long = 0L
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/main.kt:10:1: error: platform declaration clash: The following declarations have the same IR signature (com.example.klib.serialization.diagnostics/myVal.<get-myVal>|<get-myVal>(){}[0]):
|
||||
fun `<get-myVal>`(): kotlin.Int defined in com.example.klib.serialization.diagnostics
|
||||
fun `<get-myVal>`(): kotlin.Long defined in com.example.klib.serialization.diagnostics
|
||||
fun `<get-myVal>`(): kotlin.String defined in com.example.klib.serialization.diagnostics
|
||||
var myVal: Long = 0L
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/main.kt:15:1: error: platform declaration clash: The following declarations have the same IR signature (com.example.klib.serialization.diagnostics/myVal|{}myVal[0]):
|
||||
val myVal: kotlin.String defined in com.example.klib.serialization.diagnostics
|
||||
var myVal: kotlin.Int defined in com.example.klib.serialization.diagnostics
|
||||
var myVal: kotlin.Long defined in com.example.klib.serialization.diagnostics
|
||||
@Deprecated("", level = DeprecationLevel.HIDDEN)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/main.kt:15:1: error: platform declaration clash: The following declarations have the same IR signature ([ com.example.klib.serialization.diagnostics/myVal|{}myVal[0] <- Local[<BF>|FIELD PROPERTY_BACKING_FIELD name:myVal type:kotlin.Long visibility:private [static]] ]):
|
||||
var myVal: kotlin.Int defined in com.example.klib.serialization.diagnostics
|
||||
var myVal: kotlin.Long defined in com.example.klib.serialization.diagnostics
|
||||
@Deprecated("", level = DeprecationLevel.HIDDEN)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/main.kt:15:1: error: platform declaration clash: The following declarations have the same IR signature (com.example.klib.serialization.diagnostics/myVal.<get-myVal>|<get-myVal>(){}[0]):
|
||||
fun `<get-myVal>`(): kotlin.Int defined in com.example.klib.serialization.diagnostics
|
||||
fun `<get-myVal>`(): kotlin.Long defined in com.example.klib.serialization.diagnostics
|
||||
fun `<get-myVal>`(): kotlin.String defined in com.example.klib.serialization.diagnostics
|
||||
@Deprecated("", level = DeprecationLevel.HIDDEN)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/main.kt:18:1: error: platform declaration clash: The following declarations have the same IR signature (com.example.klib.serialization.diagnostics/myVal|{}myVal[0]):
|
||||
val myVal: kotlin.String defined in com.example.klib.serialization.diagnostics
|
||||
var myVal: kotlin.Int defined in com.example.klib.serialization.diagnostics
|
||||
var myVal: kotlin.Long defined in com.example.klib.serialization.diagnostics
|
||||
@Deprecated("", level = DeprecationLevel.HIDDEN)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/main.kt:20:5: error: platform declaration clash: The following declarations have the same IR signature (com.example.klib.serialization.diagnostics/myVal.<get-myVal>|<get-myVal>(){}[0]):
|
||||
fun `<get-myVal>`(): kotlin.Int defined in com.example.klib.serialization.diagnostics
|
||||
fun `<get-myVal>`(): kotlin.Long defined in com.example.klib.serialization.diagnostics
|
||||
fun `<get-myVal>`(): kotlin.String defined in com.example.klib.serialization.diagnostics
|
||||
get() = ""
|
||||
^^^^^^^^^^
|
||||
COMPILATION_ERROR
|
||||
|
||||
Reference in New Issue
Block a user