Skip to content

Commit 727ca50

Browse files
munificentCommit Queue
authored andcommitted
Revise fix recommendation in compile error help.
Change-Id: I5ea05b6b0ec7f02250f1e265c2a2d8dd9a9e90b5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/457881 Reviewed-by: Connie Ooi <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Auto-Submit: Bob Nystrom <[email protected]> Commit-Queue: Bob Nystrom <[email protected]>
1 parent e2204d3 commit 727ca50

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

pkg/analyzer/messages.yaml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21795,9 +21795,8 @@ ParserErrorCode:
2179521795
documentation: |-
2179621796
#### Description
2179721797

21798-
The analyzer produces this diagnostic when the name of a named parameter
21799-
starts with an underscore and the parameter isn't an initializing formal
21800-
or field parameter.
21798+
The analyzer produces this diagnostic when a named parameter starts with
21799+
an underscore, unless it's an initializing formal or field parameter.
2180121800

2180221801
#### Example
2180321802

@@ -21812,7 +21811,8 @@ ParserErrorCode:
2181221811

2181321812
#### Common fixes
2181421813

21815-
Only use a private named parameter when it refers to a field:
21814+
If the parameter is intended to refer to a field, then add the missing
21815+
field:
2181621816

2181721817
```dart
2181821818
class C {
@@ -21821,6 +21821,16 @@ ParserErrorCode:
2182121821
int get x => _x;
2182221822
}
2182321823
```
21824+
21825+
If the parameter isn't intended to refer to a field, then remove the
21826+
underscore:
21827+
21828+
```dart
21829+
class C {
21830+
C({int x = 0});
21831+
}
21832+
```
21833+
2182421834
REPRESENTATION_FIELD_MODIFIER:
2182521835
parameters: none
2182621836
problemMessage: "Representation fields can't have modifiers."

0 commit comments

Comments
 (0)