eda30ff704
Now, we detect clashing signatures during serialization to KLIB and
report a compiler error if two or more declarations have the same
`IdSignature`
For example, for the following code:
```kotlin
@Deprecated("", level = DeprecationLevel.HIDDEN)
fun foo(): String = ""
fun foo(): Int = 0
```
the compiler will produce this diagnostic:
```
e: main.kt:1:1 Platform declaration clash: The following declarations
have the same KLIB signature (/foo|foo(){}[0]):
fun foo(): String defined in root package
fun foo(): Int defined in root package
e: main.kt:4:1 Platform declaration clash: The following declarations
have the same KLIB signature (/foo|foo(){}[0]):
fun foo(): String defined in root package
fun foo(): Int defined in root package
```
Note that we report this diagnostic during serialization and not earlier
(e.g., in fir2ir) for more robustness, so ensure that we check
exactly the signatures that will be written to a KLIB.
If we later introduce some annotation for customizing a declaration's
signature (e.g., for preserving binary compatibility), this
diagnostic will continue to work as expected.
^KT-63670 Fixed
27 lines
747 B
Kotlin
27 lines
747 B
Kotlin
plugins {
|
|
kotlin("jvm")
|
|
id("jps-compatible")
|
|
}
|
|
|
|
dependencies {
|
|
api(project(":compiler:ir.tree"))
|
|
api(project(":compiler:serialization"))
|
|
api(project(":kotlin-util-klib"))
|
|
api(project(":kotlin-util-klib-metadata"))
|
|
api(project(":compiler:util"))
|
|
implementation(project(":compiler:psi"))
|
|
implementation(project(":compiler:frontend.common-psi"))
|
|
compileOnly(commonDependency("org.jetbrains.kotlin:kotlin-reflect")) { isTransitive = false }
|
|
compileOnly(commonDependency("org.jetbrains.intellij.deps.fastutil:intellij-deps-fastutil"))
|
|
|
|
compileOnly(intellijCore())
|
|
}
|
|
|
|
optInToUnsafeDuringIrConstructionAPI()
|
|
optInToObsoleteDescriptorBasedAPI()
|
|
|
|
sourceSets {
|
|
"main" { projectDefault() }
|
|
"test" {}
|
|
}
|