Remove weird operator== implementations.
R=johnniwinther@google.com
Review URL: https://codereview.chromium.org//18181013
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24603 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/sdk/lib/_internal/compiler/implementation/dart_types.dart b/sdk/lib/_internal/compiler/implementation/dart_types.dart
index fd9ed63..873b926 100644
--- a/sdk/lib/_internal/compiler/implementation/dart_types.dart
+++ b/sdk/lib/_internal/compiler/implementation/dart_types.dart
@@ -94,10 +94,6 @@
*/
bool forEachMalformedType(bool f(MalformedType type)) => true;
- // TODO(ahe): This is implicitly inherited from Object. What is the purpose
- // of duplicating it here?
- bool operator ==(other);
-
/**
* Is [: true :] if this type has no explict type arguments.
*/
@@ -346,10 +342,6 @@
return visitor.visitMalformedType(this, argument);
}
- // TODO(ahe): This is the default implementation that would be inherited if
- // DartType didn't declare an abstract method. What is the purpose?
- bool operator ==(other) => identical(this, other);
-
String toString() {
var sb = new StringBuffer();
if (typeArguments != null) {
@@ -456,7 +448,8 @@
bool operator ==(other) {
if (other is !GenericType) return false;
- return identical(element, other.element)
+ return kind == other.kind
+ && element == other.element
&& typeArguments == other.typeArguments;
}
@@ -465,7 +458,6 @@
GenericType asRaw() => element.rawType;
}
-// TODO(johnniwinther): Add common supertype for InterfaceType and TypedefType.
class InterfaceType extends GenericType {
final ClassElement element;
@@ -553,17 +545,6 @@
return null;
}
- bool operator ==(other) {
- // TODO(johnniwinther,karlklose): This is a bad implementation of
- // operator==. This implementation is not compatible with the
- // implementation in the superclass: another subclass of GenericType might
- // compare equal to an instance of this class if the other subclass forgets
- // to implement operator==. This is brittle and easy to avoid, ask ahe@
- // for concrete suggestions.
- if (other is !InterfaceType) return false;
- return super == other;
- }
-
int get hashCode => super.hashCode;
InterfaceType asRaw() => super.asRaw();
@@ -826,12 +807,6 @@
return definition.subst(typeArguments, declaration.typeArguments);
}
- bool operator ==(other) {
- // TODO(johnniwinther,karlklose): See InterfaceType.operator==.
- if (other is !TypedefType) return false;
- return super == other;
- }
-
int get hashCode => super.hashCode;
TypedefType asRaw() => super.asRaw();
diff --git a/tests/compiler/dart2js/analyze_api_test.dart b/tests/compiler/dart2js/analyze_api_test.dart
index e5bc2f4..3c5c9e7 100644
--- a/tests/compiler/dart2js/analyze_api_test.dart
+++ b/tests/compiler/dart2js/analyze_api_test.dart
@@ -22,11 +22,11 @@
const Map<String, List<String>> WHITE_LIST = const {
'sdk/lib/html/dart2js/html_dart2js.dart':
const ['Hint: The class "Rect" overrides "operator==", '
- 'but not "get hashCode".',
+ 'but not "get hashCode".', // http://dartbug.com/11613
'Hint: The class "Point" overrides "operator==", '
- 'but not "get hashCode".',
+ 'but not "get hashCode".', // http://dartbug.com/11613
'Hint: The class "_ClientRect" overrides "operator==", '
- 'but not "get hashCode".',
+ 'but not "get hashCode".', // http://dartbug.com/11613
],
};