diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt index 844cfe00604..ddc5fc3e414 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt @@ -108,7 +108,7 @@ class GenerationState private constructor( fun wantsDiagnostics(v: Boolean) = apply { wantsDiagnostics = v } - var jvmBackendClassResolver: JvmBackendClassResolver = JvmBackendClassResolverForModuleWithDependencies(module); private set + private var jvmBackendClassResolver: JvmBackendClassResolver = JvmBackendClassResolverForModuleWithDependencies(module) fun jvmBackendClassResolver(v: JvmBackendClassResolver) = apply { jvmBackendClassResolver = v } @@ -153,8 +153,10 @@ class GenerationState private constructor( val deserializationConfiguration: DeserializationConfiguration = CompilerDeserializationConfiguration(configuration.languageVersionSettings) - val deprecationProvider = - DeprecationResolver(LockBasedStorageManager.NO_LOCKS, configuration.languageVersionSettings, CoroutineCompatibilitySupport.ENABLED, JavaDeprecationSettings) + val deprecationProvider = DeprecationResolver( + LockBasedStorageManager.NO_LOCKS, configuration.languageVersionSettings, CoroutineCompatibilitySupport.ENABLED, + JavaDeprecationSettings + ) init { val icComponents = configuration.get(JVMConfigurationKeys.INCREMENTAL_COMPILATION_COMPONENTS) @@ -250,6 +252,7 @@ class GenerationState private constructor( class ForScript { // quite a mess, this one is an input from repl interpreter var earlierScriptsForReplInterpreter: List? = null + // and the rest is an output from the codegen var resultFieldName: String? = null var resultTypeString: String? = null @@ -346,7 +349,7 @@ class GenerationState private constructor( fun beforeCompile() { markUsed() - if (!isIrBackend || languageVersionSettings.getFlag(JvmAnalysisFlags.irCheckLocalNames)) { + if (!isIrBackend) { CodegenBinding.initTrace(this) } } diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt index 25ff966572d..1ce3fb3efa4 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt @@ -88,12 +88,6 @@ class K2JVMCompilerArguments : CommonCompilerArguments() { @Argument(value = "-Xno-use-ir", description = "Do not use the IR backend. Useful for a custom-built compiler where IR backend is enabled by default") var noUseIR: Boolean by FreezableVar(false) - @Argument( - value = "-Xir-check-local-names", - description = "Check that names of local classes and anonymous objects are the same in the IR backend as in the old backend" - ) - var irCheckLocalNames: Boolean by FreezableVar(false) - @Argument( value = "-Xallow-unstable-dependencies", description = "Do not report errors on classes in dependencies, which were compiled by an unstable version of the Kotlin compiler" @@ -446,7 +440,6 @@ class K2JVMCompilerArguments : CommonCompilerArguments() { result[JvmAnalysisFlags.inheritMultifileParts] = inheritMultifileParts result[JvmAnalysisFlags.sanitizeParentheses] = sanitizeParentheses result[JvmAnalysisFlags.suppressMissingBuiltinsError] = suppressMissingBuiltinsError - result[JvmAnalysisFlags.irCheckLocalNames] = irCheckLocalNames result[JvmAnalysisFlags.enableJvmPreview] = enableJvmPreview result[AnalysisFlags.allowUnstableDependencies] = allowUnstableDependencies || useFir result[JvmAnalysisFlags.disableUltraLightClasses] = disableUltraLightClasses diff --git a/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmAnalysisFlags.kt b/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmAnalysisFlags.kt index 38f1b62fdce..dd97e61cb3e 100644 --- a/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmAnalysisFlags.kt +++ b/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmAnalysisFlags.kt @@ -27,9 +27,6 @@ object JvmAnalysisFlags { @JvmStatic val suppressMissingBuiltinsError by AnalysisFlag.Delegates.Boolean - @JvmStatic - val irCheckLocalNames by AnalysisFlag.Delegates.Boolean - @JvmStatic val disableUltraLightClasses by AnalysisFlag.Delegates.Boolean diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLower.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLower.kt index 312247d2af8..47e43f02d84 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLower.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLower.kt @@ -374,8 +374,6 @@ private val jvmFilePhases = listOf( replaceKFunctionInvokeWithFunctionInvokePhase, kotlinNothingValueExceptionPhase, - checkLocalNamesWithOldBackendPhase, - renameFieldsPhase, fakeInliningLocalVariablesLowering, diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/CheckLocalNamesWithOldBackend.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/CheckLocalNamesWithOldBackend.kt deleted file mode 100644 index 37d739f5170..00000000000 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/CheckLocalNamesWithOldBackend.kt +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.backend.jvm.lower - -import org.jetbrains.kotlin.backend.common.FileLoweringPass -import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase -import org.jetbrains.kotlin.backend.jvm.JvmBackendContext -import org.jetbrains.kotlin.codegen.binding.CodegenBinding -import org.jetbrains.kotlin.config.JvmAnalysisFlags -import org.jetbrains.kotlin.ir.IrElement -import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI -import org.jetbrains.kotlin.ir.declarations.IrClass -import org.jetbrains.kotlin.ir.declarations.IrFile -import org.jetbrains.kotlin.ir.util.render -import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid -import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid -import org.jetbrains.kotlin.ir.visitors.acceptVoid - -val checkLocalNamesWithOldBackendPhase = makeIrFilePhase( - { context -> - if (context.state.languageVersionSettings.getFlag(JvmAnalysisFlags.irCheckLocalNames)) - CheckLocalNamesWithOldBackend(context) - else - FileLoweringPass.Empty - }, - name = "CheckLocalNamesWithOldBackend", - description = "With -Xir-check-local-names, check that names for local classes and anonymous objects are the same in the IR backend as in the old backend" -) - -class CheckLocalNamesWithOldBackend(private val context: JvmBackendContext) : FileLoweringPass, IrElementVisitorVoid { - override fun lower(irFile: IrFile) { - irFile.acceptVoid(this) - } - - @OptIn(ObsoleteDescriptorBasedAPI::class) - override fun visitClass(declaration: IrClass) { - val actualName = context.getLocalClassType(declaration)?.internalName - if (actualName != null) { - val expectedName = context.state.bindingTrace.get(CodegenBinding.ASM_TYPE, declaration.symbol.descriptor)?.internalName - if (expectedName != null && expectedName != actualName) { - throw AssertionError( - "Incorrect name for the class.\n" + - "IR: ${declaration.render()}\n" + - "Descriptor: ${declaration.descriptor}\n" + - "Expected name: $expectedName\n" + - "Actual name: $actualName" - ) - } - } - super.visitClass(declaration) - } - - override fun visitElement(element: IrElement) { - element.acceptChildrenVoid(this) - } -} diff --git a/compiler/testData/cli/jvm/extraHelp.out b/compiler/testData/cli/jvm/extraHelp.out index 111025d9443..0146bea18d5 100644 --- a/compiler/testData/cli/jvm/extraHelp.out +++ b/compiler/testData/cli/jvm/extraHelp.out @@ -31,7 +31,6 @@ where advanced options include: Works as `--enable-preview` in Java. All class files are marked as preview-generated thus it won't be possible to use them in release environment -Xfriend-paths= Paths to output directories for friend modules (whose internals should be visible) -Xmultifile-parts-inherit Compile multifile classes as a hierarchy of parts and facade - -Xir-check-local-names Check that names of local classes and anonymous objects are the same in the IR backend as in the old backend -Xmodule-path= Paths where to find Java 9+ modules -Xjava-package-prefix Package prefix for Java files -Xjava-source-roots= Paths to directories with Java source files