[klib] Don't show signature clash diagnostics for local declarations

For some reason type parameters end up in
`GlobdalDeclarationTable`, and thus we tracked them in
`IdSignatureClashDetector`, which wasn't right and confused the
diagnostic renderer that uses
`org.jetbrains.kotlin.resolve.MemberComparator` for sorting the
declarations to display in diagnostics. That comparator doesn't know
jow to work with type parameters.

Besides, type parameters, like many other types of declarations, are not
considered public wrt KLIB ABI, so there's no need to show
CONFLICTING_KLIB_SIGNATURES_ERROR for them.

^KT-65723 Fixed
This commit is contained in:
Sergej Jaskiewicz
2024-02-09 19:26:27 +01:00
committed by Space Team
parent e363a1228d
commit f26e470e80
6 changed files with 50 additions and 43 deletions
@@ -14,11 +14,6 @@ native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/main.kt:10
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 fields 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 functions 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
@@ -31,11 +26,6 @@ native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/main.kt:15
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 fields 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 functions 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