Commit graph

41337 commits

Author SHA1 Message Date
Sam Rawlins e1acab8071 [analysis server] add fix for dangling_library_doc_comments
Change-Id: I5bd3ce04fc85a698983cbbd04bab61fedadfca6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272481
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-11-29 20:00:41 +00:00
Devon Carew 1dd71b412f [dartdev] contribute a 'dart bug' command
Change-Id: Ib5557711df23d3a3e0485378c04ff6264194717f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269750
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-11-29 16:58:58 +00:00
Jens Johansen 56c416430e [analyzer] LSP 'get implementations': get lineInfo directly
Asking for implementations of 'ToJsonable' from
package:analysis_server/lsp_protocol/protocol_special.dart takes
8+ seconds both on first request and on subsequent requests.

Turns out most of that is spent on getting line info data for each
result via `server.getLineInfo`.

This CL rewrites how the search is performed, getting all subtypes
directly via `searchAllSubtypes`, from which one can cheaply get the
line info.

On my machine, the call that always took 8+ seconds before now takes
<2 seconds (at least on subsequent runs).
Notice that the time also depends on how much is open by the editor and
that calls from my editor with many folders open still takes ~6 seconds.

This CL furthermore adds more performance measurements that's available
via the "Analysis Server Diagnostics" page "Timing" for
"textDocument/implementation" requests.

Change-Id: I2e5ef20238901fb4734cc182aeb53adfc96f79b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272360
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-11-29 08:19:42 +00:00
Konstantin Shcheglov 2b5608d690 Fix parsing switch statement with SwitchPatternCaseImpl when the patterns feature is disabled.
Bug: https://github.com/dart-lang/sdk/issues/50553
Change-Id: Icd87d422ebf899d4a0d56ab4b7e476ab60949ad4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272387
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-11-29 03:02:30 +00:00
Konstantin Shcheglov 0b7124729d Use late final 'folderWithExamplesApi' for examples/api.
Change-Id: I5d02f0656e914a87dff33532c3835a373472104a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272352
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-11-29 02:56:33 +00:00
Konstantin Shcheglov f85734d220 Remove AstTextPrinter and its tests.
I don't remeber anymore *why* I implemented it.
And it causes a failure in https://dart-review.googlesource.com/c/sdk/+/272387
because we started dropping some tokens, so we cannot restore the
same source code.

Change-Id: I886122e488715ba35347662268b207a99945cd90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272440
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-11-29 01:29:57 +00:00
Brian Wilkerson 6e4b689bba Add documentation for the newest diagnostics
Change-Id: If32e96b6bb2591f2f1ba72265e7437a37a66ac5b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272386
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-11-28 23:51:38 +00:00
Srujan Gaddam ed0ac1936a Reland "[pkg:js] Disallow using @staticInterop synthetic constructors"
This reverts commit aa252e907e.

Reason for revert: Flutter engine is migrated to not use synthetic constructors.

Original change's description:
> Revert "[pkg:js] Disallow using @staticInterop synthetic constructors"
>
> This reverts commit aab6ab8b84.
>
> Reason for revert: Broke Flutter roll https://github.com/flutter/engine/pull/37838
>
> Original change's description:
> > [pkg:js] Disallow using @staticInterop synthetic constructors
> >
> > Change-Id: I5c74369ee8ae97fcc21032464fcb8fea987022d9
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268107
> > Reviewed-by: Joshua Litt <joshualitt@google.com>
> > Reviewed-by: Riley Porter <rileyporter@google.com>
> > Reviewed-by: Sigmund Cherem <sigmund@google.com>
>
> TBR=sigmund@google.com,joshualitt@google.com,rileyporter@google.com,dart-scoped@luci-project-accounts.iam.gserviceaccount.com,srujzs@google.com
>
> Change-Id: I6caf4b776191e8eed9877c43f900ae6300f1f5c2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271440
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Commit-Queue: Srujan Gaddam <srujzs@google.com>
> Reviewed-by: Srujan Gaddam <srujzs@google.com>

# Not skipping CQ checks because this is a reland.

Change-Id: Iaa538bb5f309a46c320bf1781c3d1a7148ec7be7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271500
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Riley Porter <rileyporter@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-11-28 23:41:02 +00:00
Konstantin Shcheglov e80b9bde80 Report REFERENCED_BEFORE_DECLARATION for if statement/element, pattern variable declarations.
Change-Id: I844f186d504abf69b7524017ac9be27fdcef5ff6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272385
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-11-28 23:36:38 +00:00
Nate Biggs ad14e5d67c [dart2js] Add universe/member_hierarchy.dart
This will be used from DynamicCallSiteTypeInformation nodes to get a list of receivers for dynamic calls. The InferrerEngine will also use it to calculate overrides of a given function and mark them as called.

Change-Id: I5738e393ae2de4cb93fd55c60e944a2db067b448
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266422
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2022-11-28 23:26:08 +00:00
Paul Berry 2a9491b613 Rename looksLikePatternVariableDeclaration.
The new name, `looksLikeOuterPatternEquals`, is a more precise
description of what it does.

This helps prepare for adding parser support for pattern assignments,
which require the same functionality.

Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: Ibfcc4c37faac1770c98a427facdffda5c40e6d08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272344
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-11-28 21:33:41 +00:00
Paul Berry e69a503610 Patterns parsing: Add logEvent call to Listener.handlePatternVariableDeclarationStatement.
Normally, listener methods call `LogEvent`.  This helps find bugs
where a listener that extends `Listener` doesn't implement a necessary
callback.

Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: Ideac739d8d63cda2244572f7d1deb83dceeced37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272346
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-11-28 21:27:39 +00:00
Nate Biggs 456ca8a264 [dart2js] Delete hashCode implementation on TypeInformation.
This hashCode is rarely used today so there shouldn't be any significant change from this. But in terms of code health it's better to remove this now.

Change-Id: Iff3ea93a4d82c3977ca7903888def7cbcb2f138f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272401
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2022-11-28 20:51:38 +00:00
Stephen Adams 72f429d63b [dart2js] Prepare to migrate ssa/optimize.dart
Change-Id: I1cb0fc08fa4682c0ec13fb8e101ebaaa34bc76bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271860
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2022-11-28 20:45:00 +00:00
Nate Biggs 3121b8e3ed [dart2js] Fix goldens for dump info tests (bots failing).
Change-Id: I2c4a56f7e9f7073705b56ebe7a7b819458a1f794
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272400
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2022-11-28 20:19:37 +00:00
Sam Rawlins 4d5426b35a analysis_server: Refactor disk reads for examples directory
Fixes https://github.com/dart-lang/sdk/issues/50542

One primary principle is keeping the cost for _most code_
extremely low. Most code does not have an `examples/api`
directory. Most comments do not have `{@tool`.

Looking for directories on disk is expensive. Walking tokens
in comment text is cheap. So we can pay the price of walking all comments, prowling for `{@tool` text which we won't likely find,
and skip the work of looking for `examples/api` in _all_ parent
directories, until we find a comment with `{@tool`.

Don't check if `$parent/examples` exists before checking if `$parent/examples/api` exists. We don't care if `$parent/examples`
exists.

Don't create an `AanlyzerConverter` instance for _every element_
in a compilation unit while we are editing it. Instead, refactor
some of the `AnalyzerConverter` methods to be extension methods.

Change-Id: I812a1a435ee075e921782c1a57e9ed77325f9387
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271863
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-11-28 19:53:01 +00:00
Kallen Tu f12fa86c45 [cfe] Make named mixin applications non-constructable and abstract if sealed.
Special syntax for mixin applications should be also abstract if we add the sealed modifier.

Change-Id: I3af3e997734f4bc762dc29bfc3f61f2e691ca41b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271840
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-11-28 19:44:58 +00:00
Dmitry Zhifarsky 2b7b4dc777 [analysis_server] Fix CodeAction LSP dynamic registration config
Bug: https://github.com/dart-lang/sdk/issues/50531
Change-Id: I35a3c05a70a4ffe9ae0bbfb13874eddfaa302b25
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272260
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-11-28 18:53:47 +00:00
Paul Berry a3befd399a Add support for ... inside map patterns
Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: I350eb526e67e4cc42c94b4776e5d38315932ddc5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272382
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-11-28 18:34:58 +00:00
Sam Rawlins eaff33f439 analyzer_utilities: tidy static analysis
* Stop using `implicit-casts: false`
* Don't list rules which are found in package:lints
* Fix strict-inference issues

Change-Id: Ibe350548e3d6bef486ef2ef82430cda23d684baf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271780
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-11-28 18:11:03 +00:00
Danny Tuppeny f2b4152159 [analysis_server] Include pubspec+analysis_options fixes in LSP Code Actions
Fixes https://github.com/dart-lang/sdk/issues/50306.

Change-Id: Ia9331887ee72c7ecff757557e3903ed1711ada39
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271364
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-11-28 16:46:04 +00:00
Paul Berry f22c4580e4 Fix patterns parsing when EOF encountered during potential pattern variable declaration.
Fixes #50563.

Bug: https://github.com/dart-lang/sdk/issues/50563
Change-Id: Icc1e38c0775bd1fab7ed717f24932dea47dd2990
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272342
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-11-28 16:36:08 +00:00
Jens Johansen 78fc03c7b0 [analyzer] SearchedFiles.add doesn't need File
Currently a File is created to make a lookup in a map with the key
being looked up being "file.path". I've seen examples where creating
this File - because of the call `FileSystemEntity._toUtf8Array(path)` in
`_File` (from the SDK) - adds 1+ seconds to a request.

