The tests in this class were duplicated when pattern support was added, one set
of tests for <= 2.19 and one for > 2.19. The> 2.19 tests were marked as Failing
because this functionality didn't work.
This functionality has now been implemented, but because the error code and fix
are different, these tests continued to fail. This change moves the tests to
the equivalent pattern-enabled fixes tests and removes `@FailingTest` for
those that can now pass.
There are still a few marked `@FailingTest` because of differences in the new
implementation.
See https://github.com/dart-lang/sdk/issues/52180#issuecomment-2166814402
Change-Id: Ie1dfa5bc5c608d38a191507f5f0403d20ba2ef31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371684
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Sam Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This affects very common string interpolation expressions where we now
avoid creating arrays and looping over arrays and casting references
when getting things out of arrays.
e.g. `StringBuffer.write()` uses "$obj" in it's implementation
which will benefit from this.
Change-Id: Ie6615e5f76a4a8ccb4ff9aa85c05c7e39eab6f00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371660
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
This moves a lot of the methods needed for tokenization and
outline parsing from SourceLibraryBuilder to SourceCompilationUnitImpl.
Parts that are still used elsewhere remains in SourceLibraryBuilder
but accessed through SourceCompilationUnitImpl.
Change-Id: I0df431eee4c187e5447850961d2c27be14cb0ba3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371682
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This adds DillCompilationUnit and SourceCompilationUnit and separates
CompilationUnit from DillLibraryBuilder and SourceLibraryBuilder.
This prepares for creating SourceLibraryBuilders only after
CompilationUnits have been resolved into parts and main libraries.
Change-Id: I1b8e77ac66648f7d12ee7f09826d305fdfccb363
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371300
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Adds a flag users can use via
dart compile wasm \
--extra-compiler-option=--enable-experimental-wasm-interop
which allows code to import `dart:_wasm` and use import/export
pragmas.
Similar to how we have a way to import `dart:ffi`
dart compile wasm \
--extra-compiler-option=--enable-experimental-ffi
TEST=web/wasm/allow_import_export_pragmas_test (positive test)
TEST=web/wasm/reject_import_export_pragmas_test (negative test)
Change-Id: Ibdbbac6c3aa049b2759e96b7b749dd30ecc6aaed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370063
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Jackson Gardner <jacksongardner@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
* Unqualified, out-of-scope static extension members are not
accessible.
* Locally scoped extension members shadow others.
* Static and instance extension members do not conflict.
Fixes https://github.com/dart-lang/sdk/issues/41268
Fixes https://github.com/dart-lang/sdk/issues/55848
Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: Icd618d044b3857efa24f365c6835d42c0022c176
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370323
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Sam Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This moves the CLI logic into lib/src/dds_cli_entrypoint.dart so it can
be invoked by a custom google3 entrypoint (bin/dds.dart can't be
imported using a package: URI).
Since google3 will be able to perform some custom configuration of DDS,
google3 related logic (e.g., `BazelUriConverter`) is also removed. This
is technically a breaking change, but should be safe as this
functionality isn't currently being used.
Change-Id: I54d8a9927ff2df70e013ca5c8bc1d510b0b95f02
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371520
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
This changes LSP's Find References to treat fields and field formal parameters as a single entity (matching what Document Highlights (Occurences) and Rename refactor does).
It does this in one direction by resolving the initial element to a field if it's a FieldFormalParameter, and in the other by including FieldFormalParameters when collecting the set of elements in the hierarchy to find references to.
Fixes https://github.com/Dart-Code/Dart-Code/issues/4868
Change-Id: I33626a8d58f35d0c3bda574078f32bf98f4bc87c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364120
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Previously if you sent values in experimental capabilities that are different types to what we'd expect, in some cases we'd throw an exception and fail to initialize the server.
Since the experimental section is not specified (it's specifically for off-spec things) the behaviour of sending values should (IMO) be considered server-specific. However, reporting a useful message and continuing to function is clearly better than reporting a cryptic error and failing to initialize.
At least one client (`kak-lsp`) appears to be sending values in `"commands"` intended for the Rust LSP server which uses a different format to we're using (a nested Map where we use a List). This change will prevent the failure for them and instead report a warning. My recommendation is that their client is also updated to not send Rust experimental capabilities to non-Rust servers.
Fixes https://github.com/dart-lang/sdk/issues/55935
Change-Id: I8cba1aa3a5beebf884ff247180f809ffd33b3111
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371400
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Sam Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
There are many places where the code is producing a different location
than OpType is, but those can be handled is a separate CL.
Change-Id: Idea7529a3e64ddb25a9b15bb68f7537abd3d19e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371202
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Right now the optimized is/as-checkers are only used when the operand
type is an [InterfaceType]. That means they don't get used for e.g.
dynamic obj;
T obj2;
obj is String
obj2 is List<dynamic>;
But we can use the is/as-checkers on any operand type as long as the
type we test against is an [InterfaceType] without arguments or where
the type arguments are equivalent to defaults-to-bounds (i.e. require
no checking).
Issue https://github.com/dart-lang/sdk/issues/55516
Change-Id: I1adff52b3d880c37c344edb0c42ffd454d7b1164
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371124
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
This allows copy&past'ing commands from `flutter build web --wasm
--verbose` and replacing `dart compile wasm` with
`pkg/dart2wasm/tool/compile_benchmark`.
* We make the shell script recognize `-o` flag.
* We make the shell script recognize different platform being passed.
Change-Id: Iabecc7c87b35d35f073ced5e111a9ca5ea0d9298
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371341
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Currently we decode incoming data as a string, then parse the string as
JSON.
We can do it in one step by fusing a `Utf8Decoder` with a `JsonDecoder`,
which will be faster.
A difference between `jsonDecode` and the fused version is that
`jsonDecode` returns `dynamic`, the fused version returns `Object?`.
To keep changes as small as possible we cast the return value of the
fused verison to `dynamic` in this CL.
However using `dynamic` values is often slower than type casting it to
the right type and then using it. So it might make sense to cast it to
something like `Map<String, dynamic>` in a separate CL.
Change-Id: I76de535a72ae5532db5a27e543929519c48c701c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371080
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
This CL adds a new --interop-null-assertions flag (cf.
--native-null-assertions) with the goal of validating that JS interop
APIs with non-nullable static return types do not return null values.
This flag is currently disabled by default but is intended to assist in
sound null safety migrations.
In general, we don't guarantee type soundness of package:js interop
since users can write incorrect static types which are not backed by
any runtime checks. However, it is likely that during the null safety
migration, some interop APIs which should have been made nullable
weren't. Therefore, we want to offer some additional (but limited)
checking for this case.
For static invocations of functions with non-nullable return types, we
can simply perform a null check on the result of the call.
For instance methods (which could be invoked virtually/dynamically), we
want to perform a null check on the return value in the callee (the
interceptor method) itself when possible.
It's possible for multiple interop bindings to share the same
interceptor method. We produce a null check in the interceptor method
body if all the methods have non-nullable return types. Otherwise, we
insert checks at callsites when appropriate.
Change-Id: Ifd155d7f8326152b6d57d61199e0b7973c4a1211
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369784
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
This CL moves native assets resolution to the embedder.
The Dart VM looks up the asset path (for example
`['relative', 'foo.so']`) with the asset id. The embedder defines
callbacks for asset loading, and returns a handle to the dylib.
Then the VM calls the embedder again with `dlsym` to lookup the symbol.
The Dart VM & kernel compiler are responsible for the asset id to
asset path mapping. The kernel compiler compiles it into the snapshot
and the VM looks it up in the snapshot.
Relative paths are resolved relative to the isolate script uri (kernel
snapshot, jit snapshot, aot snapshot, or `dart compile exe` result).
The embedder is responsible for remembering the script uri it set when
spawning the isolate group.
This CL does not add `dlclose` or `dladdr` embedder callbacks yet.
Bug: https://github.com/dart-lang/sdk/issues/55521
Bug: https://github.com/dart-lang/sdk/issues/55966
TEST=pkg/dartdev/test/native_assets/build_test.dart
TEST=tests/ffi/native_assets/asset_relative_test.dart
Bug: https://github.com/dart-lang/sdk/issues/55410
Bug: https://github.com/dart-lang/sdk/issues/55523
Bug: https://github.com/dart-lang/sdk/issues/55207
Change-Id: I75ec4a368c5fb3d2f76b03771e796ff56bcac941
Cq-Include-Trybots: dart/try:vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-mac-release-arm64-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,pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-mac-release-try,pkg-mac-release-arm64-try,pkg-win-release-try,pkg-win-release-arm64-try,vm-aot-asan-linux-release-x64-try,vm-asan-linux-release-x64-try,vm-aot-msan-linux-release-x64-try,vm-msan-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361881
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
This CL changes the following:
- Formal parameter wildcards can have duplicate declarations.
- Formal parameter wildcards will produce an error when used.
Most of this CL is still needed even if we want to keep these parameters in scope. I'm working on that so I'll put this out in the meantime. The tech debt is small compared to getting a move forward on the functionality of wildcards.
Bug: https://github.com/dart-lang/sdk/issues/55655
Change-Id: I5a8b6a8081ea6deb4cfd4bf2626280c6e8c98989
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370761
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
This pipes multiple witnesses from a non-exhaustive switch expression
or statement to the ADD_MISSING_SWITCH_CASES fix, such that multiple
cases can now be inserted in a single fix.
Change-Id: I5625bbb81c72917f10f4388cfe96d1bd1536c269
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371062
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This moves CompilationUnit from being a supertype of LibraryBuilder
to only being implemented by DillLibraryBuilder and SourceLibraryBuilder.
This is done in preparation for fully separating CompilationUnit from
LibraryBuilder.
Change-Id: Id2e9488d5f35ab108d5067583541dec433b90cf2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371081
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Make tool (by default) give error when test entry specified in status
file does not exist. Make -w (by default) remove such entries.
Cleanup most status files, fixing a few entries containing `.dart` and
removing obsolete entries (i.e. entries pointing to nonexisting tests).
This should for instance have given an error in
https://dart-review.googlesource.com/c/sdk/+/370600 saying that the file
I specified didn't exist (in that I shouldn't have specified the `.dart`
part).
TEST=No tests, this is status file maintenance.
Change-Id: Ie977bf15dea2e3dad8d771fd3e99917317e975f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370886
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
`COVARIANT_CONSTRUCTOR` is not reported by the parser (today) and constructors are treated the same as other members. This change updates fix status bookkeeping making it clear that the diagnostic isn't reported and so is not fixable.
Change-Id: I4944beef64e4c9ee42757430383291a54ae75f6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371061
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>