Commit graph

97138 commits

Author SHA1 Message Date
Danny Tuppeny f2eee8bf71 [analysis_server] Don't flush diagnostics for deleted files that have overlays
Fixes https://github.com/dart-lang/sdk/issues/53475

Change-Id: I5eaba2192e8d9d141cbee02f4c9bbe941db026f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325262
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-09-11 18:16:38 +00:00
Danny Tuppeny 3bf8a233a5 [analysis_server] Add a preview flag for surveys
Change-Id: Iaacdeb24a222df3cf6d730641c7c4cf7355f0f2f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325263
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-09-11 18:08:06 +00:00
Danny Tuppeny c11697af90 [analysis_server] Migrate remaining LSP tests to new set() methods for capabilities
No functional changes, just flattening capabilities into using set...() methods instead of providing them inline to the `initialize` method.

Change-Id: I0182a7dfa6ad2a3b3d83519b7a90f296722d05b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324523
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-09-11 18:00:10 +00:00
Konstantin Shcheglov c3af85fe47 Augmentation. Support for fields.
Change-Id: I57a9975c3c6516a310fccd069a1231f139e58296
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325123
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-09-11 18:00:03 +00:00
Parker Lougheed f91a4cf1b0 [linter] Link to docs for more context on enhanced enums
Change-Id: Iacfda3ea97bfe7025f0d415f06ef2b342df37dda
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325180
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-09-11 17:52:07 +00:00
Parker Lougheed 08a1093cd4 [linter] Focus omit_local_variable_types on type itself
The lint was being reported on the entire expression, making it potentially hard to identify the source of the lint. This change moves the range to the type itself, now matching the existing behavior of the lint in for each loops.

Change-Id: Id4a7c487aadb6282515c7ef5bb0fd8ebf923d8eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325161
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-09-11 17:51:59 +00:00
William Hesse 979f5d097c [linter] Remove special handling of linter package in generate_package_config
The linter is moved from third_party to pkg, and the old copy has
been removed from DEPS for weeks now. Remove the workaround that
ignores an old copy of linter in third_party/pkg/linter.
Users who have updated without running gclient sync -D will
now get an error that they have two copies of the
linter package, and they will get a message that they should
run gclient sync -D when they run gclient sync.

This completes the migration of the linter package into the SDK
source repository.

This reverts most of https://dart-review.googlesource.com/c/sdk/+/321722
leaving a small refactoring cleanup in place.

Bug: https://github.com/dart-lang/linter/issues/4411
Change-Id: Id5cdb3485e42e78743303d64370bc9f7899ad00e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325301
Reviewed-by: Jonas Termansen <sortie@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: William Hesse <whesse@google.com>
2023-09-11 17:18:05 +00:00
dependabot[bot] 79f650c4f8 Bump actions/upload-artifact from 3.1.2 to 3.1.3
Closes https://github.com/dart-lang/sdk/pull/53482

GitOrigin-RevId: 5044cd9750ccff25a4dfef3a680986bda3b16e9a
Change-Id: I5a1edba320c1e9eef1ecc2f499100d6f51857091
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325124
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2023-09-11 17:02:56 +00:00
dependabot[bot] d998492b9b Bump actions/checkout from 3.6.0 to 4.0.0
Closes https://github.com/dart-lang/sdk/pull/53483

GitOrigin-RevId: c1cb9106ffcb16dc9534172bf3354ad9954102cd
Change-Id: I66e543e1f9b7d784930cca736909dd0c327074e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325141
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-09-11 17:02:40 +00:00
Jake Macdonald 0ffd54738a add declarationKind for extensions and libraries, support augmenting extensions and add test
Change-Id: I510976cac641800e664e92e7db786962d539ec9c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325021
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
2023-09-11 15:56:23 +00:00
Parker Lougheed 0ac6f0846a [analyzer/linter] Remove linter rule maturity
Change-Id: I08a064acf5911ea20d1e3a90e9e54b5837296540
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325160
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-09-11 15:30:02 +00:00
Johnni Winther 4c1a94c0d3 [cfe] Embed tearoff in Extension(Type)MemberDescriptor
This simplifies handle the constructor/member and its corresponding
tearoff as a pair. Also it prepare for supporting tearoff of
extension type constructors and methods with the same name.

