Commit graph

8195 commits

Author SHA1 Message Date
Danny Tuppeny acefe9ab6d [analysis_server] Extract LSP registration options from ServerCapabilitiesComputer
This is a non-functional refactor that extracts the growing set of capabilities and options from ServerCapabilitiesComputer into files alongside the handlers they relate to.

The motivation for this is that for LSP-over-Legacy we'll need to accept client capabilities (and return server capabilities). The server capabilities will be different to the standard LSP ones (they will be a subset, and we might not support dynamic registration - at least initially). However the features we do support will have the same registration options, so to avoid duplicating them this moves the registration options away from the creation of the ServerCapabilities.

In future, we might consider further wrapping up a "feature" (which consists of these registration options, and the related handlers), but this change is already quite large and I just wanted to progress capabilities for LSP-over-Legacy so we can handle things like Code Actions (which require executeCommand and possible reverse-requests for applyEdit).

Change-Id: Iecd0aa36626fa44826f7d4dbd6e6c0d758075239
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319840
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-10 17:10:48 +00:00
Brian Wilkerson 98608662e7 Move more of KeywordContributor to the new framework
Change-Id: I2b257545a3af7fa2f803e8f954d14cd3679c35c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319781
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-10 16:58:51 +00:00
Jens Johansen aba5663d0a [analyzer] Deduplicate _Info* instances
When having several contexts we'll end up having many copies of the same
_Info* instances. This CL deduplicates it.
TL;DR: On flutter/flutter (82 contexts) this, when run from a clean
cache, reduces the memory usage by 600-800 MB (~15%).

Details:

All numbers from runs made from analyzer source with a clean cache on
flutter/flutter (82 contexts), memory usage after a forced GC:

Runtime:
No difference proven at 95.0% confidence

