Commit graph

88512 commits

Author SHA1 Message Date
pq 636eec185b linter 1.31.0
Cherry-picks update of `prefer_equal_for_default_values` to be a no-op in SDKs `>=2.19`.

See: https://github.com/dart-lang/linter/pull/3865

Change-Id: I2669f0279a0913bc8b3c5b0501a9869608883a14
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272543
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2022-11-30 02:11:07 +00:00
Konstantin Shcheglov 13531511d5 Resolve switch statement with patterns, support variables.
Change-Id: Idafdd5680beed4ea556cfd47941bfb22e5fe6797
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272521
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-11-30 01:16:06 +00:00
Paul Berry f28b2d71cd Remove the analyzer's AST representation for PatternAssignmentStatement.
There's no such node in the grammar.  Pattern assignment statements
are simply expression statements whose expression is a
PatternAssignment (in the same way that a statement like `a = b;` is
an expression statement whose expression is `a = b`).

Change-Id: I09ea7deade3eb942f5ae464f72f3e217c164594e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272384
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-11-29 23:24:43 +00:00
Konstantin Shcheglov 7e97d695f8 Fix highlighting FunctionTypedFormalParameter name.
Change-Id: I476711afa5c44c0eb7cb177e85bd67e57b024421
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272544
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-11-29 23:02:58 +00:00
Sam Rawlins c37fc761f5 Update changelog for analyzer
Change-Id: I2283636efd0b6c63ac047ccf703effb35e0388b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272489
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-11-29 22:47:58 +00:00
Nate Bosch b2485c549f Allow AddExplicitCall for bulk and file fixes
The edit regions should not overlap and the fixes are independent.

- Add `canBeAppliedInBulk` and `canBeAppliedToFile`.
- Add a BulkFixProcessorTest with multiple fixes in the same file.
- Add a FixKind for fixing implicit call tearofffs across the file.

Change-Id: I14260e4082fcd47c3a50514416b1c15b2c7e12c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271540
Reviewed-by: Oleh Prypin <oprypin@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2022-11-29 22:14:35 +00:00
Nicholas Shahan 2cbed01634 [ddc] Avoid null check on forwarding field setters
Overriding fields can change the type to remove nullability and
can also be final so they override the getters only.

For DDC that means there is an inherited setter that could still be nullable and a forwarding setter that should allow null even though
the type of the overriding field is non-nullable. With enhanced null
safety asserts enabled in weak mode there should be no failure when
setting the inherited field to null.

Fixes: https://github.com/dart-lang/sdk/issues/50569
Change-Id: Ie6af0d1e265a5f3b15469311fa1f7e2a184d95ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272480
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2022-11-29 21:49:15 +00:00
Alexander Markov a9c11acd25 [vm/aot] Unbox 2-field records in return values
Functions returning non-nullable records of 2 fields can now return
them as separate values on 2 registers. This postpones and sometimes
eliminates creation of record instances. As other unboxing
optimizations of return values, this optimization is only
performed in AOT.

Pair of values for an unboxed record are represented using
kPairOfTagged representation, which can be now used for the input of
Return and for the output of StaticCall/InstanceCall
PolymorphicInstanceCall/DispatchTableCall instructions.

In order to combine separate values for Return, a new MakePair
instruction is added. Extracting separate values from the result of
a call is implemented using existing ExtractNthOutput instruction.

Benchmarks (AOT mode):
MultipleReturns.Forwarded.Record +45-57%
MultipleReturns.Forwarded.RecordNamed +43-57%
MultipleReturns.NotInlined.Record +58-79%
MultipleReturns.NotInlined.RecordNamed +53-76%

TEST=runtime/tests/vm/dart/records_return_value_unboxing_il_test.dart
TEST=benchmarks/MultipleReturns/dart/MultipleReturns.dart

Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: I7117b19a134c1db0ba5117a1ef093867f9ba20e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269100
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-11-29 21:41:49 +00:00
Marya f8a0d65c70 runZoned to runZonedGuarded in docs
Closes https://github.com/dart-lang/sdk/pull/50577