TEST=existing

Change-Id: Iea6cbc0250c8df6bd0f825068c1f3e865d938427
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324202
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2023-09-11 13:35:10 +00:00
Ömer Sinan Ağacan 5865e6db9f [dart2wasm,smith] Add options support in test_matrix.json, jscm builder
- Add dart2wasm_options syntax to test_matrix.json.

- Add a new builder for the JavaScript compatbility mode
  (`--js-compatbility`).

Change-Id: I32642e932f1d4a8a74b5b75f7783117520d51f02
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322281
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-09-11 10:50:22 +00:00
Jens Johansen c49f87382b [vm] Use specialized int set in heap snapshot tool
Currently the heap snapshot tool uses a regular Set<int> for storing
ints between 0 and the number of objects (n).

This CL instead introduces a specialized int set backed by a Uint8List
where each bit represents a number between 0 and n.

This specialized set is then created to fit the number of objects, so
even an empty set takes the same amount of space as a full set: about
125 kb per million possible values (or ~6 mb per 50 million).

For small sets thats a lot worse than before, but for big sets it's a
lot better. Runtime is also a lot better.

"Benchmarks" on a snapshot that's ~1.5GB:

Runtimes:

Before:
closure roots (or all after the first one): ~30s, ~19s, ~20s
eval and: ~5.5s, ~6.3, ~5.6
eval or: ~7.3s, ~6.5s, ~6.4s
eval minus: ~4.5s, ~6.4s, ~6.5s

With CL:
closure roots (or all after the first one): ~7.7s, ~4.3s, ~4.1s
eval and: ~0.2s, ~0.3s, ~0.2s
eval or: ~0.6s, ~0.6s, ~0.6s
eval minus: ~0.3s, ~0.2s, ~0.3s


Memory usage:

Before:

after loaded:
$ grep -E "VmPeak|VmSize|VmRSS" /proc/588700/status
VmPeak: 10293036 kB
VmSize:  9896880 kB
VmRSS:   9260604 kB

after all = closure roots
VmPeak: 12354840 kB
VmSize:  9529612 kB
VmRSS:   8898088 kB

after 2 x closure all
VmPeak: 13068580 kB
VmSize: 12478236 kB
VmRSS:  11891620 kB

after 3 x eval and
VmPeak: 18377540 kB
VmSize: 18376520 kB
VmRSS:  17803032 kB

after 3 x eval or
VmPeak: 19621712 kB
VmSize: 18114376 kB
VmRSS:  17491808 kB

after 3 x eval minus
VmPeak: 21522780 kB
VmSize: 21522272 kB
VmRSS:  20907724 kB


With CL:

after loaded:
$ grep -E "VmPeak|VmSize|VmRSS" /proc/594718/status
VmPeak: 10293560 kB
VmSize:  9967036 kB
VmRSS:   9323404 kB

after all = closure roots
VmPeak: 10293560 kB
VmSize:  9805272 kB
VmRSS:   9137364 kB

after 2 x closure all
VmPeak: 10868740 kB
VmSize: 10867208 kB
VmRSS:  10199784 kB

after 3 x eval and
VmPeak: 10906236 kB
VmSize: 10905728 kB
VmRSS:  10238424 kB

after 3 x eval or
VmPeak: 10925496 kB
VmSize: 10924988 kB
VmRSS:  10257388 kB

after 3 x eval minus

VmPeak: 10944756 kB
VmSize: 10944248 kB
VmRSS:  10276672 kB
Change-Id: I8d0b65fa51ac2bd4696c4d2782c4423966a7fbae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324682
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2023-09-11 10:48:46 +00:00
Tess Strickland 959f21ab40 [vm/compiler] Use a block size of 16 bytes for ARM64 MemoryCopy.
TEST=vm/cc/IRTest_Memory, co19{,_2}/LibTest/typed_data,
     lib{,_2}/typed_data, corelib{,_2}/list_test

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

