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

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

Issue 1509693002: Issue 25108. Add ExecutableElement(s) into the 'invalid override' messages. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/error.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 engine.resolver.error_verifier; 5 library engine.resolver.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/src/generated/static_type_analyzer.dart'; 10 import 'package:analyzer/src/generated/static_type_analyzer.dart';
(...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 List<DartType> overridingPositionalPT = overridingFT.optionalParameterTypes; 1329 List<DartType> overridingPositionalPT = overridingFT.optionalParameterTypes;
1330 List<DartType> overriddenPositionalPT = overriddenFT.optionalParameterTypes; 1330 List<DartType> overriddenPositionalPT = overriddenFT.optionalParameterTypes;
1331 Map<String, DartType> overridingNamedPT = overridingFT.namedParameterTypes; 1331 Map<String, DartType> overridingNamedPT = overridingFT.namedParameterTypes;
1332 Map<String, DartType> overriddenNamedPT = overriddenFT.namedParameterTypes; 1332 Map<String, DartType> overriddenNamedPT = overriddenFT.namedParameterTypes;
1333 // CTEC.INVALID_OVERRIDE_REQUIRED, CTEC.INVALID_OVERRIDE_POSITIONAL and 1333 // CTEC.INVALID_OVERRIDE_REQUIRED, CTEC.INVALID_OVERRIDE_POSITIONAL and
1334 // CTEC.INVALID_OVERRIDE_NAMED 1334 // CTEC.INVALID_OVERRIDE_NAMED
1335 if (overridingNormalPT.length > overriddenNormalPT.length) { 1335 if (overridingNormalPT.length > overriddenNormalPT.length) {
1336 _errorReporter.reportErrorForNode( 1336 _errorReporter.reportErrorForNode(
1337 StaticWarningCode.INVALID_OVERRIDE_REQUIRED, errorNameTarget, [ 1337 StaticWarningCode.INVALID_OVERRIDE_REQUIRED, errorNameTarget, [
1338 overriddenNormalPT.length, 1338 overriddenNormalPT.length,
1339 overriddenExecutable,
1339 overriddenExecutable.enclosingElement.displayName 1340 overriddenExecutable.enclosingElement.displayName
1340 ]); 1341 ]);
1341 return true; 1342 return true;
1342 } 1343 }
1343 if (overridingNormalPT.length + overridingPositionalPT.length < 1344 if (overridingNormalPT.length + overridingPositionalPT.length <
1344 overriddenPositionalPT.length + overriddenNormalPT.length) { 1345 overriddenPositionalPT.length + overriddenNormalPT.length) {
1345 _errorReporter.reportErrorForNode( 1346 _errorReporter.reportErrorForNode(
1346 StaticWarningCode.INVALID_OVERRIDE_POSITIONAL, errorNameTarget, [ 1347 StaticWarningCode.INVALID_OVERRIDE_POSITIONAL, errorNameTarget, [
1347 overriddenPositionalPT.length + overriddenNormalPT.length, 1348 overriddenPositionalPT.length + overriddenNormalPT.length,
1349 overriddenExecutable,
1348 overriddenExecutable.enclosingElement.displayName 1350 overriddenExecutable.enclosingElement.displayName
1349 ]); 1351 ]);
1350 return true; 1352 return true;
1351 } 1353 }
1352 // For each named parameter in the overridden method, verify that there is 1354 // For each named parameter in the overridden method, verify that there is
1353 // the same name in the overriding method. 1355 // the same name in the overriding method.
1354 for (String overriddenParamName in overriddenNamedPT.keys) { 1356 for (String overriddenParamName in overriddenNamedPT.keys) {
1355 if (!overridingNamedPT.containsKey(overriddenParamName)) { 1357 if (!overridingNamedPT.containsKey(overriddenParamName)) {
1356 // The overridden method expected the overriding method to have 1358 // The overridden method expected the overriding method to have
1357 // overridingParamName, but it does not. 1359 // overridingParamName, but it does not.
1358 _errorReporter.reportErrorForNode( 1360 _errorReporter.reportErrorForNode(
1359 StaticWarningCode.INVALID_OVERRIDE_NAMED, errorNameTarget, [ 1361 StaticWarningCode.INVALID_OVERRIDE_NAMED, errorNameTarget, [
1360 overriddenParamName, 1362 overriddenParamName,
1363 overriddenExecutable,
1361 overriddenExecutable.enclosingElement.displayName 1364 overriddenExecutable.enclosingElement.displayName
1362 ]); 1365 ]);
1363 return true; 1366 return true;
1364 } 1367 }
1365 } 1368 }
1366 // SWC.INVALID_METHOD_OVERRIDE_RETURN_TYPE 1369 // SWC.INVALID_METHOD_OVERRIDE_RETURN_TYPE
1367 if (overriddenFTReturnType != VoidTypeImpl.instance && 1370 if (overriddenFTReturnType != VoidTypeImpl.instance &&
1368 !_typeSystem.isAssignableTo( 1371 !_typeSystem.isAssignableTo(
1369 overridingFTReturnType, overriddenFTReturnType)) { 1372 overridingFTReturnType, overriddenFTReturnType)) {
1370 _errorReporter.reportTypeErrorForNode( 1373 _errorReporter.reportTypeErrorForNode(
(...skipping 4706 matching lines...) Expand 10 before | Expand all | Expand 10 after
6077 toCheck.add(type.element); 6080 toCheck.add(type.element);
6078 // type arguments 6081 // type arguments
6079 if (type is InterfaceType) { 6082 if (type is InterfaceType) {
6080 InterfaceType interfaceType = type; 6083 InterfaceType interfaceType = type;
6081 for (DartType typeArgument in interfaceType.typeArguments) { 6084 for (DartType typeArgument in interfaceType.typeArguments) {
6082 _addTypeToCheck(typeArgument); 6085 _addTypeToCheck(typeArgument);
6083 } 6086 }
6084 } 6087 }
6085 } 6088 }
6086 } 6089 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/error.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698