From 210d5841a2e49a4f7501d826f487e4b5eba30bce Mon Sep 17 00:00:00 2001 From: Maxim Grankin Date: Sat, 7 Jan 2023 22:50:24 +0400 Subject: [PATCH] rebase and fix conflicts --- .../testData/resolve/cfg/selfTypes.kt | 1 + .../fir/resolve/calls/TypeArgumentMapping.kt | 14 ++----------- .../transformers/FirSupertypesResolution.kt | 20 ++++++------------- .../body/resolve/BodyResolveContext.kt | 2 +- ...FirSpecificAnnotationResolveTransformer.kt | 3 ++- ...erRequiredAnnotationsResolveTransformer.kt | 1 - .../declarations/FirCallableDeclaration.kt | 4 ++-- .../declarations/FirClassLikeDeclaration.kt | 4 ++-- .../kotlin/fir/declarations/FirFunction.kt | 4 ++-- .../fir/declarations/FirMemberDeclaration.kt | 4 ++-- .../declarations/impl/FirBackingFieldImpl.kt | 8 ++++---- .../impl/FirPropertyAccessorImpl.kt | 8 ++++---- .../impl/FirSimpleFunctionImpl.kt | 8 ++++---- .../kotlin/fir/tree/generator/model/Field.kt | 2 +- .../tree/generator/printer/implementation.kt | 17 ++++++++-------- .../box/fir/ControlFlowInfoSelfTypes.kt | 1 - .../codegen/box/fir/selfTypeBuilderTest.kt | 1 - .../testData/codegen/box/fir/selfTypes.kt | 1 - .../codegen/BlackBoxCodegenTestGenerated.java | 6 ------ .../LightAnalysisModeTestGenerated.java | 5 ----- .../js/test/JsCodegenBoxTestGenerated.java | 6 ------ .../test/ir/IrJsCodegenBoxTestGenerated.java | 6 ------ .../IrCodegenBoxWasmTestGenerated.java | 5 ----- .../NativeCodegenBoxTestGenerated.java | 6 ------ 24 files changed, 42 insertions(+), 95 deletions(-) diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/selfTypes.kt b/compiler/fir/analysis-tests/testData/resolve/cfg/selfTypes.kt index 21d67c25f951b..181cd11b06312 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/selfTypes.kt +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/selfTypes.kt @@ -1,3 +1,4 @@ +// FIR_DISABLE_LAZY_RESOLVE_CHECKS import kotlin.Self @Self diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/TypeArgumentMapping.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/TypeArgumentMapping.kt index 69a62e3c74600..f7856ac8ef27a 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/TypeArgumentMapping.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/TypeArgumentMapping.kt @@ -5,26 +5,16 @@ package org.jetbrains.kotlin.fir.resolve.calls -import org.jetbrains.kotlin.fir.declarations.FirCallableDeclaration -import org.jetbrains.kotlin.fir.declarations.FirDeclaration -import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin -import org.jetbrains.kotlin.fir.declarations.FirTypeParameterRefsOwner -import org.jetbrains.kotlin.fir.declarations.hasAnnotation +import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.resolve.providers.symbolProvider import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirConstructorSymbol import org.jetbrains.kotlin.fir.types.* -import org.jetbrains.kotlin.fir.types.ConeTypeIntersector -import org.jetbrains.kotlin.fir.types.FirTypeProjection import org.jetbrains.kotlin.fir.types.builder.buildPlaceholderProjection import org.jetbrains.kotlin.fir.types.builder.buildTypeProjectionWithVariance import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl import org.jetbrains.kotlin.name.StandardClassIds import org.jetbrains.kotlin.types.Variance -import org.jetbrains.kotlin.fir.types.builder.buildTypeProjectionWithVariance -import org.jetbrains.kotlin.fir.types.isRaw -import org.jetbrains.kotlin.fir.types.toFirResolvedTypeRef -import org.jetbrains.kotlin.types.Variance sealed class TypeArgumentMapping { abstract operator fun get(typeParameterIndex: Int): FirTypeProjection @@ -86,7 +76,7 @@ internal object MapTypeArguments : ResolutionStage() { if (classLikeSymbol != null) { val firClassSymbol = classLikeSymbol as FirClassSymbol - val isSelf = firClassSymbol.hasAnnotation(StandardClassIds.Annotations.Self) + val isSelf = firClassSymbol.hasAnnotation(StandardClassIds.Annotations.Self, context.session) if (isSelf && callInfo.callKind is CallKind.Function) { val constructorTypeParametersSize = firConstructorSymbol.typeParameterSymbols.size diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirSupertypesResolution.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirSupertypesResolution.kt index 8804d2c147d8c..29de6d5ee0054 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirSupertypesResolution.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirSupertypesResolution.kt @@ -10,38 +10,32 @@ import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.toPersistentList import org.jetbrains.kotlin.KtFakeSourceElementKind import org.jetbrains.kotlin.fakeElement -import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.fir.* import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.builder.FirTypeParameterBuilder import org.jetbrains.kotlin.fir.declarations.utils.classId import org.jetbrains.kotlin.fir.declarations.utils.expandedConeType import org.jetbrains.kotlin.fir.declarations.utils.isCompanion -import org.jetbrains.kotlin.fir.declarations.utils.isData import org.jetbrains.kotlin.fir.declarations.utils.superConeTypes import org.jetbrains.kotlin.fir.diagnostics.ConeSimpleDiagnostic import org.jetbrains.kotlin.fir.diagnostics.DiagnosticKind -import org.jetbrains.kotlin.fir.expressions.FirDelegatedConstructorCall import org.jetbrains.kotlin.fir.expressions.FirStatement import org.jetbrains.kotlin.fir.extensions.FirSupertypeGenerationExtension import org.jetbrains.kotlin.fir.extensions.extensionService import org.jetbrains.kotlin.fir.extensions.supertypeGenerators -import org.jetbrains.kotlin.fir.references.builder.buildResolvedNamedReference import org.jetbrains.kotlin.fir.resolve.* import org.jetbrains.kotlin.fir.resolve.dfa.cfg.isLocalClassOrAnonymousObject import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeTypeParameterSupertype import org.jetbrains.kotlin.fir.resolve.providers.firProvider import org.jetbrains.kotlin.fir.resolve.providers.symbolProvider import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.LocalClassesNavigationInfo -import org.jetbrains.kotlin.fir.scopes.* +import org.jetbrains.kotlin.fir.scopes.FirScope +import org.jetbrains.kotlin.fir.scopes.createImportingScopes +import org.jetbrains.kotlin.fir.scopes.getNestedClassifierScope import org.jetbrains.kotlin.fir.scopes.impl.FirMemberTypeParameterScope import org.jetbrains.kotlin.fir.scopes.impl.FirSelfTypeScope import org.jetbrains.kotlin.fir.scopes.impl.nestedClassifierScope import org.jetbrains.kotlin.fir.scopes.impl.wrapNestedClassifierScopeWithSubstitutionForSuperType -import org.jetbrains.kotlin.fir.symbols.impl.FirClassLikeSymbol -import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol -import org.jetbrains.kotlin.fir.symbols.impl.FirTypeAliasSymbol -import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase import org.jetbrains.kotlin.fir.symbols.ConeTypeParameterLookupTag import org.jetbrains.kotlin.fir.symbols.impl.* import org.jetbrains.kotlin.fir.types.* @@ -52,12 +46,10 @@ import org.jetbrains.kotlin.fir.types.impl.FirImplicitBuiltinTypeRef import org.jetbrains.kotlin.fir.visitors.FirDefaultTransformer import org.jetbrains.kotlin.fir.visitors.FirDefaultVisitor import org.jetbrains.kotlin.fir.visitors.FirTransformer -import org.jetbrains.kotlin.fir.visitors.transformSingle import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.SpecialNames import org.jetbrains.kotlin.name.StandardClassIds import org.jetbrains.kotlin.types.Variance -import org.jetbrains.kotlin.name.StandardClassIds import org.jetbrains.kotlin.types.model.TypeArgumentMarker import org.jetbrains.kotlin.utils.addIfNotNull @@ -382,7 +374,7 @@ open class FirSupertypeResolverVisitor( @OptIn(PrivateForInline::class) val resolvedTypesRefs = transformer.withFile(useSiteFile) { - addSelfToTypeParameters(classLikeDeclaration) + addSelfToTypeParameters(classLikeDeclaration, session) val scopes = prepareScopes(classLikeDeclaration) resolveSuperTypeRefs( transformer, @@ -456,8 +448,8 @@ open class FirSupertypeResolverVisitor( } } - private fun addSelfToTypeParameters(firClass: FirClassLikeDeclaration) { - val isSelf = firClass.getAnnotationByClassId(StandardClassIds.Annotations.Self) != null + private fun addSelfToTypeParameters(firClass: FirClassLikeDeclaration, session: FirSession) { + val isSelf = firClass.getAnnotationByClassId(StandardClassIds.Annotations.Self, session) != null val params = firClass.typeParameters if (params is MutableList && isSelf) { val selfSymbol = FirTypeParameterSymbol() diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/BodyResolveContext.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/BodyResolveContext.kt index 407aa95e4ccb9..798e5f2c34390 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/BodyResolveContext.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/BodyResolveContext.kt @@ -444,7 +444,7 @@ class BodyResolveContext( val typeParameterScope = (owner as? FirRegularClass)?.typeParameterScope() val selfTypeScope: FirSelfTypeScope? = - if (owner.hasAnnotation(StandardClassIds.Annotations.Self)) { + if (owner.hasAnnotation(StandardClassIds.Annotations.Self, holder.session)) { FirSelfTypeScope(owner) } else null diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/AbstractFirSpecificAnnotationResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/AbstractFirSpecificAnnotationResolveTransformer.kt index fac56d4b84fc6..45848d0152738 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/AbstractFirSpecificAnnotationResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/AbstractFirSpecificAnnotationResolveTransformer.kt @@ -40,6 +40,7 @@ import org.jetbrains.kotlin.name.StandardClassIds.Annotations.Deprecated import org.jetbrains.kotlin.name.StandardClassIds.Annotations.DeprecatedSinceKotlin import org.jetbrains.kotlin.name.StandardClassIds.Annotations.JvmRecord import org.jetbrains.kotlin.name.StandardClassIds.Annotations.WasExperimental +import org.jetbrains.kotlin.name.StandardClassIds.Annotations.Self import org.jetbrains.kotlin.utils.addToStdlib.shouldNotBeCalled internal abstract class AbstractFirSpecificAnnotationResolveTransformer( @@ -48,7 +49,7 @@ internal abstract class AbstractFirSpecificAnnotationResolveTransformer( protected val computationSession: CompilerRequiredAnnotationsComputationSession ) : FirDefaultTransformer() { companion object { - private val REQUIRED_ANNOTATIONS: Set = setOf(Deprecated, DeprecatedSinceKotlin, WasExperimental, JvmRecord) + private val REQUIRED_ANNOTATIONS: Set = setOf(Deprecated, DeprecatedSinceKotlin, WasExperimental, JvmRecord, Self) private val REQUIRED_ANNOTATION_NAMES: Set = REQUIRED_ANNOTATIONS.mapTo(mutableSetOf()) { it.shortClassName } } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/FirCompilerRequiredAnnotationsResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/FirCompilerRequiredAnnotationsResolveTransformer.kt index 24b502de1a684..16c3e3943b2b1 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/FirCompilerRequiredAnnotationsResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/FirCompilerRequiredAnnotationsResolveTransformer.kt @@ -23,7 +23,6 @@ import org.jetbrains.kotlin.name.StandardClassIds.Annotations.Deprecated import org.jetbrains.kotlin.name.StandardClassIds.Annotations.DeprecatedSinceKotlin import org.jetbrains.kotlin.name.StandardClassIds.Annotations.JvmRecord import org.jetbrains.kotlin.name.StandardClassIds.Annotations.WasExperimental -import org.jetbrains.kotlin.name.StandardClassIds.Annotations.Self class FirCompilerRequiredAnnotationsResolveProcessor( session: FirSession, diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/FirCallableDeclaration.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/FirCallableDeclaration.kt index cf739bc3e1442..50eb172f1aaee 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/FirCallableDeclaration.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/FirCallableDeclaration.kt @@ -45,10 +45,10 @@ sealed class FirCallableDeclaration : FirMemberDeclaration() { abstract override fun replaceResolvePhase(newResolvePhase: FirResolvePhase) - abstract override fun replaceTypeParameters(newTypeParameters: List) - abstract override fun replaceAnnotations(newAnnotations: List) + abstract override fun replaceTypeParameters(newTypeParameters: List) + abstract fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef) abstract fun replaceReceiverParameter(newReceiverParameter: FirReceiverParameter?) diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/FirClassLikeDeclaration.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/FirClassLikeDeclaration.kt index 83dcd03d19c5a..f44f055ba858a 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/FirClassLikeDeclaration.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/FirClassLikeDeclaration.kt @@ -38,10 +38,10 @@ sealed class FirClassLikeDeclaration : FirMemberDeclaration(), FirStatement { abstract override fun replaceResolvePhase(newResolvePhase: FirResolvePhase) - abstract override fun replaceTypeParameters(newTypeParameters: List) - abstract override fun replaceAnnotations(newAnnotations: List) + abstract override fun replaceTypeParameters(newTypeParameters: List) + abstract fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider) abstract override fun transformAnnotations(transformer: FirTransformer, data: D): FirClassLikeDeclaration diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/FirFunction.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/FirFunction.kt index 36d8fa00351ce..3bd9e6ec409a1 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/FirFunction.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/FirFunction.kt @@ -52,10 +52,10 @@ sealed class FirFunction : FirCallableDeclaration(), FirTargetElement, FirContro abstract override fun replaceResolvePhase(newResolvePhase: FirResolvePhase) - abstract override fun replaceTypeParameters(newTypeParameters: List) - abstract override fun replaceAnnotations(newAnnotations: List) + abstract override fun replaceTypeParameters(newTypeParameters: List) + abstract override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef) abstract override fun replaceReceiverParameter(newReceiverParameter: FirReceiverParameter?) diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/FirMemberDeclaration.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/FirMemberDeclaration.kt index 782d146e48838..53a4e2be38310 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/FirMemberDeclaration.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/FirMemberDeclaration.kt @@ -36,10 +36,10 @@ sealed class FirMemberDeclaration : FirDeclaration(), FirTypeParameterRefsOwner abstract override fun replaceResolvePhase(newResolvePhase: FirResolvePhase) - abstract override fun replaceTypeParameters(newTypeParameters: List) - abstract override fun replaceAnnotations(newAnnotations: List) + abstract override fun replaceTypeParameters(newTypeParameters: List) + abstract override fun transformAnnotations(transformer: FirTransformer, data: D): FirMemberDeclaration abstract override fun transformTypeParameters(transformer: FirTransformer, data: D): FirMemberDeclaration diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirBackingFieldImpl.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirBackingFieldImpl.kt index 85f7f93685ed3..3af60be14f9c0 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirBackingFieldImpl.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirBackingFieldImpl.kt @@ -185,13 +185,13 @@ open class FirBackingFieldImpl @FirImplementationDetail constructor( initializer = newInitializer } + override fun replaceAnnotations(newAnnotations: List) { + annotations = newAnnotations.toMutableOrEmpty() + } + override fun replaceTypeParameters(newTypeParameters: List) { require(newTypeParameters.all { it is FirTypeParameter }) typeParameters.clear() typeParameters.addAll(newTypeParameters.map { it as FirTypeParameter }) } - - override fun replaceAnnotations(newAnnotations: List) { - annotations = newAnnotations.toMutableOrEmpty() - } } diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirPropertyAccessorImpl.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirPropertyAccessorImpl.kt index 2fce5ae51b698..3bfaa7fa20002 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirPropertyAccessorImpl.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirPropertyAccessorImpl.kt @@ -169,13 +169,13 @@ open class FirPropertyAccessorImpl @FirImplementationDetail constructor( contractDescription = newContractDescription } + override fun replaceAnnotations(newAnnotations: List) { + annotations = newAnnotations.toMutableOrEmpty() + } + override fun replaceTypeParameters(newTypeParameters: List) { require(newTypeParameters.all { it is FirTypeParameter }) typeParameters.clear() typeParameters.addAll(newTypeParameters.map { it as FirTypeParameter }) } - - override fun replaceAnnotations(newAnnotations: List) { - annotations = newAnnotations.toMutableOrEmpty() - } } diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirSimpleFunctionImpl.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirSimpleFunctionImpl.kt index 3757138ec9734..28397b2b0ce5f 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirSimpleFunctionImpl.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirSimpleFunctionImpl.kt @@ -170,13 +170,13 @@ internal class FirSimpleFunctionImpl( contractDescription = newContractDescription } + override fun replaceAnnotations(newAnnotations: List) { + annotations = newAnnotations.toMutableOrEmpty() + } + override fun replaceTypeParameters(newTypeParameters: List) { require(newTypeParameters.all { it is FirTypeParameter }) typeParameters.clear() typeParameters.addAll(newTypeParameters.map { it as FirTypeParameter }) } - - override fun replaceAnnotations(newAnnotations: List) { - annotations = newAnnotations.toMutableOrEmpty() - } } diff --git a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/model/Field.kt b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/model/Field.kt index ac5eead596835..b349cb3786705 100644 --- a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/model/Field.kt +++ b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/model/Field.kt @@ -206,7 +206,7 @@ class FieldList( override val name: String, val baseType: Importable, override var withReplace: Boolean, - override val overrideTypeRequire: Boolean, + override val overrideTypeRequire: Boolean = true, useMutableOrEmpty: Boolean = false ) : Field() { override var defaultValueInImplementation: String? = null diff --git a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/printer/implementation.kt b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/printer/implementation.kt index a1ba3efa8b0c6..c8b47ad3a554f 100644 --- a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/printer/implementation.kt +++ b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/printer/implementation.kt @@ -353,15 +353,16 @@ fun SmartPrinter.printImplementation(implementation: Implementation) { println("${field.name}.addAll($newValue)") } - else -> { - if (field.useNullableForReplace) { - println("require($newValue != null)") - } - print("${field.name} = $newValue") - if (field.origin is FieldList && field.isMutableOrEmpty) { - print(".toMutableOrEmpty()") + else -> { + if (field.useNullableForReplace) { + println("require($newValue != null)") + } + print("${field.name} = $newValue") + if (field.origin is FieldList && field.isMutableOrEmpty) { + print(".toMutableOrEmpty()") + } + println() } - println() } } } diff --git a/compiler/testData/codegen/box/fir/ControlFlowInfoSelfTypes.kt b/compiler/testData/codegen/box/fir/ControlFlowInfoSelfTypes.kt index 99d3ec1ea104d..7cc5f078c6ff3 100644 --- a/compiler/testData/codegen/box/fir/ControlFlowInfoSelfTypes.kt +++ b/compiler/testData/codegen/box/fir/ControlFlowInfoSelfTypes.kt @@ -1,5 +1,4 @@ // TARGET_BACKEND: JVM_IR -// IGNORE_BACKEND: JVM_IR // WITH_STDLIB diff --git a/compiler/testData/codegen/box/fir/selfTypeBuilderTest.kt b/compiler/testData/codegen/box/fir/selfTypeBuilderTest.kt index 7910dec1cc6d2..5300890abb2ed 100644 --- a/compiler/testData/codegen/box/fir/selfTypeBuilderTest.kt +++ b/compiler/testData/codegen/box/fir/selfTypeBuilderTest.kt @@ -1,5 +1,4 @@ // TARGET_BACKEND: JVM_IR -// IGNORE_BACKEND: JVM_IR // WITH_STDLIB diff --git a/compiler/testData/codegen/box/fir/selfTypes.kt b/compiler/testData/codegen/box/fir/selfTypes.kt index f6c8a274d13ca..f7528ba14514b 100644 --- a/compiler/testData/codegen/box/fir/selfTypes.kt +++ b/compiler/testData/codegen/box/fir/selfTypes.kt @@ -1,5 +1,4 @@ // TARGET_BACKEND: JVM_IR -// IGNORE_BACKEND: JVM_IR // WITH_STDLIB diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index 2f2deaf865ae1..e79df87a1064a 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -17479,12 +17479,6 @@ public void testConstValAccess() throws Exception { runTest("compiler/testData/codegen/box/fir/ConstValAccess.kt"); } - @Test - @TestMetadata("ControlFlowInfoSelfTypes.kt") - public void testControlFlowInfoSelfTypes() throws Exception { - runTest("compiler/testData/codegen/box/fir/ControlFlowInfoSelfTypes.kt"); - } - @Test @TestMetadata("differentSinceKotlin.kt") public void testDifferentSinceKotlin() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 1daf43c174fe4..666be14d5f3f4 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -14488,11 +14488,6 @@ public void testConstValAccess() throws Exception { runTest("compiler/testData/codegen/box/fir/ConstValAccess.kt"); } - @TestMetadata("ControlFlowInfoSelfTypes.kt") - public void testControlFlowInfoSelfTypes() throws Exception { - runTest("compiler/testData/codegen/box/fir/ControlFlowInfoSelfTypes.kt"); - } - @TestMetadata("differentSinceKotlin.kt") public void testDifferentSinceKotlin() throws Exception { runTest("compiler/testData/codegen/box/fir/differentSinceKotlin.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java index 93e75bf50b33a..74a37e8138843 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java @@ -13509,12 +13509,6 @@ public void testClassCanNotBeCastedToVoid() throws Exception { runTest("compiler/testData/codegen/box/fir/classCanNotBeCastedToVoid.kt"); } - @Test - @TestMetadata("ControlFlowInfoSelfTypes.kt") - public void testControlFlowInfoSelfTypes() throws Exception { - runTest("compiler/testData/codegen/box/fir/ControlFlowInfoSelfTypes.kt"); - } - @Test @TestMetadata("falsePositiveBoundSmartcast.kt") public void testFalsePositiveBoundSmartcast() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java index 6e99eb17bc339..f817699886e19 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java @@ -13605,12 +13605,6 @@ public void testClassCanNotBeCastedToVoid() throws Exception { runTest("compiler/testData/codegen/box/fir/classCanNotBeCastedToVoid.kt"); } - @Test - @TestMetadata("ControlFlowInfoSelfTypes.kt") - public void testControlFlowInfoSelfTypes() throws Exception { - runTest("compiler/testData/codegen/box/fir/ControlFlowInfoSelfTypes.kt"); - } - @Test @TestMetadata("falsePositiveBoundSmartcast.kt") public void testFalsePositiveBoundSmartcast() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index a1931054699e3..6d16196e87bd5 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -12083,11 +12083,6 @@ public void testClassCanNotBeCastedToVoid() throws Exception { runTest("compiler/testData/codegen/box/fir/classCanNotBeCastedToVoid.kt"); } - @TestMetadata("ControlFlowInfoSelfTypes.kt") - public void testControlFlowInfoSelfTypes() throws Exception { - runTest("compiler/testData/codegen/box/fir/ControlFlowInfoSelfTypes.kt"); - } - @TestMetadata("falsePositiveBoundSmartcast.kt") public void testFalsePositiveBoundSmartcast() throws Exception { runTest("compiler/testData/codegen/box/fir/falsePositiveBoundSmartcast.kt"); diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java index 85253d9570a44..21b2f65e3a336 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java @@ -14641,12 +14641,6 @@ public void testClassCanNotBeCastedToVoid() throws Exception { runTest("compiler/testData/codegen/box/fir/classCanNotBeCastedToVoid.kt"); } - @Test - @TestMetadata("ControlFlowInfoSelfTypes.kt") - public void testControlFlowInfoSelfTypes() throws Exception { - runTest("compiler/testData/codegen/box/fir/ControlFlowInfoSelfTypes.kt"); - } - @Test @TestMetadata("falsePositiveBoundSmartcast.kt") public void testFalsePositiveBoundSmartcast() throws Exception {