Cq-Include-Trybots: luci.dart.try:vm-mac-debug-arm64-try,vm-aot-linux-release-simarm64-try,vm-aot-mac-release-arm64-try,vm-linux-release-simarm64-try,vm-mac-release-arm64-try,vm-aot-android-release-arm64c-try,vm-ffi-android-debug-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-linux-debug-simriscv64-try,vm-linux-release-simarm-try
Change-Id: Ife645a1d09be862d74e198162b124e657878280a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324683
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2023-09-11 09:24:19 +00:00
Vyacheslav Egorov 00d883f459 [vm/compiler] Improve integer equality comparisons
Consider for example the following two functions

    f0(int value) => value == 0 ? ... : ...;
    f1(List<int> list) => list[0] == 1 ? ... : ...;

before this change we would produce a `BoxInt64(value)` followed by
`StrictCompare` in `f0` and `UnboxInt64` followed by `EqualityCompare`
in `f1`. However the decisions should be reversed: when comparing
unboxed values we should lean on `EqualityCompare` and when
comparing boxed values when smis are involved we should lean
on `StrictCompare`.

This change adjusts specialization and canonicalization rules to achieve
that: we prefer to emit `EqualityCompare` when specializing and then
add rule to collapse it back into `StrictCompare` if we discover that
is going to be more optimal (e.g. allows to avoid boxing).

TEST=vm/dart/aot_prefer_equality_comparison_il_test

Cq-Include-Trybots: luci.dart.try:vm-aot-linux-release-x64-try,vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-x64-try,vm-aot-android-release-arm64c-try
Change-Id: I953a346f22702debc61b84b745d2a9fab58a9ca5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324981
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-09-11 07:56:47 +00:00
Nate Biggs b6e3c5cffd [dart2js] Sort holders before emitting them.
When serializing JS, we can sometimes end up changing the order we visit ModularExpressions. This can mean their indices are not stable against serialization and so the emitted code (and as a result hashes for that code) can change if the compiler did any serializing during the compilation.

We can make the order stable by sorting the holders before we process them.

This removes diff in hashes when running this (`--test-mode` forces serialization):
```
out/ReleaseX64/dart-sdk/bin/dart compile js benchmarks/OmnibusDeferred/dart/OmnibusDeferred.dart --out=om1a/m.js
out/ReleaseX64/dart-sdk/bin/dart compile js benchmarks/OmnibusDeferred/dart/OmnibusDeferred.dart --test-mode --out=om1b/m.js
```

Bug: https://github.com/dart-lang/sdk/issues/53466
Change-Id: Ibec88ff6acb71f1e96cbdb1d5ef4200d370cc3c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325100
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2023-09-09 01:50:52 +00:00
Paul Berry 1c6c8ef94d Ignore TODO in pkg/linter.
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.

(See also https://dart-review.googlesource.com/c/sdk/+/295662, which
made the corresponding change to the `analysis_server` and `analyzer`
packages).

Change-Id: I68734fdfc051ffe434c1ffc709e8b686f571d2c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325121
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-09-08 21:03:47 +00:00
Devon Carew 1fc52e514f [deps] revert bump of package:leak_tracker
Change-Id: I9cc16840391153ec735f95cafe3f9080335b0324
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325120
Auto-Submit: Devon Carew <devoncarew@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-09-08 19:46:28 +00:00
Nate Biggs a503edf481 [cfe] Fix kernel (de-)serialization missing field offset on FieldInitializer.
We are experiencing diffs in Dart2JS source maps in `--test-mode` which does a serialization round trip. JS that should map to default parameters is instead mapping to the surrounding `Constructor` member since the FieldInitializer's offset is getting dropped.

This is affecting any Dart2JS split action build since those all end of serialiaing and deserializing the kernel. Any other tools using this serialization would also be affected.

TEST=Existing/will add in follow up.

