106ee1d1ff
In the old backend, BindingContextSuppressCache is used (which is now created explicitly in GenerationState), which looks up `@Suppress` annotations on elements right before reporting the diagnostic. In JVM IR, we clear the binding context after psi2ir, so this approach doesn't work. This change provides another implementation of KotlinSuppressCache which eagerly precomputes all suppressions on all annotated elements in all source files at the point of creation of GenerationState (when the binding context is still full). #KT-43047 Fixed
26 lines
580 B
Kotlin
Vendored
26 lines
580 B
Kotlin
Vendored
// This test checks that suppressing conflicting signature / accidental override errors works.
|
|
// This is used in libraries for binary-compatible migration, as well as in some cases in multiplatform projects.
|
|
// TARGET_BACKEND: JVM
|
|
// IGNORE_BACKEND_FIR: JVM_IR
|
|
// FILE: box.kt
|
|
|
|
open class B {
|
|
open val s: String
|
|
get() = "Fail"
|
|
}
|
|
|
|
class C : B() {
|
|
@Suppress("ACCIDENTAL_OVERRIDE")
|
|
fun getS(): String = "O"
|
|
}
|
|
|
|
fun box(): String = C().getS() + D().getS()
|
|
|
|
// FILE: another.kt
|
|
|
|
@file:Suppress("ACCIDENTAL_OVERRIDE")
|
|
|
|
class D : B() {
|
|
fun getS(): String = "K"
|
|
}
|