Commit graph

48869 commits

Author SHA1 Message Date
Konstantin Shcheglov e3e0275e2c Elements. Migrate DataDriven.
Change-Id: I355e846224549ca2795fee9f9d2b8ae7a4be32e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387351
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-30 00:48:03 +00:00
Konstantin Shcheglov c1bce1be15 Elements. Migrate CreateMethodOrFunction.
Change-Id: I623534c22c6ed9fa793bd11cdb0ae2d4c8575ef1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387350
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-09-29 23:56:50 +00:00
Konstantin Shcheglov 6c5732cc51 Elements. Migrate CreateConstructor.
Change-Id: I8ed5cf761a6a3702f1dd0456c4fc0a11833a3dfd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387385
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-29 23:40:05 +00:00
Konstantin Shcheglov 0c74adfe36 Elements. Migrate ConvertIfStatementToSwitchStatement.
Change-Id: Ieae23ec264152d65302503b4a90ec14f3ef27814
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387348
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-29 23:16:04 +00:00
Konstantin Shcheglov 49654fb991 Elements. Migrate CreateField.
Change-Id: I5f014789fe1cfb6882ed75bbb3f7fa8d0e308ac7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387349
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-29 21:30:14 +00:00
Konstantin Shcheglov 600e8e59a8 Elements. Migrate ConvertToSwitchExpression.
Change-Id: I42cffddeafbd048a962f41e1a6e1fc6908ee1cb3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387347
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-09-29 19:11:16 +00:00
Konstantin Shcheglov f3f9172139 Elements. Migrate CreateConstructorForFinalFields.
Change-Id: Ic10a904acf1011bf6a832ee8980a826054d667cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387384
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-29 18:52:41 +00:00
Konstantin Shcheglov f110d24884 Elements. Migrate ConvertToSuperParameters.
Change-Id: I7315b1d910f375d19bd593571d574ab059691d05
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387346
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-09-29 18:27:24 +00:00
Konstantin Shcheglov 32313a7d83 Elements. Migrate ConvertToNormalParameter.
Change-Id: I0b953f56dc8014690b1c51c694a61a29c26d66cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387345
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-09-29 18:14:17 +00:00
Konstantin Shcheglov 9e90b9011a Elements. Migrate ConvertToWildcardVariable.
Change-Id: If7c9d04bae014d72ab828a188bc1cdde3dd113b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387383
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-29 18:09:21 +00:00
Konstantin Shcheglov e37be602a7 Elements. Migrate ConvertToSetLiteral.
Change-Id: I45428cfea93ac6f4aa780f500c0aea5b3dd1ea2c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387382
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-29 17:53:12 +00:00
Konstantin Shcheglov 41f9ce2e79 Elements. Migrate ConvertToNamedArguments.
Change-Id: I85c7fc36c3dd9069d079d2163480b6f4030bf1d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387344
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-09-29 17:50:40 +00:00
Konstantin Shcheglov 8f6944b1b4 Elements. Migrate ConvertPartOfToUri.
Change-Id: I56958695914a8a731948e263ef2ce414bc71ffa6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387380
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-29 17:17:22 +00:00
Konstantin Shcheglov c775d540b9 Elements. Migrate ConvertMapFromIterableToForLiteral.
Change-Id: I3cf858ecad5cd369d82e343df347d61db121fcc3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387343
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-29 16:54:00 +00:00
Konstantin Shcheglov da356fe47a Elements. Migrate ConvertIntoForIndex.
Change-Id: I1ffaf16b58fdc5c005d7f42233b597328e2be3b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386739
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-09-29 16:42:20 +00:00
Konstantin Shcheglov 02cc82415d Elements. Migrate ConvertIntoFinalField.
Change-Id: I13e4a74ecf0ab252c68abbcd204c1ec89612f35f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386738
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-29 04:52:29 +00:00
Konstantin Shcheglov 3c43538148 Elements. Migrate ConvertIntoBlockBody.
Change-Id: I49ca47fbb38902d31dd0995f9a6cdb771aa61034
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386737
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-29 04:28:12 +00:00
Konstantin Shcheglov 6de30974a4 Elements. Migrate ConvertClassToEnum.
Change-Id: I4642f4a19d374a901a5489467aad3f8bbcfc336a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387341
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-29 04:02:46 +00:00
Konstantin Shcheglov fae76f4672 Elements. Migrate AddTypeAnnotation.
Change-Id: Ic613ceb4dc84be4136faf926100563da444d8ac7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386735
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-09-28 20:47:34 +00:00
Konstantin Shcheglov 2da09ed154 Elements. Migrate AddSuperParameter.
Change-Id: I9519a8919712bf04949c67c26d674163c31466d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387340
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-09-28 17:26:43 +00:00
Konstantin Shcheglov 2d0c5b50a7 Elements. Migrate AddReturnType.
Change-Id: I8910362713383ea5622dd4f8e40291b1e5dcd503
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386734
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-09-28 16:56:45 +00:00
Konstantin Shcheglov 4f1161e1d9 Elements. Migrate AddRequiredKeyword.
Change-Id: I82165c4afbade8430e97ef00c1b89181f6de3f6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386979
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-09-28 16:32:41 +00:00
Konstantin Shcheglov 5a38795859 Elements. Migrate AddNullCheck.
Change-Id: I10a4b424926ecc39c14108e1b591a40bed83584a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386733
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-28 16:10:06 +00:00
Konstantin Shcheglov 0a699f4f11 Elements. Triage already migrated / not necessary files in analysis_server/.
Change-Id: Ie267c30c976a9b25fb5e3576e58317853c5f36e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386977
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-28 15:43:20 +00:00
Konstantin Shcheglov 27479d62be Elements. Migrate AddMissingRequiredArgument.
Change-Id: I155f1be9d36ed45c3a814326864e76b713559881
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387131
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-27 23:06:36 +00:00
Konstantin Shcheglov f956c0f005 Elements. Migrate AddMissingParameterNamed.
Adds a couple tweaks to improve the lint reporting.

