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

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

Issue 2045693002: Fix @protected checks to play nice with generic supers (linter#257). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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 | « no previous file | 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 2a141a60268d7cb81f04cf573c09c602c66f989c..9054cabe99869f5ada4ffebaf905bd9675017c72 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -982,9 +982,17 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
// return false;
// }
- bool _hasTypeOrSuperType(ClassElement element, InterfaceType type) =>
- element != null &&
- (element.type == type || element.allSupertypes.contains(type));
+ bool _hasTypeOrSuperType(ClassElement element, InterfaceType type) {
+ if (element == null) {
+ return false;
+ }
+ if (element.type == type) {
Brian Wilkerson 2016/06/06 20:23:00 I don't understand why this wouldn't be "element =
+ return true;
+ }
+ ClassElement typeElement = type.element;
+ return element.allSupertypes
+ .any((InterfaceType t) => t.element == typeElement);
+ }
/**
* Given a parenthesized expression, this returns the parent (or recursively grand-parent) of the
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/hint_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698