Commit graph

92468 commits

Author SHA1 Message Date
Stephen Adams 5a595124b4 [dart2js] Handle null as a switch statement case value.
Bug: 51527
Change-Id: I6203c9aa668689bb44800082864174b9fb215289
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310500
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-06-22 19:55:22 +00:00
Nate Bosch a282120406 Expand docs for Stream.lastWhere and singleWhere
Closes #30071

Add a template in the `firstWhere` doc for the paragraph about `orElse`
handling. Expand the discussion around error handling in the `lastWhere`
and `singleWhere` docs without relying on reading the `firstWhere` doc
first.

R=lrn@google.com

Change-Id: I302381bb5f4f7daa392ee22bbf667db7d7259ef5
CoreLibraryReviewExempt: Doc changes only.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310761
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2023-06-22 19:07:40 +00:00
Konstantin Shcheglov 5940badbd3 Prepare to publish analyzer 6.0.0 and _fe_analyzer_shared 62.0.0
Change-Id: Ic816540e8b052fdd1fd59f030c334c3bf56e79f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310961
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-22 19:00:56 +00:00
Keerti Parthasarathy a023c3f00e Fix bug with change parameter type when there are no parameters in argument list
Change-Id: I5cabd16091cb66be45f107a3701128776e8129ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310820
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-06-22 18:45:27 +00:00
Srujan Gaddam 6fec16d482 [dart:js_interop] Require top-level externals to have @JS
To refuse confusion between dart:ffi and dart:js_interop,
top-level externals will need to be annotated when using
dart:js_interop.

Change-Id: I1e4887eb32f135df94426e43fc885346f1b9f1b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310485
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-06-22 18:45:21 +00:00
Keerti Parthasarathy ab884b7d7f Refactors to allow for parse only mode for lints and fixes.
- Make CorrectionProducer as base class for {Parsed/Resolved}CorrectionProducer.
- Use ParsedCorrectionProducer for ConvertDocumentationIntoLine
- Move sort imports test to used ParsedUnitResult
- Add getter to LintRule to indicate that rule can be run using just parsed AST


Change-Id: Id11466c445e6e505ea752d097b57143f18c47060
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310484
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2023-06-22 18:20:15 +00:00
Konstantin Shcheglov fe35362602 [CMSR] Support for removing formal parameters.
Change-Id: Id04f6c7854dec3d5059009a0a579110690d3eb62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310963
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-06-22 18:09:23 +00:00
Nate Bosch 915c1ed9bc Change some "function" to "method" in IOSink docs
Closes #31722

R=lrn@google.com

Change-Id: Ice7ed1c1ffcc8468f8e61274fa3c4fa880cc04f6
CoreLibraryReviewExempt: Doc changes only.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310763
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2023-06-22 18:00:13 +00:00
Tess Strickland 2b1c0f5692 [vm] Reorder SubtypeTestCache inputs to improve non-dynamic cases.
In particular, avoid storing/comparing the destination type unless the
SubtypeTestCache was created for a dynamic AssertAssignable instruction.

TEST=vm/cc/STC_{Linear,Hash}Lookup, vm/cc/TTS

Bug: https://github.com/dart-lang/sdk/issues/48345
Change-Id: I279c69a668ce19785785cf71707acf951f2b2133
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-simriscv64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-release-x64-try,vm-aot-linux-product-x64-try,vm-aot-linux-release-simarm64-try,vm-aot-linux-release-simarm_x64-try,vm-aot-linux-debug-x64c-try,vm-aot-tsan-linux-release-x64-try,vm-aot-mac-release-arm64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-aot-dwarf-linux-product-x64-try,vm-linux-release-ia32-try,vm-linux-debug-x64c-try,vm-linux-debug-x64-try,vm-linux-debug-simriscv64-try,vm-linux-release-simarm64-try,vm-linux-release-simarm-try,vm-mac-release-arm64-try,vm-mac-release-x64-try,vm-tsan-linux-release-x64-try,vm-reload-rollback-linux-release-x64-try,vm-reload-linux-release-x64-try,vm-ffi-qemu-linux-release-arm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310340
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2023-06-22 16:47:59 +00:00
Danny Tuppeny 194767e452 [dds/dap] Add 'showGettersInDebugViews' which includes getters but lazily
The existing 'evaluateGettersInDebugViews' evaluates getters eagerly which can have side-effects. This adds a setting that allows showing getters in a way that can be shown lazily instead.

