diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/JetPsiUtil.java b/compiler/frontend/src/org/jetbrains/kotlin/psi/JetPsiUtil.java index 317a3617090..c24348c86c8 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/JetPsiUtil.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/JetPsiUtil.java @@ -142,6 +142,9 @@ public class JetPsiUtil { } return expression; } + else if (expression instanceof JetAnnotatedExpression) { + return ((JetAnnotatedExpression) expression).getBaseExpression(); + } else if (expression instanceof JetLabeledExpression) { return ((JetLabeledExpression) expression).getBaseExpression(); } diff --git a/compiler/testData/diagnostics/tests/resolve/resolveAnnotatedLambdaArgument.kt b/compiler/testData/diagnostics/tests/resolve/resolveAnnotatedLambdaArgument.kt new file mode 100644 index 00000000000..99b6d0f6f58 --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/resolveAnnotatedLambdaArgument.kt @@ -0,0 +1,9 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER +annotation class Ann + +fun bar(block: (T) -> Int) {} + +fun foo() { + bar @Ann [Ann] { x -> x } + bar @Ann [Ann] label@{ x -> x } +} diff --git a/compiler/testData/diagnostics/tests/resolve/resolveAnnotatedLambdaArgument.txt b/compiler/testData/diagnostics/tests/resolve/resolveAnnotatedLambdaArgument.txt new file mode 100644 index 00000000000..07a4482db96 --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/resolveAnnotatedLambdaArgument.txt @@ -0,0 +1,11 @@ +package + +internal fun bar(/*0*/ block: (T) -> kotlin.Int): kotlin.Unit +internal fun foo(): kotlin.Unit + +internal final annotation class Ann : kotlin.Annotation { + public constructor Ann() + 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 +} diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java index d574ad5e6b5..e1189fe8455 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java @@ -10038,6 +10038,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { doTest(fileName); } + @TestMetadata("resolveAnnotatedLambdaArgument.kt") + public void testResolveAnnotatedLambdaArgument() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/resolve/resolveAnnotatedLambdaArgument.kt"); + doTest(fileName); + } + @TestMetadata("resolveWithFunctionLiteralWithId.kt") public void testResolveWithFunctionLiteralWithId() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/resolve/resolveWithFunctionLiteralWithId.kt");