Unsharded tests have access to the buildtools/ directory, but cannot
find it. This is used in the dart-lang/native tests which are rolled
in to the Dart SDK.
Before this CL we already had the c compiler, linker, and archiver
available in environment vars. This CL extends that pattern to also
provide the paths to common utilities that come with the c compiler.
Change-Id: Ie254da729211865e7a7e5c3c9c8a7e147fe71553
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-arm64-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382560
Reviewed-by: Moritz Sümmermann <mosum@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
To be able to control how dart2wasm-generated modules are compiled, add
a `WebAssembly.compile` and `WebAssmebly.compileStreaming` wrapper to
the generated runtime blob.
These wrappers do js-string built-in detection and enable the built-in
when it's available.
Once the SDK is rolled into engine we will update the engine dart2wasm
module loader to use `compileStreaming` from the runtime blob, in
https://github.com/flutter/engine/pull/51488.
This will allow enabling the built-in without duplicating the feature
detection and compilation code in the engine.
Change-Id: Icb939f16a2b0ae1d348ec5a814371e9ffde4fd68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381581
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
Previously, `HintCode.UNREACHABLE_SWITCH_CASE` was marked as
deprecated, and `WarningCode.UNREACHABLE_SWITCH_CASE` was an alias to
it. This created a slightly confusing situation, because it meant that
all code referring to the diagnostic had to refer to it as
`WarningCode.UNREACHABLE_SWITCH_CASE` (to avoid a deprecation lint),
but the diagnostic still _behaved_ like it was a hint, and therefore
test runner expectations still had to treat it as a hint.
It turns out that it's not really necessary to go through the
deprecation dance when changing the kind of a diagnostic, since (a)
members of `HintCode` and `WarningCode` aren't exposed through the
analyzer public API, and (b) ignore comments don't have to specify
whether something is a hint or a warning.
So the easiest way to clear up the confusion is to just remove
`HintCode.UNREACHABLE_SWITCH_CASE` entirely, and move its implemention
into `WarningCode.UNREACHABLE_SWITCH_CASE` (so that the latter is no
longer an alias).
Change-Id: I9ff7901ad38a2c168c5e54cbe0c1c52bf7c50186
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381103
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
With hot reload, a new module format is being introduced that's
repurposing the ddc module format. This will replace all other
existing formats long-term. For now, we want to enable some test
bots to start running with the new format, so we emit different
HTML based on the format in the test runner.
With these changes, all tests pass when using ddc module format
except for libraries_test. This is due to how DDC may lazily load
libraries with the new format, so this test is reordered to make
it work with the new format.
Change-Id: If52bb64977f96b4c4a287f142026412a4db558cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379750
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
This is a reland of commit d84f908641
Includes fixes:
--- Catch scope fix ---
Each catch block should define its own scope, but the compiler was not treating the body of these catch blocks as a scope. This was leading to incorrect variable renaming.
--- Duplicate label fix ---
Labels weren't being removed from the _labelNames Map after being used so multiple nodes were getting tagged with the same label. Note: This didn't actually cause any bugs because the label closer to the break statements using those labels was the correct one.
--- addAsyncCallback cleanup ---
The new async semantics actually don't require managing addAsyncCallback and removeAsyncCallback calls (proxies for async_helper.asyncStart and async_helper.asyncEnd). None of the other backends manage these themselves. It's up to tests to ensure they call async_helper.asyncStart and async_helper.asyncEnd.
Original change's description:
> [ddc] Update DDC compiler to start using the new async transform.
>
> Updates compiler.dart to use the new async transformation.
>
> Some key things to note:
> - Dart Let and BlockExpression expressions are represented as IIFEs in DDC compiled code. For non-async code this works fine but this doesn't work when they contain "await" expressions. When these expressions contain awaits we use the same lowering as we would for an async function, but instead apply it to the IIFE function. Then we simply await the IIFE Call expression as the IIFE will return a future after the transform.
> - For async/sync*/async* functions we want to make sure parameter initialization happens synchronously before any of the async logic is hit. To do this we first apply the async transform the user-code function body. We then prepend the paramter initialization logic to the body of the transformed function.
> - We add support for JS_RAW_EXCEPTION which allows the machinery in async_patch to access the wrapped JS exception in a catch block rather than the unwrapped Dart exception.
> - Stacktraces and sourcemaps have some differences. There is still room for improvement in these but they should at least allow users to reasonably step through parts of the async code.
>
>
> There are also several test fixes/updates associated with this change. The test_runner wrapper no longer has to inject in asyncStart/asyncEnd calls, these are handled by the new async logic.
>
> Change-Id: I0f9f547cd9eb52ff7d850d277876d4d57568a14e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/374444
> Reviewed-by: Bob Nystrom <rnystrom@google.com>
> Reviewed-by: Mark Zhou <markzipan@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Nicholas Shahan <nshahan@google.com>
Change-Id: Idfe05c0628b2b91f474d08d99427961381debeb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/376000
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Fixes https://github.com/dart-lang/linter/issues/1878
The analyzer does not have a full Markdown parser (CommonMark or
otherwise), but it does a small job to try and distinguish inline
links, reference links, and link reference definitions, from code
references. The issue here is that link reference definitions can only
occur at the beginning of a line, which analyzer was not accounting
for. So text like `/// Text, [a]: text` should not be parsed as a
link reference definition, but as a code reference instead.
Coupled with the analyzer's parser changes, I make similar changes to
the comment_references lint rule.
Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I55a6dad9587bc5556592774babb9766ea040d7b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/375081
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
This reverts commit d84f908641.
Reason for revert: Causing internal failures.
Original change's description:
> [ddc] Update DDC compiler to start using the new async transform.
>
> Updates compiler.dart to use the new async transformation.
>
> Some key things to note:
> - Dart Let and BlockExpression expressions are represented as IIFEs in DDC compiled code. For non-async code this works fine but this doesn't work when they contain "await" expressions. When these expressions contain awaits we use the same lowering as we would for an async function, but instead apply it to the IIFE function. Then we simply await the IIFE Call expression as the IIFE will return a future after the transform.
> - For async/sync*/async* functions we want to make sure parameter initialization happens synchronously before any of the async logic is hit. To do this we first apply the async transform the user-code function body. We then prepend the paramter initialization logic to the body of the transformed function.
> - We add support for JS_RAW_EXCEPTION which allows the machinery in async_patch to access the wrapped JS exception in a catch block rather than the unwrapped Dart exception.
> - Stacktraces and sourcemaps have some differences. There is still room for improvement in these but they should at least allow users to reasonably step through parts of the async code.
>
>
> There are also several test fixes/updates associated with this change. The test_runner wrapper no longer has to inject in asyncStart/asyncEnd calls, these are handled by the new async logic.
>
> Change-Id: I0f9f547cd9eb52ff7d850d277876d4d57568a14e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/374444
> Reviewed-by: Bob Nystrom <rnystrom@google.com>
> Reviewed-by: Mark Zhou <markzipan@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Nicholas Shahan <nshahan@google.com>
Change-Id: Ia939fe5a9dfd3a5031b06a7ea26c52e58b89f011
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/375701
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Updates compiler.dart to use the new async transformation.
Some key things to note:
- Dart Let and BlockExpression expressions are represented as IIFEs in DDC compiled code. For non-async code this works fine but this doesn't work when they contain "await" expressions. When these expressions contain awaits we use the same lowering as we would for an async function, but instead apply it to the IIFE function. Then we simply await the IIFE Call expression as the IIFE will return a future after the transform.
- For async/sync*/async* functions we want to make sure parameter initialization happens synchronously before any of the async logic is hit. To do this we first apply the async transform the user-code function body. We then prepend the paramter initialization logic to the body of the transformed function.
- We add support for JS_RAW_EXCEPTION which allows the machinery in async_patch to access the wrapped JS exception in a catch block rather than the unwrapped Dart exception.
- Stacktraces and sourcemaps have some differences. There is still room for improvement in these but they should at least allow users to reasonably step through parts of the async code.
There are also several test fixes/updates associated with this change. The test_runner wrapper no longer has to inject in asyncStart/asyncEnd calls, these are handled by the new async logic.
Change-Id: I0f9f547cd9eb52ff7d850d277876d4d57568a14e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/374444
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
This implements generating source maps for the generated Wasm files.
Copying dart2js's command line interface, a source map file with the
name `<program name>.wasm.map` is generated unless `--no-source-maps` is
passed.
When a source map is generated, the generated .wasm file gets a new
section `sourceMappingURL` with the contents `<program name>.wasm.map`.
This section seems to be undocumented, but Chrome and binaryen recognize
it as the URI to the source map file. Chrome is then loads it
automatically in the DevTools.
## Implementation
- `wasm_builder` package is updated with the new `source_map` library,
which describes the source mapping entries.
- `wasm_builder`'s `InstructionsBuilder` is updated with the new public
members:
- `startSourceMapping`: starts mapping the instructions generated to
the given source code.
- `stopSourceMapping`: stops mapping the instructions generated to a
source code. These instructions won't have a mapping in the source
map.
- `CodeGenerator` sets the source file URI and location in the file
when:
- Starting compiling a new member
- Compiling an expression and statement
Change-Id: Ic8f723f7a154402c0d34710689db57d640b83b86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370500
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
Our tests (including code in core libraries) are never run with
assertions enabled.
=> Add the necessary configuration support in test_matrix.json
=> We'll then add a new builder running one configuration with asserts.
Change-Id: Id1bc27ddf7d683846510af4711679ad14f0e4168
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370620
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Runs only the ffi test suite with no shards due to limited capacity. Runs JIT and AOT on the same builder to avoid building twice without RBE.
Change-Id: I1cebff950d89b3302169e9e4cdb68772cd8bf413
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365865
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
* We make the test runner use the same runner script as golem uses
* We make the runner script work for different JS shells
=> The runner script encapsulates how to invoke different JS shells, the
commandline format, environment variables, ...
=> Golem can then continue to use same runner script, but also with new
shells
Change-Id: Iad63fe6c0563cfeac28cbfb25eb41ee1b7c13f3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365740
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
This was causing issues with tests when there are two expected
errors at the same lines, in different files. The first expected
error would (and consume) both actual errors. So, the second expected
error would say that is unsatisfied.
Change-Id: I0bd7b56d070732c83d1d87f3dcf8ba20a693028c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364604
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
When running in d8 the runtime flags need to be set by loading an
SDK with the same name passed for the application that gets used
when the application is started. If not the module system will
create an additional instance of the SDK module. This meant the
runtime flags were being set in one instance while the application
read them from another.
The same issue was present in the ddb script and this change fixes
it there as well.
Add the `--interop-null-assertions` option to the ddb script that uses
the runtime flag to enable null checks on non-static JavaScript
interop APIs.
Issue: https://github.com/dart-lang/sdk/issues/55378
Change-Id: Id8c31383fa601f5953e2cc41021746aa918186b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361133
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Scripts that load logs and results produced by package test_runner
will print more error details when a results file does not contain
a valid JSON map on each line.
Change-Id: Ia2789dd5c0bf565eb74f6960ec8783201ff9f0ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359220
Commit-Queue: William Hesse <whesse@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
- Add a runtime flag to enable checks on non-nullable APIs that
return values from non-static JavaScript interop.
- Call a new helper method at the call site when these APIs are
detected to perform the null check.
- Add test file for the cases we can detect and enforce.
NOTE: This does not make non-static JavaScript interop sound.
This only adds more checks to enforce soundness with respect
to nullability in some cases. There are still holes that will
never be closed due to the permissive nature of this form of
JavaScript interop.
Change-Id: I2f88d1543a683fdc84d764e2b0eaafeb0ca73107
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358581
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
* Switch to `std::unique_ptr<wchar_t[]>` to represent a
dynamically strings instead of wrappers like
`StringRAII` and `Utf8ToWideScope`;
* Avoid back and forth conversion between UTF8 and UTF16:
convert to UTF16 first then work on that. This also simplifies
code - previously it tried to work with strings allocated in
different ways uniformly, which is actually unnecessary if
resulting string needs to be converted to UTF16 (and allocated
with `malloc`) anyway;
* Fix a bug in `File::CreateLink`: it was handling relative
links with long paths incorrectly. Change file_long_path_test
to cover this case and make it run on non-Windows systems as
well to ensure that all behavior that can match actually
matches.
TEST=ci
Change-Id: I1279aff1d2cdace5e2ce8633c2f7ea69a34fe41a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356680
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
These are a new type of test that runs with the SDK under test against what
looks like an external package; they start by running "pub get" then run SDK
build commands to build the package, and check that macros applied correctly.
Add tests for various builds that already pass, plus one that doesn't:
cfe_sdk_cli_test fails because it was switched to run from an AOT snapshot
and that doesn't support macros yet.
Change-Id: Ic801cb61bd414d4876566452e01dd8c8203e9013
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353100
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Morgan :) <davidmorgan@google.com>
Based on abandoned change #264261.
Changes to that PR: compare and show file paths, improve part parsing, include analyzer expectations from other files as well as CFE expectations, update unit tests.
Add end to end tests. The simplest case "library_failure_test.dart" passes before this PR, all others require the change in this PR to pick up expectations in other files.
Change-Id: Ia71b78a8f0dced83f603309877132f261b47c5a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345541
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Morgan :) <davidmorgan@google.com>
Support `checkedExplicitCasts`,`checkedImplicitDowncasts`, `checkedParameters`, `jsNumbers`, and `nativeNumbers`.
dart2js and DDC configs should support `jsNumbers`.
dart2js and dart2wasm (both optimized) do not support checked parameters nor implicit downcasts checks.
dart2wasm optimized does not support explicit cast checks.
This CL adds these features and makes sure certain configs are opting into these features.
Bug: https://github.com/dart-lang/sdk/issues/54798
Change-Id: If61d513569259317b1fb89c27d3fd97e3542697d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352103
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
This is a reland of commit 244f8cee87
with fixes for the file URIs passed on the command line.
Original change's description:
> [ddc] Fix running d8 with test.py
>
> - Add build targets to compile .dill outlines for common test
> dependencies using kernel_worker.dart.
> - Build ddc modules for common test dependencies and move amd versions
> to a separate subdirectory.
>
> Change-Id: I126b5821f6aea00b753d83560c76f00c6c5edc61
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350081
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Commit-Queue: Nicholas Shahan <nshahan@google.com>
Change-Id: I5a77512984fda1d91c812f1e240e9c10609914f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351622
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
- Add build targets to compile .dill outlines for common test
dependencies using kernel_worker.dart.
- Build ddc modules for common test dependencies and move amd versions
to a separate subdirectory.
Change-Id: I126b5821f6aea00b753d83560c76f00c6c5edc61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350081
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
* Allow --minify/--no-minify to override defaults from -O<level>
* Remove the unused(!) --name-section option from pkg/dart2wasm/*
=> Stripping it only makes sense at the binaryen step
* Make pkg/dart2wasm/tool/compile_benchmark support -g/--no-minify
=> Only useful for dart2wasm developers
Issue https://github.com/dart-lang/sdk/issues/54675
Change-Id: I695e985897b212fc345dcfd776553a009723d3b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351121
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Adds `readableTypeStrings` feature.
Configurations where `Type.toString` is expected to show the original type name and original names in function type named parameters will have this feature.
Exceptions are dart2js-prod, dart2js-minified, and vm-obfuscated configurations.
Change-Id: I5423bc31afd586733c6249519f030f7152ac4fc7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349460
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>