Commit graph

87342 commits

Author SHA1 Message Date
Danny Tuppeny b3b2a1cebf [analysis_server] Change LSP types to use Uri types instead of Strings
This requires some tweaks to to/from JSON code, and some handling for Maps that previously could be serialised directly but now may contain `Uri`s in keys and need to be converted to strings explicitly (since Uri has no toJson method).

Change-Id: I61358d8198ac1da322fae98d6c40747ad08754b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258927
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-09-14 18:58:44 +00:00
Johnni Winther 13b5ca415f [cfe] Don't add super-initializer and body to external constructors
Closes #28565

Change-Id: Ic1eb554cab2723bb16291216d127bae30f965292
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259160
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-09-14 18:48:43 +00:00
Brian Quinlan fa53fb66d0 Throw an error if an attempt is made to create more than one resource from a ResourceHandle
Change-Id: I629d2b9cfddd8e5f7fe8ae65a03362c7bcce5e2c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257000
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2022-09-14 18:17:33 +00:00
Riley Porter c229ff56b2 [dart:html] Update prototype CSS properties script to match views model
Change-Id: I0bcea8e59b6d92b8a0aea82d64ca4266ec12869c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259062
Commit-Queue: Riley Porter <rileyporter@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2022-09-14 18:00:52 +00:00
Riley Porter b94d9ab29b [dart:html] Add script to generate dart:html prototype legacy events
Adds a flag `--generate-prototype-events` to the dart:html generation
scripts, which causes a `prototype_events.dart` file to be generated
with EventStreamProviders and extensions for all events generated
in legacy dart:html. The generated file can be copied and pasted into `html_events.dart` to be used in the new dart:html prototype.

The script `prototype_htmleventgenerator.py` reuses as much common functionality as possible from the `htmleventgenerator.py`.

There were many edge cases to consider, like:
  - de-conflicting names with different event types (e.g. ProgressEvent onError vs SpeechRecognitionErrorEvent onError)
  - hiding deprecated types that don't appear in the Web IDL and haven't been needed in the glue code prototype yet
  - renaming extension on-types that have been renamed from the Web IDL
  - hiding custom events, which then need to be added to the prototype by hand
  - prefixing some events with the correct web library

Change-Id: I6ab944d74ede6d8a2178bbf9aa580a6ab7d67a77
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259063
Commit-Queue: Riley Porter <rileyporter@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2022-09-14 17:55:03 +00:00
Ryan Macnak 596a982286 [vm] Initialize DartInitializationState in a way MSAN will accept.
TEST=msan
Change-Id: I33cf5c340ed89ce14141282e9a743acc6803f14b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259061
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-09-14 17:38:29 +00:00
Paul Berry 625357cc3b AstBuilder: add a temporary data structure for parenthesized conditions.
Previously the AstBuilder used a temporary ParenthesizedExpression
node for this purpose.  Using a custom data structure belonging to the
AstBuilder is less hacky, and paves the way for supporting more
complex conditions (such as those that arise in the `if-case`
construct in the "patterns" feature).

Change-Id: I623cf484d400aef44e835ee95a55903d80aa11a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259105
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-09-14 17:31:38 +00:00
Paul Berry 22a405bf8a Add a test case for #44394
This issue (Migration tool null safety detection fails when tests use
path imports) was reported in December of 2020 and I can't reproduce
it.  I believe there have been changes in analyzer package resolution
since then, aimed precisely at helping users who use this sort of
improper path import.  So it is likely that those changes fixed this
bug.

I'm adding a test case to ensure that the bug isn't accidentally
un-fixed by future changes.

Bug: https://github.com/dart-lang/sdk/issues/44394
Change-Id: I81490e545aa41196c3c69bc4d74cd481079d59ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259200
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-09-14 16:10:42 +00:00
Johnni Winther 6795c753fd [cfe] Handle unnamed extensions in parts
This introduces a MemberName abstraction that supports the late
computation of member names, taking privacy and synthesized names
of unnamed extensions into account. With this feature, the unnamed
extension are now more directly handled as having no (known) name
which avoids the clash between the eagerly synthesized named of
unnamed extensions in different parts.

Closes #48765

TEST=existing

