From b29a6e48fbc2980e1416f19574dea595e96688f8 Mon Sep 17 00:00:00 2001 From: Dmitry Savvinov Date: Wed, 24 Jan 2018 21:17:16 +0300 Subject: [PATCH] Refactor language features, which control effect system - Introduce new language feature 'ReadDeserializedContracts', which allows to deserialize contracts from metadata. - Introduce new language feature 'AllowContractsForCustomFunctions', which allows reading contracts from sources. - Use new features instead of combination 'CallsInPlaceEffect || ReturnsEffect' - Rename 'CallsInPlaceEffect' -> 'UseCallsInPlaceEffect', 'ReturnsEffect' -> 'UseReturnsEffect'. As names suggest, they control if it is allowed to use corresponding effect in analysis. We have to introduce separate 'ReadDeserializedContracts' to enable contracts only in some modules of the project, because libraries are read with project-wide settings (see KT-20692). --- .../arguments/CommonCompilerArguments.kt | 6 ++ .../kotlin/cli/common/CLICompiler.java | 9 +- .../kotlin/cfg/ControlFlowProcessor.kt | 2 +- .../contracts/ContractDeserializerImpl.kt | 2 +- .../kotlin/contracts/EffectSystem.kt | 8 +- .../parsing/ContractParsingServices.kt | 3 +- .../CompilerDeserializationConfiguration.kt | 4 +- .../resolve/FunctionDescriptorResolver.kt | 3 +- .../breakContinuesInInlinedLambda.kt | 2 +- .../contracts/inlinedLambdaAlwaysThrows.kt | 2 +- .../contracts/irrelevantUnknownClosure.kt | 2 +- .../contracts/nestedTryCatchFinally.kt | 2 +- .../contracts/nestedTryCatchs.kt | 2 +- .../contracts/nonReturningInlinedLambda.kt | 2 +- .../contracts/returnsAndCalls.kt | 2 +- .../contracts/throwIfNotCalled.kt | 2 +- .../contracts/tryCatch.kt | 2 +- .../contracts/tryCatchFinally.kt | 2 +- .../cfgWithStdLib/contracts/labeledReturns.kt | 2 +- .../contracts/nonReturningInlinedLambda.kt | 2 +- .../contracts/returnsAndCalls.kt | 2 +- .../contracts/throwIfNotCalled.kt | 2 +- .../contracts/tryCatchFinally.kt | 2 +- compiler/testData/cli/js/jsExtraHelp.out | 1 + compiler/testData/cli/jvm/extraHelp.out | 1 + .../boxInline/contracts/complexInitializer.kt | 2 +- ...mplexInitializerWithStackTransformation.kt | 2 +- .../definiteLongValInitialization.kt | 2 +- .../definiteNestedValInitialization.kt | 2 +- .../contracts/definiteValInitialization.kt | 2 +- .../boxInline/contracts/nonLocalReturn.kt | 2 +- .../contracts/nonLocalReturnWithCycle.kt | 2 +- .../contracts/propertyInitialization.kt | 2 +- ...valInitializationAndUsageInNestedLambda.kt | 2 +- .../breakContinuesInInlinedLambda.kt | 2 +- .../flowInlining/expressionBody.instructions | 97 ------------------- .../flowInlining/expressionBody.kt | 2 +- .../implicitCastToAnyInReturnType.kt | 2 +- .../flowInlining/inlinedLambdaAlwaysThrows.kt | 2 +- .../flowInlining/irrelevantUnknownClosure.kt | 2 +- .../flowInlining/labeledReturns.kt | 2 +- .../flowInlining/nestedTryCatchFinally.kt | 2 +- .../flowInlining/nestedTryCatchs.kt | 2 +- .../flowInlining/nonLocalReturn.kt | 2 +- .../flowInlining/nonReturningInlinedLambda.kt | 2 +- .../severalJumpOutsFromInlinedLambda.kt | 2 +- .../flowInlining/throwIfNotCalled.kt | 2 +- .../controlflow/flowInlining/tryCatch.kt | 2 +- .../flowInlining/tryCatchFinally.kt | 2 +- .../controlflow/flowInlining/typeMismatch.kt | 2 +- .../flowInlining/unreachableCode.kt | 2 +- .../atLeastOnce/valDefiniteReassignment.kt | 2 +- .../atLeastOnce/varDefiniteInitialization.kt | 2 +- .../atLeastOnce/varIndefiniteIntialization.kt | 2 +- .../exactlyOnce/valDefiniteInitialization.kt | 2 +- .../exactlyOnce/valDefiniteReassignment.kt | 2 +- .../valIndefiniteInitialization.kt | 2 +- .../exactlyOnce/varDefiniteInitalization.kt | 2 +- .../varIndefiniteInitialization.kt | 2 +- .../exactlyOnce/withReceiver.kt | 2 +- .../unknown/unknownInvocations.kt | 2 +- .../dsl/errors/booleanComparisons.kt | 2 +- .../dsl/errors/callInContractDescription.kt | 2 +- .../dsl/errors/nestedConditionalEffects.kt | 2 +- .../contracts/dsl/errors/notFirstStatement.kt | 2 +- .../dsl/errors/referenceToProperty.kt | 2 +- .../contracts/dsl/errors/unlabeledReceiver.kt | 2 +- .../contracts/dsl/useBeforeDeclaration.kt | 2 +- .../contracts/fromStdlib/check.kt | 2 +- .../contracts/fromStdlib/fromStandardKt.kt | 2 +- .../contracts/fromStdlib/isNullOrBlank.kt | 2 +- .../contracts/fromStdlib/isNullOrEmpty.kt | 2 +- .../contracts/fromStdlib/require.kt | 2 +- .../smartcasts/catchExceptionSpilling.kt | 2 +- .../contracts/smartcasts/compositions.kt | 2 +- .../contracts/smartcasts/deeplyNested.kt | 2 +- .../contracts/smartcasts/intersectingInfo.kt | 2 +- .../contracts/smartcasts/intersectionTypes.kt | 2 +- .../smartcasts/multieffect/implicitIff.kt | 2 +- .../smartcasts/multieffect/returnsAndCalls.kt | 2 +- .../nullabilitySmartcastWhenNullability.kt | 2 +- .../smartcasts/operatorsTests/andOperator.kt | 2 +- .../operatorsTests/andOperatorWithConstant.kt | 2 +- .../operatorsTests/andOperatorWithUnknown.kt | 2 +- .../operatorsTests/equalsOperator.kt | 2 +- .../equalsWithNullableBoolean.kt | 2 +- .../operatorsTests/isInstanceOperator.kt | 2 +- .../smartcasts/operatorsTests/orOperator.kt | 2 +- .../operatorsTests/orOperatorWithConstant.kt | 2 +- .../operatorsTests/orOperatorWithUnknown.kt | 2 +- .../smartcasts/partiallyIncorrect.kt | 2 +- .../contracts/smartcasts/receiver.kt | 2 +- .../contracts/smartcasts/throwsEffect.kt | 2 +- .../typeSmartcastWhenNullability.kt | 2 +- .../smartcasts/unreachableBranches.kt | 2 +- .../contracts/smartcasts/when/withSubject.kt | 2 +- .../when/withSubjectNullableBoolean.kt | 2 +- .../smartcasts/when/withoutSubject.kt | 2 +- .../kotlin/config/LanguageVersionSettings.kt | 7 +- .../DeserializationConfiguration.kt | 5 +- 100 files changed, 116 insertions(+), 206 deletions(-) delete mode 100644 compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/expressionBody.instructions diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt index d01232f67e0..9bc12bd2a40 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt @@ -131,6 +131,12 @@ abstract class CommonCompilerArguments : CommonToolArguments() { ) var effectSystem: Boolean by FreezableVar(false) + @Argument( + value = "-Xread-deserialized-contracts", + description = "Enable reading of contracts from metadata" + ) + var readDeserializedContracts: Boolean by FreezableVar(false) + open fun configureAnalysisFlags(collector: MessageCollector): MutableMap, Any> { return HashMap, Any>().apply { put(AnalysisFlag.skipMetadataVersionCheck, skipMetadataVersionCheck) diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/CLICompiler.java b/compiler/cli/src/org/jetbrains/kotlin/cli/common/CLICompiler.java index 2e43bde3181..84673443a4b 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/CLICompiler.java +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/CLICompiler.java @@ -44,7 +44,6 @@ import java.io.PrintStream; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.concurrent.atomic.AtomicBoolean; import static org.jetbrains.kotlin.cli.common.ExitCode.*; import static org.jetbrains.kotlin.cli.common.environment.UtilKt.setIdeaIoUseFallback; @@ -218,8 +217,12 @@ public abstract class CLICompiler extends CLI } if (arguments.getEffectSystem()) { - extraLanguageFeatures.put(LanguageFeature.CallsInPlaceEffect, LanguageFeature.State.ENABLED); - extraLanguageFeatures.put(LanguageFeature.ReturnsEffect, LanguageFeature.State.ENABLED); + extraLanguageFeatures.put(LanguageFeature.UseCallsInPlaceEffect, LanguageFeature.State.ENABLED); + extraLanguageFeatures.put(LanguageFeature.UseReturnsEffect, LanguageFeature.State.ENABLED); + } + + if (arguments.getReadDeserializedContracts()) { + extraLanguageFeatures.put(LanguageFeature.ReadDeserializedContracts, LanguageFeature.State.ENABLED); } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/cfg/ControlFlowProcessor.kt b/compiler/frontend/src/org/jetbrains/kotlin/cfg/ControlFlowProcessor.kt index 36f59816bd3..655e5711bc9 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/cfg/ControlFlowProcessor.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/cfg/ControlFlowProcessor.kt @@ -1048,7 +1048,7 @@ class ControlFlowProcessor(private val trace: BindingTrace) { mark(lambdaExpression) val functionLiteral = lambdaExpression.functionLiteral - // NB. Behaviour here is implicitly controlled by the LanguageFeature 'CallsInPlaceEffect' + // NB. Behaviour here is implicitly controlled by the LanguageFeature 'UseCallsInPlaceEffect' // If this feature is turned off, then slice LAMBDA_INVOCATIONS is never written and invocationKind // in all subsequent calls always 'null', resulting in falling back to old behaviour visitFunction(functionLiteral, trace[BindingContext.LAMBDA_INVOCATIONS, lambdaExpression]) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/contracts/ContractDeserializerImpl.kt b/compiler/frontend/src/org/jetbrains/kotlin/contracts/ContractDeserializerImpl.kt index 3f02d3a5479..ac67d724dec 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/contracts/ContractDeserializerImpl.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/contracts/ContractDeserializerImpl.kt @@ -38,7 +38,7 @@ class ContractDeserializerImpl(private val configuration: DeserializationConfigu ): Pair, LazyContractProvider>? { if (!proto.hasContract()) return null - if (!configuration.returnsEffectAllowed && !configuration.callsInPlaceEffectAllowed) return null + if (!configuration.readDeserializedContracts) return null val worker = ContractDeserializationWorker(typeTable, typeDeserializer, ownerFunction) val contract = worker.deserializeContract(proto.contract) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/contracts/EffectSystem.kt b/compiler/frontend/src/org/jetbrains/kotlin/contracts/EffectSystem.kt index d07d176d52c..9c30803fae4 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/contracts/EffectSystem.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/contracts/EffectSystem.kt @@ -45,7 +45,7 @@ class EffectSystem(val languageVersionSettings: LanguageVersionSettings) { bindingTrace: BindingTrace, moduleDescriptor: ModuleDescriptor ): DataFlowInfo { - if (!languageVersionSettings.supportsFeature(LanguageFeature.ReturnsEffect)) return DataFlowInfo.EMPTY + if (!languageVersionSettings.supportsFeature(LanguageFeature.UseReturnsEffect)) return DataFlowInfo.EMPTY // Prevent launch of effect system machinery on pointless cases (constants/enums/constructors/etc.) val callExpression = resolvedCall.call.callElement as? KtCallExpression ?: return DataFlowInfo.EMPTY @@ -62,7 +62,7 @@ class EffectSystem(val languageVersionSettings: LanguageVersionSettings) { bindingTrace: BindingTrace, moduleDescriptor: ModuleDescriptor ): ConditionalDataFlowInfo { - if (!languageVersionSettings.supportsFeature(LanguageFeature.ReturnsEffect)) return ConditionalDataFlowInfo.EMPTY + if (!languageVersionSettings.supportsFeature(LanguageFeature.UseReturnsEffect)) return ConditionalDataFlowInfo.EMPTY if (leftExpression == null || rightExpression == null) return ConditionalDataFlowInfo.EMPTY val leftComputation = @@ -82,7 +82,7 @@ class EffectSystem(val languageVersionSettings: LanguageVersionSettings) { } fun recordDefiniteInvocations(resolvedCall: ResolvedCall<*>, bindingTrace: BindingTrace, moduleDescriptor: ModuleDescriptor) { - if (!languageVersionSettings.supportsFeature(LanguageFeature.CallsInPlaceEffect)) return + if (!languageVersionSettings.supportsFeature(LanguageFeature.UseCallsInPlaceEffect)) return // Prevent launch of effect system machinery on pointless cases (constants/enums/constructors/etc.) val callExpression = resolvedCall.call.callElement as? KtCallExpression ?: return @@ -102,7 +102,7 @@ class EffectSystem(val languageVersionSettings: LanguageVersionSettings) { bindingTrace: BindingTrace, moduleDescriptor: ModuleDescriptor ): DataFlowInfo { - if (!languageVersionSettings.supportsFeature(LanguageFeature.ReturnsEffect)) return DataFlowInfo.EMPTY + if (!languageVersionSettings.supportsFeature(LanguageFeature.UseReturnsEffect)) return DataFlowInfo.EMPTY if (condition == null) return DataFlowInfo.EMPTY return getContextInfoWhen(ESReturns(value.lift()), condition, bindingTrace, moduleDescriptor) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/contracts/parsing/ContractParsingServices.kt b/compiler/frontend/src/org/jetbrains/kotlin/contracts/parsing/ContractParsingServices.kt index adaa612d24e..4e7ee1884e2 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/contracts/parsing/ContractParsingServices.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/contracts/parsing/ContractParsingServices.kt @@ -43,8 +43,7 @@ class ContractParsingServices(val languageVersionSettings: LanguageVersionSettin if (!isContractDescriptionCallFastCheck(expression) || ownerDescriptor !is FunctionDescriptor) return val contractProvider = ownerDescriptor.getUserData(ContractProviderKey) ?: return - val isFeatureTurnedOn = languageVersionSettings.supportsFeature(LanguageFeature.CallsInPlaceEffect) || - languageVersionSettings.supportsFeature(LanguageFeature.ReturnsEffect) || + val isFeatureTurnedOn = languageVersionSettings.supportsFeature(LanguageFeature.AllowContractsForCustomFunctions) || // This condition is here for technical purposes of compiling 1.2-runtime with contracts languageVersionSettings.getFlag(AnalysisFlag.Flags.allowKotlinPackage) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/CompilerDeserializationConfiguration.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/CompilerDeserializationConfiguration.kt index e922d2f22fa..89d657e01f3 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/CompilerDeserializationConfiguration.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/CompilerDeserializationConfiguration.kt @@ -31,7 +31,5 @@ class CompilerDeserializationConfiguration(languageVersionSettings: LanguageVers override val isJvmPackageNameSupported = languageVersionSettings.supportsFeature(LanguageFeature.JvmPackageName) - override val returnsEffectAllowed: Boolean = languageVersionSettings.supportsFeature(LanguageFeature.ReturnsEffect) - - override val callsInPlaceEffectAllowed: Boolean = languageVersionSettings.supportsFeature(LanguageFeature.CallsInPlaceEffect) + override val readDeserializedContracts: Boolean = languageVersionSettings.supportsFeature(LanguageFeature.ReadDeserializedContracts) } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/FunctionDescriptorResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/FunctionDescriptorResolver.kt index bbbb8ee7505..a5ab964ee97 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/FunctionDescriptorResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/FunctionDescriptorResolver.kt @@ -235,8 +235,7 @@ class FunctionDescriptorResolver( } val emptyContract = LazyContractProvider.createInitialized(null) - val isContractsEnabled = languageVersionSettings.supportsFeature(LanguageFeature.CallsInPlaceEffect) || - languageVersionSettings.supportsFeature(LanguageFeature.ReturnsEffect) || + val isContractsEnabled = languageVersionSettings.supportsFeature(LanguageFeature.AllowContractsForCustomFunctions) || // We need to enable contracts if we're compiling "kotlin"-package to be able to ship contracts in stdlib in 1.2 languageVersionSettings.getFlag(AnalysisFlag.allowKotlinPackage) diff --git a/compiler/testData/cfgVariablesWithStdLib/contracts/breakContinuesInInlinedLambda.kt b/compiler/testData/cfgVariablesWithStdLib/contracts/breakContinuesInInlinedLambda.kt index 8ba1536dcae..bc1a0edd15c 100644 --- a/compiler/testData/cfgVariablesWithStdLib/contracts/breakContinuesInInlinedLambda.kt +++ b/compiler/testData/cfgVariablesWithStdLib/contracts/breakContinuesInInlinedLambda.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect import kotlin.internal.contracts.* diff --git a/compiler/testData/cfgVariablesWithStdLib/contracts/inlinedLambdaAlwaysThrows.kt b/compiler/testData/cfgVariablesWithStdLib/contracts/inlinedLambdaAlwaysThrows.kt index 2986c96845d..23c8afe6446 100644 --- a/compiler/testData/cfgVariablesWithStdLib/contracts/inlinedLambdaAlwaysThrows.kt +++ b/compiler/testData/cfgVariablesWithStdLib/contracts/inlinedLambdaAlwaysThrows.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect import kotlin.internal.contracts.* diff --git a/compiler/testData/cfgVariablesWithStdLib/contracts/irrelevantUnknownClosure.kt b/compiler/testData/cfgVariablesWithStdLib/contracts/irrelevantUnknownClosure.kt index b5a2dacfa90..a6add1a03e9 100644 --- a/compiler/testData/cfgVariablesWithStdLib/contracts/irrelevantUnknownClosure.kt +++ b/compiler/testData/cfgVariablesWithStdLib/contracts/irrelevantUnknownClosure.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect import kotlin.internal.contracts.* diff --git a/compiler/testData/cfgVariablesWithStdLib/contracts/nestedTryCatchFinally.kt b/compiler/testData/cfgVariablesWithStdLib/contracts/nestedTryCatchFinally.kt index 964add34a06..6407667ac4c 100644 --- a/compiler/testData/cfgVariablesWithStdLib/contracts/nestedTryCatchFinally.kt +++ b/compiler/testData/cfgVariablesWithStdLib/contracts/nestedTryCatchFinally.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect import kotlin.internal.contracts.* diff --git a/compiler/testData/cfgVariablesWithStdLib/contracts/nestedTryCatchs.kt b/compiler/testData/cfgVariablesWithStdLib/contracts/nestedTryCatchs.kt index f2d98dce0e2..f4643c90f36 100644 --- a/compiler/testData/cfgVariablesWithStdLib/contracts/nestedTryCatchs.kt +++ b/compiler/testData/cfgVariablesWithStdLib/contracts/nestedTryCatchs.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect import kotlin.internal.contracts.* diff --git a/compiler/testData/cfgVariablesWithStdLib/contracts/nonReturningInlinedLambda.kt b/compiler/testData/cfgVariablesWithStdLib/contracts/nonReturningInlinedLambda.kt index 9acb7ccbd4d..3cee9f12c3a 100644 --- a/compiler/testData/cfgVariablesWithStdLib/contracts/nonReturningInlinedLambda.kt +++ b/compiler/testData/cfgVariablesWithStdLib/contracts/nonReturningInlinedLambda.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect import kotlin.internal.contracts.* diff --git a/compiler/testData/cfgVariablesWithStdLib/contracts/returnsAndCalls.kt b/compiler/testData/cfgVariablesWithStdLib/contracts/returnsAndCalls.kt index d271ee9e9e7..8c92d579b15 100644 --- a/compiler/testData/cfgVariablesWithStdLib/contracts/returnsAndCalls.kt +++ b/compiler/testData/cfgVariablesWithStdLib/contracts/returnsAndCalls.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect import kotlin.internal.contracts.* diff --git a/compiler/testData/cfgVariablesWithStdLib/contracts/throwIfNotCalled.kt b/compiler/testData/cfgVariablesWithStdLib/contracts/throwIfNotCalled.kt index ed87954e459..711f1d78410 100644 --- a/compiler/testData/cfgVariablesWithStdLib/contracts/throwIfNotCalled.kt +++ b/compiler/testData/cfgVariablesWithStdLib/contracts/throwIfNotCalled.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect import kotlin.internal.contracts.* diff --git a/compiler/testData/cfgVariablesWithStdLib/contracts/tryCatch.kt b/compiler/testData/cfgVariablesWithStdLib/contracts/tryCatch.kt index ebe340e0d5c..73d39613d1e 100644 --- a/compiler/testData/cfgVariablesWithStdLib/contracts/tryCatch.kt +++ b/compiler/testData/cfgVariablesWithStdLib/contracts/tryCatch.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect import kotlin.internal.contracts.* diff --git a/compiler/testData/cfgVariablesWithStdLib/contracts/tryCatchFinally.kt b/compiler/testData/cfgVariablesWithStdLib/contracts/tryCatchFinally.kt index b8f947e938b..7a9abac2fcd 100644 --- a/compiler/testData/cfgVariablesWithStdLib/contracts/tryCatchFinally.kt +++ b/compiler/testData/cfgVariablesWithStdLib/contracts/tryCatchFinally.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect import kotlin.internal.contracts.* diff --git a/compiler/testData/cfgWithStdLib/contracts/labeledReturns.kt b/compiler/testData/cfgWithStdLib/contracts/labeledReturns.kt index 8e3a76f8f15..6a48892fff0 100644 --- a/compiler/testData/cfgWithStdLib/contracts/labeledReturns.kt +++ b/compiler/testData/cfgWithStdLib/contracts/labeledReturns.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect import kotlin.internal.contracts.* diff --git a/compiler/testData/cfgWithStdLib/contracts/nonReturningInlinedLambda.kt b/compiler/testData/cfgWithStdLib/contracts/nonReturningInlinedLambda.kt index 9acb7ccbd4d..3cee9f12c3a 100644 --- a/compiler/testData/cfgWithStdLib/contracts/nonReturningInlinedLambda.kt +++ b/compiler/testData/cfgWithStdLib/contracts/nonReturningInlinedLambda.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect import kotlin.internal.contracts.* diff --git a/compiler/testData/cfgWithStdLib/contracts/returnsAndCalls.kt b/compiler/testData/cfgWithStdLib/contracts/returnsAndCalls.kt index d271ee9e9e7..7c6730a1929 100644 --- a/compiler/testData/cfgWithStdLib/contracts/returnsAndCalls.kt +++ b/compiler/testData/cfgWithStdLib/contracts/returnsAndCalls.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect +UseReturnsEffect import kotlin.internal.contracts.* diff --git a/compiler/testData/cfgWithStdLib/contracts/throwIfNotCalled.kt b/compiler/testData/cfgWithStdLib/contracts/throwIfNotCalled.kt index ed87954e459..711f1d78410 100644 --- a/compiler/testData/cfgWithStdLib/contracts/throwIfNotCalled.kt +++ b/compiler/testData/cfgWithStdLib/contracts/throwIfNotCalled.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect import kotlin.internal.contracts.* diff --git a/compiler/testData/cfgWithStdLib/contracts/tryCatchFinally.kt b/compiler/testData/cfgWithStdLib/contracts/tryCatchFinally.kt index b8f947e938b..7a9abac2fcd 100644 --- a/compiler/testData/cfgWithStdLib/contracts/tryCatchFinally.kt +++ b/compiler/testData/cfgWithStdLib/contracts/tryCatchFinally.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect import kotlin.internal.contracts.* diff --git a/compiler/testData/cli/js/jsExtraHelp.out b/compiler/testData/cli/js/jsExtraHelp.out index c61004ec91f..183d77b75bb 100644 --- a/compiler/testData/cli/js/jsExtraHelp.out +++ b/compiler/testData/cli/js/jsExtraHelp.out @@ -14,6 +14,7 @@ where advanced options include: -Xno-check-actual Do not check presence of 'actual' modifier in multi-platform projects -Xno-inline Disable method inlining -Xplugin= Load plugins from the given classpath + -Xread-deserialized-contracts Enable reading of contracts from metadata -Xrepeat= Repeat compilation (for performance analysis) -Xreport-output-files Report source to output files mapping -Xskip-metadata-version-check Load classes with bad metadata version anyway (incl. pre-release classes) diff --git a/compiler/testData/cli/jvm/extraHelp.out b/compiler/testData/cli/jvm/extraHelp.out index be0578bff13..f066fb01c1e 100644 --- a/compiler/testData/cli/jvm/extraHelp.out +++ b/compiler/testData/cli/jvm/extraHelp.out @@ -53,6 +53,7 @@ where advanced options include: -Xno-check-actual Do not check presence of 'actual' modifier in multi-platform projects -Xno-inline Disable method inlining -Xplugin= Load plugins from the given classpath + -Xread-deserialized-contracts Enable reading of contracts from metadata -Xrepeat= Repeat compilation (for performance analysis) -Xreport-output-files Report source to output files mapping -Xskip-metadata-version-check Load classes with bad metadata version anyway (incl. pre-release classes) diff --git a/compiler/testData/codegen/boxInline/contracts/complexInitializer.kt b/compiler/testData/codegen/boxInline/contracts/complexInitializer.kt index f9f97f6fa42..74f65c60f83 100644 --- a/compiler/testData/codegen/boxInline/contracts/complexInitializer.kt +++ b/compiler/testData/codegen/boxInline/contracts/complexInitializer.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect +ReadDeserializedContracts // FILE: 1.kt package test diff --git a/compiler/testData/codegen/boxInline/contracts/complexInitializerWithStackTransformation.kt b/compiler/testData/codegen/boxInline/contracts/complexInitializerWithStackTransformation.kt index b27aaad5281..7e8c1df727a 100644 --- a/compiler/testData/codegen/boxInline/contracts/complexInitializerWithStackTransformation.kt +++ b/compiler/testData/codegen/boxInline/contracts/complexInitializerWithStackTransformation.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect +ReadDeserializedContracts // FILE: 1.kt package test diff --git a/compiler/testData/codegen/boxInline/contracts/definiteLongValInitialization.kt b/compiler/testData/codegen/boxInline/contracts/definiteLongValInitialization.kt index 7a53af05a9f..97a644e6e2e 100644 --- a/compiler/testData/codegen/boxInline/contracts/definiteLongValInitialization.kt +++ b/compiler/testData/codegen/boxInline/contracts/definiteLongValInitialization.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect +ReadDeserializedContracts // FILE: 1.kt package test diff --git a/compiler/testData/codegen/boxInline/contracts/definiteNestedValInitialization.kt b/compiler/testData/codegen/boxInline/contracts/definiteNestedValInitialization.kt index aa3955f2eb2..c2c93aeea0b 100644 --- a/compiler/testData/codegen/boxInline/contracts/definiteNestedValInitialization.kt +++ b/compiler/testData/codegen/boxInline/contracts/definiteNestedValInitialization.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect +ReadDeserializedContracts // FILE: 1.kt package test diff --git a/compiler/testData/codegen/boxInline/contracts/definiteValInitialization.kt b/compiler/testData/codegen/boxInline/contracts/definiteValInitialization.kt index ec47b128aae..c62a375e4ca 100644 --- a/compiler/testData/codegen/boxInline/contracts/definiteValInitialization.kt +++ b/compiler/testData/codegen/boxInline/contracts/definiteValInitialization.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect +ReadDeserializedContracts // FILE: 1.kt package test diff --git a/compiler/testData/codegen/boxInline/contracts/nonLocalReturn.kt b/compiler/testData/codegen/boxInline/contracts/nonLocalReturn.kt index b4c12b943bd..a0dd84b387e 100644 --- a/compiler/testData/codegen/boxInline/contracts/nonLocalReturn.kt +++ b/compiler/testData/codegen/boxInline/contracts/nonLocalReturn.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect +ReadDeserializedContracts // FILE: 1.kt package test diff --git a/compiler/testData/codegen/boxInline/contracts/nonLocalReturnWithCycle.kt b/compiler/testData/codegen/boxInline/contracts/nonLocalReturnWithCycle.kt index 62f1bf7ab88..bbb1a4461bb 100644 --- a/compiler/testData/codegen/boxInline/contracts/nonLocalReturnWithCycle.kt +++ b/compiler/testData/codegen/boxInline/contracts/nonLocalReturnWithCycle.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect +ReadDeserializedContracts // WITH_RUNTIME // FILE: 1.kt package test diff --git a/compiler/testData/codegen/boxInline/contracts/propertyInitialization.kt b/compiler/testData/codegen/boxInline/contracts/propertyInitialization.kt index c8216a5d0f7..48c643c7bba 100644 --- a/compiler/testData/codegen/boxInline/contracts/propertyInitialization.kt +++ b/compiler/testData/codegen/boxInline/contracts/propertyInitialization.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect +ReadDeserializedContracts // FILE: 1.kt package test diff --git a/compiler/testData/codegen/boxInline/contracts/valInitializationAndUsageInNestedLambda.kt b/compiler/testData/codegen/boxInline/contracts/valInitializationAndUsageInNestedLambda.kt index d7f18f91f4d..73e46ac7366 100644 --- a/compiler/testData/codegen/boxInline/contracts/valInitializationAndUsageInNestedLambda.kt +++ b/compiler/testData/codegen/boxInline/contracts/valInitializationAndUsageInNestedLambda.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect +ReadDeserializedContracts // FILE: 1.kt package test diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/breakContinuesInInlinedLambda.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/breakContinuesInInlinedLambda.kt index 97da67e3fcf..a965872a853 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/breakContinuesInInlinedLambda.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/breakContinuesInInlinedLambda.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/expressionBody.instructions b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/expressionBody.instructions deleted file mode 100644 index e3b62c6ec2d..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/expressionBody.instructions +++ /dev/null @@ -1,97 +0,0 @@ -== myRun == -fun myRun(@CalledInPlace block: () -> T): T = block() ---------------------- -L0: - 1 INIT: in: {} out: {} - v(@CalledInPlace block: () -> T) INIT: in: {} out: {block=D} - magic[FAKE_INITIALIZER](@CalledInPlace block: () -> T) -> INIT: in: {block=D} out: {block=D} - w(block|) INIT: in: {block=D} out: {block=ID} USE: in: {block=READ} out: {block=READ} - r(block) -> INIT: in: {block=ID} out: {block=ID} USE: in: {} out: {block=READ} - mark(block()) - call(block(), invoke|) -> - ret(*|) L1 -L1: - -error: - INIT: in: {} out: {} -sink: - INIT: in: {block=I?} out: {block=I?} USE: in: {} out: {} -===================== -== functionWithExpressionBody == -fun functionWithExpressionBody(x: Int) = myRun { - if (x == 0) return true - if (x == 1) return false - return functionWithExpressionBody(x - 2) -} ---------------------- -L0: - 1 INIT: in: {} out: {} - v(x: Int) INIT: in: {} out: {x=D} - magic[FAKE_INITIALIZER](x: Int) -> INIT: in: {x=D} out: {x=D} - w(x|) INIT: in: {x=D} out: {x=ID} - mark({ if (x == 0) return true if (x == 1) return false return functionWithExpressionBody(x - 2) }) INIT: in: {x=ID} out: {x=ID} - jmp?(L2) - d({ if (x == 0) return true if (x == 1) return false return functionWithExpressionBody(x - 2) }) INIT: in: {} out: {} USE: in: {x=READ} out: {x=READ} -L2 [after local declaration]: - r({ if (x == 0) return true if (x == 1) return false return functionWithExpressionBody(x - 2) }) -> INIT: in: {x=ID} out: {x=ID} - mark(myRun { if (x == 0) return true if (x == 1) return false return functionWithExpressionBody(x - 2) }) - call(myRun { if (x == 0) return true if (x == 1) return false return functionWithExpressionBody(x - 2) }, myRun|) -> - ret(*|) L1 -L1: - -error: - INIT: in: {} out: {} -sink: - INIT: in: {x=I?} out: {x=I?} USE: in: {} out: {} -===================== -== anonymous_0 == -{ - if (x == 0) return true - if (x == 1) return false - return functionWithExpressionBody(x - 2) -} ---------------------- -L3: - 2 INIT: in: {x=ID} out: {x=ID} - 3 mark(if (x == 0) return true if (x == 1) return false return functionWithExpressionBody(x - 2)) - mark(if (x == 0) return true) - r(x) -> - r(0) -> - mark(x == 0) - call(x == 0, equals|, ) -> - jf(L5|) USE: in: {x=READ} out: {x=READ} - r(true) -> - ret(*|) L1 USE: in: {} out: {} -- jmp(L6) -L5 [else branch]: - read (Unit) INIT: in: {x=ID} out: {x=ID} -L6 ['if' expression result]: - merge(if (x == 0) return true|!) -> - mark(if (x == 1) return false) - r(x) -> - r(1) -> - mark(x == 1) - call(x == 1, equals|, ) -> - jf(L7|) USE: in: {x=READ} out: {x=READ} - r(false) -> - ret(*|) L1 USE: in: {} out: {} -- jmp(L8) -L7 [else branch]: - read (Unit) INIT: in: {x=ID} out: {x=ID} -L8 ['if' expression result]: - merge(if (x == 1) return false|!) -> USE: in: {x=READ} out: {x=READ} - r(x) -> USE: in: {} out: {x=READ} - r(2) -> - mark(x - 2) - call(x - 2, minus|, ) -> - mark(functionWithExpressionBody(x - 2)) - call(functionWithExpressionBody(x - 2), functionWithExpressionBody|) -> - ret(*|) L1 USE: in: {} out: {} -- 2 ret(*|!) L4 -L4: - INIT: in: {} out: {} -error: - -sink: - USE: in: {} out: {} -===================== diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/expressionBody.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/expressionBody.kt index 6096f812667..332b0386845 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/expressionBody.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/expressionBody.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/implicitCastToAnyInReturnType.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/implicitCastToAnyInReturnType.kt index 42f62f9de72..01542f8cea5 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/implicitCastToAnyInReturnType.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/implicitCastToAnyInReturnType.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/inlinedLambdaAlwaysThrows.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/inlinedLambdaAlwaysThrows.kt index cc523b610d1..1a4a901dfc3 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/inlinedLambdaAlwaysThrows.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/inlinedLambdaAlwaysThrows.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/irrelevantUnknownClosure.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/irrelevantUnknownClosure.kt index 78d5b963bd2..cdb5ed4a544 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/irrelevantUnknownClosure.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/irrelevantUnknownClosure.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/labeledReturns.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/labeledReturns.kt index 91b73d8b03b..84d071ca19f 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/labeledReturns.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/labeledReturns.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/nestedTryCatchFinally.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/nestedTryCatchFinally.kt index 0185d1353e5..fef63a8aee2 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/nestedTryCatchFinally.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/nestedTryCatchFinally.kt @@ -1,5 +1,5 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -INVISIBLE_MEMBER -INVISIBLE_REFERENCE -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/nestedTryCatchs.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/nestedTryCatchs.kt index d2e13e7dd35..a2a578cdcb0 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/nestedTryCatchs.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/nestedTryCatchs.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/nonLocalReturn.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/nonLocalReturn.kt index 8d9c8c9f3bf..c14b364a28a 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/nonLocalReturn.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/nonLocalReturn.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/nonReturningInlinedLambda.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/nonReturningInlinedLambda.kt index 8075d253173..4cff966df1d 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/nonReturningInlinedLambda.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/nonReturningInlinedLambda.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/severalJumpOutsFromInlinedLambda.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/severalJumpOutsFromInlinedLambda.kt index eb85e12ff64..d82660fc79b 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/severalJumpOutsFromInlinedLambda.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/severalJumpOutsFromInlinedLambda.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/throwIfNotCalled.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/throwIfNotCalled.kt index 780189ca5b2..18ef30583b9 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/throwIfNotCalled.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/throwIfNotCalled.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/tryCatch.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/tryCatch.kt index a7a358f89e5..9caa9f0ba82 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/tryCatch.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/tryCatch.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/tryCatchFinally.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/tryCatchFinally.kt index 73cf1d0827e..d3e8079193e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/tryCatchFinally.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/tryCatchFinally.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER -UNUSED_PARAMETER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/typeMismatch.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/typeMismatch.kt index dfceb1d2e19..2db7ed0f525 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/typeMismatch.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/typeMismatch.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/unreachableCode.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/unreachableCode.kt index 55d85bfd7fe..1b5864f86df 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/unreachableCode.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/flowInlining/unreachableCode.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/atLeastOnce/valDefiniteReassignment.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/atLeastOnce/valDefiniteReassignment.kt index c28f5e7ae43..30927987ee5 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/atLeastOnce/valDefiniteReassignment.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/atLeastOnce/valDefiniteReassignment.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/atLeastOnce/varDefiniteInitialization.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/atLeastOnce/varDefiniteInitialization.kt index c1fdcd29706..9f4b03efb98 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/atLeastOnce/varDefiniteInitialization.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/atLeastOnce/varDefiniteInitialization.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/atLeastOnce/varIndefiniteIntialization.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/atLeastOnce/varIndefiniteIntialization.kt index 6c3afbd874c..cfa30791ae0 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/atLeastOnce/varIndefiniteIntialization.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/atLeastOnce/varIndefiniteIntialization.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/valDefiniteInitialization.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/valDefiniteInitialization.kt index 3a561aa7384..b486c4626dd 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/valDefiniteInitialization.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/valDefiniteInitialization.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/valDefiniteReassignment.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/valDefiniteReassignment.kt index 042c53153aa..081e6da135e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/valDefiniteReassignment.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/valDefiniteReassignment.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/valIndefiniteInitialization.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/valIndefiniteInitialization.kt index 73d8e0a83a2..8ae785a7ddc 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/valIndefiniteInitialization.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/valIndefiniteInitialization.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/varDefiniteInitalization.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/varDefiniteInitalization.kt index 232fb788d06..e046bcc18cd 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/varDefiniteInitalization.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/varDefiniteInitalization.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/varIndefiniteInitialization.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/varIndefiniteInitialization.kt index 7360af142c9..d467e7a3b71 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/varIndefiniteInitialization.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/varIndefiniteInitialization.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/withReceiver.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/withReceiver.kt index 8b51c366386..456966b6895 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/withReceiver.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/withReceiver.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/unknown/unknownInvocations.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/unknown/unknownInvocations.kt index 6c37ea48427..f88084d868a 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/unknown/unknownInvocations.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/unknown/unknownInvocations.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/booleanComparisons.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/booleanComparisons.kt index 92f0882de30..b66c5af2ede 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/booleanComparisons.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/booleanComparisons.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/callInContractDescription.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/callInContractDescription.kt index 386aa5af7b6..dc258f49a02 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/callInContractDescription.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/callInContractDescription.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/nestedConditionalEffects.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/nestedConditionalEffects.kt index 2c54658e3d6..f96801cfa6e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/nestedConditionalEffects.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/nestedConditionalEffects.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/notFirstStatement.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/notFirstStatement.kt index 3b09896c3e8..ad39173ee1c 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/notFirstStatement.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/notFirstStatement.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/referenceToProperty.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/referenceToProperty.kt index f8c89cf9697..5a93df3830d 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/referenceToProperty.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/referenceToProperty.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/unlabeledReceiver.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/unlabeledReceiver.kt index ce272e9c183..6758ea658fd 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/unlabeledReceiver.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/unlabeledReceiver.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/useBeforeDeclaration.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/useBeforeDeclaration.kt index 2a091504f0b..18bee4913f2 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/useBeforeDeclaration.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/useBeforeDeclaration.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/check.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/check.kt index afe41b0b24e..873062fc774 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/check.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/check.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +ReadDeserializedContracts +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER fun testCheckSmartcast(x: Any?) { diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/fromStandardKt.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/fromStandardKt.kt index 727286e3f73..b102d8b9033 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/fromStandardKt.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/fromStandardKt.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +// !LANGUAGE: +ReadDeserializedContracts +UseCallsInPlaceEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER fun testRunWithUnitReturn() { diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/isNullOrBlank.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/isNullOrBlank.kt index ce5331bcaee..834a6419bb6 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/isNullOrBlank.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/isNullOrBlank.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +ReadDeserializedContracts +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER fun testIsNullOrBlank(x: String?) { diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/isNullOrEmpty.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/isNullOrEmpty.kt index 000877237eb..a28c1b00afa 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/isNullOrEmpty.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/isNullOrEmpty.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +ReadDeserializedContracts +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER fun testIsNullOrEmpty(x: String?) { diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/require.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/require.kt index 535eed3b5ec..783fb01c185 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/require.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/require.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +ReadDeserializedContracts +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER fun testRequireSmartcast(x: Any?) { diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/catchExceptionSpilling.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/catchExceptionSpilling.kt index 8cfe2bf7b55..75a75940739 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/catchExceptionSpilling.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/catchExceptionSpilling.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/compositions.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/compositions.kt index 79b33770263..93349a52a69 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/compositions.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/compositions.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/deeplyNested.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/deeplyNested.kt index 686f5683fef..b4437a0a73b 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/deeplyNested.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/deeplyNested.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER // !WITH_NEW_INFERENCE diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/intersectingInfo.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/intersectingInfo.kt index 239705e634d..7cf0c5db040 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/intersectingInfo.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/intersectingInfo.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER // !WITH_NEW_INFERENCE diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/intersectionTypes.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/intersectionTypes.kt index c8988438e1d..e64e0c736e5 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/intersectionTypes.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/intersectionTypes.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER // !WITH_NEW_INFERENCE diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/multieffect/implicitIff.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/multieffect/implicitIff.kt index 0301183e291..db3957f05ce 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/multieffect/implicitIff.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/multieffect/implicitIff.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/multieffect/returnsAndCalls.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/multieffect/returnsAndCalls.kt index ddb3c3f0a84..d924f31c220 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/multieffect/returnsAndCalls.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/multieffect/returnsAndCalls.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +CallsInPlaceEffect +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect +UseCallsInPlaceEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/nullabilitySmartcastWhenNullability.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/nullabilitySmartcastWhenNullability.kt index 0de4ae7fd1f..200bb908cf6 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/nullabilitySmartcastWhenNullability.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/nullabilitySmartcastWhenNullability.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER // !WITH_NEW_INFERENCE diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/andOperator.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/andOperator.kt index 3874cddcb8c..1f83569a606 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/andOperator.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/andOperator.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER // !WITH_NEW_INFERENCE diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/andOperatorWithConstant.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/andOperatorWithConstant.kt index 04298096e5a..e807f4a3dab 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/andOperatorWithConstant.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/andOperatorWithConstant.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/andOperatorWithUnknown.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/andOperatorWithUnknown.kt index e6e82e34316..b755183fcb7 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/andOperatorWithUnknown.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/andOperatorWithUnknown.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/equalsOperator.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/equalsOperator.kt index 159ce4370f3..d20fe4b2c5f 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/equalsOperator.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/equalsOperator.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER // !WITH_NEW_INFERENCE diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/equalsWithNullableBoolean.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/equalsWithNullableBoolean.kt index 3e49fa24ec6..e26cbc99a59 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/equalsWithNullableBoolean.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/equalsWithNullableBoolean.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/isInstanceOperator.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/isInstanceOperator.kt index 92c2dd02270..0b9f41d59cc 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/isInstanceOperator.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/isInstanceOperator.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/orOperator.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/orOperator.kt index 01a7a852133..6bffca486e6 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/orOperator.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/orOperator.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER // !WITH_NEW_INFERENCE diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/orOperatorWithConstant.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/orOperatorWithConstant.kt index daacf682548..cd0074385d3 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/orOperatorWithConstant.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/orOperatorWithConstant.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/orOperatorWithUnknown.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/orOperatorWithUnknown.kt index 69b9329f0b0..b13c557038e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/orOperatorWithUnknown.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/operatorsTests/orOperatorWithUnknown.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/partiallyIncorrect.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/partiallyIncorrect.kt index d0834f6f09c..8bbe63802b1 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/partiallyIncorrect.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/partiallyIncorrect.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/receiver.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/receiver.kt index 2da15b538b8..67003043bef 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/receiver.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/receiver.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER // !WITH_NEW_INFERENCE diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/throwsEffect.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/throwsEffect.kt index 5804aa8a914..5bdcf7e40b3 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/throwsEffect.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/throwsEffect.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/typeSmartcastWhenNullability.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/typeSmartcastWhenNullability.kt index cf2b8cfc216..a664aad3add 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/typeSmartcastWhenNullability.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/typeSmartcastWhenNullability.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/unreachableBranches.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/unreachableBranches.kt index 35039e47315..710aa6287cd 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/unreachableBranches.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/unreachableBranches.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/when/withSubject.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/when/withSubject.kt index b1031da4d42..9e12ee90301 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/when/withSubject.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/when/withSubject.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/when/withSubjectNullableBoolean.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/when/withSubjectNullableBoolean.kt index 4bc9cbff6eb..ab0ec8c895d 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/when/withSubjectNullableBoolean.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/when/withSubjectNullableBoolean.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/when/withoutSubject.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/when/withoutSubject.kt index a4d849c7d98..ad13972d73f 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/when/withoutSubject.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/when/withoutSubject.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ReturnsEffect +// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER import kotlin.internal.contracts.* diff --git a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt index ff3fa84e184..3cf34b9157c 100644 --- a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt +++ b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt @@ -67,8 +67,6 @@ enum class LanguageFeature( DefaultMethodsCallFromJava6TargetError(KOTLIN_1_2), BooleanElvisBoundSmartCasts(KOTLIN_1_3), - ReturnsEffect(KOTLIN_1_3), - CallsInPlaceEffect(KOTLIN_1_3), RestrictionOfValReassignmentViaBackingField(KOTLIN_1_3), NestedClassesInEnumEntryShouldBeInner(KOTLIN_1_3), ProhibitDataClassesOverridingCopy(KOTLIN_1_3), @@ -80,6 +78,11 @@ enum class LanguageFeature( StrictJavaNullabilityAssertions(sinceVersion = null, defaultState = State.DISABLED), + ReadDeserializedContracts(KOTLIN_1_3), + UseReturnsEffect(KOTLIN_1_3), + UseCallsInPlaceEffect(KOTLIN_1_3), + AllowContractsForCustomFunctions(KOTLIN_1_3), + // Experimental features Coroutines(KOTLIN_1_1, ApiVersion.KOTLIN_1_1, "https://kotlinlang.org/docs/diagnostics/experimental-coroutines", State.ENABLED_WITH_WARNING), diff --git a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/DeserializationConfiguration.kt b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/DeserializationConfiguration.kt index 2bff1f81d61..4622508d23d 100644 --- a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/DeserializationConfiguration.kt +++ b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/DeserializationConfiguration.kt @@ -29,10 +29,7 @@ interface DeserializationConfiguration { val isJvmPackageNameSupported: Boolean get() = true - val returnsEffectAllowed: Boolean - get() = false - - val callsInPlaceEffectAllowed: Boolean + val readDeserializedContracts: Boolean get() = false object Default : DeserializationConfiguration