Specifically, asking for implementations of 'ToJsonable' from
package:analysis_server/lsp_protocol/protocol_special.dart goes from
taking ~12.8 seconds to taking ~11.5 seconds (with enough workspace
folders open).

Change-Id: I838f7fb15f39f95b63697530336d930319961a40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271700
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-11-28 09:46:27 +00:00
Konstantin Shcheglov ba097c6b7c Check SwitchPatternCase for DUPLICATE_DEFINITION.
Change-Id: I3e83bc935589ea790962009195bd88f0c8842fda
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272121
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-11-27 03:43:19 +00:00
Konstantin Shcheglov cdf22210f2 Report DUPLICATE_DEFINITION for pattern variables.
Change-Id: I66e8049ac950c9c8fdce6214f9726af83813a881
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272120
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-11-25 17:08:27 +00:00
Johnni Winther 076c85682d [cfe] Update patterns expectations
Change-Id: I08de1fff9096b64d1e838c975a1659f4a960fc9f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272181
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2022-11-25 14:55:36 +00:00
Johnni Winther f85185aaa0 [cfe] Handle patterns in switch cases in BodyBuilder
Change-Id: Ib52a0cd077e1cd056cd5150b8b1fddf867aef3ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271706
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-11-25 12:33:40 +00:00
Konstantin Shcheglov 7759f7fe03 Resolve PatternVariableDeclarationStatement
Change-Id: Ied7bcde49729608028eb5b62102f756b565a858f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272080
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-11-24 21:03:07 +00:00
Chloe Stefantsova 8b12c0c6fb [cfe] Desugar BinaryPattern
Part of https://github.com/dart-lang/sdk/issues/49749

Change-Id: I98dd7d63c560eb4c48350c32826e51df1491d9d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271708
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2022-11-24 17:45:05 +00:00
Johnni Winther c251133418 [cfe] Handle record constant equality
Closes #50514
Closes #50515

Change-Id: I942867b3a1fc331428108f63e2b97b8b008c1d55
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271921
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-11-24 16:38:53 +00:00
Chloe Stefantsova 1a8b1370a0 [cfe] Don't emit throw of AbstractClassInstantiationError
Change-Id: I4e464bdf1decf8484cd042e973e916b5aa3b8d1c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271960
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-11-24 16:35:51 +00:00
Chloe Stefantsova 88a23c1c57 [cfe] Desugar RecordPattern
Part of https://github.com/dart-lang/sdk/issues/49749

Change-Id: Ibe09a7de3a664323afd18e27fc8902fb6c3f4842
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271361
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2022-11-24 14:56:56 +00:00
Aske Simon Christensen 6f4d84fd60 [dart2wasm] Clarify run instructions
Change-Id: I693a1adf3c028656864014f7c41bad481bb8b106
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271881
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2022-11-24 14:52:25 +00:00
Johnni Winther bf3e520203 [cfe] Add test for issue 50182
Change-Id: I6b596e46f929c95cf79bdd784a99e0fcc591852d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271707
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2022-11-24 14:19:58 +00:00
Chloe Stefantsova 563ef79195 [cfe] Desugar MapPattern
Part of https://github.com/dart-lang/sdk/issues/49749

Change-Id: Ic2b555a4384187b358e001ea29755ca14588decd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271366
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2022-11-24 13:00:09 +00:00
Ömer Sinan Ağacan 0da441713e [dart2wasm] Don't assign offsets to selectors for dynamic calls
With a06f10c we started to generate direct calls in dynamic invocations
so we no longer need dispatch table entries for members that are only
invoked in dynamic invocations.

Change-Id: I29efd7f1486126c91f4286c84878b16db9c36a05
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271880
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2022-11-24 12:33:46 +00:00
Chloe Stefantsova 722109d61b [cfe] Remove the use of the fall through exception
Change-Id: I6a6dc5e6d676e3d2260c4192a0f3700d8ff403c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262203
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-11-24 11:14:56 +00:00
Konstantin Shcheglov 16da66f3be Resolve rest elements in list patterns.
Change-Id: I95c210bde168b09c86a7a42ff984b5728440f7a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271741
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-11-24 06:40:29 +00:00
Kevin Moore d359e07aad [dart2js] Fix test breaks from dump-info change
Follow-up to 67015b7175

Change-Id: I6ead83e66a6dda23029b89fbec509861fa9dadd7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271861
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Auto-Submit: Kevin Moore <kevmoo@google.com>
2022-11-24 03:28:28 +00:00
Kevin Moore 67015b7175 [dart2js:dump_info] put version and program info first...
...more consistent sorting of holdings (improves diffing)

Change-Id: I2f2c418edea1f2dec6b8cc26e8058a5e3855ceb2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271820
Auto-Submit: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2022-11-23 23:30:32 +00:00
Paul Berry fe087f24d1 Add parser support for switch expressions.
Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: I0c58664d44312f5e9d61d24e34e7cd26dbee3a9c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271740
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-11-23 23:04:12 +00:00
Kallen Tu 669856ce4c [cfe] Report error when extending/impl/mixing in sealed classes outside of its library.
Change-Id: I8034cba69ca249c2727dea9641c3076788c6a854
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271164
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-11-23 22:58:21 +00:00
Anna Gringauze 72493a75c6 Make records inherit from core.Object
Towards: https://github.com/dart-lang/sdk/issues/49717
Change-Id: Ie32704a21db51dd713a2f03ce78532ed67fe1792
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270821
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2022-11-23 21:03:58 +00:00
Sam Rawlins 01fba618ed New fix: RemoveNameFromDeclarationClause
Change-Id: I5a877e9dcc54b4c42b37bca5de89ea7f94a1fe6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271563
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-11-23 20:24:00 +00:00
Danny Tuppeny 019fb7a214 [analysis_server] Fix auto-imports not working for plugin completions
Fixes https://github.com/Dart-Code/Dart-Code/issues/4275.

Change-Id: I8c5e80eeebfe814fb95220edcd94da3059cc1b14
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271701
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-11-23 19:53:13 +00:00
Danny Tuppeny e5b8089c27 [analysis_server] Refactor LSP code actions handling
This is mostly* a no-op refactor. This code handler had grown quite messy and all of the quick-fixes code only ran for Dart files (and assumed it had a resolved unit) which complicates fixing https://github.com/dart-lang/sdk/issues/50306 (quick-fixes for non-Dart files).

This change splits the handling into separate classes for each source of code actions (currently just "server Dart" and "plugins" but soon there will be pubspec/analysis_options producers too), then merges each group and sorts that group by priority.

* the one minor change is a code-path that was producing CodeAction literals where the client had not advertised supported this. This is now fixed and the related test updated.

Change-Id: I8837610c64aba3f2c3dcb2f1eb0bc9bf5c43ad62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271360
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-11-23 19:50:58 +00:00
Simon Binder 38ac261884 [analyzer] Add byteStore option for build_resolvers client
At the moment, we always use an in-memory store for computed units and
elements. By persisting this to file and re-using it across builds, we
can speed up subsequent build runs.

Change-Id: I6fca9d96f6961a3a802eb1d4cb21682fc0fcc469
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270400
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Simon <oss@simonbinder.eu>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-11-23 17:55:41 +00:00
Paul Berry 15c8f286d7 Fix parsing of single identifier patterns before when.
There's already logic for addressing similar issues before `as`; I
just had to generalize it.

Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: I09d9c69cd291fe8bc3ebea8181f632ddca0c49e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271580
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-11-23 16:47:29 +00:00
Paul Berry ff18485f72 Add parser support for ... in list patterns.
Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: I31c7003fd40a6e074f2561561d2fba49955cc098
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271565
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-11-23 15:11:50 +00:00
Joshua Litt e7b0d4fa68 [kernel_worker] Support unevaluated constants.
Bug: #50535
Change-Id: Iabdaa1460c74d70a0ae44b60c5ecc9287a9740cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271562
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-11-23 14:40:17 +00:00
Jens Johansen 95c6795d2f [analyzer] Use set instead of list for _contextPathList where .add was guarded by .contains
Doing .contains on a list of n items takes O(n) time.
While - with the ~1600 files in the list when having the analyzer
looking at pkg/analysis_server - going a lookup for all entries will
only take ~10 ms I see no reason not to use a Set.

Change-Id: I2a0848616381203c9b86fc9da8b4d065e391175f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271363
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-11-23 07:23:39 +00:00
Sam Rawlins a030c643cb New fix: move_annotation_to_library_directive
Change-Id: Ifef0a4d5a9c81faf21a6cb39b5fb0fbb525db139
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270780
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-11-23 02:27:31 +00:00
Paul Berry 4f37821b59 Parser: Add assertions to check skipOuterPattern behaviour
The behaviour `skipOuterPattern` needs to be kept in sync with that of
`parsePrimaryPattern`.  To reduce the risk of these to going out of
sync, I've added logic to `parsePrimaryPattern` so that after parsing
an `outerPattern`, it asserts that `skipOuterPattern` would have
behaved appropriately.

This required adding some logic to `parser_test_parser.dart` so that
these calls to `skipOuterPattern` don't show up in front_end parser
expectations files.  (If they did show up, they would lead to
failures, since the bots run the front_end parser tests with
assertions both enabled and disabled).

Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: Ida3a37532bb9a86837e70b5ec1aa2e557e3cb769
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271163
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-11-23 01:26:17 +00:00
Kevin Moore 0a7b6d10a9 [dart2js_info] Fix library size - change a name field no nullable
Otherwise tools.dart library_size crashes

