Commit Graph

40117 Commits

Author SHA1 Message Date
Paul Berry bd2d261bc6 Shared type analysis: add support for when clauses and fix label support.
Support for `when` clauses requires flow analysis integration, so that
`when` clauses can promote variables, e.g.:

    f(int x, String? y) {
      switch (x) {
        case 0 when y != null:
          // y is known to be non-null here
      }
    }

Support for labels in switch statements had a small flaw: we weren't
reporting an error in the case where a label shared a case body with a
pattern that tried to bind a variable, e.g.:

    f(int x) {
      switch (x) {

        L: // Error: does not mind the variable `y`
        case var y:
          ...
      }
    }
Change-Id: I0b2bb4721a6b3a8f7898df682b24b75ddb6e44ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256605
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-08-29 03:27:53 +00:00
Paul Berry ac86c134e9 Prototype shared type analysis for switches and variable patterns.
This change introduces the TypeAnalyzer methods
analyzeConstOrLiteralPattern, analyzeExpression,
analyzeInitializedVariableDeclaration, analyzeSwitchExpression,
analyzeSwitchStatement, analyzeUninitializedVariableDeclaration, and
analyzeVariablePattern.  These are sufficient to analyze legacy switch
statements and legacy variable declarations, as well as switch
statements and switch expressions involving either constants or
variable patterns.

Although the code is not used in the analyzer or front end yet, it is
unit tested in isolation, and it's integrated into the existing flow
analysis unit tests.

A few minor tweaks had to be made to flow analysis to support this new
functionality.  There should be no visible effect to existing analyzer
or front end behavior.

Change-Id: Ie8ec31ca92d5f2f7a7f6f6a20ca1baba3c6b28f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256604
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-08-29 03:03:53 +00:00
Brian Wilkerson d40f06ee2a Partial constant evaluation for record literals
Change-Id: I53db27f67ab1244b7e25a08002ae165840c7c012
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256544
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-08-26 21:53:21 +00:00
Brian Wilkerson a3f8672778 Add a highlight kind for record literals
I don't think that there are any other highlight kinds we're going to
want to add, but if you can think of any please let me know.

I'll add code to actually associate the kind with record literals in the
next CL.

Change-Id: I15922984d96c2d0c7d97ea3f3832a95a68172968
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256524
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-08-26 21:22:53 +00:00
Konstantin Shcheglov ac59daa32c Move RecordLiteral resolution into RecordLiteralResolver.
Change-Id: Ia748568e92d572f6371027509ef8722c86f6e4d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256523
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-08-26 21:17:20 +00:00
Alexander Aprelev 0e9b056f39 [vm/resident_frontend_server] Use File.create(exclusive:true) instead of links.
This makes resident frontend server more Windows-friendly, uses recently introduced api to ensure only one file creator succeeds.

Fixes https://github.com/dart-lang/sdk/issues/49706
TEST=ci

Change-Id: I520487f4f198cc2b2e9d656dca85607889723ef2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256543
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-08-26 21:09:11 +00:00
Konstantin Shcheglov dfc82df6f7 Store RecordLiteral(s) in summaries, for default value, initializers, etc.
Change-Id: Ida4f9f4467cc951a167a6700ea0113c100107141
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256580
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-08-26 20:50:42 +00:00
Kallen Tu 78a9f52544 Eliminate dynamic calls with file and subscription in stdio.
Change-Id: I3dbdb2c14729fd1c74e733a59234df5035386cfd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256249
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-08-26 20:21:21 +00:00
Konstantin Shcheglov 5a989a3161 Test that record types named fields like $0 still have different shape with positional fields.
Change-Id: I991fc24a68025f1b01832e759d72c331fbf62d32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256542
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-08-26 20:18:44 +00:00
Konstantin Shcheglov 5bb4ddd2f6 Resolve positional record field access in PropertyAccess.
Change-Id: I1d2adf5188302a3c7548287e02973cbc2a288af8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256522
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-08-26 19:48:20 +00:00
Konstantin Shcheglov e29ac90212 Implement record type resolution in RecordTypeAnnotationResolver, from ResolutionVisitor.
Change-Id: Ia3ab904c05d7800088ca6467d35151821130a523
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256432
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-08-26 19:47:43 +00:00
Brian Wilkerson 088c346ed0 Add some tests of record type assignability
Change-Id: Ic653447e3cb8fe8582131461d838c17e59f33fa8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256428
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-08-26 19:11:01 +00:00
Konstantin Shcheglov d90a389b97 Tests for empty record type annotation.
Change-Id: I1f0b5ae44d8de1cd9ada90da95879267d77d7291
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256426
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-08-26 18:41:41 +00:00
Brian Wilkerson 82da630cb3 Implement an object representation for records for use in constant evaluation
Change-Id: I98be6037067afb0a5f976dc5eccfbd71deef8298
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256520
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-08-26 17:41:27 +00:00
Johnni Winther 2da3806823 [cfe] Handle Record(Index/Name)Get
Change-Id: I9550d1e73b7caf1924596b3208a16f51a8cfcf41
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256362
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2022-08-26 17:10:41 +00:00
Konstantin Shcheglov 3c370fc85d More tests for RecordTypeAnnotation positions.
Change-Id: Iad0b676280e59f93ab8794c79525ee375c677831
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256370
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-08-26 16:54:41 +00:00
Konstantin Shcheglov d1e8cd4e96 Rewrite PrefixedIdentifier with RecordType prefix into PropertyAccess.
When we will have enough time, it would be nice to do such rewrite
for any case when `prefix` is not a `PrefixElement`.

