diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/ResultTypeWithNullableOperatorsChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/ResultTypeWithNullableOperatorsChecker.kt index 919fe338b4f..ee424db74af 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/ResultTypeWithNullableOperatorsChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/ResultTypeWithNullableOperatorsChecker.kt @@ -6,6 +6,7 @@ package org.jetbrains.kotlin.resolve.calls.checkers import com.intellij.psi.PsiElement +import org.jetbrains.kotlin.config.LanguageFeature import org.jetbrains.kotlin.diagnostics.Errors import org.jetbrains.kotlin.diagnostics.reportDiagnosticOnce import org.jetbrains.kotlin.lexer.KtTokens @@ -16,6 +17,8 @@ import org.jetbrains.kotlin.types.expressions.ControlStructureTypingUtils class ResultTypeWithNullableOperatorsChecker : CallChecker { override fun check(resolvedCall: ResolvedCall<*>, reportOn: PsiElement, context: CallCheckerContext) { + if (context.languageVersionSettings.supportsFeature(LanguageFeature.AllowNullOperatorsForResult)) return + val name = resolvedCall.resultingDescriptor.name val operationNode = resolvedCall.call.callOperationNode diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/ResultClassInReturnTypeChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/ResultClassInReturnTypeChecker.kt index 325f659c871..2fb65fb1d3e 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/ResultClassInReturnTypeChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/ResultClassInReturnTypeChecker.kt @@ -6,6 +6,8 @@ package org.jetbrains.kotlin.resolve.checkers import org.jetbrains.kotlin.config.AnalysisFlags +import org.jetbrains.kotlin.config.LanguageFeature +import org.jetbrains.kotlin.config.LanguageVersion import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.diagnostics.Errors import org.jetbrains.kotlin.diagnostics.reportDiagnosticOnce @@ -17,7 +19,12 @@ import org.jetbrains.kotlin.types.KotlinType class ResultClassInReturnTypeChecker : DeclarationChecker { override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) { - if (context.languageVersionSettings.getFlag(AnalysisFlags.allowResultReturnType)) return + val languageVersionSettings = context.languageVersionSettings + if ( + languageVersionSettings.getFlag(AnalysisFlags.allowResultReturnType) || + languageVersionSettings.supportsFeature(LanguageFeature.InlineClasses) && + languageVersionSettings.supportsFeature(LanguageFeature.AllowResultInReturnType) + ) return if (declaration !is KtCallableDeclaration || descriptor !is CallableMemberDescriptor) return diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowNullOperatorsForResult_1_3.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowNullOperatorsForResult_1_3.kt new file mode 100644 index 00000000000..9d01e73b82d --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowNullOperatorsForResult_1_3.kt @@ -0,0 +1,7 @@ +// !LANGUAGE: -AllowNullOperatorsForResult +// !DIAGNOSTICS: -UNUSED_EXPRESSION + +fun test(r: Result?) { + r ?: 0 + r?.isFailure +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowNullOperatorsForResult_1_3.txt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowNullOperatorsForResult_1_3.txt new file mode 100644 index 00000000000..fd6f380a37d --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowNullOperatorsForResult_1_3.txt @@ -0,0 +1,3 @@ +package + +public fun test(/*0*/ r: kotlin.Result?): kotlin.Unit diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowNullOperatorsForResult_1_4.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowNullOperatorsForResult_1_4.kt new file mode 100644 index 00000000000..17e42466635 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowNullOperatorsForResult_1_4.kt @@ -0,0 +1,7 @@ +// !LANGUAGE: +AllowNullOperatorsForResult +// !DIAGNOSTICS: -UNUSED_EXPRESSION + +fun test(r: Result?) { + r ?: 0 + r?.isFailure +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowNullOperatorsForResult_1_4.txt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowNullOperatorsForResult_1_4.txt new file mode 100644 index 00000000000..fd6f380a37d --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowNullOperatorsForResult_1_4.txt @@ -0,0 +1,3 @@ +package + +public fun test(/*0*/ r: kotlin.Result?): kotlin.Unit diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnTypeWithFlag.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnTypeWithFlag.kt index 3fd5a6d9f8e..a4a1df22f9b 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnTypeWithFlag.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnTypeWithFlag.kt @@ -1,4 +1,5 @@ // !ALLOW_RESULT_RETURN_TYPE +// !LANGUAGE: -AllowNullOperatorsForResult fun result(): Result = TODO() val resultP: Result = result() diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnType_1_3.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnType_1_3.kt new file mode 100644 index 00000000000..2136e48202e --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnType_1_3.kt @@ -0,0 +1,4 @@ +// !LANGUAGE: +InlineClasses -AllowResultInReturnType + +fun result(): Result = TODO() +val resultP: Result = result() diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnType_1_3.txt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnType_1_3.txt new file mode 100644 index 00000000000..59e9b5876a6 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnType_1_3.txt @@ -0,0 +1,4 @@ +package + +public val resultP: kotlin.Result +public fun result(): kotlin.Result diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnType_1_4.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnType_1_4.kt new file mode 100644 index 00000000000..22c66bbf4bc --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnType_1_4.kt @@ -0,0 +1,4 @@ +// !LANGUAGE: +InlineClasses +AllowResultInReturnType + +fun result(): Result = TODO() +val resultP: Result = result() \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnType_1_4.txt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnType_1_4.txt new file mode 100644 index 00000000000..59e9b5876a6 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnType_1_4.txt @@ -0,0 +1,4 @@ +package + +public val resultP: kotlin.Result +public fun result(): kotlin.Result diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeInReturnType.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeInReturnType.kt index 367072f7075..7a076f5fac8 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeInReturnType.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeInReturnType.kt @@ -1,5 +1,5 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_EXPRESSION, -UNUSED_VARIABLE -// !LANGUAGE: +InlineClasses +// !LANGUAGE: +InlineClasses -AllowResultInReturnType typealias ResultAlias = Result diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeInReturnType_1_4.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeInReturnType_1_4.kt new file mode 100644 index 00000000000..4ba97ee994d --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeInReturnType_1_4.kt @@ -0,0 +1,124 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_EXPRESSION, -UNUSED_VARIABLE +// !LANGUAGE: +InlineClasses +AllowResultInReturnType + +typealias ResultAlias = Result + +inline class InlineResult(private val r: Result) + +fun params( + r1: Result, + r2: Result?, + r3: ResultAlias, + r4: List>, + r5: InlineResult, + vararg r6: Result +) {} + +class CtorParams(r1: Result) + +fun returnTypePublic(): Result = TODO() +internal fun returnTypeInternal(): Result = TODO() +private fun returnTypePrivate(): Result = TODO() +fun returnTypeNullable(): Result? = TODO() +fun returnTypeAlias(): ResultAlias = TODO() +fun returnInferred(r1: Result, r2: ResultAlias, b: Boolean) = if (b) r1 else r2 + +fun returnTypeInline(): InlineResult = TODO() +fun returnContainer(): List> = TODO() + +val topLevelP: Result = TODO() +val topLevelPInferred = topLevelP +internal val topLevelPInternal: Result = TODO() + +private val topLevelPPrivate: Result = TODO() +private val topLevelPPrivateInferred = topLevelP + +private val topLevelPPrivateCustomGetter: Result + get() = TODO() + +val asFunctional: () -> Result = TODO() + +open class PublicCls( + val r1: Result, + val r2: Result?, + val r3: ResultAlias, + val r4: ResultAlias?, + + val r5: InlineResult, + + internal val r6: Result, + + private val r7: Result, + val r8: List> +) { + val p1: Result = TODO() + var p2: Result = TODO() + val p3: ResultAlias? = TODO() + + val p4 = p1 + + internal val p5: Result = TODO() + + private var p6: Result = TODO() + + internal val p7 = p1 + protected val p8 = p1 + + fun returnInCls(): Result = TODO() + protected fun returnInClsProtected(): Result = TODO() + private fun returnInClsPrivate(): Result = TODO() +} + +internal open class InternalCls( + val r1: Result, + val r2: ResultAlias?, + + val r3: List> +) { + companion object { + val cr1: Result = TODO() + + private val cr2: Result = TODO() + } + + val p1 = r1 + val p2: Result = TODO() + + protected val p3 = p1 + + fun returnInInternal(): Result = TODO() + protected fun returnInClsProtected(): Result = TODO() +} + +private class PrivateCls( + val r1: Result, + val r2: ResultAlias?, + val r3: List> +) { + companion object { + val cr1: Result = TODO() + private val cr2: Result = TODO() + } + + val p1 = r1 + val p2: Result = TODO() + + fun returnInPrivate(): Result = TODO() +} + +fun local(r: Result) { + val l1: Result? = null + val l2 = r + + fun localFun(): Result = TODO() + + class F { + val p1: Result = r + val p2 = r + } +} + +fun resultInGenericFun(r: Result): T = r as T + +val asFunPublic: () -> Result = TODO() +private val asFun: () -> Result? = TODO() diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeInReturnType_1_4.txt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeInReturnType_1_4.txt new file mode 100644 index 00000000000..9f5253f8fbc --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeInReturnType_1_4.txt @@ -0,0 +1,110 @@ +package + +private val asFun: () -> kotlin.Result? +public val asFunPublic: () -> kotlin.Result +public val asFunctional: () -> kotlin.Result +public val topLevelP: kotlin.Result +public val topLevelPInferred: kotlin.Result +internal val topLevelPInternal: kotlin.Result +private val topLevelPPrivate: kotlin.Result +private val topLevelPPrivateCustomGetter: kotlin.Result +private val topLevelPPrivateInferred: kotlin.Result +public fun local(/*0*/ r: kotlin.Result): kotlin.Unit +public fun params(/*0*/ r1: kotlin.Result, /*1*/ r2: kotlin.Result?, /*2*/ r3: ResultAlias /* = kotlin.Result */, /*3*/ r4: kotlin.collections.List>, /*4*/ r5: InlineResult, /*5*/ vararg r6: kotlin.Result /*kotlin.Array>*/): kotlin.Unit +public fun resultInGenericFun(/*0*/ r: kotlin.Result): T +public fun returnContainer(): kotlin.collections.List> +public fun returnInferred(/*0*/ r1: kotlin.Result, /*1*/ r2: ResultAlias /* = kotlin.Result */, /*2*/ b: kotlin.Boolean): kotlin.Result +public fun returnTypeAlias(): ResultAlias /* = kotlin.Result */ +public fun returnTypeInline(): InlineResult +internal fun returnTypeInternal(): kotlin.Result +public fun returnTypeNullable(): kotlin.Result? +private fun returnTypePrivate(): kotlin.Result +public fun returnTypePublic(): kotlin.Result + +public final class CtorParams { + public constructor CtorParams(/*0*/ r1: kotlin.Result) + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final inline class InlineResult { + public constructor InlineResult(/*0*/ r: kotlin.Result) + private final val r: kotlin.Result + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String +} + +internal open class InternalCls { + public constructor InternalCls(/*0*/ r1: kotlin.Result, /*1*/ r2: ResultAlias? /* = kotlin.Result? */, /*2*/ r3: kotlin.collections.List>) + public final val p1: kotlin.Result + public final val p2: kotlin.Result + protected final val p3: kotlin.Result + public final val r1: kotlin.Result + public final val r2: ResultAlias? /* = kotlin.Result? */ + public final val r3: kotlin.collections.List> + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + protected final fun returnInClsProtected(): kotlin.Result + public final fun returnInInternal(): kotlin.Result + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public companion object Companion { + private constructor Companion() + public final val cr1: kotlin.Result + private final val cr2: kotlin.Result + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + +private final class PrivateCls { + public constructor PrivateCls(/*0*/ r1: kotlin.Result, /*1*/ r2: ResultAlias? /* = kotlin.Result? */, /*2*/ r3: kotlin.collections.List>) + public final val p1: kotlin.Result + public final val p2: kotlin.Result + public final val r1: kotlin.Result + public final val r2: ResultAlias? /* = kotlin.Result? */ + public final val r3: kotlin.collections.List> + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final fun returnInPrivate(): kotlin.Result + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public companion object Companion { + private constructor Companion() + public final val cr1: kotlin.Result + private final val cr2: kotlin.Result + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + +public open class PublicCls { + public constructor PublicCls(/*0*/ r1: kotlin.Result, /*1*/ r2: kotlin.Result?, /*2*/ r3: ResultAlias /* = kotlin.Result */, /*3*/ r4: ResultAlias? /* = kotlin.Result? */, /*4*/ r5: InlineResult, /*5*/ r6: kotlin.Result, /*6*/ r7: kotlin.Result, /*7*/ r8: kotlin.collections.List>) + public final val p1: kotlin.Result + public final var p2: kotlin.Result + public final val p3: ResultAlias? /* = kotlin.Result? */ + public final val p4: kotlin.Result + internal final val p5: kotlin.Result + private final var p6: kotlin.Result + internal final val p7: kotlin.Result + protected final val p8: kotlin.Result + public final val r1: kotlin.Result + public final val r2: kotlin.Result? + public final val r3: ResultAlias /* = kotlin.Result */ + public final val r4: ResultAlias? /* = kotlin.Result? */ + public final val r5: InlineResult + internal final val r6: kotlin.Result + private final val r7: kotlin.Result + public final val r8: kotlin.collections.List> + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final fun returnInCls(): kotlin.Result + private final fun returnInClsPrivate(): kotlin.Result + protected final fun returnInClsProtected(): kotlin.Result + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} +public typealias ResultAlias = kotlin.Result diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeWithNullableOperators.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeWithNullableOperators.kt index 2528c9c30db..9fcf174df6b 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeWithNullableOperators.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeWithNullableOperators.kt @@ -1,4 +1,5 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION +// !LANGUAGE: -AllowNullOperatorsForResult -AllowResultInReturnType fun id(x: T): T = x diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java index 879a73b0d12..9f08ad7b863 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java @@ -1513,11 +1513,31 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/coroutines"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } + @TestMetadata("allowNullOperatorsForResult_1_3.kt") + public void testAllowNullOperatorsForResult_1_3() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/allowNullOperatorsForResult_1_3.kt"); + } + + @TestMetadata("allowNullOperatorsForResult_1_4.kt") + public void testAllowNullOperatorsForResult_1_4() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/allowNullOperatorsForResult_1_4.kt"); + } + @TestMetadata("allowResultInReturnTypeWithFlag.kt") public void testAllowResultInReturnTypeWithFlag() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnTypeWithFlag.kt"); } + @TestMetadata("allowResultInReturnType_1_3.kt") + public void testAllowResultInReturnType_1_3() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnType_1_3.kt"); + } + + @TestMetadata("allowResultInReturnType_1_4.kt") + public void testAllowResultInReturnType_1_4() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnType_1_4.kt"); + } + @TestMetadata("callableReferences.kt") public void testCallableReferences() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReferences.kt"); @@ -1763,6 +1783,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeInReturnType.kt"); } + @TestMetadata("usageOfResultTypeInReturnType_1_4.kt") + public void testUsageOfResultTypeInReturnType_1_4() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeInReturnType_1_4.kt"); + } + @TestMetadata("usageOfResultTypeWithNullableOperators.kt") public void testUsageOfResultTypeWithNullableOperators() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeWithNullableOperators.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java index af2d9519b85..2df8827e3d7 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java @@ -1513,11 +1513,31 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/coroutines"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } + @TestMetadata("allowNullOperatorsForResult_1_3.kt") + public void testAllowNullOperatorsForResult_1_3() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/allowNullOperatorsForResult_1_3.kt"); + } + + @TestMetadata("allowNullOperatorsForResult_1_4.kt") + public void testAllowNullOperatorsForResult_1_4() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/allowNullOperatorsForResult_1_4.kt"); + } + @TestMetadata("allowResultInReturnTypeWithFlag.kt") public void testAllowResultInReturnTypeWithFlag() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnTypeWithFlag.kt"); } + @TestMetadata("allowResultInReturnType_1_3.kt") + public void testAllowResultInReturnType_1_3() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnType_1_3.kt"); + } + + @TestMetadata("allowResultInReturnType_1_4.kt") + public void testAllowResultInReturnType_1_4() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/allowResultInReturnType_1_4.kt"); + } + @TestMetadata("callableReferences.kt") public void testCallableReferences() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReferences.kt"); @@ -1763,6 +1783,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeInReturnType.kt"); } + @TestMetadata("usageOfResultTypeInReturnType_1_4.kt") + public void testUsageOfResultTypeInReturnType_1_4() throws Exception { + runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeInReturnType_1_4.kt"); + } + @TestMetadata("usageOfResultTypeWithNullableOperators.kt") public void testUsageOfResultTypeWithNullableOperators() throws Exception { runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/usageOfResultTypeWithNullableOperators.kt"); diff --git a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt index 233c2310006..d6c5fcbc0ab 100644 --- a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt +++ b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt @@ -118,6 +118,8 @@ enum class LanguageFeature( ProperFinally(KOTLIN_1_4, kind = BUG_FIX), ProhibitVarargAsArrayAfterSamArgument(KOTLIN_1_4, kind = BUG_FIX), AllowAssigningArrayElementsToVarargsInNamedFormForFunctions(KOTLIN_1_4), + AllowNullOperatorsForResult(KOTLIN_1_4), + AllowResultInReturnType(KOTLIN_1_4), ProperVisibilityForCompanionObjectInstanceField(sinceVersion = null, kind = BUG_FIX), // Temporarily disabled, see KT-27084/KT-22379