Commit graph

99822 commits

Author SHA1 Message Date
Sergey G. Grekhov 3b52517bca [test] Add support of dart2wasm.status in co19 tests
Fixes: #54971

Change-Id: I033c8ba78e6cdcf26dce9cae8998308a595a37e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353262
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2024-02-21 14:03:23 +00:00
Johnni Winther d7c868f6a7 [DEPS] Update checked-in SDK
This update the checked-in SDK to a version that includes
fe52b9bfe5
which adds support for `dart:_macros` and `package:macros`.
This is needed in order to move shared macro code from to
pkg/_fe_analyzer_shared/ (a temporary location) to `dart:_macros` and
used from the CFE and analyzer through `package:macros`.

Change-Id: Icba4e19ff654b8a664269c12ac555912eccf42bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353401
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2024-02-21 13:29:20 +00:00
Paul Berry fa38f392fa Fix context for null-aware extension method invocations to match analyzer.
This looks like it was an oversight--previous to this change, there
was zero test coverage for this case.

Change-Id: Icba1381c389af37ab4fe38f345cc78fe6c01d7f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353226
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2024-02-21 13:13:07 +00:00
Lasse R.H. Nielsen e86b08e5bb Forwards ignore bit to chained-to _Future.
If a target `_Future` is chained to another source `_Future`,
then it's because the target will complete with the same
result as the source future. Instead of keeping both
alive with a listener on the source which completes the target,
instead the target moves all its listeners to be directly on
the source, and keeps a link to the source in case more listeners
are added later.
The idea is that most futures are unreferenced after they have
had their first listener, so the target future has a chance
to be GC'ed.

If the target future has `.ignore()` called, and has no listener,
then the source completing with an error should not cause the
error to be uncaught. Without the optimization, the source would
have had a listener, and the target would ignore the error.

To simulate that, the source now gets a copy of the target's
`_ignoreUnhandledErrors` flag.

This is still not precisely the same as it would be without the
optimization. If *two* target futures are chained to the same source,
and only one of targes has `.ignore()` called, then this
implementation will make the uncaught error not be reported,
where it technically should.

(An alternative would be to *not* use chaining for futures
with `ignore()` called on them. But those are precisely futures
that are likely to be GC'able, because someone has already said
that they don't care if the future complete with errors.)

Fixes #54943

Bug: https://github.com/dart-lang/sdk/issues/54943
Change-Id: I0dbb4919ce2ea612d66539862fa0eb188aab8287
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352908
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2024-02-21 13:05:56 +00:00
Jens Johansen 8a6b48f596 [CFE] First pass at coverage tool
* Added tests for compiling the platform with coverage information
* Patched all CFE suites to be able to capture coverage information
  (e.g. via
  `out/ReleaseX64/dart pkg/front_end/test/fasta/strong_suite.dart \
  --coverage=coverage/` and then merging and showing via
  `out/ReleaseX64/dart pkg/front_end/tool/coverage_merger.dart \
  --coverage=coverage/`)
* Added "meta test" that runs all of the cfe et al tests and captures
  coverage information at the end.
* Patched the bulk compiler to be able to capture coverage information
  (likely only works in non-Windows as it has to hook into signaling to
  be able to capture data as the process is being killed by the test.py
  script).
* Tool for combining the dumped coverage information.
* Meta test that executes everything and combines the result
  (run via e.g. `out/ReleaseX64/dart-sdk/bin/dart \
  pkg/front_end/test/run_all_coverage.dart`)

Initially I wanted to (for language tests) have per-test coverage,
changed the test.py scripts to run the tests through a special tool that
then captured coverage information for the kernel_service isolate which
worked well for tests that compiles without error, but doesn't work when
there are compile time errors (because dart terminates before coverage
can be captured). So the solution - at least for now - was to hook into
the batch compilation.

The "visualization" of the result currently isn't very good -- mostly
just a list of not covered positions -- but the hope is that everything
that should be covered (eventually) will be covered, so maybe it's not a
big deal.

Also still to do is being able to - probably via comments in the covered
code - say "this isn't expected to be covered", so we can work towards
expecting all (or certain) files to be 100% covered (modulo those
comments), e.g. when running the thing on the weekly bot.

Change-Id: I6f885f4a9c04fb52a65797a9de790e1e5eacecf1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353103
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2024-02-21 12:40:01 +00:00
Jake Macdonald 123e680534 update public macro apis in dart:_macros
Change-Id: Ic27669dee0bbaa96a362e5ecc5fecdd9bb86b693
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353321
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2024-02-21 12:06:09 +00:00
Chloe Stefantsova 91c54ff06a [analyzer,cfe] Share classes representing type constraints
Part of https://github.com/dart-lang/sdk/issues/54902

Change-Id: Ic441a582bcc43fb5d909ca70f101160512f11afe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352222
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2024-02-21 12:03:14 +00:00
Chloe Stefantsova 1f299666e9 [cfe] Use argument original order for downcasts from dynamic
Closes https://github.com/dart-lang/sdk/issues/54935

Change-Id: Id9e579ba015d19a5fab709e60dfbae77b0980dd5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353402
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2024-02-21 11:27:23 +00:00
David Morgan cccde729eb [test_runner] Fix static_error_test on Windows.
The path separator in the expect makes it fail; shorten the path, there
is no need for a separator in the test case.

R=whesse@google.com

Change-Id: Ief6078828daa18e1bf552e62ea0d3d4dee70ec84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353400
Reviewed-by: Jonas Termansen <sortie@google.com>
Auto-Submit: Morgan :) <davidmorgan@google.com>
Commit-Queue: Jonas Termansen <sortie@google.com>
2024-02-21 09:46:42 +00:00
Johnni Winther 460e003cac [cfe] Use generateKernelInternal in fasta compile
Change-Id: I578406cd8878778f15f77c33e0d17784f62ea841
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353180
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2024-02-21 09:14:39 +00:00
Sam Rawlins 967d13fb95 frontend: prepare for curly_braces lint change
This aligns this code better with Effective Dart and prepares for the
upcoming lint rule change at https://dart-review.googlesource.com/c/sdk/+/353140.

