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

Issue 2311513002: Fix type errors in sort(). (Closed)

Created:
4 years, 3 months ago by Bob Nystrom
Modified:
4 years, 3 months ago
Reviewers:
vsm
CC:
dev-compiler+reviews_dartlang.org
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Fix type errors in sort(). If a comparer isn't provided, it was silently assuming the element type implements Comparable, even though that isn't required. Fixed to add a manual cast at each comparison. A stricter faster approach might be to check that the type argument itself is a type that implements Comparable, but I don't know if that's too pessimistic, or even possible to do. R=vsm@google.com Committed: https://github.com/dart-lang/dev_compiler/commit/33ff9a3d4fc3fe0cf8e12513ee27d812449a2ff2

Patch Set 1 #

Total comments: 2

Patch Set 2 : Use Comparable.compare(). #

Unified diffs Side-by-side diffs Delta from patch set Stats (+40 lines, -24 lines) Patch
M pkg/dev_compiler/lib/js/amd/dart_sdk.js View 1 5 chunks +8 lines, -4 lines 0 comments Download
M pkg/dev_compiler/lib/js/common/dart_sdk.js View 1 5 chunks +8 lines, -4 lines 0 comments Download
M pkg/dev_compiler/lib/js/es6/dart_sdk.js View 1 5 chunks +8 lines, -4 lines 0 comments Download
M pkg/dev_compiler/lib/js/legacy/dart_sdk.js View 1 5 chunks +8 lines, -4 lines 0 comments Download
M pkg/dev_compiler/tool/input_sdk/lib/collection/list.dart View 1 1 chunk +1 line, -1 line 0 comments Download
M pkg/dev_compiler/tool/input_sdk/private/js_array.dart View 1 1 chunk +5 lines, -1 line 0 comments Download
M pkg/dev_compiler/tool/sdk_expected_errors.txt View 1 2 chunks +2 lines, -6 lines 0 comments Download

Messages

Total messages: 6 (2 generated)
Bob Nystrom
4 years, 3 months ago (2016-09-06 21:14:56 UTC) #2
vsm
lgtm https://codereview.chromium.org/2311513002/diff/1/pkg/dev_compiler/tool/input_sdk/private/js_array.dart File pkg/dev_compiler/tool/input_sdk/private/js_array.dart (right): https://codereview.chromium.org/2311513002/diff/1/pkg/dev_compiler/tool/input_sdk/private/js_array.dart#newcode467 pkg/dev_compiler/tool/input_sdk/private/js_array.dart:467: Sort.sort(this, (a, b) => (a as Comparable).compareTo(b)); Maybe: ...
4 years, 3 months ago (2016-09-06 21:26:07 UTC) #3
Bob Nystrom
https://codereview.chromium.org/2311513002/diff/1/pkg/dev_compiler/tool/input_sdk/private/js_array.dart File pkg/dev_compiler/tool/input_sdk/private/js_array.dart (right): https://codereview.chromium.org/2311513002/diff/1/pkg/dev_compiler/tool/input_sdk/private/js_array.dart#newcode467 pkg/dev_compiler/tool/input_sdk/private/js_array.dart:467: Sort.sort(this, (a, b) => (a as Comparable).compareTo(b)); On 2016/09/06 ...
4 years, 3 months ago (2016-09-09 00:14:21 UTC) #4
Bob Nystrom
4 years, 3 months ago (2016-09-09 00:14:32 UTC) #6
Message was sent while issue was closed.
Committed patchset #2 (id:20001) manually as
33ff9a3d4fc3fe0cf8e12513ee27d812449a2ff2 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698