[LL FIR] introduce lazy resolve tests for type annotations
From one side to check how annotation propagation works and from another side to cover scenarios with lazy resolution from type position as it is a valid case of usage in Analysis API (KtFirAnnotationListForType) ^KT-63042
This commit is contained in:
committed by
Space Team
parent
689fe28efa
commit
8dacd41818
+19
@@ -0,0 +1,19 @@
|
||||
package foo
|
||||
|
||||
class Arg
|
||||
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class Anno(val position: String)
|
||||
const val constant = 0
|
||||
|
||||
fun interface Foo {
|
||||
fun foo(a: @Anno("foo param type $constant") Arg): @Anno("foo return type $constant") Arg
|
||||
}
|
||||
|
||||
fun testMe(f: @Anno("testMe param type $constant") Foo) {}
|
||||
|
||||
<expr>
|
||||
fun resolveMe() {
|
||||
testMe { b -> b }
|
||||
}
|
||||
</expr>
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
KT element: KtNamedFunction
|
||||
FIR element: FirSimpleFunctionImpl
|
||||
FIR source kind: KtRealSourceElementKind
|
||||
|
||||
FIR element rendered:
|
||||
public final [ResolvedTo(BODY_RESOLVE)] fun resolveMe(): R|kotlin/Unit| {
|
||||
R|foo/testMe|(<L> = [ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=@R|foo/Anno|(<strcat>(String(testMe param type ), constant#)) foo/Foo] testMe@fun <anonymous>([ResolvedTo(BODY_RESOLVE)] b: R|@R|foo/Anno|(position = <strcat>(String(foo param type ), R|foo/constant|)) foo/Arg|): R|@R|foo/Anno|(position = <strcat>(String(foo return type ), R|foo/constant|)) foo/Arg| <inline=NoInline> {
|
||||
^ R|<local>/b|
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
FIR FILE:
|
||||
FILE: [ResolvedTo(IMPORTS)] lambdaAsSAMInterfaceWithAnnotation.kt
|
||||
package foo
|
||||
|
||||
public? final? [ResolvedTo(RAW_FIR)] class Arg : R|kotlin/Any| {
|
||||
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Arg] constructor(): R|foo/Arg| {
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
}
|
||||
@R|kotlin/annotation/Target|[Types](Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.TYPE|) public final [ResolvedTo(STATUS)] annotation class Anno : R|kotlin/Annotation| {
|
||||
public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] constructor([ResolvedTo(STATUS)] [CorrespondingProperty=foo/Anno.position] position: R|kotlin/String|): R|foo/Anno| {
|
||||
LAZY_super<R|kotlin/Any|>
|
||||
}
|
||||
|
||||
public final [ResolvedTo(STATUS)] [IsFromPrimaryConstructor=true] val position: R|kotlin/String| = R|<local>/position|
|
||||
public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] get(): R|kotlin/String|
|
||||
|
||||
}
|
||||
public final const [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] val constant: R|kotlin/Int| = Int(0)
|
||||
public [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] get(): R|kotlin/Int|
|
||||
public abstract fun [ResolvedTo(STATUS)] interface Foo : R|kotlin/Any| {
|
||||
public abstract [ResolvedTo(STATUS)] fun foo([ResolvedTo(STATUS)] a: R|@R|foo/Anno|(<strcat>(String(foo param type ), R|foo/constant|)) foo/Arg|): R|@R|foo/Anno|(<strcat>(String(foo return type ), R|foo/constant|)) foo/Arg|
|
||||
|
||||
}
|
||||
public final [ResolvedTo(CONTRACTS)] fun testMe([ResolvedTo(CONTRACTS)] f: R|@R|foo/Anno|(<strcat>(String(testMe param type ), constant#)) foo/Foo|): R|kotlin/Unit| {
|
||||
}
|
||||
public final [ResolvedTo(BODY_RESOLVE)] fun resolveMe(): R|kotlin/Unit| {
|
||||
R|foo/testMe|(<L> = [ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=@R|foo/Anno|(<strcat>(String(testMe param type ), constant#)) foo/Foo] testMe@fun <anonymous>([ResolvedTo(BODY_RESOLVE)] b: R|@R|foo/Anno|(position = <strcat>(String(foo param type ), R|foo/constant|)) foo/Arg|): R|@R|foo/Anno|(position = <strcat>(String(foo return type ), R|foo/constant|)) foo/Arg| <inline=NoInline> {
|
||||
^ R|<local>/b|
|
||||
}
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user