Files
kotlin-fork/compiler/testData/codegen/box/ir/suppressConflictingSignatureErrors.kt
T
Alexander Udalov 106ee1d1ff JVM IR: restore ability to suppress codegen-reported diagnostics
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
2020-11-09 19:55:31 +01:00

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"
}