Change-Id: Iec4a75a9d885bd0633ec78d56ce18830f4005606
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256424
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-08-26 16:50:41 +00:00
Gary Roumanis c5a5bb8887 [Frontend Server] Redirect Option
Closes https://github.com/dart-lang/sdk/pull/49820

GitOrigin-RevId: 3a0fbd74e57f918e3b63cae746cccc88f4e2d1a4
Change-Id: Ie311a15dbee82ea2f76bdcebb5a009d1f79b835a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256423
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Gary Roumanis <grouma@google.com>
2022-08-26 16:22:27 +00:00
Johnni Winther f8b6897a44 [cfe] Create RecordType and RecordLiteral
Change-Id: Idd59d5c26b1d695386a14544c1013aea3329b222
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256361
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-08-26 15:59:22 +00:00
Johnni Winther c6576e4bc9 [cfe] Add test for issue 49208
The test shows that the issue is not a CFE problem.

Change-Id: I359d299d9daca25590e17a1a212e6116b745a999
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247549
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2022-08-26 15:07:21 +00:00
Johnni Winther 384e802304 [cfe] Handle empty record literal in body builder
Change-Id: I01eb4aa62baf2cd875eec9d5f61c9a714221c216
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256462
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-08-26 12:16:01 +00:00
Johnni Winther 468beb8cfd [cfe] Add MergedScope
This changes how scopes are computed for libraries and classes
(work on extensions is still pending). The change supports the new
shared scope need for augmentations, in which a declaration on the
origin or any of the augmentations is directly accessible in the
origin and all augmentations.

Change-Id: Ifb76f49bf80fcad2d92a0400b9be623406afb40d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256262
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2022-08-26 12:12:11 +00:00
Emmanuel Pellereau 893d9a8e1a Revert "[pkg/dart2native] Add negative padding check to MachO writer."
This reverts commit 161f8fd942.

Reason for revert: breaks google3 (b/243899439)

Original change's description:
> [pkg/dart2native] Add negative padding check to MachO writer.
>
> This catches an inadvertent partial overwrite of the first section
> in the `dartaotruntime` executable that happens when there's not
> enough padding after the headers. The first section is a text section,
> so unless there are no calls to code in this overwritten portion, there
> are no runtime failures when this happens.
>
> However, having a MachO section which has a file offset within the
> headers is checked by MachO verification code within the `codesign`
> utility when run with the `-f` flag, and thus caused failures in
> certain tests and builds. Note that we only use that flag when
> `codesign` does not have the `linker-signed` option, which is for
> MacOS versions prior to 12.0.
>
> Example failure with this change when this case occurs (e.g., prior to
> the recent clang revert):
> ```
> $ xcodebuild/ReleaseARM64/dart-sdk/bin/dart compile exe -o test test.dart
> Info: Compiling with sound null safety
> Error: AOT compilation failed
> FormatException: The MachO header overlaps with the first 120 bytes of the section contents
> ```
>
> Change-Id: Ib27db910777f61b90f162f7a0bcfa4ba6592a5a0
> Bug: https://github.com/dart-lang/sdk/issues/49783
> Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-mac-release-arm64-try,vm-kernel-precomp-mac-product-x64-try,dart-sdk-mac-arm64-try,dart-sdk-mac-try,pkg-mac-release-arm64-try,pkg-mac-release-try
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256264
> Reviewed-by: Daco Harkes <dacoharkes@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Tess Strickland <sstrickl@google.com>