Bug: https://github.com/dart-lang/sdk/issues/53466
Change-Id: Ibeccf9153c78e6c358806c7ded4dbc2dea49d8e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325020
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-09-08 18:53:39 +00:00
Nicholas Shahan 027f57227f [ddc, dart2js] Add results cache to isSubtype
Optimize repetitive calls to isSubtype with a caches to store pairwise
results.

There are currently two caches for sound and unsound results but in the
future that can be combined into a single cache once the library is
aware of error reporting. That single cache could stores "pass", "fail", 
or "fails when sound mode but passes in unsound null safety".

Issue: https://github.com/dart-lang/sdk/issues/48585
Change-Id: I49e5794703fd58f1b2bba50e426e25146800fbb8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323707
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-09-08 18:39:53 +00:00
Kenzie Schmoll 2ed87ffb02 Update DevTools rev to adfb08c95c626248b28cc60df3b085c12ad8758e
Change-Id: Ieda1de59dec0ba68b01ec0893c43c6c4015fe58e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324770
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
2023-09-08 18:32:51 +00:00
Konstantin Shcheglov 2a758931aa Extension type. Fixes for activating rename refactoring.
Change-Id: Ie275fbb94789878ca96302635677823f24242284
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325080
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-09-08 18:13:51 +00:00
pq 8a5ddecfb3 + extension type target kind (and @optionalTypeArgs support)
Adds a new TargetKind for extension types and adds it to `@optionalTypeArgs`.

Change-Id: I7254c1299c296451b9adc5d1f8eceb50af66f039
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324769
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-09-08 18:09:01 +00:00
pq dd970ba17e de-duplicate mocked package:meta
(We should do the same for `package:flutter` but that will likely require some updates to the version stored in server.)


Change-Id: I262886a3522e19f86a7ba4ae46a50c48090c8d95
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-09-08 18:05:48 +00:00
Devon Carew d6200f801e [deps] rev dartdoc, leak_tracker, lints, native, webdev
Revisions updated by `dart tools/rev_sdk_deps.dart`.

