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

Issue 791453005: Tighten a couple type annotations in IterableMixin (Closed)

Created:
6 years ago by Jacob
Modified:
6 years ago
CC:
reviews_dartlang.org, vsm, Leaf
Target Ref:
refs/remotes/git-svn
Visibility:
Public.

Description

Tighten a couple type annotations in IterableMixin BUG= R=lrn@google.com Committed: https://code.google.com/p/dart/source/detail?r=42334

Patch Set 1 #

Patch Set 2 : Fixed ListMixin and SetMixin #

Unified diffs Side-by-side diffs Delta from patch set Stats (+8 lines, -8 lines) Patch
M sdk/lib/collection/iterable.dart View 4 chunks +4 lines, -4 lines 0 comments Download
M sdk/lib/collection/list.dart View 1 2 chunks +2 lines, -2 lines 0 comments Download
M sdk/lib/collection/set.dart View 1 2 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 11 (2 generated)
Jacob
This goes along with https://codereview.chromium.org/794953002 to fix some small inconsistencies in the types for dart:html
6 years ago (2014-12-12 01:57:28 UTC) #2
floitsch
This is a breaking change, so normally we don't allow them. I will let Lasse ...
6 years ago (2014-12-12 12:03:51 UTC) #4
Lasse Reichstein Nielsen
I'd say that this is just a bug. The interface of Iterable.firstWhere is written as ...
6 years ago (2014-12-12 12:39:26 UTC) #5
floitsch
On 2014/12/12 12:39:26, Lasse Reichstein Nielsen wrote: > I'd say that this is just a ...
6 years ago (2014-12-12 12:42:59 UTC) #6
Lasse Reichstein Nielsen
I guess that's a LGTM, and if you want to do ListMixin and SetMixin too, ...
6 years ago (2014-12-12 12:45:40 UTC) #7
Jacob
On 2014/12/12 12:45:40, Lasse Reichstein Nielsen wrote: > I guess that's a LGTM, and if ...
6 years ago (2014-12-12 17:55:33 UTC) #8
Jacob
Committed patchset #2 (id:20001) manually as 42334 (presubmit successful).
6 years ago (2014-12-12 18:01:00 UTC) #9
Jacob
This CL broke a CO19 test in Dartium checked mode. The CO19 test would have ...
6 years ago (2014-12-12 20:35:57 UTC) #10
floitsch
6 years ago (2014-12-13 16:56:45 UTC) #11
Message was sent while issue was closed.
On 2014/12/12 20:35:57, Jacob wrote:
> This CL broke a CO19 test in Dartium checked mode. The CO19 test would have
> failed if instead of being given a LinkedList it had been given an Iterable
that
> implemented the lastWhere method with the signature specified in "class
> Iterable".
> I can proceed by marking the CO19 test as skipped
There are extremely few cases where you want to use "Skip" in a status file.
Always prefer Fail (or Fail, Pass, ...) instead.

Yes: I would mark it as Fail and file a bug on Co19.

> or we can rethink whether we
> want to allow this change given that it could be a breaking change in Dartium
> checked mode.
> 
> 
> Broken version of CO19 test:
> We can fix the test by changing noneMatches to 4444444444 instead of new
> Object().
> 
> 
> 
> /*
>  * Copyright (c) 2011, the Dart project authors.  Please see the AUTHORS file
>  * for details. All rights reserved. Use of this source code is governed by a
>  * BSD-style license that can be found in the LICENSE file.
>  */
> /**
>  * @assertion dynamic lastWhere(bool test(E value), {Object orElse()})
>  * Returns the last element that satisfies the given predicate test.
>  * If none matches, the result of invoking the orElse function is returned.
>  * By default, when orElse is null, a StateError is thrown.
>  * @description Checks that If none matches, the result of invoking the orElse
>  * function is returned.
>  * @author kaigorodov
>  */
> import "../../../Utils/expect.dart";
> import "dart:collection";
> import "LinkedList.lib.dart";
> 
> var noneMatches=new Object();
> 
> void check(LinkedList a, var element) {
>   Expect.identical(noneMatches,
>     a.lastWhere(
>       (MyLinkedListEntry entry)=>entry.value==element,
>       orElse: ()=>noneMatches)
>     );
> }
> 
> main() {
>   LinkedList a = toLinkedList([42, 0, -1, 42, -1, 6031769, 0]);
>   check(a, 43);
>   check(a, 2);
>   check(a, -2);
>   check(a, 6031768);
> }

Powered by Google App Engine
This is Rietveld 408576698