Chromium Code Reviews| OLD | NEW |
|---|---|
| 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.error_verifier; | 5 library analyzer.src.generated.error_verifier; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import "dart:math" as math; | 8 import "dart:math" as math; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 1736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1747 // an error message once it's ready to "return false". | 1747 // an error message once it's ready to "return false". |
| 1748 if (!derivedFT.typeFormals.isEmpty) { | 1748 if (!derivedFT.typeFormals.isEmpty) { |
| 1749 if (baseFT.typeFormals.isEmpty) { | 1749 if (baseFT.typeFormals.isEmpty) { |
| 1750 derivedFT = _typeSystem.instantiateToBounds(derivedFT); | 1750 derivedFT = _typeSystem.instantiateToBounds(derivedFT); |
| 1751 } else { | 1751 } else { |
| 1752 List<TypeParameterElement> params1 = derivedFT.typeFormals; | 1752 List<TypeParameterElement> params1 = derivedFT.typeFormals; |
| 1753 List<TypeParameterElement> params2 = baseFT.typeFormals; | 1753 List<TypeParameterElement> params2 = baseFT.typeFormals; |
| 1754 int count = params1.length; | 1754 int count = params1.length; |
| 1755 if (params2.length != count) { | 1755 if (params2.length != count) { |
| 1756 _errorReporter.reportErrorForNode( | 1756 _errorReporter.reportErrorForNode( |
| 1757 StaticWarningCode.INVALID_METHOD_OVERRIDE_TYPE_PARAMETERS, | 1757 HintCode.INVALID_METHOD_OVERRIDE_TYPE_PARAMETERS, |
|
Jennifer Messerly
2016/11/08 01:21:57
I think this one is okay though, because we don't
| |
| 1758 errorNameTarget, [ | 1758 errorNameTarget, [ |
| 1759 count, | 1759 count, |
| 1760 params2.length, | 1760 params2.length, |
| 1761 baseElement.enclosingElement.displayName | 1761 baseElement.enclosingElement.displayName |
| 1762 ]); | 1762 ]); |
| 1763 return true; | 1763 return true; |
| 1764 } | 1764 } |
| 1765 // We build up a substitution matching up the type parameters | 1765 // We build up a substitution matching up the type parameters |
| 1766 // from the two types, {variablesFresh/variables1} and | 1766 // from the two types, {variablesFresh/variables1} and |
| 1767 // {variablesFresh/variables2} | 1767 // {variablesFresh/variables2} |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 1781 variables1.add(variable1); | 1781 variables1.add(variable1); |
| 1782 variables2.add(variable2); | 1782 variables2.add(variable2); |
| 1783 variablesFresh.add(variableFresh); | 1783 variablesFresh.add(variableFresh); |
| 1784 DartType bound1 = p1.bound ?? DynamicTypeImpl.instance; | 1784 DartType bound1 = p1.bound ?? DynamicTypeImpl.instance; |
| 1785 DartType bound2 = p2.bound ?? DynamicTypeImpl.instance; | 1785 DartType bound2 = p2.bound ?? DynamicTypeImpl.instance; |
| 1786 bound1 = bound1.substitute2(variablesFresh, variables1); | 1786 bound1 = bound1.substitute2(variablesFresh, variables1); |
| 1787 bound2 = bound2.substitute2(variablesFresh, variables2); | 1787 bound2 = bound2.substitute2(variablesFresh, variables2); |
| 1788 pFresh.bound = bound2; | 1788 pFresh.bound = bound2; |
| 1789 if (!_typeSystem.isSubtypeOf(bound2, bound1)) { | 1789 if (!_typeSystem.isSubtypeOf(bound2, bound1)) { |
| 1790 _errorReporter.reportErrorForNode( | 1790 _errorReporter.reportErrorForNode( |
| 1791 StaticWarningCode.INVALID_METHOD_OVERRIDE_TYPE_PARAMETER_BOUND, | 1791 HintCode.INVALID_METHOD_OVERRIDE_TYPE_PARAMETER_BOUND, |
| 1792 errorNameTarget, [ | 1792 errorNameTarget, [ |
| 1793 p1.displayName, | 1793 p1.displayName, |
| 1794 p1.bound, | 1794 p1.bound, |
| 1795 p2.displayName, | 1795 p2.displayName, |
| 1796 p2.bound, | 1796 p2.bound, |
| 1797 baseElement.enclosingElement.displayName | 1797 baseElement.enclosingElement.displayName |
| 1798 ]); | 1798 ]); |
| 1799 return true; | 1799 return true; |
| 1800 } | 1800 } |
| 1801 } | 1801 } |
| (...skipping 5128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6930 class _InvocationCollector extends RecursiveAstVisitor { | 6930 class _InvocationCollector extends RecursiveAstVisitor { |
| 6931 final List<String> superCalls = <String>[]; | 6931 final List<String> superCalls = <String>[]; |
| 6932 | 6932 |
| 6933 @override | 6933 @override |
| 6934 visitMethodInvocation(MethodInvocation node) { | 6934 visitMethodInvocation(MethodInvocation node) { |
| 6935 if (node.target is SuperExpression) { | 6935 if (node.target is SuperExpression) { |
| 6936 superCalls.add(node.methodName.name); | 6936 superCalls.add(node.methodName.name); |
| 6937 } | 6937 } |
| 6938 } | 6938 } |
| 6939 } | 6939 } |
| OLD | NEW |