Change-Id: I4a419c50b851680150d4f17941bc0f94a98cb148
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353221
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
2024-02-21 07:28:59 +00:00
Keerti Parthasarathy 249895f979 Add type hierarchy tests for augmentations for LSP protocol.
Change-Id: Ie6358f4908e988b89afea44b663d03c042346e1c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353204
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-02-21 01:04:03 +00:00
Mayank Patke 69df740ea9 [dart2js] Assorted TODO cleanup, bump pubspecs to 3.3.0
Change-Id: I621ac252c5d6f3b157a2f194b7f0b7ad85874e4c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352990
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2024-02-21 00:02:13 +00:00
Srujan Gaddam e9678f72de [dart2js] Handle object literal constructors with no library @JS annotation
Fixes https://github.com/dart-lang/sdk/issues/54801

Object literal constructors need to be explicitly handled when
determining a member is JS interop or not in dart2js as it does
not require any @JS annotations.

Change-Id: Iee99375439057844485aa3f5cd88f85f5d03ae06
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349840
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2024-02-20 23:59:24 +00:00
Vyacheslav Egorov 9fe6571a75 [vm/compiler] Let Parameter carry its location
Previously we would specify parameter offset and base register and
use SpecialParameter instruction to represent values passed in
registers.

This CL simplifies and merges these concepts: now every Parameter
instruction simply carries around its Location.

This CL also tweaks printing of stack slot locations so that they
are easier to read: `S+1` becomes `fp[1]` or `sp[1]` depending on the
base register, DS+1 becomes `dword fp[1]` / `dword sp[1]` and `QS+1`
expands to `qword fp[1]`/`qword sp[1]`.

Additionally we clean `BlockBuilder` API a bit - instead of
passing `with_frame` to `AddParameter` we make this the
property of the builder itself, set at construction time.

Issue https://github.com/dart-lang/sdk/issues/54955
Closes https://github.com/dart-lang/sdk/issues/31956

TEST=ci

Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-release-arm64-try,vm-aot-linux-release-simarm_x64-try,vm-ffi-qemu-linux-release-arm-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-linux-product-x64-try,vm-aot-mac-release-x64-try
Change-Id: Ie24dc6b6c47b3a45db722813218bc53c3a06c91d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353081
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-02-20 23:54:08 +00:00
asiva ac39be3eed [VM/Service] Define vmservice entry points only under non product mode
TEST=ci