Change-Id: Iba72c273eea6d550c2ecf1193f44111f55ca4c22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271564
Reviewed-by: Nate Biggs <natebiggs@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Auto-Submit: Kevin Moore <kevmoo@google.com>
2022-11-23 01:18:27 +00:00
Paul Berry 0037c6c001 Rename extractorPattern to objectPattern in parser and listeners.
This reflects a spec change that was done in
4c83abe1fe.

Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: I282ec073d723294b7c1cd84928d8404a50b0b195
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271162
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-11-22 23:06:10 +00:00
Konstantin Shcheglov 669361a6d0 Add VariablePatternBindElement and VariablePatternJoinElement.
Change-Id: Id4b7cb3ecd75d75ebcc3e500030ffc78964dbdc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271501
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-11-22 22:15:39 +00:00
Konstantin Shcheglov 610587f6fd Extract _resolveGuardedPattern() and use for if-case and switch-case.
Change-Id: I242aaf2311eac908c59de4c464bbc3a63e0836df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271560
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-11-22 21:49:29 +00:00
Ömer Sinan Ağacan c5482b3faf [dart2wasm] Fix tear-off getter generation
Currently we use two `hasTearOffUses` and `tornOff` when deciding
whether to generate a tear-off getter for a member.

These metadata are undocumented so it's unclear how they are supposed to
be used, but `hasTearOfUses` seems to be what we need when generating
references for tear-off getters. For example, in this code:

    class A {
      void f() => print('A.f called');
    }

    void main() {
      dynamic x = A();
      final f = x.f;
      f();
    }

`hasTearOffUses` of `A.f` is true, `tornOff` is false. So the current
condition `hasTearOffUses && tornOff` incorrectly skips the reference.

In addition, I realized in my testing that when `tornOff` is true,
`hasTearOffUses` is true as well. So just using `hasTearOffUses` seems
to do the right thing.

New passing tests:

- corelib/map_unmodifiable_cast_test
- language/closure/bound_closure_equality_test
- language/closure/closure7_test
- language/closure/tearoff_bounds_instantiation_test
- language/function/type3_test
- language/nosuchmethod_forwarding/nosuchmethod_forwarding_test/06
- language/prefix/prefix15_test
- language/unsorted/fast_method_extraction_test
- lib/async/stream_event_transformed_test
- lib/convert/chunked_conversion1_test
- lib/convert/streamed_conversion_json_decode1_test
- lib/convert/streamed_conversion_json_utf8_decode_test

Fixes #50485

Change-Id: Id130649d6e175b84430f9bf967ea01c4d471cd92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271320
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2022-11-22 20:49:06 +00:00
Konstantin Shcheglov 03140fd5f4 Implement analyzeMapPattern() in TypeAnalyzer.
Change-Id: I6b974b930de7971c48f0324a656da02125d05e48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271300
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2022-11-22 19:51:38 +00:00
Ömer Sinan Ağacan a06f10c4c9 [dart2wasm] Generate direct calls in dynamic invocations
Also removes an old TODO about handling null receivers in dynamic
invocations.

Change-Id: I08e14e19084e7186259375b6ac99cde19587dc27
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271322
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-11-22 19:47:02 +00:00
Srujan Gaddam aa252e907e Revert "[pkg:js] Disallow using @staticInterop synthetic constructors"
This reverts commit aab6ab8b84.

Reason for revert: Broke Flutter roll https://github.com/flutter/engine/pull/37838

Original change's description:
> [pkg:js] Disallow using @staticInterop synthetic constructors
>
> Change-Id: I5c74369ee8ae97fcc21032464fcb8fea987022d9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268107
> Reviewed-by: Joshua Litt <joshualitt@google.com>
> Reviewed-by: Riley Porter <rileyporter@google.com>
> Reviewed-by: Sigmund Cherem <sigmund@google.com>

TBR=sigmund@google.com,joshualitt@google.com,rileyporter@google.com,dart-scoped@luci-project-accounts.iam.gserviceaccount.com,srujzs@google.com

Change-Id: I6caf4b776191e8eed9877c43f900ae6300f1f5c2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271440
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2022-11-22 17:28:28 +00:00
Paul Berry 3d625df93a Add comment and metadata nodes to PatternVariableDeclaration.
Bug: https://github.com/dart-lang/sdk/issues/49750
Change-Id: I16f3614795b6b53d2112d6093d3ef7df13abb69c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270921
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-11-22 17:24:42 +00:00
Sam Rawlins f6d66b6ea7 Update fix status file
Change-Id: I9ac3d082720f9176704f1c600d96238f55778a63
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271240
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-11-22 16:24:29 +00:00
Aske Simon Christensen adc8543784 [dart2wasm] Initialize translator fields using a LibraryIndex
This merges the initialization of kernel `Class` and `Procedure`
fields with their definitions, resulting in more concise declarations.

Change-Id: Id7835edb9a29b4ad47ecce06d337f00738063891
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271083
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2022-11-22 15:11:35 +00:00
Aske Simon Christensen 1f4db8ad1f [dart2wasm] Clean out some uses of fields.last
It's more robust to refer to the actual field directly.

Change-Id: I8947fdd11070f71645671ee1df9efa10a994f138
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271103
Reviewed-by: Ömer Ağacan <omersa@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-11-22 15:11:35 +00:00
Aske Simon Christensen 9cea247af4 [dart2wasm] Remove the --string-data-segments option
In WasmGC MVP, the `array.new_data` instruction will not be a constant
instruction. This means we can't implement the option that places
eager string constants in data segments and reads them using
`array.new_data`. We can still do this for lazy strings.

Also clean out the string function generator (which is dead since we
started using `array.new_data` for lazy strings) and the special case
for the empty string (which is obsolete since we started using
`array.new_fixed` for eager strings).

Change-Id: If28bdf6913ae0cd0f4faf7d87d64cb9412e56bb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271120
Reviewed-by: Ömer Ağacan <omersa@google.com>
2022-11-22 15:11:35 +00:00
Johnni Winther 6f54f6236e [cfe] Add AwaitExpression.runtimeTypeCheck
Add AwaitExpression.runtimeTypeCheck to support easy backend
implementation of runtime type check.

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

TEST=pkg/front_end/testcases/general/issue49396.dart

Change-Id: I13b9b14566ebc34cdb0811c16a262421417b68e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270723
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2022-11-22 10:42:22 +00:00
Chloe Stefantsova 414f318a05 [cfe] Cache access to scrutinee members in pattern desugaring
The desugaring is presented as a series of nested if-statements
interleaved with intermediate variable declarations that cache the
results of accessing the members of the scrutinee object. Among other
things, it prevents double access to a list element when checking the
pattern conditions on it and then assigning it into a variable pattern.

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

Change-Id: I5bf0b040c44d150eacef9a727a8a66fd3a9a568d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270701
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-11-22 10:41:31 +00:00
Johnni Winther 0aea9cb1d0 [cfe] Create ObjectAccessTargets for record access
This normalizes the handling of record access to use the
ObjectAccessTarget interfaces. The extension handling of getter/setter
shadowing is now computed in terms of ObjectAccessTargets which
now handles shadowing for functions and records.

Closes #50157
Closes #50513

Change-Id: Ib35ca9f7459016688eecc6d05019b0384f37ab76
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271084
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2022-11-22 09:44:47 +00:00
Sam Rawlins c5729b36d5 Fix runtime errors in instrumentation log_viewer
I encountered these errors while trying the log_viewer on some recent
log files.

Change-Id: If0207659eae717e4fbba28455ceee8815671f081
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270801
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-11-22 00:04:35 +00:00
Sam Rawlins 5f8ef7be53 Enable new linter rules in analyzer packages
Change-Id: Id0182648a347a05cbf6e1483a0afe94219268853
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271000
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-11-21 23:02:38 +00:00
Stephen Adams 419c5fdb91 [dart2js] Cleanup ssa/value_range_analyzer.dart for migration
- Remove the dynamic 'apply' operation from `constant_system.operation`.
- Create all range expressions from ValueRangeInfo.

Change-Id: I008d941141e2b91056173a317f387f0986fce4fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270321
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2022-11-21 22:58:31 +00:00
Ahmed Ashour 972128666d [analyzer] add failing test case
Bug #50496

Change-Id: I80fe20b24a32c6a3b68c8825b976dd9360d4a918
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271201
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-11-21 22:37:24 +00:00
Ahmed Ashour 208d65324a [analysis_server] fix AddMissingEnumCaseClauses with prefix
Fixes #50484

Change-Id: I1bd325d460f0e286e602e215c0cce6a86eae2a3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270700
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-11-21 22:29:37 +00:00
Konstantin Shcheglov 4ba2fdc0fe Add RestPatternElement, ListPatternElement, MapPatternElement.
Change-Id: Icbd312e97c7c03348a1ea5c0d9bea5f4d5ace373
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271180
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2022-11-21 21:54:31 +00:00
Sam Rawlins cd52ce3f22 Enable new linter rules in nnbd_migration
Change-Id: I7ba071c9edc23a53cb2f9bd9a37de8306a10ccef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271001
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2022-11-21 21:46:28 +00:00
Anna Gringauze 112c93863b Add record types
Towards: https://github.com/dart-lang/sdk/issues/49717
Change-Id: Ib2df16184d1db7d191a22305dacaeb1efe595e5c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270581
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2022-11-21 20:49:10 +00:00
Anna Gringauze bca6278b3b Revert "Cache expression compilers in incremental DDC mode"
This reverts commit e6f779bcdd.