I added a new setting (instead of just making evaluateGettersInDebugViews=false be lazy) to preserve the ability to have getters not shown at all (since some users are using that today and might prefer this over lots of lazy getters showing up).

Fixes https://github.com/Dart-Code/Dart-Code/issues/4234

Change-Id: I56c2a7c8f85aa8c4cc85cfb3120a8cfec6b54c70
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310164
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-06-22 16:42:52 +00:00
Danny Tuppeny c2a4f8e7eb [dds/dap] Ensure breakpoint modifications do not drop resolution events
When adding new breakpoints, DAP clients send a full new set of breakpoints which results in us removing and re-adding all breakpoints (for a file).

When we re-add a breakpoint that already existed, we would sometimes get the BreakpointAdded event _before_ the addBreakpointWithScriptUri request completed. We couldn't process the event because without the original request completing we could not map the VM breakpoint back to the clients breakpoint to generate the event.

This could result in resolution events being lost, and breakpoints becoming unresolved when you modified them (depending on timing).

This change collects queues and replays any BreakpointAdded/BreakpointResolved events that arrived when the breakpoint ID is unknown, and when `addBreakpointWithScriptUri` completes, it immediately processes any items in this queue.

Fixes https://github.com/Dart-Code/Dart-Code/issues/4599

Change-Id: I11daaf99b786ab94f1cc93f9fd38a4f1e241320f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310620
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-06-22 16:36:55 +00:00
Sam Rawlins 7f2e70ec5a Bump dartdoc to 475733910b8429e93fd41272be59ff1531440028
Change-Id: I4a27873707edc9bf5cb734ec590fe87fac0d147b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310960
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-06-22 16:11:58 +00:00
Danny Tuppeny 0a691e3647 [dds/dap] Fix a bug that could result in test failures
This logic was inverted and could result in duplicate terminate requests being sent. Depending on timing, this request might be sent but not responded to (because the DA was already shutting down), causing a "Application terminated with pending terminate request" error.

Change-Id: If89f002792878f8a5ce12341536be70ee01cde11
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310380
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-06-22 15:26:39 +00:00
Sigurd Meldgaard 62324794ca Bump pub to 42819a1e10f803eb7f6296692c5a976e1c647360
Changes:
```
> git log --format="%C(auto) %h %s" 078c7fe..42819a1
 https://dart.googlesource.com/pub.git/+/42819a1e Add missing await (and make downstream async) (3949)
 https://dart.googlesource.com/pub.git/+/c5c34c3e Add (more) trailing commas (3950)
 https://dart.googlesource.com/pub.git/+/a76c7916 Handle non-default hosts in `upgrade --major-versions` (3947)
 https://dart.googlesource.com/pub.git/+/a42800e5 Smallest update in `dependency-services report` (3761)
 https://dart.googlesource.com/pub.git/+/1be821d5 Remove usage of Isolate.packageRoot from tests (3945)
 https://dart.googlesource.com/pub.git/+/a16763a9 Validate that dependency names are valid package names (3940)
 https://dart.googlesource.com/pub.git/+/4a109f30 Expand constraint for `http` (3930)
 https://dart.googlesource.com/pub.git/+/8aee9515 Retry package:http ClientException (3939)
 https://dart.googlesource.com/pub.git/+/d7fa780d Add test for publish --skip-validation (3935)
 https://dart.googlesource.com/pub.git/+/5a3f21b4 Add strict-cast analysis option (3919)
 https://dart.googlesource.com/pub.git/+/fbb6f750 Merge pull request 3934 from sigurdm/cherry_pick_cache_warning
 https://dart.googlesource.com/pub.git/+/0dc18c02 Merge remote-tracking branch 'origin/master' into cherry_pick_cache_warning
 https://dart.googlesource.com/pub.git/+/fe6acca8 Warn about presence of legacy cache (3921)
 https://dart.googlesource.com/pub.git/+/0c2b0bb8 Handle pubspec_overrides.yaml in `add` and `upgrade --major-versions` (3920)
 https://dart.googlesource.com/pub.git/+/3a7dc04e Reinterpret dart sdk constraints when read from a lockfile (3897)

```

