Commit Graph

1080 Commits

Author SHA1 Message Date
Danny Tuppeny 387e9d9ab2 [analyzer] Include ConditionalExpressions in Flutter Outlines
Fixes https://github.com/Dart-Code/Dart-Code/issues/3196.

Change-Id: I369e48285329c808a092ff677440e159aa7a103b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192688
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-03-24 15:01:21 +00:00
Konstantin Shcheglov 86c5085565 Fix NPE when the return type of a method is inherited.
Change-Id: Iaf77f250c806b116f0f0d6bbd3d9b9ff2ab0090d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192540
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-03-22 21:03:45 +00:00
Brian Wilkerson d00ef8611a Update the server protocol to support passing back the line and column numbers for the end of a range
Change-Id: I8310e4a32cacbe98310c1dbaa3b3563b1ff1a1ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191862
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-03-18 19:22:23 +00:00
Sam Rawlins 1cb203d8c9 Remove unused code and files from analysis_server:
* ManifestFixKind, PubspecFixKind, ImportElementInfo class
* WithNullSafetyMixin mixin
* suggestionComparator function

Change-Id: I9e332be6345b2f2b7b788bc4ae63a075a21cbe06
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190821
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-03-16 05:08:24 +00:00
Brian Wilkerson 55522f9e90 Fix a bug in completion when a setter does not have a corresponding getter
Fixes: https://github.com/dart-lang/sdk/issues/45300
Change-Id: I0a5043b5d395abb426615e8c434f23c20062e182
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191180
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-03-15 17:34:53 +00:00
Brian Wilkerson 917688fe3c Resolve type parameters to their bounds when computing the context type
Change-Id: I34349ccf3728e0cc1f1caab4499896f2f827e85b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190721
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-03-11 18:59:01 +00:00
Brian Wilkerson acdd5231fd Deprecated setters should not take priority over non-deprecated getters
I hadn't really noticed this behavior until we deprecated large numbers
of setters in the AstNode hierarchy.

Change-Id: If068edd0a55a7a828b7ad114ff5812716ff265e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190283
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-03-10 00:55:42 +00:00
Brian Wilkerson 7a862df2d8 Compute the context_type feature in instance creation expressions
Change-Id: I72c34e7ecb24377605b8983bcbdb98bdfd73c6f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190281
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-03-09 23:27:02 +00:00
Konstantin Shcheglov f94484c8d2 Fix AvailableSuggestionSetsTest on Windows.
Change-Id: I1736cb9b28b82b43c5f49661c157fac477ed3a34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190260
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-03-09 22:20:44 +00:00
Keerti Parthasarathy b4adea8f46 Add flutter assist test for Cider
Change-Id: Icc04283fd2d37638fcb7382c55f8d409a627a97f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189880
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-03-09 21:32:12 +00:00
Brian Wilkerson 038c653c08 Fix a bug in the sort_child_property_last fix
Fixes: https://github.com/dart-lang/sdk/issues/45220
Change-Id: I6634443de0fd87983097cb452238b6b1588ae818
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190101
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-03-09 17:51:00 +00:00
Brian Wilkerson 097a825e4a Suggest the fix add_ne_null only when the type of the condition is nullable
Change-Id: Iaad91d5e8b7f5725a8ccb7430eb3f7570a1eea38
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189842
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-03-08 23:13:43 +00:00
Brian Wilkerson 7d971fad1c Stop suggesting non-factory constructors for abstract classes
Change-Id: I3ed6936d36b0f35cea7950ac089c89efacdf0ca6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189680
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-03-08 18:53:51 +00:00
Konstantin Shcheglov f81be2cd8b Use AnalysisDriver.addedFiles for search, remove DriverAnalyzedFiles.
The client that uses Search - DAS, adds analyzed files.
Visiting the file system again to gather analyzed files is wasteful.
DAS now uses AnalysisContextCollection, so the same set of files.

Change-Id: I2b6ba4181e7ed8cda02db152086d13758ea6f4dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189381
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-03-06 05:15:24 +00:00
pq 82ad11aeb9 fix all support for USE_NOT_EQ_NULL
Change-Id: I928c669eed12c7f0a6082db059f7ce4133d4f27a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189164
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2021-03-04 23:14:20 +00:00
pq d202a4c719 fix all fix for USE_EQ_EQ_NULL
Change-Id: I02f78f01b3fcc647dd8e3ca0557cb4f023a745f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189140
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-03-04 21:58:39 +00:00
pq 567d745312 fix all support for REPLACE_BOOLEAN_WITH_BOOL
Change-Id: I9b9c9d1732653697abd66b2d7b0d09e818a33ae3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189101
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-03-04 17:54:39 +00:00
pq 64012a281f fix all support for REMOVE_UNNECESSARY_CAST
Change-Id: I1507f07271390d24aefed9db96a7fbf9e304ff01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189000
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-03-04 16:20:27 +00:00
Konstantin Shcheglov 810d6c7a6b Remove a test for prefer_interpolation_to_compose_strings lint fix.
The lint is not reported after the linter roll.
https://github.com/dart-lang/linter/issues/2490

