Commit graph

91352 commits

Author SHA1 Message Date
Konstantin Shcheglov a868a5bfa6 Issue 52148. Disable invert 'if' when 'case'.
Disable a few assists that require 'patterns', when it is not enabled.

Bug: https://github.com/dart-lang/sdk/issues/52148
Change-Id: I3c3816f4a944c59698543e37f15e024249545952
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297880
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-04-24 21:16:48 +00:00
Sigmund Cherem 8026975546 [dart2js] better help message.
Makes more prominent that you can use '-v' to show
extra details about all options.

The message after this change will look as follows:
```
Compile Dart to JavaScript.

Usage: dart compile js [arguments] <dart entry point>
(use -h -v for detailed information about all options)
  -h, --help      Print this usage information
  -o, --output    Write the output to <file name>.
  -O<0,1,2,3,4>   Set the compiler optimization level (defaults to -O1).
```

Fixes https://github.com/dart-lang/sdk/issues/51982

Change-Id: I76fe5478b4a1d4b2ae2170eca72d764bc4d120b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/294164
Reviewed-by: Nate Biggs <natebiggs@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2023-04-24 20:48:14 +00:00
Nate Biggs 339399a593 [dart2js] Resolve failing web unit tests.
- variance_subtype_cast_test.dart: Pass soundNullSafety flag so @dart=2.7 flag doesn't get added to test.
- logical_expression_test.dart: Remove test as this is now covered by test added in https://dart-review.googlesource.com/c/sdk/+/297360.

