[LL FIR] resolve class before delegate field

This is required to have stable resolution order to avoid concurrent
modifications and correct resolution context.
E.g., this commit fixes the resolution behavior of delegate field for
ANNOTATION_ARGUMENTS phase – now annotation argument resolves in the
correct scope

^KT-63042
This commit is contained in:
Dmitrii Gridin
2023-11-21 18:08:07 +01:00
committed by Space Team
parent 5a54520723
commit e3d91741ca
21 changed files with 198 additions and 261 deletions
@@ -1,48 +0,0 @@
FILE: nestedNameClashAndAnnotations.reversed.kt
package second
@R|kotlin/annotation/Target|(allowedTargets = vararg(Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.TYPE|)) public final annotation class Anno : R|kotlin/Annotation| {
public constructor(i: R|kotlin/Int|): R|second/Anno| {
super<R|kotlin/Any|>()
}
public final val i: R|kotlin/Int| = R|<local>/i|
public get(): R|kotlin/Int|
}
public abstract interface Base<A> : R|kotlin/Any| {
public open fun foo(): R|kotlin/Unit| {
}
}
public final const val outer: R|kotlin/Int| = Int(0)
public get(): R|kotlin/Int|
public final const val inner: R|kotlin/String| = String()
public get(): R|kotlin/String|
public final class MyClass : R|@R|second/Anno|(i = IntegerLiteral(3).<Ambiguity: plus, [kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus]>#(this@R|second/MyClass.Companion|.R|second/MyClass.Companion.outer|)) second/Base<@R|second/Anno|(i = IntegerLiteral(4).<Ambiguity: plus, [kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus]>#(this@R|second/MyClass.Companion|.R|second/MyClass.Companion.outer|)) second/Base<@R|second/Anno|(i = IntegerLiteral(5).<Ambiguity: plus, [kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus]>#(this@R|second/MyClass.Companion|.R|second/MyClass.Companion.outer|)) kotlin/Int>>| {
public constructor(prop: R|@R|second/Anno|(i = Int(0).R|kotlin/Int.plus|(this@R|second/MyClass.Companion|.R|second/MyClass.Companion.inner|)) second/Base<@R|second/Anno|(i = Int(1).R|kotlin/Int.plus|(this@R|second/MyClass.Companion|.R|second/MyClass.Companion.inner|)) second/Base<@R|second/Anno|(i = Int(2).R|kotlin/Int.plus|(this@R|second/MyClass.Companion|.R|second/MyClass.Companion.inner|)) kotlin/Int>>|): R|second/MyClass| {
super<R|kotlin/Any|>()
}
private final field $$delegate_0: R|@R|second/Anno|(i = IntegerLiteral(3).<Ambiguity: plus, [kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus]>#(this@R|second/MyClass.Companion|.R|second/MyClass.Companion.outer|)) second/Base<@R|second/Anno|(i = IntegerLiteral(4).<Ambiguity: plus, [kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus]>#(this@R|second/MyClass.Companion|.R|second/MyClass.Companion.outer|)) second/Base<@R|second/Anno|(i = IntegerLiteral(5).<Ambiguity: plus, [kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus]>#(this@R|second/MyClass.Companion|.R|second/MyClass.Companion.outer|)) kotlin/Int>>| = R|<local>/prop|
public final val prop: R|@R|second/Anno|(i = Int(0).R|kotlin/Int.plus|(this@R|second/MyClass.Companion|.R|second/MyClass.Companion.inner|)) second/Base<@R|second/Anno|(i = Int(1).R|kotlin/Int.plus|(this@R|second/MyClass.Companion|.R|second/MyClass.Companion.inner|)) second/Base<@R|second/Anno|(i = Int(2).R|kotlin/Int.plus|(this@R|second/MyClass.Companion|.R|second/MyClass.Companion.inner|)) kotlin/Int>>| = R|<local>/prop|
public get(): R|@R|second/Anno|(i = Int(0).R|kotlin/Int.plus|(this@R|second/MyClass.Companion|.R|second/MyClass.Companion.inner|)) second/Base<@R|second/Anno|(i = Int(1).R|kotlin/Int.plus|(this@R|second/MyClass.Companion|.R|second/MyClass.Companion.inner|)) second/Base<@R|second/Anno|(i = Int(2).R|kotlin/Int.plus|(this@R|second/MyClass.Companion|.R|second/MyClass.Companion.inner|)) kotlin/Int>>|
public abstract interface Base<B> : R|kotlin/Any| {
}
public final companion object Companion : R|kotlin/Any| {
private constructor(): R|second/MyClass.Companion| {
super<R|kotlin/Any|>()
}
public final const val outer: R|kotlin/String| = String()
public get(): R|kotlin/String|
public final const val inner: R|kotlin/Int| = Int(0)
public get(): R|kotlin/Int|
}
}
@@ -1,22 +0,0 @@
// FIR_IDENTICAL
// FIR_DUMP
package second
@Target(AnnotationTarget.TYPE)
annotation class Anno(val i: Int)
interface Base<A> {
fun foo() {}
}
const val outer = 0
const val inner = ""
class MyClass(val prop: @Anno(0 + inner) second.Base<@Anno(1 + inner) second.Base<@Anno(2 + inner) Int>>): @Anno(3 <!NONE_APPLICABLE, NONE_APPLICABLE!>+<!> outer) Base<@Anno(4 <!NONE_APPLICABLE, NONE_APPLICABLE!>+<!> outer) Base<@Anno(5 <!NONE_APPLICABLE, NONE_APPLICABLE!>+<!> outer) Int>> by prop {
interface Base<B>
companion object {
const val outer = ""
const val inner = 0
}
}