Danny Tuppeny
5d84439f5d
[analyzer] Add support for "formatter" in analysis_options + use page_width in LSP
...
This adds support for validation + completion for `formatter/page_width` in analysis_options, and uses this value in preference to the client-supplied value in the LSP server.
It does not yet add support for the legacy protocol, and there are a few questions in https://github.com/dart-lang/sdk/issues/56864#issuecomment-2399289974 .
See https://github.com/dart-lang/sdk/issues/56864
Change-Id: I7844e3abd1191beb9cc24197bbc8aa7c9e9ad4fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388822
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
2024-10-08 16:37:54 +00:00
Alexander Thomas
d4aa30a3ba
Revert "analyzer: Write out qualified extension names in error messages"
...
This reverts commit 10c1d883df .
Reason for revert: g/dart-sdk-rolls/MOLCzv4S-kQ
Original change's description:
> analyzer: Write out qualified extension names in error messages
>
> Fixes https://github.com/dart-lang/sdk/issues/56269
>
> Change-Id: I025966fd4aa3d7c5b71175321f21f95e8c41f086
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388580
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
> Commit-Queue: Samuel Rawlins <srawlins@google.com >
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Change-Id: I613695e90c96e5ffdb4dc56e729dc34be385f5fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388823
Reviewed-by: Samuel Rawlins <srawlins@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Auto-Submit: Alexander Thomas <athom@google.com >
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com >
Commit-Queue: Samuel Rawlins <srawlins@google.com >
Commit-Queue: Alexander Thomas <athom@google.com >
2024-10-08 15:07:38 +00:00
Brian Wilkerson
5fab16aca2
Fix two tests in InheritanceManger3
...
There are still two failing tests, but I wanted to get these in before
some code started depending on the broken behavior.
Change-Id: I50f0e282293e756409064491e74c64311fbdf707
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388666
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com >
2024-10-07 22:57:21 +00:00
Konstantin Shcheglov
164777e2cd
Part. Deprecate LibraryElement.scope
...
Change-Id: I85a24d0f1d0b4251415644fe1438503e41710436
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388682
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
2024-10-07 20:43:10 +00:00
Sam Rawlins
10c1d883df
analyzer: Write out qualified extension names in error messages
...
Fixes https://github.com/dart-lang/sdk/issues/56269
Change-Id: I025966fd4aa3d7c5b71175321f21f95e8c41f086
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388580
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
Commit-Queue: Samuel Rawlins <srawlins@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2024-10-07 18:01:54 +00:00
Konstantin Shcheglov
54c244b936
Test also search for CompilationUnitElement referenced in 'export' and 'part'.
...
Change-Id: I272de045d5e8d3287c568c108cf559955d32a091
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388243
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
2024-10-07 16:28:59 +00:00
Konstantin Shcheglov
95a2ddc688
Parts. Deprecate LibraryElement.parts
...
Change-Id: I4175fa8425728510d6179a0132a56f20af6bf57e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388424
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
2024-10-04 21:02:45 +00:00
Konstantin Shcheglov
eba5e1a619
Parts. Deprecate LibraryElement.prefixes
...
Change-Id: I0bf170dfde143c60c6e69b331ca3e1a8bc2f6448
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388422
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2024-10-04 19:10:45 +00:00
Brian Wilkerson
450c1962d0
Make members a subtype of element rather than fragment
...
Change-Id: I4fce1d1a3a63b79dcfc1b61903e5dcabd7771bfb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388066
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com >
2024-10-04 18:42:33 +00:00
Konstantin Shcheglov
13a052e0e7
Parts. Deprecate LibraryElement.libraryImports
...
Change-Id: I9e3455fda9943123cc0aa0d95617f532bcec670f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388440
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
2024-10-04 18:41:14 +00:00
Konstantin Shcheglov
9e4817cca1
Parts. Move shouldIgnoreUndefined() to CompilationUnitElementImpl.
...
Change-Id: I79921f0e28e7f89165a01f143a92b6d49b7f4af5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388264
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
2024-10-04 17:19:00 +00:00
Konstantin Shcheglov
4e0fe817fd
Parts. Deprecate LibraryElement.libraryExports
...
Change-Id: I5d06bc1a2ce20a275f54f2185f437382ef659a14
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388055
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
2024-10-04 14:34:23 +00:00
Konstantin Shcheglov
a4124616c9
Parts. Deprecate LibraryElement.importedLibraries
...
Change-Id: I3407e7fe0aa92218346d8376854a6e4a639e8013
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388220
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
2024-10-03 21:54:07 +00:00
Konstantin Shcheglov
c87b93c6f1
Add withTokenPreviousNext to AST printer.
...
Bug: https://github.com/dart-lang/sdk/issues/56355
Change-Id: I0cd58070853cfe0fa59788b3ed4586fc156e27d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388054
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
2024-10-03 21:50:31 +00:00
Parker Lougheed
a409a1c07d
[analyzer/linter] Use shared enumeration for lint names
...
This helps to avoid any accidental mispellings, enables find usages, and potentially makes future renames easier.
The primary goal is to make future work in https://github.com/dart-lang/sdk/issues/56835 easier.
Change-Id: I684630a4d6cb145031de0dabc221f247246ea00c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388042
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Auto-Submit: Parker Lougheed <parlough@gmail.com >
Commit-Queue: Phil Quitslund <pquitslund@google.com >
Reviewed-by: Phil Quitslund <pquitslund@google.com >
2024-10-03 21:36:49 +00:00
Konstantin Shcheglov
331ca05414
Elements. Implement PrefixElement2 and PrefixFragment.
...
Change-Id: I547049096efa1ecf56f7b4adb77d21908d2da4db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388121
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
2024-10-03 19:18:48 +00:00
Paul Berry
a602b9ae20
Fix FunctionTypeImpl.hashCode.
...
This change addresses several drawbacks that previously existed in
FunctionTypeImpl.hashCode:
- The hash computation was complex and not cached, potentially slowing
down performance.
- The hash computation failed to differentiate between optional
positional parameters and required positional parameters, leading to
a greater risk of hash collisions.
- The hash computation failed to differentiate between optional named
parameters and required named parameters, leading to a greater risk
of hash collisions.
- The hash computation failed to differentiate between named
parameters based on their names, leading to a greater risk of hash
collisions.
- The hash computation failed to account for the presence or absence
of a nullability suffix, leading to a greater risk of hash
collisions.
- The hash computation distinguished between equivalent types that had
different type formal names, leading to a situation where two
function types might compare equal but have different hash codes.
Of these drawbacks, only the last is a serious issue, since it
violates the implied contract of hash codes; the others are only
potential performance issues.
Change-Id: I9fbe4dd4751e7a070934e5d86de529765e135ac9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388100
Commit-Queue: Paul Berry <paulberry@google.com >
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
2024-10-02 21:55:59 +00:00
FMorschel
2fd313b62a
fix renaming prefix
...
Fixes https://github.com/dart-lang/sdk/issues/56809
R=srawlins@google.com
Change-Id: I3df1f42923e7cb6382f7d6ad9875af6bb91a62a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387381
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Samuel Rawlins <srawlins@google.com >
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com >
Reviewed-by: Samuel Rawlins <srawlins@google.com >
2024-10-02 20:58:13 +00:00
Konstantin Shcheglov
4fe2944776
Parts. Consider 'part' of 'part of lib.name' as an error.
...
Maybe? https://github.com/dart-lang/co19/issues/2907
Change-Id: If64ba74bf8d3ad3f5e1b926f19705ae469c76a5b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387820
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2024-10-02 18:16:14 +00:00
Konstantin Shcheglov
69b358ec81
Parts. Test reusing import prefix, skip a file.
...
Change-Id: I807c15a807c1c8c789e9c4dfcc502278ee0bd98a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387826
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
2024-10-02 16:23:49 +00:00
Devon Carew
1f8aea0c81
Bump lints to a97011b4b031b1df94765dbacd7d92b0b765c8b9
...
Changes:
```
> git log --format="%C(auto) %h %s" af68bf0..a97011b
https://dart.googlesource.com/lints.git/+/a97011b add unintended_html_in_doc_comment; rev to 5.1.0 (211)
```
Diff: https://dart.googlesource.com/lints.git/+/af68bf0cbad88002a2ae19ee8db37b64eb120c32..a97011b4b031b1df94765dbacd7d92b0b765c8b9/
Change-Id: I998d73f5f72e94d5f2922b0751d31620a837555e
Tested: analysis only change
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387601
Reviewed-by: Nate Bosch <nbosch@google.com >
Commit-Queue: Devon Carew <devoncarew@google.com >
2024-09-30 21:48:03 +00:00
Sam Rawlins
9f9e98893f
analyzer: allow visibleForOverride combined with others
...
`_checkForOtherInvalidAccess` first checks whether an access is
explicitly _allowed_, and then goes back through the annotations to
see if something needs to be reported. The `visibleForOverriding` check
was not implemented correctly in this function, to allow combining
annotations.
Fixes https://github.com/dart-lang/sdk/issues/56819
Change-Id: I64b6757e000c29dcf0e0a1559f9d89c0f3855b28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387521
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
Commit-Queue: Samuel Rawlins <srawlins@google.com >
2024-09-30 19:26:29 +00:00
Sam Rawlins
94f7a5af2c
analyzer: Consider nullability when checking identical function types
...
Fixes https://github.com/dart-lang/sdk/issues/54584
Change-Id: I7bc2af3c3c6bc84a1ef13e65dc6ac90977a31c66
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386974
Commit-Queue: Samuel Rawlins <srawlins@google.com >
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
2024-09-30 18:44:51 +00:00
Sam Rawlins
4038b97713
analyzer: track used calls to 'call' on an extension
...
Fixes https://github.com/dart-lang/sdk/issues/55781
Change-Id: I34eb02d4c0f6a44afe98c0224bed779972a415e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387560
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
Commit-Queue: Samuel Rawlins <srawlins@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2024-09-30 16:44:26 +00:00
Sam Rawlins
84a87f47c2
analyzer: Report when type variables are used in constant collection literals
...
Fixes https://github.com/dart-lang/sdk/issues/52244
Change-Id: I2189dc3ef149c51bbf9aaacd22cf4aecfec8f321
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387125
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Samuel Rawlins <srawlins@google.com >
2024-09-27 19:52:59 +00:00
Konstantin Shcheglov
15540bc90a
Elements. Return Element2 from Identifier.element, specifically LocalVariableElement2.
...
Change-Id: If8cb0e75472b542371f8eea794350135b3551283
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386964
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
Reviewed-by: Phil Quitslund <pquitslund@google.com >
2024-09-27 00:26:50 +00:00
Brian Wilkerson
ddf4a687a2
Add new element model members to InheritanceManager3
...
Change-Id: I08e8f9d956c514728ec27d0dc1f68a1d1f323850
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387062
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com >
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
2024-09-26 16:36:30 +00:00
Sam Rawlins
f84a81002c
linter rules: tidy up test support
...
Just little things:
* Convert the class AnalysisOptionsFileConfig and it's `toContent`
method into a single function.
* Convert the class PubspecYamlFileConfig and it's `toContent` method
into a single function.
* Privatize ExpectedDiagnostic fields `diagnosticMatcher`, `offset`,
`length`, `messageContains`,
ExpectedError field `codes`,
ExpectedLint field `lintName`,
LintRuleTest field `collectionIncludedPaths`,
_ContextResolutionTest field `sdkRoot`.
* Privatize `writeTestPackageAnalysisOptionsFile` and
`writeTestPackagePubspecYamlFile`
* Start doc comments with a single-sentence summary (https://dart.dev/effective-dart/documentation#do-start-doc-comments-with-a-single-sentence-summary and https://dart.dev/effective-dart/documentation#do-separate-the-first-sentence-of-a-doc-comment-into-its-own-paragraph )
* Document with third-person verbs (https://dart.dev/effective-dart/documentation#prefer-starting-function-or-method-comments-with-third-person-verbs )
Change-Id: I7d584810cd339f8184fe14c3151b55988bf2cfff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386580
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Samuel Rawlins <srawlins@google.com >
2024-09-26 14:33:04 +00:00
Konstantin Shcheglov
776f4e0427
Elements. Unique LocalVariableElementImpl2 instance for LocalVariableElementImpl, print.
...
And the same for labels.
Change-Id: I64ad24597f87d3104d04118151b79ba9f7c2a79c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
2024-09-26 14:25:00 +00:00
Danny Tuppeny
1833e76658
[analyzer] Read @template definitions in dartdocs of extension members
...
Fixes https://github.com/dart-lang/dartdoc/issues/3888
Fixes https://github.com/Dart-Code/Dart-Code/issues/5284
Change-Id: Ia89d92d4dacb21086a8796b3e84f938d383b52a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386840
Reviewed-by: Samuel Rawlins <srawlins@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com >
2024-09-26 14:21:55 +00:00
Konstantin Shcheglov
8ffaefab10
Don't report InconsistentAnalysisException for package:build
...
Bug: https://github.com/dart-lang/source_gen/issues/721
Change-Id: If9ecb9d9c39a314187121c0622e5663bbc261bd4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386862
Reviewed-by: Phil Quitslund <pquitslund@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
2024-09-26 01:47:29 +00:00
Konstantin Shcheglov
5e5cf385ee
Parts. Report AMBIGUOUS_EXPORT in parts.
...
Change-Id: If900bd4b254c5c89719af61368c9160c2e6ac7ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386684
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Reviewed-by: Phil Quitslund <pquitslund@google.com >
2024-09-25 21:04:09 +00:00
Konstantin Shcheglov
edccc388f5
Elements. Use 'formalParameters' and 'typeParameters' names.
...
Change-Id: I4540f3f23c7b317e54a59037eab6041794c745bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386606
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2024-09-25 16:49:31 +00:00
Chloe Stefantsova
f6fe5615c4
[analyzer][cfe] Generate constraints based on type variable bounds
...
In response to https://github.com/dart-lang/language/issues/3009
Change-Id: I918d392e422f1997736bf2543c8107cb44d3d6f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364721
Reviewed-by: Erik Ernst <eernst@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Michael Thomsen <mit@google.com >
Reviewed-by: Paul Berry <paulberry@google.com >
2024-09-25 10:59:51 +00:00
Parker Lougheed
46cd8b627c
[linter] Move old lint details out of source
...
- Makes way for slowly replacing them with new "why" docs.
- Slightly reduces snapshot size of analysis server
- Colocates docs in the new linter/messages.yaml file.
Change-Id: I8708b8b55455a183ccfa5c9d8c21098ae0655b51
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/385304
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Reviewed-by: Samuel Rawlins <srawlins@google.com >
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com >
Auto-Submit: Parker Lougheed <parlough@gmail.com >
2024-09-24 23:06:34 +00:00
Konstantin Shcheglov
b07eb3b325
Parts. Report PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER in parts.
...
This also moves the target to be the import prefix, not the declaration.
This is how the specification describes it, and scope lookup works.
Change-Id: Ic0f60a6b57bd8760589b1a91be8885fafb5c90c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386602
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
Reviewed-by: Bob Nystrom <rnystrom@google.com >
2024-09-24 21:45:12 +00:00
Konstantin Shcheglov
e9a7079ee3
Elements. Remove _writeCodeRange(), only fragments have offsets.
...
Change-Id: Ie0d1467feda42046620e5c24bbed924906696e0c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386523
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
2024-09-24 20:09:59 +00:00
Konstantin Shcheglov
d063ceb520
Elements. Store 'element2' in NamedTypeImpl, extract 'element' from it.
...
This is a step toward the state where we eventually want to be.
Change-Id: I8d3062478c08a5aac0992ccccd7848d2c74589de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386400
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
2024-09-24 15:55:01 +00:00
Konstantin Shcheglov
2fbdc85da0
Elements. Write InterfaceType.element3 where we write elements.
...
Change-Id: I2a46321d59c83f04f27f67b8335b7f31cddedbe3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386264
Reviewed-by: Phil Quitslund <pquitslund@google.com >
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2024-09-23 22:14:49 +00:00
Konstantin Shcheglov
ca996da11e
Parts. Support for exports from library fragments in ExportLocation.
...
Change-Id: I1f489dbbfe96b0d17e6b8bdb1df262d057f8a4b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386362
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
2024-09-23 21:08:18 +00:00
Konstantin Shcheglov
b058a3a080
Elements. Don't write LibraryImport reference, it does not exist.
...
Change-Id: I420946f08e04248a4f962a218f95c705b7d7ddfb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386340
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2024-09-23 19:55:08 +00:00
Konstantin Shcheglov
09e3261127
Elements. Write FormalParameterElementImpl.
...
Change-Id: Icb61913fe0a195271e507c61e500a3f2be0ec689
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/385960
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
2024-09-23 16:05:32 +00:00
Konstantin Shcheglov
6e0f03fd5e
Elements. Print new elements for resolved AST.
...
Change-Id: I629151c61fafea61b4fe8cd1ff94a828d2a99754
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/385800
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
2024-09-19 12:12:28 +00:00
Konstantin Shcheglov
d695bd0cbd
Elements. Write Element2 as firstFragment#element.
...
In many cases `element:` property is not very interesting, and we
should replace it with checking cross-linking between elements and
fragments.
I kept `element:` for now as a demonstration.
However there are also useful additions, see: superConstructor: <testLibraryFragment>::@class::A::@constructor::new#element
in class_test.dart
Change-Id: I1ad16ddcf73be6af81da92f1d831d5b165629860
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/385362
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
2024-09-18 13:35:52 +00:00
Konstantin Shcheglov
18bf3f3fd8
Elements. Write 'firstFragment' first, instead of 'reference' for Element2.
...
Change-Id: I6eadbb86af7060500b2b52f2fe903c9969445a7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/385323
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
2024-09-13 22:51:29 +00:00
Konstantin Shcheglov
60b56e8ee7
Elements. Give duplicate fields/variables unique references.
...
Change-Id: I3265c9e45e444e4788224fbdf48f7329d0a29a81
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/385082
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2024-09-13 16:15:58 +00:00
Sam Rawlins
b1416116b7
analyzer: rename most API references to 'plugins' to 'legacy plugins'
...
Change-Id: I56217045ff9d4da8a5a556cd709e0f63a507884f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384964
Commit-Queue: Samuel Rawlins <srawlins@google.com >
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2024-09-12 21:25:56 +00:00
Konstantin Shcheglov
35bbfb2314
Parts. Move changes to prepare for removing deprecated 'enclosingElement'.
...
Change-Id: I79804b8907627e54d993a905c62ffc36e6d348b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384963
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
2024-09-12 20:33:20 +00:00
Paul Berry
a3c696fa58
Properly report unreachable switch cases containing when clauses.
...
When determining whether a switch statement is exhaustive, it's
important for the exhaustiveness algorithm to ignore cases containing
`when` clauses, since a `when` clause creates the possiblity that the
case won't match.
Previously, the way this was done in the analyzer was for the
`SpaceCreator.createRootSpace` method to create an unknown space for
cases containing `when` clauses. This approach produced the correct
behavior when determining whether the switch statement as a whole was
exhaustive, but since it discarded information about the pattern being
matched, it limited the ability to determine whether an individual
case was reachable, leading to
https://github.com/dart-lang/sdk/issues/56710 .
To fix this, `SpaceCreator.createRootSpace` is changed so that it
always produces a space that describes the case pattern, regardless of
whether a `when` clause is present, and instead,
`computeExhaustiveness` is responsible for ensuring that the case is
properly excluded from the determination of whether the switch is
exhaustive. This allows `computeExhaustiveness` to properly computate
whether each individual case is reachable, even for cases that have
`when` clauses.
This change in approach produced some minor differences in the test
cases in `pkg/_fe_analyzer_shared/test/exhaustiveness/data`, but these
differences are not user-observable.
Fixes https://github.com/dart-lang/sdk/issues/56710 .
Change-Id: I36629a77c4c1832fb1b8abb6ea7b109e0ca14373
Bug: https://github.com/dart-lang/sdk/issues/56710
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384326
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Commit-Queue: Paul Berry <paulberry@google.com >
2024-09-12 16:30:22 +00:00
Konstantin Shcheglov
e48d848a5e
Parts. Stop writing 'enclosingElement', write 'enclosingElement3' instead.
...
Preparation for a breaking change CL to remove 'enclosingElement'.
Change-Id: Ifd3cc6dc801a7222748421f0935ce8010db93472
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384862
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Konstantin Shcheglov <scheglov@google.com >
2024-09-12 16:22:19 +00:00