From 22938522b3dd1623873d8bbcfd14b0e329e5bc7d Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Fri, 9 Jul 2021 11:46:07 +0300 Subject: [PATCH] [FIR] Add forgotten updating phase of value parameters --- .../FirStatusResolveTransformer.kt | 2 ++ .../transformers/FirTypeResolveTransformer.kt | 3 +++ .../FirDeclarationsResolveTransformer.kt | 1 + .../diagnostics/notLinked/dfa/pos/49.fir.kt | 1 - .../testdata/lazyResolve/delegates.txt | 8 ++++---- .../lazyResolve/parameterOfNonLocalSetter.txt | 20 +++++++++---------- .../propertyWithGetterAndSetter.txt | 8 ++++---- .../lazyResolve/typeParameterOfTopSetter.txt | 20 +++++++++---------- 8 files changed, 34 insertions(+), 29 deletions(-) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirStatusResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirStatusResolveTransformer.kt index d4e1a68f193..a9825b2e6a5 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirStatusResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirStatusResolveTransformer.kt @@ -464,6 +464,8 @@ abstract class AbstractFirStatusResolveTransformer( if (needReplacePhase(propertyAccessor)) { propertyAccessor.replaceResolvePhase(transformerPhase) } + + propertyAccessor.transformValueParameters(this, null) } override fun transformConstructor( diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirTypeResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirTypeResolveTransformer.kt index cb50e6f1af6..80259519768 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirTypeResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirTypeResolveTransformer.kt @@ -110,6 +110,9 @@ open class FirTypeResolveTransformer( property.replaceResolvePhase(FirResolvePhase.TYPES) property.getter?.replaceResolvePhase(FirResolvePhase.TYPES) property.setter?.replaceResolvePhase(FirResolvePhase.TYPES) + property.setter?.valueParameters?.forEach { + it.replaceResolvePhase(FirResolvePhase.TYPES) + } } property.transformTypeParameters(this, data) .transformReturnTypeRef(this, data) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt index 2e02a44d02a..17ce9e2c442 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt @@ -89,6 +89,7 @@ open class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransfor callableMember.valueParameters.forEach { it.transformReturnTypeRef(transformer, ResolutionMode.ContextIndependent) it.transformVarargTypeToArrayType() + it.replaceResolvePhase(FirResolvePhase.STATUS) } } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/49.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/49.fir.kt index 836af86d6bd..31a712b525e 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/49.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/49.fir.kt @@ -1,4 +1,3 @@ -// FIR_IDE_IGNORE // !LANGUAGE: +NewInference // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE // SKIP_TXT diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/delegates.txt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/delegates.txt index ce76db26272..9a0a60fe199 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/delegates.txt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/delegates.txt @@ -372,7 +372,7 @@ FILE: delegates.kt [STATUS] public get(): { ^ D|/variableWithExplicitType|.getValue#(Null(null), ::R|/variableWithExplicitType|) } - [STATUS] public set([RAW_FIR] : ): R|kotlin/Unit| { + [STATUS] public set([STATUS] : ): R|kotlin/Unit| { D|/variableWithExplicitType|.setValue#(Null(null), ::R|/variableWithExplicitType|, R|/variableWithExplicitType|) } public final [BODY_RESOLVE] [ResolvePhaseWithForAllDeclarationsKey=STATUS] var variableWithImplicitType: R|kotlin/Int|by R|/delegate| @@ -468,7 +468,7 @@ FILE: delegates.kt [STATUS] public get(): { ^ D|/variableWithExplicitType|.getValue#(Null(null), ::R|/variableWithExplicitType|) } - [STATUS] public set([RAW_FIR] : ): R|kotlin/Unit| { + [STATUS] public set([STATUS] : ): R|kotlin/Unit| { D|/variableWithExplicitType|.setValue#(Null(null), ::R|/variableWithExplicitType|, R|/variableWithExplicitType|) } public final [BODY_RESOLVE] [ResolvePhaseWithForAllDeclarationsKey=STATUS] var variableWithImplicitType: R|kotlin/Int|by R|/delegate| @@ -516,7 +516,7 @@ FILE: delegates.kt [STATUS] public get(): { ^ D|/variableWithExplicitType|.getValue#(Null(null), ::R|/variableWithExplicitType|) } - [STATUS] public set([RAW_FIR] : ): R|kotlin/Unit| { + [STATUS] public set([STATUS] : ): R|kotlin/Unit| { D|/variableWithExplicitType|.setValue#(Null(null), ::R|/variableWithExplicitType|, R|/variableWithExplicitType|) } public final [BODY_RESOLVE] [ResolvePhaseWithForAllDeclarationsKey=STATUS] var variableWithImplicitType: R|kotlin/Int|by R|/delegate| @@ -660,7 +660,7 @@ FILE: delegates.kt [STATUS] public get(): { ^ D|/variableWithExplicitType|.getValue#(Null(null), ::R|/variableWithExplicitType|) } - [STATUS] public set([RAW_FIR] : ): R|kotlin/Unit| { + [STATUS] public set([STATUS] : ): R|kotlin/Unit| { D|/variableWithExplicitType|.setValue#(Null(null), ::R|/variableWithExplicitType|, R|/variableWithExplicitType|) } public final [BODY_RESOLVE] [ResolvePhaseWithForAllDeclarationsKey=STATUS] var variableWithImplicitType: R|kotlin/Int|by R|/delegate| diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/parameterOfNonLocalSetter.txt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/parameterOfNonLocalSetter.txt index a61f5a3d9b2..2238070e5f4 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/parameterOfNonLocalSetter.txt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/parameterOfNonLocalSetter.txt @@ -52,7 +52,7 @@ FILE: parameterOfNonLocalSetter.kt public? final? [TYPES] [ResolvePhaseWithForAllDeclarationsKey=TYPES] var x: R|kotlin/Int| = IntegerLiteral(2) [TYPES] [ContainingClassKey=X] public? get(): R|kotlin/Int| - [TYPES] [ContainingClassKey=X] public? set([RAW_FIR] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { + [TYPES] [ContainingClassKey=X] public? set([TYPES] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { ^ Unit# } @@ -67,7 +67,7 @@ FILE: parameterOfNonLocalSetter.kt public final [STATUS] [ResolvePhaseWithForAllDeclarationsKey=STATUS] var x: R|kotlin/Int| = IntegerLiteral(2) [BODY_RESOLVE] [ContainingClassKey=X] public get(): R|kotlin/Int| - [STATUS] [ContainingClassKey=X] public set([RAW_FIR] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { + [STATUS] [ContainingClassKey=X] public set([STATUS] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { ^ Unit# } @@ -82,7 +82,7 @@ FILE: parameterOfNonLocalSetter.kt public final [CONTRACTS] [ResolvePhaseWithForAllDeclarationsKey=CONTRACTS] var x: R|kotlin/Int| = IntegerLiteral(2) [BODY_RESOLVE] [ContainingClassKey=X] public get(): R|kotlin/Int| - [CONTRACTS] [ContainingClassKey=X] public set([RAW_FIR] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { + [CONTRACTS] [ContainingClassKey=X] public set([STATUS] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { ^ Unit# } @@ -97,7 +97,7 @@ FILE: parameterOfNonLocalSetter.kt public final [CONTRACTS] [ResolvePhaseWithForAllDeclarationsKey=IMPLICIT_TYPES_BODY_RESOLVE] var x: R|kotlin/Int| = IntegerLiteral(2) [BODY_RESOLVE] [ContainingClassKey=X] public get(): R|kotlin/Int| - [CONTRACTS] [ContainingClassKey=X] public set([RAW_FIR] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { + [CONTRACTS] [ContainingClassKey=X] public set([STATUS] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { ^ Unit# } @@ -172,7 +172,7 @@ FILE: parameterOfNonLocalSetter.kt public? final? [TYPES] [ResolvePhaseWithForAllDeclarationsKey=TYPES] var x: R|kotlin/Int| = IntegerLiteral(2) [TYPES] [ContainingClassKey=X] public? get(): R|kotlin/Int| - [TYPES] [ContainingClassKey=X] public? set([RAW_FIR] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { + [TYPES] [ContainingClassKey=X] public? set([TYPES] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { ^ Unit# } @@ -187,7 +187,7 @@ FILE: parameterOfNonLocalSetter.kt public? final? [TYPES] [ResolvePhaseWithForAllDeclarationsKey=TYPES] var x: R|kotlin/Int| = IntegerLiteral(2) [TYPES] [ContainingClassKey=X] public? get(): R|kotlin/Int| - [TYPES] [ContainingClassKey=X] public? set([RAW_FIR] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { + [TYPES] [ContainingClassKey=X] public? set([TYPES] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { ^ Unit# } @@ -217,7 +217,7 @@ FILE: parameterOfNonLocalSetter.kt public final [CONTRACTS] [ResolvePhaseWithForAllDeclarationsKey=CONTRACTS] var x: R|kotlin/Int| = IntegerLiteral(2) [BODY_RESOLVE] [ContainingClassKey=X] public get(): R|kotlin/Int| - [CONTRACTS] [ContainingClassKey=X] public set([RAW_FIR] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { + [CONTRACTS] [ContainingClassKey=X] public set([STATUS] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { ^ Unit# } @@ -232,7 +232,7 @@ FILE: parameterOfNonLocalSetter.kt public final [STATUS] [ResolvePhaseWithForAllDeclarationsKey=STATUS] var x: R|kotlin/Int| = IntegerLiteral(2) [BODY_RESOLVE] [ContainingClassKey=X] public get(): R|kotlin/Int| - [STATUS] [ContainingClassKey=X] public set([RAW_FIR] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { + [STATUS] [ContainingClassKey=X] public set([STATUS] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { ^ Unit# } @@ -247,7 +247,7 @@ FILE: parameterOfNonLocalSetter.kt public? final? [TYPES] [ResolvePhaseWithForAllDeclarationsKey=TYPES] var x: R|kotlin/Int| = IntegerLiteral(2) [TYPES] [ContainingClassKey=X] public? get(): R|kotlin/Int| - [TYPES] [ContainingClassKey=X] public? set([RAW_FIR] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { + [TYPES] [ContainingClassKey=X] public? set([TYPES] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { ^ Unit# } @@ -262,7 +262,7 @@ FILE: parameterOfNonLocalSetter.kt public? final? [TYPES] [ResolvePhaseWithForAllDeclarationsKey=TYPES] var x: R|kotlin/Int| = IntegerLiteral(2) [TYPES] [ContainingClassKey=X] public? get(): R|kotlin/Int| - [TYPES] [ContainingClassKey=X] public? set([RAW_FIR] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { + [TYPES] [ContainingClassKey=X] public? set([TYPES] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { ^ Unit# } diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/propertyWithGetterAndSetter.txt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/propertyWithGetterAndSetter.txt index cae9a57e1f8..468cbfee4de 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/propertyWithGetterAndSetter.txt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/propertyWithGetterAndSetter.txt @@ -123,7 +123,7 @@ FILE: propertyWithGetterAndSetter.kt [STATUS] public get(): R|kotlin/Int| { ^ field# } - [STATUS] public set([RAW_FIR] value: R|kotlin/Int|): R|kotlin/Unit| { + [STATUS] public set([STATUS] value: R|kotlin/Int|): R|kotlin/Unit| { field# = value# } @@ -155,7 +155,7 @@ FILE: propertyWithGetterAndSetter.kt [STATUS] public get(): R|kotlin/Int| { ^ field# } - [STATUS] public set([RAW_FIR] value: R|kotlin/Int|): R|kotlin/Unit| { + [STATUS] public set([STATUS] value: R|kotlin/Int|): R|kotlin/Unit| { field# = value# } @@ -171,7 +171,7 @@ FILE: propertyWithGetterAndSetter.kt [STATUS] public get(): R|kotlin/Int| { ^ field# } - [STATUS] public set([RAW_FIR] value: R|kotlin/Int|): R|kotlin/Unit| { + [STATUS] public set([STATUS] value: R|kotlin/Int|): R|kotlin/Unit| { field# = value# } @@ -219,7 +219,7 @@ FILE: propertyWithGetterAndSetter.kt [STATUS] public get(): R|kotlin/Int| { ^ field# } - [STATUS] public set([RAW_FIR] value: R|kotlin/Int|): R|kotlin/Unit| { + [STATUS] public set([STATUS] value: R|kotlin/Int|): R|kotlin/Unit| { field# = value# } diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/typeParameterOfTopSetter.txt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/typeParameterOfTopSetter.txt index a3e594bddeb..d4433b5eb45 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/typeParameterOfTopSetter.txt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/typeParameterOfTopSetter.txt @@ -26,7 +26,7 @@ TYPES: FILE: typeParameterOfTopSetter.kt public? final? [TYPES] [ResolvePhaseWithForAllDeclarationsKey=TYPES] var x: R|kotlin/Int| = IntegerLiteral(2) [TYPES] public? get(): R|kotlin/Int| - [TYPES] public? set([RAW_FIR] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { + [TYPES] public? set([TYPES] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { ^ Unit# } @@ -34,7 +34,7 @@ STATUS: FILE: typeParameterOfTopSetter.kt public final [STATUS] [ResolvePhaseWithForAllDeclarationsKey=STATUS] var x: R|kotlin/Int| = IntegerLiteral(2) [BODY_RESOLVE] public get(): R|kotlin/Int| - [STATUS] public set([RAW_FIR] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { + [STATUS] public set([STATUS] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { ^ Unit# } @@ -42,7 +42,7 @@ CONTRACTS: FILE: typeParameterOfTopSetter.kt public final [CONTRACTS] [ResolvePhaseWithForAllDeclarationsKey=CONTRACTS] var x: R|kotlin/Int| = IntegerLiteral(2) [BODY_RESOLVE] public get(): R|kotlin/Int| - [CONTRACTS] public set([RAW_FIR] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { + [CONTRACTS] public set([STATUS] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { ^ Unit# } @@ -50,7 +50,7 @@ IMPLICIT_TYPES_BODY_RESOLVE: FILE: typeParameterOfTopSetter.kt public final [CONTRACTS] [ResolvePhaseWithForAllDeclarationsKey=IMPLICIT_TYPES_BODY_RESOLVE] var x: R|kotlin/Int| = IntegerLiteral(2) [BODY_RESOLVE] public get(): R|kotlin/Int| - [CONTRACTS] public set([RAW_FIR] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { + [CONTRACTS] public set([STATUS] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { ^ Unit# } @@ -90,7 +90,7 @@ CallableReturnType: FILE: typeParameterOfTopSetter.kt public? final? [TYPES] [ResolvePhaseWithForAllDeclarationsKey=TYPES] var x: R|kotlin/Int| = IntegerLiteral(2) [TYPES] public? get(): R|kotlin/Int| - [TYPES] public? set([RAW_FIR] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { + [TYPES] public? set([TYPES] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { ^ Unit# } @@ -98,7 +98,7 @@ AnnotationType: FILE: typeParameterOfTopSetter.kt public? final? [TYPES] [ResolvePhaseWithForAllDeclarationsKey=TYPES] var x: R|kotlin/Int| = IntegerLiteral(2) [TYPES] public? get(): R|kotlin/Int| - [TYPES] public? set([RAW_FIR] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { + [TYPES] public? set([TYPES] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { ^ Unit# } @@ -114,7 +114,7 @@ CallableContracts: FILE: typeParameterOfTopSetter.kt public final [CONTRACTS] [ResolvePhaseWithForAllDeclarationsKey=CONTRACTS] var x: R|kotlin/Int| = IntegerLiteral(2) [BODY_RESOLVE] public get(): R|kotlin/Int| - [CONTRACTS] public set([RAW_FIR] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { + [CONTRACTS] public set([STATUS] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { ^ Unit# } @@ -122,7 +122,7 @@ DeclarationStatus: FILE: typeParameterOfTopSetter.kt public final [STATUS] [ResolvePhaseWithForAllDeclarationsKey=STATUS] var x: R|kotlin/Int| = IntegerLiteral(2) [BODY_RESOLVE] public get(): R|kotlin/Int| - [STATUS] public set([RAW_FIR] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { + [STATUS] public set([STATUS] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { ^ Unit# } @@ -130,7 +130,7 @@ ValueParametersTypes: FILE: typeParameterOfTopSetter.kt public? final? [TYPES] [ResolvePhaseWithForAllDeclarationsKey=TYPES] var x: R|kotlin/Int| = IntegerLiteral(2) [TYPES] public? get(): R|kotlin/Int| - [TYPES] public? set([RAW_FIR] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { + [TYPES] public? set([TYPES] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { ^ Unit# } @@ -138,7 +138,7 @@ TypeParametersTypes: FILE: typeParameterOfTopSetter.kt public? final? [TYPES] [ResolvePhaseWithForAllDeclarationsKey=TYPES] var x: R|kotlin/Int| = IntegerLiteral(2) [TYPES] public? get(): R|kotlin/Int| - [TYPES] public? set([RAW_FIR] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { + [TYPES] public? set([TYPES] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { ^ Unit# }