TBR

Change-Id: I29158445b1395f2bd135d4c67b9322f39eb66fd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189020
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-03-04 07:48:16 +00:00
pq c43be3487b bulk fix support for REMOVE_UNNECESSARY_PARENTHESES
Change-Id: I4ce0336398adab64ba6bd811ab918d3f77a0c6cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2021-03-03 23:01:15 +00:00
Sam Rawlins 8d7dfd6769 Analysis_server: Improve add_null_check fix
This adds add_null_check support for prefix operations, postfix operations,
binary operations, and cascades.

Bug: https://github.com/dart-lang/sdk/issues/43708
Change-Id: I2d1e80f2ccad58adfbac72400ce44efd48751833
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188740
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-03-03 22:31:14 +00:00
Konstantin Shcheglov 26fce2a64a Fixes for plugin_manager_test.dart to work on Windows.
Change-Id: Icf36f67acf716d6b4c0ce534c8fb865e3a97d5ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188840
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-03-03 22:22:34 +00:00
Konstantin Shcheglov 52ea1fd237 Fix for CiderFixesComputerTest on Windows
TBR

Change-Id: Iad1b8148bdc1d87ed57b8eec5593c09a9b4e5148
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188900
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-03-03 21:57:15 +00:00
Brian Wilkerson 38a4d48974 Fix bugs in convert_to_generic_function_syntax
Fixes: https://github.com/dart-lang/sdk/issues/45178
Change-Id: Idcdb392637c85225caeba0bab3f539e30abf55f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188742
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-03-03 21:10:34 +00:00
pq 944169ad81 fix attempts to fix lints not in the producer map
Fixes: https://github.com/dart-lang/sdk/issues/45177

Change-Id: Id3282f69ee1639b45f5de938f30ae414cee4a3cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188780
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2021-03-03 20:01:04 +00:00
pq 4b35c50cbd fix all support for ADD_NE_NULL
Change-Id: I03e09133fa8af48da1395a538c042c1ee33137de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188681
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-03-03 18:22:24 +00:00
Danny Tuppeny d901f7326a [Analyzer] Add code completion for Pub package names
Change-Id: I0fa8fb1c2801e2acb2d2cf75f7efecf4f9058eeb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176120
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-03-03 17:12:58 +00:00
pq e7644d9a4c fix all support for REMOVE_UNUSED_IMPORT
* adds support for non lint fix all fixes
* enables multi fix for REMOVE_UNUSED_IMPORT

Change-Id: Ib08e82686622d449592cd899df8d63873232a703
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188587
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-03-03 02:58:57 +00:00
Konstantin Shcheglov bf4a65cb62 Cache resolved files in FileResolver.
Change-Id: I3df19bb31e962ff6666e3c677d696315f8e8d8e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187720
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-25 23:46:24 +00:00
Konstantin Shcheglov 0e9f75c14c Fix for NPE in ReplaceIfElseWithConditional.
Saw it in crashes and was able to reproduce.

