From 4c96495eef51bcfd6a3bc63b071b53632b95b6a1 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Mon, 23 Jan 2023 18:05:13 +0200 Subject: [PATCH] [FIR] Put new contract syntax under feauture flag ^KT-55171 Fixed --- ...nosisCompilerFirTestdataTestGenerated.java | 6 +++ ...TouchedTilContractsPhaseTestGenerated.java | 5 +++ .../contracts/contractFromOtherModule.kt | 1 + .../contractFromOtherModule_samePackage.kt | 1 + .../resolve/contracts/disabledFeature.fir.txt | 34 +++++++++++++++++ .../resolve/contracts/disabledFeature.kt | 26 +++++++++++++ .../resolve/contracts/genericContract.kt | 1 + .../newSyntax/functionsWithContract.kt | 3 +- .../runners/FirDiagnosticTestGenerated.java | 6 +++ ...DiagnosticsWithLightTreeTestGenerated.java | 6 +++ .../checkers/CommonDeclarationCheckers.kt | 2 + .../declaration/NiceContractSyntaxChecker.kt | 38 +++++++++++++++++++ ...actContractResolveTransformerDispatcher.kt | 1 + .../complexContractDescription.fir.kt | 3 +- .../newSyntax/complexContractDescription.kt | 3 +- ...onelineFunctionsContractDescription.fir.kt | 5 ++- .../onelineFunctionsContractDescription.kt | 3 +- ...ropertyAccessorsContractDescription.fir.kt | 3 +- .../propertyAccessorsContractDescription.kt | 3 +- .../simpleFunctionsContractDescription.fir.kt | 3 +- .../simpleFunctionsContractDescription.kt | 3 +- .../kotlin/config/LanguageVersionSettings.kt | 1 + 22 files changed, 147 insertions(+), 10 deletions(-) create mode 100644 compiler/fir/analysis-tests/testData/resolve/contracts/disabledFeature.fir.txt create mode 100644 compiler/fir/analysis-tests/testData/resolve/contracts/disabledFeature.kt create mode 100644 compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/NiceContractSyntaxChecker.kt diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerFirTestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerFirTestdataTestGenerated.java index d9fa3c259e5..58897f5d9c7 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerFirTestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerFirTestdataTestGenerated.java @@ -1385,6 +1385,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis runTest("compiler/fir/analysis-tests/testData/resolve/contracts/contractFromOtherModule_samePackage.kt"); } + @Test + @TestMetadata("disabledFeature.kt") + public void testDisabledFeature() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolve/contracts/disabledFeature.kt"); + } + @Test @TestMetadata("genericContract.kt") public void testGenericContract() throws Exception { diff --git a/compiler/fir/analysis-tests/legacy-fir-tests/tests-gen/org/jetbrains/kotlin/fir/LazyBodyIsNotTouchedTilContractsPhaseTestGenerated.java b/compiler/fir/analysis-tests/legacy-fir-tests/tests-gen/org/jetbrains/kotlin/fir/LazyBodyIsNotTouchedTilContractsPhaseTestGenerated.java index e7487c585c2..8e536d0c777 100644 --- a/compiler/fir/analysis-tests/legacy-fir-tests/tests-gen/org/jetbrains/kotlin/fir/LazyBodyIsNotTouchedTilContractsPhaseTestGenerated.java +++ b/compiler/fir/analysis-tests/legacy-fir-tests/tests-gen/org/jetbrains/kotlin/fir/LazyBodyIsNotTouchedTilContractsPhaseTestGenerated.java @@ -1208,6 +1208,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract runTest("compiler/fir/analysis-tests/testData/resolve/contracts/contractFromOtherModule_samePackage.kt"); } + @TestMetadata("disabledFeature.kt") + public void testDisabledFeature() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolve/contracts/disabledFeature.kt"); + } + @TestMetadata("genericContract.kt") public void testGenericContract() throws Exception { runTest("compiler/fir/analysis-tests/testData/resolve/contracts/genericContract.kt"); diff --git a/compiler/fir/analysis-tests/testData/resolve/contracts/contractFromOtherModule.kt b/compiler/fir/analysis-tests/testData/resolve/contracts/contractFromOtherModule.kt index f43ffd075d7..a371f9d4d83 100644 --- a/compiler/fir/analysis-tests/testData/resolve/contracts/contractFromOtherModule.kt +++ b/compiler/fir/analysis-tests/testData/resolve/contracts/contractFromOtherModule.kt @@ -1,3 +1,4 @@ +// LANGUAGE: +ContractSyntaxV2 // SKIP_JAVAC // This directive is needed to skip this test in LazyBodyIsNotTouchedTilContractsPhaseTestGenerated, // because it fails to parse module structure of multimodule test diff --git a/compiler/fir/analysis-tests/testData/resolve/contracts/contractFromOtherModule_samePackage.kt b/compiler/fir/analysis-tests/testData/resolve/contracts/contractFromOtherModule_samePackage.kt index 391f0afb8b6..6093a2df6fe 100644 --- a/compiler/fir/analysis-tests/testData/resolve/contracts/contractFromOtherModule_samePackage.kt +++ b/compiler/fir/analysis-tests/testData/resolve/contracts/contractFromOtherModule_samePackage.kt @@ -1,3 +1,4 @@ +// LANGUAGE: +ContractSyntaxV2 // SKIP_JAVAC // This directive is needed to skip this test in LazyBodyIsNotTouchedTilContractsPhaseTestGenerated, // because it fails to parse module structure of multimodule test diff --git a/compiler/fir/analysis-tests/testData/resolve/contracts/disabledFeature.fir.txt b/compiler/fir/analysis-tests/testData/resolve/contracts/disabledFeature.fir.txt new file mode 100644 index 00000000000..a39410a002b --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolve/contracts/disabledFeature.fir.txt @@ -0,0 +1,34 @@ +FILE: disabledFeature.kt + public final inline fun requreIsInstance(value: R|kotlin/Any|): R|kotlin/Unit| + [R|Contract description] + < + Returns(WILDCARD) -> value is T + > + { + when () { + (R|/value| !is R|T|) -> { + throw R|java/lang/IllegalArgumentException.IllegalArgumentException|() + } + } + + } + public final val R|kotlin/Any?|.myLength: R|kotlin/Int?| + public get(): R|kotlin/Int?| + [R|Contract description] + < + > + { + ^ (this@R|/myLength| as? R|kotlin/String|)?.{ $subj$.R|kotlin/String.length| } + } + public final fun test_1(x: R|kotlin/Any|): R|kotlin/Unit| { + R|/requreIsInstance|(R|/x|) + R|/x|.R|kotlin/String.length| + } + public final fun test_2(x: R|kotlin/Any|): R|kotlin/Unit| { + when () { + !=(R|/x|.R|/myLength|, Null(null)) -> { + R|/x|.# + } + } + + } diff --git a/compiler/fir/analysis-tests/testData/resolve/contracts/disabledFeature.kt b/compiler/fir/analysis-tests/testData/resolve/contracts/disabledFeature.kt new file mode 100644 index 00000000000..989ebd479bd --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolve/contracts/disabledFeature.kt @@ -0,0 +1,26 @@ +// LANGUAGE: -ContractSyntaxV2 +// WITH_STDLIB + +import kotlin.contracts.* + +inline fun requreIsInstance(value: Any) contract [ + returns() implies (value is T) +] { + if (value !is T) throw IllegalArgumentException() +} + +val Any?.myLength: Int? + get() contract [ + returnsNotNull() implies (this@length is String) + ] = (this as? String)?.length + +fun test_1(x: Any) { + requreIsInstance(x) + x.length +} + +fun test_2(x: Any) { + if (x.myLength != null) { + x.length + } +} diff --git a/compiler/fir/analysis-tests/testData/resolve/contracts/genericContract.kt b/compiler/fir/analysis-tests/testData/resolve/contracts/genericContract.kt index ec5eb213873..8c7ab202281 100644 --- a/compiler/fir/analysis-tests/testData/resolve/contracts/genericContract.kt +++ b/compiler/fir/analysis-tests/testData/resolve/contracts/genericContract.kt @@ -1,3 +1,4 @@ +// LANGUAGE: +ContractSyntaxV2 // WITH_STDLIB import kotlin.contracts.* diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/good/variousContracts/newSyntax/functionsWithContract.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/good/variousContracts/newSyntax/functionsWithContract.kt index a3f0e69866e..6ca6c50d149 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/good/variousContracts/newSyntax/functionsWithContract.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/good/variousContracts/newSyntax/functionsWithContract.kt @@ -1,3 +1,4 @@ +// LANGUAGE: +ContractSyntaxV2 import kotlin.contracts.* fun test1(arg: Any?) contract [ @@ -19,4 +20,4 @@ fun test3(arg: Any?): Boolean contract [ ] { require(arg != null) return true -} \ No newline at end of file +} diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticTestGenerated.java index 4f94ce68651..dd7d7b55753 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticTestGenerated.java @@ -1385,6 +1385,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest { runTest("compiler/fir/analysis-tests/testData/resolve/contracts/contractFromOtherModule_samePackage.kt"); } + @Test + @TestMetadata("disabledFeature.kt") + public void testDisabledFeature() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolve/contracts/disabledFeature.kt"); + } + @Test @TestMetadata("genericContract.kt") public void testGenericContract() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticsWithLightTreeTestGenerated.java index 084218067e6..cdf17431ed6 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticsWithLightTreeTestGenerated.java @@ -1385,6 +1385,12 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos runTest("compiler/fir/analysis-tests/testData/resolve/contracts/contractFromOtherModule_samePackage.kt"); } + @Test + @TestMetadata("disabledFeature.kt") + public void testDisabledFeature() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolve/contracts/disabledFeature.kt"); + } + @Test @TestMetadata("genericContract.kt") public void testGenericContract() throws Exception { diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/CommonDeclarationCheckers.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/CommonDeclarationCheckers.kt index cc86361314b..2454e1da86f 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/CommonDeclarationCheckers.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/CommonDeclarationCheckers.kt @@ -56,6 +56,7 @@ object CommonDeclarationCheckers : DeclarationCheckers() { FirTailrecFunctionChecker, FirMemberFunctionsChecker, FirDataObjectContentChecker, + ContractSyntaxV2FunctionChecker, ) override val propertyCheckers: Set @@ -73,6 +74,7 @@ object CommonDeclarationCheckers : DeclarationCheckers() { FirDelegateUsesExtensionPropertyTypeParameterChecker, FirTopLevelPropertiesChecker, FirLocalExtensionPropertyChecker, + ContractSyntaxV2PropertyChecker, ) override val backingFieldCheckers: Set diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/NiceContractSyntaxChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/NiceContractSyntaxChecker.kt new file mode 100644 index 00000000000..40f12bda422 --- /dev/null +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/NiceContractSyntaxChecker.kt @@ -0,0 +1,38 @@ +/* + * Copyright 2010-2023 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.fir.analysis.checkers.declaration + +import org.jetbrains.kotlin.KtNodeTypes +import org.jetbrains.kotlin.config.LanguageFeature +import org.jetbrains.kotlin.diagnostics.DiagnosticReporter +import org.jetbrains.kotlin.diagnostics.reportOn +import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext +import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors +import org.jetbrains.kotlin.fir.declarations.FirContractDescriptionOwner +import org.jetbrains.kotlin.fir.declarations.FirProperty +import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction + +object ContractSyntaxV2FunctionChecker : FirSimpleFunctionChecker() { + override fun check(declaration: FirSimpleFunction, context: CheckerContext, reporter: DiagnosticReporter) { + checkFeatureIsEnabled(declaration, context, reporter) + } +} + +object ContractSyntaxV2PropertyChecker : FirPropertyChecker() { + override fun check(declaration: FirProperty, context: CheckerContext, reporter: DiagnosticReporter) { + declaration.getter?.let { checkFeatureIsEnabled(it, context, reporter) } + declaration.setter?.let { checkFeatureIsEnabled(it, context, reporter) } + } +} + +private fun checkFeatureIsEnabled(declaration: FirContractDescriptionOwner, context: CheckerContext, reporter: DiagnosticReporter) { + val source = declaration.contractDescription.source ?: return + if (source.elementType != KtNodeTypes.CONTRACT_EFFECT_LIST) return + val languageVersionSettings = context.languageVersionSettings + if (!languageVersionSettings.supportsFeature(LanguageFeature.ContractSyntaxV2)) { + reporter.reportOn(source, FirErrors.UNSUPPORTED_FEATURE, LanguageFeature.ContractSyntaxV2 to languageVersionSettings, context) + } +} diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/contracts/FirAbstractContractResolveTransformerDispatcher.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/contracts/FirAbstractContractResolveTransformerDispatcher.kt index c72b7a4aa4c..afd3ce48ddd 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/contracts/FirAbstractContractResolveTransformerDispatcher.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/contracts/FirAbstractContractResolveTransformerDispatcher.kt @@ -245,6 +245,7 @@ abstract class FirAbstractContractResolveTransformerDispatcher( val legacyRawContractDescription = buildLegacyRawContractDescription { this.contractCall = contractCall + this.source = contractDescription.source } owner.replaceContractDescription(legacyRawContractDescription) diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/complexContractDescription.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/complexContractDescription.fir.kt index a246f26be9c..38e40c4652c 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/complexContractDescription.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/complexContractDescription.fir.kt @@ -1,3 +1,4 @@ +// LANGUAGE: +ContractSyntaxV2 // !DIAGNOSTICS: -UNUSED_VARIABLE import kotlin.contracts.* @@ -21,4 +22,4 @@ fun bar(arg: Any?, block: () -> Int): Boolean contract [ return true } return false -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/complexContractDescription.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/complexContractDescription.kt index e00f1b81189..2f4eb40a068 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/complexContractDescription.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/complexContractDescription.kt @@ -1,3 +1,4 @@ +// LANGUAGE: +ContractSyntaxV2 // !DIAGNOSTICS: -UNUSED_VARIABLE import kotlin.contracts.* @@ -21,4 +22,4 @@ fun bar(arg: Any?, block: () -> Int): Boolean contract [ return true } return false -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/onelineFunctionsContractDescription.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/onelineFunctionsContractDescription.fir.kt index 54f63ba0994..ac3159a381a 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/onelineFunctionsContractDescription.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/onelineFunctionsContractDescription.fir.kt @@ -1,10 +1,11 @@ +// LANGUAGE: +ContractSyntaxV2 import kotlin.contracts.* fun calculateNumber(block: () -> Int): Int contract [ callsInPlace(block, InvocationKind.EXACTLY_ONCE) ] = block() -fun calculateResult(num: Int?, calculate: (Int?) -> R): R contract [ +fun calculateResult(num: Int?, calculate: (Int?) -> R): R contract [ callsInPlace(calculate, InvocationKind.EXACTLY_ONCE), returns() implies (num != null) -] = calculate(num) \ No newline at end of file +] = calculate(num) diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/onelineFunctionsContractDescription.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/onelineFunctionsContractDescription.kt index 17454298331..e62942bbda8 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/onelineFunctionsContractDescription.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/onelineFunctionsContractDescription.kt @@ -1,3 +1,4 @@ +// LANGUAGE: +ContractSyntaxV2 import kotlin.contracts.* fun calculateNumber(block: () -> Int): Int contract [ @@ -7,4 +8,4 @@ fun calculateNumber(block: () -> Int): Int contract [ fun calculateResult(num: Int?, calculate: (Int?) -> R): R contract [ callsInPlace(calculate, InvocationKind.EXACTLY_ONCE), returns() implies (num != null) -] = calculate(num) \ No newline at end of file +] = calculate(num) diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/propertyAccessorsContractDescription.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/propertyAccessorsContractDescription.fir.kt index a6146426367..c8d16730220 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/propertyAccessorsContractDescription.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/propertyAccessorsContractDescription.fir.kt @@ -1,3 +1,4 @@ +// LANGUAGE: +ContractSyntaxV2 import kotlin.contracts.* class A { @@ -15,4 +16,4 @@ class A { fun f(arg: Int) = arg * arg fun g(arg: Double) = arg / 2 -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/propertyAccessorsContractDescription.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/propertyAccessorsContractDescription.kt index dde7ca59955..d525a61072f 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/propertyAccessorsContractDescription.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/propertyAccessorsContractDescription.kt @@ -1,3 +1,4 @@ +// LANGUAGE: +ContractSyntaxV2 import kotlin.contracts.* class A { @@ -15,4 +16,4 @@ class A { fun f(arg: Int) = arg * arg fun g(arg: Double) = arg / 2 -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/simpleFunctionsContractDescription.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/simpleFunctionsContractDescription.fir.kt index a98423998b9..20755b21268 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/simpleFunctionsContractDescription.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/simpleFunctionsContractDescription.fir.kt @@ -1,3 +1,4 @@ +// LANGUAGE: +ContractSyntaxV2 import kotlin.contracts.* fun printStr(str: String?) contract [ @@ -19,4 +20,4 @@ fun calculateNumber(block: () -> Int): Int contract [ ] { val num = block() return num -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/simpleFunctionsContractDescription.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/simpleFunctionsContractDescription.kt index 0859f8ca8a0..221dd85879b 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/simpleFunctionsContractDescription.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/newSyntax/simpleFunctionsContractDescription.kt @@ -1,3 +1,4 @@ +// LANGUAGE: +ContractSyntaxV2 import kotlin.contracts.* fun printStr(str: String?) contract [ @@ -19,4 +20,4 @@ fun calculateNumber(block: () -> Int): Int contract [ ] { val num = block() return num -} \ No newline at end of file +} diff --git a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt index e9e1a744d94..cd824667f69 100644 --- a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt +++ b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt @@ -325,6 +325,7 @@ enum class LanguageFeature( CustomEqualsInValueClasses(sinceVersion = null, kind = OTHER), // KT-24874 InlineLateinit(sinceVersion = null, kind = OTHER), // KT-23814 EnableDfaWarningsInK2(sinceVersion = null, kind = OTHER), // KT-50965 + ContractSyntaxV2(sinceVersion = null, kind = UNSTABLE_FEATURE), // KT-56127 ; init {