diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/FunctionsTypingVisitor.kt b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/FunctionsTypingVisitor.kt index 751d5b93381..8b99bdb1191 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/FunctionsTypingVisitor.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/FunctionsTypingVisitor.kt @@ -17,7 +17,6 @@ package org.jetbrains.kotlin.types.expressions import com.google.common.collect.Lists -import com.intellij.psi.PsiElement import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.builtins.getReturnTypeFromFunctionType import org.jetbrains.kotlin.builtins.isFunctionType @@ -28,9 +27,7 @@ import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl import org.jetbrains.kotlin.diagnostics.DiagnosticUtils import org.jetbrains.kotlin.diagnostics.Errors.* -import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.psi.psiUtil.checkReservedPrefixWord import org.jetbrains.kotlin.psi.psiUtil.getAnnotationEntries import org.jetbrains.kotlin.resolve.* import org.jetbrains.kotlin.resolve.BindingContext.EXPECTED_RETURN_TYPE @@ -58,7 +55,6 @@ internal class FunctionsTypingVisitor(facade: ExpressionTypingInternals) : Expre isDeclaration: Boolean, statementScope: LexicalWritableScope? // must be not null if isDeclaration ): KotlinTypeInfo { - checkReservedAsync(context, function) if (!isDeclaration) { // function expression if (!function.getTypeParameters().isEmpty()) { @@ -135,8 +131,6 @@ internal class FunctionsTypingVisitor(facade: ExpressionTypingInternals) : Expre } override fun visitLambdaExpression(expression: KtLambdaExpression, context: ExpressionTypingContext): KotlinTypeInfo? { - checkReservedAsync(context, expression) - if (!expression.functionLiteral.hasBody()) return null val expectedType = context.expectedType @@ -159,10 +153,6 @@ internal class FunctionsTypingVisitor(facade: ExpressionTypingInternals) : Expre return components.dataFlowAnalyzer.createCheckedTypeInfo(resultType, context, expression) } - private fun checkReservedAsync(context: ExpressionTypingContext, expression: PsiElement) { - checkReservedPrefixWord(context.trace, expression, "async", "async block/lambda. Use 'async() { ... }' or 'async(fun...)'") - } - private fun createFunctionLiteralDescriptor( expression: KtLambdaExpression, context: ExpressionTypingContext diff --git a/compiler/testData/diagnostics/tests/ReservedAsync.kt b/compiler/testData/diagnostics/tests/ReservedAsync.kt deleted file mode 100644 index f14e04ac806..00000000000 --- a/compiler/testData/diagnostics/tests/ReservedAsync.kt +++ /dev/null @@ -1,23 +0,0 @@ -fun async(f: () -> Unit) { - f() -} - -infix fun Any.async(f: () -> Unit) = f() - -fun test(foo: Any) { - async { } - `async` { } - async /**/ { } - foo async { } - - async() { } - - async({ }) - foo async ({ }) - - foo async fun () {} - foo `async` fun () {} - foo async (fun () {}) - - async (fun () {}) -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/ReservedAsync.txt b/compiler/testData/diagnostics/tests/ReservedAsync.txt deleted file mode 100644 index 8f9046d89b8..00000000000 --- a/compiler/testData/diagnostics/tests/ReservedAsync.txt +++ /dev/null @@ -1,5 +0,0 @@ -package - -public fun async(/*0*/ f: () -> kotlin.Unit): kotlin.Unit -public fun test(/*0*/ foo: kotlin.Any): kotlin.Unit -public infix fun kotlin.Any.async(/*0*/ f: () -> kotlin.Unit): kotlin.Unit diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index 286ece29244..2786846a07b 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -571,12 +571,6 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { doTest(fileName); } - @TestMetadata("ReservedAsync.kt") - public void testReservedAsync() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/ReservedAsync.kt"); - doTest(fileName); - } - @TestMetadata("ResolveOfJavaGenerics.kt") public void testResolveOfJavaGenerics() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/ResolveOfJavaGenerics.kt");