Change-Id: I2d72d4c786e3725434c552a317da6b50a08646c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353228
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-02-20 22:48:47 +00:00
Mayank Patke 0d9d7f4e75 Clean up TODOs in TryConstantEvaluator.
Issue: #48820
Change-Id: I01a9c7b1de3697afc2d643a5a1c7aaa26532ea70
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352974
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2024-02-20 21:46:43 +00:00
Mayank Patke 2fc877a09a [dart2js] Use new method encoding in runtime type analysis.
Change-Id: I41e6b6314266203e37badcb084becd95894bdf6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352966
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2024-02-20 21:42:19 +00:00
pq 3f5a96bbf4 don't overreport prefer_void_to_null in augmentations
See: https://github.com/dart-lang/linter/issues/4890

Change-Id: Ie2f3364e781c5b62cbea252460b28ba48482a552
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353203
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-02-20 21:01:50 +00:00
Mayank Patke b0a96bf950 [dart2js] Clean up handling of missing super methods.
Issue: #47406
Issue: #48820
Change-Id: I19de399c4670f9866cffceae3bc3ce19201d1ed3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352963
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2024-02-20 21:01:14 +00:00
Devon Carew 3722837cec Bump http to 6d9f9efe04886d9685fbfb1a76ba24a71b6c951c
Changes:
```
> git log --format="%C(auto) %h %s" f0a02f9..6d9f9ef
 https://dart.googlesource.com/http.git/+/6d9f9ef blast repo changes: auto-publish, github-actions, no-response (1133)
 https://dart.googlesource.com/http.git/+/d8b237d [http] Migrate to the latest pkg:web, require Dart 3.3 (1132)
 https://dart.googlesource.com/http.git/+/5179d1c Bump actions/cache from 3.3.2 to 4.0.0 (1125)
 https://dart.googlesource.com/http.git/+/0b803e8 Bump dart-lang/setup-dart from 1.6.0 to 1.6.2 (1124)
 https://dart.googlesource.com/http.git/+/82e0424 Use preferred flutter version constraints (1119)
 https://dart.googlesource.com/http.git/+/ccefa7c Support `BaseResponseWithUrl` in `package:cupertino_http` and `package:cronet_http` (1110)
 https://dart.googlesource.com/http.git/+/e7a8e25 Add `BaseResponseWithUrl.url` (1109)
 https://dart.googlesource.com/http.git/+/c8f17a6 Add a contributing guide (1115)
 https://dart.googlesource.com/http.git/+/ebd86b9 Add the ability to get response headers as a `Map<String, List<String>>` (1114)
 https://dart.googlesource.com/http.git/+/5c75da6 Add tests for sending "cookie" and receiving "set-cookie" headers (1113)
 https://dart.googlesource.com/http.git/+/c2a6d64 [cronet_http] ⬇️ Downgrade `minSdkVersion` to 21 (1104)
 https://dart.googlesource.com/http.git/+/661f5d6 Use `package:http_image_provider` in all `Client` implementation examples (1089)
 https://dart.googlesource.com/http.git/+/473a892 Remove the "play-services-cronet" dependency in the example app when building `package:cronet_http_embedded` (1103)
 https://dart.googlesource.com/http.git/+/e79ebe1 Fix `labeler.yml` (1099)
 https://dart.googlesource.com/http.git/+/73b0b1c Bump actions/labeler from 4.3.0 to 5.0.0 (1096)
 https://dart.googlesource.com/http.git/+/15ec3ba Prepare to publish `package:cronet_http` as 1.0.0 (1087)
 https://dart.googlesource.com/http.git/+/26e55c3 cronet_http: require android API level 28 (1088)
 https://dart.googlesource.com/http.git/+/b10f448 [cronet_http] Enables CI for `cronet_http_embedded` (1070)
 https://dart.googlesource.com/http.git/+/a5b8eec Prepare to publish cupertino 1.2.0 (1080)
 https://dart.googlesource.com/http.git/+/c114aa0 Add a fake response for PNG images (1081)
 https://dart.googlesource.com/http.git/+/db2cb76 Run web tests with wasm with dev Dart sdk (1078)
 https://dart.googlesource.com/http.git/+/36f98e9 Fix a bug where BrowserClient was listed as requiring Flutter (1077)
 https://dart.googlesource.com/http.git/+/db7f165 Provide an example of configuring IOClient with an HttpClient. (1074)
 https://dart.googlesource.com/http.git/+/cd748b6 Document that runWithClient must be called for every isolate (1069)
 https://dart.googlesource.com/http.git/+/f585947 Test persistentConnection with large request bodies (984)
 https://dart.googlesource.com/http.git/+/7c05dde Add documentation for "no_default_http_client" (1068)
 https://dart.googlesource.com/http.git/+/d8983fa Add support for setting headers for all requests (1060)
 https://dart.googlesource.com/http.git/+/c90496e Document how to use replacement `Client` implementations (1063)
 https://dart.googlesource.com/http.git/+/c8536e4 [http_client_conformance_tests] Updates to support wasm compilation (1064)
 https://dart.googlesource.com/http.git/+/5dd5140 Bump actions/setup-java from 3 to 4 (1065)
 https://dart.googlesource.com/http.git/+/064f510 misc cleanup of yaml files (1061)
 https://dart.googlesource.com/http.git/+/22f52e2 Update pubspec.yaml to 0.4.2 (1059)
 https://dart.googlesource.com/http.git/+/40a46d8 Fix a bug where cronet_http sends incorrect HTTP request methods (1058)
 https://dart.googlesource.com/http.git/+/c125ed5 [http] Allow pkg:web v0.3.0 (1055)
 https://dart.googlesource.com/http.git/+/9fb4cfa Update lints to latest, etc (1048)
 https://dart.googlesource.com/http.git/+/5e84d9f Update platform-specific imports for wasm (1051)
 https://dart.googlesource.com/http.git/+/8c9feb5 [http] Fix type cast for dart2wasm (1050)
 https://dart.googlesource.com/http.git/+/a2f0b25 [http] use pkg:web, require Dart 3.2 (1049)

```