Diff: https://dart.googlesource.com/pub.git/+/078c7fea0be2656debc675646806da14fa94f853..42819a1e10f803eb7f6296692c5a976e1c647360/
Change-Id: Ic5a9b1fc1f03f029a36a208e31d919e5e82f0302
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310881
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2023-06-22 14:46:18 +00:00
Konstantin Shcheglov a8a3f3f77e [CMSR] Improve 'get invocation' implementation.
Change-Id: I871eddc1727ea6a51e169f4031d55ba3bc93527d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310860
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-22 14:38:38 +00:00
Sam Rawlins f264102869 Bump linter to 3632a3d83488af2ba8eb60e674b7e3b8de82816b
Change-Id: Ifd4937c81db36073ee2ec7f20b8fdfdc3f557cfe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310766
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-06-22 14:31:57 +00:00
Tess Strickland 0304832202 [vm] Check hash-based caches in the DRT_InstanceOf runtime entry.
We added a hash-based cache check in DRT_TypeCheck until the
SubtypeNTestCache stubs handle hash-based caches to avoid doing
the full runtime check when unnecessary, but did not do so for
DRT_InstanceOf. This fixes that until an upcoming CL that adds
support for hash-based caches in the SubtypeNTestCacheStubs lands.

TEST=Manual inspection of profiles before and after change. Not
adding an automated test as this change is a temporary bandaid
similar to the tested path in DRT_TypeCheck that will be removed soon.

Change-Id: I905a0fc6f501c68d66ae1ee848631c40cad04af2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310882
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2023-06-22 12:21:58 +00:00
Tess Strickland 97a09b90c8 [sdk] Add NativeRuntime.buildId to dart:developer.
TEST=vm/dart/build_id

Issue: https://github.com/dart-lang/sdk/issues/51941
CoreLibraryReviewExempt: Native runtime only API
Change-Id: Ib3757480f0eab6d147385a87adf657f4f709ec4e
Cq-Include-Trybots: luci.dart.try:vm-aot-dwarf-linux-product-x64-try,vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-release-x64-try,vm-aot-mac-product-arm64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-linux-product-x64-try,vm-aot-win-release-x64-try,vm-aot-win-product-x64-try,vm-aot-win-debug-x64c-try,vm-aot-android-release-arm_x64-try,vm-fuchsia-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307122
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2023-06-22 11:11:11 +00:00
Brian Wilkerson 1c3011cbf0 Capture a failing case in code completion
Change-Id: I6a21172628462d0f3b569360849f8417e48cad1c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310321
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-06-22 05:19:58 +00:00
Brian Wilkerson 5c84db453d Initial framework for completion refactoring
This is some prepration for starting the refactoring of the completion
support. The plan is for `InScopeCompletionPass` to implement the first
pass of the proposed algorithm. My intention is to convert one
contributor at a time (as much as possible), starting with the
`KeywordContributor`.

