Previously, it was unclear what information was stored in
_IfNullExpressionContext._previous. It turned out that it was the
"shortcut state", i.e. the flow state if the LHS of the `??` was
non-`null`. I've renamed variables and added comments to clarify
this. Also, based on the implementation of
`ifNullExpression_rightBegin`, it looked like it might update
`_current`, but in fact it did not (because `tryMarkNonNullable`
always returns an `ExpressionInfo` whose `ifFalse` is unchanged); I've
refactored the code so that this is clearer, and added a comment
explaining why it is the right thing to do.
Bug: https://github.com/dart-lang/language/issues/2020
Change-Id: Ib8a5235f9b9482f4b290ad90686385514660a95d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251142
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
The motivation for this functionality is lints which inspect the
declaration of constant values within Dart programs. By giving lints a
small amount of visibility into the intermediate values which were used
to construct constant values, it is possible for lints to validate not
just the resulting constant, but the means by which that constant was
constructed.
Change-Id: I75b3f46222ced88a0c7a7f7887de2994fcfa3f68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251682
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This introduces a race where if the function throws before `expect(throwsA)` adds a handler, it becomes an unhandled exception.
Fixes https://github.com/dart-lang/sdk/issues/49455.
Change-Id: I81205f272c9ec211b99bf73af64dab8e4d774e84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251550
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Previously there was a window between the decision to resume generator
and actually running the micro-task. The stream could be canceled
during that window, making running the generator incorrect.
The solution is to check if the stream was canceled right before
resuming the generator in yield/yield*.
This change also unifies yield and yield* to check if the stream
was canceled even before suspending the generator.
TEST=language/async_star/cancel_while_paused_test,
language/async_star/cancel_while_paused_at_yield_test
Fixes https://github.com/dart-lang/sdk/issues/49451
Change-Id: Ib8ff3a2da9a6a7da8766a7dbf28e2c9d618728f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251562
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
We don't check undefined symbols in our assembly snapshots. We
currently never emit undefined symbols, because Dart code only refers
to Dart code statically.
When adding static linking, we would like to have the option to have
PC relative calls to native libraries provided as relocatable files
(object files or static libraries).
Not checking would compile the symbols to dynamic linker, but we don't
support that `dart compile exe` at the moment. So we should add this
sanity check.
Also: Removes unused imports in relevant test.
Bug: https://github.com/dart-lang/sdk/issues/49418
Change-Id: I10701b82a1e8a06ce41271bd9183064addfb88f4
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-win-debug-x64c-try,vm-kernel-precomp-mac-product-x64-try,vm-kernel-precomp-dwarf-linux-product-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251261
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
Tested: Builds on the CQ, built locally.
Change-Id: I25d0286d43199f4012a21e2223b1046a61a86bb9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251545
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
The DetachableFileSystemManager API also changes slightly with this change resolving a TODO.
Change-Id: I388b352c987e6c96f95fcabd9a532cbfcfa39e4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251580
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jaime Wren <jwren@google.com>
Tested: Standard CQ
Change-Id: Ic52d4d38a5b117dfcdc778dedfac08315ca30a54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251541
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: William Hesse <whesse@google.com>
The result of the advanced invalidation is recorded and used for
testing, replacing the 'expectsRebuildBodiesOnly' yaml property
with an 'advancedInvalidation' property.
Change-Id: I520d329b100c1a7be72d6eff9d277b8e94df3a2c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251462
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Change the mapping between SSA indices and virtual registers from 1:1 to 1:2.
This shrinks the size of bit vectors used during optimizations, and leaves the size of bit vectors used during register allocation the same.
TEST=ci
Change-Id: I0c82ca7972f7efb30559f7e4869396f1eed757c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250982
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
The annotation data is queried on demand rather than being precomputed.
Methods that don't throw are computed after computing side-effects.
Change-Id: I4e31f0b7df668d41a15dcafee0c84fc7249e0699
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251340
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
The required keyword means that adding a field to a class is a breaking
change, and needs a major version bump instead of a minor one. All the
fields are already nullable, and the constructors all use named
parameters, so removing this keyword is a minor (non-breaking) change.
Bug: https://github.com/dart-lang/coverage/pull/412
Bug: https://buganizer.corp.google.com/issues/236964692
Change-Id: I410d0f4359c003696570dfb11e3e2f7f179fb9ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251443
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
In order to create a Future for the result of async closure,
closure needs to instantiate a type argument of its result type.
The result type may reference type arguments of enclosing function or
class and scope builder should visit closure's result type
in order to capture receiver or type arguments variable of parent
factory.
TEST=runtime/tests/vm/dart/regress_49424_test.dart
Fixes https://github.com/dart-lang/sdk/issues/49424
Change-Id: I1cd131251717fca43f8ca95856d13718eb9aca68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251320
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Before we added the --experiment flag when enabling because the
alternative invalidation strategy is not on by default.
This CL makes it always pass the --experiment flag (i.e. with the no-
version when we don't want it) making any default not matter.
Change-Id: Id62da7bcdee52f4556092a49e4939b9b66829d51
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251265
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Part of #49365
Change-Id: Icf4ef0fb89cbc514587b39bbe10a4d394290499a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250162
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Not storing a collection of methods is a step towards processing
annotations more 'online'.
Change-Id: I378ec4db9526004a1f1dc56886bbc91a7acde7f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251322
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>