TBR=kustermann@google.com,dacoharkes@google.com,sstrickl@google.com

Change-Id: Iccf27ffab6c6b6272e366b77c5092b346145e263
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/49783
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-mac-release-arm64-try,vm-kernel-precomp-mac-product-x64-try,dart-sdk-mac-arm64-try,dart-sdk-mac-try,pkg-mac-release-arm64-try,pkg-mac-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256460
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Emmanuel Pellereau <emmanuelp@google.com>
Reviewed-by: Emmanuel Pellereau <emmanuelp@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2022-08-26 09:24:40 +00:00
Konstantin Shcheglov 85dee9748c Specify that 'get element' for FunctionType, RecordType and VoidType always return 'Null'.
Change-Id: I4bbf7aaef2afc3d9ad5d2f7da35a4c8bd9e39caa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256421
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-08-25 21:24:36 +00:00
Brian Wilkerson a95bf31736 Report diagnostics for record types
Change-Id: I9727f73dcfc4d110b5510a066a979ce6d9fd56d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256369
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-08-25 20:35:53 +00:00
Konstantin Shcheglov b2b50f7fc6 Make RecordTypeImpl structured, without elements.
Change-Id: I7e06c728037f2b94609165394a40388979269cc0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256420
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-08-25 19:47:03 +00:00
Paul Berry 7fb9540f09 Initial infrasturucte for sharing type analysis logic.
This change introduces the mixin TypeAnalyzer, which is intended to be
mixed into analyzer and front end classes to provide shared logic for
type analysis of Dart code.  This work is currently experimental, and
not hooked up to the analyzer or front end, but the eventual hope is
that it can replace the logic that's currently duplicated between the
analyzer's ResolverVisitor and the front end's InferenceVisitorImpl.
A secondary goal of introducing this code is to allow some of the
static consequences of the patterns proposal to be explored now, even
before parser support is finished.

To avoid introducing additional code duplication while the project is
in this experimental phase, I'm going to attempt to restrict myself as
much as possible to prototyping functionality that is not yet
implemented in the analyzer or front end.  This initial CL is an
exception; it introduces the method `analyzeIntLiteral`, which
duplicates logic that already exists in both the front end and
analyzer that analyzes integer literals.  I'm doing this because it's
just complex enough to serve as a validation of the basic approach,
and because integer literals will be handy in writing test cases for
the expanded switch functionality in the patterns proposal, which I
plan to work on next.

Although the code is not used in the analyzer or front end yet, it is
unit tested in isolation, and it's integrated into the existing flow
analysis unit tests.

Change-Id: I07c7cd709eec9e8492669f2dc8db57fb7c10798f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255081
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-08-25 18:21:05 +00:00
pq 1519292b7a [dart fix] dry-run individual code run details
Adds details to make applying individual fixes easier.

Example output:

```
3 proposed fixes in 1 file.

foo/baz/main.dart
  annotate_overrides • 1 fix
  prefer_single_quotes • 2 fixes

To fix an individual diagnostic, run one of the following commands:
  dart fix --apply --code=no_duplicate_case_values .
  dart fix --apply --code=unused_imports .

To fix all diagnostics, run:
  dart fix --apply .
```

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


Change-Id: Ibc89388acabe868fe3253d802e03481d853646ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256367
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-08-25 18:11:40 +00:00
Brian Wilkerson 9d1a877082 Generate diagnostics for invalid field names in record literals
Change-Id: I12ece78e257b1265d86114e8c17e6a8c641559e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256364
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-08-25 17:47:06 +00:00
Danny Tuppeny 857a0d2e66 [analyzer] Resolve comment references for inherited members
Fixes https://github.com/Dart-Code/Dart-Code/issues/4114.

Change-Id: I47fe2909e4d09366c1e2f432c31076ba690fac7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256162
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-08-25 14:29:43 +00:00
Jens Johansen 4970534cab [parser] Allow ? to be parsed a part of the type after is/as right before end bracket
Before this was ok:

