Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional<int>.absent() != Optional<String>.absent() #373

Merged
merged 1 commit into from
Oct 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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