Allow to use collection literals only in annotations

This commit is contained in:
Mikhail Zarechenskiy
2017-03-21 03:11:54 +03:00
parent bfe2ddf7c1
commit a2ea518b1a
7 changed files with 40 additions and 3 deletions
@@ -1517,6 +1517,10 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
public KotlinTypeInfo visitCollectionLiteralExpression(
@NotNull KtCollectionLiteralExpression expression, ExpressionTypingContext context
) {
if (!isInsideAnnotationEntryOrClass(expression)) {
context.trace.report(UNSUPPORTED.on(expression, "Collection literals outside of annotations"));
}
checkSupportsArrayLiterals(expression, context);
return resolveCollectionLiteralSpecialMethod(expression, context);
}