Change-Id: I62c00ace017141ecbc61eeecb275d0211f341c82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258800
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2022-09-14 14:44:12 +00:00
Danny Tuppeny 15dfda917a [analysis_server] Support inlay hints for parameter names
Change-Id: I436d3e460759f58d6a87e8cc8742b0c7736f4f5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259181
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-09-14 14:17:02 +00:00
Chloe Stefantsova 8d5e20eb8f [cfe] Add temporary testing framework for pattern desugarings
Part of https://github.com/dart-lang/sdk/issues/49749

Change-Id: Ifb46078eb24b5c5288847ae95f1a0e584830335e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259180
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-09-14 13:55:52 +00:00
Aske Simon Christensen 35e35f5786 [dart2wasm] Support different default values within the same selector
Default parameter values are implemented in dart2wasm via caller-side
substitution. When the same parameter has different default values
across different implementations within the same selector, a
special sentinel value is passed by the caller, and the callee
checks for this value and substitutes the actual default value.

Change-Id: I8235145f93c2aee7e9ef603456380253b836fcef
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259040
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-09-14 13:43:52 +00:00
Aske Simon Christensen 99ad190028 [dart2wasm] Implement super tear-offs
Change-Id: I7686a1a1ae4f91e1ffe6f6dd6c3d2f7c4341f80b
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258924
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-09-14 13:43:52 +00:00
Aske Simon Christensen 8ae4802e05 [dart2wasm] Dummy isolate patch
Change-Id: Id748ef2f69c09592513ba6a3cffafc37a8450d00
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258921
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-09-14 13:43:52 +00:00
Aske Simon Christensen 33a5b3e270 [dart2wasm] Implement instantiation constants
Change-Id: If602ecc06fabf2581484b90547d0dbcfbb5d30e0
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257362
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-09-14 13:43:52 +00:00
Ömer Sinan Ağacan 5c2efead72 Delete tests for wasm package
The package 'wasm' was moved to https://github.com/dart-lang/wasm in
063d0ef286.

Some of the tests for this package in pkg/wasm/test were duplicated
(probably with some changes) in tests/lib/wasm, and the commit that
moved the package to the new repo forgot to remove those duplicated
tests. This commit removes them.

Change-Id: I24ecbab99a383319482a2220623449bd516e6528
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258926
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2022-09-14 13:34:03 +00:00
dependabot[bot] 8644b02080 Bump github/codeql-action from 2.1.21 to 2.1.22
Closes https://github.com/dart-lang/sdk/pull/49948

GitOrigin-RevId: a97ee973289227457632d629a2696d5e0ceaddf9
Change-Id: I69a1b63bf4749450791e4c2397d504203df88134
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258762
Reviewed-by: Alexander Thomas <athom@google.com>
2022-09-14 12:59:33 +00:00
dependabot[bot] b27caa6717 Bump ossf/scorecard-action from 1.1.2 to 2.0.2
Closes https://github.com/dart-lang/sdk/pull/49947

GitOrigin-RevId: 8ff482cc9b970be62d47f69ecfad0c4c46f7fd07
Change-Id: I76786b291d578be3e07e5805a93fac46273f9237
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258760
Reviewed-by: Alexander Thomas <athom@google.com>
2022-09-14 12:59:08 +00:00
Kallen Tu aad35b490f Remove dynamic invocations in error handling in directory_impl.
Change-Id: Idb1ac4490efd74a2ff98a3d9f0c57a74299ce413
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258512
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-09-14 07:24:53 +00:00
Nate Bosch 4198020cce Bump shelf to ca731ab09eba26d6e301fbc882a65621cb3cfed4
Changes:
```
> git log --format="%C(auto) %h %s" 6f80ea1..ca731ab
 https://dart.googlesource.com/shelf.git/+/ca731ab Add a poweredByHeader argument to server (#272)

```

Diff: https://dart.googlesource.com/shelf.git/+/6f80ea14fcd13c911bd31d32260bf1f97ad799b1~..ca731ab09eba26d6e301fbc882a65621cb3cfed4/
Change-Id: I6f828214c084591ca5e9827ab2f6de07b626fbbe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259107
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Auto-Submit: Nate Bosch <nbosch@google.com>
2022-09-13 23:50:01 +00:00
asiva 3cdeb58c98 [VM/Runtime] - Use 'const' qualifier for CObject typed data
Addresses https://github.com/dart-lang/sdk/issues/49827

TEST=ci