GitOrigin-RevId: 5dd34da55ba6ecab73966d753ef275ddd4b4b2d8
Change-Id: Ie60ce8e57fa5cad532b776f35b82ab5470fe6d4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272488
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
2022-11-29 20:28:59 +00:00
Paul Berry 7b41b6215b Add parser support for patternAssignment.
Bug: https://github.com/dart-lang/sdk/issues/50035, https://github.com/dart-lang/sdk/issues/50502, https://github.com/dart-lang/sdk/issues/50575
Change-Id: Idd3bdcae7cbb95c6f2016bb5d3efc638867f52af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272383
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-11-29 20:16:29 +00:00
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
Mark Zhou 8b48d7839b [ddc] Adding checks to expando setters, and extending checks to records
Change-Id: I7cd1244806fa63b880d5f6c842d1995207330db9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272462
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2022-11-29 19:51:37 +00:00
Kallen Tu 0329e7da94 [tests] Typedef, part of, and mixin 'on' language tests for sealed classes.
Change-Id: Idc72291668d72def5ec4c93ecb77eeea554628b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271502
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-11-29 17:51:34 +00:00
Polina Cherkasova d18ad3a9b7 Bump DevTools DEP to 2.20.0
Change-Id: I3c7ab280e334281e1b15ca8cd25508423344bb98
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272482
Commit-Queue: Polina Cherkasova <polinach@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2022-11-29 17:03:47 +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
Sigurd Meldgaard e9de133c2d Bump pub to 867ad175d81713c4e70473b1ab32107547cbdc3e
Changes:
```
> git log --format="%C(auto) %h %s" 6fdcdd4..867ad17
 https://dart.googlesource.com/pub.git/+/867ad175 Fix reading pubspecs from git (#3670)

```

Diff: https://dart.googlesource.com/pub.git/+/6fdcdd4357645817e7d7027ee2157ed68ef69c53~..867ad175d81713c4e70473b1ab32107547cbdc3e/
Bug: https://github.com/flutter/flutter/issues/116107
Change-Id: I6b1a2f1e4f1864c9a2658568f6dfd63383d10406
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272620
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2022-11-29 15:24:35 +00:00
Alexander Aprelev 36e8d9ab6f [vm/compare] Speed up internal one/two-byte strings comparisons.
Ensure padding around data and length fields for these strings is zeroed-out, allowing for comparison to be done in word-sized chunks.
For configurations where the hash is not in the header, swap the length and the hash in string class so that the length is adjacent to the data.

x64
===
LongStringCompare.2.3000reps 109.2%
LongStringCompare.32.1000reps 526.4%
LongStringCompare.1024.30reps 670.1%
===

ia32
===
LongStringCompare.2.3000reps 90.68%
LongStringCompare.32.1000reps 274.5%
LongStringCompare.1024.30reps 211.4%
===

arm64
===
LongStringCompare.2.3000reps 89.28%
LongStringCompare.32.1000reps 454.5%
LongStringCompare.1024.30reps 677.7%
===

arm
===
LongStringCompare.2.3000reps 68.76%
LongStringCompare.32.1000reps 330.9%
LongStringCompare.1024.30reps 426.8%
===


BUG=https://github.com/dart-lang/sdk/issues/50190
TEST=string_equals_test

Change-Id: Ia4ab9bcb4daca5d4f403e0ece364bb6aafb68577
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269600
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-11-29 14:36:19 +00:00
Sergey G. Grekhov fc4d9c6210 [co19] Roll co19 to e2e8dd01102f4856574c5cd7bed02ebfa63fed9c
2022-11-29 sgrekhov22@gmail.com dart-lang/co19#1554. Don't use colon for initializing default value (dart-lang/co19#1561)
2022-11-29 sgrekhov22@gmail.com dart-lang/co19#1401. Update logical patterns syntax to && and || (dart-lang/co19#1559)

