Skip to content

Commit a5cacf8

Browse files
pqCommit Queue
authored and
Commit Queue
committed
quick fix for STATIC_GETTER_WITHOUT_BODY
See: #55917 Change-Id: I4a212bc638cc2a36d805af9eedd319fd3dc9c00b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370881 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Phil Quitslund <[email protected]>
1 parent f1cf8c2 commit a5cacf8

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
#
4646
# Stats:
4747
# - 42 "needsEvaluation"
48-
# - 328 "needsFix"
49-
# - 420 "hasFix"
48+
# - 327 "needsFix"
49+
# - 421 "hasFix"
5050
# - 516 "noFix"
5151

5252
AnalysisOptionsErrorCode.INCLUDED_FILE_PARSE_ERROR:
@@ -3209,9 +3209,7 @@ ParserErrorCode.STACK_OVERFLOW:
32093209
ParserErrorCode.STATIC_CONSTRUCTOR:
32103210
status: hasFix
32113211
ParserErrorCode.STATIC_GETTER_WITHOUT_BODY:
3212-
status: needsFix
3213-
notes: |-
3214-
Add an empty body.
3212+
status: hasFix
32153213
ParserErrorCode.STATIC_OPERATOR:
32163214
status: hasFix
32173215
ParserErrorCode.STATIC_SETTER_WITHOUT_BODY:

pkg/analysis_server/lib/src/services/correction/fix_internal.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,6 +1489,9 @@ final _builtInNonLintProducers = <ErrorCode, List<ProducerGenerator>>{
14891489
ParserErrorCode.STATIC_CONSTRUCTOR: [
14901490
RemoveLexeme.keyword,
14911491
],
1492+
ParserErrorCode.STATIC_GETTER_WITHOUT_BODY: [
1493+
ConvertIntoBlockBody.missingBody,
1494+
],
14921495
ParserErrorCode.STATIC_OPERATOR: [
14931496
RemoveLexeme.keyword,
14941497
],

pkg/analysis_server/test/src/services/correction/fix/convert_into_block_body_test.dart

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,22 @@ class A {
161161
// TODO: implement m
162162
}
163163
}
164+
''');
165+
}
166+
167+
Future<void> test_static_getter() async {
168+
await resolveTestCode('''
169+
class C {
170+
static int get g;
171+
}
172+
''');
173+
await assertHasFix('''
174+
class C {
175+
static int get g {
176+
// TODO: implement g
177+
throw UnimplementedError();
178+
}
179+
}
164180
''');
165181
}
166182
}

0 commit comments

Comments
 (0)