Change-Id: I6e85e323cc2f34f1236d46046b033c9bc72999c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387130
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-27 22:44:01 +00:00
pq 645a6193da [element model] migrate avoid_slow_async_io
Bug: https://github.com/dart-lang/linter/issues/5099
Change-Id: I4f67ae413031d5bd8a848fa28aee634e481ab4be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387132
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-09-27 22:17:25 +00:00
pq c69898ab1b [element model] migrate discarded_futures
Bug: https://github.com/dart-lang/linter/issues/5099
Change-Id: I1034c5daf88a33f2d8a18fa8dc01d9e2de10e942
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387321
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-09-27 22:09:50 +00:00
pq 01cc3856ef [element model] migrate unnecessary_statements
Bug: https://github.com/dart-lang/linter/issues/5099
Change-Id: Ia91e1dc12038414b62c4975de3c2ee4769017b5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387129
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-09-27 22:09:22 +00:00
Konstantin Shcheglov ae182d2ca6 Elements. Migrate AddMissingEnumLikeCaseClauses.
Change-Id: I6199929a0ad0c715c3705d396f94e5851c5f3ef0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387323
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-09-27 21:33:56 +00:00
Konstantin Shcheglov 4ed8a6a657 Elements. Disable AnalyzerUseNewElementsTest for Windows.
We will never use it on Windows, only on Mac / Linux.

Change-Id: I01c54ddabefa7269c50432978cd5e609da448b1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387128
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-27 21:17:01 +00:00
Konstantin Shcheglov 482329e5e6 Elements. Migrate AddLate.
Change-Id: I26035d05790b0115f8233a3901bc9cbd31db220b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386976
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-27 20:59:29 +00:00
Konstantin Shcheglov d1702f40be Elements. Migrate AddEnumConstant.
Change-Id: Ie4a1010a5c6cb5515bb8946795516fea7af79fbc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386731
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-27 20:33:16 +00:00
Konstantin Shcheglov dadc46dd4d Elements. Migrate AddKeyToConstructors.
Change-Id: I498becb67634a05507b009a32a96c2d1b699d47e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386975
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-27 20:27:32 +00:00
Konstantin Shcheglov 44e121e38e Elements. Migrate AddFieldFormalParameters.
Change-Id: Ie15ded7793303f2395ce7f1d82357e8d2c3ab41a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386732
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-09-27 20:20:29 +00:00
Keerti Parthasarathy 9e5cf34721 [Element model] Migrate convert_to_field_parameter correction producer
Change-Id: I99bfdd1c2d46b0fa0fe204bcaac4e8548a9ebb2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386973
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2024-09-27 20:09:06 +00:00
Brian Wilkerson 2c701526a6 Remove a broken test and rename a test file in linter
Change-Id: I880fd89a2447c02bded3dbb0196b519dd0542e31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386730
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-09-27 20:08:23 +00:00
Konstantin Shcheglov 47d030cc38 Elements. Add new lint rule to flag using old element model.
The lint must be enabled for a Pub package.

