Skip to content

Commit

Permalink
Optional<int>.absent() != Optional<String>.absent() (#373)
Browse files Browse the repository at this point in the history
  • Loading branch information
a14n authored and cbracken committed Oct 16, 2017
1 parent 16c7fa2 commit 052b652
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/src/core/optional.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class Optional<T> extends IterableBase<T> {
int get hashCode => _value.hashCode;

/// Delegates to the underlying [value] operator==.
bool operator ==(o) => o is Optional && o._value == _value;
bool operator ==(o) => o is Optional<T> && o._value == _value;

String toString() {
return _value == null
Expand Down
4 changes: 4 additions & 0 deletions test/core/optional_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ main() {
expect(new Optional<int>.of(7), equals(new Optional<int>.of(7)));
expect(new Optional<int>.fromNullable(null),
equals(new Optional<int>.fromNullable(null)));
expect(
new Optional<int>.fromNullable(null) ==
new Optional<String>.fromNullable(null),
isFalse);
expect(new Optional<int>.fromNullable(null),
isNot(equals(new Optional<int>.of(7))));
expect(new Optional<int>.of(7), isNot(equals(new Optional<int>.of(8))));
Expand Down

0 comments on commit 052b652

Please sign in to comment.