Commit 18b93ca
Add a warning for methods named factory
The primary constructors language feature changes the interpretation of
members of the form `factory() {}`. Before the feature that code defines
a method named `factory`, but with the feature enabled that now defines
a factory constructor.
This CL adds a warning that applies when the feature is not enabled that
tells users that methods named `factory`, when there is nothing before
the name of the method such as a return type, will no longer be
supported after the feature is enabled.
In addition, it associates a fix with the diagnostic in order to make it
easier for users to update their code in a way that will preserve the
semantics of the code after the feature is enabled.
I added the check in the `BestPracticesVerifier`, but that might not be
the best place for it. Please let me know if it should be moved.
Change-Id: Iff51d36975a914a4b1e3d9c2497cc23a1485c0b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/466180
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>1 parent 0e9487d commit 18b93caCopy full SHA for 18b93ca
File tree
Expand file treeCollapse file tree
9 files changed
+213
-3
lines changedOpen diff view settings
Filter options
- pkg
- analysis_server
- lib/src/services/correction
- test/src/services/correction/fix
- analyzer
- lib/src
- diagnostic
- error
- test/src/diagnostics
Expand file treeCollapse file tree
9 files changed
+213
-3
lines changedOpen diff view settings
Collapse file
pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
Copy file name to clipboardExpand all lines: pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml+2Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
3898 | 3898 | |
3899 | 3899 | |
3900 | 3900 | |
| 3901 | + |
| 3902 | + |
Collapse file
pkg/analysis_server/lib/src/services/correction/fix_internal.dart
Copy file name to clipboardExpand all lines: pkg/analysis_server/lib/src/services/correction/fix_internal.dart+1Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
525 | 525 | |
526 | 526 | |
527 | 527 | |
| 528 | + |
528 | 529 | |
529 | 530 | |
530 | 531 | |
|
Collapse file
pkg/analysis_server/test/src/services/correction/fix/add_return_type_test.dart
Copy file name to clipboardExpand all lines: pkg/analysis_server/test/src/services/correction/fix/add_return_type_test.dart+28Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
2 | 2 | |
3 | 3 | |
4 | 4 | |
| 5 | + |
5 | 6 | |
| 7 | + |
6 | 8 | |
7 | 9 | |
8 | 10 | |
| ||
12 | 14 | |
13 | 15 | |
14 | 16 | |
| 17 | + |
15 | 18 | |
16 | 19 | |
17 | 20 | |
| ||
300 | 303 | |
301 | 304 | |
302 | 305 | |
| 306 | + |
| 307 | + |
| 308 | + |
| 309 | + |
| 310 | + |
| 311 | + |
| 312 | + |
| 313 | + |
| 314 | + |
| 315 | + |
| 316 | + |
| 317 | + |
| 318 | + |
| 319 | + |
| 320 | + |
| 321 | + |
| 322 | + |
| 323 | + |
| 324 | + |
| 325 | + |
| 326 | + |
| 327 | + |
| 328 | + |
| 329 | + |
| 330 | + |
303 | 331 | |
304 | 332 | |
305 | 333 | |
|
Collapse file
pkg/analyzer/lib/src/diagnostic/diagnostic.g.dart
Copy file name to clipboardExpand all lines: pkg/analyzer/lib/src/diagnostic/diagnostic.g.dart+15Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
3223 | 3223 | |
3224 | 3224 | |
3225 | 3225 | |
| 3226 | + |
| 3227 | + |
| 3228 | + |
| 3229 | + |
| 3230 | + |
| 3231 | + |
| 3232 | + |
| 3233 | + |
| 3234 | + |
| 3235 | + |
| 3236 | + |
| 3237 | + |
| 3238 | + |
| 3239 | + |
| 3240 | + |
3226 | 3241 | |
3227 | 3242 | |
3228 | 3243 | |
|
Collapse file
pkg/analyzer/lib/src/diagnostic/diagnostic_code_values.g.dart
Copy file name to clipboardExpand all lines: pkg/analyzer/lib/src/diagnostic/diagnostic_code_values.g.dart+1Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
214 | 214 | |
215 | 215 | |
216 | 216 | |
| 217 | + |
217 | 218 | |
218 | 219 | |
219 | 220 | |
|
Collapse file
pkg/analyzer/lib/src/error/best_practices_verifier.dart
Copy file name to clipboardExpand all lines: pkg/analyzer/lib/src/error/best_practices_verifier.dart+20-3Lines changed: 20 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
676 | 676 | |
677 | 677 | |
678 | 678 | |
| 679 | + |
679 | 680 | |
680 | 681 | |
681 | 682 | |
| ||
706 | 707 | |
707 | 708 | |
708 | 709 | |
709 | | - |
| 710 | + |
710 | 711 | |
711 | 712 | |
712 | 713 | |
| ||
723 | 724 | |
724 | 725 | |
725 | 726 | |
726 | | - |
| 727 | + |
727 | 728 | |
728 | 729 | |
729 | | - |
| 730 | + |
730 | 731 | |
731 | 732 | |
732 | 733 | |
733 | 734 | |
734 | 735 | |
| 736 | + |
| 737 | + |
| 738 | + |
| 739 | + |
| 740 | + |
| 741 | + |
| 742 | + |
| 743 | + |
| 744 | + |
| 745 | + |
| 746 | + |
| 747 | + |
| 748 | + |
| 749 | + |
| 750 | + |
| 751 | + |
735 | 752 | |
736 | 753 | |
737 | 754 | |
|
Collapse file
+6Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
25329 | 25329 | |
25330 | 25330 | |
25331 | 25331 | |
| 25332 | + |
| 25333 | + |
| 25334 | + |
| 25335 | + |
| 25336 | + |
| 25337 | + |
25332 | 25338 | |
25333 | 25339 | |
25334 | 25340 | |
|
Collapse file
pkg/analyzer/test/src/diagnostics/deprecated_factory_method_test.dart
Copy file name to clipboard+138Lines changed: 138 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | + |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | + |
| 100 | + |
| 101 | + |
| 102 | + |
| 103 | + |
| 104 | + |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | + |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | + |
| 115 | + |
| 116 | + |
| 117 | + |
| 118 | + |
| 119 | + |
| 120 | + |
| 121 | + |
| 122 | + |
| 123 | + |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | + |
| 128 | + |
| 129 | + |
| 130 | + |
| 131 | + |
| 132 | + |
| 133 | + |
| 134 | + |
| 135 | + |
| 136 | + |
| 137 | + |
| 138 | + |
Collapse file
pkg/analyzer/test/src/diagnostics/test_all.dart
Copy file name to clipboardExpand all lines: pkg/analyzer/test/src/diagnostics/test_all.dart+2Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
183 | 183 | |
184 | 184 | |
185 | 185 | |
| 186 | + |
186 | 187 | |
187 | 188 | |
188 | 189 | |
| ||
1079 | 1080 | |
1080 | 1081 | |
1081 | 1082 | |
| 1083 | + |
1082 | 1084 | |
1083 | 1085 | |
1084 | 1086 | |
|
0 commit comments