Reason for revert: Broke expression compilation in google3

Original change's description:
> Cache expression compilers in incremental DDC mode
>
> - cache expression compilers in expression compiler worker
>   to improve performance of exression compilation.
> - pass module format in expression compiler worker
>   (the ddc format tests were not running!)
> - fix an issue where the same library was imported twice
>   in module_builder.dart
> - add verbose mode timeline logging to ProgramCompiler.
> - update tests.
>
> Closes: https://github.com/dart-lang/sdk/issues/49944
> Change-Id: Ie7408dcd42e757b1eb5e7f5ccbc1b078b6417011
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268361
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Mark Zhou <markzipan@google.com>
> Commit-Queue: Anna Gringauze <annagrin@google.com>
> Reviewed-by: Nicholas Shahan <nshahan@google.com>

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

Change-Id: I6c7209ffb03416dbb8d34c1a6f520f21766d9190
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270840
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
2022-11-21 20:27:43 +00:00
Srujan Gaddam 7d8e63b0b5 [pkg:js] Disallow non-@staticInterop classes from inheriting @staticInterop
Adds checks that if the derived class does not have a `@staticInterop`
annotation, none of the classes it implements or immediately extends can
have it either. Also cleans up some redundant abstract class tests for
readability.

Change-Id: I2e8528b0fb02d9ce39003d00ee0b3da88ce75d44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268109
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Riley Porter <rileyporter@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2022-11-21 20:19:06 +00:00
Srujan Gaddam 4c34e780cf [pkg:js] Require users to use @JS when using @staticInterop
Change-Id: Iea0a54ff03b32bc910ef2c6eb633bffd09cf0671
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268108
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Riley Porter <rileyporter@google.com>
2022-11-21 20:19:06 +00:00
Srujan Gaddam aab6ab8b84 [pkg:js] Disallow using @staticInterop synthetic constructors
Change-Id: I5c74369ee8ae97fcc21032464fcb8fea987022d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268107
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Riley Porter <rileyporter@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2022-11-21 20:19:06 +00:00
Ahmed Ashour 9bea89246a Fix grammar
Fixes #50509

TEST=ci

Change-Id: I7ca115bbe6f436e9df126afddcc08eaba79af2f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270740
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2022-11-21 20:07:29 +00:00
Ahmed Ashour 3556eb571e [analysis_server] RemoveDeadCode to handle forParts updaters
Fixes #43511

Change-Id: I8d717038356444c70e082aab37911791de63bd6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266389
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-11-21 19:59:27 +00:00
Sam Rawlins 8e743ca83c Add fix for CompileTimeErrorCode.SUPER_FORMAL_PARAMETER_TYPE_IS_NOT_SUBTYPE_OF_ASSOCIATED
Fixes https://github.com/dart-lang/sdk/issues/50524

Change-Id: I0d2a32c3c93e48979872592ba371865c695e76cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271060
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-11-21 19:44:02 +00:00
Ryan Macnak 3dfceb5ad8 [vm, service] Fix documentation on the various flavors of reference.
These have always been able to return non-Instances.

TEST=ci
Change-Id: I13e46aae8705ea1f79ec0618cdb815a8ed9c0fdb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270461
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-11-21 19:30:09 +00:00
Nate Biggs 795e35e0af [dart2js] Don't use deferred serialization strategy for Dart2JS info dump.
The info dump processor ends up deserializing most of the deferred data anyway so there is no benefit to the deferred logic. This saves ~600MB on info dump.

Change-Id: Ib9a1154b38594a3f046d5da96b477de9f2c90b9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271041
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2022-11-21 19:29:58 +00:00
Sam Rawlins 6eef2c0649 Add fix for NON_FINAL_FIELD_IN_ENUM
Change-Id: I4eb8125468290af44b65343d620ee2646c2594c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270800
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-11-21 18:42:51 +00:00
Paul Berry ef4f5a3470 Add parser support for patternVariableDeclaration.
Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: I13158547d9200f37eb4434d1792b4d4667a46071
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270920
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-11-21 18:33:05 +00:00
Johnni Winther 22c013724b [cfe] Inline set literal and collection transformations in inference visitor
Change-Id: Iaf3a3a9fd288757280071701461e40057ba7e79d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270000
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2022-11-21 18:30:11 +00:00
Ahmed Ashour 6ab608ac8b [analyzer] DEPRECATED_MEMBER_USE message which ends with period.
Fixes #50518

Change-Id: I5c22eb73133b5591ca3b4ea4c63823fcab0935c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271020
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-11-21 18:07:32 +00:00
Danny Tuppeny 699b42c8e3 [analysis_server] Support adding multiple imports for @overrides completions
Related to https://github.com/Dart-Code/Dart-Code/issues/4116.

Change-Id: I81b9e7bfbe4bbd093770925f9dcb640b72487142
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270181
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-11-21 18:06:35 +00:00
Ben Konyi 3602351df0 [ VM Service ] Add support for '--[no-]serve-observatory'
To prepare for the eventual removal of Observatory, we plan on disabling
Observatory by default while providing an escape hatch to manually serve
the tool for some period of time before completely removing Observatory
from the SDK. This change adds flags that can be used to configure
whether or not Observatory is served.

Currently, '--serve-observatory' is the default behavior, but will be
changed to '--no-serve-observatory' once tooling is ready to support the
escape hatch behavior.

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

TEST=run_test.dart

Change-Id: Ib6d1e1587d9fbd3c61d4a4c75d90635052835844
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267720
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-11-21 17:47:31 +00:00
Paul Berry 22c46e573a Field type promotion: fix CFE handling of abstract fields.
Bug: https://github.com/dart-lang/language/issues/2020
Change-Id: Ie35f7ff2d3de33c5f94bb7b703c13c9764a85c70
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269981
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-11-21 15:25:03 +00:00
Paul Berry a975bf0737 Parser API changes in preparation for supporting patternVariableDeclaration.
Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: I2661b7cbe60815b6232a165d56a478d8975aa6c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270228
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-11-21 14:30:16 +00:00
Paul Berry ac1ad9f393 Update shared analysis of object patterns to match spec.
In
ce01d330d7,
the patterns spec was changed so that if an object pattern's type
resolves to `dynamic` or `Never`, no getters are looked up during
static analysis, and the getter type is simply presumed to be
`dynamic` or `Never`, respectively.

Also, the parameter `requiredType` of `analyzeObjectPattern` is
removed (is was not needed, and the caller always passed `null`).

Finally, the test artifact `ObjectPatternRequiredType` is removed in
favor of just using a PrimaryType directly.  This makes the tests a
little bit more compact.

Change-Id: I6fcef8dab8250905e1d37308bbdc82a4fd65f52c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270982
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-11-21 13:12:00 +00:00
Paul Berry 2d2a15af8f Mini-type testing framework: rename NonFunctionType.
The name was misleading because it only models types whose names take
the form `IDENTIFIER` or `IDENTIFIER<ARGS>`; it doesn't model record
types, promoted type variable types, "question"/"star" types, or the
"unknown" type, which aren't function types either.

"PrimaryType" seems like a good name because it's at the base of the
type grammar.

Change-Id: I6e1916931892f2ef670bc89cfebb198b596b0173
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270981
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-11-21 13:05:08 +00:00
Paul Berry cf4716149d Shared patterns analysis: adjust nomenclature to match spec
Rename `TypeAnalyzer.analyzeInitializedVariableDeclaration` to
`analyzePatternVariableDeclarationStatement`, since the corresponding
grammar construct is called `patternVariableDeclaration`.

Change-Id: I5819a4434349b85974252f8e4da35adeffbc3d7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270980
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-11-21 13:03:57 +00:00
Aske Simon Christensen 2518307779 [dart2wasm] Generic function types
Extend the runtime representation of function types with a list of
type parameter bounds and take these into account when doing subtype
comparisons on function types.

The implementation has a number of limitations for now:

- When converting a function type to a string, the type does not know
  its nesting depth. Function types on all nesting levels thus follow
  the same naming scheme for their type parameters (`X0`, `X1`, ...),
  which can lead to name clashes between type parameters in the case
  of nested generic function types.

- When a generic function is instantiated, the type arguments are not
  substituted for the function type parameters in the type of the
  resulting function object, which therefore has an incorrect type.

- The default types of function type parameters are not explicitly
  represented in function types. When we implement automatic
  instantiation of missing type arguments in dynamic function calls,
  we need to either add the default types to the representation
  somehow or compute them from the bounds.

Change-Id: Ib756d9f8f2b6959efd7ef2e6bc79c7e4793ca3e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269761
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-11-21 10:40:20 +00:00
Aske Simon Christensen 35100862c2 [dart2wasm] Shallow type normalization
Since we normalize types at every step of runtime type construction
(in `Types.makeType` and `ConstantCreator.visitTypeLiteralConstant`)
we don't need to normalize types recursively, except in the case of
`FutureOrType`.

This change avoids creating new type parameters for function types,
which would interfere with construction of generic function types.

Change-Id: I8f7c0ec4348e962ca6e67a9c1224107f73f75474
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270001
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-11-21 10:40:20 +00:00
Konstantin Shcheglov 92908bd8e7 Update analyzeListPattern() and analyzeListPatternSchema() to the new spec, support for rest.
Change-Id: Ia4c88e9307b4b37b163aa35c3ac2b906ed431120
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270483
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-11-21 03:23:37 +00:00
Konstantin Shcheglov 1a59438051 Use single instance of _VariableBinder.
Change-Id: I9cd57705c505a13059afb0f84e5c8ab73c28f747
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270841
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-11-20 19:45:25 +00:00
Ömer Sinan Ağacan d46aa63099 [dart2wasm] Document DispatchTable and SelectorInfo
Some other changes:

