Make suspend fun, where suspend is a function error in 1.9

instead of 1.8.

 #KT-49264
This commit is contained in:
Ilmir Usmanov
2022-07-27 16:00:23 +02:00
parent 92109a6bef
commit b93c000250
4 changed files with 10 additions and 6 deletions
@@ -2018,7 +2018,8 @@ object FirErrorsDefaultMessages : BaseDiagnosticRendererFactory() {
)
map.put(
MODIFIER_FORM_FOR_NON_BUILT_IN_SUSPEND_FUN,
"Calls having a form of ''suspend fun'' are deprecated because ''suspend'' in the context will have a meaning of a modifier. Surround the argument of the call with parens: ''suspend(fun() { ... })''"
"Calls having a form of ''suspend fun'' are deprecated because ''suspend'' in the context will have a meaning of a modifier. Surround the argument of the call with parens: ''suspend(fun() { ... })''." +
" See https://youtrack.jetbrains.com/issue/KT-49264"
)
map.put(RETURN_FOR_BUILT_IN_SUSPEND, "Using implicit label for this lambda is prohibited")
@@ -1114,7 +1114,10 @@ public class DefaultErrorMessages {
MAP.put(IMPLICIT_NOTHING_TYPE_ARGUMENT_AGAINST_NOT_NOTHING_EXPECTED_TYPE, "Returning type parameter has been inferred to Nothing implicitly because Nothing is more specific than specified expected type. Please specify type arguments explicitly in accordance with expected type to hide this warning. Nothing can produce an exception at runtime. See KT-36776 for more details.");
MAP.put(RETURN_FOR_BUILT_IN_SUSPEND, "Using implicit label for this lambda is prohibited");
MAP.put(MODIFIER_FORM_FOR_NON_BUILT_IN_SUSPEND, "Calls having a form of ''suspend {}'' are deprecated because ''suspend'' in the context will have a meaning of a modifier. Add empty argument list to the call: ''suspend() { ... }''");
MAP.put(MODIFIER_FORM_FOR_NON_BUILT_IN_SUSPEND_FUN, "Calls having a form of ''suspend fun'' are deprecated because ''suspend'' in the context will have a meaning of a modifier. Surround the argument of the call with parens: ''suspend(fun() { ... })''");
MAP.put(MODIFIER_FORM_FOR_NON_BUILT_IN_SUSPEND_FUN,
"Calls having a form of ''suspend fun'' are deprecated because ''suspend'' in the context will have a meaning of a modifier. Surround the argument of the call with parens: ''suspend(fun() { ... })''." +
" See https://youtrack.jetbrains.com/issue/KT-49264"
);
MAP.put(PLUGIN_ERROR, "{0}", (d, c) -> d.getText());
MAP.put(PLUGIN_WARNING, "{0}", (d, c) -> d.getText());
@@ -4,7 +4,7 @@
infix fun Int.suspend(c: () -> Unit) { c() }
fun bar() {
1 <!MODIFIER_FORM_FOR_NON_BUILT_IN_SUSPEND_FUN_ERROR!>suspend<!> fun() {
1 <!MODIFIER_FORM_FOR_NON_BUILT_IN_SUSPEND_FUN_WARNING!>suspend<!> fun() {
println()
}
@@ -12,7 +12,7 @@ fun bar() {
println()
}
1 <!MODIFIER_FORM_FOR_NON_BUILT_IN_SUSPEND_FUN_ERROR!>suspend<!> @Ann fun() {
1 <!MODIFIER_FORM_FOR_NON_BUILT_IN_SUSPEND_FUN_WARNING!>suspend<!> @Ann fun() {
println()
}
}
@@ -22,7 +22,7 @@ fun bar() {
annotation class Ann
fun main(suspend: WLambdaInvoke) {
1 <!MODIFIER_FORM_FOR_NON_BUILT_IN_SUSPEND_FUN_ERROR!>suspend<!> fun() {}
1 <!MODIFIER_FORM_FOR_NON_BUILT_IN_SUSPEND_FUN_WARNING!>suspend<!> fun() {}
}
class WLambdaInvoke {
@@ -256,7 +256,6 @@ enum class LanguageFeature(
ReportMissingUpperBoundsViolatedErrorOnAbbreviationAtSupertypes(KOTLIN_1_8, kind = BUG_FIX), // KT-29168
IgnoreNullabilityForErasedValueParameters(KOTLIN_1_8, kind = BUG_FIX),
ForbidUsingExtensionPropertyTypeParameterInDelegate(KOTLIN_1_8, kind = BUG_FIX),
ModifierNonBuiltinSuspendFunError(KOTLIN_1_8),
SynchronizedSuspendError(KOTLIN_1_8),
EnableDfaWarningsInK2(KOTLIN_1_8, kind = OTHER), // KT-50965
ReportNonVarargSpreadOnGenericCalls(KOTLIN_1_8, kind = BUG_FIX), // KT-48162
@@ -282,6 +281,7 @@ enum class LanguageFeature(
ForbidExtensionCallsOnInlineFunctionalParameters(KOTLIN_1_9, kind = BUG_FIX), // KT-52502
ForbidInferringPostponedTypeVariableIntoDeclaredUpperBound(KOTLIN_1_9, kind = BUG_FIX), // KT-47986
SkipStandaloneScriptsInSourceRoots(KOTLIN_1_9, kind = OTHER), // KT-52525
ModifierNonBuiltinSuspendFunError(KOTLIN_1_9),
// Disabled for indefinite time. See KT-48535 and related discussion
ApproximateIntegerLiteralTypesInReceiverPosition(sinceVersion = null),