Make the following changes, based on
8a9b9a8a74:
- Replace `ConstOrLiteralPattern` nomenclature with `ConstantPattern`
(the spec no longer speaks of "literal patterns").
- It is an error if a guard's type is not assignable to `bool`.
- Variable patterns can now be `final`.
- We now have a separate error condition to cover the case where a
variable, list, map, record, or extractor pattern appears in an
irrefutable context and the matched type is not assignable to the
required type of the pattern. (Previously such patterns were simply
called "refutable", leading to a less clear error).
Additionally, we now consistenly use the term "guard" to refer to the
expression after a `when`, consistent with the spec text.
There are a few new TODOs, which I plan to address in follow-up CLs.
Change-Id: Ia0abab9492583f2aa8b59a9b381b90ba11b3e0fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259246
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This function is used internally to abstract over null safety modes.
Since dart2wasm is always fully null safe, the function is trivial.
Change-Id: I8d636d4ce146a2a848dde736d8563dcb0028f92a
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258928
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
There's no LICENSE file that mentions the Go authors in this repository, but since this code is covered by the CLA we can just move the name to the AUTHORS file and rely on the existing statement that references the Dart LICENSE file.
Change-Id: I3e8e04ef39e7ed6de0134cc33bf8a22e3d33389b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250792
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Avoid removing dynamic invocations in sanitizing code as we don't know what type the element and its attributes may be.
Change-Id: I057d908027befe7fd284bf4ec6c68bd1d0e977f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259108
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Change-Id: Ifb1bf92c9017a43c626104d115276cc49d883e13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259241
Commit-Queue: Kevin Moore <kevmoo@google.com>
Auto-Submit: Devon Carew <devoncarew@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
This requires some tweaks to to/from JSON code, and some handling for Maps that previously could be serialised directly but now may contain `Uri`s in keys and need to be converted to strings explicitly (since Uri has no toJson method).
Change-Id: I61358d8198ac1da322fae98d6c40747ad08754b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258927
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Adds a flag `--generate-prototype-events` to the dart:html generation
scripts, which causes a `prototype_events.dart` file to be generated
with EventStreamProviders and extensions for all events generated
in legacy dart:html. The generated file can be copied and pasted into `html_events.dart` to be used in the new dart:html prototype.
The script `prototype_htmleventgenerator.py` reuses as much common functionality as possible from the `htmleventgenerator.py`.
There were many edge cases to consider, like:
- de-conflicting names with different event types (e.g. ProgressEvent onError vs SpeechRecognitionErrorEvent onError)
- hiding deprecated types that don't appear in the Web IDL and haven't been needed in the glue code prototype yet
- renaming extension on-types that have been renamed from the Web IDL
- hiding custom events, which then need to be added to the prototype by hand
- prefixing some events with the correct web library
Change-Id: I6ab944d74ede6d8a2178bbf9aa580a6ab7d67a77
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259063
Commit-Queue: Riley Porter <rileyporter@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Previously the AstBuilder used a temporary ParenthesizedExpression
node for this purpose. Using a custom data structure belonging to the
AstBuilder is less hacky, and paves the way for supporting more
complex conditions (such as those that arise in the `if-case`
construct in the "patterns" feature).
Change-Id: I623cf484d400aef44e835ee95a55903d80aa11a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259105
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This issue (Migration tool null safety detection fails when tests use
path imports) was reported in December of 2020 and I can't reproduce
it. I believe there have been changes in analyzer package resolution
since then, aimed precisely at helping users who use this sort of
improper path import. So it is likely that those changes fixed this
bug.
I'm adding a test case to ensure that the bug isn't accidentally
un-fixed by future changes.
Bug: https://github.com/dart-lang/sdk/issues/44394
Change-Id: I81490e545aa41196c3c69bc4d74cd481079d59ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259200
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
This introduces a MemberName abstraction that supports the late
computation of member names, taking privacy and synthesized names
of unnamed extensions into account. With this feature, the unnamed
extension are now more directly handled as having no (known) name
which avoids the clash between the eagerly synthesized named of
unnamed extensions in different parts.
Closes#48765
TEST=existing
Change-Id: I62c00ace017141ecbc61eeecb275d0211f341c82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258800
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Default parameter values are implemented in dart2wasm via caller-side
substitution. When the same parameter has different default values
across different implementations within the same selector, a
special sentinel value is passed by the caller, and the callee
checks for this value and substitutes the actual default value.
Change-Id: I8235145f93c2aee7e9ef603456380253b836fcef
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259040
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
The package 'wasm' was moved to https://github.com/dart-lang/wasm in
063d0ef286.
Some of the tests for this package in pkg/wasm/test were duplicated
(probably with some changes) in tests/lib/wasm, and the commit that
moved the package to the new repo forgot to remove those duplicated
tests. This commit removes them.
Change-Id: I24ecbab99a383319482a2220623449bd516e6528
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258926
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
Relatved to https://dart-review.googlesource.com/c/sdk/+/259020
The goal is to avoid the need to update NodeListImpl.
I'm not 100% sure that we can fully achieve this, there is at least
one more place with switch / case.
Change-Id: Ic7468a7b9ded817b3315902cefdeaa7428ec6857
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259100
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
I don't believe that we need to implement anything new for these two
protocols to work correctly, and these tests are intended to demonstrate
that that's the case. The tests aren't intended to be exhaustive, but if
there are areas that you think should be tested, or aspects of the
protocols that you think might be impacted by records, please let me
know.
Change-Id: Id37fa4764b5d1d69cb7fb31f1a035e517043e96a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259060
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
This change refactors the logic for detecting overlapping and missing
variable patterns so that it can be invoked prior to the rest of type
analysis, rather than during it. In addition separating concerns
nicely (since no types are involved in these checks), I believe this
will facilitate integration with the analyzer and front end, by
allowing them to detect these errors and find the unique set of
variables defined by a pattern, at the time they are resolving
identifiers to their corresponding declarations.
Change-Id: I40879fca46d39e78a60813db007983e57a3aec31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259021
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
When using `Uri.parse` or `Uri(path:..)`, a `\` is treated as, and converted to, a `/`.
This avoids a particular problematic difference in behavior between Dart and the browser's `URL` functionality. There are still examples where the two differ in interpretation of the same code, but in those cases, the Dart `Uri` will most likely end up without a host name, which should be easily detected.
Change-Id: I798df6c3c27c6d64fb9fc8dc30d90b06ba5a9004
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258120
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>