E.g. "var = 42;" now has a different error message than "var default = 42;".
Fixes#22553
Change-Id: I58affe988569d8e79190b63f7267b471a1b0ebc8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162182
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
We decided not to land this, but I change it locally to test faster,
and forgot to revert with one of the CLs.
Change-Id: I4817c768778c0bb10fc0030fb5885bac8fbe2ce4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162622
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
It is exposed from LibraryElement.
Change-Id: I6acf704312e185ff8fd8b6391590d5385f9821df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162482
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Previously the flow analysis equations for a for-each loop `N` of the
form `for (var V in E) S` were approximately as follows:
- Let `before(E) = before(N)`
- Let `before(S) = conservativeJoin(after(E), assignedIn(N), capturedIn(N))`
- Let `after(N) = join(after(E), break(S))`
This CL changes the behavior to:
- Let `before(E) = before(N)`
- Let `before(S) = conservativeJoin(after(E), assignedIn(N), capturedIn(N))`
- Let `after(N) = join(before(S), break(S))`
(In other words, the result of the conservative join is carried
through to the state after the loop). This isn't strictly necessary
for soundness, but it makes the behavior of a for-each loop more
consistent with its desugared equivalent. In particular, it means
that if a variable is potentially assigned to or captured in the body
of the loop, then the effect of that potential assignment or capture
will be felt in the code that follows the loop, even if the potential
assignment or capture is not connected to the flow control path.
Change-Id: I7a70a8ae9f87bd40b6592992d8ee985a9aa87e80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162480
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
The return value of a closure call on `null` or bottom should be
bottom.
Change-Id: I4520a8d6b13575172cf5407b0fbcbaa0b6be5e63
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162384
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Fix dartvm re-init Flag check crash,if dartvm first init set FLAG_causal_async_stacks and FLAG_lazy_async_stacks both true, when we re-init dart vm we will get a crash,it's better to read flag before flag check.
I got this crash when we modified flutter engine [common/settings.h](https://github.com/flutter/engine/blob/master/common/settings.h), because we want to destory dartvm to release memory,but when we recreate the Flutter engine ,we got crash below
```dart
[VERBOSE-3:dart_vm.cc(421)] Error while initializing the Dart VM: To use --lazy-async-stacks, please disable --causal-async-stacks!
```
So I changed the code order, First to initialize flag from snopshot,then we check the Flag is legal or not
Closes https://github.com/dart-lang/sdk/pull/43312https://github.com/dart-lang/sdk/pull/43312
GitOrigin-RevId: d8b05f613751a3516c864a526d5976f570d589d5
Change-Id: I4cb73df93000333963bd68da3d5dae96e382a2e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161720
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Leaf runtime calls a silently clobbering R23 and R25 registers, which
causes bugs when these calls happen from write barriers (which are not
expected to clobber anything outside of R25).
We introduce a special helper class to handle saving and restoring
necessary registers.
The bug originally reported by Joe Lin <zuojian.lzj@alibaba-inc.com>
who proposed a fix[1]. This CL builds on top of that fix and tries to
make it more safe by forcing users to use a more strict API.
[1] https://dart-review.googlesource.com/c/sdk/+/162300
TEST=vm/dart/write_barrier_register_clobber_test
Change-Id: I93e0a13a3c4c38ad28210b35750a66e615e3e44a
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162191
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
parameters under null safety
Note that the fix is disabled when we can't suggest anything other than
`null` in an opted-in library and the parameter can't accept `null`. We
might want to relax that restriction, even though we'd be introducing an
error, if we think it's better to provide some fix rather than none in
this case. Doing so would violate a long-standing design constraint,
which is why I haven't already done it. Reducing the temptation to do so
is why I provided non-null defaults for so many other types.
Change-Id: I114a495ee2bf3e01f02a51b87cc8659048e56aa2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162440
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Ensures that static finals with recursive initializers will throw
a `LateInitializationError` after trying to assign the value twice,
even if the value is the same.
Change-Id: Iae85a4fab93f51161a9842a684b0efd2aeba9dbc
Fixes: https://github.com/dart-lang/sdk/issues/43358
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162280
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This also contains a few minor clean-up changes to the parser, mostly
dealing with keys that should have been required but weren't.
I'm tempted to make the date a required field and then use it to sort
the transforms so that they are applied from oldest to newest. Right
now it's optional but provides a way for users to document the date
for their own record keeping. Thoughts appreciated.
Change-Id: If3a22bbc2dea30f760f868c1ca1bf41aaf4654c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162382
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
* Refactor MigrationCliRunner, mostly simplification.
* Add AnalysisResult class to track analysis errors.
* MigrationState now contains an AnalysisResult, and the previewUrls.
* Add logic in the UI to display analysis results.
* Add logic to the backend to display analysis results.
Fixes https://github.com/dart-lang/sdk/issues/41712
Fixes https://github.com/dart-lang/sdk/issues/43138
Change-Id: I3304467955cfa81820f0010d32e17931b3c68b08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162400
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
The validation was not actually traversing the message and the test was not actually testing sendAndExit, rather standard message passing.
Brought error messages reported by sendAndExit in line with regular message passing error messages.
Bug: https://github.com/dart-lang/sdk/issues/43382
Change-Id: Iceb26ab9027a39e9eb3847b42a64ce991521578e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162249
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
the service
As part of the dartdev refactoring, 'dfe.Init()' was only called when
an explicit script URI was found during option parsing. However, with
--observe provided, 'script_uri' is always null as dartdev is
responsible for determining which script to run. This change ensures
that vm_platform_strong.dill is always loaded by the DFE.
Fixes https://github.com/dart-lang/sdk/issues/43207
Change-Id: I118b83390efba48e3e8d5b793444d189ba3c5ae2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162060
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
I originally thought we'd need this to handle updating overrides, but I
now think we can get the deafult value from the overridden method and
hence don't need it in the data file. We can always re-add it when we
support the override case if I'm wrong.
Change-Id: I1016841d18badf9deeb92ad2294e5ffe4af94ef2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162380
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
The widget transformer doesn't handle widgets with optional positional
parameters and therefore doesn't provide locations in these cases.
For this reason we leave the location field nullable and don't null check
it on construction.
Close#43371
Change-Id: I2595eb215e8fab477ab0819b70e25d9fb921ed01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162187
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
`Pointer.load` and `Pointer.store` are now extension methods which are
only available for types that are sized.
`allocate` moved to `package:ffi` instead of `dart:ffi`.
Misc: gitignore another clangd cache location.
Change-Id: Ib01ba416f2efa18638a21dd4052d9a35eeab6f4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162188
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Instead of possibly looping over the closure function parameter names
array multiple times, just do it once. Check each entry against the
provided argument names. If none match, check the required bit (if in
null-safe mode). Also keep a count of matched names to check that all
provided names matched after the iteration.
Now that optional name checking is part of the fragment built by
BuildClosureCallArgumentsValidCheck, that method builds checks for
exactly the same things as its namesake in Function.
Also refactor the variables used by the checker into read/write ones
that need to be allocated in the parsed function and read-only ones
that can just be temporaries since no Phi nodes are needed.
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try
Bug: https://github.com/dart-lang/sdk/issues/40813
Change-Id: I3cb421dd538629d7f5499f3bbf0653d34b850dce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160725
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
* Add mechanisms to try out a recovery and only perform it if is
successful.
* Recover written out binary operators, e.g. "a xor b", "a or b" etc.
This fixes#26810 and is also how these operators are written in e.g.
Kotlin. This might be somewhat controversial though.
* Adds a mechanism to _replace_ a token by another token.
This might be controversial.
It is done because just inserting the operator causes the same rewrite
to be attempted on the same token stream several times (at least with
the way the token stream is parsed via the CFE) in turn causing it to
be recovered *sometimes*. This is now avoided by actually replacing
the token.
Change-Id: Icfa806045575d2aa2e5f35126708651b275bcf84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162003
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Avoids a compiler crash if invalid characters in the type names leak
from the CFE.
Change-Id: I3c9a9fcfd2ac6ef4f7ef5593a53d6f936653955e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162260
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Original issue: On iOS, The problem is that people on iOS can have their
IPv6 misconfigured so it doesn't work, but it's still turned on.
Additionally getaddrinfo on that platform doesn't handle that case well,
meaning that the IPv6 lookup takes a long time to time out, delaying the
legitimate response.
This fix will issue a concurrent lookup for IPv4 and IPv6 on iOS.
Whichever IP comes first will be used to try to build the connection.
Bug: https://github.com/dart-lang/sdk/issues/41451
Change-Id: I7cda9845f03cf435245bbfad493d7443629b05c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143883
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>