From e4c1fe7c3abf5ed3ce98b7425bbf00f2d88efe92 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Tue, 10 Sep 2013 20:30:52 +0400 Subject: [PATCH] Report unsupported annotations for local variables --- .../ExpressionTypingVisitorForStatements.java | 10 ++++++---- .../annotations/AnnotationsForPropertyTypeParameter.kt | 4 ++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingVisitorForStatements.java b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingVisitorForStatements.java index deda5fb0b1b..7b4df6c2fac 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingVisitorForStatements.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingVisitorForStatements.java @@ -22,12 +22,10 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jet.lang.descriptors.*; import org.jetbrains.jet.lang.descriptors.impl.FunctionDescriptorUtil; +import org.jetbrains.jet.lang.diagnostics.AbstractDiagnosticFactory; import org.jetbrains.jet.lang.diagnostics.Errors; import org.jetbrains.jet.lang.psi.*; -import org.jetbrains.jet.lang.resolve.BindingContext; -import org.jetbrains.jet.lang.resolve.ModifiersChecker; -import org.jetbrains.jet.lang.resolve.TemporaryBindingTrace; -import org.jetbrains.jet.lang.resolve.TopDownAnalyzer; +import org.jetbrains.jet.lang.resolve.*; import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo; import org.jetbrains.jet.lang.resolve.calls.context.TemporaryTraceAndCache; import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCall; @@ -123,6 +121,10 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito context.trace.report(LOCAL_VARIABLE_WITH_DELEGATE.on(property.getDelegate())); } + for (JetTypeParameter typeParameter : property.getTypeParameters()) { + AnnotationResolver.reportUnsupportedAnnotationForTypeParameter(typeParameter, context.trace); + } + VariableDescriptor propertyDescriptor = context.expressionTypingServices.getDescriptorResolver(). resolveLocalVariableDescriptor(scope, property, context.dataFlowInfo, context.trace); JetExpression initializer = property.getInitializer(); diff --git a/compiler/testData/diagnostics/tests/annotations/AnnotationsForPropertyTypeParameter.kt b/compiler/testData/diagnostics/tests/annotations/AnnotationsForPropertyTypeParameter.kt index f3fcf453855..dd4401942e4 100644 --- a/compiler/testData/diagnostics/tests/annotations/AnnotationsForPropertyTypeParameter.kt +++ b/compiler/testData/diagnostics/tests/annotations/AnnotationsForPropertyTypeParameter.kt @@ -5,4 +5,8 @@ val <A1 A2(3) A2 A1 A2(3) A2 A1(12) A2("Test") T> field = 12 + + fun foo() { + val <A1 A2(3) A2 A1(12) A2("Test") T> localVal = 12 + } } \ No newline at end of file