Change-Id: I525cc27d0bf01945d4f700f48355a3f17e297007
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256602
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2022-09-13 22:38:22 +00:00
Brian Quinlan 2ead86ab9d Implement anonymous pipes and the ability to transmit them between processes using Unix Domain Sockets.
Change-Id: I9c9f4ec0e99075a29c6f4d97c503e759134eb094
TESTED=Unit tests
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257804
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2022-09-13 21:16:28 +00:00
DEPS Autoroller e324ada968 Roll Dart Documentation Generator from c64f800bd6a7 to b0b0d6ace017 (8 revisions)
https://dart.googlesource.com/dartdoc/+log/c64f800bd6a7..b0b0d6ace017

2022-09-13 srawlins@google.com Use toList(growable:false) more (#3151)
2022-09-13 srawlins@google.com Make Warnable.package non-nullable (#3155)
2022-09-13 parlough@gmail.com Update scorecard action to v2.0.3 (#3162)
2022-09-13 srawlins@google.com Bump to 6.1.1 (#3161)
2022-09-12 srawlins@google.com Allow analyzer 5.0.0 (#3160)
2022-09-12 srawlins@google.com Make Extension.typeParameters late final (#3150)
2022-09-12 srawlins@google.com Fix HTML of features (#3147)
2022-09-12 srawlins@google.com Improve assert of function typedef (#3158)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/dart-doc-dart-sdk
Please CC dart-ecosystem-gardener@grotations.appspotmail.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Dart Documentation Generator: https://github.com/dart-lang/dartdoc/issues
To file a bug in Dart SDK: https://github.com/dart-lang/sdk/issues

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

Tbr: dart-ecosystem-gardener@grotations.appspotmail.com
Change-Id: I96e0843c13d07f35e1bab57cacaddd747f54e00b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259081
Commit-Queue: DEPS Autoroller <dart-autoroll@skia-public.iam.gserviceaccount.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-09-13 19:31:20 +00:00
Konstantin Shcheglov 3945c9aa71 Use builders in AstBuilder to build ClassDeclarationImpl, etc.
Relatved to https://dart-review.googlesource.com/c/sdk/+/259020

The goal is to avoid the need to update NodeListImpl.
I'm not 100% sure that we can fully achieve this, there is at least
one more place with switch / case.

Change-Id: Ic7468a7b9ded817b3315902cefdeaa7428ec6857
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259100
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-09-13 18:30:27 +00:00
Brian Wilkerson d1fbc73bf1 Add tests for selectionRange and signatureHelp with records
I don't believe that we need to implement anything new for these two
protocols to work correctly, and these tests are intended to demonstrate
that that's the case. The tests aren't intended to be exhaustive, but if
there are areas that you think should be tested, or aspects of the
protocols that you think might be impacted by records, please let me
know.

Change-Id: Id37fa4764b5d1d69cb7fb31f1a035e517043e96a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259060
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
2022-09-13 17:37:18 +00:00
Paul Berry a7cebc7349 Shared type analysis for patterns: Refactor VariableBindings logic.
This change refactors the logic for detecting overlapping and missing
variable patterns so that it can be invoked prior to the rest of type
analysis, rather than during it.  In addition separating concerns
nicely (since no types are involved in these checks), I believe this
will facilitate integration with the analyzer and front end, by
allowing them to detect these errors and find the unique set of
variables defined by a pattern, at the time they are resolving
identifiers to their corresponding declarations.

Change-Id: I40879fca46d39e78a60813db007983e57a3aec31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259021
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-09-13 17:07:48 +00:00
Johnni Winther 4ef2914caa [kernel] Update VariableDeclaration.name comment
Change-Id: I40336a0ea93b5384bd73e7c8810cdac8d029a014
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258925
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Auto-Submit: Johnni Winther <johnniwinther@google.com>
2022-09-13 16:17:07 +00:00
Danny Tuppeny ba479310b3 [analysis_server] Include implicit parameter types in inlay hints
Change-Id: If1b116cfc2a6fac00c20951e702a7d1a978e5421
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258808
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-09-13 16:06:27 +00:00
Danny Tuppeny 1b9adcb502 [dds/dap] Normalise Windows drive letters to avoid missing breakpoints
See https://github.com/dart-lang/sdk/issues/32222.
See https://github.com/Dart-Code/Dart-Code/issues/4149.

Change-Id: I6f975734839ff7cad4d086d5363c0ab03390b966
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258900
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2022-09-13 13:24:47 +00:00
Lasse R.H. Nielsen e4ae0cf2ce Make Uri treat \ as / in path and authority.
When using `Uri.parse` or `Uri(path:..)`, a `\` is treated as, and converted to, a `/`.
This avoids a particular problematic difference in behavior between Dart and the browser's `URL` functionality. There are still examples where the two differ in interpretation of the same code, but in those cases, the Dart `Uri` will most likely end up without a host name, which should be easily detected.


Change-Id: I798df6c3c27c6d64fb9fc8dc30d90b06ba5a9004
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258120
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-09-13 11:48:19 +00:00
Chloe Stefantsova b5972073a9 [cfe] Add WildcardBinder and ListBinder internal AST nodes
Part of https://github.com/dart-lang/sdk/issues/49749

Change-Id: Ic47effd09ebb38568a9c7847e658d22f03b2d873
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258806
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-09-13 09:00:08 +00:00
Alexander Thomas 14da46cfaa [release] Add changelog for 2.18.1
Change-Id: I754a5ae6a52e3be01dd90491f11dd642f77a5ec9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258923
Reviewed-by: Michael Thomsen <mit@google.com>
2022-09-13 07:58:49 +00:00
Aske Simon Christensen 72797a3761 [dart2wasm] Make type parameters available in async return types
Change-Id: I117647010dfe2f6b60b5124d99ad250af4a491be
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258805
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2022-09-13 07:03:18 +00:00
Aske Simon Christensen 98055e5b86 [dart2wasm] Fix vtable offsets for closures with named parameters
Change-Id: I4a2916e52d371937d11b2b6d5c878355b55e742b
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258804
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2022-09-13 06:49:08 +00:00
Alexander Markov e36a39437c [vm] Record field access operations
TEST=language/records/simple/literals_and_field_access_test
TEST=language/records/simple/constants_and_field_access_test
TEST=language/record_type_test

Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: I727b6ced0a70fa4f6513cb7bacce5796404e514c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257924
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-09-12 23:16:26 +00:00
Alexander Markov 3cc320d5c8 [vm] Record constants
TEST=language/record_literal_test

Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: Ia24fb1178c4a19761fea65c5c0cc9a0137226e45
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257920
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-09-12 23:12:37 +00:00
Alexander Markov 3ec7cf9c34 [vm] Record literals
TEST=language/record_literal_test

Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: I287586c0adb19fe401d76c7a586133a1fe9f1d1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257264
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-09-12 23:08:17 +00:00
Alexander Markov c94103ae05 [vm] Initial implementation of record instances
TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: I82ba571d1935d616fe3d4d6d579e59eb57d65a43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256804
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-09-12 22:41:57 +00:00
Alexander Markov 9a023aeae9 [vm] Initial implementation of record types
TEST=language/record_type_test

Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: Ib2100c23513395c9fa9c541320eacbb33a2a119e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256802
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-09-12 22:40:57 +00:00
Brian Wilkerson 3744763f3a Add a framework for testing refactorings
This currently isn't working, and I haven't yet figured out why. At this
point I thought it would be faster to ask than to keep guessing.

The problem is that the server is not getting initialized correctly.
There's probably something I don't understand about the way LSP clients
in general (and tests in particular) are expected to operate. I looked
at some of the other tests, but the ones that I looked at don't appear
to be following a common pattern.

Change-Id: I886a210f7b98a14de2f1bc53c2a499cc3462d6dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255100
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-09-12 21:19:07 +00:00
Ryan Macnak 8c577c420c [vm] Add unmodifiable typed data as a type that can be sent with Dart_PostCObject.
Cf. 938a2c81d2

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/49810
Bug: https://github.com/dart-lang/sdk/issues/49825
Change-Id: I8d4a574f12458e88b589d5ee02c68b1f436fb964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257925
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-09-12 19:45:12 +00:00
Konstantin Shcheglov 8f70d95df0 Use TypeAliasElement.aliasedType instead of aliasedElement in analysis_server/..
Change-Id: Ib7c144b12c59a09be98f3a461bd50b5e0a663fa9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258861
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-09-12 19:38:19 +00:00
Konstantin Shcheglov daada3e35d Prepare to publish analyzer 5.0.0 and _fe_analyzer_shared 48.0.0
Change-Id: Ib9f0cab59a6791ed077ed78395cc24d1bf3d482c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258860
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-09-12 19:37:09 +00:00
Devon Carew 5389fd41ed [deps] rev dartdoc, matcher, and webdev
Change-Id: Ie7a41a5ab1094e136550c4c5f549c1cb62371fea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258862
Commit-Queue: Nate Bosch <nbosch@google.com>
Auto-Submit: Devon Carew <devoncarew@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2022-09-12 18:36:56 +00:00
Danny Tuppeny 8e2dbc1cdc [analysis_server] Add support for showing inferred types via inlayHints
Change-Id: I075871df3e6bec89f03f55e1387d479a48123713
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258807
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-09-12 18:26:07 +00:00
Paul Berry 466494f5be Shared type analysis: API adjustments for analyzer and CFE
I've begun prototyping what it might look like to integrate the
current shared type analysis functionality with the analyzer and CFE,
and I've discovered some API improvements that are needed:

- The shared logic now handles the possibility that switch cases that
  share a body have been merged prior to type analysis (because the
  CFE merges them during parsing), in addition to the pre-existing
  functionality which assumed that switch case merging had to be done
  in the shared logic.

- The shared logic now returns several pieces of information as the
  result of a call to `analyzeSwitchStatement`: whether the switch
  statement had a `default` clause, whether it was exhaustive, whether
  the last case body terminates, and the type of the scrutinee.  These
  are all needed by the CFE.

- The shared logic now allows `TypeAnalyzer.errors` to be `null`,
  indicating that no errors should be reported.  This reflects how
  errors are suppressed during top level inference in the CFE.

- If a switch case lacks a `when` clause, this is reported by calling
  `handleNoWhen` rather than passing a boolean to `handleCaseHead`.

- The shared logic now reports the appropriate error when a case
  constant doesn't properly match the scrutinee's static type.

- Information about case labels is now delivered to flow analysis via
  `switchStatement_endAlternatives` rather than
  `switchStatement_beginCase`.  This made it possible to rewrite the
  shared `analyzeSwitchStatement` method in a way that requires less
  bookkeeping, because it no longer has to peek ahead to look for
  labels associated with a given case body.

- `TypeAnalyzer.analyzeExpression` is now responsible for
  understanding that "no context" and a context of `dynamic` should
  both be coalesced to `?`.  The analyzer does this (although it's not
  100% why), and it's definitely "business logic" that eventually
  belongs in the shared type analyzer.

- `TypeAnalyzer.analyzeSwitchExpression` and
  `TypeAnalyzer.analyzeSwitchStatement` no longer receive a list of
  ExpressionCaseInfo / StatementCaseInfo objects describing the cases;
  instead they query for them using a callback.  This reduces the
  lifetime of the ExpressionCaseInfo / StatementCaseInfo objects.  In
  the future, when we have record support, we could replace these
  objects with records, which would then be passed on the stack,
  avoiding any allocations.

- A new hook, `handleSwitchScrutinee`, is called right after visiting
  the "scrutinee" expression of a switch expression or switch
  statement.  This hook is needed by the analyzer to compute
  exhaustiveness.  In a future CL, I hope to move exhaustiveness
  analysis into the shared code as well, which should make this hook
  unnecessary.

- `TypeAnalyzer.analyzeSwitchStatement` now reports an error if a
  switch case completes normally and pattern support is not enabled.

- The test class `_MiniAstTypeAnalyzer` no longer overrides
  `analyzeExpression` to provide a default context type; instead,
  every call to `analyzeExpression` that didn't previously provide a
  context now provides a context of `?`.  Note that not all of these
  are correct, but they are close enough for the unit tests we have
  today.  I plan to fix them in future CLs as I replace this logic
  with shared logic.

- The hook `handleVariablePattern` is now always provided with a
  static type.  Previously, it was only provided with a static type if
  this was the first time the variable was bound in the pattern.

Change-Id: I70e3c5468312a9329fcf4ad2e13749a32d2418e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257487
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-09-12 13:55:37 +00:00
Sergey G. Grekhov 272a10853d [co19] Roll co19 to 3c9ba02a1e4bfc416ff3cd05df512d63deacd885
2022-09-02 sgrekhov22@gmail.com dart-lang/co19#1399. on clause tests added (dart-lang/co19#1416)
2022-09-02 sgrekhov22@gmail.com dart-lang/co19#1399. [Records] Type annotations and record expressions tests updated (dart-lang/co19#1415)
2022-09-01 sgrekhov22@gmail.com Fixes dart-lang/co19#1398. Fix tests that use unreachable code after `Never` (dart-lang/co19#1402)
2022-08-31 sgrekhov22@gmail.com dart-lang/co19#1399. [Records] Typos in subtyping tests description fixed (dart-lang/co19#1414)
2022-08-31 sgrekhov22@gmail.com dart-lang/co19#1399. [Records] Subtyping tests for records added (dart-lang/co19#1412)
2022-08-31 asashour@yahoo.com Fix typo (dart-lang/co19#1413)
2022-08-30 sgrekhov22@gmail.com dart-lang/co19#1405. BytesBuilder tests moved from dart:io to dart:typed_data (dart-lang/co19#1410)
2022-08-30 sgrekhov22@gmail.com dart-lang/co19#1399. Tests for record types. Part 1 (dart-lang/co19#1395)
2022-08-24 sgrekhov22@gmail.com dart-lang/co19#1405. Don't use deprecated API in co19 tests. Update generated files (dart-lang/co19#1407)
2022-08-24 sgrekhov22@gmail.com dart-lang/co19#1405. Don't use deprecated API in co19 tests (dart-lang/co19#1406)
2022-08-23 sgrekhov22@gmail.com Fixes dart-lang/co19#1361. Private fields promotion tests added (dart-lang/co19#1391)
2022-08-23 sgrekhov22@gmail.com Fixes dart-lang/co19#1394. Add missing compile-error (dart-lang/co19#1396)
2022-08-23 sgrekhov22@gmail.com Fixes dart-lang/co19#1403. Added test that `super` cannot be used as an expression (dart-lang/co19#1404)
2022-08-15 sgrekhov22@gmail.com dart-lang/co19#1388. FFI tests fixed for 32-bit systems (dart-lang/co19#1392)
2022-08-11 sgrekhov22@gmail.com dart-lang/co19#1388. FFI test failures fixed (dart-lang/co19#1389)

Change-Id: I2eee6c193eed1ce8a511f3ef5667ded947fbfad8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257700
Reviewed-by: Alexander Thomas <athom@google.com>
2022-09-12 13:00:30 +00:00
Vyacheslav Egorov 912577baec [vm] Follow up to 4a4eedd860
* Avoid calling memmove(dst, nullptr, 0) as this is flagged by UBSAN.
* Avoid hitting a bug[1] in the linker: LLD's identical code folding
(ICF) happens to replace RecordCoverageInstr::DebugName() with
DispatchTable::LargestSmallOffset() because they happen to contain
the same machine code, ICF fails to accomodate that DebugName also
contains a relocation to constant string. To avoid this we simply
eliminate LargestSmallOffset and replace it with a constant. Same for
OriginElement.

TEST=manually tested previously failing tests

[1]: reported https://github.com/llvm/llvm-project/issues/57693

Change-Id: I38637df6475c7670081b7af0a2de75ca37f6f07c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258801
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2022-09-12 12:33:57 +00:00
Emmanuel Pellereau 727e792e77 Revert "[ddc] Add non-null assertions when setting fields"
This reverts commit 27099c121c.

Reason for revert: Breaks google3 (b/246251728)
Original change's description:
> [ddc] Add non-null assertions when setting fields
>
> Fixes: https://github.com/dart-lang/sdk/issues/49918
> Change-Id: I6dddda878afa504bebebb00a80855bac636f8efd
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258220
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Commit-Queue: Nicholas Shahan <nshahan@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I5e3fb1c151a85e11025135b8fc95c65192b33791
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258780
Commit-Queue: Emmanuel Pellereau <emmanuelp@google.com>
Reviewed-by: Emmanuel Pellereau <emmanuelp@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2022-09-12 11:21:06 +00:00
Johnni Winther 96d52d4e35 [cfe] Handle multiple named record fields in constants
This bypasses the hoisting of record elements in constant record literals.
The created let variables would otherwise interfere with the constant
evaluation.

Closes #49915

Change-Id: Ia70387a0f0c435373dc5fcf5cdd526104db8f394
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258363
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-09-12 10:16:16 +00:00