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

Issue 14246008: Allow Object when doing lookups. (Closed)

Created:
7 years, 8 months ago by floitsch
Modified:
7 years, 6 months ago
CC:
reviews_dartlang.org, ahe, dgrove, srdjan, blois
Visibility:
Public.

Description

Allow Object when doing lookups. According to our typing rules a Set<Apple> is a Set<Fruit>. However, before this change, we couldn't use it as a Set<Fruit>: === bool foo(Set<Fruit> fruits) { // Would yield a type-error since we actually got a Set<Apple>. return fruits.contains(new Banana()); } foo(new Set<Apple>()); === R=ajohnsen@google.com, blois@google.com, lrn@google.com Committed: https://code.google.com/p/dart/source/detail?r=24326

Patch Set 1 #

Total comments: 13

Patch Set 2 : Rebaso #

Patch Set 3 : More fixes. #

Patch Set 4 : Fix type error. #

Total comments: 4

Patch Set 5 : Make indexOf accept Objects and refactor test (no new tests yet). #

Patch Set 6 : Added tests. #

Total comments: 2

Patch Set 7 : Fix typo. #

Patch Set 8 : Fix firstWhere and lastWhere #

Patch Set 9 : Forgot to upload before committing #

Unified diffs Side-by-side diffs Delta from patch set Stats (+505 lines, -178 lines) Patch
M pkg/mdv_observe/lib/src/observable_map.dart View 1 2 2 chunks +4 lines, -4 lines 0 comments Download
M pkg/serialization/lib/src/serialization_helpers.dart View 1 2 3 4 5 6 7 8 4 chunks +5 lines, -5 lines 0 comments Download
M runtime/lib/array.dart View 1 2 3 4 4 chunks +6 lines, -6 lines 0 comments Download
M runtime/lib/collection_patch.dart View 1 8 chunks +10 lines, -10 lines 0 comments Download
M runtime/lib/growable_array.dart View 1 2 3 4 2 chunks +3 lines, -3 lines 0 comments Download
M runtime/lib/immutable_map.dart View 1 2 4 chunks +4 lines, -4 lines 0 comments Download
M samples/swarm/swarm_ui_lib/observable/observable.dart View 1 2 3 4 5 6 7 3 chunks +5 lines, -5 lines 0 comments Download
M sdk/lib/_collection_dev/iterable.dart View 1 2 3 4 5 6 7 8 5 chunks +6 lines, -6 lines 0 comments Download
M sdk/lib/_collection_dev/list.dart View 1 2 3 chunks +3 lines, -3 lines 0 comments Download
M sdk/lib/_internal/lib/collection_patch.dart View 1 2 11 chunks +11 lines, -11 lines 0 comments Download
M sdk/lib/_internal/lib/js_array.dart View 1 2 3 4 5 6 7 8 2 chunks +4 lines, -4 lines 0 comments Download
M sdk/lib/async/stream.dart View 1 2 3 4 5 6 7 8 4 chunks +7 lines, -7 lines 0 comments Download
M sdk/lib/collection/hash_map.dart View 1 1 chunk +4 lines, -4 lines 0 comments Download
M sdk/lib/collection/hash_set.dart View 1 2 3 chunks +5 lines, -5 lines 0 comments Download
M sdk/lib/collection/iterable.dart View 1 2 3 4 5 6 7 8 chunks +6 lines, -12 lines 0 comments Download
M sdk/lib/collection/linked_hash_map.dart View 1 1 chunk +4 lines, -4 lines 0 comments Download
M sdk/lib/collection/list.dart View 1 2 3 4 5 6 7 5 chunks +5 lines, -5 lines 0 comments Download
M sdk/lib/collection/splay_tree.dart View 1 2 2 chunks +5 lines, -4 lines 0 comments Download
M sdk/lib/core/iterable.dart View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M sdk/lib/core/map.dart View 1 2 4 chunks +4 lines, -5 lines 0 comments Download
M sdk/lib/core/set.dart View 1 2 4 chunks +5 lines, -5 lines 0 comments Download
M sdk/lib/core/uri.dart View 1 2 3 4 5 6 7 8 2 chunks +4 lines, -4 lines 0 comments Download
M sdk/lib/html/dart2js/html_dart2js.dart View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M sdk/lib/html/dartium/html_dartium.dart View 1 chunk +1 line, -1 line 0 comments Download
M sdk/lib/html/html_common/css_class_set.dart View 1 2 3 4 5 6 7 1 chunk +2 lines, -2 lines 0 comments Download
M sdk/lib/html/html_common/filtered_element_list.dart View 1 2 3 4 5 6 1 chunk +4 lines, -2 lines 0 comments Download
M sdk/lib/io/platform_impl.dart View 1 2 1 chunk +1 line, -1 line 0 comments Download
M sdk/lib/typed_data/dart2js/typed_data_dart2js.dart View 1 2 3 4 5 6 7 9 chunks +18 lines, -18 lines 0 comments Download
A tests/corelib/iterable_contains2_test.dart View 1 2 3 4 5 1 chunk +26 lines, -0 lines 0 comments Download
A tests/corelib/list_index_of2_test.dart View 1 2 3 4 5 1 chunk +27 lines, -0 lines 0 comments Download
M tests/corelib/list_index_of_test.dart View 1 2 3 4 1 chunk +23 lines, -29 lines 0 comments Download
A tests/corelib/map_contains_key_test.dart View 1 2 3 4 5 1 chunk +22 lines, -0 lines 0 comments Download
A tests/corelib/map_contains_value_test.dart View 1 2 3 4 5 1 chunk +23 lines, -0 lines 0 comments Download
A tests/corelib/map_index_test.dart View 1 2 3 4 5 1 chunk +22 lines, -0 lines 0 comments Download
A tests/corelib/map_remove_test.dart View 1 2 3 4 5 1 chunk +22 lines, -0 lines 0 comments Download
A tests/corelib/set_containsAll_test.dart View 1 2 3 4 5 1 chunk +21 lines, -0 lines 0 comments Download
A tests/corelib/set_contains_test.dart View 1 2 3 4 5 1 chunk +23 lines, -0 lines 0 comments Download
A tests/corelib/set_intersection_test.dart View 1 2 3 4 5 1 chunk +26 lines, -0 lines 0 comments Download
A tests/corelib/set_removeAll_test.dart View 1 2 3 4 5 1 chunk +23 lines, -0 lines 0 comments Download
A tests/corelib/set_remove_test.dart View 1 2 3 4 5 1 chunk +23 lines, -0 lines 0 comments Download
A tests/corelib/set_retainAll_test.dart View 1 2 3 4 5 1 chunk +23 lines, -0 lines 0 comments Download
M tests/html/custom_element_bindings_test.dart View 1 2 2 chunks +4 lines, -4 lines 0 comments Download
A tests/lib/async/stream_first_where_test.dart View 1 2 3 4 5 6 7 8 1 chunk +28 lines, -0 lines 0 comments Download
A tests/lib/async/stream_last_where_test.dart View 1 2 3 4 5 6 7 8 1 chunk +28 lines, -0 lines 0 comments Download
M tools/dom/src/WrappedList.dart View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
M tools/dom/templates/html/impl/impl_Element.darttemplate View 1 2 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 13 (0 generated)
floitsch
This looks like something we might want to get into M4.
7 years, 8 months ago (2013-04-16 15:32:47 UTC) #1
Anders Johnsen
LGTM with the collowing comment: The implementation should never throw an error, or we are ...
7 years, 8 months ago (2013-04-16 15:37:07 UTC) #2
Lasse Reichstein Nielsen
https://codereview.chromium.org/14246008/diff/1/sdk/lib/_internal/compiler/implementation/lib/collection_patch.dart File sdk/lib/_internal/compiler/implementation/lib/collection_patch.dart (right): https://codereview.chromium.org/14246008/diff/1/sdk/lib/_internal/compiler/implementation/lib/collection_patch.dart#newcode45 sdk/lib/_internal/compiler/implementation/lib/collection_patch.dart:45: return (strings == null) ? false : _hasTableEntry(strings, key); ...
7 years, 8 months ago (2013-04-24 09:11:18 UTC) #3
Lasse Reichstein Nielsen
Is SplayTreeMap compatible with this, unchanged? If it is, it's a *little* scary, since the ...
7 years, 7 months ago (2013-04-30 07:42:27 UTC) #4
floitsch
I think we already discussed that the splay-tree map doesn't have any problems. PTAL. I ...
7 years, 6 months ago (2013-06-17 18:25:34 UTC) #5
floitsch
Fix small type error.
7 years, 6 months ago (2013-06-17 18:39:41 UTC) #6
Lasse Reichstein Nielsen
lgtm https://codereview.chromium.org/14246008/diff/15001/runtime/lib/growable_array.dart File runtime/lib/growable_array.dart (right): https://codereview.chromium.org/14246008/diff/15001/runtime/lib/growable_array.dart#newcode215 runtime/lib/growable_array.dart:215: int indexOf(T element, [int start = 0]) { ...
7 years, 6 months ago (2013-06-18 14:13:08 UTC) #7
floitsch
Changed indexOf too. Added vm reviewers. Will commit tomorrow. https://codereview.chromium.org/14246008/diff/15001/runtime/lib/growable_array.dart File runtime/lib/growable_array.dart (right): https://codereview.chromium.org/14246008/diff/15001/runtime/lib/growable_array.dart#newcode215 runtime/lib/growable_array.dart:215: ...
7 years, 6 months ago (2013-06-20 15:52:50 UTC) #8
floitsch
CC +blois.
7 years, 6 months ago (2013-06-20 15:53:14 UTC) #9
blois
lgtm, with one nit. https://codereview.chromium.org/14246008/diff/25001/sdk/lib/html/html_common/filtered_element_list.dart File sdk/lib/html/html_common/filtered_element_list.dart (right): https://codereview.chromium.org/14246008/diff/25001/sdk/lib/html/html_common/filtered_element_list.dart#newcode63 sdk/lib/html/html_common/filtered_element_list.dart:63: if (needle != Element) return ...
7 years, 6 months ago (2013-06-20 15:58:58 UTC) #10
floitsch
https://codereview.chromium.org/14246008/diff/25001/sdk/lib/html/html_common/filtered_element_list.dart File sdk/lib/html/html_common/filtered_element_list.dart (right): https://codereview.chromium.org/14246008/diff/25001/sdk/lib/html/html_common/filtered_element_list.dart#newcode63 sdk/lib/html/html_common/filtered_element_list.dart:63: if (needle != Element) return false; On 2013/06/20 15:58:58, ...
7 years, 6 months ago (2013-06-20 16:00:05 UTC) #11
floitsch
Had to change firstWhere and lastWhere, too.
7 years, 6 months ago (2013-06-21 16:09:40 UTC) #12
floitsch
7 years, 6 months ago (2013-06-24 12:45:45 UTC) #13
Message was sent while issue was closed.
Committed patchset #8 manually as r24326 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698