dartdoc (a32ba3a..adc76e6):
  adc76e6d  2023-09-06  Parker Lougheed  Take advantage of a few Dart 3 features (#3491)

leak_tracker (098bafc..4616c8b):
  4616c8b  2023-09-05  Polina Cherkasova  Note about OverlayEntry. (#142)
  fd7d70f  2023-09-01  dependabot[bot]  Bump actions/checkout from 3.5.3 to 3.6.0 (#141)
  c6c1004  2023-09-01  Polina Cherkasova  - (#139)
  0298e20  2023-08-31  Polina Cherkasova  Add a test specific rule. (#138)
  ea17fa4  2023-08-29  Polina Cherkasova  Increase version of leak_tracker_flutter_testing (#136)
  8f830d6  2023-08-29  Polina Cherkasova  Update pubspec.yaml (#135)
  8a54575  2023-08-29  Polina Cherkasova  Enable connection to vm service for flutter testing and define matcher for reporting for memory
allocations. (#128)
  88a19a7  2023-08-28  Polina Cherkasova  - (#133)
  2070856  2023-08-24  Polina Cherkasova  Add instruction to start tracking instances of ChangeNotifier earlier. (#130)
  eb6113a  2023-08-23  Polina Cherkasova  Measure how memory is consumed by a test. (#114)
  72264f7  2023-08-22  Polina Cherkasova  Fix misspelling. (#131)
  87c9e9e  2023-08-16  Polina Cherkasova  Add debugging construcstors to LeakTrackingTestConfig, per leak type. (#129)
  b29547a  2023-08-15  Polina Cherkasova  Create visibility for roadmap for leak_tracker. (#124)
  23b15b6  2023-08-15  Polina Cherkasova  Fix issue of using wrong settings for a phase. (#122)
  713f646  2023-08-11  Polina Cherkasova  Enable global configuration for leak tracking. (#121)
  19b01cf  2023-08-10  Polina Cherkasova  Create package leak_tracker_flutter_testing. (#119)
  02d0b2f  2023-08-07  Polina Cherkasova  Stop failing if object is disposed twice. (#117)
  2026379  2023-08-04  Polina Cherkasova  Remove not-published versions and increase leak_tracker version. (#116)
  9bb71c6  2023-08-04  Polina Cherkasova  Stop requiring registration of disposed objects. (#113)
  8939456  2023-08-04  Polina Cherkasova  Refactor dispatcher. (#115)
  6f54f5a  2023-08-01  Polina Cherkasova  Start vm service when needed. (#112)
  b045c5e  2023-08-01  Polina Cherkasova  Reorganize leak tracker for better performance. (#106)
  127b83c  2023-07-31  Polina Cherkasova  Update TROUBLESHOOT.md (#108)
  6dabd33  2023-07-31  Polina Cherkasova  Simplify and clarify instructions to fix leaks. (#107)
  c53db68  2023-07-25  Polina Cherkasova  Improve code structure. (#103)
  10cce1a  2023-07-24  Polina Cherkasova  Rename `gcCountBuffer` to `numberOfGcCycles`. (#101)
  3a061a4  2023-07-21  Polina Cherkasova  Improve doc comments. (#100)
  6e3f57c  2023-07-21  Polina Cherkasova  Fix and test cover case of customized `gcCountBuffer` (#99)
  2152aab  2023-07-21  Polina Cherkasova  Add details about hidden leaks. (#97)

lints (da44af3..8d5f750):
  8d5f750  2023-09-06  Devon Carew  move the list of lint rules from the readme to a separate rules.md file (#145)

native (a2dfedc..387f894):
  387f894  2023-09-06  Gabriel Terwesten  [native_toolchain_c] Default handling for PIC/PIE compiler flags (#121)
  0a4e5f8  2023-09-06  Gabriel Terwesten  Add support for defines to `CBuilder` (#120)

webdev (fc876cb..9487a45):
  9487a459  2023-09-05  Jacob Bang  Update README.md to use `dart pub` instead of `pub` (#2195)
  07367779  2023-08-31  Elliott Brooks  Pass the package config directly to the load strategy instead of depending on an app entrypoint
(#2203)
  0044d753  2023-08-24  Jonas Termansen  Fix conflicting webdev smoke package names. (#2202)
  6183f270  2023-08-23  Elliott Brooks  Allow client to specify a way to convert an absolute path into a g3-relative path (#2200)
  b244b899  2023-08-22  Elliott Brooks  Allow client to specify how to find the package config  (#2199)

Change-Id: Ic00adc68ec01cd0cc6e27be665436de5095d8d07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324801
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2023-09-08 16:51:40 +00:00
Daco Harkes 01b1291d54 [tool] generate_idefiles sanitizer argument
Change-Id: I6f93fdbce8f4cef6c606e8b43ae9e1e888772292
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325000
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2023-09-08 15:49:28 +00:00
Brian Wilkerson b8a89b66a6 Initial support for code completion in extension type declarations
Change-Id: I6acb71d0ac282135b6527431b162fad9a0dee8f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324900
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-09-08 14:30:20 +00:00
Johnni Winther 1da590fc3f Fix type promotion of late final fields on DDC and dart2wasm.
When the CFE compiles code for DDC or dart2wasm, it lowers late final
fields to synthetic getters. In order to ensure that accesses to these
fields can still be type promoted, a flag is added to the kernel
`Procedure` class, to indicate that a getter was produced by lowering
a late final field. When deciding whether a property access is
promotable, the CFE checks this flag; if it's set, it treats the
getter like a field.

Includes a language test validating the fix.

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

TEST=tests/language/inference_update_2/late_field_test.dart

Change-Id: I98b81f04a3342d851060e5b2a7265323b93bb4e3
Bug: https://github.com/dart-lang/sdk/issues/53462
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324767
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-09-08 14:02:00 +00:00
Johnni Winther fefa87d1e6 [cfe] Make DartTypeVisitor(1) a pure interface
This splits DartTypeVisitor(1) into a pure interface and a
DartTypeVisitor(1)DefaultMixin with the base implementation. This is
a step towards avoid having an accidental default implementation where
a static error would have been preferable.

TEST=existing

Change-Id: Ieea9a773a9b70897a2db10cff8d721831a702a8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324780
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-09-08 11:59:41 +00:00
Johnni Winther e401b6f18a [kernel] Add sealed classes GenericDeclaration and GenericFunction
This adds a typed `TypeParameter.declaration` property to be used
instead of the `parent` property. The `declaration` property holds the
declaration (Class, Method, Extension, etc.) that introduced the
type parameter. `GenericFunction` is the subset of `GenericDeclaration`
that is defined through a `FunctionNode`.

TEST=existing

Change-Id: Ie89e7f5fa12a7966507a250cacc098eb0ce6b30b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323160
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2023-09-08 08:32:25 +00:00
Keerti Parthasarathy 5b44717c63 Fixes for organize imports
- consider prefix when sorting
- remove duplicates
- ignore comment if there is a line break

fixes b/299271413, b/299270948, b/299272871

Change-Id: I0e5e72ae0d326042ee1bec777189c645a52e9ed7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324840
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-09-08 04:50:15 +00:00
Ryan Macnak ac22e72d59 [test] Mark RISC-V pass-struct-by-value tests to avoid flaky status changes.
Bug: https://github.com/dart-lang/sdk/issues/48645
Change-Id: I3729c7df81ad2089224bf886a8c5345cc857f026
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324764
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2023-09-08 01:17:30 +00:00
Srujan Gaddam fedc687bd3 [dart:js_interop] Add toJSProxyOrRef
Adds a conversion function on List<JSAny?> so that users can
modify the original list and have those changes carry forward
to the array. Creates a proxy object for dart2wasm when the
list is not a JSArrayImpl. This proxy uses handler methods and
the fact that Array methods are generic to provide an Array
interface. Also fixes a small issue in the exporting so that
toJS'd function types have a valid return type.

CoreLibraryReviewExempt: Backend-specific library.
Change-Id: I00f453aa82dd19f2913820579eb2675b799288d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323446
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-09-07 22:58:22 +00:00
Srujan Gaddam 54522db98f [dart2wasm] Fix nullable JS type and int parameters in JSFunction
When a callback is toJS'd with an int parameter, we should attempt
a conversion to int if possible, similar to return values on
external functions. Similarly, parameters where the expected type is
a JS type should check to make the value isn't nullish before boxing,
as JS null and undefined are converted to Dart null.

Tests are added for conversion semantics of JSFunctions.

Change-Id: I95566c2954d915b8cf31cdc55fed359c695404f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323445
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2023-09-07 22:58:22 +00:00
Srujan Gaddam 6f497776e6 Reland "[dart:js_interop] Remove unnecessary custom static interop check"
This is a reland of commit 8193e6a385

The CL is changed to handle the inconsistent patching we have for
extension methods. This CL either checks if the member is non-external
or has the @patch annotation. This accounts for all the members in
dart:js_interop.

Original change's description:
> [dart:js_interop] Remove unnecessary custom static interop check
>
> This was added to prevent accidentally lowering patched members,
> but these members are patched before we see them, so they aren't
> marked external.
>
> Change-Id: Ib8f7c52c38a3f1e28905798a40319f7aa2994328
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322502
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Commit-Queue: Srujan Gaddam <srujzs@google.com>

Change-Id: I129e5a030df1fd55e7292b4b4bd0276cab7bee15
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322564
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-09-07 22:58:22 +00:00
MarkZ dacf4a8f46 [ddc] Cleaning up extraneous null checks in runtime.
Change-Id: Ia32b15ec9ac572332da7904e94ec9c9615bf3de1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324842
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
Auto-Submit: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-09-07 22:57:39 +00:00
Sam Rawlins e6ac464ff0 Avoid passing a nullable value to Completer<nn-type>.completer.
This is cleanup work required to start enforcing this with static analysis, as
per https://github.com/dart-lang/sdk/issues/53253.

Real quick this issue is that this code is unsafe:

```dart
void f(Completer<int> c, int? i) {
  Future<int>.value(i); // Ouch!
  c.complete(i);        // Ouch!
}
```

Change-Id: Ia4d83719c425601b24e8ae6e305c88c95cba8b20
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324640
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2023-09-07 21:48:26 +00:00
pq 7b8735eeb4 annotation validation for extension types
validation/tests for application of

* `@mustCallSuper`
* `@nonVirtual`
* `@reopen`
* `@sealed`

to extension types

See: https://github.com/dart-lang/sdk/issues/53434

Change-Id: I005523507044e7d5879a5589c132384e7bb8be56
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324768
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-09-07 21:26:33 +00:00
Nicholas Shahan c4d2f64dd8 [ddc] Avoid unnecessary cast as Object
Change-Id: I96ffb4e91bf1656818fd5a71077f034a1acd1b93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324641
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2023-09-07 21:20:44 +00:00
Kallen Tu ac04a4e4e2 [analyzer] Remove generated constant evaluator and its tests.
The generated constant evaluator is not being used and is removed by
this CL. All imports of the deleted evaluator will import the more
direct dependency and tests are moved to `evaluation_test.dart`.

Change-Id: Ie435d289bd85256419f67407b36af0375661f335
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324342
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-09-07 21:08:49 +00:00
Danny Tuppeny 1a0472fdca [analysis_server] Migrate some more tests to use flattened client capabilities
Change-Id: I9e466d6eb3821f8f358d9f6c6c9d69c8f0ff9733
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324722
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-09-07 18:45:27 +00:00
Sam Rawlins 736d8bcd87 Move DEPRECATED_EXPORT_USE to be a WarningCode
After this move, there are 10 remaining HintCodes: 3 are deprecated
(only reported in pre Dart 3.0 code), 5 are to be moved; 2 are to be
re-implemented as LintCodes.

Work towards https://github.com/dart-lang/sdk/issues/50796

Change-Id: I230c1c6a4defcdf1a00c0a755eac71baa1d4c9bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324420
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-09-07 18:32:53 +00:00
Danny Tuppeny fc44a53bd5 [analysis_server] Move signature help tests to TestCode + cleanup
No functional changes, just moving from the old `markers()` functions to `TestCode`, using the flat setXxxCapabilities() style and some other minor cleanup to be consistent with other tests.

Change-Id: I8ad04cd6b50df59004d07510f4fa2f57a8cd4463
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324721
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-09-07 18:28:53 +00:00
Danny Tuppeny aee790b69e [analysis_server] Add a test for signature help of extension type method
Change-Id: I3e4d54e63f171dfd73b11e1997feb4dba7e4b76a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324684
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-09-07 18:24:50 +00:00
Konstantin Shcheglov db212846ed Extension type. Create navigation regions for primary constructor and representation field.
Change-Id: I491780daa376941d031bba6dd7da60655ec3e76e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324765
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-09-07 18:20:50 +00:00
Sam Rawlins 48a8903efc Avoid passing a nullable value to Completer<nn-type>.complete
This is cleanup work required to start enforcing this with static
analysis, as per dart-lang/sdk#53253.

Real quick this issue is that this code is unsafe:

```dart
void f(Completer<int> c, int? i) {
  Future<int>.value(i); // Ouch!
  c.complete(i);        // Ouch!
}
```

Change-Id: I12c4f0a92a2071fb47759d9626689e00cfa42f8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324763
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-09-07 17:55:03 +00:00
pq 725de4ea23 validate @mustBeOverridden on extension type methods
See: https://github.com/dart-lang/sdk/issues/53434

Change-Id: Ibeab460fa8cc9d7e7fa0efdb062c839659243e45
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324574
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-09-07 17:40:31 +00:00
Sam Rawlins 4176e16c59 linter: Move avoid_slow_async_io tests
Change-Id: Ic8a1e3ecd10b635b5f353ecbbabc942905fd2832
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324482
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-09-07 17:09:53 +00:00
Mayank Patke 1e2146b404 [dart2js] Bump pubspec SDK constraint to 3.0.0
This CL also cleans up any required mixin declarations/uses.

Change-Id: Ib51847f01aa6c10ebf1284600455a07091a109b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324484
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2023-09-07 17:07:24 +00:00