- Variable `id` renamed to `classId` in a few places. In this code there
  are two types of IDs: class IDs and selector IDs, and they have the
  same type. So just "id" is ambiguous to the reader.

- `SelectorInfo.sortWeight` and `SelectorInfo.isAlive` getters moved to
  `DispatchTable.build` as local functions

- Most of the members are made private.

- List of selector IDs of a class is now a Set. These lists used to have
  duplicate selector IDs coming from superclasses.

- `DynamicDispatcher.maybeCalledDynamically` special case for
  `noSuchMethod` moved to `SelectorInfo.isAlive`, as the only reason why
  we had that special case is to keep selector for `noSuchMethod` alive.
  `maybeCalledDynamically` inlined in the use site.

Change-Id: Iff650862d57e376913bda67db74bc67466d45e87
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269461
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2022-11-19 09:51:19 +00:00
Sam Rawlins 100f78daf6 Enforce new lint rules in pkg/analysis_server
Change-Id: I2fd938e5bc44f0798429b68524abc5718211c0ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270482
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-11-18 22:36:57 +00:00
Nicholas Shahan bdc13d89bb [ddc] Add public API and DartDoc comments
Followup for https://dart-review.git.corp.google.com/c/sdk/+/266540.

Create a public API to better document the interaction between 
`TypeRecipeGenerator` and `_TypeRecipeVisitor`.

Issue: https://github.com/dart-lang/sdk/issues/48585
Change-Id: Ideeea0e6fa313e77a40e8bc04987c5bf1ed380ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269482
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
2022-11-18 22:15:48 +00:00
Ryan Macnak 9a5dd4707f [vm] Remove "Impl" suffix from VM implementation classes.
This makes things nicer to read in places that display implementation names, such as stack traces, debuggers, profilers and inspectors.

TEST=ci
Change-Id: I959f70d9e51be59801c4455f8c5ccac3c214c21a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270502
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2022-11-18 21:42:59 +00:00
Nate Biggs bdb782ba8f [dart2js] Add mmap-based read to dart2js for linux systems.
Based on Martin Kustermann and Slava Egorov's versions of memory mapped views.

This feature is disabled by default and even if the flag is enabled, it will fall back to the current strategy if the platform is not Linux or the new strategy fails.

Phase 1 stats from 50 runs:
---Before---
Max memory: 8786.766
Median memory: 8116.242
Average memory: 8327.404081632654
---After---=
Max memory: 7805.691
Median memory: 7137.203
Average memory: 7305.301122448978

Phase 2 stats from 50 runs:
---Before---
Max memory: 9273.359
Median memory: 8742.133
Average memory: 8868.929124999999
---After---
Max memory: 9409.672
Median memory: 7500.148
Average memory: 7650.154000000001

Phase 3b stats from 50 runs:
---Before---
Max memory: 8979.367
Median memory: 8705.215
Average memory: 8703.982755102037
---After---
Max memory: 7809.898
Median memory: 7455.609
Average memory: 7449.96102040816


Change-Id: I73d73cfb26218399367c72c886f247836b89925c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269640
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2022-11-18 21:40:38 +00:00
Stephen Adams b8d85b7ad3 [dart2js] loadLibrary priority annotation
Add annotations

    @pragma('dart2js:load-priority:normal')
    @pragma('dart2js:load-priority:high')

The test shows that these annotations are scoped.

This CL is just plumbing the annotation through as an argument to the runtime call to the code that implements `loadLibrary()`. Actual prioritization is not yet implemented.

Change-Id: Iff1404baf34192139dab95e2dbb01c2d4e8dae45
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270283
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2022-11-18 19:22:29 +00:00
Kallen Tu e7c0280487 [analyzer/cfe] Add support for sealed mixins and class type aliases.
Change-Id: I1b875f9569ed09db73bda5fe33e723c8e8ed3b79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270020
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-11-18 19:09:40 +00:00
Konstantin Shcheglov 43a684ad60 Stop using logicalOrPattern(), use or() instead.
Change-Id: I63db2c1a24c41b6c0a639a69802d23ad07d44621
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270600
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-11-18 19:01:18 +00:00
Konstantin Shcheglov e65f0f43ea Resolve if-case statement, make variables available to 'when' and 'ifTrue'.
Change-Id: I1f5074753792aba6ace28f1e2ec8e970fd22fddf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270561
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-11-18 19:00:57 +00:00
Nate Biggs 3d61bef06e [dart2js] Migrate serialization/task.dart to null safety.
Change-Id: Icbba0f1f1ba3d68d4374e15ade41d3a8876510e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270344
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2022-11-18 18:38:12 +00:00
Nate Biggs ec6184f7ef [dart2js] Clean up migration files for common/codegen.dart.
Change-Id: I7b236580cb0ecfa9aa71f4976bd954570b944284
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270343
Reviewed-by: Mayank Patke <fishythefish@google.com>
2022-11-18 18:38:12 +00:00
Nate Biggs ca07c65770 [dart2js] Clean up migration files for js_emitter.
Change-Id: I113f4cb410d4e3372825d9af8c83dbf4af844716
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270342
Reviewed-by: Mayank Patke <fishythefish@google.com>
2022-11-18 18:38:12 +00:00
Nate Biggs 7ef59cdf1f [dart2js] Migrate startup_emitter/emitter.dart and js_emitter/code_emitter_task.dart to null safety.
Change-Id: Iabad108c88a4e900fcb0c05dc23bb7318b04472b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270341
Reviewed-by: Mayank Patke <fishythefish@google.com>
2022-11-18 18:38:12 +00:00
Nate Biggs b91ad8cd39 [dart2js] Migrate common/codegen.dart to null safety.
Change-Id: I474f31946b9a9da59e7f51e78907691afc860782
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270340
Reviewed-by: Mayank Patke <fishythefish@google.com>
2022-11-18 18:38:12 +00:00
Konstantin Shcheglov 84c452a826 Update SwitchExpression to th new state of the specification.
Change-Id: I6ae0950eff55febd438c92580c866f050c80bd1a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270580
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-11-18 17:12:02 +00:00
Paul Berry 2cdc987724 Field promotion: more thorough language tests, plus a CFE bug fix.
Bug: https://github.com/dart-lang/language/issues/2020
Change-Id: I1c604b548f2635b50addc0a97b105da8391b043c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269641
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-11-18 14:54:48 +00:00
Aske Simon Christensen 2846cb8da6 [dart2wasm] Add Wasm bottom heap types
- Add getters for the top and bottom types of the WasmGC hierarchy
  that a type belongs to.
- Rename the internal common supertype from `top` to `common` to avoid
  confusion with the top type of each hierarchy.
- Always use a bottom type when emitting a `ref.null` instruction.
- Translate the `Null` and `Never` Dart types to WasmGC `nullref`.

Change-Id: I43ba5da222a848214647980f7b4876940546242a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268463
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2022-11-18 11:43:52 +00:00
Johnni Winther 91509ba7c5 [cfe] Derive view representation type from field
Change-Id: I83c0f45fa57e71c8a902f872547f26fbfdc9785a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269760
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-11-18 10:30:26 +00:00
Jens Johansen bb840ad2fd [CFE] Don't omit platform in incremental dart2js tester to avoid false positives on leak test
E.g. https://dart-review.googlesource.com/c/sdk/+/269640 got a false
positive which this CL fixes.

Change-Id: I2112b98aea23f00cb30e67418a00fa258e7d39a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270660
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-11-18 10:21:58 +00:00
Ömer Sinan Ağacan 6257ac6bfe [dart2wasm] Fix extension method tear-off equality
Previously for function equality we compared contexts and vtables. This
works for top-level functions, local functions, function literals, and
instance method tear-offs, but not for extension method tear-offs.
Extension method spec specifies extension method tear-offs as never
being equal to any other function object. See #50475 for discussion and
references.

Extension method tear-offs are implemented as function literals
capturing `this`. For example:

    class A {
      final int i;
      A(this.i);
    }

    extension X on A {
      void g() {}
    }

    void main() {
      final a = A(123);
      print(a.g == a.g);
    }

