Add alternatives for functions that should be deprecated.
`List.unmodifiable` and `Map.unmodifiable` is as badly typed as `List.from` and `Map.from`, but does not have a better-typed `.of` constructor. This adds such, to give a migration target when deprecating the badly typed constructors. The `Future.delayed` with no second argument is also unsafely typed, it fails if the type argument is not nullable. The `Future.pause` creates `Future<void>` instead. CoreLibraryReviewExempt: No new or platform specific behavior. Change-Id: Iba101b3dc62f412003abd501fa042aca0ce63116 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/499280 Commit-Queue: Lasse Nielsen <lrn@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com> Reviewed-by: Nate Bosch <nbosch@google.com>
This commit is contained in:
committed by
dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent
70b0c87d5f
commit
f35a3fcce4
@@ -4,6 +4,12 @@
|
||||
|
||||
### Libraries
|
||||
|
||||
#### `dart:async`
|
||||
|
||||
- Added `Future.pause` as alternative to `Future.delayed` with no callback.
|
||||
- Added `List.unmodifiableOf` with better typing than `List.unmodifiable`.
|
||||
- Added `Map.unmodifiableOf` with better typing than `Map.unmodifiable`.
|
||||
|
||||
#### `dart:io`
|
||||
|
||||
- The cookie-date parser now uses the correct algorithm again.
|
||||
|
||||
@@ -39,6 +39,8 @@ static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/arr
|
||||
return core::List::generate<self::_#MyList#generate#tearOff::T>(length, generator, growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#MyList#unmodifiable#tearOff<T extends core::num>(core::Iterable<dynamic> elements) → core::List<self::_#MyList#unmodifiable#tearOff::T>
|
||||
return core::List::unmodifiable<self::_#MyList#unmodifiable#tearOff::T>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/core/list.dart */ _#MyList#unmodifiableOf#tearOff<T extends core::num>(core::Iterable<self::_#MyList#unmodifiableOf#tearOff::T> elements) → core::List<self::_#MyList#unmodifiableOf#tearOff::T>
|
||||
return core::List::unmodifiableOf<self::_#MyList#unmodifiableOf#tearOff::T>(elements);
|
||||
|
||||
constants {
|
||||
#C1 = constructor-tearoff core::List::filled
|
||||
|
||||
+2
@@ -39,6 +39,8 @@ static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/arr
|
||||
return core::List::generate<self::_#MyList#generate#tearOff::T>(length, generator, growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#MyList#unmodifiable#tearOff<T extends core::num>(core::Iterable<dynamic> elements) → core::List<self::_#MyList#unmodifiable#tearOff::T>
|
||||
return core::List::unmodifiable<self::_#MyList#unmodifiable#tearOff::T>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/core/list.dart */ _#MyList#unmodifiableOf#tearOff<T extends core::num>(core::Iterable<self::_#MyList#unmodifiableOf#tearOff::T> elements) → core::List<self::_#MyList#unmodifiableOf#tearOff::T>
|
||||
return core::List::unmodifiableOf<self::_#MyList#unmodifiableOf#tearOff::T>(elements);
|
||||
|
||||
constants {
|
||||
#C1 = constructor-tearoff core::List::filled
|
||||
|
||||
+2
@@ -19,3 +19,5 @@ static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/arr
|
||||
return core::List::generate<self::_#MyList#generate#tearOff::T>(length, generator, growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#MyList#unmodifiable#tearOff<T extends core::num>(core::Iterable<dynamic> elements) → core::List<self::_#MyList#unmodifiable#tearOff::T>
|
||||
return core::List::unmodifiable<self::_#MyList#unmodifiable#tearOff::T>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/core/list.dart */ _#MyList#unmodifiableOf#tearOff<T extends core::num>(core::Iterable<self::_#MyList#unmodifiableOf#tearOff::T> elements) → core::List<self::_#MyList#unmodifiableOf#tearOff::T>
|
||||
return core::List::unmodifiableOf<self::_#MyList#unmodifiableOf#tearOff::T>(elements);
|
||||
|
||||
+3
-1
@@ -39,6 +39,8 @@ static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/arr
|
||||
return core::List::generate<self::_#MyList#generate#tearOff::T>(length, generator, growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#MyList#unmodifiable#tearOff<T extends core::num>(core::Iterable<dynamic> elements) → core::List<self::_#MyList#unmodifiable#tearOff::T>
|
||||
return core::List::unmodifiable<self::_#MyList#unmodifiable#tearOff::T>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/core/list.dart */ _#MyList#unmodifiableOf#tearOff<T extends core::num>(core::Iterable<self::_#MyList#unmodifiableOf#tearOff::T> elements) → core::List<self::_#MyList#unmodifiableOf#tearOff::T>
|
||||
return core::List::unmodifiableOf<self::_#MyList#unmodifiableOf#tearOff::T>(elements);
|
||||
|
||||
constants {
|
||||
#C1 = constructor-tearoff core::List::filled
|
||||
@@ -52,4 +54,4 @@ constants {
|
||||
Extra constant evaluation status:
|
||||
Evaluated: StaticInvocation @ org-dartlang-testcase:///issue47462.dart:18:16 -> BoolConstant(true)
|
||||
Evaluated: StaticInvocation @ org-dartlang-testcase:///issue47462.dart:19:17 -> BoolConstant(false)
|
||||
Extra constant evaluation: evaluated: 50, effectively constant: 2
|
||||
Extra constant evaluation: evaluated: 52, effectively constant: 2
|
||||
|
||||
@@ -555,6 +555,8 @@ static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/arr
|
||||
return core::List::generate<self::E16b% /* erasure=invalid-type, declared=! */>(length, generator, growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias16a#unmodifiable#tearOff<unrelated T extends core::Object? = dynamic>(core::Iterable<dynamic> elements) → core::List<self::E16b% /* erasure=invalid-type, declared=! */>
|
||||
return core::List::unmodifiable<self::E16b% /* erasure=invalid-type, declared=! */>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/core/list.dart */ _#Alias16a#unmodifiableOf#tearOff<unrelated T extends core::Object? = dynamic>(core::Iterable<self::E16b% /* erasure=invalid-type, declared=! */> elements) → core::List<self::E16b% /* erasure=invalid-type, declared=! */>
|
||||
return core::List::unmodifiableOf<self::E16b% /* erasure=invalid-type, declared=! */>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias16b#empty#tearOff<unrelated T extends core::Object? = dynamic>({core::bool growable = #C2}) → core::List<self::E16a% /* erasure=invalid-type, declared=! */>
|
||||
return core::List::empty<self::E16a% /* erasure=invalid-type, declared=! */>(growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias16b#filled#tearOff<unrelated T extends core::Object? = dynamic>(core::int length, self::E16a% /* erasure=invalid-type, declared=! */ fill, {core::bool growable = #C2}) → core::List<self::E16a% /* erasure=invalid-type, declared=! */>
|
||||
@@ -567,6 +569,8 @@ static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/arr
|
||||
return core::List::generate<self::E16a% /* erasure=invalid-type, declared=! */>(length, generator, growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias16b#unmodifiable#tearOff<unrelated T extends core::Object? = dynamic>(core::Iterable<dynamic> elements) → core::List<self::E16a% /* erasure=invalid-type, declared=! */>
|
||||
return core::List::unmodifiable<self::E16a% /* erasure=invalid-type, declared=! */>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/core/list.dart */ _#Alias16b#unmodifiableOf#tearOff<unrelated T extends core::Object? = dynamic>(core::Iterable<self::E16a% /* erasure=invalid-type, declared=! */> elements) → core::List<self::E16a% /* erasure=invalid-type, declared=! */>
|
||||
return core::List::unmodifiableOf<self::E16a% /* erasure=invalid-type, declared=! */>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias23#empty#tearOff<T extends self::E23% /* erasure=invalid-type, declared=! */>({core::bool growable = #C2}) → core::List<self::_#Alias23#empty#tearOff::T%>
|
||||
return core::List::empty<self::_#Alias23#empty#tearOff::T%>(growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias23#filled#tearOff<T extends self::E23% /* erasure=invalid-type, declared=! */>(core::int length, self::_#Alias23#filled#tearOff::T% fill, {core::bool growable = #C2}) → core::List<self::_#Alias23#filled#tearOff::T%>
|
||||
@@ -579,6 +583,8 @@ static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/arr
|
||||
return core::List::generate<self::_#Alias23#generate#tearOff::T%>(length, generator, growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias23#unmodifiable#tearOff<T extends self::E23% /* erasure=invalid-type, declared=! */>(core::Iterable<dynamic> elements) → core::List<self::_#Alias23#unmodifiable#tearOff::T%>
|
||||
return core::List::unmodifiable<self::_#Alias23#unmodifiable#tearOff::T%>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/core/list.dart */ _#Alias23#unmodifiableOf#tearOff<T extends self::E23% /* erasure=invalid-type, declared=! */>(core::Iterable<self::_#Alias23#unmodifiableOf#tearOff::T%> elements) → core::List<self::_#Alias23#unmodifiableOf#tearOff::T%>
|
||||
return core::List::unmodifiableOf<self::_#Alias23#unmodifiableOf#tearOff::T%>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias24#empty#tearOff<T extends self::E24<self::_#Alias24#empty#tearOff::T%>% /* erasure=invalid-type, declared=! */ = self::E24<dynamic>% /* erasure=invalid-type, declared=! */>({core::bool growable = #C2}) → core::List<self::_#Alias24#empty#tearOff::T%>
|
||||
return core::List::empty<self::_#Alias24#empty#tearOff::T%>(growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias24#filled#tearOff<T extends self::E24<self::_#Alias24#filled#tearOff::T%>% /* erasure=invalid-type, declared=! */ = self::E24<dynamic>% /* erasure=invalid-type, declared=! */>(core::int length, self::_#Alias24#filled#tearOff::T% fill, {core::bool growable = #C2}) → core::List<self::_#Alias24#filled#tearOff::T%>
|
||||
@@ -591,6 +597,8 @@ static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/arr
|
||||
return core::List::generate<self::_#Alias24#generate#tearOff::T%>(length, generator, growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias24#unmodifiable#tearOff<T extends self::E24<self::_#Alias24#unmodifiable#tearOff::T%>% /* erasure=invalid-type, declared=! */ = self::E24<dynamic>% /* erasure=invalid-type, declared=! */>(core::Iterable<dynamic> elements) → core::List<self::_#Alias24#unmodifiable#tearOff::T%>
|
||||
return core::List::unmodifiable<self::_#Alias24#unmodifiable#tearOff::T%>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/core/list.dart */ _#Alias24#unmodifiableOf#tearOff<T extends self::E24<self::_#Alias24#unmodifiableOf#tearOff::T%>% /* erasure=invalid-type, declared=! */ = self::E24<dynamic>% /* erasure=invalid-type, declared=! */>(core::Iterable<self::_#Alias24#unmodifiableOf#tearOff::T%> elements) → core::List<self::_#Alias24#unmodifiableOf#tearOff::T%>
|
||||
return core::List::unmodifiableOf<self::_#Alias24#unmodifiableOf#tearOff::T%>(elements);
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
|
||||
+8
@@ -555,6 +555,8 @@ static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/arr
|
||||
return core::List::generate<self::E16b% /* erasure=invalid-type, declared=! */>(length, generator, growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias16a#unmodifiable#tearOff<unrelated T extends core::Object? = dynamic>(core::Iterable<dynamic> elements) → core::List<self::E16b% /* erasure=invalid-type, declared=! */>
|
||||
return core::List::unmodifiable<self::E16b% /* erasure=invalid-type, declared=! */>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/core/list.dart */ _#Alias16a#unmodifiableOf#tearOff<unrelated T extends core::Object? = dynamic>(core::Iterable<self::E16b% /* erasure=invalid-type, declared=! */> elements) → core::List<self::E16b% /* erasure=invalid-type, declared=! */>
|
||||
return core::List::unmodifiableOf<self::E16b% /* erasure=invalid-type, declared=! */>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias16b#empty#tearOff<unrelated T extends core::Object? = dynamic>({core::bool growable = #C2}) → core::List<self::E16a% /* erasure=invalid-type, declared=! */>
|
||||
return core::List::empty<self::E16a% /* erasure=invalid-type, declared=! */>(growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias16b#filled#tearOff<unrelated T extends core::Object? = dynamic>(core::int length, self::E16a% /* erasure=invalid-type, declared=! */ fill, {core::bool growable = #C2}) → core::List<self::E16a% /* erasure=invalid-type, declared=! */>
|
||||
@@ -567,6 +569,8 @@ static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/arr
|
||||
return core::List::generate<self::E16a% /* erasure=invalid-type, declared=! */>(length, generator, growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias16b#unmodifiable#tearOff<unrelated T extends core::Object? = dynamic>(core::Iterable<dynamic> elements) → core::List<self::E16a% /* erasure=invalid-type, declared=! */>
|
||||
return core::List::unmodifiable<self::E16a% /* erasure=invalid-type, declared=! */>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/core/list.dart */ _#Alias16b#unmodifiableOf#tearOff<unrelated T extends core::Object? = dynamic>(core::Iterable<self::E16a% /* erasure=invalid-type, declared=! */> elements) → core::List<self::E16a% /* erasure=invalid-type, declared=! */>
|
||||
return core::List::unmodifiableOf<self::E16a% /* erasure=invalid-type, declared=! */>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias23#empty#tearOff<T extends self::E23% /* erasure=invalid-type, declared=! */>({core::bool growable = #C2}) → core::List<self::_#Alias23#empty#tearOff::T%>
|
||||
return core::List::empty<self::_#Alias23#empty#tearOff::T%>(growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias23#filled#tearOff<T extends self::E23% /* erasure=invalid-type, declared=! */>(core::int length, self::_#Alias23#filled#tearOff::T% fill, {core::bool growable = #C2}) → core::List<self::_#Alias23#filled#tearOff::T%>
|
||||
@@ -579,6 +583,8 @@ static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/arr
|
||||
return core::List::generate<self::_#Alias23#generate#tearOff::T%>(length, generator, growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias23#unmodifiable#tearOff<T extends self::E23% /* erasure=invalid-type, declared=! */>(core::Iterable<dynamic> elements) → core::List<self::_#Alias23#unmodifiable#tearOff::T%>
|
||||
return core::List::unmodifiable<self::_#Alias23#unmodifiable#tearOff::T%>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/core/list.dart */ _#Alias23#unmodifiableOf#tearOff<T extends self::E23% /* erasure=invalid-type, declared=! */>(core::Iterable<self::_#Alias23#unmodifiableOf#tearOff::T%> elements) → core::List<self::_#Alias23#unmodifiableOf#tearOff::T%>
|
||||
return core::List::unmodifiableOf<self::_#Alias23#unmodifiableOf#tearOff::T%>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias24#empty#tearOff<T extends self::E24<self::_#Alias24#empty#tearOff::T%>% /* erasure=invalid-type, declared=! */ = self::E24<dynamic>% /* erasure=invalid-type, declared=! */>({core::bool growable = #C2}) → core::List<self::_#Alias24#empty#tearOff::T%>
|
||||
return core::List::empty<self::_#Alias24#empty#tearOff::T%>(growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias24#filled#tearOff<T extends self::E24<self::_#Alias24#filled#tearOff::T%>% /* erasure=invalid-type, declared=! */ = self::E24<dynamic>% /* erasure=invalid-type, declared=! */>(core::int length, self::_#Alias24#filled#tearOff::T% fill, {core::bool growable = #C2}) → core::List<self::_#Alias24#filled#tearOff::T%>
|
||||
@@ -591,6 +597,8 @@ static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/arr
|
||||
return core::List::generate<self::_#Alias24#generate#tearOff::T%>(length, generator, growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias24#unmodifiable#tearOff<T extends self::E24<self::_#Alias24#unmodifiable#tearOff::T%>% /* erasure=invalid-type, declared=! */ = self::E24<dynamic>% /* erasure=invalid-type, declared=! */>(core::Iterable<dynamic> elements) → core::List<self::_#Alias24#unmodifiable#tearOff::T%>
|
||||
return core::List::unmodifiable<self::_#Alias24#unmodifiable#tearOff::T%>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/core/list.dart */ _#Alias24#unmodifiableOf#tearOff<T extends self::E24<self::_#Alias24#unmodifiableOf#tearOff::T%>% /* erasure=invalid-type, declared=! */ = self::E24<dynamic>% /* erasure=invalid-type, declared=! */>(core::Iterable<self::_#Alias24#unmodifiableOf#tearOff::T%> elements) → core::List<self::_#Alias24#unmodifiableOf#tearOff::T%>
|
||||
return core::List::unmodifiableOf<self::_#Alias24#unmodifiableOf#tearOff::T%>(elements);
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
|
||||
+8
@@ -495,6 +495,8 @@ static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/arr
|
||||
return core::List::generate<self::E16b% /* erasure=invalid-type, declared=! */>(length, generator, growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias16a#unmodifiable#tearOff<unrelated T extends core::Object? = dynamic>(core::Iterable<dynamic> elements) → core::List<self::E16b% /* erasure=invalid-type, declared=! */>
|
||||
return core::List::unmodifiable<self::E16b% /* erasure=invalid-type, declared=! */>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/core/list.dart */ _#Alias16a#unmodifiableOf#tearOff<unrelated T extends core::Object? = dynamic>(core::Iterable<self::E16b% /* erasure=invalid-type, declared=! */> elements) → core::List<self::E16b% /* erasure=invalid-type, declared=! */>
|
||||
return core::List::unmodifiableOf<self::E16b% /* erasure=invalid-type, declared=! */>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias16b#empty#tearOff<unrelated T extends core::Object? = dynamic>({has-declared-initializer core::bool growable}) → core::List<self::E16a% /* erasure=invalid-type, declared=! */>
|
||||
return core::List::empty<self::E16a% /* erasure=invalid-type, declared=! */>(growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias16b#filled#tearOff<unrelated T extends core::Object? = dynamic>(core::int length, self::E16a% /* erasure=invalid-type, declared=! */ fill, {has-declared-initializer core::bool growable}) → core::List<self::E16a% /* erasure=invalid-type, declared=! */>
|
||||
@@ -507,6 +509,8 @@ static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/arr
|
||||
return core::List::generate<self::E16a% /* erasure=invalid-type, declared=! */>(length, generator, growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias16b#unmodifiable#tearOff<unrelated T extends core::Object? = dynamic>(core::Iterable<dynamic> elements) → core::List<self::E16a% /* erasure=invalid-type, declared=! */>
|
||||
return core::List::unmodifiable<self::E16a% /* erasure=invalid-type, declared=! */>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/core/list.dart */ _#Alias16b#unmodifiableOf#tearOff<unrelated T extends core::Object? = dynamic>(core::Iterable<self::E16a% /* erasure=invalid-type, declared=! */> elements) → core::List<self::E16a% /* erasure=invalid-type, declared=! */>
|
||||
return core::List::unmodifiableOf<self::E16a% /* erasure=invalid-type, declared=! */>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias23#empty#tearOff<T extends self::E23% /* erasure=invalid-type, declared=! */>({has-declared-initializer core::bool growable}) → core::List<self::_#Alias23#empty#tearOff::T%>
|
||||
return core::List::empty<self::_#Alias23#empty#tearOff::T%>(growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias23#filled#tearOff<T extends self::E23% /* erasure=invalid-type, declared=! */>(core::int length, self::_#Alias23#filled#tearOff::T% fill, {has-declared-initializer core::bool growable}) → core::List<self::_#Alias23#filled#tearOff::T%>
|
||||
@@ -519,6 +523,8 @@ static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/arr
|
||||
return core::List::generate<self::_#Alias23#generate#tearOff::T%>(length, generator, growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias23#unmodifiable#tearOff<T extends self::E23% /* erasure=invalid-type, declared=! */>(core::Iterable<dynamic> elements) → core::List<self::_#Alias23#unmodifiable#tearOff::T%>
|
||||
return core::List::unmodifiable<self::_#Alias23#unmodifiable#tearOff::T%>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/core/list.dart */ _#Alias23#unmodifiableOf#tearOff<T extends self::E23% /* erasure=invalid-type, declared=! */>(core::Iterable<self::_#Alias23#unmodifiableOf#tearOff::T%> elements) → core::List<self::_#Alias23#unmodifiableOf#tearOff::T%>
|
||||
return core::List::unmodifiableOf<self::_#Alias23#unmodifiableOf#tearOff::T%>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias24#empty#tearOff<T extends self::E24<self::_#Alias24#empty#tearOff::T%>% /* erasure=invalid-type, declared=! */ = self::E24<dynamic>% /* erasure=invalid-type, declared=! */>({has-declared-initializer core::bool growable}) → core::List<self::_#Alias24#empty#tearOff::T%>
|
||||
return core::List::empty<self::_#Alias24#empty#tearOff::T%>(growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias24#filled#tearOff<T extends self::E24<self::_#Alias24#filled#tearOff::T%>% /* erasure=invalid-type, declared=! */ = self::E24<dynamic>% /* erasure=invalid-type, declared=! */>(core::int length, self::_#Alias24#filled#tearOff::T% fill, {has-declared-initializer core::bool growable}) → core::List<self::_#Alias24#filled#tearOff::T%>
|
||||
@@ -531,3 +537,5 @@ static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/arr
|
||||
return core::List::generate<self::_#Alias24#generate#tearOff::T%>(length, generator, growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias24#unmodifiable#tearOff<T extends self::E24<self::_#Alias24#unmodifiable#tearOff::T%>% /* erasure=invalid-type, declared=! */ = self::E24<dynamic>% /* erasure=invalid-type, declared=! */>(core::Iterable<dynamic> elements) → core::List<self::_#Alias24#unmodifiable#tearOff::T%>
|
||||
return core::List::unmodifiable<self::_#Alias24#unmodifiable#tearOff::T%>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/core/list.dart */ _#Alias24#unmodifiableOf#tearOff<T extends self::E24<self::_#Alias24#unmodifiableOf#tearOff::T%>% /* erasure=invalid-type, declared=! */ = self::E24<dynamic>% /* erasure=invalid-type, declared=! */>(core::Iterable<self::_#Alias24#unmodifiableOf#tearOff::T%> elements) → core::List<self::_#Alias24#unmodifiableOf#tearOff::T%>
|
||||
return core::List::unmodifiableOf<self::_#Alias24#unmodifiableOf#tearOff::T%>(elements);
|
||||
|
||||
+8
@@ -555,6 +555,8 @@ static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/arr
|
||||
return core::List::generate<self::E16b% /* erasure=invalid-type, declared=! */>(length, generator, growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias16a#unmodifiable#tearOff<unrelated T extends core::Object? = dynamic>(core::Iterable<dynamic> elements) → core::List<self::E16b% /* erasure=invalid-type, declared=! */>
|
||||
return core::List::unmodifiable<self::E16b% /* erasure=invalid-type, declared=! */>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/core/list.dart */ _#Alias16a#unmodifiableOf#tearOff<unrelated T extends core::Object? = dynamic>(core::Iterable<self::E16b% /* erasure=invalid-type, declared=! */> elements) → core::List<self::E16b% /* erasure=invalid-type, declared=! */>
|
||||
return core::List::unmodifiableOf<self::E16b% /* erasure=invalid-type, declared=! */>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias16b#empty#tearOff<unrelated T extends core::Object? = dynamic>({core::bool growable = #C2}) → core::List<self::E16a% /* erasure=invalid-type, declared=! */>
|
||||
return core::List::empty<self::E16a% /* erasure=invalid-type, declared=! */>(growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias16b#filled#tearOff<unrelated T extends core::Object? = dynamic>(core::int length, self::E16a% /* erasure=invalid-type, declared=! */ fill, {core::bool growable = #C2}) → core::List<self::E16a% /* erasure=invalid-type, declared=! */>
|
||||
@@ -567,6 +569,8 @@ static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/arr
|
||||
return core::List::generate<self::E16a% /* erasure=invalid-type, declared=! */>(length, generator, growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias16b#unmodifiable#tearOff<unrelated T extends core::Object? = dynamic>(core::Iterable<dynamic> elements) → core::List<self::E16a% /* erasure=invalid-type, declared=! */>
|
||||
return core::List::unmodifiable<self::E16a% /* erasure=invalid-type, declared=! */>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/core/list.dart */ _#Alias16b#unmodifiableOf#tearOff<unrelated T extends core::Object? = dynamic>(core::Iterable<self::E16a% /* erasure=invalid-type, declared=! */> elements) → core::List<self::E16a% /* erasure=invalid-type, declared=! */>
|
||||
return core::List::unmodifiableOf<self::E16a% /* erasure=invalid-type, declared=! */>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias23#empty#tearOff<T extends self::E23% /* erasure=invalid-type, declared=! */>({core::bool growable = #C2}) → core::List<self::_#Alias23#empty#tearOff::T%>
|
||||
return core::List::empty<self::_#Alias23#empty#tearOff::T%>(growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias23#filled#tearOff<T extends self::E23% /* erasure=invalid-type, declared=! */>(core::int length, self::_#Alias23#filled#tearOff::T% fill, {core::bool growable = #C2}) → core::List<self::_#Alias23#filled#tearOff::T%>
|
||||
@@ -579,6 +583,8 @@ static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/arr
|
||||
return core::List::generate<self::_#Alias23#generate#tearOff::T%>(length, generator, growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias23#unmodifiable#tearOff<T extends self::E23% /* erasure=invalid-type, declared=! */>(core::Iterable<dynamic> elements) → core::List<self::_#Alias23#unmodifiable#tearOff::T%>
|
||||
return core::List::unmodifiable<self::_#Alias23#unmodifiable#tearOff::T%>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/core/list.dart */ _#Alias23#unmodifiableOf#tearOff<T extends self::E23% /* erasure=invalid-type, declared=! */>(core::Iterable<self::_#Alias23#unmodifiableOf#tearOff::T%> elements) → core::List<self::_#Alias23#unmodifiableOf#tearOff::T%>
|
||||
return core::List::unmodifiableOf<self::_#Alias23#unmodifiableOf#tearOff::T%>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias24#empty#tearOff<T extends self::E24<self::_#Alias24#empty#tearOff::T%>% /* erasure=invalid-type, declared=! */ = self::E24<dynamic>% /* erasure=invalid-type, declared=! */>({core::bool growable = #C2}) → core::List<self::_#Alias24#empty#tearOff::T%>
|
||||
return core::List::empty<self::_#Alias24#empty#tearOff::T%>(growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias24#filled#tearOff<T extends self::E24<self::_#Alias24#filled#tearOff::T%>% /* erasure=invalid-type, declared=! */ = self::E24<dynamic>% /* erasure=invalid-type, declared=! */>(core::int length, self::_#Alias24#filled#tearOff::T% fill, {core::bool growable = #C2}) → core::List<self::_#Alias24#filled#tearOff::T%>
|
||||
@@ -591,6 +597,8 @@ static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/arr
|
||||
return core::List::generate<self::_#Alias24#generate#tearOff::T%>(length, generator, growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#Alias24#unmodifiable#tearOff<T extends self::E24<self::_#Alias24#unmodifiable#tearOff::T%>% /* erasure=invalid-type, declared=! */ = self::E24<dynamic>% /* erasure=invalid-type, declared=! */>(core::Iterable<dynamic> elements) → core::List<self::_#Alias24#unmodifiable#tearOff::T%>
|
||||
return core::List::unmodifiable<self::_#Alias24#unmodifiable#tearOff::T%>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/core/list.dart */ _#Alias24#unmodifiableOf#tearOff<T extends self::E24<self::_#Alias24#unmodifiableOf#tearOff::T%>% /* erasure=invalid-type, declared=! */ = self::E24<dynamic>% /* erasure=invalid-type, declared=! */>(core::Iterable<self::_#Alias24#unmodifiableOf#tearOff::T%> elements) → core::List<self::_#Alias24#unmodifiableOf#tearOff::T%>
|
||||
return core::List::unmodifiableOf<self::_#Alias24#unmodifiableOf#tearOff::T%>(elements);
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
|
||||
@@ -39,6 +39,8 @@ static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/arr
|
||||
return core::List::generate<self::_#MyList#generate#tearOff::T>(length, generator, growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#MyList#unmodifiable#tearOff<T extends core::num>(core::Iterable<dynamic> elements) → core::List<self::_#MyList#unmodifiable#tearOff::T>
|
||||
return core::List::unmodifiable<self::_#MyList#unmodifiable#tearOff::T>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/core/list.dart */ _#MyList#unmodifiableOf#tearOff<T extends core::num>(core::Iterable<self::_#MyList#unmodifiableOf#tearOff::T> elements) → core::List<self::_#MyList#unmodifiableOf#tearOff::T>
|
||||
return core::List::unmodifiableOf<self::_#MyList#unmodifiableOf#tearOff::T>(elements);
|
||||
|
||||
constants {
|
||||
#C1 = constructor-tearoff core::List::filled
|
||||
|
||||
@@ -39,6 +39,8 @@ static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/arr
|
||||
return core::List::generate<self::_#MyList#generate#tearOff::T>(length, generator, growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#MyList#unmodifiable#tearOff<T extends core::num>(core::Iterable<dynamic> elements) → core::List<self::_#MyList#unmodifiable#tearOff::T>
|
||||
return core::List::unmodifiable<self::_#MyList#unmodifiable#tearOff::T>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/core/list.dart */ _#MyList#unmodifiableOf#tearOff<T extends core::num>(core::Iterable<self::_#MyList#unmodifiableOf#tearOff::T> elements) → core::List<self::_#MyList#unmodifiableOf#tearOff::T>
|
||||
return core::List::unmodifiableOf<self::_#MyList#unmodifiableOf#tearOff::T>(elements);
|
||||
|
||||
constants {
|
||||
#C1 = constructor-tearoff core::List::filled
|
||||
|
||||
@@ -19,3 +19,5 @@ static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/arr
|
||||
return core::List::generate<self::_#MyList#generate#tearOff::T>(length, generator, growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#MyList#unmodifiable#tearOff<T extends core::num>(core::Iterable<dynamic> elements) → core::List<self::_#MyList#unmodifiable#tearOff::T>
|
||||
return core::List::unmodifiable<self::_#MyList#unmodifiable#tearOff::T>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/core/list.dart */ _#MyList#unmodifiableOf#tearOff<T extends core::num>(core::Iterable<self::_#MyList#unmodifiableOf#tearOff::T> elements) → core::List<self::_#MyList#unmodifiableOf#tearOff::T>
|
||||
return core::List::unmodifiableOf<self::_#MyList#unmodifiableOf#tearOff::T>(elements);
|
||||
|
||||
@@ -39,6 +39,8 @@ static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/arr
|
||||
return core::List::generate<self::_#MyList#generate#tearOff::T>(length, generator, growable: growable);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/_internal/vm/lib/array_patch.dart */ _#MyList#unmodifiable#tearOff<T extends core::num>(core::Iterable<dynamic> elements) → core::List<self::_#MyList#unmodifiable#tearOff::T>
|
||||
return core::List::unmodifiable<self::_#MyList#unmodifiable#tearOff::T>(elements);
|
||||
static synthetic method /* from org-dartlang-sdk:///sdk/lib/core/list.dart */ _#MyList#unmodifiableOf#tearOff<T extends core::num>(core::Iterable<self::_#MyList#unmodifiableOf#tearOff::T> elements) → core::List<self::_#MyList#unmodifiableOf#tearOff::T>
|
||||
return core::List::unmodifiableOf<self::_#MyList#unmodifiableOf#tearOff::T>(elements);
|
||||
|
||||
constants {
|
||||
#C1 = constructor-tearoff core::List::filled
|
||||
@@ -52,4 +54,4 @@ constants {
|
||||
Extra constant evaluation status:
|
||||
Evaluated: StaticInvocation @ org-dartlang-testcase:///issue47462.dart:18:16 -> BoolConstant(true)
|
||||
Evaluated: StaticInvocation @ org-dartlang-testcase:///issue47462.dart:19:17 -> BoolConstant(false)
|
||||
Extra constant evaluation: evaluated: 50, effectively constant: 2
|
||||
Extra constant evaluation: evaluated: 52, effectively constant: 2
|
||||
|
||||
@@ -399,16 +399,19 @@ abstract interface class Future<T> {
|
||||
///
|
||||
/// If [computation] returns a future,
|
||||
/// the future returned by this constructor will complete with the value or
|
||||
/// error of that future.
|
||||
/// error of that future, which may not be available until even later.
|
||||
///
|
||||
/// If the duration is 0 or less,
|
||||
/// it completes no sooner than in the next event-loop iteration,
|
||||
/// after all microtasks have run.
|
||||
/// (The waiting for the delay uses a [Timer] created in the current zone.)
|
||||
///
|
||||
/// If [computation] is omitted,
|
||||
/// it will be treated as if [computation] was `() => null`,
|
||||
/// The computation must not be omitted, and must not be null.
|
||||
/// Use [Future.pause] instead if you just want to wait for duration.
|
||||
/// Until that is reflected in the signature, if [computation] is omitted,
|
||||
/// then [T] must be nullable.
|
||||
/// Then the computation will be treated as if it was `() => null`,
|
||||
/// and the future will eventually complete with the `null` value.
|
||||
/// In that case, [T] must be nullable.
|
||||
///
|
||||
/// If calling [computation] throws, the created future will complete with the
|
||||
/// error.
|
||||
@@ -418,11 +421,16 @@ abstract interface class Future<T> {
|
||||
///
|
||||
/// Example:
|
||||
/// ```dart
|
||||
/// Future.delayed(const Duration(seconds: 1), () {
|
||||
/// print('One second has passed.'); // Prints after 1 second.
|
||||
/// var now = DateTime.now();
|
||||
/// var later = await Future.delayed(const Duration(seconds: 1), () {
|
||||
/// return DateTime.timestamp();
|
||||
/// });
|
||||
/// print(now.difference(later)); // At least a second.
|
||||
/// ```
|
||||
factory Future.delayed(Duration duration, [FutureOr<T> computation()?]) {
|
||||
factory Future.delayed(
|
||||
Duration duration, [
|
||||
FutureOr<T> Function()? computation,
|
||||
]) {
|
||||
if (computation == null && !typeAcceptsNull<T>()) {
|
||||
throw ArgumentError.value(
|
||||
null,
|
||||
@@ -448,6 +456,19 @@ abstract interface class Future<T> {
|
||||
return result;
|
||||
}
|
||||
|
||||
/// Creates a [Future] that completes with no result after [duration].
|
||||
///
|
||||
/// Like [Future.delayed], but does not perform any action,
|
||||
/// and cannot complete with an error.
|
||||
@Since("3.13")
|
||||
static Future<void> pause([Duration duration = Duration.zero]) {
|
||||
var result = _Future<void>();
|
||||
Zone._current.createTimer(duration, () {
|
||||
result._completeWithValue(null);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
/// Waits for multiple futures to complete and collects their results.
|
||||
///
|
||||
/// Returns a future which will complete once all the provided futures
|
||||
|
||||
+20
-1
@@ -191,7 +191,10 @@ abstract interface class List<E> implements Iterable<E>, _ListIterable<E> {
|
||||
///
|
||||
/// This constructor creates a growable list when [growable] is true;
|
||||
/// otherwise, it returns a fixed-length list.
|
||||
external factory List.from(Iterable elements, {bool growable = true});
|
||||
external factory List.from(
|
||||
Iterable<Object?> elements, {
|
||||
bool growable = true,
|
||||
});
|
||||
|
||||
/// Creates a list from [elements].
|
||||
///
|
||||
@@ -241,8 +244,24 @@ abstract interface class List<E> implements Iterable<E>, _ListIterable<E> {
|
||||
/// final unmodifiableList = List.unmodifiable(numbers); // [1, 2, 3]
|
||||
/// unmodifiableList[1] = 87; // Throws.
|
||||
/// ```
|
||||
// @Deprecated("Use List.unmodifiableOf instead")
|
||||
external factory List.unmodifiable(Iterable elements);
|
||||
|
||||
/// Creates an unmodifiable list containing all [elements].
|
||||
///
|
||||
/// The [Iterator] of [elements] provides the order of the elements.
|
||||
///
|
||||
/// An unmodifiable list cannot have its length or elements changed.
|
||||
/// If the elements are themselves immutable, then the resulting list
|
||||
/// is also immutable.
|
||||
/// ```dart
|
||||
/// final numbers = <int>[1, 2, 3];
|
||||
/// final unmodifiableList = List.unmodifiable(numbers); // [1, 2, 3]
|
||||
/// unmodifiableList[1] = 87; // Throws.
|
||||
/// ```
|
||||
@Since("3.13")
|
||||
factory List.unmodifiableOf(Iterable<E> elements) = List<E>.unmodifiable;
|
||||
|
||||
/// Adapts [source] to be a `List<T>`.
|
||||
///
|
||||
/// Any time the list would produce an element that is not a [T],
|
||||
|
||||
@@ -92,8 +92,26 @@ abstract interface class Map<K, V> {
|
||||
/// final unmodifiableMap = Map.unmodifiable(planets);
|
||||
/// unmodifiableMap[4] = 'Mars'; // Throws
|
||||
/// ```
|
||||
// @Deprecated("Use Map.unmodifiableOf instead")
|
||||
external factory Map.unmodifiable(Map<dynamic, dynamic> other);
|
||||
|
||||
/// Creates an unmodifiable hash-based map containing the entries of [other].
|
||||
///
|
||||
/// The map requires the keys to implement compatible
|
||||
/// `operator==` and `hashCode`.
|
||||
/// The created map iterates keys in a fixed order,
|
||||
/// preserving the order provided by [other].
|
||||
///
|
||||
/// The resulting map behaves like the result of [Map.of],
|
||||
/// except that the map returned by this constructor is not modifiable.
|
||||
/// ```dart
|
||||
/// final planets = <int, String>{1: 'Mercury', 2: 'Venus', 3: 'Earth'};
|
||||
/// final unmodifiableMap = Map.unmodifiableOf(planets);
|
||||
/// unmodifiableMap[4] = 'Mars'; // Throws
|
||||
/// ```
|
||||
@Since("3.13")
|
||||
factory Map.unmodifiableOf(Map<K, V> other) = Map<K, V>.unmodifiable;
|
||||
|
||||
/// Creates an identity map with the default implementation, [LinkedHashMap].
|
||||
///
|
||||
/// An identity map uses [identical] for equality and [identityHashCode]
|
||||
|
||||
@@ -36,13 +36,13 @@ class Test<E> {
|
||||
|
||||
Test(this.element);
|
||||
|
||||
run(name, Iterable create(int size)) {
|
||||
void run(String name, Iterable<Object?> create(int size)) {
|
||||
test(name, create(0));
|
||||
test(name, create(1));
|
||||
test(name, create(3));
|
||||
}
|
||||
|
||||
test(name, iterable) {
|
||||
void test(String name, Iterable<Object?> iterable) {
|
||||
testSingle(name, iterable);
|
||||
testSingle("$name-where", iterable.where((x) => true));
|
||||
testSingle("$name-map", iterable.map((x) => x));
|
||||
@@ -53,180 +53,188 @@ class Test<E> {
|
||||
testSingle("$name-takeWhile", iterable.takeWhile((x) => true));
|
||||
}
|
||||
|
||||
testSingle(name, iterable) {
|
||||
void testSingle(String name, Iterable<Object?> iterable) {
|
||||
var elements = iterable.toList();
|
||||
int length = elements.length;
|
||||
|
||||
var list = new List<E>.unmodifiable(iterable);
|
||||
for (var list in [
|
||||
new List<E>.unmodifiable(iterable),
|
||||
// Not the case for "subclass" test.
|
||||
if (iterable is Iterable<E>) new List<E>.unmodifiableOf(iterable),
|
||||
]) {
|
||||
Expect.isTrue(list is List<E>, "$name-type-$E");
|
||||
Expect.isTrue(list is! List<Test>, "$name-!type-!$E");
|
||||
|
||||
Expect.isTrue(list is List<E>, "$name-type-$E");
|
||||
Expect.isTrue(list is! List<Test>, "$name-!type-!$E");
|
||||
|
||||
checkElements() {
|
||||
Expect.equals(length, list.length);
|
||||
for (int i = 0; i < length; i++) {
|
||||
Expect.identical(elements[i], list[i], "$name-identical-$i");
|
||||
checkElements() {
|
||||
Expect.equals(length, list.length);
|
||||
for (int i = 0; i < length; i++) {
|
||||
Expect.identical(elements[i], list[i], "$name-identical-$i");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
checkElements();
|
||||
|
||||
throws(funcName, func) {
|
||||
try {
|
||||
func();
|
||||
} catch (e, s) {
|
||||
Expect.isTrue(e is UnsupportedError, "$name: $funcName threw $e");
|
||||
return;
|
||||
}
|
||||
checkElements();
|
||||
Expect.fail("$name: $funcName didn't throw");
|
||||
}
|
||||
|
||||
throws("[]=", () {
|
||||
list[0] = element;
|
||||
});
|
||||
throws("length=", () {
|
||||
list.length = length + 1;
|
||||
});
|
||||
throws("length=", () {
|
||||
list.length = length - 1;
|
||||
});
|
||||
throws("setAll", () {
|
||||
list.setAll(0, []);
|
||||
});
|
||||
throws("add", () {
|
||||
list.add(element);
|
||||
});
|
||||
throws("insert", () {
|
||||
list.insert(0, element);
|
||||
});
|
||||
throws("insertAll", () {
|
||||
list.insertAll(0, []);
|
||||
});
|
||||
throws("addAll", () {
|
||||
list.addAll([]);
|
||||
});
|
||||
throws("remove", () {
|
||||
list.remove(element);
|
||||
});
|
||||
throws("removeWhere", () {
|
||||
list.removeWhere((x) => true);
|
||||
});
|
||||
throws("retainWhere", () {
|
||||
list.retainWhere((x) => false);
|
||||
});
|
||||
throws("sort", () {
|
||||
list.sort();
|
||||
});
|
||||
throws("shuffle", () {
|
||||
list.shuffle();
|
||||
});
|
||||
throws("clear", () {
|
||||
list.clear();
|
||||
});
|
||||
throws("removeAt", () {
|
||||
list.removeAt(0);
|
||||
});
|
||||
throws("removeLast", () {
|
||||
list.removeLast();
|
||||
});
|
||||
throws("setRange", () {
|
||||
list.setRange(0, 1, []);
|
||||
});
|
||||
throws("removeRange", () {
|
||||
list.removeRange(0, 1);
|
||||
});
|
||||
throws("replaceRange", () {
|
||||
list.replaceRange(0, 1, []);
|
||||
});
|
||||
throws("fillRange", () {
|
||||
list.fillRange(0, 1, element);
|
||||
});
|
||||
throws(funcName, func) {
|
||||
try {
|
||||
func();
|
||||
} catch (e, s) {
|
||||
Expect.isTrue(e is UnsupportedError, "$name: $funcName threw $e");
|
||||
return;
|
||||
}
|
||||
checkElements();
|
||||
Expect.fail("$name: $funcName didn't throw");
|
||||
}
|
||||
|
||||
success(opName, op(List list), [bool throws = false]) {
|
||||
if (throws) {
|
||||
var e1, e2;
|
||||
Expect.throws(() => op(elements), (e) {
|
||||
e1 = e;
|
||||
return true;
|
||||
}, '$name :: $opName should throw for $elements');
|
||||
Expect.throws(() => op(list), (e) {
|
||||
e2 = e;
|
||||
return true;
|
||||
}, '$name :: $opName should throw for $list');
|
||||
Expect.equals(
|
||||
e1.runtimeType,
|
||||
e2.runtimeType,
|
||||
"$name :: $opName threw different errors for $elements and $list: "
|
||||
"${e1.runtimeType} vs ${e2.runtimeType}",
|
||||
throws("[]=", () {
|
||||
list[0] = element;
|
||||
});
|
||||
throws("length=", () {
|
||||
list.length = length + 1;
|
||||
});
|
||||
throws("length=", () {
|
||||
list.length = length - 1;
|
||||
});
|
||||
throws("setAll", () {
|
||||
list.setAll(0, []);
|
||||
});
|
||||
throws("add", () {
|
||||
list.add(element);
|
||||
});
|
||||
throws("insert", () {
|
||||
list.insert(0, element);
|
||||
});
|
||||
throws("insertAll", () {
|
||||
list.insertAll(0, []);
|
||||
});
|
||||
throws("addAll", () {
|
||||
list.addAll([]);
|
||||
});
|
||||
throws("remove", () {
|
||||
list.remove(element);
|
||||
});
|
||||
throws("removeWhere", () {
|
||||
list.removeWhere((x) => true);
|
||||
});
|
||||
throws("retainWhere", () {
|
||||
list.retainWhere((x) => false);
|
||||
});
|
||||
throws("sort", () {
|
||||
list.sort();
|
||||
});
|
||||
throws("shuffle", () {
|
||||
list.shuffle();
|
||||
});
|
||||
throws("clear", () {
|
||||
list.clear();
|
||||
});
|
||||
throws("removeAt", () {
|
||||
list.removeAt(0);
|
||||
});
|
||||
throws("removeLast", () {
|
||||
list.removeLast();
|
||||
});
|
||||
throws("setRange", () {
|
||||
list.setRange(0, 1, []);
|
||||
});
|
||||
throws("removeRange", () {
|
||||
list.removeRange(0, 1);
|
||||
});
|
||||
throws("replaceRange", () {
|
||||
list.replaceRange(0, 1, []);
|
||||
});
|
||||
throws("fillRange", () {
|
||||
list.fillRange(0, 1, element);
|
||||
});
|
||||
|
||||
success(opName, op(List list), [bool throws = false]) {
|
||||
if (throws) {
|
||||
var e1, e2;
|
||||
Expect.throws(() => op(elements), (e) {
|
||||
e1 = e;
|
||||
return true;
|
||||
}, '$name :: $opName should throw for $elements');
|
||||
Expect.throws(() => op(list), (e) {
|
||||
e2 = e;
|
||||
return true;
|
||||
}, '$name :: $opName should throw for $list');
|
||||
Expect.equals(
|
||||
e1.runtimeType,
|
||||
e2.runtimeType,
|
||||
"$name :: $opName threw different errors for $elements and $list: "
|
||||
"${e1.runtimeType} vs ${e2.runtimeType}",
|
||||
);
|
||||
return;
|
||||
}
|
||||
var expect = op(elements);
|
||||
var actual = op(list);
|
||||
checkElements();
|
||||
if (expect is List) {
|
||||
Expect.listEquals(expect, actual, "$name-$opName");
|
||||
} else if (expect is Iterable) {
|
||||
Expect.isTrue(actual is Iterable);
|
||||
Expect.listEquals(expect.toList(), actual.toList(), "$name-$opName");
|
||||
} else {
|
||||
Expect.equals(expect, actual, "$name-$opName");
|
||||
}
|
||||
}
|
||||
|
||||
success("indexOf", (l) => l.indexOf(element));
|
||||
success("lastIndexOf", (l) => l.lastIndexOf(element));
|
||||
success("contains", (l) => l.contains(2));
|
||||
success("elementAt", (l) => l.elementAt(1), list.length < 2);
|
||||
success("reversed", (l) => l.reversed);
|
||||
success("sublist0-1", (l) => l.sublist(0, 1), list.isEmpty);
|
||||
success("getRange0-1", (l) => l.getRange(0, 1), list.isEmpty);
|
||||
success("asMap-keys", (l) => l.asMap().keys);
|
||||
success("asMap-values", (l) => l.asMap().values);
|
||||
success("where", (l) => l.where((x) => true));
|
||||
success("map", (l) => l.map((x) => x));
|
||||
success("expand", (l) => l.expand((x) => [x, x]));
|
||||
success("skip", (l) => l.skip(1));
|
||||
success("take", (l) => l.take(1));
|
||||
success("skipWhile", (l) => l.skipWhile((x) => false));
|
||||
success("takeWhile", (l) => l.takeWhile((x) => true));
|
||||
success("first", (l) => l.first, list.isEmpty);
|
||||
success("last", (l) => l.last, list.isEmpty);
|
||||
success("single", (l) => l.single, list.length != 1);
|
||||
success("firstWhere", (l) => l.firstWhere((x) => true), list.isEmpty);
|
||||
success("lastWhere", (l) => l.lastWhere((x) => true), list.isEmpty);
|
||||
success(
|
||||
"singleWhere",
|
||||
(l) => l.singleWhere((x) => true),
|
||||
list.length != 1,
|
||||
);
|
||||
success("isEmpty", (l) => l.isEmpty);
|
||||
success("isNotEmpty", (l) => l.isNotEmpty);
|
||||
success("join", (l) => l.join("/"));
|
||||
success("fold", (l) => l.fold("--", (a, b) => "$a/$b"));
|
||||
if (elements is List<num> && list is List<num>) {
|
||||
success(
|
||||
"reduce",
|
||||
(l) => (l as List<num>).reduce((a, b) => (a + b).floor()),
|
||||
list.isEmpty,
|
||||
);
|
||||
return;
|
||||
}
|
||||
var expect = op(elements);
|
||||
var actual = op(list);
|
||||
checkElements();
|
||||
if (expect is List) {
|
||||
Expect.listEquals(expect, actual, "$name-$opName");
|
||||
} else if (expect is Iterable) {
|
||||
Expect.isTrue(actual is Iterable);
|
||||
Expect.listEquals(expect.toList(), actual.toList(), "$name-$opName");
|
||||
} else {
|
||||
Expect.equals(expect, actual, "$name-$opName");
|
||||
success("every", (l) => l.every((x) => x == 0));
|
||||
success("any", (l) => l.any((x) => x == 2));
|
||||
success("toList", (l) => l.toList());
|
||||
success("toSet", (l) => l.toSet());
|
||||
success("toString", (l) => l.toString());
|
||||
|
||||
var it = elements.iterator;
|
||||
list.forEach((v) {
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(it.current, v);
|
||||
});
|
||||
Expect.isFalse(it.moveNext());
|
||||
|
||||
if (elements is List<int> && list is List<int>) {
|
||||
success(
|
||||
"String.fromCharCodes",
|
||||
(l) => new String.fromCharCodes(l as List<int>),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
success("indexOf", (l) => l.indexOf(element));
|
||||
success("lastIndexOf", (l) => l.lastIndexOf(element));
|
||||
success("contains", (l) => l.contains(2));
|
||||
success("elementAt", (l) => l.elementAt(1), list.length < 2);
|
||||
success("reversed", (l) => l.reversed);
|
||||
success("sublist0-1", (l) => l.sublist(0, 1), list.isEmpty);
|
||||
success("getRange0-1", (l) => l.getRange(0, 1), list.isEmpty);
|
||||
success("asMap-keys", (l) => l.asMap().keys);
|
||||
success("asMap-values", (l) => l.asMap().values);
|
||||
success("where", (l) => l.where((x) => true));
|
||||
success("map", (l) => l.map((x) => x));
|
||||
success("expand", (l) => l.expand((x) => [x, x]));
|
||||
success("skip", (l) => l.skip(1));
|
||||
success("take", (l) => l.take(1));
|
||||
success("skipWhile", (l) => l.skipWhile((x) => false));
|
||||
success("takeWhile", (l) => l.takeWhile((x) => true));
|
||||
success("first", (l) => l.first, list.isEmpty);
|
||||
success("last", (l) => l.last, list.isEmpty);
|
||||
success("single", (l) => l.single, list.length != 1);
|
||||
success("firstWhere", (l) => l.firstWhere((x) => true), list.isEmpty);
|
||||
success("lastWhere", (l) => l.lastWhere((x) => true), list.isEmpty);
|
||||
success("singleWhere", (l) => l.singleWhere((x) => true), list.length != 1);
|
||||
success("isEmpty", (l) => l.isEmpty);
|
||||
success("isNotEmpty", (l) => l.isNotEmpty);
|
||||
success("join", (l) => l.join("/"));
|
||||
success("fold", (l) => l.fold("--", (a, b) => "$a/$b"));
|
||||
if (elements is List<num> && list is List<num>) {
|
||||
success(
|
||||
"reduce",
|
||||
(l) => (l as List<num>).reduce((a, b) => (a + b).floor()),
|
||||
list.isEmpty,
|
||||
);
|
||||
}
|
||||
success("every", (l) => l.every((x) => x == 0));
|
||||
success("any", (l) => l.any((x) => x == 2));
|
||||
success("toList", (l) => l.toList());
|
||||
success("toSet", (l) => l.toSet());
|
||||
success("toString", (l) => l.toString());
|
||||
|
||||
var it = elements.iterator;
|
||||
list.forEach((v) {
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(it.current, v);
|
||||
});
|
||||
Expect.isFalse(it.moveNext());
|
||||
|
||||
if (elements is List<int> && list is List<int>) {
|
||||
success(
|
||||
"String.fromCharCodes",
|
||||
(l) => new String.fromCharCodes(l as List<int>),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,36 +251,36 @@ List<int> createGrowableList(int n) {
|
||||
return new List<int>.filled(n, n, growable: true);
|
||||
}
|
||||
|
||||
Iterable createIterable(int n) => new Iterable.generate(n);
|
||||
Iterable createConstMapKeys(int n) {
|
||||
Iterable<int> createIterable(int n) => new Iterable.generate(n);
|
||||
Iterable<int> createConstMapKeys(int n) {
|
||||
if (n == 0) return const <int, int>{}.keys;
|
||||
return const <int, int>{0: 0, 1: 1, 2: 2}.keys;
|
||||
}
|
||||
|
||||
Iterable createConstMapValues(int n) {
|
||||
Iterable<int> createConstMapValues(int n) {
|
||||
if (n == 0) return const <int, int>{}.values;
|
||||
return const <int, int>{0: 0, 1: 1, 2: 2}.values;
|
||||
}
|
||||
|
||||
Iterable createMapKeys(int n) {
|
||||
Iterable<int> createMapKeys(int n) {
|
||||
var map = <int, int>{};
|
||||
for (int i = 0; i < n; i++) map[i] = i;
|
||||
return map.keys;
|
||||
}
|
||||
|
||||
Iterable createMapValues(int n) {
|
||||
Iterable<int> createMapValues(int n) {
|
||||
var map = <int, int>{};
|
||||
for (int i = 0; i < n; i++) map[i] = i;
|
||||
return map.values;
|
||||
}
|
||||
|
||||
Iterable createSplayMapKeys(int n) {
|
||||
Iterable<int> createSplayMapKeys(int n) {
|
||||
var map = new SplayTreeMap<int, int>();
|
||||
for (int i = 0; i < n; i++) map[i] = i;
|
||||
return map.keys;
|
||||
}
|
||||
|
||||
Iterable createSplayMapValues(int n) {
|
||||
Iterable<int> createSplayMapValues(int n) {
|
||||
var map = new SplayTreeMap<int, int>();
|
||||
for (int i = 0; i < n; i++) map[i] = i;
|
||||
return map.values;
|
||||
@@ -296,11 +304,11 @@ Queue<int> createQueue(int n) {
|
||||
return queue;
|
||||
}
|
||||
|
||||
Iterable createListMapKeys(int n) {
|
||||
Iterable<int> createListMapKeys(int n) {
|
||||
return createGrowableList(n).asMap().keys;
|
||||
}
|
||||
|
||||
Iterable createListMapValues(int n) {
|
||||
Iterable<int> createListMapValues(int n) {
|
||||
return createGrowableList(n).asMap().values;
|
||||
}
|
||||
|
||||
|
||||
@@ -1115,6 +1115,7 @@ void testUnmodifiableMaps() {
|
||||
|
||||
checkUnmodifiable(const {1: 1});
|
||||
checkUnmodifiable(Map.unmodifiable({1: 1}));
|
||||
checkUnmodifiable(Map.unmodifiableOf({1: 1}));
|
||||
checkUnmodifiable(UnmodifiableMapView({1: 1}));
|
||||
checkUnmodifiable(const MapView({1: 1}));
|
||||
}
|
||||
|
||||
@@ -30,9 +30,13 @@ void main() {
|
||||
"unmodView<Object>(int).cast<num>",
|
||||
);
|
||||
|
||||
var m2 = new Map<num, num>.unmodifiable({1: 37});
|
||||
testNum(m2, "Map<num>.unmod");
|
||||
testNum(m2.cast<int, int>(), "Map<num>.unmod.cast<int>");
|
||||
for (var map in [
|
||||
new Map<num, num>.unmodifiable({1: 37}),
|
||||
new Map<num, num>.unmodifiableOf({1: 37}),
|
||||
]) {
|
||||
testNum(map, "Map<num>.unmod");
|
||||
testNum(map.cast<int, int>(), "Map<num>.unmod.cast<int>");
|
||||
}
|
||||
|
||||
Map<Symbol, dynamic> nsm = new NsmMap().foo(a: 0);
|
||||
test<Symbol, dynamic>(nsm, #a, 0, "nsm", noSuchMethodMap: true);
|
||||
|
||||
@@ -1319,6 +1319,109 @@ void testIgnoreWhenCompleteError() {
|
||||
Future.delayed(Duration.zero, asyncEnd);
|
||||
}
|
||||
|
||||
void testFuturePause() {
|
||||
const Duration low = Duration(milliseconds: 10);
|
||||
const Duration mid = Duration(milliseconds: 20);
|
||||
const Duration hi = Duration(milliseconds: 30);
|
||||
// No argument means Duration.zero.
|
||||
|
||||
asyncStart();
|
||||
var timers = 0;
|
||||
void expectTimer(int n) {
|
||||
timers++;
|
||||
Expect.equals(n, timers);
|
||||
}
|
||||
|
||||
Timer(hi, () {
|
||||
expectTimer(10);
|
||||
});
|
||||
Timer(mid, () {
|
||||
expectTimer(7);
|
||||
});
|
||||
Timer(low, () {
|
||||
expectTimer(4);
|
||||
});
|
||||
Timer(Duration.zero, () {
|
||||
expectTimer(1);
|
||||
});
|
||||
Future.pause(hi).then((_) {
|
||||
expectTimer(11);
|
||||
});
|
||||
Future.pause(mid).then((_) {
|
||||
expectTimer(8);
|
||||
});
|
||||
Future.pause(low).then((_) {
|
||||
expectTimer(5);
|
||||
});
|
||||
Future.pause().then((_) {
|
||||
expectTimer(2);
|
||||
});
|
||||
Timer(hi, () {
|
||||
expectTimer(12);
|
||||
asyncEnd();
|
||||
});
|
||||
Timer(mid, () {
|
||||
expectTimer(9);
|
||||
});
|
||||
Timer(low, () {
|
||||
expectTimer(6);
|
||||
});
|
||||
Timer(Duration.zero, () {
|
||||
expectTimer(3);
|
||||
});
|
||||
}
|
||||
|
||||
void testFuturePauseNoArg() {
|
||||
asyncStart();
|
||||
// No argument means Duration.zero.
|
||||
var microtasks = 0;
|
||||
var timers = 0;
|
||||
void expectMicrotask(int expectedMicrotasks, int expectedTimers) {
|
||||
microtasks++;
|
||||
Expect.equals(expectedMicrotasks, microtasks);
|
||||
Expect.equals(expectedTimers, timers);
|
||||
}
|
||||
|
||||
void expectTimer(int expectedTimers) {
|
||||
timers++;
|
||||
microtasks = 0;
|
||||
Expect.equals(expectedTimers, timers);
|
||||
}
|
||||
|
||||
scheduleMicrotask(() {
|
||||
expectMicrotask(1, 0);
|
||||
});
|
||||
Future.microtask(() {
|
||||
expectMicrotask(2, 0);
|
||||
});
|
||||
Timer(Duration.zero, () {
|
||||
expectTimer(1);
|
||||
scheduleMicrotask(() {
|
||||
expectMicrotask(1, 1);
|
||||
});
|
||||
});
|
||||
Timer(const Duration(milliseconds: 10), () {
|
||||
expectTimer(4);
|
||||
asyncEnd();
|
||||
});
|
||||
// Behaves as timer.zero.
|
||||
Future.pause().then((_) {
|
||||
expectTimer(2);
|
||||
scheduleMicrotask(() {
|
||||
expectMicrotask(1, 2);
|
||||
});
|
||||
});
|
||||
scheduleMicrotask(() {
|
||||
expectMicrotask(3, 0);
|
||||
});
|
||||
Future.microtask(() {
|
||||
expectMicrotask(4, 0);
|
||||
});
|
||||
Timer(Duration.zero, () {
|
||||
expectTimer(3);
|
||||
});
|
||||
}
|
||||
|
||||
void main() {
|
||||
asyncStart();
|
||||
|
||||
@@ -1373,6 +1476,9 @@ void main() {
|
||||
testChainedFutureValueDelay();
|
||||
testChainedFutureError();
|
||||
|
||||
testFuturePause();
|
||||
testFuturePauseNoArg();
|
||||
|
||||
testSyncFuture_i13368();
|
||||
|
||||
testWaitCleanUp();
|
||||
|
||||
Reference in New Issue
Block a user