Skip to content

Commit b8b67c0

Browse files
parloughCommit Queue
authored and
Commit Queue
committed
[cfe] Correct PrivateNamedParameter problem message
Named parameters can't start with underscores whether they are optional or required. Change-Id: Iaaeab80f74a691b4981148f06412a60ca115f73e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/337883 Auto-Submit: Parker Lougheed <[email protected]> Reviewed-by: Paul Berry <[email protected]> Commit-Queue: Paul Berry <[email protected]> Reviewed-by: Johnni Winther <[email protected]>
1 parent ad138aa commit b8b67c0

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12369,7 +12369,8 @@ const Code<Null> codePrivateNamedParameter = messagePrivateNamedParameter;
1236912369
const MessageCode messagePrivateNamedParameter = const MessageCode(
1237012370
"PrivateNamedParameter",
1237112371
analyzerCodes: <String>["PRIVATE_OPTIONAL_PARAMETER"],
12372-
problemMessage: r"""An optional named parameter can't start with '_'.""");
12372+
problemMessage:
12373+
r"""A named parameter can't start with an underscore ('_').""");
1237312374

1237412375
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
1237512376
const Code<Null> codeRecordFieldsCantBePrivate =

pkg/front_end/messages.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1995,7 +1995,7 @@ FunctionTypeDefaultValue:
19951995
analyzerCode: DEFAULT_VALUE_IN_FUNCTION_TYPE
19961996

19971997
PrivateNamedParameter:
1998-
problemMessage: "An optional named parameter can't start with '_'."
1998+
problemMessage: "A named parameter can't start with an underscore ('_')."
19991999
analyzerCode: PRIVATE_OPTIONAL_PARAMETER
20002000

20012001
NoFormals:

tests/language/parameter/initializer6_test.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ class Foo {
1111
Foo.private({this._y = 77}) {}
1212
// ^^
1313
// [analyzer] COMPILE_TIME_ERROR.PRIVATE_OPTIONAL_PARAMETER
14-
// ^
15-
// [cfe] An optional named parameter can't start with '_'.
14+
// [cfe] A named parameter can't start with an underscore ('_').
1615
}
1716

1817
main() {

0 commit comments

Comments
 (0)