The tear-off `a.g` compiled to kernel:

    static method X|get#g(lowered final self::A #this) → () → void
      return () → void => self::X|g(#this);

This CL changes function equality to only consider two closures equal
when their contexts are a receiver (`this`). In all other cases it works
as before.

New comparison code (pseudo code):

    bool _equals(f1, f2) {
      if (identical(f1, f2) return true;
      if (f1.vtable == f2.vtable) {
        if (v1.context is #Top && v2.context is #Top) {
          // Closures are instance tear-offs, compare receivers
          return identical(v1.context, v2.context);
        }
      }
      return false;
    }

Because extension method tear-offs are actually closures that capture
`this` (rather than instance methods), their contexts are don't have the
same type as instance tear-off contexts and the new check returns
`false`.

New passing test: co19/LanguageFeatures/Extension-methods/tearoffs_t02

Fixes #50475

Change-Id: Ica57b16301b9276059103cbdbdd6c0730040e844
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270380
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-11-18 10:11:49 +00:00
Ömer Sinan Ağacan 81551c4465 [dart2wasm] Always generate direct calls for singular targets
Change-Id: I6bde0878ca776a205e656a96abccef4aa946b6af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270402
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-11-18 09:22:31 +00:00
Johnni Winther 9061f57ec7 [kernel] Add assert and comment to RecordConstant
Change-Id: If6a3eb00e393bbe200b02b4a49e6d79999ed0b06
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270183
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-11-18 09:07:37 +00:00
Sam Rawlins f7520deae2 New fix for removing an unnecessary library directive
Change-Id: I4a57623d7e5b638d8fdf6ca174fdc5fb70187107
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270541
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-11-18 04:27:50 +00:00
Nate Biggs 975cb8a9cb [dart2js] Move memory compiler out of test folder.
Change-Id: I4fd3b1fa91582ce19fb16a61a81013d694e0cd59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270540
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2022-11-18 02:59:15 +00:00
Konstantin Shcheglov 1c3d94c0d7 Add DartPattern.unParenthesized
Change-Id: I7d9b641ec12d136df765fefc3886dc2c5715ccf6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270503
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2022-11-18 02:57:39 +00:00
pq 59adefeef4 [logViewer] support pageLength configuration
Change-Id: Ic6d7a64af16c85baac65e8729ed423c3e4b006ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270560
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-11-18 02:51:13 +00:00
Konstantin Shcheglov 624afb9a48 Enable 'patterns' feature by default in analyzer unit tests.
Fixes one of the large failures, and marks remaining with
https://github.com/dart-lang/sdk/issues/50502

Change-Id: I66abb7509b1a8b8c2167b80436b80b25c55715e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270520
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-11-18 00:42:05 +00:00
Danny Tuppeny 3f206da5e3 [analyzer] Propagate nullability in InterfaceType.allSupertypes
Fixes https://github.com/Dart-Code/Dart-Code/issues/4185.

Change-Id: Ic9fcd60ef3eae24e3921c25162ec405a56c62c53
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261840
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-11-17 21:59:44 +00:00
Ahmed Ashour d88ce93390 [analysis_server] add a failing test case for AddMissingEnumLikeCaseClauses
Bug #50484

Change-Id: Ia5fe475e62eb9015abcc06a7c9a15c7c79e6bef9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270105
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-11-17 21:30:42 +00:00
Danny Tuppeny 35d3015ed5 [analysis_server] Allow folding of whole function declarations (not only bodies)
Fixes https://github.com/Dart-Code/Dart-Code/issues/4269.

Change-Id: I137a105d119c3387a2f319a34c420380e4b97e5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270401
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-11-17 20:03:17 +00:00
Konstantin Shcheglov f016675e41 Add GuardedPattern node, for consistency with the specification.
Change-Id: I0e2248d784580ddee47790b4fa8515157874e140
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270460
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-11-17 19:38:23 +00:00
Konstantin Shcheglov a225d19b22 More comments for VariableBinder, asserts.
Added `_SharedCaseScope`, and added `key` parameters to
`switchStatementSharedCaseScope*` methods, to verify the consistency
of method invocations.

Change-Id: Ia4c552351bf367814f8c5ba645ac7aa0e0af1c94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270320
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-11-17 15:58:27 +00:00
Paul Berry 03f6c4c7ce Shared analysis logic: remove .noGuard from tests.
By creating a mixin shared by the `Pattern` and `GuardedPattern`
classes, we can avoid having to explicitly write `.noGuard` in cases
where a pattern doesn't have a corresponding guard.

Change-Id: I9178674306fca1c6517a3c54f27fb2f28cf17716
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270229
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-11-17 15:35:07 +00:00
Konstantin Shcheglov d4c443cfb7 Enable annotate_overrides lint in _fe_analyzer_shared/
Change-Id: Ic8e34af296368e8159fa75887ed54cbb4b550648
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270226
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2022-11-17 15:13:39 +00:00
Jens Johansen 5b68279417 [analyzer] Fix timing issue in benchmark
When I run
`out/ReleaseX64/dart-sdk/bin/dart pkg/analysis_server/benchmark/benchmarks.dart run analysis-server`
locally the process often doesn't finish because of a timing bug.
This fixes the one I'm running in to.

Change-Id: Ie94de8c4bb59211bff39ca2df1f8dd63fc53cc75
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270420
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-11-17 14:46:59 +00:00
Aske Simon Christensen eaa2ea9aab [dart2wasm] Switch back opcode for call_ref
V8 and Binaryen now both accept a function type immediate for the
version of call_ref using the proper opcode value of 0x14.

Change-Id: I1010de82d97df0ff80ff1365e2f827d7fd78eb81
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266162
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2022-11-17 12:59:48 +00:00
Johnni Winther 02e8bbb036 [cfe,analyzer] Share experimental flags for the parser
This adds a new generated file into _fe_analyzer_shared for the
experimental flags. This is now used by the parser when generating
messages about features not being available.

The default implementation uses whether the feature is enabled by default
or not, to emit different messages. This change will therefore ensure
that when a missing feature changes from 'experimental' to
'enabled by default', the  message reported by the parser will be
updated accordingly. Currently errors are only reported from the parser
on features that are enabled by default, so the message for experimental
features is not currently used.

The reporting is performed through the Listener, such that
implementations can override the reporting to improve the messaging.
This is done in the CFE where the message is improved to take into
account whether the language version is explicit in the parsed library.

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

Change-Id: Ief812817c7eb4b1e433389f6f49d6a1f77604fa7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269860
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-11-17 11:32:01 +00:00
Johnni Winther fa62e34be4 [cfe] Enabled patterns experiment in test suite
Change-Id: I4b74d9056db56669dd5c0c776821ab5083c6af5c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269920
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-11-17 11:08:04 +00:00
Konstantin Shcheglov 9b4be3b388 Remove unused methods from TypeAnalyzerErrors.
Change-Id: If98171798dc5fc4563c0c63e3ec70f56fa323799
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270227
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-11-17 02:21:48 +00:00
Kallen Tu 9e922093da [cfe] Add sealed classes to AST, builders and dill files.
TEST=pkg/front_end/testcases/sealed_class/*

Change-Id: Iea7db59d2bba92e5f3594f6e89949e6ff3c85a80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269801
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-11-16 23:57:29 +00:00
Brian Wilkerson 269358cb6c Fix a crash in AstBuilder
Change-Id: Iec79de2c59937a74febe988b901c9f1d0ab48405
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270225
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-11-16 23:56:06 +00:00
Konstantin Shcheglov c78ec3cd98 Remove the whole statement for any assignment to a SimpleIdentifier.
Stop using PromotableElement in analysis_server/.

Change-Id: If543c1e5e73112335634ecab5b275322010b0b66
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269203
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-11-16 22:38:00 +00:00
Konstantin Shcheglov e10bfd30e3 Rename to ObjectPattern, instead of ExtractorPattern.
Change-Id: Iae1cc5037452ceb1940158567a87d90f4d30dc54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270261
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-11-16 21:59:27 +00:00
Konstantin Shcheglov 5ce9338197 Implement variables and scopes rules.
Change-Id: Ice0b5375b8a5a0f9fa69c9d1a9aeb6241157dfb9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269540
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-11-16 21:56:22 +00:00
Stephen Adams 58c15eeeeb [dart2js] Migrate ssa/codegen.dart
Migrate the cycle codegen.dart, codegen_helpers.dart and variable_allocator.dart

Change-Id: I89b2b59736bd8024fe5a65bba4bbb60f3379b700
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268863
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
2022-11-16 21:32:00 +00:00
Devon Carew 8e70a02f05 [dartdev] updates to the 'dart compiler-server-shutdown' command
Change-Id: I38c268dace6610083051f9ec62fc9c0846d202d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270023
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-11-16 21:14:41 +00:00
Brian Wilkerson 4daaff9a27 Fix wrapping for two diagnostic messages
Change-Id: I44190fc8dd3194ecd2cc637dad7759228185d96b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270221
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-11-16 20:41:08 +00:00
Mark Zhou d902517118 [ddc] Cleaning up extraneous key sorting
Johnni's confirmed that these constants will be sorted by name.

Change-Id: I1d48055d6f80673d64b28c889a1f2015f9e20a73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270222
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Auto-Submit: Mark Zhou <markzipan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2022-11-16 18:42:56 +00:00
Danny Tuppeny 1d64cba68e [analysis_server] Fix override completions being suppressed because of import edits
Fixes https://github.com/Dart-Code/Dart-Code/issues/4116, although currently inserts the override without adding imports (imports will be added in a separate CL).

Change-Id: Ib78442c8a084928ff7da122a17d4b035b3fade8f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270180
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-11-16 17:51:50 +00:00
Brian Wilkerson 6ef4cfe23b Revert "[analyzer] add UNNECESSARY_NAN_COMPARISON hint"
This reverts commit 254da67495.

Reason for revert: This breaks both Flutter and internal code.

Original change's description:
> [analyzer] add `UNNECESSARY_NAN_COMPARISON` hint
>
> Fixes #44649
>
> Change-Id: I3784f7222a217e5b6ca485c02e9a889964ffcc8c
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269881
> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>

TBR=brianwilkerson@google.com,dart-scoped@luci-project-accounts.iam.gserviceaccount.com,asashour@yahoo.com

Change-Id: Ibcfaba3f1a24a81e01f94d3fe98e3d7df36250f4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270081
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-11-16 17:19:46 +00:00
Stephen Adams c50144d4d9 [dart2js] Migrate some small optimization phases
Change-Id: Ib9af322acdf247e0e431717b7f3ddec3dff15142
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270026
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2022-11-16 17:18:48 +00:00
Paul Berry 448a98ea1d Shared type analysis: eliminate unnecessary RecordType allocation.
All callers of TypeAnalyzer.recordType() were packaging the positional
and named fields into a RecordType object, which all implementations
immediately unpacked.

It's more efficient (and straightforward) to just pass the positional
and named fields as separate arguments to TypeAnalyzer.recordType().

Change-Id: I5c7fbdf0d4a2c01abbc157ad63a23d0e1a840f2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269983
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-11-16 17:03:27 +00:00
William Hesse cb6041acf0 [test] Disable auto-update of Firefox browser in testing scripts
Fixes: https://github.com/dart-lang/sdk/issues/50486
Change-Id: I289a396e0c2ae6c08510fbf96b6bb65c66c019e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270101
Commit-Queue: William Hesse <whesse@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2022-11-16 16:50:48 +00:00
Kevin Moore 0210b58d68 dartdev: update generated .gitignore files
No standard Dart package creates build directory
.packages is gone

Change-Id: Ib9859a7147f251c0e6422fa75e0d24c7ab3c6070
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270025
Auto-Submit: Kevin Moore <kevmoo@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
2022-11-16 09:14:13 +00:00
Ömer Sinan Ağacan ef23a1d81c [dart2wasm] Implement function equality
New passing tests:

- co19/Language/Expressions/Property_Extraction/conditional_t05
- co19/LanguageFeatures/Constructor-tear-offs/equality_A05_t01
- co19/LanguageFeatures/Constructor-tear-offs/equality_A05_t02
- co19/LanguageFeatures/Constructor-tear-offs/equality_A07_t01
- co19/LanguageFeatures/Constructor-tear-offs/object_member_A01_t02
- language/call/method_implicit_tear_off_test/01
- language/call/method_implicit_tear_off_test/02
- language/call/method_implicit_tear_off_test/03
- language/call/method_implicit_tear_off_test/04
- language/call/method_implicit_tear_off_test/05
- language/call/method_implicit_tear_off_test/06
- language/call/method_implicit_tear_off_test/13

The failing test co19/LanguageFeatures/Extension-methods/tearoffs_t02 is
about extension method tear-offs, which will be fixed separately.

Change-Id: I4fe46e5afdb79af4123eeda8671f968a4b86d254
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269882
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2022-11-16 07:57:51 +00:00
Ahmed Ashour 254da67495 [analyzer] add UNNECESSARY_NAN_COMPARISON hint
Fixes #44649

Change-Id: I3784f7222a217e5b6ca485c02e9a889964ffcc8c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269881
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-11-16 00:04:28 +00:00
Nate Biggs f2a46de0c1 [dart2js] Fix RTI in non-prod mode, ignore parameters on abstract methods.
Change-Id: Ie8752f4b055324a06c29812c2a9d756b060ceccc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269643
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2022-11-15 22:17:12 +00:00
Mark Zhou f504ad2a20 [dartdevc] Adding support for more Record nodes and core methods
- Supports: RecordGet, RecordIndexGet, RecordConstant
- Adds methods: hashCode, toString, ==

Change-Id: I512978a0ccf2eb58e24baf8462cc93ff98bd9105
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269745
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2022-11-15 22:15:25 +00:00
Nate Biggs 26a5c637a4 [dart2js] Add metric to track FlatTypeMask.intersection cache size.
Change-Id: Ie727c3e0a8513fa67feb01f59ebfaa6029d320eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269520
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2022-11-15 22:09:06 +00:00
Joshua Litt 2af123778b [dart2wasm] Cleanup comment.
Change-Id: I3144171a14d47e1df3e6bf6306784203e8d7d1b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267283
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2022-11-15 22:07:22 +00:00
Ahmed Ashour 58ac7e15fe [analysis_server] offer AddSuperParameter fix
Fixes #50293

Change-Id: I1cb05382bae6ff68ff5f9babb078e3ba95024d31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266742
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-11-15 21:43:03 +00:00
Nate Biggs ba662eb4b4 [dart2js] Replace dart2js_dynamic_test with lint and appropriate lint ignores.
See patch 2 for failures coming from this new analysis option.

Change-Id: I6bb10c2eb12431f6c503cc817a9c9bb45ba597a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269800
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2022-11-15 21:11:59 +00:00
Ahmed Ashour 50e615e2c0 [analyzer] improve message of AMBIGUOUS_IMPORT
Bug #49355

Change-Id: Icac2fb1e812ffc6e87cd086c43c5925928a097d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269900
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-11-15 19:16:12 +00:00
Danny Tuppeny fc9581d758 [analysis_server] Use ElementLocation to properly resolve documentation in LSP completions
Fixes https://github.com/Dart-Code/Dart-Code/issues/3787.

Change-Id: Iffd83fbd96f2ff8dc136c2a3f5ec7824e7451ca2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269960
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-11-15 19:14:18 +00:00
Ryan Macnak a2de36e708 [vm] Rename the default implementation classes of Map and Set.
_InternalLinkedHashMap => _Map
_InternalImmutableLinkedHashMap => _ConstMap
_InternalLinkedHashSet => _Set
_InternalImmutableLinkedHashSet => _ConstSet

This makes things nicer to read in places that display implementation names, such as stack traces, debuggers, profilers and inspectors.

TEST=ci
Change-Id: Iec851c80ea2086cbe79934565dbf35f04809a836
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266303
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2022-11-15 17:15:58 +00:00
Paul Berry 3207808567 Field promotion: allow super.property to be promoted.
Fixes test language/inference_update_2/field_invocation_promotion_test
on front end configurations.

Note that there is still an outstanding problem with `this.property`
and `super.property` getting treated as synonymous
(https://github.com/dart-lang/sdk/issues/50138).  That will be
addressed in a later CL.

Bug: https://github.com/dart-lang/language/issues/2020
Change-Id: Idb95601b47711df5ca7517c83621638783446e45
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269743
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-11-15 13:10:38 +00:00
Johnni Winther 39c68314f2 [cfe] Remove use of the AST-based class hierarchy from the inferrer
Change-Id: I636dd75b443a23dc531fbeddfbbf3cb76358e5f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269780
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-11-15 10:44:10 +00:00
Ömer Sinan Ağacan c6d69f1b02 [test_runner] Create --write-logs dir, add default dir to .gitignore
`python3 tools/test.py --write-results ...` fails to run if the default
directory (logs) doesn't exist. Create the directory if it doesn't
exist.

Update .gitignore with the correct default paths of logs.json and
results.json.

Change-Id: Ib1118387195c3bb30b350ef3748e66b4057c57de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269880
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2022-11-15 09:59:08 +00:00
Jens Johansen 9e53a1679c [CFE] Fix weekly bot 117 (incl references for views when recompiling)
Change-Id: I25316eaf5108012ed7b7d81dda93b88e758af24a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269684
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-11-15 07:08:30 +00:00
Nate Biggs 271f72422e [dart2js] Add live abstract members into closed world.
Effects of this change are minimal on a large application:
- ~9100 new members being tracked.
- +500KB closed world serialized output (.3% increase)
- No discernible difference in closed world runtime
- Heap space in global inference after closed world deserialization increase is <1MB.
- No change in JS output

These abstract members will be used by the new hierarchy-based dynamic call type graph linearization.

Change-Id: I4ce56d12e039effe0a855fd23f2a5e69d0847025
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264900
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2022-11-15 04:52:01 +00:00
Nicholas Shahan 99b3dffec6 [ddc] Avoid crash when compiling super initializer
We can't find a reproduction but for now it seems better to
avoid crashing and just keep compiling without adding any
source information.

Issue: https://github.com/dart-lang/sdk/issues/50465
Fixes: https://github.com/dart-lang/sdk/issues/50394
Change-Id: I9bba60c35647ec1cb5894d0be20a97228098880a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269741
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2022-11-14 23:41:48 +00:00
Paul Berry bf486676f0 Field promotion: fix handling of forwarding stubs on CFE.
The front end synthesizes forwarding stubs in several circumstances.
We only want forwarding stubs of the "no such method" variety to
prevent field promotion.  (The others exist just to adjust signatures
or to forward to mixins; they always forward to procedures or fields
with the same name, so they don't need to cause field promotion to be
disabled).

Fixes test
language/inference_update_2/field_promotion_and_no_such_method_test.

Bug: https://github.com/dart-lang/language/issues/2020
Change-Id: Ia45c127a9fd50c958dfa5d2e0bc7844b51c77989
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269603
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-11-14 20:15:19 +00:00
Kallen Tu 0e524b949a [analyzer/cfe] Emit error when trying to use sealed and abstract modifiers on a class.
`sealed` and `abstract` modifiers are mutually exclusive. Error when a user tries to use them together on a class declaration.

Implemented in the parser since it's a common error between the analyzer and the CFE.

Change-Id: I9a8835c29ddb430ea0f005630bbdf9348f8b055c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269260
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-11-14 19:51:42 +00:00
Ryan Macnak 6ca6400cdc [vm, service] Report InstanceKind for Sets.
(The elements were already being populated.)

TEST=ci
Change-Id: I02cfa2f311e7871836f1eddd8ed131c282235d58
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269383
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-11-14 18:38:09 +00:00
Derek Xu f310275ffb [VM/Service] Only return @Instances as values of BoundFields
We were planning on making the `value` property of `BoundField` have
type `@Instance|Sentinel|bool|int|double`, but we have decided to stick
with `@Instance|Sentinel`.

TEST=CI

Issue: https://github.com/dart-lang/sdk/issues/49724
Change-Id: Ia728586e695c14c0597f377e6c110329e553d62c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269440
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2022-11-14 18:17:43 +00:00
Ahmed Ashour 933cba6c21 [analyzer] don't report UNUSED_RESULT for import show/hide
Fixes #50444

Change-Id: I8f45a6735434baf788c4c1c8744b68e14206b29d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269460
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-11-14 18:07:35 +00:00
Aske Simon Christensen a9cfad4e1f [dart2wasm] Move low-level int/double intrinsics to base classes
Change-Id: I9900286e0f4538d887226ffbaa6dc739174b37af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269001
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2022-11-14 15:50:20 +00:00
Paul Berry 3e00be7c1c Integrate analyzeIfCaseStatement with front_end
Change-Id: I652bfe56482050b9d154a4d65c0bab465a0937d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267480
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-11-14 14:12:48 +00:00
Paul Berry 1af3f76a6c Patterns parsing: fix handling of builtin identifiers and pseudo-keywords.
Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: I95f2b7d59a54d0d5e1975bd8cd1dce88db03fa51
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269580
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2022-11-14 14:12:48 +00:00
Ömer Sinan Ağacan f073bb8953 [dart2wasm] Split DispatchTable.selectorForTarget into two methods
Currently `selectorForTarget` is used for two different things:

1. In `DispatchTable.build` when creating selectors. This process
   creates new selectors, and if a selector for a member already exists,
   updates the selector's signature and `calledDynamically` field.

2. After `DispatchTable.build`, when generating code. These calls should
   never create a new selector and should never change fields of an
   existing selector. If this creates a new selector, the selector won't
   have a dispatch table entry and we'll have a crash in compile time
   when we ask for the new selector's offset. If this updates an
   existing selector, that can invalidate the selector's signature after
   it's computed.

To avoid accidentally updating selector state in (2) this CL renames
`selectorForTarget` to `_createSelectorForTarget` and uses this in (1).
The original `selectorForTarget` now only returns an existing selector
from the selector map and doesn't update any selector state or create a
new selector.

Change-Id: I7b2a555166d8715a24df285af864c57958d92a07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269680
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-11-14 13:20:51 +00:00
Ömer Sinan Ağacan 61bb8c5a52 [dart2wasm] Remove SelectorInfo.tornOff member
The member is not used outside of `DispatchTable`, and the use in
`DispatchTable` can be refactored to use the member's value directly.

Change-Id: I7f9070740337f88c1f19c3113f16050256b95481
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269660
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2022-11-14 12:49:08 +00:00
Jens Johansen d26cf07b10 [analyzer] Complete completers when disposing
There has been reports of slow analyzer queries that ~locked up VSCode,
and I was given a (reproducable) example by @yousefi.

Turns out that, at least what I could reproduce, wasn't the analyzer
being slow, but rather the analyzer never responding to a query in
certain timing-related situations.

In the concrete example a test-script checks out another copy of the
directory opened by VSCode _inside_ the same directory (say root folder
opened by VSCode was "foo" and now it gets "foo_copy" inside it), this
causes `_destroyAnalysisContext` to be called, effectivley stopping all
in-flight queries via the stopped `AnalysisDriver`s, meaning that a
response is never given.

I can also reproduce the same thing by for instance having
`pkg/analysis_server` open in VSCode and then checking out a many
months old revision (while firering queries).

This CL is a suggestion for how to fix it: When disposing of an
`AnalysisDriver` we finish all waiting `Completer`s with an error,
this means a response is given and that VSCode stops waiting.

Change-Id: Idc04bf1d1d3f86a6d12bb77f5805064c67965209
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269300
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-11-14 09:37:37 +00:00
Sam Rawlins f811d53450 Add some recent lint rules to analyzer
Change-Id: I962812880b660dd17c821fb4264da28783fa14ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269441
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-11-14 04:14:40 +00:00
Nicholas Shahan 1ad3b1c45a [ddc] Add support for new function types
Issue: https://github.com/dart-lang/sdk/issues/48585
Change-Id: I0a338e672467b8fec5158f5959da01fa100f3ae8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266541
Reviewed-by: Anna Gringauze <annagrin@google.com>
2022-11-11 23:49:34 +00:00
Nicholas Shahan 52d70ed2cf [ddc] Add support for new generic interface types
- Introduce type environments in the compiler used for evaluating type
  parameters from generic classes and generic function types.

Issue: https://github.com/dart-lang/sdk/issues/48585
Change-Id: Ib5641eb666527acc3b7f13a4a00dea34e0122b52
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266540
Reviewed-by: Mark Zhou <markzipan@google.com>
2022-11-11 23:49:34 +00:00
Nate Biggs 6cb9397f59 [dart2js] Add cache to FlatTypeMask.interesection
Both the calls to ClassHierarchy.commonSubclasses and UnionTypeMask.flatten (in the worse case) are expensive for large programs. Certain programs can have a type structure that ends up in the UnionTypeMask.flatten case very often which can be especially taxing.


Change-Id: I7799d2f5a7f764162a4ca753bfa37b11f583373f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269221
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2022-11-11 22:49:02 +00:00
Devon Carew b84a08a0e1 [pkg/dart2js_info] remove older .github config files
Change-Id: I1d558855bbeec2e598f5d02efb6355cc575f30df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269362
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2022-11-11 21:13:13 +00:00
Ahmed Ashour 1be1780b79 [analyzer] add CAST_FROM_NULLABLE_ALWAYS_FAILS hint
Fixes #50309

Change-Id: Iaf19f46e7d3632d048a7db2e5194d59e933a69a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266400
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-11-11 21:12:48 +00:00
Konstantin Shcheglov f74e269f93 Add isVariableFinal(), move isFinal to Var.
Change-Id: I03cb8754303185d132846b6f79a51f5f9525e9ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269361
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-11-11 20:37:39 +00:00
Brian Wilkerson f50c52f3dd Add (already referenced) initial docs for tokens
Change-Id: I8edb453f638223464ffb8563c8d4fe0dd6999991
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269360
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-11-11 19:48:00 +00:00
Johnni Winther 39ec46ecdc [cfe] Use fullMemberIterator in ClassMembersNodeBuilder
This adds support for looking up injected members though the members
builder. It also changes the duplicate handling to match the invariant
used elsewhere; that the used member is the one declared first and not
any of the subsequent, and the so-called, duplicate members.

Change-Id: If9c06a8e17af482b4365da44798b47b54e5277dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268946
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-11-11 16:59:48 +00:00
Aske Simon Christensen 6ddd14696c Update d8 to 10.9.104
This version contains a number of updates to WasmGC:
- `dataref` is replaced by `structref`.
- `call_ref` now takes a function type immediate, both with the proper
  0x14 opcode and the temporary 0x17 opcode.
- Some of the new type test/cast instructions are implemented,
  specifically `ref.test`, `ref.cast`, `ref.test null` and
  `ref.cast null`. The new `br_on_cast` and `br_on_cast_fail` are not
  yet implemented.

Additionally, the `--wasm-gc-js-interop` flag is removed, and interop
is always enabled.

Change-Id: Ibe7a1d9e8800f89096239ff5afa16e80322e01c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266161
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2022-11-11 15:11:54 +00:00
Alexander Johr bdbe0ded45 Deleted repetition "/// (We return the string)" from the Documentation of DartObject.toSymbolValue
Closes https://github.com/dart-lang/sdk/pull/50257

GitOrigin-RevId: c5b92e48c99959d04ad3d6e0934254c522e7d655
Change-Id: I1df469f693faf18a463027498f02d226f7fa603a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265000
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2022-11-11 14:57:04 +00:00
Chloe Stefantsova aaf1e1eb52 [cfe] Forbid Object member names in record type positional fields
This CL implements the following update to the spec
d668c82840

Change-Id: I70b1f12da340a8218f3559adaef60855c378716e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269304
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-11-11 14:19:07 +00:00
Chloe Stefantsova b97e5b95fa [cfe] Implement the desugaring for NullAssertPattern
Part of https://github.com/dart-lang/sdk/issues/49749

Change-Id: I56ac79a98eb4306daabec05d95f09bb18d248825
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268961
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2022-11-11 13:01:29 +00:00
Chloe Stefantsova e25e532900 [cfe] Allow 'new' as constructor name on enum elements
Additionally, add some missing compile-time errors and adjust error
text expectations.

Closes https://github.com/dart-lang/sdk/issues/49327

TEST=Covered by existing tests.

Change-Id: Ie62211650633beb26abdf735e0dd36c4de4e24c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266740
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-11-11 11:13:35 +00:00
Sam Rawlins bb0c4cede5 Fix missing identifier crash
* Also, fix missing quotes in message
* Also, do not report CLASS_INSTANTIATION_ACCESS_TO_UNKNOWN_MEMBER
  when obviously not a constructor name.

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

Change-Id: Idd78790289068bab1c20314d185a9abce1849ea2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269202
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-11-11 06:01:30 +00:00
Sam Rawlins 020d53b059 A value from Angular's 'injector.get' in setUp signals non-null intent.
For b/254330485

Change-Id: I5a3993753dfe559426ce0517c1527eba27221759
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265120
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-11-11 05:09:43 +00:00
Konstantin Shcheglov 4ed6433ed7 Report when a record or object patterns have duplicate named fields.
See https://github.com/dart-lang/language/issues/2610

Change-Id: I4fe910583c4b316013a5df915b86d8590d625995
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269200
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2022-11-11 03:59:35 +00:00