Change-Id: I206c704f5c2370f4c37b674be01ab7fb55afa65e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310200
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-06-22 05:18:07 +00:00
Konstantin Shcheglov dc01c56e94 [CMSR] Test when the agnostic refactoring updates multiple files.
Change-Id: Ia80d9e31db9d7ad17472aff0e5f5595bf43bc9ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310778
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-06-22 05:11:55 +00:00
Srujan Gaddam e985d991b1 [dart:js_interop] Fix JSNumber conversions/semantics and JSBoxedDartObject
- Adds toDartInt and toDartDouble to JSNumber
- Changes semantics of int on external functions from truncate to
assert integer value
- Adds tests for number semantics
- Renames JSExportedDartObject -> JSBoxedDartObject to avoid confusion
with @JSExport
- Adds Object.toJSBox

JSNumber.toDart and Object.toJS will be removed in a future CL once
migrations are complete.

CoreLibraryReviewExempt: Backend-specific library.
Change-Id: I8ff26ee5624c52703e49dd8483f62e829cb6fff0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309081
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-06-22 02:51:13 +00:00
Konstantin Shcheglov 7ecc57ac9e [CMSR] Split into separate files.
Change-Id: I45f1b13a2a025887ee7eb05179934f219097f67c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310776
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-06-22 01:19:08 +00:00
asiva d29341e1ea Ensure HttpClient.setTimelineLogging does not throw an exception in
product mode.

Change-Id: I38097caac847ac5211b1b12f77f342956eaecc6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309823
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2023-06-22 01:16:45 +00:00
Marcin Wojnarowski 330106212a Retain surrounding comments in remove comparison quickfix for if-statement
Closes https://github.com/dart-lang/sdk/pull/52544

GitOrigin-RevId: 267e6378cc9a3f64a1a177ec69279ed1baa61b4a
Change-Id: Idb51e14b46708d8b44bc703a4681deea7ec8b42e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306220
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-06-22 00:26:27 +00:00
Konstantin Shcheglov 6a65dd0efe [CMSR] Check the second file for ConvertFormalParametersToNamed.
Change-Id: I07a477701939cf2f40c8eeb77faf5a2d38290a5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310700
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-06-21 23:03:42 +00:00
Konstantin Shcheglov 1d9846b16f Remove ADD_NOT_NULL_ASSERT
We believe that it is not necessary anymore, with sound null safety.

Change-Id: I18741eafea1bd969139cdae3b94a294dde1b5abd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310769
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-06-21 22:54:12 +00:00
Danny Tuppeny eafa748a4b [dds/dap] Make hot reload test not flaky on Windows
On my Windows PC, this test often fails because the new content is never hot reloaded because the modification is made too soon after the app starts.

This change does what some Flutter tests do, which is to write a future modified stamp to ensure the file is considered updated when the reload is issued.

Change-Id: If52086fb279897d3e572162dc3a32436fbdb27c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310400
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-06-21 22:46:24 +00:00
Konstantin Shcheglov 55e7119183 [CMSR] Add new command to LSP, to convert selected formal parameter(s) to required named.
Change-Id: I7d86ccfe94cc960ea3a8204daf27f339c4ca767f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310764
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-06-21 22:06:44 +00:00
Konstantin Shcheglov 6a4f127831 [CMSR] Not available if external executable element.
Change-Id: Icf209c8cd844918a62195f8a024f0c0b8922f0d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310705
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-21 19:51:58 +00:00
Kallen Tu b8d8da0183 [analyzer] Refactor visitListLiteral to handle Constants.
Add CONST_FOR_LOOP error message to be clearer that for loops are not
allowed in const contexts.

visitListLiteral handles Constants.

Change-Id: I84465ecf4e1f044c256db45c723fac081b50a40c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306917
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-06-21 18:20:51 +00:00
Helin Shiah 02b10e1321 Revert "Send DAP events through DDS"
This reverts commit 5292ee8839.

Reason for revert: Causes failure on `sse_smoke_test` because it needs to set up an event handler.

Original change's description:
> Send DAP events through DDS
>
> Change-Id: Ib40306b8e47d74b02b6cbf348c2b5833cfb31a9d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309080
> Commit-Queue: Helin Shiah <helinx@google.com>
> Reviewed-by: Ben Konyi <bkonyi@google.com>