Change-Id: I6cb79b51319730636f1a0200ea0ba71e2ece015a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187620
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-25 21:10:27 +00:00
Konstantin Shcheglov 34bec2f1a5 Deprecate AnalysisDriver.contextRoot
Change-Id: I2dfb7f2f751e3c3ba7cdc11c94b9dfa5ddd35670
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187140
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-25 19:35:11 +00:00
pq 94f6b6ec94 migrate multi-fixes to unique fix kinds
Change-Id: If28b89ebeab3be8120cb9189d7c54eb1393beb6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186741
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-02-25 00:24:35 +00:00
Konstantin Shcheglov f1094d5c3a Use newPubspecYamlFile() to create pubspec.yaml files
Change-Id: I181a3f3f14810019731201bf43e27befa7bc5481
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186420
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-22 21:32:00 +00:00
Brian Wilkerson 191e95fa3e Fix the replace_conditional_with_if_else assist in null safe libraries (issue 45030)
Bug: 45030
Change-Id: I2a0946a490a1e69cab7d1bbac6c9efdabd8926c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186200
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-02-22 18:20:59 +00:00
Konstantin Shcheglov c2195fcc14 Rewrite to use AnalysisContextCollection in analysis_server.
Change-Id: Iee6b392711790d17c25a3c18fa1e9bdfe8b8cc4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185160
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-19 23:01:25 +00:00
Keerti Parthasarathy dcf6b12270 Add CiderAssistComputer to compute assists for Cider.
Change-Id: I6087ccabda0c0749d0027b40ecad5050a2eb0431
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185492
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-02-19 15:08:34 +00:00
Konstantin Shcheglov 2e40e359e2 getElementDeclaration() can return null.
Change-Id: I2c8331d22191587991cd1782525d84f5044a79b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185721
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-19 08:21:37 +00:00
Brian Wilkerson bfe3a31cd4 Add a failing test for issue 45030
Change-Id: I59e9db21ef97286c137e635b1c8bdbd2991b98a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185493
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-02-18 23:29:50 +00:00
Danny Tuppeny a6c14e8848 [analyzer] Insert imports after annotation of first import directive in file
Fixes https://github.com/Dart-Code/Dart-Code/issues/3104.

Change-Id: Ic91727c11cda1436662a52b737094ea87927047c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185220
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-02-16 21:32:50 +00:00
pq 4302f058dd disable legacy fix-all fix creation
Tests to be re-enabled when we wire-up `FixInFileProcessor`.  (Or maybe we want a different approach to testing fix all fixes entirely?  TBD.)

See: https://github.com/dart-lang/sdk/issues/45026

Change-Id: I66f83d06801a71143dcc770cc38d9e2f86782264
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185180
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-02-16 20:50:20 +00:00
Brian Wilkerson 77da201b19 Add a fix for unnecessary_nullable_for_final_variable_declarations
Change-Id: Ibd6570c05f3a289fba72c42f3fc30e88649a9004
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185000
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-02-15 16:26:39 +00:00
Konstantin Shcheglov 51950ab881 Add Resource.parent2 that returns non-null Folder, add Folder.isRoot
A bigger version of than https://dart-review.googlesource.com/c/sdk/+/184381
This is breaking change, so we do this in steps.

Change-Id: I0c7212a073b605ade56657036543c604651810c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184581
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-02-12 19:09:20 +00:00
pq 2d27b34b06 appliedTogetherMessages for fixable in file fixes
Change-Id: I674f0e79c5d7ce5c44bcbddff8e6866106e860c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184621
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2021-02-12 17:10:23 +00:00
pq fbf07bc7b7 migrate towards a shared nonLintProducerMap
Introduces a new map datastructure and migrate BulkFixProcessor to use it.

Change-Id: I6294cce875ac5e5052b363282454af6dadf011f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184320
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2021-02-11 18:37:30 +00:00
Brian Wilkerson 1ee6459ded Fix a bug in addParameter handling
Change-Id: Id321108ce4fbd096ba79212f530486ec2318fba3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184205
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-02-10 22:49:33 +00:00
Konstantin Shcheglov bcbebc8fd5 Fix for resolving package: URIs with space in BazelPackageUriResolver.
Change-Id: I0de91dcb2438205b476dea99fa2231dd189ef094
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184042
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-09 22:26:59 +00:00
pq 7b2dcad078 improved fix in file computation
Follow-up from: https://dart-review.googlesource.com/c/sdk/+/183700

Change-Id: I6d15b25a2dc4664fd3743763fedd83bf39bba794
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184041
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-02-09 22:24:54 +00:00
pq db09afdd1f fix (all) in file processor
Change-Id: I092d99ab8dd7e16fe351cf475a7c935a2546d67c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183700
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2021-02-09 20:35:46 +00:00
Brian Wilkerson cf2e85f035 Generalize FeatureComputerTest to make writing more tests easier
Also, fixed a small bug found by updating the code used to find the node.

Change-Id: Id64e66f4d50f70aaadd3e56e37a83b257d119b9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183181
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-02-06 01:24:28 +00:00
Lasse R.H. Nielsen 222b894d62 Change resolve for package:URIs to not remove package name.
A "package URI" is defined as one with a `package` scheme,
no authority, a first path segment terminated by `/` which
contains no escapes and is not all `.` characters.
This is the definition of package names accepted by .packages
as well: Valid path characters and not all dots.

Change-Id: I9a161d47732e8bf873d278774315c72a4a928823
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117542
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-02-05 18:31:48 +00:00