Skip to content

Commit fd0617b

Browse files
srawlinscommit-bot@chromium.org
authored andcommitted
Improve listToString and setToString documentation. Fixes #26529
Bug: #26529 Change-Id: I4e2994dd39c676c2136c82d3e5dd9f45a8b154ce Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/82784 Commit-Queue: Samuel Rawlins <srawlins@google.com> Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
1 parent cb9eefc commit fd0617b

File tree

5 files changed

+31
-15
lines changed

5 files changed

+31
-15
lines changed

runtime/observatory/tests/service/step_through_mixin_from_sdk_test.dart

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,19 @@ List<String> stops = [];
3535
List<String> expected = [
3636
"$file:${LINE + 0}:17", // on "Foo" (in "new Foo()")
3737
"$file:${LINE + 1}:11", // on "="
38-
"list.dart:101:24", // on parameter to "contains"
39-
"list.dart:102:23", // on "length" in "this.length"
40-
"list.dart:103:16", // on "=" in "i = 0"
41-
"list.dart:103:23", // on "<" in "i < length"
42-
"list.dart:104:15", // on "[" in "this[i]"
38+
"list.dart:105:24", // on parameter to "contains"
39+
"list.dart:106:23", // on "length" in "this.length"
40+
"list.dart:107:16", // on "=" in "i = 0"
41+
"list.dart:107:23", // on "<" in "i < length"
42+
"list.dart:108:15", // on "[" in "this[i]"
4343
"$file:${LINE + 13}:23", // on parameter in "operator []"
4444
"$file:${LINE + 14}:5", // on "return"
45-
"list.dart:104:19", // on "=="
46-
"list.dart:105:26", // on "length" in "this.length"
47-
"list.dart:105:18", // on "!="
48-
"list.dart:103:34", // on "++" in "i++"
49-
"list.dart:103:23", // on "<" in "i < length"
50-
"list.dart:109:5", // on "return"
45+
"list.dart:108:19", // on "=="
46+
"list.dart:109:26", // on "length" in "this.length"
47+
"list.dart:109:18", // on "!="
48+
"list.dart:107:34", // on "++" in "i++"
49+
"list.dart:107:23", // on "<" in "i < length"
50+
"list.dart:113:5", // on "return"
5151
"$file:${LINE + 4}:5", // on "print"
5252
"$file:${LINE + 6}:1" // on ending '}'
5353
];

sdk/lib/collection/list.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ part of dart.collection;
2121
/// to the growable list, or, preferably, use `DelegatingList` from
2222
/// "package:collection/wrappers.dart" instead.
2323
abstract class ListBase<E> extends Object with ListMixin<E> {
24-
/// Convert a `List` to a string as `[each, element, as, string]`.
24+
/// Converts a [List] to a [String].
25+
///
26+
/// Converts [list] to a string by converting each element to a string (by
27+
/// calling [Object.toString]), joining them with ", ", and wrapping the
28+
/// result in "[" and "]".
2529
///
2630
/// Handles circular references where converting one of the elements
2731
/// to a string ends up converting [list] to a string again.

sdk/lib/collection/set.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,11 @@ abstract class SetMixin<E> implements Set<E> {
299299
/// `clear` in constant time. The default implementation works by removing every
300300
/// element.
301301
abstract class SetBase<E> extends Object with SetMixin<E> {
302-
/// Convert a `Set` to a string as `{each, element, as, string}`.
302+
/// Converts a [Set] to a [String].
303+
///
304+
/// Converts [set] to a string by converting each element to a string (by
305+
/// calling [Object.toString]), joining them with ", ", and wrapping the
306+
/// result in "{" and "}".
303307
///
304308
/// Handles circular references where converting one of the elements
305309
/// to a string ends up converting [set] to a string again.

sdk_nnbd/lib/collection/list.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ part of dart.collection;
2323
/// to the growable list, or, preferably, use `DelegatingList` from
2424
/// "package:collection/wrappers.dart" instead.
2525
abstract class ListBase<E> extends Object with ListMixin<E> {
26-
/// Convert a `List` to a string as `[each, element, as, string]`.
26+
/// Converts a [List] to a [String].
27+
///
28+
/// Converts [list] to a string by converting each element to a string (by
29+
/// calling [Object.toString]), joining them with ", ", and wrapping the
30+
/// result in "[" and "]".
2731
///
2832
/// Handles circular references where converting one of the elements
2933
/// to a string ends up converting [list] to a string again.

sdk_nnbd/lib/collection/set.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,11 @@ abstract class SetMixin<E> implements Set<E> {
301301
/// `clear` in constant time. The default implementation works by removing every
302302
/// element.
303303
abstract class SetBase<E> extends Object with SetMixin<E> {
304-
/// Convert a `Set` to a string as `{each, element, as, string}`.
304+
/// Converts a [Set] to a [String].
305+
///
306+
/// Converts [set] to a string by converting each element to a string (by
307+
/// calling [Object.toString]), joining them with ", ", and wrapping the
308+
/// result in "{" and "}".
305309
///
306310
/// Handles circular references where converting one of the elements
307311
/// to a string ends up converting [set] to a string again.

0 commit comments

Comments
 (0)