The lint rule reads once the file `analyzer_use_new_elements.txt`
from the root of the package (next to `pubspec.yaml`). The it uses
the read file until DAS is restarted.

The file should have path prefixes from the root of the package.
See the included example for DAS.
It could be also the whole directory, e.g. `lib/src/services/correction/dart/`.
These are just path prefixes, not regular expressions.

Change-Id: Ia3e5ed5f1366302a7d82189cb158f78024fa3a17
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387122
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-27 20:01:03 +00:00
Keerti Parthasarathy 01298121c4 [Element model] Migrate convert_to_package_import and convert_to_relative_import correction producers
Change-Id: I692340aefc1778821d1071fbf01d1e1c851ca09a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387126
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2024-09-27 19:58:37 +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 efd44480bc Elements. Add getters to TypeProvider.
Change-Id: I905a6b9b439e40dc52d3d7378aafb3492167a03b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387127
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-27 19:50:33 +00:00
Brian Wilkerson 5fee5a8277 Fix bug in writeElement2
Change-Id: I666449e780c8545c4bc6e247920fefcdab80c4cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387322
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-09-27 19:03:13 +00:00
Konstantin Shcheglov 7d6d5448dc Elements. Migrate AddExplicitCall.
Change-Id: Idccff2640ec19806cfd3231c5c618c5b84950ad8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386972
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-09-27 18:59:58 +00:00
pq dfe15b19ac [element model] migrate avoid_double_and_int_checks
Bug: https://github.com/dart-lang/linter/issues/5099
Change-Id: I36f41cc74a2050fd3a87d33ff6103741e7d40deb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386726
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-09-27 18:27:59 +00:00
Konstantin Shcheglov 0dd18c67fb Elements. Add VariableDeclaration.declaredElement2
Although saying that VariableDeclaration is _FragmentDeclaration, is
not quite correct. Maybe we should have separate LocalVariableDeclaration.

Change-Id: I81d606258b2c1a639b2df4a11b8da13ef56e98e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386902
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-09-27 18:18:12 +00:00
Sigmund Cherem 00b11411d6 [ddc] support library cycles in the new module format.
We'd like to properly support cases like:

```
a.dart:
  import 'b.dart';
  class A extends B {}
  class C {}

b.dart:
  import 'a.dart'
  class B extends C {}
```

Here both A and B will request a reference to the other during
linking.

We break the cycle by storing libraries in the map after they are
initialized, but before we recursively link them. Now an access to a
library proxy has different guarantees:
* during linking, it guarantees to return an intialized library.
* during program execution, it guarantees to return a linked
  library.

Aside from this change, this CL does a minor change to the logic on
`hotReloadEnd` to not change the state of the `libraries` array on a
hot-reload. This change is technically not necessary, but may help us
more clearly track the invariants of the library map: the new logic
keeps updates to the map monotonic over time.

Change-Id: Id2aafa3d94c6bff32b7ddb326f883f978bff6bf0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/385324
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2024-09-27 18:07:48 +00:00
pq 9db958049b [element model] migrate unnecessary_parenthesis
Bug: https://github.com/dart-lang/linter/issues/5099
Change-Id: Ic0e42a86bcab608ff47f7e7911b8909b7d93c8f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387124
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-09-27 18:05:27 +00:00
Konstantin Shcheglov c58d9319be Completion. Issue 56783. Suggest non-assignable members when not in LHS of assignment.
Bug: https://github.com/dart-lang/sdk/issues/56783
Change-Id: I5e190bd0ebf59e5771d394eb5a72600d40a02a90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386683
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-27 17:55:31 +00:00
pq ae6b4b6d65 [element model] migrate tighten_type_of_initializing_formals
Bug: https://github.com/dart-lang/linter/issues/5099
Change-Id: I8e540237743629b314d1439270b9fc0a33437f48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386970
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-09-27 17:55:05 +00:00
Brian Wilkerson fdcb76d8bf Replace "type variable" with "type parameter" in docs
Change-Id: I98087fcc104ed972c1ca291c7c05cadb08d6d593
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387123
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-09-27 17:32:31 +00:00