From 63c6c38952295a86f7adef37eb905f506f44c0eb Mon Sep 17 00:00:00 2001 From: Dmitrii Gridin Date: Sat, 29 Jul 2023 02:45:48 +0200 Subject: [PATCH] [LL FIR] LLFirPhaseUpdater: update phases inside delegate expression ^KT-60728 --- .../low/level/api/fir/lazy/resolve/LLFirPhaseUpdater.kt | 1 + .../declarations/propertyDelegate.out_of_src_roots.txt | 6 +++--- .../getOrBuildFir/declarations/propertyDelegate.txt | 6 +++--- .../propertyDelegateExpression.out_of_src_roots.txt | 6 +++--- .../declarations/propertyDelegateExpression.txt | 6 +++--- .../getOrBuildFir/declarations/propertyDelegateScript.txt | 4 ++-- .../topLevelPropertyWithTypeInDelegate.txt | 4 ++-- .../topLevelPropertyWithTypeInDelegateWithoutName.txt | 4 ++-- ...quiredAnnotationsOnPropertyDelegate.out_of_src_roots.txt | 4 ++-- .../compilerRequiredAnnotationsOnPropertyDelegate.txt | 4 ++-- .../compilerRequiredAnnotationsOnPropertyDelegateScript.txt | 6 +++--- .../low-level-api-fir/testdata/lazyResolve/lazyProperty.txt | 4 ++-- .../testdata/lazyResolve/lazyPropertyScript.txt | 6 +++--- 13 files changed, 31 insertions(+), 30 deletions(-) diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/LLFirPhaseUpdater.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/LLFirPhaseUpdater.kt index 193cc87ee41..9b38df1465d 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/LLFirPhaseUpdater.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/LLFirPhaseUpdater.kt @@ -25,6 +25,7 @@ internal object LLFirPhaseUpdater { is FirFunction -> target.body?.accept(PhaseUpdatingTransformer, newPhase) is FirVariable -> { target.initializer?.accept(PhaseUpdatingTransformer, newPhase) + target.delegate?.accept(PhaseUpdatingTransformer, newPhase) target.getter?.body?.accept(PhaseUpdatingTransformer, newPhase) target.setter?.body?.accept(PhaseUpdatingTransformer, newPhase) target.backingField?.accept(PhaseUpdatingTransformer, newPhase) diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegate.out_of_src_roots.txt b/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegate.out_of_src_roots.txt index 7d1ca71c2e4..538805ae7e4 100644 --- a/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegate.out_of_src_roots.txt +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegate.out_of_src_roots.txt @@ -3,17 +3,17 @@ FIR element: FirFunctionCallImpl FIR source kind: KtRealSourceElementKind FIR element rendered: -#( = [ResolvedTo(RAW_FIR)] lazy@fun (): R|kotlin/Int| { +#( = [ResolvedTo(BODY_RESOLVE)] lazy@fun (): R|kotlin/Int| { ^ Int(1) } ) FIR FILE: FILE: [ResolvedTo(IMPORTS)] propertyDelegate.kt - public final [ResolvedTo(BODY_RESOLVE)] val x: by #( = [ResolvedTo(RAW_FIR)] lazy@fun (): R|kotlin/Int| { + public final [ResolvedTo(BODY_RESOLVE)] val x: by #( = [ResolvedTo(BODY_RESOLVE)] lazy@fun (): R|kotlin/Int| { ^ Int(1) } ) public [ResolvedTo(BODY_RESOLVE)] get(): { ^ D|/x|.#(Null(null), ::R|/x|) - } + } \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegate.txt b/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegate.txt index 8e3040a3bd9..9e59eba795c 100644 --- a/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegate.txt +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegate.txt @@ -3,17 +3,17 @@ FIR element: FirFunctionCallImpl FIR source kind: KtRealSourceElementKind FIR element rendered: -R|kotlin/lazy|( = [ResolvedTo(RAW_FIR)] [MatchingParameterFunctionTypeKey=kotlin/Function0] lazy@fun (): R|kotlin/Int| { +R|kotlin/lazy|( = [ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=kotlin/Function0] lazy@fun (): R|kotlin/Int| { ^ Int(1) } ) FIR FILE: FILE: [ResolvedTo(IMPORTS)] propertyDelegate.kt - public final [ResolvedTo(BODY_RESOLVE)] val x: R|kotlin/Int|by R|kotlin/lazy|( = [ResolvedTo(RAW_FIR)] [MatchingParameterFunctionTypeKey=kotlin/Function0] lazy@fun (): R|kotlin/Int| { + public final [ResolvedTo(BODY_RESOLVE)] val x: R|kotlin/Int|by R|kotlin/lazy|( = [ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=kotlin/Function0] lazy@fun (): R|kotlin/Int| { ^ Int(1) } ) public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| { ^ D|/x|.R|kotlin/getValue|(Null(null), ::R|/x|) - } + } \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegateExpression.out_of_src_roots.txt b/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegateExpression.out_of_src_roots.txt index 832ed08357c..7545c24fb6e 100644 --- a/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegateExpression.out_of_src_roots.txt +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegateExpression.out_of_src_roots.txt @@ -3,17 +3,17 @@ FIR element: FirFunctionCallImpl FIR source kind: KtRealSourceElementKind FIR element rendered: -#( = [ResolvedTo(RAW_FIR)] lazy@fun (): R|kotlin/Int| { +#( = [ResolvedTo(BODY_RESOLVE)] lazy@fun (): R|kotlin/Int| { ^ Int(1) } ) FIR FILE: FILE: [ResolvedTo(IMPORTS)] propertyDelegateExpression.kt - public final [ResolvedTo(BODY_RESOLVE)] val x: by #( = [ResolvedTo(RAW_FIR)] lazy@fun (): R|kotlin/Int| { + public final [ResolvedTo(BODY_RESOLVE)] val x: by #( = [ResolvedTo(BODY_RESOLVE)] lazy@fun (): R|kotlin/Int| { ^ Int(1) } ) public [ResolvedTo(BODY_RESOLVE)] get(): { ^ D|/x|.#(Null(null), ::R|/x|) - } + } \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegateExpression.txt b/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegateExpression.txt index ffa713a9df6..0e731e0d9e8 100644 --- a/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegateExpression.txt +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegateExpression.txt @@ -3,17 +3,17 @@ FIR element: FirFunctionCallImpl FIR source kind: KtRealSourceElementKind FIR element rendered: -R|kotlin/lazy|( = [ResolvedTo(RAW_FIR)] [MatchingParameterFunctionTypeKey=kotlin/Function0] lazy@fun (): R|kotlin/Int| { +R|kotlin/lazy|( = [ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=kotlin/Function0] lazy@fun (): R|kotlin/Int| { ^ Int(1) } ) FIR FILE: FILE: [ResolvedTo(IMPORTS)] propertyDelegateExpression.kt - public final [ResolvedTo(BODY_RESOLVE)] val x: R|kotlin/Int|by R|kotlin/lazy|( = [ResolvedTo(RAW_FIR)] [MatchingParameterFunctionTypeKey=kotlin/Function0] lazy@fun (): R|kotlin/Int| { + public final [ResolvedTo(BODY_RESOLVE)] val x: R|kotlin/Int|by R|kotlin/lazy|( = [ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=kotlin/Function0] lazy@fun (): R|kotlin/Int| { ^ Int(1) } ) public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int| { ^ D|/x|.R|kotlin/getValue|(Null(null), ::R|/x|) - } + } \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegateScript.txt b/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegateScript.txt index 88e030a7f75..cd44e46fd51 100644 --- a/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegateScript.txt +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegateScript.txt @@ -3,7 +3,7 @@ FIR element: FirFunctionCallImpl FIR source kind: KtRealSourceElementKind FIR element rendered: -R|kotlin/lazy|( = [ResolvedTo(RAW_FIR)] [MatchingParameterFunctionTypeKey=kotlin/Function0] lazy@fun (): R|kotlin/Int| { +R|kotlin/lazy|( = [ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=kotlin/Function0] lazy@fun (): R|kotlin/Int| { ^ Int(1) } ) @@ -14,7 +14,7 @@ FILE: [ResolvedTo(IMPORTS)] propertyDelegateScript.kts SCRIPT: [ResolvedTo(RAW_FIR)] [ResolvedTo(RAW_FIR)] lval args: R|kotlin/Array| - public final [ResolvedTo(BODY_RESOLVE)] val x: R|kotlin/Int|by R|kotlin/lazy|( = [ResolvedTo(RAW_FIR)] [MatchingParameterFunctionTypeKey=kotlin/Function0] lazy@fun (): R|kotlin/Int| { + public final [ResolvedTo(BODY_RESOLVE)] val x: R|kotlin/Int|by R|kotlin/lazy|( = [ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=kotlin/Function0] lazy@fun (): R|kotlin/Int| { ^ Int(1) } ) diff --git a/analysis/low-level-api-fir/testdata/inBlockModification/topLevelPropertyWithTypeInDelegate.txt b/analysis/low-level-api-fir/testdata/inBlockModification/topLevelPropertyWithTypeInDelegate.txt index 8af1425396a..d78c9a1ae22 100644 --- a/analysis/low-level-api-fir/testdata/inBlockModification/topLevelPropertyWithTypeInDelegate.txt +++ b/analysis/low-level-api-fir/testdata/inBlockModification/topLevelPropertyWithTypeInDelegate.txt @@ -1,6 +1,6 @@ BEFORE MODIFICATION: -public final [ResolvedTo(BODY_RESOLVE)] val x: R|kotlin/Int|by #( = [ResolvedTo(RAW_FIR)] lazy@fun (): R|kotlin/Int| { - local final [ResolvedTo(RAW_FIR)] fun doSmth([ResolvedTo(RAW_FIR)] i: R|kotlin/String|): R|kotlin/Int| { +public final [ResolvedTo(BODY_RESOLVE)] val x: R|kotlin/Int|by #( = [ResolvedTo(BODY_RESOLVE)] lazy@fun (): R|kotlin/Int| { + local final [ResolvedTo(BODY_RESOLVE)] fun doSmth([ResolvedTo(BODY_RESOLVE)] i: R|kotlin/String|): R|kotlin/Int| { ^doSmth Int(4) } diff --git a/analysis/low-level-api-fir/testdata/inBlockModification/topLevelPropertyWithTypeInDelegateWithoutName.txt b/analysis/low-level-api-fir/testdata/inBlockModification/topLevelPropertyWithTypeInDelegateWithoutName.txt index 68083d0f82f..2011a948564 100644 --- a/analysis/low-level-api-fir/testdata/inBlockModification/topLevelPropertyWithTypeInDelegateWithoutName.txt +++ b/analysis/low-level-api-fir/testdata/inBlockModification/topLevelPropertyWithTypeInDelegateWithoutName.txt @@ -1,6 +1,6 @@ BEFORE MODIFICATION: -public final [ResolvedTo(BODY_RESOLVE)] val : R|kotlin/Int|by #( = [ResolvedTo(RAW_FIR)] lazy@fun (): R|kotlin/Int| { - local final [ResolvedTo(RAW_FIR)] fun doSmth([ResolvedTo(RAW_FIR)] i: R|kotlin/String|): R|kotlin/Int| { +public final [ResolvedTo(BODY_RESOLVE)] val : R|kotlin/Int|by #( = [ResolvedTo(BODY_RESOLVE)] lazy@fun (): R|kotlin/Int| { + local final [ResolvedTo(BODY_RESOLVE)] fun doSmth([ResolvedTo(BODY_RESOLVE)] i: R|kotlin/String|): R|kotlin/Int| { ^doSmth Int(4) } diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/compilerRequiredAnnotationsOnPropertyDelegate.out_of_src_roots.txt b/analysis/low-level-api-fir/testdata/lazyResolve/compilerRequiredAnnotationsOnPropertyDelegate.out_of_src_roots.txt index 0b72c3945bb..8af69aa610d 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/compilerRequiredAnnotationsOnPropertyDelegate.out_of_src_roots.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/compilerRequiredAnnotationsOnPropertyDelegate.out_of_src_roots.txt @@ -210,7 +210,7 @@ FILE: [ResolvedTo(IMPORTS)] compilerRequiredAnnotationsOnPropertyDelegate.kt public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] get(): R|kotlin/String| } - field:@PROPERTY_DELEGATE_FIELD:R|kotlin/Deprecated|[Types](message = String(delegate)) @PROPERTY_DELEGATE_FIELD:R|Anno|[Types](s = String(delegate)) public final [ResolvedTo(BODY_RESOLVE)] val memberProperty: by #( = [ResolvedTo(RAW_FIR)] lazy@fun (): R|kotlin/String| { + field:@PROPERTY_DELEGATE_FIELD:R|kotlin/Deprecated|[Types](message = String(delegate)) @PROPERTY_DELEGATE_FIELD:R|Anno|[Types](s = String(delegate)) public final [ResolvedTo(BODY_RESOLVE)] val memberProperty: by #( = [ResolvedTo(BODY_RESOLVE)] lazy@fun (): R|kotlin/String| { ^ String(42) } ) @@ -229,7 +229,7 @@ FILE: [ResolvedTo(IMPORTS)] compilerRequiredAnnotationsOnPropertyDelegate.kt public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=Anno] get(): R|kotlin/String| } - field:@PROPERTY_DELEGATE_FIELD:R|kotlin/Deprecated|[Types](message = String(delegate)) @PROPERTY_DELEGATE_FIELD:R|Anno|[Types](s = String(delegate)) public final [ResolvedTo(BODY_RESOLVE)] val memberProperty: by #( = [ResolvedTo(RAW_FIR)] lazy@fun (): R|kotlin/String| { + field:@PROPERTY_DELEGATE_FIELD:R|kotlin/Deprecated|[Types](message = String(delegate)) @PROPERTY_DELEGATE_FIELD:R|Anno|[Types](s = String(delegate)) public final [ResolvedTo(BODY_RESOLVE)] val memberProperty: by #( = [ResolvedTo(BODY_RESOLVE)] lazy@fun (): R|kotlin/String| { ^ String(42) } ) diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/compilerRequiredAnnotationsOnPropertyDelegate.txt b/analysis/low-level-api-fir/testdata/lazyResolve/compilerRequiredAnnotationsOnPropertyDelegate.txt index e445db3f6c8..c9a8de8ef48 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/compilerRequiredAnnotationsOnPropertyDelegate.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/compilerRequiredAnnotationsOnPropertyDelegate.txt @@ -210,7 +210,7 @@ FILE: [ResolvedTo(IMPORTS)] compilerRequiredAnnotationsOnPropertyDelegate.kt public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] get(): R|kotlin/String| } - field:@PROPERTY_DELEGATE_FIELD:R|kotlin/Deprecated|[Types](message = String(delegate)) @PROPERTY_DELEGATE_FIELD:R|Anno|[Types](s = String(delegate)) public final [ResolvedTo(BODY_RESOLVE)] val memberProperty: R|kotlin/String|by R|kotlin/lazy|( = [ResolvedTo(RAW_FIR)] [MatchingParameterFunctionTypeKey=kotlin/Function0] lazy@fun (): R|kotlin/String| { + field:@PROPERTY_DELEGATE_FIELD:R|kotlin/Deprecated|[Types](message = String(delegate)) @PROPERTY_DELEGATE_FIELD:R|Anno|[Types](s = String(delegate)) public final [ResolvedTo(BODY_RESOLVE)] val memberProperty: R|kotlin/String|by R|kotlin/lazy|( = [ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=kotlin/Function0] lazy@fun (): R|kotlin/String| { ^ String(42) } ) @@ -229,7 +229,7 @@ FILE: [ResolvedTo(IMPORTS)] compilerRequiredAnnotationsOnPropertyDelegate.kt public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=Anno] get(): R|kotlin/String| } - field:@PROPERTY_DELEGATE_FIELD:R|kotlin/Deprecated|[Types](message = String(delegate)) @PROPERTY_DELEGATE_FIELD:R|Anno|[Types](s = String(delegate)) public final [ResolvedTo(BODY_RESOLVE)] val memberProperty: R|kotlin/String|by R|kotlin/lazy|( = [ResolvedTo(RAW_FIR)] [MatchingParameterFunctionTypeKey=kotlin/Function0] lazy@fun (): R|kotlin/String| { + field:@PROPERTY_DELEGATE_FIELD:R|kotlin/Deprecated|[Types](message = String(delegate)) @PROPERTY_DELEGATE_FIELD:R|Anno|[Types](s = String(delegate)) public final [ResolvedTo(BODY_RESOLVE)] val memberProperty: R|kotlin/String|by R|kotlin/lazy|( = [ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=kotlin/Function0] lazy@fun (): R|kotlin/String| { ^ String(42) } ) diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/compilerRequiredAnnotationsOnPropertyDelegateScript.txt b/analysis/low-level-api-fir/testdata/lazyResolve/compilerRequiredAnnotationsOnPropertyDelegateScript.txt index 07dfbad57f8..5ee7a766c89 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/compilerRequiredAnnotationsOnPropertyDelegateScript.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/compilerRequiredAnnotationsOnPropertyDelegateScript.txt @@ -314,7 +314,7 @@ FILE: [ResolvedTo(IMPORTS)] compilerRequiredAnnotationsOnPropertyDelegateScript. } - field:@PROPERTY_DELEGATE_FIELD:R|kotlin/Deprecated|[Types](message = String(delegate)) @PROPERTY_DELEGATE_FIELD:R|Anno|[Types](s = String(delegate)) public final [ResolvedTo(BODY_RESOLVE)] val memberProperty: R|kotlin/String|by R|kotlin/lazy|( = [ResolvedTo(RAW_FIR)] [MatchingParameterFunctionTypeKey=kotlin/Function0] lazy@fun (): R|kotlin/String| { + field:@PROPERTY_DELEGATE_FIELD:R|kotlin/Deprecated|[Types](message = String(delegate)) @PROPERTY_DELEGATE_FIELD:R|Anno|[Types](s = String(delegate)) public final [ResolvedTo(BODY_RESOLVE)] val memberProperty: R|kotlin/String|by R|kotlin/lazy|( = [ResolvedTo(BODY_RESOLVE)] [MatchingParameterFunctionTypeKey=kotlin/Function0] lazy@fun (): R|kotlin/String| { ^ String(42) } ) @@ -326,7 +326,7 @@ FILE: [ResolvedTo(IMPORTS)] compilerRequiredAnnotationsOnPropertyDelegateScript. FILE RAW TO BODY: FILE: [ResolvedTo(IMPORTS)] compilerRequiredAnnotationsOnPropertyDelegateScript.kts context(