Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: pkg/analyzer/lib/src/generated/element_resolver.dart

Issue 2487583002: Convert generic method errors to hints (Closed)
Patch Set: add missed code Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer.src.generated.element_resolver; 5 library analyzer.src.generated.element_resolver;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/syntactic_entity.dart'; 10 import 'package:analyzer/dart/ast/syntactic_entity.dart';
(...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 */ 1571 */
1572 DartType _instantiateGenericMethod( 1572 DartType _instantiateGenericMethod(
1573 DartType invokeType, TypeArgumentList typeArguments, AstNode node) { 1573 DartType invokeType, TypeArgumentList typeArguments, AstNode node) {
1574 // TODO(jmesserly): support generic "call" methods on InterfaceType. 1574 // TODO(jmesserly): support generic "call" methods on InterfaceType.
1575 if (invokeType is FunctionType) { 1575 if (invokeType is FunctionType) {
1576 List<TypeParameterElement> parameters = invokeType.typeFormals; 1576 List<TypeParameterElement> parameters = invokeType.typeFormals;
1577 1577
1578 NodeList<TypeName> arguments = typeArguments?.arguments; 1578 NodeList<TypeName> arguments = typeArguments?.arguments;
1579 if (arguments != null && arguments.length != parameters.length) { 1579 if (arguments != null && arguments.length != parameters.length) {
1580 _resolver.errorReporter.reportErrorForNode( 1580 _resolver.errorReporter.reportErrorForNode(
1581 StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, 1581 HintCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD,
Jennifer Messerly 2016/11/08 01:21:57 This needs to be an error in strong mode.
Jennifer Messerly 2016/11/08 01:22:30 (and by an error, I mean StaticTypeWarningCode bec
Brian Wilkerson 2016/11/08 15:39:06 Done
1582 node, 1582 node,
1583 [invokeType, parameters.length, arguments?.length ?? 0]); 1583 [invokeType, parameters.length, arguments?.length ?? 0]);
1584 1584
1585 // Wrong number of type arguments. Ignore them. 1585 // Wrong number of type arguments. Ignore them.
1586 arguments = null; 1586 arguments = null;
1587 } 1587 }
1588 if (parameters.isNotEmpty) { 1588 if (parameters.isNotEmpty) {
1589 if (arguments == null) { 1589 if (arguments == null) {
1590 return _resolver.typeSystem.instantiateToBounds(invokeType); 1590 return _resolver.typeSystem.instantiateToBounds(invokeType);
1591 } else { 1591 } else {
(...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after
2639 2639
2640 @override 2640 @override
2641 Element get staticElement => null; 2641 Element get staticElement => null;
2642 2642
2643 @override 2643 @override
2644 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => null; 2644 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => null;
2645 2645
2646 @override 2646 @override
2647 void visitChildren(AstVisitor visitor) {} 2647 void visitChildren(AstVisitor visitor) {}
2648 } 2648 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698