Index: pkg/analyzer/lib/src/generated/error_verifier.dart |
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart |
index 27bb23d0d95d332239457e2bb38b2b70219fcced..2a71ac62d48573331c0f79db9bd36cb9fd2d3459 100644 |
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart |
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart |
@@ -924,6 +924,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> { |
@override |
Object visitIsExpression(IsExpression node) { |
_checkForTypeAnnotationDeferredClass(node.type); |
+ _checkForTypeAnnotationGenericFunctionParameter(node.type); |
return super.visitIsExpression(node); |
} |
@@ -2610,8 +2611,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> { |
// terminated with 'throw' expression |
if (statement is ExpressionStatement) { |
Expression expression = statement.expression; |
- if (expression is ThrowExpression || |
- expression is RethrowExpression) { |
+ if (expression is ThrowExpression || expression is RethrowExpression) { |
return; |
} |
} |
@@ -5690,6 +5690,29 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> { |
} |
/** |
+ * Verify that the given type [name] is not a type parameter in a generic |
+ * method. |
+ * |
+ * See [StaticWarningCode.TYPE_ANNOTATION_GENERIC_FUNCTION_PARAMETER]. |
+ */ |
+ void _checkForTypeAnnotationGenericFunctionParameter(TypeName typeName) { |
+ if (typeName == null) { |
+ return; |
+ } |
+ Identifier name = typeName.name; |
+ if (name is SimpleIdentifier) { |
+ Element element = name.staticElement; |
+ if (element is TypeParameterElement && |
+ element.enclosingElement is ExecutableElement) { |
+ _errorReporter.reportErrorForNode( |
+ StaticWarningCode.TYPE_ANNOTATION_GENERIC_FUNCTION_PARAMETER, |
+ name, |
+ [name.name]); |
+ } |
+ } |
+ } |
+ |
+ /** |
* Verify that the type arguments in the given [typeName] are all within |
* their bounds. |
* |