```
  var x = [a as int?, a];
```

but this was not:

```
  var x = [a, a as int?];
```

Nor was this:

```
list[i as int?];
```

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

Change-Id: I8a169e15b189965ad19ad489e8a0a6f02c09b34b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256300
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-08-25 13:47:22 +00:00
Tess Strickland 0a4cb4d43e [pkg/native_stack_traces] Add support for MacOS universal binaries.
In addition to adding a parser for the universal binary format, this
also requires major reworks to handle files that contain different
DWARF information for different architectures, and how to pass the
architecture down to where it's needed.

Also fix dSYM handling: instead of assuming the name of the MachO file
corresponds exactly to the basename of the dSYM with the extension
stripped, just look for the single file within the
Contents/Resources/DWARF directory.

Also add `unrecognized` enum entries for DW_TAG, DW_AT, and DW_FORM
values that aren't handled.

Issue: https://github.com/flutter/flutter/pull/101586
Change-Id: Ief5edc275ccd1192669252140d128136cd2bed26
Cq-Include-Trybots: luci.dart.try:vm-kernel-nnbd-mac-release-arm64-try,vm-kernel-precomp-mac-product-x64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try,vm-kernel-nnbd-mac-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252821
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-08-25 13:27:24 +00:00
Tess Strickland 161f8fd942 [pkg/dart2native] Add negative padding check to MachO writer.
This catches an inadvertent partial overwrite of the first section
in the `dartaotruntime` executable that happens when there's not
enough padding after the headers. The first section is a text section,
so unless there are no calls to code in this overwritten portion, there
are no runtime failures when this happens.

However, having a MachO section which has a file offset within the
headers is checked by MachO verification code within the `codesign`
utility when run with the `-f` flag, and thus caused failures in
certain tests and builds. Note that we only use that flag when
`codesign` does not have the `linker-signed` option, which is for
MacOS versions prior to 12.0.

Example failure with this change when this case occurs (e.g., prior to
the recent clang revert):
```
$ xcodebuild/ReleaseARM64/dart-sdk/bin/dart compile exe -o test test.dart
Info: Compiling with sound null safety
Error: AOT compilation failed
FormatException: The MachO header overlaps with the first 120 bytes of the section contents
```

Change-Id: Ib27db910777f61b90f162f7a0bcfa4ba6592a5a0
Bug: https://github.com/dart-lang/sdk/issues/49783
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-mac-release-arm64-try,vm-kernel-precomp-mac-product-x64-try,dart-sdk-mac-arm64-try,dart-sdk-mac-try,pkg-mac-release-arm64-try,pkg-mac-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256264
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2022-08-25 11:02:11 +00:00
Chloe Stefantsova ddff459c7f [cfe] Add RecordType, RecordLiteral, and associated nodes
TEST=Covered by upcoming language and co19 tests.

Change-Id: Ibe8ecfb7f854adce5646125f6909066e27424665
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256066
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2022-08-25 10:33:35 +00:00
Johnni Winther 1bf33f5345 [cfe] Change LibraryBuilder.origin to use effective origin
This updates the SourceLibraryBuilder.origin to return the effective
origin library and not just the immediate origin. In case of an
'import augment' in a part file, the immediate origin is set to the
part "library". Since the part is not a real library, the augmentation
library should not (try to) depend on that library but instead the
library containing the part.

Change-Id: I8ca1345c2e7c5bef71a7a1f9bed41a3bc4e538d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255256
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-08-25 07:10:20 +00:00
Jens Johansen 7aeea765d8 [parser] Parse record type return types for functions taking type parameters
Fixes https://github.com/dart-lang/sdk/issues/49794

Change-Id: Ie80497bcfcda42cfb082240346ed547586742598
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256203
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-08-25 06:10:03 +00:00
pq 103a2fa642 [dart fix] detect and report un-enabled lints
Change-Id: Ie113348ae442f93ae2ea49afb2ed1b0305a6da03
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256245
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2022-08-25 04:23:12 +00:00
Brian Wilkerson 38ed71630c More fixes for AstBuilder related to record types
Change-Id: I01f840ae2a83afb5e940c543d529e4878386a7a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256246
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-08-25 04:09:41 +00:00
pq c0e74c4433 [dart fix] report undefined diagnostics
Fixes: https://github.com/dart-lang/sdk/issues/49699

