[LL FIR] resolve propagated type annotations correctly
This commit is Low Level FIR part of changes around propagated annotations (aka foreign annotations). It includes such changes as: * implicit type phase postpones foreign annotations resolution * annotation arguments are requests resolution for postponed annotations from implicit type phase as a pre-resolve step * body resolve phase just calls lazy resolution for foreign annotations on demand * isResolved check for type annotations to be sure that all annotations are resolved after annotation arguments phase ^KT-63042 Fixed ^KT-63681 Fixed
This commit is contained in:
committed by
Space Team
parent
cf11e26755
commit
97956b4374
+9
-9
@@ -4,7 +4,7 @@ FIR source kind: KtRealSourceElementKind
|
||||
|
||||
FIR element rendered:
|
||||
public final [ResolvedTo(BODY_RESOLVE)] fun resolveMe(): R|kotlin/Unit| {
|
||||
R|foo/testMe|(<L> = SAM([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|(<strcat>(String(foo param type ), constant#)) foo/Arg|): R|@R|foo/Anno|(<strcat>(String(foo return type ), constant#)) foo/Arg| <inline=NoInline> {
|
||||
R|foo/testMe|(<L> = SAM([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|
|
||||
}
|
||||
))
|
||||
@@ -20,25 +20,25 @@ FILE: [ResolvedTo(IMPORTS)] lambdaAsSAMInterfaceWithAnnotation.kt
|
||||
}
|
||||
|
||||
}
|
||||
@R|kotlin/annotation/Target|[CompilerRequiredAnnotations](Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.TYPE|) public? final? [ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] annotation class Anno : R|kotlin/Annotation| {
|
||||
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] constructor([ResolvedTo(RAW_FIR)] [CorrespondingProperty=foo/Anno.position] position: String): R|foo/Anno| {
|
||||
@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(RAW_FIR)] [IsFromPrimaryConstructor=true] val position: String = R|<local>/position|
|
||||
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] get(): String
|
||||
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(RAW_FIR)] val constant: <implicit> = LAZY_EXPRESSION
|
||||
public? [ResolvedTo(RAW_FIR)] get(): <implicit>
|
||||
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 ), constant#)) foo/Arg|): R|@R|foo/Anno|(<strcat>(String(foo return type ), constant#)) foo/Arg|
|
||||
public abstract [ResolvedTo(ANNOTATION_ARGUMENTS)] fun foo([ResolvedTo(ANNOTATION_ARGUMENTS)] a: 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|
|
||||
|
||||
}
|
||||
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> = SAM([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|(<strcat>(String(foo param type ), constant#)) foo/Arg|): R|@R|foo/Anno|(<strcat>(String(foo return type ), constant#)) foo/Arg| <inline=NoInline> {
|
||||
R|foo/testMe|(<L> = SAM([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|
|
||||
}
|
||||
))
|
||||
|
||||
+5
-5
@@ -3,7 +3,7 @@ FIR element: FirPropertyImpl
|
||||
FIR source kind: KtRealSourceElementKind
|
||||
|
||||
FIR element rendered:
|
||||
@R|foo/Anno|[Types](position = <strcat>(String(property ), R|foo/secondConstant|)) [ResolvedTo(BODY_RESOLVE)] lval localProperty: R|@R|foo/Anno|(<strcat>(String(return type: ), constant#)) kotlin/collections/List<@R|foo/Anno|(<strcat>(String(nested return type: ), constant#)) kotlin/collections/Collection<@R|foo/Anno|(<strcat>(String(nested nested return type: ), constant#)) kotlin/String>>|by R|kotlin/lazy|<R|@R|foo/Anno|(<strcat>(String(return type: ), constant#)) kotlin/collections/List<@R|foo/Anno|(<strcat>(String(nested return type: ), constant#)) kotlin/collections/Collection<@R|foo/Anno|(<strcat>(String(nested nested return type: ), constant#)) kotlin/String>>|>(<L> = [ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=kotlin/Function0<T>] lazy@fun <anonymous>(): R|@R|foo/Anno|(<strcat>(String(return type: ), constant#)) kotlin/collections/List<@R|foo/Anno|(<strcat>(String(nested return type: ), constant#)) kotlin/collections/Collection<@R|foo/Anno|(<strcat>(String(nested nested return type: ), constant#)) kotlin/String>>| <inline=NoInline> {
|
||||
@R|foo/Anno|[Types](position = <strcat>(String(property ), R|foo/secondConstant|)) [ResolvedTo(BODY_RESOLVE)] lval localProperty: R|@R|foo/Anno|(position = <strcat>(String(return type: ), R|foo/constant|)) kotlin/collections/List<@R|foo/Anno|(position = <strcat>(String(nested return type: ), R|foo/constant|)) kotlin/collections/Collection<@R|foo/Anno|(position = <strcat>(String(nested nested return type: ), R|foo/constant|)) kotlin/String>>|by R|kotlin/lazy|<R|@R|foo/Anno|(position = <strcat>(String(return type: ), R|foo/constant|)) kotlin/collections/List<@R|foo/Anno|(position = <strcat>(String(nested return type: ), R|foo/constant|)) kotlin/collections/Collection<@R|foo/Anno|(position = <strcat>(String(nested nested return type: ), R|foo/constant|)) kotlin/String>>|>(<L> = [ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=kotlin/Function0<T>] lazy@fun <anonymous>(): R|@R|foo/Anno|(position = <strcat>(String(return type: ), R|foo/constant|)) kotlin/collections/List<@R|foo/Anno|(position = <strcat>(String(nested return type: ), R|foo/constant|)) kotlin/collections/Collection<@R|foo/Anno|(position = <strcat>(String(nested nested return type: ), R|foo/constant|)) kotlin/String>>| <inline=NoInline> {
|
||||
^ R|foo/explicitType|()
|
||||
}
|
||||
)
|
||||
@@ -21,13 +21,13 @@ FILE: [ResolvedTo(IMPORTS)] localDelegatedPropertyWithPropagatedType.kt
|
||||
public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] get(): R|kotlin/String|
|
||||
|
||||
}
|
||||
public? final? const [ResolvedTo(RAW_FIR)] val constant: <implicit> = LAZY_EXPRESSION
|
||||
public? [ResolvedTo(RAW_FIR)] get(): <implicit>
|
||||
public final [ResolvedTo(CONTRACTS)] fun explicitType(): R|@R|foo/Anno|(<strcat>(String(return type: ), constant#)) kotlin/collections/List<@R|foo/Anno|(<strcat>(String(nested return type: ), constant#)) kotlin/collections/Collection<@R|foo/Anno|(<strcat>(String(nested nested return type: ), constant#)) 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 final [ResolvedTo(ANNOTATION_ARGUMENTS)] fun explicitType(): R|@R|foo/Anno|(position = <strcat>(String(return type: ), R|foo/constant|)) kotlin/collections/List<@R|foo/Anno|(position = <strcat>(String(nested return type: ), R|foo/constant|)) kotlin/collections/Collection<@R|foo/Anno|(position = <strcat>(String(nested nested return type: ), R|foo/constant|)) kotlin/String>>| {
|
||||
^explicitType IntegerLiteral(0)
|
||||
}
|
||||
public final [ResolvedTo(BODY_RESOLVE)] fun resolveMe(): R|kotlin/Unit| {
|
||||
@R|foo/Anno|[Types](position = <strcat>(String(property ), R|foo/secondConstant|)) [ResolvedTo(BODY_RESOLVE)] lval localProperty: R|@R|foo/Anno|(<strcat>(String(return type: ), constant#)) kotlin/collections/List<@R|foo/Anno|(<strcat>(String(nested return type: ), constant#)) kotlin/collections/Collection<@R|foo/Anno|(<strcat>(String(nested nested return type: ), constant#)) kotlin/String>>|by R|kotlin/lazy|<R|@R|foo/Anno|(<strcat>(String(return type: ), constant#)) kotlin/collections/List<@R|foo/Anno|(<strcat>(String(nested return type: ), constant#)) kotlin/collections/Collection<@R|foo/Anno|(<strcat>(String(nested nested return type: ), constant#)) kotlin/String>>|>(<L> = [ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=kotlin/Function0<T>] lazy@fun <anonymous>(): R|@R|foo/Anno|(<strcat>(String(return type: ), constant#)) kotlin/collections/List<@R|foo/Anno|(<strcat>(String(nested return type: ), constant#)) kotlin/collections/Collection<@R|foo/Anno|(<strcat>(String(nested nested return type: ), constant#)) kotlin/String>>| <inline=NoInline> {
|
||||
@R|foo/Anno|[Types](position = <strcat>(String(property ), R|foo/secondConstant|)) [ResolvedTo(BODY_RESOLVE)] lval localProperty: R|@R|foo/Anno|(position = <strcat>(String(return type: ), R|foo/constant|)) kotlin/collections/List<@R|foo/Anno|(position = <strcat>(String(nested return type: ), R|foo/constant|)) kotlin/collections/Collection<@R|foo/Anno|(position = <strcat>(String(nested nested return type: ), R|foo/constant|)) kotlin/String>>|by R|kotlin/lazy|<R|@R|foo/Anno|(position = <strcat>(String(return type: ), R|foo/constant|)) kotlin/collections/List<@R|foo/Anno|(position = <strcat>(String(nested return type: ), R|foo/constant|)) kotlin/collections/Collection<@R|foo/Anno|(position = <strcat>(String(nested nested return type: ), R|foo/constant|)) kotlin/String>>|>(<L> = [ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=kotlin/Function0<T>] lazy@fun <anonymous>(): R|@R|foo/Anno|(position = <strcat>(String(return type: ), R|foo/constant|)) kotlin/collections/List<@R|foo/Anno|(position = <strcat>(String(nested return type: ), R|foo/constant|)) kotlin/collections/Collection<@R|foo/Anno|(position = <strcat>(String(nested nested return type: ), R|foo/constant|)) kotlin/String>>| <inline=NoInline> {
|
||||
^ R|foo/explicitType|()
|
||||
}
|
||||
)
|
||||
|
||||
+5
-5
@@ -3,7 +3,7 @@ FIR element: FirPropertyImpl
|
||||
FIR source kind: KtRealSourceElementKind
|
||||
|
||||
FIR element rendered:
|
||||
@R|foo/Anno|[Types](position = <strcat>(String(property ), R|foo/secondConstant|)) [ResolvedTo(BODY_RESOLVE)] lval localProperty: R|@R|foo/Anno|(<strcat>(String(return type: ), constant#)) kotlin/collections/List<@R|foo/Anno|(<strcat>(String(nested return type: ), constant#)) kotlin/collections/Collection<@R|foo/Anno|(<strcat>(String(nested nested return type: ), constant#)) kotlin/String>>| = R|foo/explicitType|()
|
||||
@R|foo/Anno|[Types](position = <strcat>(String(property ), R|foo/secondConstant|)) [ResolvedTo(BODY_RESOLVE)] lval localProperty: R|@R|foo/Anno|(position = <strcat>(String(return type: ), R|foo/constant|)) kotlin/collections/List<@R|foo/Anno|(position = <strcat>(String(nested return type: ), R|foo/constant|)) kotlin/collections/Collection<@R|foo/Anno|(position = <strcat>(String(nested nested return type: ), R|foo/constant|)) kotlin/String>>| = R|foo/explicitType|()
|
||||
|
||||
FIR FILE:
|
||||
FILE: [ResolvedTo(IMPORTS)] localPropertyWithPropagatedType.kt
|
||||
@@ -18,13 +18,13 @@ FILE: [ResolvedTo(IMPORTS)] localPropertyWithPropagatedType.kt
|
||||
public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] get(): R|kotlin/String|
|
||||
|
||||
}
|
||||
public? final? const [ResolvedTo(RAW_FIR)] val constant: <implicit> = LAZY_EXPRESSION
|
||||
public? [ResolvedTo(RAW_FIR)] get(): <implicit>
|
||||
public final [ResolvedTo(CONTRACTS)] fun explicitType(): R|@R|foo/Anno|(<strcat>(String(return type: ), constant#)) kotlin/collections/List<@R|foo/Anno|(<strcat>(String(nested return type: ), constant#)) kotlin/collections/Collection<@R|foo/Anno|(<strcat>(String(nested nested return type: ), constant#)) 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 final [ResolvedTo(ANNOTATION_ARGUMENTS)] fun explicitType(): R|@R|foo/Anno|(position = <strcat>(String(return type: ), R|foo/constant|)) kotlin/collections/List<@R|foo/Anno|(position = <strcat>(String(nested return type: ), R|foo/constant|)) kotlin/collections/Collection<@R|foo/Anno|(position = <strcat>(String(nested nested return type: ), R|foo/constant|)) kotlin/String>>| {
|
||||
^explicitType IntegerLiteral(0)
|
||||
}
|
||||
public final [ResolvedTo(BODY_RESOLVE)] fun resolveMe(): R|kotlin/Unit| {
|
||||
@R|foo/Anno|[Types](position = <strcat>(String(property ), R|foo/secondConstant|)) [ResolvedTo(BODY_RESOLVE)] lval localProperty: R|@R|foo/Anno|(<strcat>(String(return type: ), constant#)) kotlin/collections/List<@R|foo/Anno|(<strcat>(String(nested return type: ), constant#)) kotlin/collections/Collection<@R|foo/Anno|(<strcat>(String(nested nested return type: ), constant#)) kotlin/String>>| = R|foo/explicitType|()
|
||||
@R|foo/Anno|[Types](position = <strcat>(String(property ), R|foo/secondConstant|)) [ResolvedTo(BODY_RESOLVE)] lval localProperty: R|@R|foo/Anno|(position = <strcat>(String(return type: ), R|foo/constant|)) kotlin/collections/List<@R|foo/Anno|(position = <strcat>(String(nested return type: ), R|foo/constant|)) kotlin/collections/Collection<@R|foo/Anno|(position = <strcat>(String(nested nested return type: ), R|foo/constant|)) kotlin/String>>| = R|foo/explicitType|()
|
||||
}
|
||||
public final const [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] val secondConstant: R|kotlin/String| = String(str)
|
||||
public [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] get(): R|kotlin/String|
|
||||
Reference in New Issue
Block a user