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

Unified Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 2174423005: Fix for false positive in field (not-)overriding. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/error.dart ('k') | pkg/analyzer/test/generated/hint_code_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/resolver.dart
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 8b583239440b30e4cd1d90517f083dc7cfe9abe2..9c78da091b308c633fee69ec44ccd5dc898c594d 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -5141,7 +5141,7 @@ class InstanceFieldResolverVisitor extends ResolverVisitor {
* Instances of the class `OverrideVerifier` visit all of the declarations in a compilation
* unit to verify that if they have an override annotation it is being used correctly.
*/
-class OverrideVerifier extends RecursiveAstVisitor<Object> {
+class OverrideVerifier extends RecursiveAstVisitor {
/**
* The error reporter used to report errors.
*/
@@ -5161,22 +5161,23 @@ class OverrideVerifier extends RecursiveAstVisitor<Object> {
OverrideVerifier(this._errorReporter, this._manager);
@override
- Object visitFieldDeclaration(FieldDeclaration node) {
+ visitFieldDeclaration(FieldDeclaration node) {
for (VariableDeclaration field in node.fields.variables) {
VariableElement fieldElement = field.element;
if (fieldElement is FieldElement && _isOverride(fieldElement)) {
- PropertyAccessorElement getterElement = fieldElement.getter;
- if (_getOverriddenMember(getterElement) == null) {
+ PropertyAccessorElement getter = fieldElement.getter;
+ PropertyAccessorElement setter = fieldElement.setter;
+ if (!(_getOverriddenMember(getter) != null ||
pquitslund 2016/07/26 05:32:49 Is it possible for `getter` to be null here? Do w
scheglov 2016/07/26 05:48:23 If other parts of analyzer work correctly, there s
Brian Wilkerson 2016/07/27 14:24:41 I'd rather that we just make other parts of analyz
+ setter != null && _getOverriddenMember(setter) != null)) {
_errorReporter.reportErrorForNode(
- HintCode.OVERRIDE_ON_NON_OVERRIDING_GETTER, field.name);
+ HintCode.OVERRIDE_ON_NON_OVERRIDING_FIELD, field.name);
}
}
}
- return super.visitFieldDeclaration(node);
}
@override
- Object visitMethodDeclaration(MethodDeclaration node) {
+ visitMethodDeclaration(MethodDeclaration node) {
ExecutableElement element = node.element;
if (_isOverride(element)) {
if (_getOverriddenMember(element) == null) {
@@ -5194,7 +5195,6 @@ class OverrideVerifier extends RecursiveAstVisitor<Object> {
}
}
}
- return super.visitMethodDeclaration(node);
}
/**
« no previous file with comments | « pkg/analyzer/lib/src/generated/error.dart ('k') | pkg/analyzer/test/generated/hint_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698