Change-Id: Ia412e4dce51b0887c3cd0d9b6d91f0ace926bea3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256243
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2022-08-24 20:35:59 +00:00
Sam Rawlins 7dfe682557 Migration: _task is non-null
Change-Id: I5af61a0e8748d011b9c896ac23bc0bc82e08ae59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256240
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-08-24 20:29:40 +00:00
Brian Wilkerson 310d6d0660 First draft of some process docs for the analyzer
I'm not sure that the list of "features" (that isn't the right word here)
is either correct or complete. I'm happy to fix it as part of this CL;
I'm also happy to land this as-is and let someone else fix it if that's
easier.

Change-Id: I9aa56e8eb1116478eedd0b37c91b8197e89809ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256217
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-08-24 19:58:41 +00:00
Danny Tuppeny ece330a700 [analysis_server] Include annotation completions at end of class
Fixes https://github.com/Dart-Code/Dart-Code/issues/3182.

Change-Id: I93d7606cbbf9c527f31dcf9d0fb502dac581abc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256068
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-08-24 19:25:39 +00:00
Brian Wilkerson 2f3c69c361 Rename a subdirectory under doc to match what analysis_server has
Change-Id: Ibb4447511570a61b71a8c92cf6d7fe738d6054a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256216
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-08-24 19:00:39 +00:00
Liam Appelbe 00f032a641 [ VM / Service ] Add isolateGroupId to IsolateRef and Isolate
This will reduce the number of RPCs we need to do in package:coverage.

Benchmarked on a bunch of flutter test suites, and it halved the time
spent gathering coverage, bringing package:coverage's performance in
line with flutter's custom coverage collector. This unblocks migrating
flutter test to package:coverage.

Bug: https://github.com/flutter/flutter/issues/108313
Change-Id: I27651c7ce356d8b20c9c88444ad25d7677795a6d
TEST=Updated existing tests
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255720
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2022-08-24 18:40:49 +00:00
Brian Wilkerson 2b27d3257b Report duplicated field names in record literals
Change-Id: Ifc5c3a06c7f489b00421f5b1af47df52615694d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256200
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-08-24 16:33:49 +00:00
Brian Wilkerson 65b4621a09 Fix an exception when a record type appears in an extends clause
Fixes https://github.com/dart-lang/sdk/issues/49801

Change-Id: I829abcc3c1c52cfff47b424e0915961b68cdd2ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256215
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-08-24 16:33:19 +00:00
Lasse R.H. Nielsen 8a883fa54d Change : to = for default values in pkg.
Leaves some in parser test:
 pkg/front_end/parser_testcases/error_recovery/keyword_named_formal_parameter_prime.dart

TEST=Refactoring, covered by existing tests.

Change-Id: I7a83ef95df3cbd283878b3685b5c747bd89a1b16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256125
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-08-24 15:57:16 +00:00
Danny Tuppeny 177147bac3 [analysis_server] Improve handling of document modifications while computing completions
This prevents an issue where typing during completion can cause completion requests to completely fail (returning 0 items) just because snippets couldn't
be computed.

Change-Id: I20fb457a700ec12317d0146b3364e6f1a4f96177
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256214
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-08-24 15:53:00 +00:00
Johnni Winther dbac2a4df3 [cfe] Add InternalRecordLiteral
This adds support for handling record literals in the BodyBuilder,
passing and handling it in the inference visitor. The correct
AST node is still not produced.

Change-Id: Ifc1e22f3ed30ddde7058ff666117e02d43a4c6a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256210
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-08-24 15:29:39 +00:00
Martin Kustermann 4193bb3846 [analyzer] Remove the [ImportedElement] class
When running analyzer on flutter and it's transitive sources, it
consumes around 480 MB of memory.

The [ImportedElement] class is an intermediatey wrapper around an
[Element] and a boolean that is mostly false.

This CL removes the [ImportedElement] class and stores the boolean
side-information alongside the element in [PrefixScope] and
[PrefixScopeLookupResult].

This saves around 15.5 MB of memory.

TEST=ci

Change-Id: I94692a9709c70decd90c604bbdc85f5b308b3006
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256029
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-08-24 13:53:49 +00:00