We should verify that element type is nullable every time length is
increased, not only when capacity is increased.
Fixes https://github.com/dart-lang/sdk/issues/42502
Change-Id: Id91c702a99028634da8c2d41ae0ceac521af2cf5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152900
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This reverts commit 038e981f89.
Reason for revert: Breaks some tests; visible changes to some web UIs.
Original change's description:
> Fix duration.toString() to conform the description
>
> Duration.toString() should return in a format of "HH:MM:SS.mmmmmm".
> But when `hours` is less than 10, toString() doesn't have the leading
> zero, which is "H:MM:SS.mmmmmm".
>
> The corresponding co19 issue: https://github.com/dart-lang/co19/issues/733
>
> Bug: https://github.com/dart-lang/sdk/issues/41737
> Change-Id: I2264171b2b37e89056695f7f821125a5f78d87fb
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151163
> Commit-Queue: Zichang Guo <zichangguo@google.com>
> Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
TBR=lrn@google.com,zichangguo@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: https://github.com/dart-lang/sdk/issues/41737
Change-Id: I4d7ef5de9807e8e2b2a77c2171d1693b7527f671
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151848
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
The old RangeError.range message was confusing:
RangeError (index): Invalid value: Not in range 0..2, inclusive: 9
The comma makes the message hard to parse. I've seen a number of
people misinterpret "inclusive" as describing the invalid value (9)
instead of acting as a modifier on the range.
https://github.com/dart-lang/sdk/issues/29586 has a lot of
bikeshedding about this, but in the interest of mitigating confusion
sooner, I propose changing it to:
RangeError (index): Invalid value: Not in inclusive range 0..2: 9
I'm intentionally trying to improve the message with minimal
disruption to the structure of the error message. Although I'd much
prefer that "Invalid value" and the actual value be adjacent instead
of being interrupted by the explanation, such restructuring is rather
non-trivial. RangeError allows the "Invalid value" message to be
customized, and rearranging terms could produce even worse
constructions.
I also considered:
RangeError (index): Invalid value: Not in range [0, 2]: 9
And while I like that that is brief and clear, I chose not to use it
for people who are unfamiliar with interval notation and who might
mistake it as a Dart List.
Bug: https://github.com/dart-lang/sdk/issues/29586
Change-Id: I0f23b195437e4053ae5f76b5d303123979a8c9fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146024
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
This should enable strong mode tests to be fully NNBD opted in. At the
same time, legacy tests when run with the experiment off should
hopefully be able to still consume these libraries because they don't
actually use any NNBD features.
To do this, I changed the script that generates the SDK repo's package
config to not put in a language version for any package whose pubspec
has no SDK version. According to language versioning, that means the
package should be considered to be at the "current" version of the SDK
running the code.
In NNBD, that's opted in. With the experiment off, that is (presumably)
"opted out" in the sense that NNBD doesn't exist.
In order to *not* opt in some of the other packages that currently
lack SDK constraints, I put those in and pinned them to "^2.7.0" which
was what the package config script used to implicitly fill in for them.
I see a bunch of other changes in the generated package config too. The
update script probably hasn't been run in a while.
Change-Id: I55193d42eac0696a6b0105546551efa45a1f3252
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144305
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Several instance checks added during the null safety core library
migration were incorrectly rejecting null values in places where null
values can still flow in legacy mode. This eliminates the instance
checks in favor of casts which will behave as desired.
Bug: https://github.com/dart-lang/sdk/issues/41465
Change-Id: I50fb9e6cef41d645d5312871932c7168f2d80c29
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143333
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Split out int64 lines of multi-test for
corelib/iterable_return_type_test and added status to skip the
int64 test on the web compilers.
Change-Id: I1e56299973956932c5b16b1ceeeb2b8f00457bf5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141802
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Riley Porter <rileyporter@google.com>
error_stack_trace2_test: As part of the late field spec, we no longer
have a special error for cyclic statics, so they just end up with stack
overflow errors, which don't have a stack trace.
list_..._test: Modify ListMixin<T> in NNBD libs so that addAll,
replaceRange, and insertAll work for non-nullable T.
Change-Id: I0f3f0c30f1aa45ea148eb5cdc954f024b7ba4777
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141252
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Replacing usage of deprecated `new List()` and `new List(x)` in tests
with `List.filled` or `[]` where applicable.
Change-Id: Ie52a1869dfa25e141a8486c02c2d7668e9303ec9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141022
Reviewed-by: Riley Porter <rileyporter@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Riley Porter <rileyporter@google.com>
One test verifies that the default values of fromEnvironment
constructors are the values false/0/''.
The other new test verifies that it is allowed to invoke an expression
whose static type is a proper subtype of a function type (X extends F,
where F is a function type), cf.
https://github.com/dart-lang/language/issues/896.
Change-Id: I4ee32df7c5950be07b800027f000a486bf3af61c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141249
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Also, tests/corelib/string_operations_with_null_test.dart is fixed for
strong mode: in strong mode TypeError is thrown when null is casted
to a non-nullable type; in weak mode null is silently passed and
ArgumentError or NoSuchMethodError is thrown.
Change-Id: I566a80293ffb03752cc3409e1b79491f0aff6888
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140779
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Migrated test caused a compiler error due to an added type declaration:
Error: The argument type 'Null? Function(dynamic, int)' can't be
assigned to the parameter type 'void Function(dynamic, dynamic)'.
Change-Id: I65541ddcf10eff18bd6013c07567835d87b0daab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140661
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Riley Porter <rileyporter@google.com>
This makes these checks useful in situations where you don't want to spend
an extra statement, like `=>` bodies or initializer lists (including
forwarding generative constructors).
Change-Id: Ia55b8741a7c75af631db48ac70e64597d8f96c73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135649
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
The json.decode function returns a _JsonMap, which is a Map<String, dynamic>
and could include nulls. Without converting to a Map<String, Object>,
the migrated map_entry_test for the nnbd sdk causes a runtime error.
Change-Id: I8b66e693a5f91c1e14f7a89d887ac4c4549442a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139753
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Riley Porter <rileyporter@google.com>
Constructors int.fromEnvironment and String.fromEnvironment will now
yield 0 or '' rather than null in the case where the requested
environment declaration does not exist, so various expectations needed
to be updated accordingly.
Change-Id: Ie6f3b9ee18a970e50520ac84c2741b4875ada3c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139804
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
The intent of this change is to make editing the tests in these
directories more user friendly. When you open these directories in an
analyzer enabled editor it will produce results consistent with the
language features being used in the test.
Change-Id: I68e9cdc0e9fccfc360a2649261a5fdca042ec108
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139560
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Normalize FutureOr<T> and Never? after instantiation.
Use mutual subtyping of bounds in generic function type parameters instead of structural equality.
Change-Id: I78b836d8bd2f091bd56e5a0f9c2089a411fa6f6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135787
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
- Migrated test now expects `null is Object` to be false.
- Added expectations for `is! Object`.
Change-Id: I99c5dc76d2ccfa5a9fd853b7745b58edfff07085
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129309
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Note that cast_test.dart isn't migrated yet due to #39517.
First patch set is just copying the tests over. The second patchset has
the actual meaningful changes.
Change-Id: I89233f20187b4305a776f865cde09a984423fa4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125920
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
- Copies corelib_2/a* -> corelib/
- Copies language_2/ab* -> language/
- Copies lib_2/math/ -> lib/math/
- Copies standalone_2/a* -> standalone/
And also copies over and renames all of the status files in those
directories.
Then it migrates those tests to be static error free in NNBD.
Finally, adds support to the test_runner for the new suites.
Note that this review is split into multiple patchsets. The first
patchset is a straight copy of the existing files. Then the later
patchsets have the interesting changes.
Change-Id: Icec2ff850a3aee30b653066ac184495d1e3814d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125467
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
This deletes:
tests/co19
tests/corelib
tests/html
tests/isolate
tests/language
tests/lib
It does not delete tests/standalone because apparently there are tests
in there that are not in standalone_2. (I assume they were added after
the test migration. I don't know why they were added there.)
I have tried to remove references to the old tests from various scripts
and tools but may have missed some. (As you can imagine, grepping for
"lib" does not have the best signal-to-noise ratio.)
"It was a pleasure to burn. It was a special pleasure to see things
eaten, to see things blackened and changed. With the brass nozzle in his
fists, with this great python spitting its venomous kerosene upon the
world, the blood pounded in his head, and his hands were the hands of
some amazing conductor playing all the symphonies of blazing and burning
to bring down the tatters and charcoal ruins of history."
- Ray Bradbury, Fahrenheit 451
Change-Id: If3db4a50e7a5ee25aff8058b1483e2ce8e68424e
Reviewed-on: https://dart-review.googlesource.com/c/75420
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Terry Lucas <terry@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>