Change-Id: I39da17a33ad828c05bd685f8064178a6b003d302
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272581
Reviewed-by: Alexander Thomas <athom@google.com>
2022-11-29 13:25:23 +00:00
Sergey G. Grekhov b6c1cecbee [co19] Roll co19 to a9a8b41a5efb6051956ef3c747efe3fa516d4a7e
2022-11-28 sgrekhov22@gmail.com dart-lang/co19#1554. Don't use colon for initializing default value (dart-lang/co19#1560)
2022-11-25 asashour@yahoo.com Remove extra space (dart-lang/co19#1550)
2022-11-25 asashour@yahoo.com Remove unrecognized character. (dart-lang/co19#1558)

Change-Id: I4812998edcd38c5695e7d6d910afcd79843542bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272363
Reviewed-by: Alexander Thomas <athom@google.com>
2022-11-29 08:39:19 +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
Ben Konyi af1536d463 [ dart:developer ] Deprecate Metrics related functionality
See https://github.com/dart-lang/sdk/issues/50231

Change-Id: I8f5196f90dd7a03c08d413d381bf093cc1f309eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272381
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-11-28 23:03:18 +00:00
Devon Carew 576df7f82c Bump pub_semver to 17231113f98c80285881cc4452863bcfd085d1a8
Changes:
```
> git log --format="%C(auto) %h %s" 28159b8..1723111
 https://dart.googlesource.com/pub_semver.git/+/1723111 rev to 2.1.3 in preparation for release (#75)
 https://dart.googlesource.com/pub_semver.git/+/5ac4c28 update and fix lints, bump min SDK (#74)

```

Diff: https://dart.googlesource.com/pub_semver.git/+/28159b8c5b96fc2709d0904389d7932880f68659~..17231113f98c80285881cc4452863bcfd085d1a8/
Change-Id: I52e3503fff0529917e3ce9e9c79bd27b00402940
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272388
Commit-Queue: Devon Carew <devoncarew@google.com>
Auto-Submit: Devon Carew <devoncarew@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2022-11-28 22:42:18 +00:00
Devon Carew af23ffc8cc [deps] revert the recent package:fixnum roll
Change-Id: I95c46b3e47963348daf0f4ac97cd2b2f5c6ad59e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272348
Commit-Queue: Oleh Prypin <oprypin@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Auto-Submit: Devon Carew <devoncarew@google.com>
Reviewed-by: Oleh Prypin <oprypin@google.com>
2022-11-28 21:59:30 +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
Alexander Thomas 1d9f3ba509 [infra] Update checked-in SDKs to 2.19.0-374.0.dev
Change-Id: Icef5a3ba6968312c6a49dc5bedb44dbeb901ee99
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272347
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Alexander Thomas <athom@google.com>
2022-11-28 21:25: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
Devon Carew 32ae44215f [deps] rev ffi, fixnum, http, markdown, protobuf, sse, test
Revisions updated by `dart tools/rev_sdk_deps.dart`.

ffi (3ede231..17a8142):
  17a8142  2022-11-21  Daco Harkes  Add links to API reference and examples to README (#167)

fixnum (bca3816..62916f2):
  62916f2  2022-11-24  Lasse R.H. Nielsen  Split into separate libraries instead of using parts. (#97)
  14d4827  2022-11-23  Lasse R.H. Nielsen  Add `tryParse` methods. (#96)

http (d56141d..047d6ed):
  047d6ed  2022-11-22  Brian Quinlan  Fixes a bug where requests made in different Clients would fail (#827)
  9dbbafb  2022-11-17  Brian Quinlan  Add tests for compressed responses (#823)

markdown (37951d1..ee3f4e9):
  ee3f4e9  2022-11-24  Zhiguang Chen  Fix a blockquote issue (#496)
  c9048c0  2022-11-16  Zhiguang Chen  Optimise DelimiterSyntax (#492)

protobuf (ae90e53..c181573):
  c181573  2022-11-23  Kevin Moore  [api_benchmark] migrate to null-safety (#776)
  648deaf  2022-11-23  Kevin Moore  Standardize and fix lints (#775)
  bfa4c0d  2022-11-23  Kevin Moore  Fix `///` at the top of generated Dart files (#774)
  ed68426  2022-11-17  Devon Carew  Remove duplicate consts (#773)

sse (283568d..8d018dd):
  8d018dd  2022-11-23  Elliott Brooks (she/her)  Format markdown files (#68)
  2f6f151  2022-11-23  Elliott Brooks (she/her)  Add optional `debugKey` parameter to SSE client (#67)
  eaee6a8  2022-11-23  Elliott Brooks (she/her)  Use Fetch API in SSE Client (#66)

test (7756833..b25dac9):
  b25dac99  2022-11-21  Kevin Moore  checks: finish async tests (#1793)
  3166163e  2022-11-18  Devon Carew  Update scorecards-analysis.yml (#1792)
  d930d5b0  2022-11-18  Nate Bosch  Add support for async soft checks (#1789)
  b1411a21  2022-11-18  Devon Carew  blast_repo fixes (#1788)
  a6aa04e0  2022-11-18  Jacob MacDonald  disable wasm tests for now as they are failing (#1791)
  8b5174c1  2022-11-17  Kevin Moore  Starting on async tests (#1787)

Change-Id: Ic361fce7753d08d43fc827f13cb1bfa1738cc16e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272343
Auto-Submit: Devon Carew <devoncarew@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-11-28 19:47:48 +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
Tess Strickland 4f925105cf [vm] Use a hash map for larger type argument instantiation caches.
Previously, the VM used a linear array to cache previous instantiations
of a type arguments object. Now once the cache hits a certain number
of occupied entries, the VM changes to using a hash-based approach.

The InstantiateTypeArguments stubs have not yet been updated to
traverse the hash-based cache, so once the cache has grown too large,
all attempts at instantiations, even those that are in the cache, go to
the runtime. Thus, until the stubs are updated, this is only an
improvement if the cost of traversing the linear cache dominates the
cost of making a runtime call. Our benchmarks see a ~40% performance
regression for hash-based caches of size 100 but a ~400% performance
improvement for hash-based caches of size 1000. Thus, we currently
split the difference and set the maximum size of linear caches to 500.

TEST=vm/cc/TypeArguments_Cache_ManyInstantiations

Bug: https://github.com/dart-lang/sdk/issues/48344
Change-Id: I7f1376943523bb5bcd8b175cfb1936779ea73d60
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try,vm-kernel-precomp-nnbd-linux-release-simarm_x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-simarm64-try,vm-kernel-precomp-nnbd-linux-debug-simriscv64-try,vm-kernel-precomp-tsan-linux-release-x64-try,vm-kernel-tsan-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265325
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2022-11-28 15:00:20 +00:00
Tess Strickland 333d924504 [vm/compiler] Make InstantiateTypeArgs stubs architecture independent.
TEST=ci

Bug: https://github.com/dart-lang/sdk/issues/48344
Change-Id: I7c0cee827a09d981e6e65802304a361ace7ce501
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try,vm-kernel-precomp-nnbd-linux-release-simarm_x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-simarm64-try,vm-kernel-precomp-nnbd-linux-debug-simriscv64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270102
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-11-28 15:00:20 +00:00
Sergey G. Grekhov b1949bfa1f [spec_parser] Change logical pattern rules to '||' and '&&'
Change-Id: I0f973090b6fab0be0f9c774636b3cc4248dc2c22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272362
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2022-11-28 14:23:34 +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
Daco Harkes 827d166ea0 [vm/ffi] Stop reifying type argument in Pointer
All `Pointer`s will now have the `Never` type argument at runtime.

TEST=tests/ffi(_2)/*

Bug: https://github.com/dart-lang/sdk/issues/49935

Change-Id: I83c8bba9461c2cab22992ba2e3cf42b7b5f43c36
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-precomp-win-debug-x64c-try,vm-kernel-mac-debug-x64-try,dart-sdk-mac-arm64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-debug-arm64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272201
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-11-28 09:45:45 +00:00
Coaspe 091a292d82 Fix typo in wasm_types.dart
Closes https://github.com/dart-lang/sdk/pull/50555

GitOrigin-RevId: 5bdce7c315236c33be893c525f1fa063c71b95ea
Change-Id: I0267dc19610746323abab067b1957e9ca32ad61c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272340
Reviewed-by: Michael Thomsen <mit@google.com>
2022-11-28 09:29:36 +00:00