Current memory (GB):
Difference at 95.0% confidence
        -0.683333 +/- 0.0627592
        -13.3987% +/- 1.23057%
        (Student's t, pooled s = 0.0276887)

Peak memory (GB):
Difference at 95.0% confidence
        -0.643333 +/- 0.0746028
        -12.5243% +/- 1.45236%
        (Student's t, pooled s = 0.032914)

Heap (used) (GB):
Difference at 95.0% confidence
        -0.77 +/- 0
        -17.5799% +/- 0%
        (Student's t, pooled s = 0)

Heap (capacity) (GB):
Difference at 95.0% confidence
        -0.69 +/- 0.05552
        -15.2993% +/- 1.23104%
        (Student's t, pooled s = 0.0244949)

_List (MB):
Difference at 95.0% confidence
        -59.2333 +/- 0.0925333
        -6.91547% +/- 0.0108032%
        (Student's t, pooled s = 0.0408248)

_Uint32List (MB):
Difference at 95.0% confidence
        -105.433 +/- 1.06715
        -17.3382% +/- 0.175489%
        (Student's t, pooled s = 0.470815)

_OneByteString (MB):
Difference at 95.0% confidence
        -403.667 +/- 2.37542
        -58.1206% +/- 0.342017%
        (Student's t, pooled s = 1.04801)

Raw data:

NOW:

Runtime (ms): 151855
current memory	4.46GB
peak memory	4.54GB
heap 3.61GB of 3.86GB
797.3 MB 6067774 _List
503.1 MB 2574937 _Uint32List
291.7 MB 2233396 _OneByteString
233.0 MB 338029 _Uint8List
158.7 MB 3466691 Reference
116.1 MB 1901830 _Map

Runtime (ms): 152410
current memory	4.40GB
peak memory	4.49GB
heap 3.61GB of 3.80GB
797.3 MB 6067637 _List
503.0 MB 2574976 _Uint32List
290.7 MB 2232326 _OneByteString
226.8 MB 339447 _Uint8List
158.7 MB 3466691 Reference
116.1 MB 1901830 _Map

Runtime (ms): 153205
current memory	4.39GB
peak memory	4.45GB
heap 3.61GB of 3.80GB
797.3 MB 6067638 _List
501.9 MB 2556644 _Uint32List
290.2 MB 2235718 _OneByteString
226.7 MB 338584 _Uint8List
158.7 MB 3466691 Reference
116.1 MB 1901830 _Map




BEFORE:

Runtime (ms): 159178
current memory	5.09GB
peak memory	5.15GB
heap 4.38GB of 4.51GB
856.6 MB 7366027 _List
696.0 MB 3780593 _OneByteString
608.1 MB 5239817 _Uint32List
226.9 MB 341102 _Uint8List
158.7 MB 3466691 Reference
116.1 MB 1901829 _Map

Runtime (ms): 153913
current memory	5.11GB
peak memory	5.13GB
heap 4.38GB of 4.51GB
856.5 MB 7366249 _List
693.8 MB 3730773 _OneByteString
608.1 MB 5239925 _Uint32List
233.0 MB 338205 _Uint8List
158.7 MB 3466691 Reference
116.1 MB 1901829 _Map

Runtime (ms): 157729
current memory	5.10GB
peak memory	5.13GB
heap 4.38GB of 4.51GB
856.5 MB 7366221 _List
693.8 MB 3730773 _OneByteString
608.1 MB 5239924 _Uint32List
233.0 MB 337860 _Uint8List
158.7 MB 3466691 Reference
116.1 MB 1901829 _Map

Change-Id: I5697ff0efd40c9325f7f15d8092655b80b4876ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318940
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-08-10 09:58:31 +00:00
Konstantin Shcheglov 4dffed5065 Extension types. Report when implemented not extension type superinterface is not a supertype of the representation type erasure.
Change-Id: Ib1f2bfcfe51edb6bcbc54d7165f148810e3df4ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319600
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-09 22:18:27 +00:00
Parker Lougheed 6f645c8f1c [analysis_server] Fix TODO in diagnostic_describe_all_properties test
Change-Id: Id81194e0bf07aaa90777055597a9dba914060d3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319620
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-09 22:04:58 +00:00
Konstantin Shcheglov e5a16ae775 Extension types. Report self reference in implements clause.
Change-Id: Icd26dcd6cf7521e075d6a8f13a985f3185c02369
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319584
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-09 20:56:25 +00:00
pq 8db531a948 update mocked package:meta to 1.10
Change-Id: I6d3afd37a31302855d426085547eda67a145efd8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319385
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-08-09 20:23:48 +00:00
Danny Tuppeny aee6d0af18 [analysis_server] Restore use of pathContext.fromUri() for parsing file URIs in the LSP server
This reverts be4189f047 plus adds an additional test to verify pkg:path to behaviour (to catch future regressions or if pkg:path has to be reverted, this will need reverting too).

This relies on the fix made at https://github.com/dart-lang/path/issues/148 which rolled into the SDK in f1de897762.

Change-Id: I1dea45e2017f7505bc4aca97f6c07c1a6e445a5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319523
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-09 19:39:22 +00:00
Konstantin Shcheglov 0540ac84e1 Extension types. Report an error for super formal parameters.
Change-Id: I0e577dbe9d27913ce633951c68b2891f48699ca6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319560
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-09 18:45:51 +00:00
Parker Lougheed 5656b3384e [analyzer] Remove failing test for removed diagnostic
The diagnostic this is testing was removed in 415ff8ece8, causing this test to fail since no diagnostic is reported anymore.

Change-Id: I4cc657094f93dd58a0750847496dccb53e3e8cde
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319540
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-09 17:21:46 +00:00
Konstantin Shcheglov ffcb38d702 Extension types. Report super constructor invocations.
Change-Id: Ib3da4c7f19864bbbb6d9f53769375fe9f1cf7daa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319300
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-08-09 16:50:56 +00:00
Danny Tuppeny 6229694c74 [analysis_server] Don't remove unused parameters when running fix-all-on-save
Fixes https://github.com/Dart-Code/Dart-Code/issues/4655

Change-Id: I09269766124f7b77fde7c499c6f69a09989d1766
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317684
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-09 15:49:06 +00:00
Kyle Turney 3c8fccf7a4 add fix for removing the leading underscore in constructor parameter lists
Closes https://github.com/dart-lang/sdk/pull/53122

GitOrigin-RevId: 802bc7caf2816906cc38de44784c20531675fdc2
Change-Id: I1adbd74ec20f2a4e2d78d6da9dd538d03ca0475e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318200
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-09 15:08:47 +00:00
Oleh Prypin 9f0f33c676 Revert "[analyzer] simplify the libraries.dart file"
This reverts commit 1948b0a9fe.

Reason for revert: causes `promiseToFuture` to become undefined - b/295129286

Original change's description:
> [analyzer] simplify the libraries.dart file
>
> Change-Id: I86bc196eaddd9a80c02f38c8d947d3c0f4c63394
> CoreLibraryReviewExempt: the sdk_library_metadata/libraries.dart is only used by the analyzer
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317803
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Commit-Queue: Devon Carew <devoncarew@google.com>

Change-Id: I4810c408b996cefd46c0a40cc36818d34aa86071
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319402
Auto-Submit: Oleh Prypin <oprypin@google.com>
Commit-Queue: Oleh Prypin <oprypin@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2023-08-09 10:27:47 +00:00
Parker Lougheed 1b8870bbb1 [analyzer] Don't generate error codes for removed diagnostics
Also renames 'removed' to 'removedIn' to better indicate it is looking for a version, not a boolean.

Change-Id: If3a6708ba32460305e89ba59c4a58ce2ad284e6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319282
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-09 04:08:23 +00:00
Konstantin Shcheglov 1e12b09a59 Extension types. Report conflicts for members from superinterfaces.
Change-Id: I4bc513102f734a98a263dffd97c5d93874ef3ae1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318803
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-08 23:23:13 +00:00
Kallen Tu 1f88336597 [analyzer] Move all constructor error reporting to _InstanceCreationEvaluator.evaluate
Pull the error handling outwards to _InstanceCreationEvaluator.evaluate. All errors in const constructors should point to the location of the actual exception and provide more context.

Change-Id: Iafcf46182fab698f5546c63780de6dd9a605a51b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318802
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-08-08 21:55:34 +00:00
Keerti Parthasarathy 155bfc973b Add support for sort imports to BulkFixProcessor, add prefer_generic_function_type_aliases to list of lints for lightweight mode.
Change-Id: Ic8a1afde5f35a65065dd8439a11c4d99846c2905
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319240
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-08 21:10:54 +00:00
Devon Carew 1948b0a9fe [analyzer] simplify the libraries.dart file
Change-Id: I86bc196eaddd9a80c02f38c8d947d3c0f4c63394
CoreLibraryReviewExempt: the sdk_library_metadata/libraries.dart is only used by the analyzer
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317803
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2023-08-08 21:00:01 +00:00
Konstantin Shcheglov 36c578f75c Extension types. Report when has representation self reference.
Change-Id: I729515f92c4c31530b61c7f9d71507fbf922787d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319180
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-08 20:39:40 +00:00
Danny Tuppeny 1bae1b3dd5 [analysis_server] Don't produce fix-all-in-file fixes when there's no individual fix
Fixes https://github.com/dart-lang/sdk/issues/53021

Change-Id: I674430c5e01eaeaee7867e85795eca2250ec14f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318840
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-08 18:20:39 +00:00
Danny Tuppeny b6e7b7e536 [analysis_server] Expose additional LSP handlers over legacy protocol
Change-Id: I8aae887eba3d35f8086b62f2e9b861e17e41555e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318983
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-08 15:21:53 +00:00
Konstantin Shcheglov 7d83540366 Extension types. Report an error for instance fields in extension types.
Change-Id: I35cb446c45e027a77d0a5ff870b4e5b4b22b7512
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318747
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-07 22:39:55 +00:00
Danny Tuppeny 2a811a0ad9 [analysis_server] Split DartUnitHoverComputer.compute() into smaller methods
No functional changes here, I'm just trying to simplify the hover implementation a little as this method had gotten quite long and deeply nested. We've discussed improving hover support for patterns and keywords and hopefully this'll make that easier.

Change-Id: I974f7fb0fbb99a967b5970f99b36ef3601df4ea3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318701
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-07 18:14:15 +00:00
Konstantin Shcheglov 0cd0412a75 Extension types. Report when invalid type is implemented.
Change-Id: I66c30209a5fe5083f78291ea3ec7e5fd2259164f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318742
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-07 18:06:11 +00:00
Keerti Parthasarathy 360ebb6e50 Wire up a parse option for bulk processor
Change-Id: I8cecd6bf4ac3693e2cf65a66eed809abb571b22a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318362
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2023-08-07 16:29:58 +00:00
Konstantin Shcheglov 6ac57ff0b9 Extension types. Report when a method has the name of an Object member.
Change-Id: I0585451580c1a1921f813a1af574175f04354475
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318741
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-08-07 16:11:59 +00:00
Brian Wilkerson 7901efffe7 Convert a few more methods in KeywordContributor
Change-Id: I905a4855f67db227ab654c3d4dc7441b7ee2bf58
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/315540
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-08-07 16:09:40 +00:00
Danny Tuppeny 17f3a6ec30 [analysis_server] Convert more LSP handlers to work over the legacy protocol
Change-Id: I9bd1f3ffd9bcdb017a4208e4aedcfb7436259fc8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318700
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-07 15:27:46 +00:00
Keerti Parthasarathy 2530047ad2 Add test case for #53101
Change-Id: I0d6956e37e4240f861addf7c71a933071c1498b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318022
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2023-08-07 14:55:14 +00:00
Danny Tuppeny 660c9bbace [analysis_server] Switch LSP completion tests to use new setXxx() capabilities instead of nested withXxxx() capabilities methods
No functional changes, just simplifies the tests a little by calling functions to set capabilities instead of having to nest them inside `initialize()` calls.

Change-Id: I1496da221b1802c3375c32c7e0d048310769bdf9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317961
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-07 14:39:32 +00:00
Danny Tuppeny ea5e58356b [analysis_server] Fix logging of LSP-over-Legacy requests to use the LSP identifiers
Otherwise they'll be recorded as "lsp.handle".

Change-Id: I511d5eef44d6d647fef4d0347a03f6a7a9f88f9e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/315920
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-07 14:27:12 +00:00
Danny Tuppeny 16d787694a [analysis_server] Refactor completion labels in preparation for new LabelDetails support
This is just a little refactoring towards https://github.com/Dart-Code/Dart-Code/issues/2462. It doesn't change anything, it just makes the next CL (with the functional changes) simpler.

Change-Id: I98ed5991f1abb67f86f9d4d43c27ff6ccf21847c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317940
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-06 18:21:31 +00:00
Danny Tuppeny 7f0ac7853e [analysis_server] Fix navigation for the offset between a type name and generic type args
Fixes https://github.com/Dart-Code/Dart-Code/issues/4619

Change-Id: I5cee17037fe4531183dc5e2cb566e9f020e1b541
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316223
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-06 17:37:27 +00:00
Danny Tuppeny 76dc2c4cfa [analysis_server] Change LSP-over-Legacy to be wrapped with the original protocol
Originally we didn't use the LSP Request/Response classes, and just exposed the handlers through the legacy request/response.

However there were some mismatches (such as legacy protocol always returns Map<String, Object?> but some LSP requests return Lists, LSP using int|String IDs, and LSP having numeric error codes that don't match legacy string error codes).

This change uses LSP's request and Response by wrapping them inside a standard (legacy) handler. The LSP-over-Legacy handler has become a standard handler, and the params contain an "lspMessage" field that holds an LSP message, and the result contains an "lspResponse" field that contains an LSP response.

If an LSP handler returns an error, it will be returned as an error inside the LSP response, which will be in a _successful_ legacy request (since that's how we can return an LSP response - as the result).

Change-Id: I67973590ab32f3543d1a6e1b7279974e5e8832bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/315201
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-06 14:32:18 +00:00
Danny Tuppeny 678e207a6d [analysis_server] Fix a bug with sorting semantic tokens
I was trying out DCM and it found this bogus condition.

The only instance I can find where it triggered was adjacent interpolations in strings, and the fallback code (which compares by token type) would handle it correctly, but in case there are other cases (now or in future), I've added an assert to try to avoid reaching the fallback in case it doesn't produce the desired result.

Change-Id: I3092fa4892c812be7d3a91629c5f6ed3be627743
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/315720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-05 19:05:38 +00:00
Konstantin Shcheglov e21306a4eb Extension types. Report when a type parameter is used in a non-covariant position.
Change-Id: I12dbfccdf670cb02f74ddcb787b9e1e4a2b4e6fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318001
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-05 03:51:42 +00:00
Konstantin Shcheglov 508a293029 Revert a few not published API changes.
Change-Id: I093c3d3f6e221cfe874e82b598f52087670ce24e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318020
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-04 19:21:58 +00:00
Konstantin Shcheglov 759d5a5a01 Extension types. Report when await of not Future subtype.
Change-Id: I51b825c1d48b55866d8112ab6421c7937a0c7575
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318024
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-04 19:18:11 +00:00
Konstantin Shcheglov ce7164488a Extension types. Semantic highlighting.
Change-Id: I46cde8151965e209a230df811592f8498e93c218
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318161
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-04 19:13:43 +00:00
Kallen Tu 944a2f691e [analyzer] Make constant assertion errors more helpful and specific.
If a condition is valid, but fails in an assert, make sure we report
that and a pseudo trace with context messages for the user to link
back to the problem.

This CL also starts building the stack trace when we call a super constructor for more detailed errors.

Bug: https://github.com/dart-lang/sdk/issues/36526
Change-Id: Ib9bc9841256644d2380d3f806e3bc3c9d84b37cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316625
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-08-04 17:33:58 +00:00
Danny Tuppeny 02c99b40ab [analysis_server] Handle "Extract Method" in static field declarations
Fixes https://github.com/Dart-Code/Dart-Code/issues/4564

Change-Id: I9119941232cf17af7115fe5476ac1c4faa95cddb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317780
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-02 18:17:38 +00:00
Sam Rawlins 5c9b4ed2cb [analyzer] Remove support for pre-const-update-2018 code
Dart 3's minimum language version is 2.12. google3's is 2.9.

Change-Id: Icd892b0fcec7f2ce9fa813a108519c0bbbd29a52
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317040
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-08-01 21:31:52 +00:00
Danny Tuppeny d9363a6639 [analysis_server] Don't show expression snippets in argument names
Fixes https://github.com/Dart-Code/Dart-Code/issues/4635

Change-Id: I8e8addabc7bd601ad9a9abffb87f318243255932
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316222
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-07-31 20:31:23 +00:00
Danny Tuppeny abc712af72 [analysis_server] Show types when hovering over a wildcard variable pattern
Fixes https://github.com/Dart-Code/Dart-Code/issues/4640

Change-Id: Ide55831c0a7711d2bf2d389742a47cebfbe22f6f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316260
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-07-31 20:26:22 +00:00
Danny Tuppeny 8abaa7b81b [analysis_server] Fix finding references for the offset between a type name and generic type parameters
Fixes https://github.com/Dart-Code/Dart-Code/issues/4668

Change-Id: Ibdb45b5c09ab8de0746239e351b5e581af4bb7df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317080
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-07-31 17:14:33 +00:00
Sam Rawlins 415ff8ece8 [analyzer] Remove all checks for set-literal and extensions enablement
And using Future from dart:core, which was not enabled until Dart
2.1.0.

Dart 3's minimum language version is 2.12. google3's is 2.9.

Change-Id: Id31d92007e685447ff217bdccf8161c8fd6ce6e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316863
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-07-30 00:12:59 +00:00
Kallen Tu 19859a0f91 [analyzer] Add error for deferred constants in const constructors.
There's a false positive with the `prefer_const_constructors` lint where
deferred constant values in const constructors were not being reported
as an error.

This change adds the new error so that the lint doesn't fire.

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

Bug: https://github.com/dart-lang/sdk/issues/48991
Change-Id: I378093c02ec63e0c5eb5a1a8d80c1bbb0c88ba2a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316842
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-07-28 23:47:35 +00:00
Sam Rawlins b87dee93a7 [analyzer] Rename AnalysisOptions.hint to AnalysisOptions.warning
Bug: https://github.com/dart-lang/sdk/issues/50796
Change-Id: I7050b4f758976ff555e43f219c6f5c2b0e8d362a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290903
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-07-28 15:51:05 +00:00
Sam Rawlins ab8736cf7c [analyzer] Remove all checks for ui-as-code enablement
Dart 3's minimum language version is 2.12. google3's is 2.9.

Change-Id: I8303b14de17b695e835cf9f8018f08731b51ec35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316526
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-07-27 02:43:38 +00:00