diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/project/NewInferenceForIDEAnalysisComponent.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/project/NewInferenceForIDEAnalysisComponent.kt deleted file mode 100644 index e71b7f15d1b..00000000000 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/project/NewInferenceForIDEAnalysisComponent.kt +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2010-2020 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.idea.project - -import com.intellij.ide.util.PropertiesComponent -import com.intellij.openapi.project.Project - -object NewInferenceForIDEAnalysisComponent { - private const val inferenceOptionV1 = "kotlin.use.new.inference.for.ide.analysis" - private const val inferenceOptionV2 = "kotlin.use.new.inference.for.ide.analysis.v2" - val defaultState: Boolean get() = true - - @JvmStatic - fun setEnabled(project: Project, state: Boolean) { - PropertiesComponent.getInstance(project).setValue(inferenceOptionV2, state, defaultState) - } - - @JvmStatic - fun isEnabled(project: Project): Boolean { - return PropertiesComponent.getInstance(project).getBoolean(inferenceOptionV2, defaultState) - } - - // This method is preserved only for FUS collector and it shouldn't be used in other contexts - @Deprecated("Use isEnabled method instead", replaceWith = ReplaceWith("this.isEnabled(project)")) - fun isEnabledForV1(project: Project): Boolean { - return PropertiesComponent.getInstance(project).getBoolean(inferenceOptionV1, true) - } -} \ No newline at end of file diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/project/Platform.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/project/Platform.kt index bf1ef52c970..0b0c2da9725 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/project/Platform.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/project/Platform.kt @@ -137,7 +137,6 @@ fun Project.getLanguageVersionSettings( CoroutineSupport.byCompilerArguments(KotlinCommonCompilerArgumentsHolder.getInstance(this@getLanguageVersionSettings).settings), languageVersion ) - configureNewInferenceSupportInIDE(this@getLanguageVersionSettings) if (isReleaseCoroutines != null) { put( LanguageFeature.ReleaseCoroutines, @@ -227,7 +226,6 @@ private fun Module.computeLanguageVersionSettings(): LanguageVersionSettings { val languageFeatures = facetSettings?.mergedCompilerArguments?.configureLanguageFeatures(MessageCollector.NONE)?.apply { configureCoroutinesSupport(facetSettings.coroutineSupport, languageVersion) configureMultiplatformSupport(facetSettings.targetPlatform?.idePlatformKind, this@computeLanguageVersionSettings) - configureNewInferenceSupportInIDE(project) }.orEmpty() val analysisFlags = facetSettings @@ -297,14 +295,6 @@ fun MutableMap.configureMultiplatformSup } } -fun MutableMap.configureNewInferenceSupportInIDE( - project: Project -) { - if (NewInferenceForIDEAnalysisComponent.isEnabled(project)) { - putIfAbsent(LanguageFeature.NewInference, LanguageFeature.State.ENABLED) - } -} - val PsiElement.languageVersionSettings: LanguageVersionSettings get() { if (ServiceManager.getService(project, ProjectFileIndex::class.java) == null) { diff --git a/idea/resources/messages/KotlinBundle.properties b/idea/resources/messages/KotlinBundle.properties index fc3f3678ee8..0beb48597a8 100644 --- a/idea/resources/messages/KotlinBundle.properties +++ b/idea/resources/messages/KotlinBundle.properties @@ -238,7 +238,6 @@ intention.extract.declarations.from.file.text.details=Extract ''{0}'' {1, choice kotlin.compiler.option.generate.no.warnings=Report compiler &warnings kotlin.compiler.option.additional.command.line.parameters=&Additional command line parameters: -kotlin.compiler.option.enable.new.inference.in.ide=Enable new type inference algorithm for IDE analysis kotlin.compiler.jvm.option.panel.title=Kotlin to JVM diff --git a/idea/src/org/jetbrains/kotlin/idea/compiler/configuration/KotlinCompilerConfigurableTab.form b/idea/src/org/jetbrains/kotlin/idea/compiler/configuration/KotlinCompilerConfigurableTab.form index 14931f83d26..3cbb19a85f9 100644 --- a/idea/src/org/jetbrains/kotlin/idea/compiler/configuration/KotlinCompilerConfigurableTab.form +++ b/idea/src/org/jetbrains/kotlin/idea/compiler/configuration/KotlinCompilerConfigurableTab.form @@ -1,6 +1,6 @@
- + @@ -12,13 +12,13 @@ - + - + @@ -153,7 +153,7 @@ - + @@ -229,7 +229,7 @@ - + @@ -286,7 +286,7 @@ - + @@ -310,7 +310,7 @@ - + @@ -334,7 +334,7 @@ - + @@ -357,7 +357,7 @@ - + @@ -365,7 +365,7 @@ - + @@ -373,33 +373,13 @@ - + - - - - - - - - - - - - - - - - - - - - diff --git a/idea/src/org/jetbrains/kotlin/idea/compiler/configuration/KotlinCompilerConfigurableTab.java b/idea/src/org/jetbrains/kotlin/idea/compiler/configuration/KotlinCompilerConfigurableTab.java index b922d25e6ac..05d1d7ffdb5 100644 --- a/idea/src/org/jetbrains/kotlin/idea/compiler/configuration/KotlinCompilerConfigurableTab.java +++ b/idea/src/org/jetbrains/kotlin/idea/compiler/configuration/KotlinCompilerConfigurableTab.java @@ -36,7 +36,6 @@ import org.jetbrains.kotlin.idea.PluginStartupService; import org.jetbrains.kotlin.idea.KotlinBundle; import org.jetbrains.kotlin.idea.facet.DescriptionListCellRenderer; import org.jetbrains.kotlin.idea.facet.KotlinFacet; -import org.jetbrains.kotlin.idea.project.NewInferenceForIDEAnalysisComponent; import org.jetbrains.kotlin.idea.roots.RootUtilsKt; import org.jetbrains.kotlin.idea.util.CidrUtil; import org.jetbrains.kotlin.idea.util.application.ApplicationUtilsKt; @@ -110,7 +109,6 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable { private JLabel labelForSourceMapPrefix; private JComboBox sourceMapEmbedSources; private JPanel coroutinesPanel; - private ThreeStateCheckBox enableNewInferenceInIDECheckBox; private boolean isEnabled = true; public KotlinCompilerConfigurableTab( @@ -151,7 +149,6 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable { } reportWarningsCheckBox.setThirdStateEnabled(isMultiEditor); - enableNewInferenceInIDECheckBox.setThirdStateEnabled(isMultiEditor); if (isProjectSettings) { List modulesOverridingProjectSettings = ArraysKt.mapNotNull( @@ -209,7 +206,6 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable { keepAliveCheckBox.setVisible(false); k2jvmPanel.setVisible(false); enableIncrementalCompilationForJsCheckBox.setVisible(false); - enableNewInferenceInIDECheckBox.setVisible(false); } updateOutputDirEnabled(); @@ -441,7 +437,6 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable { @Override public boolean isModified() { return isModified(reportWarningsCheckBox, !commonCompilerArguments.getSuppressWarnings()) || - isModified(enableNewInferenceInIDECheckBox, NewInferenceForIDEAnalysisComponent.isEnabled(project)) || !getSelectedLanguageVersionView().equals(KotlinFacetSettingsKt.getLanguageVersionView(commonCompilerArguments)) || !getSelectedAPIVersionView().equals(KotlinFacetSettingsKt.getApiVersionView(commonCompilerArguments)) || !getSelectedCoroutineState().equals(commonCompilerArguments.getCoroutinesState()) || @@ -523,8 +518,7 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable { !getSelectedLanguageVersionView().equals(KotlinFacetSettingsKt.getLanguageVersionView(commonCompilerArguments)) || !getSelectedAPIVersionView().equals(KotlinFacetSettingsKt.getApiVersionView(commonCompilerArguments)) || !getSelectedCoroutineState().equals(commonCompilerArguments.getCoroutinesState()) || - !additionalArgsOptionsField.getText().equals(compilerSettings.getAdditionalArguments()) || - enableNewInferenceInIDECheckBox.isSelected() != NewInferenceForIDEAnalysisComponent.isEnabled(project); + !additionalArgsOptionsField.getText().equals(compilerSettings.getAdditionalArguments()); if (shouldInvalidateCaches) { ApplicationUtilsKt.runWriteAction( @@ -540,7 +534,6 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable { } commonCompilerArguments.setSuppressWarnings(!reportWarningsCheckBox.isSelected()); - NewInferenceForIDEAnalysisComponent.setEnabled(project, enableNewInferenceInIDECheckBox.isSelected()); KotlinFacetSettingsKt.setLanguageVersionView(commonCompilerArguments, getSelectedLanguageVersionView()); KotlinFacetSettingsKt.setApiVersionView(commonCompilerArguments, getSelectedAPIVersionView()); @@ -594,7 +587,6 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable { @Override public void reset() { reportWarningsCheckBox.setSelected(!commonCompilerArguments.getSuppressWarnings()); - enableNewInferenceInIDECheckBox.setSelected(NewInferenceForIDEAnalysisComponent.isEnabled(project)); languageVersionComboBox.setSelectedItem(KotlinFacetSettingsKt.getLanguageVersionView(commonCompilerArguments)); onLanguageLevelChanged(getSelectedLanguageVersionView()); apiVersionComboBox.setSelectedItem(KotlinFacetSettingsKt.getApiVersionView(commonCompilerArguments)); @@ -647,10 +639,6 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable { return reportWarningsCheckBox; } - public ThreeStateCheckBox getEnableNewInferenceInIDECheckBox() { - return enableNewInferenceInIDECheckBox; - } - public RawCommandLineEditor getAdditionalArgsOptionsField() { return additionalArgsOptionsField; } diff --git a/idea/src/org/jetbrains/kotlin/idea/configuration/projectUtils.kt b/idea/src/org/jetbrains/kotlin/idea/configuration/projectUtils.kt index df3e35d5b97..bbb41c3372d 100644 --- a/idea/src/org/jetbrains/kotlin/idea/configuration/projectUtils.kt +++ b/idea/src/org/jetbrains/kotlin/idea/configuration/projectUtils.kt @@ -6,7 +6,6 @@ package org.jetbrains.kotlin.idea.configuration import com.intellij.openapi.module.Module -import com.intellij.openapi.util.registry.Registry import com.intellij.psi.search.FileTypeIndex import org.jetbrains.kotlin.idea.KotlinFileType @@ -16,4 +15,4 @@ fun hasKotlinFilesOnlyInTests(module: Module): Boolean { fun hasKotlinFilesInSources(module: Module): Boolean { return FileTypeIndex.containsFileOfType(KotlinFileType.INSTANCE, module.getModuleScope(false)) -} +} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/facet/MultipleKotlinFacetEditor.kt b/idea/src/org/jetbrains/kotlin/idea/facet/MultipleKotlinFacetEditor.kt index 684fe67693f..4e487f54677 100644 --- a/idea/src/org/jetbrains/kotlin/idea/facet/MultipleKotlinFacetEditor.kt +++ b/idea/src/org/jetbrains/kotlin/idea/facet/MultipleKotlinFacetEditor.kt @@ -33,7 +33,6 @@ class MultipleKotlinFacetEditor( //TODO(auskov): Support bulk editing target platforms? with(compilerConfigurable) { helper.bind(reportWarningsCheckBox, editors) { it.compilerConfigurable.reportWarningsCheckBox } - helper.bind(enableNewInferenceInIDECheckBox, editors) { it.compilerConfigurable.enableNewInferenceInIDECheckBox } helper.bind(additionalArgsOptionsField.textField, editors) { it.compilerConfigurable.additionalArgsOptionsField.textField } helper.bind(generateSourceMapsCheckBox, editors) { it.compilerConfigurable.generateSourceMapsCheckBox } helper.bind(outputPrefixFile.textField, editors) { it.compilerConfigurable.outputPrefixFile.textField } diff --git a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt index 2cd0d298d76..5262f188e42 100644 --- a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt +++ b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt @@ -58,7 +58,6 @@ import org.jetbrains.kotlin.codegen.AsmUtil import org.jetbrains.kotlin.codegen.JvmCodegenUtil import org.jetbrains.kotlin.config.IncrementalCompilation import org.jetbrains.kotlin.config.KotlinCompilerVersion.TEST_IS_PRE_RELEASE_SYSTEM_PROPERTY -import org.jetbrains.kotlin.config.LanguageVersion import org.jetbrains.kotlin.incremental.components.LookupTracker import org.jetbrains.kotlin.incremental.withIC import org.jetbrains.kotlin.jps.build.KotlinJpsBuildTestBase.LibraryDependency.* @@ -626,40 +625,6 @@ open class KotlinJpsBuildTest : KotlinJpsBuildTestBase() { result.assertSuccessful() } - /* - * Here we're checking that enabling inference in IDE doesn't affect compilation via JPS - * - * the following two tests are connected: - * - testKotlinProjectWithEnabledNewInferenceInIDE checks that project is compiled when new inference is enabled only in IDE - * - this is done via project component - * - testKotlinProjectWithErrorsBecauseOfNewInference checks that project isn't compiled when new inference is enabled in the compiler - * - * So, if the former will fail => option affects JPS compilation, it's bad. Also, if the latter test fails => test is useless as it's - * compiled with new and old inference. - * - */ - fun testKotlinProjectWithEnabledNewInferenceInIDE() { - initProject(JVM_MOCK_RUNTIME) - val module = myProject.modules.single() - val args = module.kotlinCompilerArguments - args.languageVersion = LanguageVersion.KOTLIN_1_3.versionString - myProject.kotlinCommonCompilerArguments = args - - buildAllModules().assertSuccessful() - } - - fun testKotlinProjectWithErrorsBecauseOfNewInference() { - initProject(JVM_MOCK_RUNTIME) - val module = myProject.modules.single() - val args = module.kotlinCompilerArguments - args.newInference = true - myProject.kotlinCommonCompilerArguments = args - - val result = buildAllModules() - result.assertFailed() - result.checkErrors() - } - private fun createKotlinJavaScriptLibraryArchive() { val jarFile = File(workDir, KOTLIN_JS_LIBRARY_JAR) try { diff --git a/jps-plugin/testData/general/KotlinProjectWithEnabledNewInferenceInIDE/kotlinProject.iml b/jps-plugin/testData/general/KotlinProjectWithEnabledNewInferenceInIDE/kotlinProject.iml deleted file mode 100644 index a0cbe548242..00000000000 --- a/jps-plugin/testData/general/KotlinProjectWithEnabledNewInferenceInIDE/kotlinProject.iml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/jps-plugin/testData/general/KotlinProjectWithEnabledNewInferenceInIDE/kotlinProject.ipr b/jps-plugin/testData/general/KotlinProjectWithEnabledNewInferenceInIDE/kotlinProject.ipr deleted file mode 100644 index f04957c330e..00000000000 --- a/jps-plugin/testData/general/KotlinProjectWithEnabledNewInferenceInIDE/kotlinProject.ipr +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/jps-plugin/testData/general/KotlinProjectWithEnabledNewInferenceInIDE/src/test1.kt b/jps-plugin/testData/general/KotlinProjectWithEnabledNewInferenceInIDE/src/test1.kt deleted file mode 100644 index 5f41546490a..00000000000 --- a/jps-plugin/testData/general/KotlinProjectWithEnabledNewInferenceInIDE/src/test1.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun foo() { - ByteArray(42) { - when (Any()) {} - } -} \ No newline at end of file diff --git a/jps-plugin/testData/general/KotlinProjectWithErrorsBecauseOfNewInference/errors.txt b/jps-plugin/testData/general/KotlinProjectWithErrorsBecauseOfNewInference/errors.txt deleted file mode 100644 index df2e59d5fe9..00000000000 --- a/jps-plugin/testData/general/KotlinProjectWithErrorsBecauseOfNewInference/errors.txt +++ /dev/null @@ -1 +0,0 @@ -Type mismatch: inferred type is Unit but Byte was expected at line 3, column 9 diff --git a/jps-plugin/testData/general/KotlinProjectWithErrorsBecauseOfNewInference/kotlinProject.iml b/jps-plugin/testData/general/KotlinProjectWithErrorsBecauseOfNewInference/kotlinProject.iml deleted file mode 100644 index a0cbe548242..00000000000 --- a/jps-plugin/testData/general/KotlinProjectWithErrorsBecauseOfNewInference/kotlinProject.iml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/jps-plugin/testData/general/KotlinProjectWithErrorsBecauseOfNewInference/kotlinProject.ipr b/jps-plugin/testData/general/KotlinProjectWithErrorsBecauseOfNewInference/kotlinProject.ipr deleted file mode 100644 index 90747786771..00000000000 --- a/jps-plugin/testData/general/KotlinProjectWithErrorsBecauseOfNewInference/kotlinProject.ipr +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/jps-plugin/testData/general/KotlinProjectWithErrorsBecauseOfNewInference/src/test1.kt b/jps-plugin/testData/general/KotlinProjectWithErrorsBecauseOfNewInference/src/test1.kt deleted file mode 100644 index 5f41546490a..00000000000 --- a/jps-plugin/testData/general/KotlinProjectWithErrorsBecauseOfNewInference/src/test1.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun foo() { - ByteArray(42) { - when (Any()) {} - } -} \ No newline at end of file