From 0dbf6986531d6a2c38ff767fb240214a25da6a4f Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Sat, 15 Apr 2023 11:03:52 +0200 Subject: [PATCH] K1: count anonymous function as function expression in checkers Related to KT-57991 --- .../src/org/jetbrains/kotlin/resolve/AnnotationChecker.kt | 1 + .../tests/modifiers/suspendAnonymousFunction.fir.kt | 7 ------- .../tests/modifiers/suspendAnonymousFunction.kt | 3 ++- 3 files changed, 3 insertions(+), 8 deletions(-) delete mode 100644 compiler/testData/diagnostics/tests/modifiers/suspendAnonymousFunction.fir.kt diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationChecker.kt index a0b31af71c7..b90886cc78d 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationChecker.kt @@ -394,6 +394,7 @@ class AnnotationChecker( is KtFunction -> { when { ExpressionTypingUtils.isFunctionExpression(descriptor) -> TargetLists.T_FUNCTION_EXPRESSION + annotated.name == null -> TargetLists.T_FUNCTION_EXPRESSION annotated.isLocal -> TargetLists.T_LOCAL_FUNCTION annotated.parent is KtClassOrObject || annotated.parent is KtClassBody -> TargetLists.T_MEMBER_FUNCTION else -> TargetLists.T_TOP_LEVEL_FUNCTION diff --git a/compiler/testData/diagnostics/tests/modifiers/suspendAnonymousFunction.fir.kt b/compiler/testData/diagnostics/tests/modifiers/suspendAnonymousFunction.fir.kt deleted file mode 100644 index c98c25018e2..00000000000 --- a/compiler/testData/diagnostics/tests/modifiers/suspendAnonymousFunction.fir.kt +++ /dev/null @@ -1,7 +0,0 @@ -// ISSUE: KT-57991 - -fun foo() { - suspend fun() { - - } -} diff --git a/compiler/testData/diagnostics/tests/modifiers/suspendAnonymousFunction.kt b/compiler/testData/diagnostics/tests/modifiers/suspendAnonymousFunction.kt index 826ebbe6ab6..839a6f3887c 100644 --- a/compiler/testData/diagnostics/tests/modifiers/suspendAnonymousFunction.kt +++ b/compiler/testData/diagnostics/tests/modifiers/suspendAnonymousFunction.kt @@ -1,7 +1,8 @@ +// FIR_IDENTICAL // ISSUE: KT-57991 fun foo() { - suspend fun() { + suspend fun() { } }