CLI: remove obsolete -Xallow-result-return-type
This commit is contained in:
committed by
Space Team
parent
49c659b379
commit
9d5e1bdc47
-1
@@ -12,7 +12,6 @@ fun copyCommonCompilerArguments(from: CommonCompilerArguments, to: CommonCompile
|
||||
|
||||
to.allowAnyScriptsInSourceRoots = from.allowAnyScriptsInSourceRoots
|
||||
to.allowKotlinPackage = from.allowKotlinPackage
|
||||
to.allowResultReturnType = from.allowResultReturnType
|
||||
to.apiVersion = from.apiVersion
|
||||
to.autoAdvanceApiVersion = from.autoAdvanceApiVersion
|
||||
to.autoAdvanceLanguageVersion = from.autoAdvanceLanguageVersion
|
||||
|
||||
-11
@@ -341,16 +341,6 @@ They should be a subset of sources passed as free arguments."""
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xallow-result-return-type",
|
||||
description = "Allow compiling code when 'kotlin.Result' is used as a return type."
|
||||
)
|
||||
var allowResultReturnType = false
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xlist-phases",
|
||||
description = "List backend phases."
|
||||
@@ -810,7 +800,6 @@ The corresponding calls' declarations may not be marked with @BuilderInference."
|
||||
put(AnalysisFlags.optIn, useExperimentalFqNames + optIn?.toList().orEmpty())
|
||||
put(AnalysisFlags.skipExpectedActualDeclarationChecker, metadataKlib)
|
||||
put(AnalysisFlags.explicitApiVersion, apiVersion != null)
|
||||
put(AnalysisFlags.allowResultReturnType, allowResultReturnType)
|
||||
ExplicitApiMode.fromString(explicitApi)?.also { put(AnalysisFlags.explicitApiMode, it) } ?: collector.report(
|
||||
CompilerMessageSeverity.ERROR,
|
||||
"Unknown value for parameter -Xexplicit-api: '$explicitApi'. Value should be one of ${ExplicitApiMode.availableValues()}"
|
||||
|
||||
@@ -30,9 +30,6 @@ object AnalysisFlags {
|
||||
@JvmStatic
|
||||
val ignoreDataFlowInAssert by AnalysisFlag.Delegates.Boolean
|
||||
|
||||
@JvmStatic
|
||||
val allowResultReturnType by AnalysisFlag.Delegates.Boolean
|
||||
|
||||
@JvmStatic
|
||||
val explicitApiMode by AnalysisFlag.Delegates.ApiModeDisabledByDefault
|
||||
|
||||
|
||||
-3
@@ -6,7 +6,6 @@
|
||||
package org.jetbrains.kotlin.resolve.checkers
|
||||
|
||||
import org.jetbrains.kotlin.builtins.StandardNames
|
||||
import org.jetbrains.kotlin.config.AnalysisFlags
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.diagnostics.Errors
|
||||
@@ -20,8 +19,6 @@ class ResultClassInReturnTypeChecker : DeclarationChecker {
|
||||
override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) {
|
||||
val languageVersionSettings = context.languageVersionSettings
|
||||
|
||||
if (languageVersionSettings.getFlag(AnalysisFlags.allowResultReturnType)) return
|
||||
|
||||
if ((languageVersionSettings.getFeatureSupport(LanguageFeature.InlineClasses) == LanguageFeature.State.ENABLED ||
|
||||
languageVersionSettings.supportsFeature(LanguageFeature.JvmInlineValueClasses)) &&
|
||||
languageVersionSettings.supportsFeature(LanguageFeature.AllowResultInReturnType)
|
||||
|
||||
+1
-2
@@ -10,8 +10,8 @@ import org.jetbrains.kotlin.test.TargetBackend
|
||||
import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives
|
||||
import org.jetbrains.kotlin.test.directives.model.RegisteredDirectives
|
||||
import org.jetbrains.kotlin.test.directives.model.singleOrZeroValue
|
||||
import org.jetbrains.kotlin.test.services.DefaultsDsl
|
||||
import org.jetbrains.kotlin.test.services.AbstractEnvironmentConfigurator
|
||||
import org.jetbrains.kotlin.test.services.DefaultsDsl
|
||||
import org.jetbrains.kotlin.test.util.LANGUAGE_FEATURE_PATTERN
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.runIf
|
||||
|
||||
@@ -100,7 +100,6 @@ class LanguageVersionSettingsBuilder {
|
||||
val analysisFlags = listOfNotNull(
|
||||
analysisFlag(AnalysisFlags.optIn, directives[LanguageSettingsDirectives.OPT_IN].takeIf { it.isNotEmpty() }),
|
||||
analysisFlag(AnalysisFlags.ignoreDataFlowInAssert, trueOrNull(LanguageSettingsDirectives.IGNORE_DATA_FLOW_IN_ASSERT in directives)),
|
||||
analysisFlag(AnalysisFlags.allowResultReturnType, trueOrNull(LanguageSettingsDirectives.ALLOW_RESULT_RETURN_TYPE in directives)),
|
||||
analysisFlag(AnalysisFlags.explicitApiMode, directives.singleOrZeroValue(LanguageSettingsDirectives.EXPLICIT_API_MODE)),
|
||||
analysisFlag(AnalysisFlags.allowKotlinPackage, trueOrNull(LanguageSettingsDirectives.ALLOW_KOTLIN_PACKAGE in directives)),
|
||||
analysisFlag(AnalysisFlags.muteExpectActualClassesWarning, trueOrNull(LanguageSettingsDirectives.ENABLE_EXPECT_ACTUAL_CLASSES_WARNING in directives) != true),
|
||||
|
||||
+4
-5
@@ -5,7 +5,10 @@
|
||||
|
||||
package org.jetbrains.kotlin.test.directives
|
||||
|
||||
import org.jetbrains.kotlin.config.*
|
||||
import org.jetbrains.kotlin.config.ApiVersion
|
||||
import org.jetbrains.kotlin.config.ExplicitApiMode
|
||||
import org.jetbrains.kotlin.config.JvmDefaultMode
|
||||
import org.jetbrains.kotlin.config.LanguageVersion
|
||||
import org.jetbrains.kotlin.test.directives.model.SimpleDirectivesContainer
|
||||
|
||||
object LanguageSettingsDirectives : SimpleDirectivesContainer() {
|
||||
@@ -51,10 +54,6 @@ object LanguageSettingsDirectives : SimpleDirectivesContainer() {
|
||||
description = "Enables corresponding analysis flag (AnalysisFlags.ignoreDataFlowInAssert)"
|
||||
)
|
||||
|
||||
val ALLOW_RESULT_RETURN_TYPE by directive(
|
||||
description = "Allow using Result in return type position"
|
||||
)
|
||||
|
||||
val EXPLICIT_API_MODE by enumDirective(
|
||||
"Configures explicit API mode (AnalysisFlags.explicitApiMode)",
|
||||
additionalParser = ExplicitApiMode.Companion::fromString
|
||||
|
||||
-1
@@ -68,7 +68,6 @@ where advanced options include:
|
||||
-Xallow-any-scripts-in-source-roots
|
||||
Allow compiling scripts along with regular Kotlin sources.
|
||||
-Xallow-kotlin-package Allow compiling code in the 'kotlin' package, and allow not requiring 'kotlin.stdlib' in 'module-info'.
|
||||
-Xallow-result-return-type Allow compiling code when 'kotlin.Result' is used as a return type.
|
||||
-Xbuiltins-from-sources Compile built-ins from sources.
|
||||
-Xcheck-phase-conditions Check pre- and postconditions of IR lowering phases.
|
||||
-Xcheck-sticky-phase-conditions
|
||||
|
||||
-1
@@ -155,7 +155,6 @@ where advanced options include:
|
||||
-Xallow-any-scripts-in-source-roots
|
||||
Allow compiling scripts along with regular Kotlin sources.
|
||||
-Xallow-kotlin-package Allow compiling code in the 'kotlin' package, and allow not requiring 'kotlin.stdlib' in 'module-info'.
|
||||
-Xallow-result-return-type Allow compiling code when 'kotlin.Result' is used as a return type.
|
||||
-Xbuiltins-from-sources Compile built-ins from sources.
|
||||
-Xcheck-phase-conditions Check pre- and postconditions of IR lowering phases.
|
||||
-Xcheck-sticky-phase-conditions
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
$TESTDATA_DIR$/flagAllowingResultAsReturnType.kt
|
||||
-Xallow-result-return-type
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
@@ -1 +0,0 @@
|
||||
fun foo(): Result<Int> = TODO()
|
||||
@@ -1 +0,0 @@
|
||||
OK
|
||||
Vendored
-1
@@ -1,5 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !ALLOW_RESULT_RETURN_TYPE
|
||||
// !LANGUAGE: -AllowNullOperatorsForResult
|
||||
|
||||
fun result(): Result<Int> = TODO()
|
||||
|
||||
-2
@@ -20,7 +20,6 @@ const val OPT_IN_DIRECTIVE = "OPT_IN"
|
||||
const val IGNORE_DATA_FLOW_IN_ASSERT_DIRECTIVE = "IGNORE_DATA_FLOW_IN_ASSERT"
|
||||
const val JVM_DEFAULT_MODE = "JVM_DEFAULT_MODE"
|
||||
const val SKIP_METADATA_VERSION_CHECK = "SKIP_METADATA_VERSION_CHECK"
|
||||
const val ALLOW_RESULT_RETURN_TYPE = "ALLOW_RESULT_RETURN_TYPE"
|
||||
const val INHERIT_MULTIFILE_PARTS = "INHERIT_MULTIFILE_PARTS"
|
||||
const val SANITIZE_PARENTHESES = "SANITIZE_PARENTHESES"
|
||||
const val ENABLE_JVM_PREVIEW = "ENABLE_JVM_PREVIEW"
|
||||
@@ -66,7 +65,6 @@ fun parseLanguageVersionSettings(
|
||||
analysisFlag(JvmAnalysisFlags.jvmDefaultMode, directives[JVM_DEFAULT_MODE]?.let { JvmDefaultMode.fromStringOrNull(it) }),
|
||||
analysisFlag(AnalysisFlags.ignoreDataFlowInAssert, if (IGNORE_DATA_FLOW_IN_ASSERT_DIRECTIVE in directives) true else null),
|
||||
analysisFlag(AnalysisFlags.skipMetadataVersionCheck, if (SKIP_METADATA_VERSION_CHECK in directives) true else null),
|
||||
analysisFlag(AnalysisFlags.allowResultReturnType, if (ALLOW_RESULT_RETURN_TYPE in directives) true else null),
|
||||
analysisFlag(JvmAnalysisFlags.inheritMultifileParts, if (INHERIT_MULTIFILE_PARTS in directives) true else null),
|
||||
analysisFlag(JvmAnalysisFlags.sanitizeParentheses, if (SANITIZE_PARENTHESES in directives) true else null),
|
||||
analysisFlag(JvmAnalysisFlags.enableJvmPreview, if (ENABLE_JVM_PREVIEW in directives) true else null),
|
||||
|
||||
@@ -630,11 +630,6 @@ public class CliTestGenerated extends AbstractCliTest {
|
||||
runTest("compiler/testData/cli/jvm/firVsClassicAnnotation.args");
|
||||
}
|
||||
|
||||
@TestMetadata("flagAllowingResultAsReturnType.args")
|
||||
public void testFlagAllowingResultAsReturnType() throws Exception {
|
||||
runTest("compiler/testData/cli/jvm/flagAllowingResultAsReturnType.args");
|
||||
}
|
||||
|
||||
@TestMetadata("forbidKotlinPackageK1.args")
|
||||
public void testForbidKotlinPackageK1() throws Exception {
|
||||
runTest("compiler/testData/cli/jvm/forbidKotlinPackageK1.args");
|
||||
|
||||
@@ -93,7 +93,6 @@ class CompilerArgumentsContentProspectorTest {
|
||||
CommonCompilerArguments::readDeserializedContracts,
|
||||
CommonCompilerArguments::properIeee754Comparisons,
|
||||
CommonCompilerArguments::reportPerf,
|
||||
CommonCompilerArguments::allowResultReturnType,
|
||||
CommonCompilerArguments::listPhases,
|
||||
CommonCompilerArguments::profilePhases,
|
||||
CommonCompilerArguments::checkPhaseConditions,
|
||||
|
||||
@@ -95,7 +95,6 @@ class GenerateIrRuntime {
|
||||
"kotlin.Experimental",
|
||||
"kotlin.ExperimentalMultiplatform"
|
||||
),
|
||||
AnalysisFlags.allowResultReturnType to true
|
||||
)
|
||||
)
|
||||
|
||||
@@ -307,7 +306,6 @@ class GenerateIrRuntime {
|
||||
irModuleName = "kotlin"
|
||||
allowKotlinPackage = true
|
||||
optIn = arrayOf("kotlin.contracts.ExperimentalContracts", "kotlin.Experimental", "kotlin.ExperimentalMultiplatform")
|
||||
allowResultReturnType = true
|
||||
multiPlatform = true
|
||||
languageVersion = "1.4"
|
||||
commonSources = filesToCompile.filter { it.isCommonSource == true }.map { it.virtualFilePath }.toTypedArray()
|
||||
|
||||
Reference in New Issue
Block a user