Diff: https://dart.googlesource.com/http.git/+/f0a02f98f7c921e86ecc81c70f38bb6fbccc81b9..6d9f9efe04886d9685fbfb1a76ba24a71b6c951c/
Change-Id: Ic67698b3c808f4fc550cd3c59dc8efdf508384df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353202
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
2024-02-20 20:53:18 +00:00
Paul Berry 32ab547688 Fix analyzer handling of record literal type inference.
This CL contains several small bug fixes:

- The context is only used for type inference if it is a record type
  with the same shape as the record literal. Previously, if the
  context was a record type with a different shape than the record
  literal, the analyzer would attempt to do an approximate match
  (using the context from any matching named fields, and from all the
  positional fields that were in common between the context and the
  literal). At first glance, it might seem like this would only matter
  for erroneous code (since record shape mismatches typically lead to
  compile-time errors). But if the context arises from a local
  variable promotion, then a mismatch doesn't lead to a compile-time
  error; it simply leads to a demotion. So the difference is
  observable for non-erroneous code.

- If one of the fields is implicitly downcast from `dynamic`, the
  static type of the field's expression remains `dynamic`. This makes
  the behavior of dynamic downcasts inside field literals consistent
  with all other implicit dynamic downcasts.

- If one of the fields is implicitly downcast from `dynamic`, the
  downcast is made to the greatest closure of the context. Previously,
  the downcast was made to the context itself, which meant that it was
  possible to create static types containing the unknown type,
  violating one of the key assumptions of the Dart type system.

- If one of the fields has a static type of `dynamic`, and `dynamic`
  is a subtype of the greatest closure of the context (e.g. because
  the context is `Object?`), no dynamic downcast is
  performed. Previously, a dynamic downcast _was_ performed, meaning
  that the static type of the resulting record literal would have
  `dynamic` in a spot where `Object?` should be.

This brings the analyzer behavior into line with the spec and the
front end, with one minor exception:

- When the front end uses the greatest closure of the context to
  implicitly downcast a field from dynamic, it uses a modified
  greatest closure algorithm where covariant instances of `_` are
  replaced with `dynamic` instead of `Object?`.

The front end's behavior in this rare case doesn't agree with the
spec; I'll address this in a future CL.