Change-Id: I62b12de8e2478441d9a7a4177ed1090aa845467f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310740
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Helin Shiah <helinx@google.com>
2023-06-21 18:17:16 +00:00
Konstantin Shcheglov c3f3a00465 [CMSR] More checks for not allowed order of formal parameters.
Change-Id: Ida0380afb141873e75c27460b0804a8457c876e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310703
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-21 18:12:48 +00:00
Vyacheslav Egorov 8e6290bcb0 [vm] Remove unused ObjectStore::completer_class()
TEST=ci

Change-Id: I074c69dd81e3ed7b9b79f537a2162573d19c776f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310721
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2023-06-21 18:09:13 +00:00
Konstantin Shcheglov 67970cc613 Add failing tests for enum and 'if'.
Change-Id: I23187e0699df36c8a24d066a733382fe090e3b44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310701
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-21 17:57:29 +00:00
Brian Wilkerson bf62bc27bc Adjust the definition of coveringNode to favor identifiers
I would like to use `Selection` for code completion, but the current
definition of `coveringNode` too often favors the parent node over the
child node. This will effectively cause the cursor to bind more closely
to an identifier token than to other tokens, making it more useful for
code completion.

If we don't like this change for the general case, I can make these changes in a specialized `coveringNodeForCompletion`, but I'd rather not have two approaches.

Change-Id: I39e70f83ad44d50cec55a8bee1f7061dd83746fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310060
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-06-21 17:55:36 +00:00
Alexander Aprelev 7bdbc0560e [vm/win] Use wide-character api for local hostname on Windows.
Fixes https://github.com/dart-lang/sdk/issues/52701
TEST=test locally

Change-Id: Ia38b67cadea3d15824b06d0a2fc69f0c20192bb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310481
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-06-21 16:57:49 +00:00
Nate Bosch e4b7d100a1 Bump stream_channel to 34804a13bfa3112faecddfcd6a5a4f2b6e184aa4
Changes:
```
> git log --format="%C(auto) %h %s" b1d3384..34804a1
 https://dart.googlesource.com/stream_channel.git/+/34804a1 Fix a race condition in IsolateChannel.connectReceive() (92)

```

Diff: https://dart.googlesource.com/stream_channel.git/+/b1d3384638064a4f25beacef3be770e2c4534408..34804a13bfa3112faecddfcd6a5a4f2b6e184aa4/
Change-Id: Ia891fff9b22e68e829587e1993bb488b52ce5764
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310483
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Moritz Sümmermann <mosum@google.com>
2023-06-21 16:12:58 +00:00
Helin Shiah 5292ee8839 Send DAP events through DDS
Change-Id: Ib40306b8e47d74b02b6cbf348c2b5833cfb31a9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309080
Commit-Queue: Helin Shiah <helinx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-06-21 15:51:24 +00:00
Tess Strickland dfc1b6b16b [vm] Store the number of used inputs in SubtypeTestCaches.
Previously, SlowTypeTestStub would use the incoming instance and
destination type to determine which `SubtypeNTestCacheStub` to call,
where `N` is the number of inputs checked for each entry. The code
for generating `InstanceOf` instructions performs similar work,
inlining some checks and then falling back to checking and updating
an appropriate `SubtypeNTestCacheStub` if the inlined checks fail.

Meanwhile, the runtime would use all available information to
create a new entry when needed, depending on the `SubtypeNTestCacheStub`
called at runtime to ignore the parts of the entry it didn't need.

To illustrate a situation where the runtime might use more
information to create an entry than needed by the stub, consider
the following class header:

```
  class C<T> extends D
```

If no subtype of `D` requires knowing the specific type arguments for
an instance to determine whether that instance is an instance of `D`,
then the compiler can generate a `Subtype1TestCacheStub` call, where
only the class id of the instance is checked.