Change-Id: I02d0fb816c5b41dad31014152ff3a796a528904c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297860
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2023-04-24 20:38:27 +00:00
Derek Xu 58b796bac9 [VM/Timeline] Disable SUPPORT_PERFETTO macro to investigate flaky Flutter crashes
Issue: https://github.com/flutter/flutter/issues/125425
Change-Id: If134e4f4efb3e3259dab421e769cc76264189ad3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297821
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-04-24 20:32:31 +00:00
Robert Nystrom 7b3c81f06d Update package:dart_internal to allow Dart SDK 3.0.0.
Change-Id: I564b60940475f40fa842e03d9b03ef0f7b06e9ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297820
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
2023-04-24 19:51:09 +00:00
Nate Biggs 9a7f60b438 [dart2js] Add Dart2JS input bytes as an internal metric.
Change-Id: Ib036b0511af2a54aa049f3638d9680fca3b77385
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297701
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2023-04-24 19:43:04 +00:00
Konstantin Shcheglov 2cdfc05568 Issue 52146. Fix ConvertToIfCaseStatementChain for a case without statements.
Bug: https://github.com/dart-lang/sdk/issues/52146
Change-Id: I2947111a0e1a4c6e739bda851f1f91c9637a745a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297420
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-04-24 19:28:56 +00:00
Danny Tuppeny d3460e0855 [analysis_server] Don't produce diagnostics for empty/commented fix_data files
Previous changes to analyze the fix_data/**.yaml files failed to roll into Flutter because it has a template for these files that contains only comments.

See https://dart-review.googlesource.com/c/sdk/+/297320 and https://github.com/flutter/flutter/pull/125363.

Change-Id: I098a5b336371bab7f80ac84c556efe118c70e74f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-04-24 18:47:21 +00:00
Stephen Adams 073def1334 [dart2js] Add codegen test for logical operator generation
Change-Id: I5f86fdf4e58122a234dc2c7b16e1e16ec44d0d83
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297360
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
2023-04-24 18:47:14 +00:00
Robert Nystrom 988642a94e Remove support for "@compile-error" and similar markers in tests.
These were added during the Dart 2 test migration as a way to indicate
why a test was expected to fail. But, like negative tests, they have
very poorly granularity.

Static error tests are strictly superior.

The co19 tests have been migrated off of these markers for a couple of
years, so our own language tests were the only holdouts. I see no uses
of "@syntax-error", "@runtime-error", or "@static-warning". I have now
migrated all of the tests that contained "@compile-error" to be proper
static error tests.

This simplifies the test runner and makes our tests more precise.

Fix #45634.

Change-Id: I0f46d110b6f322d98187e734195ecba7524574af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296720
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
2023-04-24 18:34:59 +00:00
Derek Xu 5978b607d2 [VM/Timeline] Make a header file for perfetto_utils
This is being done to allow us to access the utils from
profiler_service.cc.

TEST=Requested a trace using the getPerfettoVMTimeline RPC and confirmed
that it still looked correct.

Change-Id: Icfb7a5b41da0fc987a72098c4345e7e108b6566e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297740
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-04-24 18:29:23 +00:00
Konstantin Shcheglov 903be31b05 Apply nullabilitySuffix to interfaces / mixins / superclassConstraints / superclass.
Bug: https://github.com/dart-lang/sdk/issues/52133
Change-Id: Ib32d10d7736c59f93fdb1d6eb79851f3e44457b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297400
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-04-24 17:56:40 +00:00
Brian Wilkerson e8e4980b4c Rewrite keyword contributor tests
I did not change any of the test cases. I did change the names of the
tests to be more consistent, and in the process I found a couple of
tests where the test code was identical, so I deleted the duplicates.

I expect that there will be more cleanup that we'll want to do after
all of the contributor tests have been converted and merged together,
but I wanted this CL to be as straightforward as possible given its
size.

Change-Id: I2cbb6b5c0718fbbc36da521ee3c4fc7d00c36dcb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297720
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-04-24 17:36:22 +00:00
Brian Wilkerson 71d4e1478e Clean up some tests to make conversion of contributor tests easier
Change-Id: I801970b4b88b883b2219badcefb7e1c84517d592
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297780
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-04-24 17:35:27 +00:00
Devon Carew 4b582c4581 [deps] rev async, characters, convert, crypto, dartdoc, intl, markdown, sse, stream_channel, test, tools, usage, webdev
Revisions updated by `dart tools/rev_sdk_deps.dart`.

async (0127813..ce650b0):
  ce650b0  2023-04-19  Nate Bosch  Regression test for error rejecting transaction (#230)

characters (ba8d557..b306414):
  b306414  2023-04-19  Lasse R.H. Nielsen  Add tools to update and generate tables and tests. (#72)

convert (8812e40..855aeac):
  855aeac  2023-04-10  Kevin Moore  Require Dart 2.19, fix override param name, update lints (#81)

crypto (1cb1528..77491f5):
  77491f5  2023-04-19  Lasse R.H. Nielsen  Make `DigestSink` implement `Sink` (#146)

dartdoc (a0755f5..8e8b36e):
  8e8b36e3  2023-04-19  Janice Collins  Fix up documentation on comment reference parser to align with wiki (#2851)
  b9178fce  2023-04-19  dependabot[bot]  Bump github/codeql-action from 2.2.11 to 2.2.12 (#3390)
  37b981c4  2023-04-19  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#3389)
  dadef24a  2023-04-10  dependabot[bot]  Bump github/codeql-action from 2.2.9 to 2.2.11 (#3386)
  dda699a7  2023-04-10  Sam Rawlins  Prepare mixin-like classes for Dart 3.0.0 (#3385)

intl (a958db0..5d65e38):
  5d65e38  2023-04-19  Moritz  Update README.md
  9972a89  2023-04-19  Moritz  Update README.md
  5c14faa  2023-04-18  Copybara-Service  Merge pull request #584 from dart-lang:fixDateFormattingUrl
  4ea644e  2023-04-17  Moritz  Merge branch 'master' into fixDateFormattingUrl
  b0d5687  2023-04-17  dependabot[bot]  Bump dart-lang/setup-dart from 1.4.0 to 1.5.0 (#574)
  92149be  2023-04-17  Moritz  Merge branch 'master' into fixDateFormattingUrl
  5203d6e  2023-04-17  Googler  Internal change
  bab667f  2023-04-17  Moritz  Typo
  b0896b1  2023-04-17  Moritz  Fix bug
  43507e1  2023-04-14  Googler  Internal change
  d8844a0  2023-04-14  dependabot[bot]  Bump actions/checkout from 3.3.0 to 3.5.2 (#579)
  99ed16f  2023-04-13  Copybara-Service  Merge pull request #572 from dart-lang:adaptBrowserTest
  34e824c  2023-03-30  Moritz  Adapt test to browser CLDR update

markdown (d437c85..5f98aea):
  5f98aea  2023-04-20  Jonas Finnemann Jensen  Throw, if `BlockSyntax.parseLines` loops indefinitely (#533)
  86ebc2c  2023-04-19  Zhiguang Chen  Fix `linkReferenceDefinitionPattern` (#532)

sse (11e83a0..f947c3d):
  f947c3d  2023-04-10  Kevin Moore  Require Dart 2.19, bump lints (#82)

stream_channel (74646ea..71d4690):
  71d4690  2023-04-11  Tobe Osakwe  Add example/example.dart (#52)

test (7832931..7fab079):
  7fab0792  2023-04-19  Oleh Prypin  Dart 3 compatibility: change `extends Iterator` to `implements Iterator` (#1997)
  8f7682a5  2023-04-18  Nate Bosch  Remove deprecation of test_api top level libraries (#1994)
  7151486c  2023-04-14  Simon Binder  Add support for Microsoft Edge (#1992)
  c1d686aa  2023-04-12  Parker Lougheed  Fix "Improvements" link in `package:checks` migration guide (#1991)

tools (545d7e1..5c9f45c):
  5c9f45c  2023-04-20  Elias Yishak  Move `dateStamp` getter to `utils.dart` (#83)

usage (0698711..f97752f):
  f97752f  2023-04-10  Devon Carew  update readme for deprecation (#192)

webdev (7546291..8b42c95):
  8b42c950  2023-04-21  Anna Gringauze  Cleanup record types display (#2070)
  1cfb3bd6  2023-04-20  Elliott Brooks  Update CONTRIBUTING docs (#2097)
  941eda5b  2023-04-19  Elliott Brooks  Add a test to make sure proper release procedure is followed for `dwds` and `webdev` (#2095)
  2eb7c3ee  2023-04-17  Elliott Brooks  Add Github workflow for Dart Code Metrics (#2092)
  79a9bc9b  2023-04-17  Elliott Brooks  Fix DCM analyzer warnings (#2094)
  2a625039  2023-04-14  Elliott Brooks  Add `vm_service` git package dependency override (#2078)
  1fa19603  2023-04-12  Elliott Brooks  Add CI check to remind contributor to update CHANGELOG (#2090)
  c7bb19e1  2023-04-12  Elliott Brooks  Prevent PRs labeled `do-not-submit` from being merged (#2088)
  3781ef9b  2023-04-10  Elliott Brooks  Run mono_repo generate with version 6.5.3 (#2084)
  843890c6  2023-04-10  Anna Gringauze  Refactor record shape processing out of calculating record bound fields (#2074)

Change-Id: I4ce65f9f79d5086c33c575e57eff300216392510
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297800
Auto-Submit: Devon Carew <devoncarew@google.com>
Reviewed-by: Moritz Sümmermann <mosum@google.com>
Commit-Queue: Moritz Sümmermann <mosum@google.com>
2023-04-24 17:08:01 +00:00
Danny Tuppeny d75a4e162e [analysis_server] Update LSP generated classes to latest published version of the spec
No functional changes here but there have been some refactors inside the meta model that required some minor tweaks (URI moved from a type alias to string to a spec-defined base type).

I also improved the handling of some type references in the comments we bring in so they're clickable in more places.

Change-Id: I7c725d01b6d7bc0925979b8118dbfd8952f78724
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297482
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-04-24 15:09:20 +00:00
Johnni Winther 3a5b06a9c3 [_fe_analyzer_shared] Handle private names in exhaustiveness checking
Closes #52041

Change-Id: I8824aeb84eb6357bd47a6111217a273c883a68d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297462
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2023-04-24 14:31:49 +00:00
Johnni Winther 51c7d143e0 [_fe_analyzer_shared] Handle custom list implementation
This fixes the handling of list types in exhaustiveness checking so
that custom list implementations can be exhausted as lists.

The change doesn't include handling of sealed class and enums as lists
but test for these are added.

Closes #51973

Change-Id: I66bcff99c5262a82513dbde1e5561284846ceace
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297460
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-04-24 14:29:01 +00:00
William Hesse 60fec9c720 [infra] Adjust sharding for VM JIT builders
Cutting the shards from 10 to 4 makes the shards time out after 90
minutes on the slowest builders. Even the fastest builders have shard
runtimes of 30 minutes.

Changing the sharding of JIT builder tests from 4 to 8 for both VM tests
and co19 tests.

Fixup after https://dart-review.googlesource.com/c/sdk/+/294140

Change-Id: I813aa40b6aac0fc5083a9606b71d00e78ce71ffc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297480
Commit-Queue: William Hesse <whesse@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-04-24 10:18:05 +00:00
Johnni Winther 8cc76bde6e [cfe] Support type inference on inline class constructor invocation
Closes #51146

Change-Id: I8fab2e999b29fbc811786e168d0e7a4c5a081418
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295363
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-04-24 10:17:54 +00:00
Jens Johansen d18893c799 [CFE] Add more benchmarking points; change how subdivides are handled
This CL adds more benchmarking points, specifically giving more insight
into where body_buildBodies time goes.

It furthermore changes how overlapping subdivides are handled.
Previously only the first subdivide was actually recorded, meaning that
if a subdivide `a` contained a subdivide `b` only subdivide `a` would
have any time recorded for it. Now instead subdivide `b` will get data
recorded for the time it runs; this time will then _not_ be added to
`a`s total. For instance if subdivide `a` spends one second, then
(while still being in subdivide `a`) we enter subdivide `b` and spend
one second there, exit it, and spend yet another second before we exit
subdivide `a` before we would just have recorded 3 seconds for subdivide
`a`, now we will instead record 2 seconds for subdivide `a` and 1 second
for subdivide `b`.

Additionally a "system subdivide" is automatically added summarizing
any unaccounted for subdivide time, and an extra entry describing the
estimated subdivide recording overhead figues too.

As an additional note, enabling benchmarking seems to add ~6-7% runtime,
and because we specifically add additional parsing phases to measure
that separately the token stream can change before doing the actual
parsing, meaning that when enabling benchmarking some errors might be
swallowed.

Change-Id: I07ef42657c385031e8bb8680738442cf04fe2263
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295540
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2023-04-24 09:49:12 +00:00
Johnni Winther fe01a2068d [cfe] Implement least upper bound for inline types
Closes #51556

Change-Id: I44f2ae947b5316d21d23b39b88f1515702525955
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/294983
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2023-04-24 09:14:07 +00:00
Sergey G. Grekhov 92239e6b27 [co19] Roll co19 to 4b8157719cdcb99ee7380c920551786b6383f961
2023-04-19 sgrekhov22@gmail.com dart-lang/co19#1959. Test valid combinations of modifiers. Part 1 (dart-lang/co19#2023)
2023-04-18 49699333+dependabot[bot]@users.noreply.github.com Bump actions/checkout from 3.5.0 to 3.5.2 (dart-lang/co19#2022)
2023-04-17 sgrekhov22@gmail.com dart-lang/co19#1959. More basic and mixin restrictions tests (dart-lang/co19#2021)
2023-04-17 sgrekhov22@gmail.com dart-lang/co19#1959. Tests for syntax and basic restrictions (dart-lang/co19#2017)

Change-Id: I0d27a6b3504eb13351e72d8dac6281ff0aa52fc7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296802
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2023-04-24 07:59:58 +00:00
Chloe Stefantsova 6b0acfecc1 [cfe] Put patterns in the scopes of their declared variables
Closes https://github.com/dart-lang/sdk/issues/51971

Change-Id: I8ba634e7303bafdb1895c50970fbc80321f4bf6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296581
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2023-04-24 07:30:00 +00:00
Zach Anderson e34daa818b Revert "[analysis_server] Analyze fix data in fix_data folder"
This reverts commit bbacf39e9c.

Reason for revert: Causing flutter/engine to fail to roll into flutter/flutter. See https://github.com/flutter/flutter/pull/125363.

Original change's description:
> [analysis_server] Analyze fix data in fix_data folder
>
> Fixes part of https://github.com/dart-lang/sdk/issues/52126.
>
> Change-Id: Ib4bd7830a2f644eacedccd375c7c8dc60f040d33
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296801
> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>

Change-Id: I109a4b2c596ad22d73eaf0ac3e25f53a35ba5e28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297320
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2023-04-22 22:10:12 +00:00
Zach Anderson 7575e2c5be Revert "[analysis_server] Use fixDataYamlFolder constant instead of string literals"
This reverts commit ccb02fa8fc.

Reason for revert: Blocking revert in https://dart-review.googlesource.com/c/sdk/+/297320

Original change's description:
> [analysis_server] Use fixDataYamlFolder constant instead of string literals
>
> Follow-up from https://dart-review.googlesource.com/c/sdk/+/296801.
>
> Change-Id: I72ea8a42ec64c4bd6c6cee021a1464167ec368e6
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296862
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>

Change-Id: I8ed39fc343b9121c40de83038e97c43cac669ca1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297321
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2023-04-22 21:22:47 +00:00
Stephen Adams 45efccb5e0 Remove left-over patch declarations for List constructor.
This CL replaces https://dart-review.googlesource.com/c/sdk/+/296900

The `List` constructor is removed in Dart 3.0.
Some of the `@patch` implementations were not removed.

This is *high priority*. It seems the left-over `@patch factory List` constructor did not cause any errors, instead it *added* a constructor  to `List` that can be used in web compiled code. Even if `List` doesn't have such a constructor in the SDK code proper.
The VM and analyzer will say the invocation is an error, but dart2js happily compiles it and runs.

(It used to be that patches couldn't add public members, that security seems to have been removed.)

Also removes code which tries to detect "the unnamed List constructor",
which is no longer a thing, and a number of invocations of the constructor, where it's not clear that the test is aware that the constructor no longer exists, and is not marked as `@dart=2.x` with x < 12.

TEST=ci

Change-Id: I4ffaf3ae2c4e75ca06e7ba0bf19187b6376f3888
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297100
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-04-22 00:38:28 +00:00
Brian Quinlan 69f71e90ea Remove 'abstract' from 'class Platform'
Bug: https://github.com/dart-lang/sdk/issues/52138
Change-Id: Ibef54f5369d4b9374e9d58939ee26c853021bf74
CoreLibraryReviewExempt: Partial revert of 9c702bc72e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297160
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2023-04-21 23:44:29 +00:00
pq c1affe94e0 bump linter to grab pattern field false positive fixes
Change-Id: I80d0bcbeaf9b46488d53126deafc21215276036f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297120
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-04-21 23:09:45 +00:00
Nate Biggs 13849a9dd9 [dart2js] Add Dart input chars to compiler output when reading from dill.
What was being logged as "kernel bytes" or "Dart characters" included the size of the platform dill as well. Changed the text for that to the more general "input bytes". The new source bytes number is the number of bytes registered to Dart2JS by the CFE. This registration is done when the CFE is being run modularly or directly from sources.

When being run modularly the input to phase 0 (CFE-only) is slightly larger (includes extra files) but the input to phase 1 (closed world) ends up matching the non-modular value.

Example output:
Compiled 14,927,936 input bytes (8,010,096 characters source) to 11,647,944 kernel bytes in 0.48 seconds using 114.082 MB of memory

Change-Id: Idaaaf6f9c906659434a9af50882b7ed3343e601a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297020
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-04-21 22:49:11 +00:00
Ryan Macnak 78daab15b3 [vm] Remove FindObject.
Before the calling convention change during the introduction of AOT, this was used to get code metadata associated with a frame. Its remaining non-test use is forming service IDs for code object, which can  use the regular visitors.

TEST=ci
Change-Id: Ica8eafe988d19eba8d905d9dc5907afbfd559118
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296705
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2023-04-21 22:41:28 +00:00
Konstantin Shcheglov b5d63cb67f Add quick assist to convert SwitchStatement (with patterns) into if-case chain.
Bug: https://github.com/dart-lang/sdk/issues/52068
Change-Id: Ia20b943dfc5212764f31cd94f4f8cce8755628bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297140
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-04-21 22:07:02 +00:00
Konstantin Shcheglov 529adda42e Issue 52131. Find implicit constructor invocations from other constructors.
Bug: https://github.com/dart-lang/sdk/issues/52131
Change-Id: I7f28e4664f18196f978cb9dd38f878b1240d46a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297080
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-04-21 22:04:16 +00:00
Ryan Macnak 29472dbb73 [vm, gc] Avoid race between unregistering pages with LSAN and exit.
After the Page is unregistered, the only reference to its VirtualMemory is in memory not traced by LSAN. If exit happens here before the VirtualMemory is deleted or put into the global cache, it appears to be leaked.

TEST=lsan
Bug: https://github.com/dart-lang/sdk/issues/51560
Change-Id: I973e09bb19910d9cdcc3af6c8c9a188f095df36a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297040
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-04-21 19:32:40 +00:00
Konstantin Shcheglov 81ab76124f Support for pattern variables in RemoveUnusedLocalVariable.
Change-Id: I67ed0892a96f911bfae7a4fda91e2e6e55927fc9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296761
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-04-21 19:18:59 +00:00
Paul Berry 5d7dd58d41 Ignore TODO in pkg/analyzer and pkg/analysis_server.
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.  They may even consider adding a presubmit hook
to ensure that `FIXME` comments are only used during local
development.

Accordingly, it makes sense to suppress `TODO` comments from being
surfaced to the IDE "problems" view (since there are hundreds of them,
and they're not immediately actionable).  This makes VSCode's
"problems" view much more usable in "tree" mode.

Change-Id: I11a0c59132fb98c1c86fb4adf22d1fdf3b547c80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295662
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-04-21 19:16:04 +00:00
Derek Xu e36a587298 [VM/Service] Prepare to publish package:vm_service 11.4.0
Change-Id: I5ffbe166a0c13135c3fe356f46f8d355240585cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297000
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-04-21 18:59:37 +00:00
Danny Tuppeny ccb02fa8fc [analysis_server] Use fixDataYamlFolder constant instead of string literals
Follow-up from https://dart-review.googlesource.com/c/sdk/+/296801.

Change-Id: I72ea8a42ec64c4bd6c6cee021a1464167ec368e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296862
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-04-21 18:50:50 +00:00
Paul Berry 3516c86ae5 Add dependency overrides for pkg/analysis_server
These dependency overrides prevent pub from getting confused about the
fact that our SDK development is in a mono-repo; that in turn will
allow unit tests to be run from inside vscode using the standard test
integration (see https://github.com/Dart-Code/Dart-Code/issues/4502).

Change-Id: I8ea709984b03927e67f119d147338203d7e80811
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296980
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-04-21 18:43:33 +00:00
Martin Kustermann 79d133ab3a [vm] Fix product build by if/defing out reload tests
TEST=Fixes product build of run_vm_tests

Change-Id: I62fae4aba74cca6ebe1b3ce965fc015db3277e02
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296803
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-04-21 17:38:00 +00:00
Danny Tuppeny ee178b273b [analysis_server] Switch TypeMemberContributor to using InheritanceManager3
Fixes https://github.com/Dart-Code/Dart-Code/issues/4499.

Change-Id: I339f975894f6734c634df5dbc2df9695ecc999a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296580
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-04-21 17:31:12 +00:00
Danny Tuppeny bbacf39e9c [analysis_server] Analyze fix data in fix_data folder
Fixes part of https://github.com/dart-lang/sdk/issues/52126.

Change-Id: Ib4bd7830a2f644eacedccd375c7c8dc60f040d33
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296801
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-04-21 15:18:56 +00:00
Alexander Markov d83caf1c0c [vm/compiler] Support obfuscation of record field names
TEST=language/records/simple/* on vm-aot-obfuscate-linux-release-x64

Fixes https://github.com/dart-lang/sdk/issues/52124
Fixes https://github.com/flutter/flutter/issues/125289

Cq-Include-Trybots: luci.dart.try:vm-aot-obfuscate-linux-release-x64-try
Change-Id: Ic53ae5282ba1d30b395fa706840393fd467abf2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296920
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2023-04-21 15:14:58 +00:00
Jonas Termansen df63c24638 Checked in SDKs are now automatically uploaded.
The official dart-sdk packages are now automatically built in the CI and
developers will no longer need to build them manually when rolling the
checked in SDK. The cipd instances are now tagged with the commit hash
instead of the version number, which allows us multiple attempts at
building a particular version (which different commits).

Bug: b/279024347
Change-Id: I4bfb4a5384bb8c671b576afdac0e5008ccfcc8a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296861
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Jonas Termansen <sortie@google.com>
2023-04-21 13:57:15 +00:00
Martin Kustermann 2ea92acba5 [vm] Make reloading of isolate groups use new safepoint-level mechanism
The current hot-reload implementation [0] will perform a reload by
first sending OOB messages to all isolates and waiting until those OOB
messages are being handled. The handler of the OOB message will block
the thread (and unschedule isolate) and notify the thread performing
reload it's ready.

This requires that all isolates within a group can actually run & block.
This is the case for the VM implementation of isolates (as they are
run an unlimited size thread pool).

Though flutter seems to multiplex several engine isolates on the same OS
thread. Reloading can then result in one engine isolate performing
reload waiting for another to act on the OOB message (which it will not
do as it's multiplexed on the same thread as the former).

Now that we have a more flexible safepointing mechanism (introduced in
[1]) we can utilize for hot reloading by introducing a new "reloading"
safepoint level.

Reload safepoints
-----------------------

We introduce a new safepoint level (SafepointLevel::kGCAndDeoptAndReload).

Being at a "reload safepoint" implies being at a "deopt safepoint"
which implies being at a "gc safepoint".

Code has to explicitly opt-into making safepoint checks participate /
check into "reload safepoints" using [ReloadParticipationScope]. We do
that at certain well-defined places where reload is possible (e.g. event
loop boundaries, descheduling of isolates, OOM message processing, ...).

While running under [NoReloadScope] we disable checking into "reload
safepoints".

Initiator of hot-reload
-----------------------

When a mutator initiates a reload operation (e.g. as part of a
`ReloadSources` `vm-service` API call) it will use a
[ReloadSafepointOperationScope] to get all other mutators to a
safepoint.

For mutators that aren't already at a "reload safepoint", we'll
notify them via an OOB message (instead of scheduling kVMInterrupt).

While waiting for all mutators to check into a "reload safepoint", the
thread is itself at a safepoint (as other mutators may perform lower
level safepoint operations - e.g. GC, Deopt, ...)

Once all mutators are at a "reload safepoint" the thread will take
ownership of all safepoint levels.

Other mutators
-----------------------

Mutators can be at a "reload safepoint" already (e.g. isolate is not
scheduled). If they try to exit safepoint they will block until the
reload operation is finished.

Mutators that are not at a "reload safepoint" (e.g. executing Dart or VM
code) will be sent an OOB message indicating it should check into a
"reload safepoint". We assume mutators make progress until they can
process OOB message.

Mutators may run under a [NoReloadScope] when handling the OOM message.
In that case they will not check into the "reload safepoint" and simply
ignore the message. To ensure the thread will eventually check-in,
we'll make the destructor of [~NoReloadScope] check & send itself a new OOB
message indicating reload should happen. Eventually getting the mutator
to process the OOM message (which is a well-defined place where we can
check into the reload safepoint).

Non-isolate mutators such as the background compiler do not react to OOB
messages. This means that either those mutators have to be stopped (e.g.
bg compiler) before initiating a reload safepoint operation, the
threads have to explicitly opt-into participating in reload safepoints
or the threads have to deschedule themselves eventually.

Misc
----

Owning a reload safepoint operation implies also owning the deopt &
gc safepoint operation. Yet some code would like to ensure it actually
runs under a [DeoptSafepointOperatoinScope]/[GCSafepointOperationScope].
=> The `Thread::OwnsGCSafepoint()` handles that.

While performing hot-reload we may exercise common code (e.g. kernel
loader, ...) that acquires safepoint locks. Normally it's disallows to
acquire safepoint locks while holding a safepoint operation (since
mutators may be stopped at places where they hold locks, creating
deadlock scenarios).
=> We explicitly opt code into participating in reload safepointing
requests. Those well-defined places aren't holding safepoint locks.
=> The `Thread::CanAcquireSafepointLocks()` will return `true` despite
owning a reload operation. (But if one also holds deopt/gc safepoint
operation it will return false)

Example where this matters: As part of hot-reload, we load kernel which
may create new symbols. The symbol creation code may acquire the symbol
lock and `InsertNewOrGet()` a symbol. This is safe as other mutators
don't hold the symbol lock at reload safepoints. The same cannot be said
for Deopt/GC safepoint operations - as they can interrupt code at many
more places where there's no guarantee that no locks are held.

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

Issue https://github.com/flutter/flutter/issues/124546

TEST=Newly added Reload_* tests.

Change-Id: I6842d7d2b284d043cc047fd702b7c5c7dd1fa3c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296183
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2023-04-21 13:56:49 +00:00
Martin Kustermann 742612ddac [vm] Add Isolate::{Enter,Exit}AsNonMutator() APIs, use in sweeper
The sweeper threads are bypassing safepoints and have no need for normal
mutator state (e.g. storebuffer, marking stacks, .,..) on the [Thread]
object.

This fixes a TSAN report where sweeper would clear reusable handles
(which it didn't actually modify) and scavenger is reading those
handles (which arguably it doesn't have to either).

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

TEST=ci

Change-Id: I03a36e8518b6c00eb7f3b57f65fd469dddba23e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296860
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2023-04-21 11:23:47 +00:00
Martin Kustermann 586d359813 [gardening] Update status files after starting to run tests in obfucated/dwarf nnbd mode
After [0] landed we started running tests in strong mode (instead of
skipping them). This is the corresponding status file update.

[0] https://dart-review.googlesource.com/c/sdk/+/296583

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

TEST=ci

Change-Id: I52e5e9477c47c42a583fb76a8b4205c0ac16bbf3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296820
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2023-04-21 10:13:57 +00:00
Sigurd Meldgaard e0177fe017 Bump pub to 21eb39e148c720ab8577bbf3bf089556a113eb10
Changes:
```
> git log --format="%C(auto) %h %s" 3e2c92a..21eb39e
 https://dart.googlesource.com/pub.git/+/21eb39e1 Don't pass --fatal-infos to `dart analyze` in validation (3877)
 https://dart.googlesource.com/pub.git/+/95044c22 Improve message when sdk constraint is not null-safety enabled (3875)
 https://dart.googlesource.com/pub.git/+/b666c920 Fix tests to work in context of 3.1 (3876)
 https://dart.googlesource.com/pub.git/+/c890afa1 Refactor `cache add` check for existing package. (3872)
 https://dart.googlesource.com/pub.git/+/460283b7 Bump actions/checkout from 3.3.0 to 3.5.0 (3858)
 https://dart.googlesource.com/pub.git/+/b5df2113 Bump dart-lang/setup-dart from 1.4.0 to 1.5.0 (3857)

```

Diff: https://dart.googlesource.com/pub.git/+/3e2c92a8bb74935302de52b80b870bf66963756d..21eb39e148c720ab8577bbf3bf089556a113eb10/
Change-Id: If3f6244e79f7b284876795887066412b351a441b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295820
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2023-04-21 09:58:38 +00:00
Daco Harkes a045aea9bc [test/ffi] Format record types
Now that https://github.com/dart-lang/dart_style/issues/1128 has been
addressed, format the files testing varargs.

And skips `printf` executable lookup on Android.

Closes: https://github.com/dart-lang/sdk/issues/52112
Change-Id: I31158ad7a5ddd8520bbee5d67e427ee4c1f3da9e
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296800
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-04-21 08:23:57 +00:00
Martin Kustermann 2e466f66db [vm] Refactor thread scheduling code to better handle exits with active stack
An embedder (or the VM) can exit an isolate via `Thread::ExitIsolate()`
at a point where there's still active state (e.g. dart frames).

Because of this the VM has so far conservatively retained the [Thread]
object of dart mutators throughout the isolate's lifetime. After which
is was manually `delete`ed. We'd never re-use those [Thread] objects (we
do re-use [Thread] objects of non-dart-mutator threads).

When exiting via `Thread::ExitIsolate()` with active state, the mutator
was assumed to be at-safepoint at all levels. It was removed from the
thread registry's active threads. This also means that when e.g. GC runs
it can't use the thread registry to find all active threads it may
need to scan, instead it uses [Isolate::mutator_thread_] of all isolates.

This causes a variety of subtle issues, but the main one that motivated
this change is the following:

If a thread obtains a safepoint operation it means all other mutators
are parked. The thread owning the safepoint can do whatever it likes.
When introducing reload operation safepoints, a thread may want to

    ReloadSafepointOperation reload(thread);
    ...

    // Compile sources.
    {
      TransitionVMToNative transition(thread);

      // Will temporarily exit & re-enter current isolate.
      response_port = Dart_NewNativePort();

      Dart_PostCObject(kernel_isolate_port, ...);

      // Wait on [response_port] for response.
    }

This will cause the reloading thread to own the reload safepoint
operation but still transition states and even exit/re-enter the
isolate. Though this is currently not possible in the way enter/exit is
implemented.

So we'll refactor this fragile code in the following way:

* Move thread enter/exit logic entirely to the [Thread] object.

* Keep used threads in the thread registry's active list.

  => This allows us to keep various state on the [Thread] and thereby
  avoids clearing it when suspending & re-initialing it when resuming

  => It makes nested `Thread::ExitIsolate()` faster as we mainly have
  to enter safepoint (avoid acquiring threads lock, avoid releasing
  storebuffers, ...)

  => It makes nested `Thread::EnterIsolate()` faster as we mainly have
  to leave the safepoint (avoid acquiring threads lock, avoid acquiring
  storebuffers, ...).

  => A mutator can now own a safepoint operation (e.g. reload safepoint
  operation) and still `ExitSafepoint()` / `EnterSafepoint()` safely -
  as those are based on the normal `EnterSafepoint()` and
  `LeaveSafepoint()` APIs.

* We separate

   - Suspend & Resume of a dart mutator (possibly with active stack)
   - Setup & Reset of state only relevant for dart mutators
   - Setup & Reset of state relevant for any mutator

* We unify how the [Thread] objects are freed between dart mutator and
  non-dart mutators: [Thread] objects without state can be given back to
  the [ThreadRegistry] and re-used (instead of being deleted in
  `Isolate::~Isolate`)

* We have capability to free [Thread] objects if a dart mutator has an
  empty stack & re-use for another isolate of the same group.
  (In future we may have N Thread objects for N cores and the threads
   would even maintain their TLABs when switching between isolates)

* Since we allow reusing of [Thread] objects also for dart mutators now,
  we have extensive asserts to ensure they are "clean" when they get
  into the free list and come out "clean" again.

TEST=ci

Change-Id: Id85e8e484efd98d28e323b33795716420e619986
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296585
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-04-21 08:06:49 +00:00