Change-Id: Ib1ab7ee4d0f63a152480704e2c0d5332446a613c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350983
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2024-02-20 20:21:48 +00:00
Ryan Macnak cfe4462b28 [vm] Add some warnings to Dart_RecordTimelineEvent.
TEST=no
Change-Id: I448901c2767c48e931dc492e000d2f01e5194ed8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353225
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2024-02-20 20:18:09 +00:00
Dan Chevalier 952e3b718f Add --unrestricted to DTD command.
NOTE: the tests view better if you turn off whitespaces on the diff.

This command will start a DTD instance that has the FileSystem service restrictions disabled. Which can be used in development environments.

Bug: https://github.com/dart-lang/sdk/issues/54762
Change-Id: I829f83d7c7afc7dd83732fc8a600cb41ffe36f63
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352921
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
Commit-Queue: Dan Chevalier <danchevalier@google.com>
2024-02-20 20:08:57 +00:00
Danny Tuppeny 30b9238561 [dds/dap] Increase number of toStrings() per evaluation from 11 to 100
This was an apparently error when moving to the SDK DAPs. The original DAPs performed 100 toStrings() (and 100 is the batch size for VS Code, so the user wouldn't usually see the limit) but we'd done 10 (actually 11) here.

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

Change-Id: Ie3ca74c9189a725adb971646db2defaf1ffa9627
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353104
Reviewed-by: Helin Shiah <helinx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2024-02-20 19:24:12 +00:00
asiva 6ee5474a62 [dartdev/tests] Fix racy tests.
Fix vm service tests which are racy as dds is spawned as an external
process and the testee process might have exited before dds
connects to it.

Change-Id: I514e20c84c6041cb1b65854494698911a34eb50e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352464
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-02-20 19:14:44 +00:00
Sam Rawlins 6ff4673225 build_integration: prepare for stricter implementation_imports check
As an oversight, this lint rule doesn't currently check non-lib directories. It
will in https://dart-review.googlesource.com/c/sdk/+/351160.

Change-Id: I6881a2224a2f3689e84bba36b331184fef497239
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353223
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
2024-02-20 18:47:41 +00:00
Derek Xu 391c0fb6c0 [VM] Remove deprecated Dart_TimelineEvent embedder API
TEST=CI

Change-Id: I094c32ec44a886a8154692de22b6575661918d29
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353240
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2024-02-20 18:18:30 +00:00
Paul Berry 8047862840 Change a HACK to a TODO
The analyzer team has decided to adopt the convention of using `TODO`
comments to document long term issues that should persist in the
codebase, and `FIXME` comments to document short term issues that need
immediate attention (see
https://dart-review.googlesource.com/c/sdk/+/295662).  They may even
consider adding a presubmit hook to ensure that `FIXME` comments are
only used during local development.

We didn't consider `HACK` comments at the time, but IMHO it makes
sense to treat them the same as `FIXME` comments; that is, as a rule
we don't include them in checked in code.

This change restores the analysis server to a state of having a clean
"problems" view when edited using Visual Studio code.

Change-Id: Icd6079cb1eb47e02d9084332d0bad0e3afa04177
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353200
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2024-02-20 18:15:11 +00:00
Sam Rawlins 35075c1c22 modular_test: prepare for curly_braces lint change
This aligns this code better with Effective Dart and prepares for the
upcoming lint rule change at https://dart-review.googlesource.com/c/sdk/+/353140.

Change-Id: Ibfb4736ae01a6e2d843f9faf19eba08c16ff6c92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353222
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
2024-02-20 17:56:29 +00:00
pq 22520f43f9 mixin support for camel_case_types
Fixes: https://github.com/dart-lang/linter/issues/2532

Change-Id: Icbc5c9ae4bd8b50c1a4471424bd9ae3d95299257
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352976
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-02-20 16:59:03 +00:00
pq c55a99c855 non_constant_identifier_names support for augmentations
See: https://github.com/dart-lang/linter/issues/4883

Change-Id: Ia83e8a6e8e726bc3ef83ccbc5c0106f9698e4d4c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352978
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-02-20 16:57:54 +00:00
osaxma a3cb1f6bdc Fix issue where invalid analysis options file is produced for some tests
R=brianwilkerson@google.com

fixes: https://github.com/dart-lang/sdk/issues/54921
Change-Id: Ib1d7fa2400ea587ff66568efdaec67559cad1e6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352866
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Osama Alraddadi <osama.alraddadi@gmail.com>
2024-02-20 16:51:00 +00:00
Erik Ernst bf17088787 Add test about types being incompatible with await
PR https://github.com/dart-lang/language/pull/3560 and
https://github.com/dart-lang/language/pull/3598 updated the feature
specification of extension types to define a notion of types being
'incompatible with await'. This CL adds a test to verify that various
types are being classified correctly, and errors are hence reported
as expected for expressions of the form `await e`.

Change-Id: I39e992b4317ef49fbc2267819481d71d87b56aca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351143
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2024-02-20 16:49:49 +00:00
Sam Rawlins e61f2a0d89 dart2wasm: prepare for curly_braces lint change
This aligns this code better with Effective Dart and prepares for the
upcoming lint rule change at https://dart-review.googlesource.com/c/sdk/+/353140.

Change-Id: I96e77d5c49c17fe0dfcbef7e997cb9d634f1e648
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353201
Reviewed-by: Ömer Ağacan <omersa@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2024-02-20 16:35:28 +00:00
Sam Rawlins cda9755918 dev_compiler: prepare for curly_braces lint change
This aligns this code better with Effective Dart and prepares for the
upcoming lint rule change at https://dart-review.googlesource.com/c/sdk/+/353140.

Change-Id: I1b3ff4a4f85ec2182d06a67acf0e43fbc45129f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353220
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2024-02-20 16:04:30 +00:00
David Morgan 93b7791c0c [macros] Fix flakiness on Windows related to add during flush and timeouts.
R=jakemac@google.com

Change-Id: I48f5829613ca2999caf23a485648054b920596a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352907
Reviewed-by: Jake Macdonald <jakemac@google.com>
Auto-Submit: Morgan :) <davidmorgan@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2024-02-20 15:47:10 +00:00
Brian Wilkerson e1f1151870 Suggest pattern variables declared in a for loop
Fixes: https://github.com/dart-lang/sdk/issues/52851
Change-Id: Ie44af3d9a336ba6daa26b52abcf29bada88bf660
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352998
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-02-20 15:44:22 +00:00
Martin Kustermann c4fbfc9271 [vm] Make iso-stress builder use valid -Dtest_configuration when compiling the giant stress test
Some tests that are run as part of the giant iso-stress test are relying
on `package:expect/config.config` getters, which in return rely on the
test configuration being set as part of the compilation from the app

=> We pass valid JIT & AOT configurations when compiling the giant iso
   stress test files.

TEST=May fix the iso-stress failures.

Change-Id: Icacbfe941eb01030c010670f35848a76c9a8ee12
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353102
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2024-02-20 09:39:00 +00:00
David Morgan 980cf725ff [test] Check all local files for error strings.
Based on abandoned change #264261.

Changes to that PR: compare and show file paths, improve part parsing, include analyzer expectations from other files as well as CFE expectations, update unit tests.

Add end to end tests. The simplest case "library_failure_test.dart" passes before this PR, all others require the change in this PR to pick up expectations in other files.
Change-Id: Ia71b78a8f0dced83f603309877132f261b47c5a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345541
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Morgan :) <davidmorgan@google.com>
2024-02-20 09:31:21 +00:00
Alexander Markov c1f5305f49 [vm/compiler] Eliminate unused allocations
Unused object, closure, context and record allocations can be always
eliminated, even when allocation sinking is disabled due to a
'try' block.