However, in the runtime, when updating the cache, the runtime will
create an entry that includes the specific type arguments used to
instantiate `C` when the initial cache miss occurred, as the runtime
does not know how many inputs the code that checks that SubtypeTestCache
uses. If the cache has grown to the point that it is hash-based, that
means the runtime uses the instance type arguments of the first cache
miss to determine the correct place to create a new entry.

When the stub only performs a linear search over the cache contents,
this works, as every entry is checked until a matching entry is found,
and thus the stub can ignore unneeded information. However, if a cache
is hash-based, this doesn't work: if the first miss was an instance
of `C<int>`, then the runtime includes all that information in a new
entry. This means the stub has to calculate the instance type
arguments, which it did not have to do before, and if a subsequent
check uses different instance type arguments (e.g., an instance of
`C<String>`), the result may still be a cache miss, and the runtime
adds another entry which has the same information as the previous
entry as far as the stub was originally concerned.

Thus, to limit itself to considering only the inputs used by the
appropriate `SubtypeNTestCacheStub`, the runtime needs to be told how
many inputs are used. This CL adds an additional field to
`SubtypeTestCache`s which contains the number of used inputs, and
changes the places where `SubtypeTestCache`s are allocated in the
flow graph compiler and the `DRT_TypeCheck` runtime entry to pass the
appropriate number of inputs. To ensure that the runtime and stubs
agree on how many inputs should be used, the `SlowTypeTestStub` now
uses the value of this field to determine which `SubtypeNTestCacheStub`
to call.

TEST=vm/cc/STC_{Linear,Hash}Lookup

Bug: https://github.com/dart-lang/sdk/issues/48345
Change-Id: Ie16f2d12c4c5eae856b668f28178818203662d1c
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-simriscv64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-release-x64-try,vm-aot-linux-product-x64-try,vm-aot-linux-release-simarm64-try,vm-aot-linux-release-simarm_x64-try,vm-aot-linux-debug-x64c-try,vm-aot-mac-release-arm64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-aot-dwarf-linux-product-x64-try,vm-linux-release-ia32-try,vm-linux-debug-x64c-try,vm-linux-debug-x64-try,vm-linux-debug-simriscv64-try,vm-linux-release-simarm64-try,vm-linux-release-simarm-try,vm-mac-release-arm64-try,vm-mac-release-x64-try,vm-tsan-linux-release-x64-try,vm-reload-rollback-linux-release-x64-try,vm-reload-linux-release-x64-try,vm-ffi-qemu-linux-release-arm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310180
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2023-06-21 15:24:30 +00:00
Tess Strickland 24ad7f9000 [vm/tests] Skip vm/cc/TypeArguments_Cache_ManyInstantiations on qemu.
This is just a larger version of another test
vm/cc/TypeArguments_Cache_SomeInstantiations, which does run on
qemu and tests the same paths, so it's okay to skip.

TEST=vm-linux-release-riscv64-qemu

Change-Id: Ie39665c818cc95c934582383b5e57d77f539f46d
Cq-Include-Trybots: luci.dart.try:vm-ffi-qemu-linux-release-riscv64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310680
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Tess Strickland <sstrickl@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-06-21 14:43:25 +00:00
Paul Berry 2ca7380ab0 Flow analysis: fix first phase handling of pattern assignments.
Prior to this change, the first phase of flow analysis, in which flow
analysis "looks ahead" to see which variables are potentially assigned
in each code block, was failing to properly account for variables that
are assigned by pattern assignment expressions. This "look ahead"
information is used by flow analysis to determine the effects of
nonlinear control flow (e.g. to figure out which variables to demote
at the top of a loop, or to figure out which variables are potentially
assigned inside a closure). As a result, it was possible to construct
correct code that would be rejected by the analyzer and compiler, as
well as incorrect code that would (unsoundly) be accepted.

The fix is to call `AssignedVariables.write` from the analyzer's
`FlowAnalysisVisitor`, and from the CFE's `BodyBuilder`, to let flow
analysis know about variable assignments that occur inside pattern
assignment expressions.

