Commit graph

43884 commits

Author SHA1 Message Date
Nate Biggs 64fe77f8db [dart2js] Revert invalid refinement change.
A user found another case where this fails (b/290868787).

In this case a ForwardingTypeMask is delegating the subtyping checks to its `forwardTo` mask which ends up saying the masks are equal even though the wrapper around the forwarded masks means they are not equal.

Change-Id: I015f2faf57557ff4189acb6c7144d09cf1ae6bb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313341
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-07-12 15:56:09 +00:00
Danny Tuppeny d718ab5f08 [analysis_server] Extract LSP request helpers to allow reuse in LSP-over-Legacy tests
The mixin `LspAnalysisServerTestMixin` contains a lot of helpers for interacting with the LSP server in tests and is used by both the in-process tests and the out-of-process integration tests.

We now have a third category of LSP tests that would benefit from many of these helpers (such as "getHover()") but are not talking to a native LSP server.

This change splits those helpers out into `LspRequestHelpersMixin` which contains only the request helpers without any code assuming a native LSP server, so they can be used by LSP-over-Legacy tests.

All code in `request_helpers_mixin.dart` was lifted directly from `server_abstract.dart` with no changes.

It also adds a test that error responses in LSP-over-Legacy are handled appropriately.

Change-Id: I847855a5314b5b04d700c6400b67e76e5f0d3402
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313362
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-07-12 15:30:15 +00:00
Danny Tuppeny c4105d35db [dds/dap] Support translating VM Instance IDs -> DAP variablesReferences and back for DAP-over-DDS
This adds two custom requests to the DAP-over-DDS handler to translate between VM/DAP instance IDs:

- $/createVariableForInstance (String isolateId, String instanceId)
- $/getVariablesInstanceId (int variablesReference)

Because DAP's variables request only fetches _child_ variables (eg. fields) but we'd likely want to align the top-level string display of a variable, the wrapped variable will first be returned as a single variable named "value", which contains both the string display value and also a variablesReference to then get the child variables (usually invoked when expanded).

These methods currently live directly in the DDS DAP adapter since I figure they're only useful for clients using the VM Service, but we can move them to the base adapter if in future this turns out to not be the case.

Change-Id: I60f28edd86c3468cc592175cb665557a1fc85056
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312987
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-07-12 15:04:20 +00:00
Paul Berry 3ae6793469 Flow analysis: remove redundant assertion from constructor.
The assertion in the `_FlowAnalysisImpl` constructor was unnecessary
because it was checking that all variables that are reported to
`AssignedVariables` as read or written must also be reported as
declared. This is already checked by assertions in
`AssignedVariables.finish`, which is called by the `_FlowAnalysisImpl`
constructor.

I've added tests to `assigned_variables_test.dart` to confirm that
these assertions work, and I've also cleaned up the assertions a bit,
eliminating some redundancy and ensuring that in the event of a
failure the assertion failure message will be comprehensible.

Change-Id: Ife827c91d944707f093f4cb8421385f5355d11fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313140
Auto-Submit: Paul Berry <paulberry@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-07-11 21:03:29 +00:00
Daco Harkes b64ef27dec [pkg/ffi] Roll dart-lang/native
Rolling https://github.com/dart-lang/native/pull/87 manually because
of the c_compiler -> native_toolchain_c rename.

Change-Id: I2592882a7137a40703f96a487a66d31eac7c990d
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313200
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2023-07-11 19:14:48 +00:00
Konstantin Shcheglov c54b4bc5d3 Push class modifiers up to ClassOrAugmentationElement.
Change-Id: If99d9e29ec8ca87677a58cd90a68a5dda5c5af9c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313183
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-07-11 18:45:20 +00:00
Derek Xu f5080bedb3 [VM/Debugger] Fix behaviour of ActivationFrame::EvaluateCompiledExpression when paused inside a closure
TEST=pkg/vm_service/test/evaluate_inside_closures_test.dart, pkg tryjob

Fixes: https://github.com/dart-lang/sdk/issues/52430
Change-Id: I72b755d31614c7c56c504130656c3668d8b7e72b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313001
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-07-11 18:41:04 +00:00
Konstantin Shcheglov 3e80d29fd6 Use AugmentationExecutableElement, AugmentationMethodElement.
These become a single property of ExecutableElement, MethodElement.
No new visitors, no new nodes and elements.