TearOff.Inlined.InTry benchmark +534-1481%

TEST=runtime/tests/vm/dart/eliminate_allocations_il_test.dart
Issue: https://github.com/dart-lang/sdk/issues/54808
Change-Id: I5a4094b391079fd0d63af48bec4594179806fdf5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350341
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
2024-02-20 09:30:56 +00:00
Chloe Stefantsova aa043e90a4 Revert "[analyzer][cfe] Expand TypeAnalyzerOperations. Part 1"
This reverts commit a8cf0a0825.

Reason for revert: The CL broke a few places in google3.

Original change's description:
> [analyzer][cfe] Expand TypeAnalyzerOperations. Part 1
>
> This CL adds more of the type operations required in the subtype
> constraint gathering algorithm into the shared type operation
> class. The added operations are used in the constraint gathering
> algorithms in the Analyzer and the CFE.
>
> Part of https://github.com/dart-lang/sdk/issues/54902
>
> Change-Id: Ia895fc84bd7ab666330a4ab32b6e759f0977e750
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346840
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Paul Berry <paulberry@google.com>
> Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>

Change-Id: Ibf75bb6dda4a4f5f36a2265036703977b28a4333
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353160
Auto-Submit: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-02-20 09:14:00 +00:00
David Morgan 859e359266 [macros] Cleanup after exception changes.
Add `RequestChannelException`, remove unused `RemoteExcepion`, update
some doc comments.

