Undo conversion from List() to [] and List(n) to List.filled(n, null) in comments.
Change-Id: I80b5e335f63e14a80db697e2ac3cbcf4c8d51d6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175253
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
diff --git a/pkg/compiler/lib/src/inferrer/builder_kernel.dart b/pkg/compiler/lib/src/inferrer/builder_kernel.dart
index fdfd67e..55d7ab6 100644
--- a/pkg/compiler/lib/src/inferrer/builder_kernel.dart
+++ b/pkg/compiler/lib/src/inferrer/builder_kernel.dart
@@ -1243,15 +1243,15 @@
var commonElements = _elementMap.commonElements;
if (commonElements.isUnnamedListConstructor(constructor)) {
- // We have `new List.filled(..., null)`.
+ // We have `new List(...)`.
if (arguments.positional.isEmpty && arguments.named.isEmpty) {
- // We have `[]`.
+ // We have `new List()`.
return _inferrer.concreteTypes.putIfAbsent(
node,
() => _types.allocateList(_types.growableListType, node,
_analyzedMember, _types.nonNullEmpty(), 0));
} else {
- // We have `new List.filled(len, null)`.
+ // We have `new List(len)`.
int length = _findLength(arguments);
return _inferrer.concreteTypes.putIfAbsent(
node,
diff --git a/pkg/compiler/lib/src/js_backend/runtime_types.dart b/pkg/compiler/lib/src/js_backend/runtime_types.dart
index 2998012..c8084d5 100644
--- a/pkg/compiler/lib/src/js_backend/runtime_types.dart
+++ b/pkg/compiler/lib/src/js_backend/runtime_types.dart
@@ -994,7 +994,7 @@
/// For instance `A` in:
///
/// class A {}
- /// main() => <A>[] is List<String>;
+ /// main() => new List<A>() is List<String>;
///
bool typeArgument = false;
@@ -1003,7 +1003,7 @@
/// For instance `A` in:
///
/// class A {}
- /// main() => <String>[] is List<A>;
+ /// main() => new List<String>() is List<A>;
///
bool checkedTypeArgument = false;
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
index e81ca79..7c66c12 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -3816,12 +3816,12 @@
return;
}
- // Recognize `[]` and `List.filled(n, null)`.
+ // Recognize `List()` and `List(n)`.
if (_commonElements.isUnnamedListConstructor(function)) {
if (invocation.arguments.named.isEmpty) {
int argumentCount = invocation.arguments.positional.length;
if (argumentCount == 0) {
- // `[]` takes no arguments, `JSArray.list()` takes a sentinel.
+ // `List()` takes no arguments, `JSArray.list()` takes a sentinel.
assert(arguments.length == 0 || arguments.length == 1,
'\narguments: $arguments\n');
_handleInvokeLegacyGrowableListFactoryConstructor(
@@ -3936,14 +3936,14 @@
stack.add(_setListRuntimeTypeInfoIfNeeded(pop(), type, sourceInformation));
}
- /// Handle the legacy `<T>[]` constructor.
+ /// Handle the legacy `List<T>()` constructor.
void _handleInvokeLegacyGrowableListFactoryConstructor(
ir.StaticInvocation invocation,
ConstructorEntity function,
AbstractValue typeMask,
List<HInstruction> arguments,
SourceInformation sourceInformation) {
- // `<T>[]` is essentially the same as `<T>[]`.
+ // `List<T>()` is essentially the same as `<T>[]`.
push(_buildLiteralList(<HInstruction>[]));
HInstruction allocation = pop();
var inferredType = globalInferenceResults.typeOfNewList(invocation);
@@ -3956,7 +3956,7 @@
_setListRuntimeTypeInfoIfNeeded(allocation, type, sourceInformation));
}
- /// Handle the `JSArray<T>.list(length)` and legacy `List<T>.filled(length, null)`
+ /// Handle the `JSArray<T>.list(length)` and legacy `List<T>(length)`
/// constructors.
void _handleInvokeLegacyFixedListFactoryConstructor(
ir.StaticInvocation invocation,
diff --git a/pkg/dev_compiler/doc/GENERIC_METHOD_COMMENTS.md b/pkg/dev_compiler/doc/GENERIC_METHOD_COMMENTS.md
index 8f23657..9050eab 100644
--- a/pkg/dev_compiler/doc/GENERIC_METHOD_COMMENTS.md
+++ b/pkg/dev_compiler/doc/GENERIC_METHOD_COMMENTS.md
@@ -139,7 +139,7 @@
```dart
List/*<T>*/ makeList/*<T extends num>*/() {
- return <num /*=T*/>[];
+ return new List<num /*=T*/>();
}
void main() {
@@ -174,7 +174,7 @@
var l0 = <dynamic /*=S*/>[x];
// as above, but with a regular constructor.
- var l1 = <dynamic /*=S*/>[];
+ var l1 = new List<dynamic /*=S*/>();
return l1;
}
```