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

Unified Diff: pkg/compiler/lib/src/types/flat_type_mask.dart

Issue 2284923002: Fix bug in locateSingleElement (Closed)
Patch Set: Created 4 years, 4 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 | tests/compiler/dart2js_extra/locate_single_element_1_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/types/flat_type_mask.dart
diff --git a/pkg/compiler/lib/src/types/flat_type_mask.dart b/pkg/compiler/lib/src/types/flat_type_mask.dart
index 90389a73915ed49b31a37b4575f89d5a9d6a8d48..59b573accb48283c7de992babaa37bdd736204e8 100644
--- a/pkg/compiler/lib/src/types/flat_type_mask.dart
+++ b/pkg/compiler/lib/src/types/flat_type_mask.dart
@@ -688,11 +688,13 @@ class FlatTypeMask implements TypeMask {
if (targets.length != 1) return null;
Element result = targets.first;
ClassElement enclosing = result.enclosingClass;
- // We only return the found element if it is guaranteed to be
- // implemented on the exact receiver type. It could be found in a
- // subclass or in an inheritance-wise unrelated class in case of
- // subtype selectors.
- return (base.isSubclassOf(enclosing)) ? result : null;
+ // We only return the found element if it is guaranteed to be implemented on
+ // all classes in the receiver type [this]. It could be found only in a
+ // subclass or in an inheritance-wise unrelated class in case of subtype
+ // selectors.
+ if (isSubtype) return null;
+ if (base.isSubclassOf(enclosing)) return result;
+ return null;
}
bool operator ==(var other) {
« no previous file with comments | « no previous file | tests/compiler/dart2js_extra/locate_single_element_1_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698