Whenever a pattern performs an implicit `is` test, flow analysis
attempts to determine whether the `is` test is guaranteed to succeed;
if it is, then flow analysis considers the code path in which the `is`
test fails to be unreachable. This allows flow analysis to recognize
switch statements that are trivially exhaustive (because one of the
cases is guaranteed to match), avoiding spurious errors such as
"variable must be assigned before use" or "missing return statement".
This change upgrades the logic for computing when an `is` test is
guaranteed to succeed, so that it accounts for type erasure of
extension types. This brings flow analysis's treatment of switch
statements into closer alignment with the exhaustiveness checker,
which should reduce the risk of confusing error messages. For more
information see
https://github.com/dart-lang/language/issues/3534#issuecomment-1885839268.
Fixes https://github.com/dart-lang/language/issues/3534.
Bug: https://github.com/dart-lang/language/issues/3534
Change-Id: Ib73d191e04e7fa8c0e6888c2733dae73d8f389da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345822
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This also fixes some code that was assuming the args parser returns
`Map<String, String>` for the `--define` multi-option, it's rather returning
a `List<String>`.
Forwarding these two flags will allow running some of our configurations
using `dart compile wasm` as opposed to
`pkg/dart2wasm/tool/compile_benchmark` (though the former is still
slower than the ladder).
Though since `dart compile wasm` is still a bit slower then the shell
script, we'll do that only for one configuration.
Issue https://github.com/dart-lang/sdk/issues/54675
Change-Id: I74e9edb2f635f48faade8d843857be2aa7c6066f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347903
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Add the javascript shell WebKit JavaScriptCore as an optional
download in third_party/jsc. This is a CIPD download, and includes
an update.sh script to upload a new version of jsc to CIPD and
update DEPS.
Bug: b/322134579
Change-Id: I94902ccdff3d121e5be51ef6eeab595fc24ad7e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348161
Commit-Queue: William Hesse <whesse@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
This reduces time for `dart compile wasm` on a hello world in
* `--no-optimize` mode from 8.2 to 1.8 seconds (0.6 sec via [0])
* `--optimize` mode from 9.2 to 3 seconds (1.6 sec via [0])
[0] pkg/dart2wasm/tool/compile_benchmark
Issue https://github.com/dart-lang/sdk/issues/54675
Change-Id: I47093e747f343b542bc7faa34e102c62657c7b81
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347902
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
The `minified:...` encoding of class names mirrors the one used by
dart2js. So the added test will work in both modes.
This reduces optimized dart2wasm output
* hello world by 20%
* flute complex by 8.5%
Change-Id: I080de40919ee3f25f0f0d8c9b82aa662f7e734aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347741
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
The renames most uses of 'patch' to 'augmentation'. Missing is
the `Builder.isPatch` property and messages related to patches.
Change-Id: Idb957c30f3ed3644213ad88ced767d75b5f25e09
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347921
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
The comment makes it sound like a worthy exception type, but it is never
thrown or even instantiated.
Change-Id: Icc946250ed730a3eb61cdc39eed3dc68206e9663
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348083
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
The current implementation externalizes and internalizes the Dart
value instead of adding a box and using a runtime-specific symbol.
This makes the implementation consistent with the JS backends.
Change-Id: Iefa382f742bc819b18dfe27ca33741b12473ee39
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347222
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
* No need to give an extension a private name, without an explicit extension override. Just go unnamed.
* Co-locate the two extensions on `AstNode` and on AstNode?` in analyzer package.
* Combine two linter extensions on the same type, `AstNode?`.
Change-Id: I88fef7d5b85bb04bf7263af3810a1c8c3b35f541
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347652
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
The initial global evaluation support only worked when the open script was loaded into the VM as a `file:///` URI (eg. things in a `bin/` folder, and not a `lib/` folder). This is because we short-cut resolving file paths to `package:` URIs for most VM functionality (for example setting breakpoints) because it's unnecessary (the VM supports setting breakpoints with file:/// URIs even for `lib/`).
This change forces us to resolve paths to their resolved URIs (eg. `package:` where applicable) in the case where we're looking up a script for global evaluation.
We could enable this lookup for all cases (to remove the additional `force` flag here), but since it's called much more from the other path (breakpoints) we should add caching (which was more than I wanted to change for this fix).
Fixes https://github.com/Dart-Code/Dart-Code/issues/4932
Change-Id: I57a99ec3b7c726d9d120e6cda7d0b938fec397bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346400
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Helin Shiah <helinx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
And add a bit to our style doc about naming of extensions.
Change-Id: I22dd05dfe08b46ae38cc200456eb008e02eb002f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347782
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
The google3 CL landed, so this CL might work.
Change-Id: I5ed108f7a2dd00d3fe581a6a9f8647fd900e40bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347648
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
The updates the expectation tests to use * instead of line/column number
for sdk messages.
Change-Id: I882abe6e3b1d88238d87a71d655ca9807869592c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347901
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
This updates the processing of macro generated augmentation libraries
to add library dependencies of the augmentation libraries to the
emitted library.
Change-Id: Ibc06a3c309fb3cfc8eb1f02beda637dfd9a3ea62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347601
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Now that dart2js only takes migrated files as input, all tests should
use the current language version.
Change-Id: I6c84850f5786aeac04154b67bd7a3c19083c8bba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345344
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
Clear local caches storing const values in each module.
Change-Id: I7766e92df6b8d1f91bad5fbb2addb8ace7763646
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347220
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Change-Id: I4b847f20e53ba57012a412e0099a6310fdc9c6d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347780
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
This method takes advantage of a class, PatternCaseExpression, which
was only introduced for the method. The class should not be made
private, as it is returned by the method, to code outside the library. However, since patternOfBoolCondition is only used by one correction producer, I think it is more pragmatic to just inline it into that producer.
We can remove the need for the PatternCaseExpression class, as it can easily be replaced by a record. I think this change nicely simplifies both ConvertToSwitchStatement, and the correction/util.dart library.
Change-Id: If630994ce74451047c5ce5cccd2641475121a94b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347781
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
These fences were added before we decided that (1) `NativeFinalizer`s
are only attached to `Finalizable`s and (2) `Finalizer`s do not have
a guarantee against premature finalization.
Now that we're inlining, we should avoid allocating the `Pointer`
object.
TEST=Should be a no-op, running a bunch of bots just in case.
Closes: https://github.com/dart-lang/sdk/issues/54680
Change-Id: I3b2702d910c8ed53a3f3fcbf0e6f437d1b8026c5
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-mac-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-debug-x64-try,vm-aot-win-debug-x64c-try,vm-appjit-linux-debug-x64-try,vm-asan-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347740
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Change-Id: Idca54c94a583d688e3f2470f1e062e9f44f0d131
CoreLibraryReviewExempt: doc only change to the web libraries
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347387
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
This logic ends up unused as the CFE was updated to report the relevant errors in language versions before 3.0. With a language version of 3.0 or greater, they aren't relevant.
Change-Id: Ie14849f1d5be7588dd0093e10a1a9b8a967669d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346720
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>