[LL FIR] pass correct context during class annotation arguments mapping

The root cause of the problem is that we visit class annotations more
accurately than in the regular compiler transformer, so we have
a difference: the compiler assumes that annotation processing
of the class is called already inside this class, so it should enable
CLASS_HEADER_ANNOTATIONS mode to not capture extra context.
But we in LL FIR do this out of the class, so such context switching
is redundant and results in cutting out the outer class context

^KT-62587 Fixed
This commit is contained in:
Dmitrii Gridin
2023-10-16 19:46:20 +02:00
committed by Space Team
parent bbd09c6272
commit b03e3f0b0d
9 changed files with 45 additions and 77 deletions
@@ -1,14 +0,0 @@
// LL_FIR_DIVERGENCE
// KT-62587
// LL_FIR_DIVERGENCE
// FIR_IDENTICAL
annotation class Anno(val number: Int)
class Outer {
companion object {
const val CONSTANT_FROM_COMPANION = 42
@Anno(<!UNRESOLVED_REFERENCE!>CONSTANT_FROM_COMPANION<!>)
class Nested
}
}
@@ -1,15 +0,0 @@
// LL_FIR_DIVERGENCE
// KT-62587
// LL_FIR_DIVERGENCE
// FIR_IDENTICAL
import kotlin.reflect.KClass
@Target(AnnotationTarget.CLASS, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.TYPE)
annotation class Special(val why: KClass<*>)
interface Interface
class Outer {
@Special(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!><!UNRESOLVED_REFERENCE!>Nested<!>::class<!>)
class Nested<@Special(Nested::class) T> : @Special(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!><!UNRESOLVED_REFERENCE!>Nested<!>::class<!>) Interface
}
@@ -1,14 +0,0 @@
// LL_FIR_DIVERGENCE
// KT-62587
// LL_FIR_DIVERGENCE
import kotlin.reflect.KClass
@Target(AnnotationTarget.CLASS, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.TYPE)
annotation class Special(val why: KClass<*>)
interface Interface
class Outer {
@Special(<!UNRESOLVED_REFERENCE!>Nested<!>)
class Nested<@Special(<!ARGUMENT_TYPE_MISMATCH, NO_COMPANION_OBJECT!>Nested<!>) T> : @Special(<!UNRESOLVED_REFERENCE!>Nested<!>) Interface
}
@@ -1,15 +0,0 @@
// LL_FIR_DIVERGENCE
// KT-62587
// LL_FIR_DIVERGENCE
// FIR_IDENTICAL
import kotlin.reflect.KClass
@Target(AnnotationTarget.CLASS, AnnotationTarget.TYPE)
annotation class Special(val why: KClass<*>)
interface Interface
object Outer {
@Special(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!><!UNRESOLVED_REFERENCE!>Nested<!>::class<!>)
object Nested : @Special(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!><!UNRESOLVED_REFERENCE!>Nested<!>::class<!>) Interface
}