Allow annotations on loop statements
This commit is contained in:
+5
-1
@@ -1169,6 +1169,10 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JetTypeInfo visitAnnotatedExpression(JetAnnotatedExpression expression, ExpressionTypingContext context) {
|
public JetTypeInfo visitAnnotatedExpression(JetAnnotatedExpression expression, ExpressionTypingContext context) {
|
||||||
|
return visitAnnotatedExpression(expression, context, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public JetTypeInfo visitAnnotatedExpression(JetAnnotatedExpression expression, ExpressionTypingContext context, boolean isStatement) {
|
||||||
context.expressionTypingServices.getAnnotationResolver().resolveAnnotationsWithArguments(
|
context.expressionTypingServices.getAnnotationResolver().resolveAnnotationsWithArguments(
|
||||||
context.scope, expression.getAnnotationEntries(), context.trace);
|
context.scope, expression.getAnnotationEntries(), context.trace);
|
||||||
|
|
||||||
@@ -1176,7 +1180,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
|||||||
if (baseExpression == null) {
|
if (baseExpression == null) {
|
||||||
return JetTypeInfo.create(null, context.dataFlowInfo);
|
return JetTypeInfo.create(null, context.dataFlowInfo);
|
||||||
}
|
}
|
||||||
return facade.getTypeInfo(baseExpression, context);
|
return facade.getTypeInfo(baseExpression, context, isStatement);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+7
@@ -356,6 +356,13 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
|
|||||||
return controlStructures.visitForExpression(expression, context, true);
|
return controlStructures.visitForExpression(expression, context, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JetTypeInfo visitAnnotatedExpression(
|
||||||
|
@NotNull JetAnnotatedExpression expression, ExpressionTypingContext data
|
||||||
|
) {
|
||||||
|
return basic.visitAnnotatedExpression(expression, data, true);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JetTypeInfo visitIfExpression(JetIfExpression expression, ExpressionTypingContext context) {
|
public JetTypeInfo visitIfExpression(JetIfExpression expression, ExpressionTypingContext context) {
|
||||||
return controlStructures.visitIfExpression(expression, context, true);
|
return controlStructures.visitIfExpression(expression, context, true);
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
fun test() {
|
||||||
|
[ann]
|
||||||
|
while (1 < 2) {}
|
||||||
|
|
||||||
|
[ann]
|
||||||
|
do {} while (1 < 2)
|
||||||
|
|
||||||
|
[ann]
|
||||||
|
for (i in 1..2) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
annotation class ann
|
||||||
@@ -615,6 +615,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
|
|||||||
doTest("compiler/testData/diagnostics/tests/annotations/onExpression.kt");
|
doTest("compiler/testData/diagnostics/tests/annotations/onExpression.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("onLoops.kt")
|
||||||
|
public void testOnLoops() throws Exception {
|
||||||
|
doTest("compiler/testData/diagnostics/tests/annotations/onLoops.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("onMultiDeclaration.kt")
|
@TestMetadata("onMultiDeclaration.kt")
|
||||||
public void testOnMultiDeclaration() throws Exception {
|
public void testOnMultiDeclaration() throws Exception {
|
||||||
doTest("compiler/testData/diagnostics/tests/annotations/onMultiDeclaration.kt");
|
doTest("compiler/testData/diagnostics/tests/annotations/onMultiDeclaration.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user