Unwrap annotated expression in deparenthesize

It's needed to complete resolved call with annotated function literal
This commit is contained in:
Denis Zharkov
2015-05-05 12:21:25 +03:00
parent 9101505eca
commit 9e23698fe3
4 changed files with 29 additions and 0 deletions
@@ -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();
}
@@ -0,0 +1,9 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
annotation class Ann
fun <T> bar(block: (T) -> Int) {}
fun foo() {
bar<Int> @Ann [Ann] { x -> x }
bar<Int> @Ann [Ann] label@{ x -> x }
}
@@ -0,0 +1,11 @@
package
internal fun </*0*/ T> 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
}
@@ -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");