[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
@@ -404,10 +404,10 @@ FILE: [ResolvedTo(IMPORTS)] annotationWithConstantFromNestedClass.kt
LAZY_super<R|kotlin/Any|>
}
public final const [ResolvedTo(STATUS)] val CONSTANT_FROM_COMPANION: <implicit> = LAZY_EXPRESSION
public [ResolvedTo(STATUS)] [ContainingClassKey=Companion] get(): <implicit>
public final const [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] val CONSTANT_FROM_COMPANION: R|kotlin/Int| = Int(42)
public [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] [ContainingClassKey=Companion] get(): R|kotlin/Int|
@R|Anno|[Types](number = <Unresolved name: CONSTANT_FROM_COMPANION>#) public final [ResolvedTo(ANNOTATIONS_ARGUMENTS_MAPPING)] class Nested : R|kotlin/Any| {
@R|Anno|[Types](number = this@R|/Outer.Companion|.R|/Outer.Companion.CONSTANT_FROM_COMPANION|) public final [ResolvedTo(ANNOTATIONS_ARGUMENTS_MAPPING)] class Nested : R|kotlin/Any| {
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Nested] constructor(): R|Outer.Companion.Nested| {
LAZY_super<R|kotlin/Any|>
}
@@ -439,10 +439,10 @@ FILE: [ResolvedTo(IMPORTS)] annotationWithConstantFromNestedClass.kt
LAZY_super<R|kotlin/Any|>
}
public final const [ResolvedTo(STATUS)] val CONSTANT_FROM_COMPANION: <implicit> = LAZY_EXPRESSION
public [ResolvedTo(STATUS)] [ContainingClassKey=Companion] get(): <implicit>
public final const [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] val CONSTANT_FROM_COMPANION: R|kotlin/Int| = Int(42)
public [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] [ContainingClassKey=Companion] get(): R|kotlin/Int|
@R|Anno|[Types](number = <Unresolved name: CONSTANT_FROM_COMPANION>#) public final [ResolvedTo(BODY_RESOLVE)] class Nested : R|kotlin/Any| {
@R|Anno|[Types](number = this@R|/Outer.Companion|.R|/Outer.Companion.CONSTANT_FROM_COMPANION|) public final [ResolvedTo(BODY_RESOLVE)] class Nested : R|kotlin/Any| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=Nested] constructor(): R|Outer.Companion.Nested| {
super<R|kotlin/Any|>()
}
@@ -477,7 +477,7 @@ FILE: [ResolvedTo(BODY_RESOLVE)] annotationWithConstantFromNestedClass.kt
public final const [ResolvedTo(BODY_RESOLVE)] val CONSTANT_FROM_COMPANION: R|kotlin/Int| = Int(42)
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=Companion] get(): R|kotlin/Int|
@R|Anno|[Types](number = <Unresolved name: CONSTANT_FROM_COMPANION>#) public final [ResolvedTo(BODY_RESOLVE)] class Nested : R|kotlin/Any| {
@R|Anno|[Types](number = this@R|/Outer.Companion|.R|/Outer.Companion.CONSTANT_FROM_COMPANION|) public final [ResolvedTo(BODY_RESOLVE)] class Nested : R|kotlin/Any| {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=Nested] constructor(): R|Outer.Companion.Nested| {
super<R|kotlin/Any|>()
}