Change-Id: Ic523e9d51356e5a8d2a6cd62cd508344f561ffb0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312960
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-07-11 16:19:09 +00:00
Danny Tuppeny 80a6670d5d [dds/dap] Add some basic global evaluation support
This provides support for basic global evaluation matching the legacy DAPs. The first available thread is used (because there's currently no way for the user to select a thread) and we look up a library from a file URI provided in the `context` field.

In future I hope there's a standard DAP way of getting a file from the client (see https://github.com/microsoft/vscode/issues/134452).

See https://github.com/dart-lang/sdk/issues/52574
See https://github.com/Dart-Code/Dart-Code/issues/4636

Change-Id: I7bfa466001142e7e39ebb270ce65f4746a9affcd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312980
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-07-11 15:12:41 +00:00
Johnni Winther 0d47ba6890 [_fe_analyzer_shared] Remove RecordStaticType.isSubtypeOfInternal
This method caused invalid exhaustiveness checking by seeing
record types as related based solely on the structure.

The original purpose of the methods has been removed in the mean time
by the change to restrict the created spaces by the matched value
type.

Closes #52800

Change-Id: I8fb581374a4813dc63261d9e1354c4eea94f212c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312982
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2023-07-11 12:19:39 +00:00
Martin Kustermann 81df36216f Make utf8.encode() have Uint8List return type
Right now `utf8.encode()` has a static return type of `List<int>`
due to extending `Encoding` (which extends `Codec<String, List<int>>`).

We cannot easily change `Encoding` to extend `Codec<String, Uint8List>`
because that would also change `utf8.decode()` to require `Uint8List`
which would be a breaking change.

So instead we override `utf8.encode()` to have more precise return type.

Some parts of our SDK are run using the checked-in SDK, so it cannot
rely on the changed return type yet (until checked-in SDK is rolled).

So we use `const Utf8Encoder().convert()` as a temporary change, as
that already has `Uint8List` return type.

Issue https://github.com/dart-lang/sdk/issues/52801

TEST=ci

CoreLibraryReviewExempt: More precise return type for existing API
Change-Id: I2861d1f0eb3d292d8e3ec8437c0d441a2d2bd193
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254903
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2023-07-11 08:54:33 +00:00
Daco Harkes e1c12b3ab2 [cfe/ffi] Fix Finalizable non-nullable variables
TEST=pkg/vm/test/transformations/ffi_test.dart
TEST=pkg/vm/testcases/transformations/ffi/regress_52596.dart
Contains
`throw "Attempt to execute code removed by Dart AOT compiler (TFA)";`
without the fix.

Closes:https://github.com/dart-lang/sdk/issues/52596
Change-Id: I5de819afcf6f70be037b60432ea016bc281b742e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312909
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
2023-07-11 07:53:47 +00:00
Konstantin Shcheglov 2c97bd7801 Remove duplicate getters from ClassDeclaration and MixinDeclaration.
Change-Id: I69440dd7b1911db6616dc500d82b7b9c3e996529
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313083
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-07-11 05:47:30 +00:00
Konstantin Shcheglov 7a258fa43b Add NotAugmentedXyzElementImpl implements AugmentedXyzElement.
So, that we don't have to copy all class members for 99% cases when
there are no augmentaitons.

Change-Id: I5c225905a0460ce5162543553e207a2d4412ecb9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313082
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-07-11 02:22:35 +00:00
Kallen Tu 8be3439ce3 [analyzer] Make InstanceCreationEvaluatorTest consistent with other const tests.
Print type in `dart_object_printer.dart`.
Use `assertDartObjectText` instead of whatever was being used before.

Change-Id: Ifdfb6343013bb5fe654bcff870a9ff83b155402f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312885
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-07-10 22:20:22 +00:00
Helin Shiah 2094a733aa Add URI converter method that can be overridden
This is for an internal debug adapter to extend the test debug adapter and provide a custom URI converter to provide internal local paths during breakpoints.

Change-Id: I3b61b70fe07e14f08ff37443ef87facc523bf7fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313000
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Helin Shiah <helinx@google.com>
2023-07-10 21:30:51 +00:00
Konstantin Shcheglov 3bb4d7d0d4 Parse mixin augmentations, build element model.
Change-Id: Ie1bdb6d47b31c527546f62abf65d19a4a4e50ee7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312924
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-07-10 20:48:32 +00:00
Danny Tuppeny 95e6f1e110 [dds/dap] Use Isolate numbers as DAP thread IDs
We used to generate our own thread ID starting at 1 and counting up. There was always a 1:1 mapping from a DAP thread to a VM Isolate. With this change, we always use the Isolate number as the thread ID which makes it easier for tools using both VM Service and DAP at the same time.

Change-Id: Id8d82f6fd5134987f2ecfeaa761765d55999405d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312906
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-07-10 20:14:58 +00:00
Brian Wilkerson edb8d33c8e Start converting portions of the KeywordContributor
Change-Id: I9423ae6e50eec95ba3e5212529f4f3635d2f76d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312940
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-07-10 19:51:33 +00:00
Joshua Litt 50c810e12c [js|dart2wasm] Add JS backed subtypes of Dart typed array classes.
Change-Id: I19a6d47bf857969abe2205e6b505b3a1dead5e3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310480
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2023-07-10 18:11:02 +00:00
Ryan Macnak 99ef36064f [infra] Make the sanitizer a first-class status variable.
Makes the TSAN skips apply to
 `test.py -mrelease --sanitizer=tsan`
and not just
 `test.py -n vm-tsan-linux-release-x64`.

Also makes the timeouts agree.

Change-Id: I10315e754a4ebb3020f3c2f6cecfac6b77e77a9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311828
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-07-10 17:46:31 +00:00
Sam Rawlins fab30a7a73 Bump linter to e8c878360595c1d268d93f54c09bc843815a42d7
Change-Id: I8ab5b3de76d2e498185135660aae1875326f8a8c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312961
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-07-10 16:20:18 +00:00
Kyle Turney e826300560 add fix for removing the leading underscore from local function names
Closes https://github.com/dart-lang/sdk/pull/52822

GitOrigin-RevId: 1e97f3fde70079ea47a4bb8f8f58db341ae26fdc
Change-Id: Iec46cca3532789b4fb338d73cdbb946a0d383845
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312061
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-07-10 14:18:08 +00:00
Martin Kustermann daa35fd4fd [gardening] Restore timout multiplier in test runner for linux-arm64
The timeout multipiler for linux-arm64 was originally 4, then lowered to
1 (see [0]), then increased again to 2 (see [1]).

Though it seems that service tests are still flakily timing out, so
let's try restoring the original multilier.

[0] https://dart-review.googlesource.com/c/sdk/+/306662
[1] https://dart-review.googlesource.com/c/sdk/+/307972

Also special case `ia32` in timeout calculations due to not using
an AppJIT trained `kernel-isolate` snapshot and therefore being
very slow, especially in ia32-debug mode.

Issue https://github.com/dart-lang/sdk/issues/52589
TEST=ci

Change-Id: Iab8c768866aec9e77bb83c7a3242cc5de8fb4e2f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312905
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2023-07-10 12:02:16 +00:00
Jake Macdonald 1a13ea6c05 Add a disposeMacro api, with TODOs in the implementations to call it.
Change-Id: I38049ca8b851c2203ddaaa729ef651e7802a1d2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312860
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-07-10 12:01:49 +00:00
Johnni Winther 911b376f7e [cfe] Handle inline class representation field in object pattern
Closes #52667

Change-Id: I9c6d51597ff27ae3a7cdeed29d75755c18a2d530
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311742
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2023-07-10 11:02:50 +00:00
Chloe Stefantsova b36fbaef2c [cfe] Update both sides of intersection types in GUB
In computation of GUB both the left-hand and the right-hand sides of
the intersection should be updated as nullable when the other operator
to GUB is Null.

Closes https://github.com/dart-lang/sdk/issues/50431

Change-Id: I4b616a94a3e7bf149205ba1b90732453c19ace47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311845
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2023-07-10 09:51:56 +00:00
Konstantin Shcheglov 4d4eefa956 Compute 'mixins' and 'interfaces' for ClassElement.augmented
Change-Id: I7514576ada4a5dcd048a2c399d5bfe11169f3394
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312887
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-07-07 21:39:41 +00:00
Konstantin Shcheglov 884116a83b Move 'constructors' getter into NamedInstanceOrAugmentationElementMixin.
Remove extra looping detection.

Change-Id: Ifdd7f4729930b3022a8b04f8143d714298acf8dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312884
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-07-07 20:34:39 +00:00
Konstantin Shcheglov aad361b31e Link augmentations and targets during building.
We walk augmentations in the right order, so can update update
necessary data structures as we go.

Change-Id: Ibf3409658009b82a960caaacd538fcd6c779b007
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312883
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-07-07 19:14:25 +00:00
Konstantin Shcheglov 553c804eb5 Don't use LinkedData type parameter.
Change-Id: I2afa126856f05072cb5e796b4f47d64e61284b96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312882
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-07-07 18:29:37 +00:00
Konstantin Shcheglov ac0fc3c11c Print augmentation libraries after the defining unit.
So, we can read it more naturally, first the declaration, then its
augmentations.

Change-Id: I21805969bff6874660500d4477b39ce5aba7484a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312880
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-07-07 17:08:54 +00:00
pq ff8963d1be fix make_final to properly update for loop patterns
Fixes: https://github.com/dart-lang/sdk/issues/52820

Change-Id: If94b56f034bc8c28087251aada59433578ed7a2f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312702
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-07-07 16:23:59 +00:00
Danny Tuppeny 201fb68e64 [analysis_server] Update remaining CodeActions tests to use new expectation format
This is a continuation of a previous change that stops tests from verifying only individual files modified via a `WorkspaceEdit`. All verifications of these edits are done via a single string that includes all changes, with annotations for creates/deletes/renames.

Additionally, it migrates some additional tests to use TestCode instead of the old markers, and removes some extra indenting these tests had.

It also starts changing how capabilities are set for tests from having to nest function calls in `initialize()` calls to instead calling simple helpers prior to initialization.

Change-Id: I35d16a296c2125ab830685437e14eb3b29ea4704
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312841
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-07-07 16:15:24 +00:00
pq b05282a1e9 @useResult support for pattern variable declarations
Fixes: https://github.com/dart-lang/sdk/issues/52841

Change-Id: I0ce4e8bc7771808fcaacfbfc2b591ab805c74ff4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312711
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-07-07 15:56:28 +00:00
Konstantin Shcheglov fc0e656868 Build ClassAugmentationElementImpl, basic linking.
Change-Id: I18bd3d97ad9fe661d14e3d3d006219ffceedcfc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312349
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-07-07 14:55:38 +00:00
Tess Strickland 1bdbafff49 [pkg/vm_snapshot_analysis] Allow old 'patched_class_' field.
While in more recent SDK versions the 'patched_class_' field has
been replaced with 'wrapped_class_', this package can still be
used with the earlier SDK versions if we fall back to checking it.

Issue: https://github.com/flutter/flutter/issues/130009
Change-Id: Ifb1250393b72e58bbdc0764c7e2ce96269e659ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312802
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-07-07 11:36:59 +00:00
Tess Strickland 1133598168 [pkg/vm_snapshot_analysis] Don't assume Code objects have an owner.
For regular stubs, the owner will be null.

Issue: https://github.com/flutter/flutter/issues/130009
Change-Id: I8c85e3130128af79c596f381869d61631221cf9e
Cq-Include-Trybots: luci.dart.try:pkg-mac-release-try,pkg-mac-release-arm64-try,pkg-linux-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312660
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2023-07-07 09:52:50 +00:00
Nicholas Shahan 5ca83258ef [ddc] Fix default type args signature on native classes
- They should match the calling convention and use the "dartx" symbol.
- Skip adding signatures for static methods since they can't be
  called dynamically anyway.

Issue: https://github.com/dart-lang/sdk/issues/48585
Issue: https://github.com/dart-lang/sdk/issues/52867
Change-Id: If5a76f52163b2267129880dbfe8d145a3fd93408
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312204
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-07-06 23:34:20 +00:00
Alexander Aprelev e62748f3e1 [gardening] Make info_macos_test resilient to snapshots running.
Align info_macos_test with info_linux_test in this regard: fix is similar to how https://github.com/dart-lang/sdk/issues/50583 was addressed.

BUG=https://github.com/dart-lang/sdk/issues/52658
BUG=https://github.com/dart-lang/sdk/issues/52402

TEST=ci

Change-Id: If7ab54990069c86eb5c0348e20086254818da839
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312705
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-07-06 22:57:13 +00:00
Kallen Tu a2cdf8e96d [analyzer] Refactor const evaluator visitBinaryExpression and tests.
Made more of the tests consistent in `evaluation_test` (slowly, but surely).

Change-Id: I515c4d6d81cedcc1d8d20080e231ac1e0afb5ec7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312200
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-07-06 21:48:07 +00:00
Konstantin Shcheglov 98e6322086 Fix another TODO in elements printer, use 'name'.
Change-Id: I6696a4b559072b064ee16d22b8aad528b52eb6a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312704
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-07-06 21:47:21 +00:00
Jake Macdonald 658de58b4f move the majority of the client bootstrap code into a real library to make it more maintainable
Change-Id: Id84981b236176c7831cece61692ec895ba2ac1e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312723
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
2023-07-06 21:12:58 +00:00
Brian Wilkerson a510e60dbf Simplify the keyword contributor to make it easier to port to the new framework
Change-Id: I29d0bdc2d798adc3b39718fabba893456495dce9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312703
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-07-06 21:03:37 +00:00
Nicholas Shahan 420b551d54 [ddc] Fix missing type tags in new type system
The types implemented transitively through mixins were missing from
the tags we manually attach. 

Issue: https://github.com/dart-lang/sdk/issues/48585
Change-Id: I7fa00fd79963914cd25c2f87f52d8acc76c9c359
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312202
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-07-06 20:27:24 +00:00
Nicholas Shahan 1199dc09b7 [ddc] Support extractTypeArguments in new types
Inline calls to the extract function directly with the type arguments
inserted as extractions from the instance.

Issue: https://github.com/dart-lang/sdk/issues/48585
Change-Id: I6b791c59478c2e609df30163835e3fd0863a2d94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307514
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-07-06 19:24:54 +00:00
Konstantin Shcheglov 4169196834 Use NodeTextExpectationsCollector to collect and update element expectations.
This code was older, and was a prototype of NodeTextExpectationsCollector,
but we have it now, it is better, and we can de-duplicate.

Change-Id: I428abb04687f2e3ff5142907a71fcf80e460b830
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312700
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-07-06 17:50:59 +00:00
Nicholas Shahan be6a560ca1 [kernel] Fix record type equivalence
- Increment index to avoid infinite loop when the first named elements
  in the two record types are equivalent.
- Add some test cases for record types.

Fixes: https://github.com/dart-lang/sdk/issues/52817
Change-Id: Ifbf3505c74a1f130c9c90ddbb6b1d96d9641e51e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311929
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-07-06 16:37:49 +00:00
Konstantin Shcheglov eaed1fbaff Fix a couple TODOs in the element model printer.
We can use ElementPrinter now for printing elements as references.

Change-Id: Ie75dc96940cf3a1e60f87e34801494f55145901f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312350
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-07-06 15:45:57 +00:00
Ben Konyi ea1a6a66b8 [ DDS ] Set minimum SDK bound to 3.0.0
Allows for use of new language features.

Change-Id: Ic66cb6d2e8bfbf5ff505cc72c0a23deb32026bbc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312601
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2023-07-06 15:39:35 +00:00
Danny Tuppeny 7c2ee2222f [dds/dap] Improve stack frame rendering + fix bad paths in tests
This fixes a bug where we'd produce the wrong absolute path for stack frames that had absolute paths (because `package:stack_trace` uses `path.absolute()` on them).

It also adds support for making stack frames in printed stack traces faded if they are not part of the users own code. This is something the legacy DAPs did. I've also made it possible to perform this stack parsing on non-error events because I'd like to use it on Flutter structured errors (again, something we supported in legacy adapters and was missing here).

Fixes https://github.com/Dart-Code/Dart-Code/issues/4573,

Change-Id: I6c1c3ab69915eca9a1eeef5dcba7f1eb558086de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311842
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-07-06 15:01:21 +00:00
Danny Tuppeny c81b2bac1b [analysis_server] Enable calling LSP handlers over the legacy protocol
This currently only allows "textDocument/hover". Handlers may need some tweaks to remove any dependencies on LspAnalysisServer before they can be enabled.

Capabilities and config are hard-coded to a very basic set (which I suspect will expand as new handlers are added). Reverse requests and notifications are not currently supported (I suspect these will be added when there are more concrete use cases for them because they may need to be conditional based on real client capabilities/needs).

Change-Id: I8a096f9530ad1518ac5ee876aea2560d269a27ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312303
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-07-06 14:15:16 +00:00
Danny Tuppeny 0d3e76c8e6 [analysis_server] Modify code action/refactor tests to verify whole set of edits
The goal here is to ensure tests can't accidentally check only a subset of edits made during the command execution.

Not all tests have been migrated (only refactorings and a few that happened to use some of the same methods for verification).

Change-Id: I5589e8e667e957aee3ea55f741b1b49a3859d6bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312304
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-07-06 14:05:09 +00:00
Nate Biggs 924a33c0f5 [dart2js] Fix valid/invalid refinement logic.
The issue here was that isInMask does not hold inversely. The key is that we want to verify which refinements to skip, therefore we want to calculate *in*valid refinements. We want to skip refines where the new type is a Union AND the old tpye is a supertype of the new type. after.isInMask(before) gives us that but !before.isInMask(after) does not.

I've renamed isValidRefinement to isInvalidRefinement to more accurately capture this distinction.

Change-Id: I0d99479357a140095a5d0dfb7e2f987556097891
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312160
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2023-07-05 20:56:28 +00:00
Konstantin Shcheglov ec893a4d8f Rework ElementImpl and AugmentationElementImpl hierarchies to use XyzOrAugmentationElementMixin(s).
Add ClassAugmentationElementImpl, no any tests yet because it
required parsing, AST, etc. And it is also not ready yet.

Change-Id: I601141545e9bf0638771f28bb9498be9de664659
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312345
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-07-05 20:03:47 +00:00
Konstantin Shcheglov c4cbc7042f Add ClassAugmentationDeclarationImpl, parse into it.
Change-Id: I2461cffa76f31079e52f9877b9fe35668811191b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312346
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-07-05 20:03:37 +00:00
Jake Macdonald f254c8a4ba Add library macro definitions and support for executing them.
These are intended to be applied by annotating a library directive.

Note that some parameter types had to be widened since `Library` is not a subtype of `Declaration`. Ultimately I think that is fine though.

Bug:https://github.com/dart-lang/language/issues/2839
Change-Id: Ia1311c8aea729f2bd8b76173ce4c7595a6a37a42
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312140
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2023-07-05 18:56:53 +00:00
Danny Tuppeny 1c4ad79985 [analyzer] Include trailing commas in display strings for single-positional-field records
See https://github.com/Dart-Code/Dart-Code/issues/4624

Change-Id: Iac2f061c11ffdb95917329465307abc8e92b6ba3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312421
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-07-05 18:56:36 +00:00
Danny Tuppeny 28ea45c05c [analysis_server] Handle hovers for identifiers declared in for loops
Fixes https://github.com/Dart-Code/Dart-Code/issues/4627

Change-Id: Idcff9a6e87929ef6ceb0cbed5b44a493bb6a8260
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312441
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-07-05 18:12:21 +00:00
Konstantin Shcheglov fb9d0e6dc3 Tweaks for mixin inference.
I started initially with the idea to move 'mixinInferenceCallback'
to `ClassElementImpl`, but then realized that we do it for enums too.
So, it should stay in `InterfaceElementImpl`.

I left with code that I think slightly modernized, so decided to
send it for review.

Change-Id: Ib990392dc4985a71ffba1f4080237872d9a65ad2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312521
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-07-05 18:04:37 +00:00
Konstantin Shcheglov 2b36ef12e6 Remove a few ramaining references to TypeName, use NamedType.
Change-Id: I61b6499dd369c24726084d68f1f4abf374209986
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312520
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-07-05 17:48:09 +00:00
Kallen Tu 1da821f670 [analyzer] Refactor visitRecordLiteral and visitSetOrMapLiteral in the constant evaluator.
Change-Id: Iabab7f406a5f688c5070a26af12cabc3323ef765
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310970
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-07-05 17:43:55 +00:00
Konstantin Shcheglov 4f62032cf9 Fix a few TODOs in DartObjectPrinter, ElementPrinter.
Change-Id: I76aedfffad60095bdca5c09644c983439868f9bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312343
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-07-05 17:37:08 +00:00
Danny Tuppeny 08353751ea [analysis_server] Handle inlay hints for patterns + improve hints for record types
Fixes https://github.com/Dart-Code/Dart-Code/issues/4624

Change-Id: Ib1887803957c001907ac439fd9f380964f6177e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312460
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-07-05 16:41:49 +00:00
Danny Tuppeny 0daf23ee75 [analysis_server] Handle widget references inside functions when converting to StatelessWidget
Fixes https://github.com/Dart-Code/Dart-Code/issues/4621

Change-Id: I7dda2ff11e56bb227b476b38ba42e3222f2ceb59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312265
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-07-05 16:37:56 +00:00
Konstantin Shcheglov 2b8b3345aa Use XyzElementImpl in 'declaredElement' in AST impls.
Change-Id: Id1e59db0e706859e9e04132b3058e8885f8cb669
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312344
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-07-05 15:11:40 +00:00
Tess Strickland ac2533e705 [pkg/vm] Instantiate the ffi Pointer class to bounds when needed.
Previously, the FFI transformer could produce is checks where the
type to check against was Pointer<dynamic>. However, given that
the Pointer class is defined as:

abstract class Pointer<X extends NativeType> ...

the instantiated to bounds version of its type is Pointer<NativeType>.
Pointer<dynamic> is not a subtype of Pointer<NativeType>, and thus is an
invalid instantiation, but the only place this type could occur was as
the right hand side of an is check.

Before 7cc005ea1, Class::RareType() returned the class instantiated with
the null (all-dynamic) type arguments vector. Among other things, this
"rare" type was compared to the right-hand side of is checks and, if it
matched, performed a simple (cid-only) check of the instance type
arguments in unoptimized code.

Afterwards, Class::RareType() returns the class instantiated with a type
arguments vector where each type parameter is instantiated to bounds, so
now the "rare" type check fails and it falls back to the full check of
the instance type arguments, which causes a ~25% regression in some
unoptimized benchmarks.

This CL fixes the generation of those is checks in the FFI transformer
to use the instantiated to bounds version of the Pointer type instead.

TEST=pkg/front_end/test

Issue: https://github.com/dart-lang/sdk/issues/52843
Issue: https://github.com/dart-lang/sdk/issues/52848
Cq-Include-Trybots: luci.dart.try:vm-ffi-qemu-linux-release-riscv64-try,vm-ffi-qemu-linux-release-arm-try,vm-aot-linux-debug-x64-try,vm-linux-debug-x64-try
Change-Id: Ic9ac6d75ba2743e233065444fad13ab098094349
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312400
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Auto-Submit: Tess Strickland <sstrickl@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2023-07-05 14:24:56 +00:00
Konstantin Shcheglov 6a4ef6c93f Update DartObjectPrinter to TreeStringSink and ElementPrinter.
Change-Id: Ied8b54df21b19f144566546de0c0580ebb2078a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312340
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-07-05 03:04:09 +00:00
Konstantin Shcheglov 03e6d8d758 Test that augmentations are listed in the depth-first pre-order.
Change-Id: I7ade7b101c3c7895c1e8a68ca336ac83fa2b1348
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312341
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-07-05 03:01:40 +00:00
Konstantin Shcheglov 636abe3ab7 Extract TreeStringSink and ElementPrinter, reuse in a few tests.
Change-Id: I78cafbd198af113f11216d7c0322559dc5d20cd5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312320
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-07-04 21:43:23 +00:00
Sam Rawlins e67a2193da Add jsonEncode for use in unreachable_from_main
Bug: https://github.com/dart-lang/linter/issues/4495
Change-Id: I74b0a6cb516d2850bb922005e463f58f58453b4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312280
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-07-04 03:02:47 +00:00
Konstantin Shcheglov 37003ee3be Add InterfaceElementImpl, move many methods into it.
Change-Id: I7f77e318586b2c05874b3a0d25d2d940869b6a0d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312240
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-07-04 01:41:38 +00:00
Konstantin Shcheglov d4de535a3a Use identical() instead of == for elements in RuntimeTypeEqualityVisitor.
See https://github.com/dart-lang/mockito/issues/658#issuecomment-1615269018

Change-Id: I5b9e4b1d82ec935bcd2097ec76cf5a8e28c5e29e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312205
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-07-04 01:33:12 +00:00
Konstantin Shcheglov 44a94e8400 Remove 'Clients may not extend...', because all these classes are final.
Change-Id: If20d22b0407a67f630aa87debada6dab1d803c71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312201
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-07-04 00:17:10 +00:00
Nate Biggs 73160bc40d [dart2js] Temporarily undo valid refines change.
It's still unclear why this is causing an issue but this will unblock b/285636639 until the underlying cause is found and fixed.

Change-Id: I44db6059a13738d5781c0557810ee53556ecb9c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312100
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-06-30 20:40:45 +00:00
Kallen Tu c86af3c39b [analyzer] Refactor visitMethodInvocation in the const evaluator.
Change-Id: I9ae6c17967c98770ed06dead200c8bd87ae7f2a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309829
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-06-30 18:32:27 +00:00
Vyacheslav Egorov a52f2b9617 [vm] Rework awaiter stack unwinding.
The main contribution of this CL is unification of disparate
handling of various functions like `Future.timeout`,
`Future.wait`, `_SuspendState.createAsyncCallbacks` and
`_SuspendState._createAsyncStarCallback` into a single
`@pragma('vm:awaiter-link')` which allows Dart developers
to specify where awaiter unwinder should look for the next
awaiter.

For example this allows unwinding to succeed for the code like this:

    Future<int> outer(Future<int> inner) {
      @pragma('vm:awaiter-link')
      final completer = Completer<int>();

      inner.then((v) => completer.complete(v));

      return completer.future;
   }

This refactoring also ensures that we preserve information
(including Function & Code objects) required for awaiter
unwinding across all modes (JIT, AOT and AOT with DWARF stack
traces). This guarantees users will get the same information
no matter which mode they are running in. Previously
we have been disabling awaiter_stacks tests in some AOT
modes - which led to regressions in the quality of produced
stacks.

This CL also cleans up relationship between debugger and awaiter
stack returned by StackTrace.current - which makes stack trace
displayed by debugger (used for stepping out and determinining
whether exception is caught or not) and `StackTrace.current`
consistent.

Finally we make one user visible change to the stack trace:
awaiter stack will no always include intermediate listeners
created through `Future.then`. Previously we would sometimes
include these listeners at the tail of the stack trace,
which was inconsistent.

Ultimately this means that code like this:

    Future<int> inner() async {
      await null;  // asynchronous gap
      print(StackTrace.current); // (*)
      return 0;
    }

    Future<int> outer() async {
      int process(int v) {
        return v + 1;
      }

      return await inner().then(process);
    }

    void main() async {
      await outer();
    }

Produces stack trace like this:

    inner
    <asynchronous suspension>
    outer.process
    <asynchronous suspension>
    outer
    <asynchronous suspension>
    main
    <asynchronous suspension>

And when stepping out of `inner` execution will stop at `outer.process`
first and the next step out will bring execution to `outer` next.

Fixes https://github.com/dart-lang/sdk/issues/52797
Fixes https://github.com/dart-lang/sdk/issues/52203
Issue https://github.com/dart-lang/sdk/issues/47985

TEST=ci

Bug: b/279929839
CoreLibraryReviewExempt: CL just adds @pragma to facilitate unwinding
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-product-x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-dwarf-linux-product-x64-try
Change-Id: If377d5329d6a11c86effb9369dc603a7ae616fe7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311680
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-06-30 14:03:03 +00:00
Konstantin Shcheglov 8828fee865 Deprecate ExecutableElement.returnType, use returnType2 instead.
Change-Id: Ibd29c3fbec0439236c2cf45c57f820c45427df9f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311932
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-06-29 23:16:59 +00:00
Jake Macdonald 34f25c4a28 Add library introspection apis for macros.
Allows you to ask for the types in a library in the declarations phase, and all
the top level declarations in the definitions phase.

Bug: https://github.com/dart-lang/language/issues/2839
Change-Id: If0f8fb777fd8a006d686d457cf5d5ca11fcca9ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311900
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2023-06-29 22:05:58 +00:00
Kallen Tu 74adf1626e [analyzer] Refactor visitNamedType and other visitors in const evaluator.
Change-Id: Ia3c22fc87c96d719cfa3617c72f5586badfec183
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310972
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-06-29 21:26:14 +00:00
Konstantin Shcheglov fae9e418ea Deprecate Element.enclosingElement, use enclosingElement2 instead.
Change-Id: I78edb6d433949eb8bd86f397fb873a078edf9fc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311827
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-29 19:45:19 +00:00
Danny Tuppeny fc1188d55c [analysis_server] Refactor/rename server to simplify sharing handlers between LSP+Legacy protocols
In order to share LSP handlers between protocols, we need to be able to use a LegacyAnalysisServer in place of an LspAnalysisServer which means having a common interface (which they have via AnalysisServer) and to make the mapping of LSP method names to handlers reusable.

This changes makes the following non-functional changes (to reduce the size of a future change that will begin sharing handlers):

- Rename "clientCapabilities" to "lspClientCapabilities" to avoid conflicts with legacy servers clientCapabilities field when we add this to the base AnalysisServer interface
- Rename "clientConfiguration" to "lspClientConfiguration" for consistency
- Add an "LspMessageHandler" typedef over "MessageHandler" which now has a server type arg so that it can be used with either LspAnalysisServer (by handlers that really need LSP) and AnalysisServer (for handlers that can work in either server)
- Extract handler generators in `InitializedStateMessageHandler` to a static map and make constructors consistent taking only a server (in a future CL the legacy server will want access to some this mapping)

Change-Id: I23554a7ca318fbcd1113dcebff5601186b223618
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311982
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-06-29 19:20:20 +00:00
Ryan Macnak a4f59b8c20 [gardening] Update PatchClass::patched_class_ to wrapped_class_ in pkg/vm_snapshot_analsysis.
Cf. 99db606bab

Change-Id: I653ab3d8d4bb0ccee0bfeed7e8ab5d2c219b6924
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311928
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-06-29 18:34:37 +00:00
Nate Bosch a4331b433a Fix dependency on package:meta
A usage of `@mustBeOverridden` was added in
https://dart-review.googlesource.com/c/sdk/+/309460. The API was added
in version `1.9.0` of `package:meta`.

R=jakemac@google.com

Bug: https://github.com/dart-lang/sdk/issues/52815
Change-Id: I6069b20d2ea6cfae6af4cb0af033ad9a07f48d0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311925
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2023-06-29 17:35:51 +00:00
Danny Tuppeny 70be63ce49 Fix CreateConstructorForFinalFieldsRequiredNamedTest.test_enum on Windows
Checking the offset can be wrong on Windows due to line endings. Other tests in this file are checking the message, so I've done the same here.

I noticed this locally, but I see the Windows bot was also failing on this.

Change-Id: I36de86c3b3eac6f379da894ea9e6fcfcb1a0aa4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311981
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-06-29 15:39:08 +00:00
Konstantin Shcheglov 8a037770f9 Tweaks for element model documentation comments.
As requested in https://dart-review.googlesource.com/c/sdk/+/311725

Change-Id: I76cd2322f9cca9845f3ec767adfd1e5dca9d7c47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311826
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-28 20:28:30 +00:00
Konstantin Shcheglov 6f01da06a2 Put aside invalid mixin constructors, quick fix for MIXIN_DECLARES_CONSTRUCTOR.
Change-Id: If1b808bf7746b4f2c2c856d7fb7e72499023759f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311823
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-28 19:49:08 +00:00
Keerti Parthasarathy aec08eabd9 Convert some more assists/fixes to using ParsedCorrectionProducer
Change-Id: Ie715868183e1b06023b538ec1bc550171cfa2f5f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311825
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2023-06-28 19:46:47 +00:00
Konstantin Shcheglov 1fd7e2b670 Update a few documentation comments to the style guide.
Change-Id: If019e456de041081ed688cfce4c7f5063055ba39
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311821
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-28 17:44:08 +00:00
Konstantin Shcheglov 892a7fbe4e Put aside invalid nodes during parsing, fix for EXTENSION_DECLARES_CONSTRUCTOR.
Change-Id: Ic01f4c1116ecb29087c8d1bff679906522b7562e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311726
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-06-28 15:17:23 +00:00
Konstantin Shcheglov a49dbe539f Extract NamedInstanceElement from InstanceElement, use for ExtensionElement.
Change-Id: Iee49f110afacc3f5c54fb15e70b3f18ac18c67a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311725
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-28 15:16:18 +00:00
Chloe Stefantsova 53c9cf1c46 [cfe] Remove spurious assignment error on late final loop variables
Closes https://github.com/dart-lang/sdk/issues/52704

Change-Id: I2bf7363be6def613fdd9389d5e080514a3f2e455
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311120
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2023-06-28 10:13:28 +00:00
Daco Harkes bd1bad7afc [deps/ffi] Unbundle package:native_assets_builder
The Dart SDK CL for https://github.com/dart-lang/native/pull/69.

Bug: https://github.com/dart-lang/native/issues/67
Change-Id: I45d7ac691a6aaa41bce5be0e36403021a948bb4f
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311740
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2023-06-28 09:09:09 +00:00
Johnni Winther 0c8ded72dc [cfe] Add FileUriConstantExpression
This adds FileUriConstantExpression, a subclass of ConstantExpression, to support correct file offset of annotations for augmentations and patches.
The FileUriExpression is used to carry the file uri of the expression
before constant evaluation.

TEST=general/patch_annotations

Change-Id: I0dc8a0cb97dd530fd1960785d38c2d5e4883c3dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311660
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2023-06-28 07:52:09 +00:00
Johnni Winther cfd4200c85 [cfe] Handle late lowered fields in addUnpromotablePrivateFieldNames
Closes #52452

Change-Id: I39b3045b5e8b95493ea954ffa678b9caede901c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311741
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-06-28 07:34:38 +00:00
Liam Appelbe 13ec07415b [vm] Async FFI callbacks
More details about the design:
https://docs.google.com/document/d/1QDjyY_6wOTOgURwpeYMKU9qEz0gKxx2MUrdruC6Kp6c/edit?usp=sharing

Change-Id: Ie3985d86dca7f5010044ca46c33ca177588c0f69
Bug: #37022
CoreLibraryReviewExempt: Reviewed by vm and api groups. web and wasm groups not affected because FFI isn't on those platforms.
TEST=async_void_function_callbacks_test.dart, ffi_callback_metadata_test.cc, other front end tests
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305900
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-06-28 01:00:18 +00:00
Konstantin Shcheglov d264ceeb05 Add InstanceElement as a super-interface for InterfaceElement and InlineClassElement.
Change-Id: Ie92168509cccb5b145bc5c9adea2945813725038
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311721
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-28 00:56:05 +00:00
Anna Gringauze 789b1d1fcd [frontend_server] Add --canary flag
Closes: https://github.com/dart-lang/sdk/issues/52774
Change-Id: Ie42a803c5b63a41c37984a790ab0406c8939872d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311149
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2023-06-27 22:21:04 +00:00
Nate Bosch db585cef2b Add a note about training run for JIT snapshot
Closes #50615

R=bkonyi@google.com

Change-Id: I488c9f232ab5b0138d25a66006b8f69a05ea9c05
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311144
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2023-06-27 19:26:38 +00:00
Devon Carew 9216f830c6 [deps] rev package:lints to the latest; address lints
Change-Id: I64032a39c589c291297decade18f6a46c08f9c5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310966
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2023-06-27 17:03:37 +00:00