R=jakemac@google.com

Change-Id: Id51d2a9d16e7d4599703470b5c974c2bd438c55e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352911
Auto-Submit: Morgan :) <davidmorgan@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-02-20 09:07:29 +00:00
Jens Johansen b25ebda686 [macro] Add 'isClosed' to ExternalMacroExecutorBase and throw if using it after
E.g. running
```
out/ReleaseX64/dart pkg/_fe_analyzer_shared/test/macros/executor/executor_test.dart
```

(which is apparently the wrong executable) fails after 12 minutes (!)
with "TimeoutException after 0:12:00.000000: Test timed out after 12
minutes."

With this instead it runs in a few seconds because the stuff that makes
it wait forever throws instead.

Change-Id: Idd8be08438863511769b4cace1a492d613cadb03
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352301
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2024-02-20 08:19:18 +00:00
Sam Rawlins 4c30a89904 analyzer: Correct the scope in a switch statement case
Fixes https://github.com/dart-lang/linter/issues/4457

In the previous code, we set a Scope on the SwitchStatement for the
first `memberGroup`, and then _overwrite_ that Scope for each
subsequent `memberGroup`. This manifests in
`ScopeResolverVisitor.getNodeNameScope` using a scope from one switch
member that does not know about the variables declared in the relevant
switch member.

Change-Id: Ic88a800db339712b83a66d4d647b20005b2b8305
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348900
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-02-20 00:37:43 +00:00
Johnni Winther a765ffc540 [cfe] Generate merged augmentation library for macros
This adds support for generating the merged augmentation library in the
CFE. In order to get the right file offsets in the generated AST the
MacroExecutor.buildArgumentationLibrary function is extended to compute
a list of spans the describe what each segment of the generated source
code contains. These spans are used to compute the offset relation
between the intermediate augmentation libraries and the merged
augmentation libraries.

Change-Id: Ie5b9c23130da67ac874fb824b82827bfd6b88880
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349864
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2024-02-19 12:35:22 +00:00
Johnni Winther c4724e5a89 [cfe] Add Throw.forErrorHandling
This adds a `forErrorHandling` to the `Throw` node. This is used that the `throw` is *not* present in the source code but added to ensure
correctness and/or soundness of the generated code.

This is used for instance in the lowering for handling duplicate writes
to a late final field or for pattern assignments that don't match.

In response to https://github.com/dart-lang/sdk/issues/53519

TEST=updated ast-to-text

Change-Id: Ie103829d98fda9cd7b64e9e3d893e77d1e86d7d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347900
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2024-02-19 12:12:02 +00:00
Chloe Stefantsova a8cf0a0825 [analyzer][cfe] Expand TypeAnalyzerOperations. Part 1
This CL adds more of the type operations required in the subtype
constraint gathering algorithm into the shared type operation
class. The added operations are used in the constraint gathering
algorithms in the Analyzer and the CFE.

Part of https://github.com/dart-lang/sdk/issues/54902

Change-Id: Ia895fc84bd7ab666330a4ab32b6e759f0977e750
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346840
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2024-02-19 10:41:00 +00:00
Chloe Stefantsova 59eb20c04d Test collecting constraints in extension type vs non-extension types
Part of https://github.com/dart-lang/sdk/issues/54902

Change-Id: I142b57ddddba4e701a1c39af0e90f98f573635be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352861
Reviewed-by: Paul Berry <paulberry@google.com>
2024-02-19 10:41:00 +00:00
Daco Harkes dabad3bb30 [gardening] Mark test as slow
The test runs multiple test cases in sequence.

Bug: https://github.com/dart-lang/sdk/issues/54950
Change-Id: Id57771c2456ad18d14c7b6112a5cd2764336df01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352909
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2024-02-19 10:21:38 +00:00