Fixes #52745.

Change-Id: I0e6f426a5c5c36f214d5a206aaf5a2de0bfdaac1
Bug: https://github.com/dart-lang/sdk/issues/52745
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310502
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-21 14:33:42 +00:00
Kallen Tu 3deaeb84dd [analyzer] Refactor visitFunctionReference for the const evaluator.
Simple functions can be printed in dart_object_printer.dart.
Moving function reference tests around so they can be easily found together.


Change-Id: If022721f7dca4881d51cbebd65ed968cd89c33c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308261
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-06-21 14:29:48 +00:00
Aske Simon Christensen 5838562040 [dart2wasm] Add option and target for stringref.
This adds basic infrastructure for a stringref implementation in
dart2wasm:

- A `--[no-]stringref` option to the compiler
- An option in the `WasmTarget`, controlling the name of the target
- Separate sets of patch files for the two targets
- Separate platform dill files for the two targets

For now, the patch file contents are the same, and the compiler flag
is not used by the backend (only by the `dart2wasm` script to select
the appropriate platform dill file). Both of these will change as the
implementation progresses.

Tested: ci + manual check that the option selects the correct dill
Change-Id: I2c9bb95ba06fd3de3f7007703ef545e3f0c728ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310621
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2023-06-21 14:25:38 +00:00
Aske Simon Christensen 21d45c0268 [dart2wasm] Put string_patch into its own patch
Change-Id: Iae4c98406eb08fdf39929448bba53879f1fae61e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310580
Reviewed-by: Ömer Ağacan <omersa@google.com>
2023-06-21 14:25:38 +00:00
Vyacheslav Egorov 8f6eaeb883 [infra] Pass TEST_COMPILATION_DIR to Android tests
The whole directory is already copied to the device. This makes
it consistent with tests running on the host and allows us to
access various artefacts (e.g. SO files containing DWARF
information).

Change-Id: I9fe20fdbb48ad5a3742286a84c87f87f580f2c09
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310600
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-06-21 14:17:34 +00:00
Ömer Sinan Ağacan 2f27fc5ddf [dart2wasm] Update dart2wasm script
When DART_CONFIGURATION is not provided, search in output directory for
a configuration. Code copied from the `dart` script.

Currently the script only works without DART_CONFIGURATION on X64
systems, which is inconvenient when working on macOS or others.

Change-Id: I48c3e32f8824913932aee63e220e5152931b54db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310540
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-06-21 14:15:25 +00:00
Tess Strickland 9a6c33571f [vm] Set page_size_ to 0 after deleting the compressed heap.
When DEBUG is defined, deleting the compressed heap uses the
page size to check alignments.

TEST=*-debug-{x64c,arm64c} builds

Change-Id: Idc0c3fd213d1639234ae52a19466843464790e64
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-x64c-try,vm-aot-win-debug-x64c-try,vm-linux-debug-x64c-try,vm-win-debug-x64c-try,vm-ffi-android-debug-arm64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310581
Reviewed-by: Martin Kustermann <kustermann@google.com>
Auto-Submit: Tess Strickland <sstrickl@google.com>
2023-06-21 11:39:50 +00:00
Stephen Adams b64fc318e7 [dart2js] Update JavaScript global names list
The following would fail unminified because the variable shadowed the
global JavaScript constructor. The fix is to add more global names to
the avoid-list. This is not a problem for js-interop since those are
accessed via `self` or `globalThis`.

```
import 'dart:typed_data';

foo(int Float32Array) => Float32List(Float32Array);

main() => print((foo)(10));
```

Change-Id: I887ece4a888fdab5df437822f9f1f34b384ec24f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310482
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
2023-06-21 01:49:57 +00:00
Robert Nystrom ce9e38fff1 Update package:dart_internal to work with SDK 3.2.0.
Fixes #52742.

Change-Id: I11cebf22f48788632e45cacc1e43c3be069a03dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310323
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
2023-06-21 01:14:38 +00:00