For closures generated from both FunctionDeclarations and
FunctionExpressions, the starting file offset of the generated closure
function should be the file offset of the node itself, not the file
offset of the FunctionNode.
(This matches the logic in KernelLoader::LoadClosureFunction.)
TEST=pkg/vm_service/test/coverage_extension_methods_test
Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try
Change-Id: I25a0cd0aa6505e122a215237ca6ef7e8edb031af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507424
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Some instance calls involving numbers in bytecode are converted to
specialized bytecode instead of generating an InstanceCall instruction.
When emitting RecordCoverage instructions, add them prior to these
specialized bytecodes as well.
TEST=ci
Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try
Change-Id: Ic1ab6be4123766d7ce583966dfde393a5df77579
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507421
Reviewed-by: Alexander Markov <alexmarkov@google.com>
The original iteration of adding coverage arrays originally eagerly
allocated coverage arrays for bytecode methods with recorded coverage.
Now that these coverage arrays are lazily allocated,
Function::GetCoverageArray() needs to ensure that the appropriate
coverage array has been allocated. Otherwise, no misses within the
function are recorded in cases where no RecordCoverage instruction in
the method has yet been executed.
TEST=vm/cc/SourceReport_Coverage_UnusedClass_ForceCompile
pkg/vm_service/test/branch_coverage_test
pkg/vm_service/test/coverage_async_test
pkg/vm_service/test/coverage_closure_call_after_optimization_test
pkg/vm_service/test/coverage_closure_call_test
pkg/vm_service/test/coverage_instance_call_after_optimization_test
pkg/vm_service/test/coverage_static_call_after_optimization_test
Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try
Change-Id: Iff4ddaf583d0f9583bc415142bdee52c046a6712
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507440
Reviewed-by: Alexander Markov <alexmarkov@google.com>
These two groups were the same (except for Kallen, who was
accidentally not included in OWNERS_FOUNDATION and should have been),
so we decided to merge them. Internally, the group is called the "Dart
Language and Core Libraries" team, so `OWNERS_LANGUAGE` seems like the
one to keep.
Change-Id: I606ba5828f482c04841c2e995a0066ad6a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508166
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
These tests were testing that elements declared in augmentations
can be target. But resolution is based on the element model, and we
already have tests that show how we aggregate declatations into th
element model.
Migrated 3 tests that show that `this` and `super` prefixes work
inside augmentations.
Change-Id: I36d7b1044a856e64ed92990f0e4a732f2b41a4b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507281
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Mark server_connection_api_test and server_connection_vm_service_test as Slow, Pass in pkg/pkg.status to prevent false-positive timeouts on slower/loaded builders.
TAG=agy
CONV=2fddba4d-da91-4fcd-923a-faee680c5b4e
Change-Id: Ic4fa73242c3c64d517294d9a8fb1fec5e0423380
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507660
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
Extend --check-clean (enabled on bots) to verify build commands don't include absolute paths.
The non-RBE GCC and MSVC builds still have absolute paths. GCC doesn't have -ffile-compilation-dir so it uses -fdebug-prefix-map, which is not fixable. The MSVC build has absolute path in the toolchain wrappers, which might be fixable.
TEST=ci
Change-Id: I3b984aaab7aefa7ff527f0a039ca42281224a09d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/506505
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Previously, when the code in `parser_ast_indexer.dart` encountered a
constructor, it assumed that it could figure out the constructor's
name by looking at the last identifier (before parameters) of the
signature, and prepending the class name with a `.`. This had the side
effect that "unnamed" constructors were given a name of
`ClassName.ClassName`.
With the new constructor syntax, this doesn't work anymore, because
for unnamed constructors the signature looks like
`new(...parameters...)` or `factory(...parameters...)`, so there are
no identifiers, leading to a crash.
At the moment we don't see the crash because this code is only used to
analyze files within the front end and kernel, which don't use the new
constructor syntax yet. But it blocks us from being able to migrate
the front end and kernel to use the new constructor syntax.
This CL fixes the problem, unblocking the migration.
Change-Id: Ibf78b77d736ab2ec812945401ffacf3f6a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507261
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This CL ensures the processing of parameter annotations on primary constructors.
Since primary constructors with constructor body declarations are built in two parts, the constructor is not finished when the primary constructor is built, but instead delayed to when the primary constructor body declaration is built. This conditional code path accidentally left parameter annotations unprocessed.
Fixes b/517220569
Change-Id: I8ec82283dc60a743c22cb03c041d2975e95941bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507980
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
NOTE: Amost all of this code was written by AI, but has all been
reviewed by me. I did a tiny amount of cleanup that was faster to do
myself than to ask the agent to do it. That doesn't mean that I've
caught all of the AI's bugs, but I did try to ensure that test coverage
was complete enough to also catch problems.
This fixes a bug in the way the `ChangeBuilder` handled linked edit
groups. The bug resulted from the fact that the offsets of the linked
edit groups was adjusted at the time each edit location was added.
Doing that meant that they weren't re-adjusted when new non-group edits
were added at a lower offset, making it possible for the edits to have
the wrong offsets when they were sent to the client.
The solution is to not adjust them when they are created, but to
adjust them during `finalize` when other offsets are adjusted. At that
point we have full knowledge of all of the edits so we can get it right.
Doing that required adding a reference to the each edit in the file
edit builder (because only the edits in the same file can require that
an adjustment be made).
My hope is that with this change in place I can complete the arc of
work to update all of our refactors to use the `ChangeBuilder` APIs to
build the edits.
Change-Id: I59ddb0dee1f9dbb15bdcc38a84ddc07acefe6262
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507622
Reviewed-by: Samuel Rawlins <srawlins@google.com>
This add a fix to add a type annotation in place of the `var` keyword.
The assist to add a type annotation was already being offered, but it
didn't understand that it needed to also remove the keyword. The added
fix will do both, and, by being a fix, will appear higher in the list
of code actions that users see, along side the fix to remove the
keyword without adding a type annotation.
The fix to remove the keyword can be bulk applied, so I couldn't make
the new one also be bulk applicable. We might consider reversing the
status so that the default bulk fix behavior includes adding a type
annotation, but this CL doesn't do that.
Change-Id: I122221ef1e5119a76e1157a9a15cf1193135fc59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507161
Reviewed-by: Samuel Rawlins <srawlins@google.com>
In `server_connection_common.dart`, the `server removes clients that
disconnect from the API` test spawned its own Chrome instance using
`package:devtools_shared`'s `Chrome` class without isolated profiles or
essential headless flags.
This caused the test to hang or fail flakily in container environments
(like LUCI bots) and local environments: 1. Without
`--use-mock-keychain`, headless Chrome on macOS blocks on system
credential dialogs. 2. Without `--no-sandbox`, Chrome renderer processes
can crash in restricted container environments. 3. Without
`--user-data-dir`, Chrome uses the default system profile, which can
cause it to attach to an existing open Chrome instance instead of
starting a new one, meaning the process exits immediately and the test
cannot terminate it.
Fixed by directly using `package:browser_launcher`'s `Chrome` class in
the test and passing:
* `--user-data-dir` pointing to a unique temporary directory.
* `--no-first-run` and `--no-default-browser-check` to bypass welcome prompts.
* `--no-sandbox` and `--use-mock-keychain` where appropriate.
Also wrapped the test in `try-finally` to guarantee cleanup of the
temporary profile directory.
Change-Id: I6fbe5a280524b57c635ab11ef54fa07dba2794cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507600
Reviewed-by: Alexander Aprelev <aam@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Adds support for writing the active VM service connection URI to the file
specified by `--write-service-info-to-file` and updates native bindings
with the web server address on startups.
TAG=agy
CONV=ae3a29f5-e2c8-499c-b221-ff61e40f5f1f
Change-Id: Ice85fda098031ef4ba1cd1120a917137aae97105
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505163
Auto-Submit: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Resolves issues in DevFS handling where individual stream file PUT
requests could result in flaky test failures on Windows.
TAG=agy
CONV=ae3a29f5-e2c8-499c-b221-ff61e40f5f1f
Change-Id: I55d12cc55f35d1d1ed36742d442a3d4bebad53bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505162
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Correctly define `kRootLibraryUri` constant and forward `rootLibraryUri`
to the resident frontend compiler.
TAG=agy
CONV=ae3a29f5-e2c8-499c-b221-ff61e40f5f1f
Change-Id: Ie4c87857744d9b32165ea7d0f8004d6d6c337886
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505161
Auto-Submit: Ben Konyi <bkonyi@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
(Part of https://github.com/dart-lang/sdk/issues/63288)
This change migrates `pkg/build_integration` to use the new
constructor declaration syntax, described in
https://github.com/dart-lang/language/blob/main/accepted/future-releases/primary-constructors/feature-specification.md#abbreviations-of-in-body-constructor-declarations.
This change was performed in an automated fashion, by (a) bumping the
packages' SDK constraints to `3.13.0-0`, (b) enabling the lints
`unnecessary_type_name_in_constructor` and
`unnecessary_const_in_enum_constructor`, (c) fixing the resulting lint
failures using `dart fix`, and then (d) reformatting the affected
files.
To ease code review, I've reverted unrelated formatting changes.
Since this change requires bumping SDK constaints to `3.13.0-0`, it
was only performed on packages that are *not* published on
pub. (Packages that *are* published on pub should remain on lower
language versions until at least after the stable version of 3.13 is
released, so that we don't block users on the stable channel from
receiving updates to those packages.)
Change-Id: Ifb2c4ca31f14c3e94f7b756969e730bf6a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/506023
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This will avoid some merge conflicts in a follow-up CL I'm working on
that will enable the lints `unnecessary_type_name_in_constructor` and
`unnecessary_const_in_enum_constructor` (and will fix declarations
accordingly).
Change-Id: I26d8b58ac8f299dd08539b91d7b2bc786a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/506022
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
We have comments in some generated files suggesting that the user use
this script to regenerate them, but the script previously only worked
on Macs. This CL fixes the script so that it work with Linux too.
Change-Id: I4b42b843513247b16bbbcd0b7c85f82d6a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507540
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Because of the reversed condition, the priority for primary constructor
bodies wasn't being added when the lint was disabled, causing it to not
be moved, resulting in seemingly inconsistent results.
Change-Id: I5110e39e066414e04bb69f61b3aa7189875469f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507460
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Report direct recursive interface inheritance diagnostics on the
inheritance clause that introduces the cycle, rather than on the class
or mixin name. This gives a more precise target for self-references in
extends, implements, on, and with clauses.
Track recursive inheritance reporting per interface element across
fragments so that augmentation clauses can produce the specific
diagnostic when they introduce the cycle. Defer the generic cycle
diagnostic while earlier fragments still have later augmentations to
inspect, and use the element target as the fallback location for
indirect cycles.
Update diagnostic expectations to match the new locations and cover
augmentation and part-file cases for recursive extends, implements, on,
and with clauses.
Change-Id: I480a56e4b766d704c290d67d9ca4f6a73a2f655b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507300
Reviewed-by: Paul Berry <paulberry@google.com>
Forward the `pause` parameter to the C++ runtime in reloadSources, and use
the path resolver helper to properly resolve raw Windows file paths during
hot reload compilation.
TAG=agy
CONV=ae3a29f5-e2c8-499c-b221-ff61e40f5f1f
Change-Id: Iab29cb94b390144d17f1c014ec2e9acd1ab1e11e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505160
Commit-Queue: Ben Konyi <bkonyi@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
These files had comments indicating that running
`pkg/analysis_server/tool/spec/generate_files` would regenerate them,
but that was not the case.
Change-Id: I6ceb6352edf6eab5e746276a0a2f33b16a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507521
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Avoid a race condition between async setenv/unsetenv calls on the VM thread and concurrent getenv/environ reads on the main thread.
In glibc, setenv and getenv are not thread-safe against each other. VmInteropHandler.setEnvironmentVariable previously sent a message to the VM thread to call setenv/unsetenv asynchronously, while the main thread immediately proceeded to access Platform.environment or Platform.localeName (which calls getenv). This could cause a crash (SIGSEGV) in getenv.
This CL makes VmInteropHandler.setEnvironmentVariable synchronous by awaiting a reply from the VM thread before returning.
TEST=pkg/dartdev/test/environment_test.dart
Fixes https://github.com/dart-lang/sdk/issues/63460
Change-Id: Ic8211897ce26ffbdc142fa594cd397189a61f061
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/506800
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>