Replace constant with value in messages and docs
Change-Id: Id5829e5b9de6b3ca59c0f2fa5e7a534c64c696d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361001
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Marya Belanger <mbelanger@google.com>
diff --git a/pkg/analyzer/lib/src/error/codes.g.dart b/pkg/analyzer/lib/src/error/codes.g.dart
index a6ab2bb..8738609 100644
--- a/pkg/analyzer/lib/src/error/codes.g.dart
+++ b/pkg/analyzer/lib/src/error/codes.g.dart
@@ -1409,14 +1409,14 @@
static const CompileTimeErrorCode ENUM_CONSTANT_INVOKES_FACTORY_CONSTRUCTOR =
CompileTimeErrorCode(
'ENUM_CONSTANT_INVOKES_FACTORY_CONSTRUCTOR',
- "An enum constant can't invoke a factory constructor.",
+ "An enum value can't invoke a factory constructor.",
correctionMessage: "Try using a generative constructor.",
);
static const CompileTimeErrorCode ENUM_CONSTANT_SAME_NAME_AS_ENCLOSING =
CompileTimeErrorCode(
'ENUM_CONSTANT_SAME_NAME_AS_ENCLOSING',
- "The name of the enum constant can't be the same as the enum's name.",
+ "The name of the enum value can't be the same as the enum's name.",
correctionMessage: "Try renaming the constant.",
hasPublishedDocs: true,
);
@@ -2872,7 +2872,7 @@
INVALID_REFERENCE_TO_GENERATIVE_ENUM_CONSTRUCTOR = CompileTimeErrorCode(
'INVALID_REFERENCE_TO_GENERATIVE_ENUM_CONSTRUCTOR',
"Generative enum constructors can only be used as targets of redirection.",
- correctionMessage: "Try using an enum constant, or a factory constructor.",
+ correctionMessage: "Try using an enum value, or a factory constructor.",
hasPublishedDocs: true,
);
@@ -5284,7 +5284,7 @@
);
/// Parameters:
- /// 0: the name of the enum constant that is not defined
+ /// 0: the name of the enum value that is not defined
/// 1: the name of the enum used to access the constant
static const CompileTimeErrorCode UNDEFINED_ENUM_CONSTANT =
CompileTimeErrorCode(
diff --git a/pkg/analyzer/messages.yaml b/pkg/analyzer/messages.yaml
index c5136a4..dca2811 100644
--- a/pkg/analyzer/messages.yaml
+++ b/pkg/analyzer/messages.yaml
@@ -4254,22 +4254,22 @@
}
```
ENUM_CONSTANT_INVOKES_FACTORY_CONSTRUCTOR:
- problemMessage: "An enum constant can't invoke a factory constructor."
+ problemMessage: "An enum value can't invoke a factory constructor."
correctionMessage: Try using a generative constructor.
ENUM_CONSTANT_SAME_NAME_AS_ENCLOSING:
- problemMessage: "The name of the enum constant can't be the same as the enum's name."
+ problemMessage: "The name of the enum value can't be the same as the enum's name."
correctionMessage: Try renaming the constant.
hasPublishedDocs: true
documentation: |-
#### Description
- The analyzer produces this diagnostic when an enum constant has the same
- name as the enum in which it's declared.
+ The analyzer produces this diagnostic when an enum value has the same name
+ as the enum in which it's declared.
#### Example
- The following code produces this diagnostic because the enum constant `E`
- has the same name as the enclosing enum `E`:
+ The following code produces this diagnostic because the enum value `E` has
+ the same name as the enclosing enum `E`:
```dart
enum E {
@@ -4302,14 +4302,14 @@
documentation: |-
#### Description
- The analyzer produces this diagnostic when an enum constant is being
- created using either a factory constructor or a generative constructor
- that isn't marked as being `const`.
+ The analyzer produces this diagnostic when an enum value is being created
+ using either a factory constructor or a generative constructor that isn't
+ marked as being `const`.
#### Example
- The following code produces this diagnostic because the enum constant `e`
- is being initialized by a factory constructor:
+ The following code produces this diagnostic because the enum value `e` is
+ being initialized by a factory constructor:
```dart
enum E {
@@ -4344,8 +4344,8 @@
The analyzer produces this diagnostic when a mixin that's applied to an
enum declares one or more instance variables. This isn't allowed because
- the enum constants are constant, and there isn't any way for the
- constructor in the enum to initialize any of the mixin's fields.
+ the enum values are constant, and there isn't any way for the constructor
+ in the enum to initialize any of the mixin's fields.
#### Example
@@ -8834,7 +8834,7 @@
4: the type of the overridden setter.
INVALID_REFERENCE_TO_GENERATIVE_ENUM_CONSTRUCTOR:
problemMessage: Generative enum constructors can only be used as targets of redirection.
- correctionMessage: Try using an enum constant, or a factory constructor.
+ correctionMessage: Try using an enum value, or a factory constructor.
hasPublishedDocs: true
documentation: |-
#### Description
@@ -8861,7 +8861,7 @@
#### Common fixes
- If there's an enum constant with the same value, or if you add such a
+ If there's an enum value with the same value, or if you add such a
constant, then reference the constant directly:
```dart
@@ -16664,13 +16664,13 @@
hasPublishedDocs: true
comment: |-
Parameters:
- 0: the name of the enum constant that is not defined
+ 0: the name of the enum value that is not defined
1: the name of the enum used to access the constant
documentation: |-
#### Description
- The analyzer produces this diagnostic when it encounters an identifier that
- appears to be the name of an enum constant, and the name either isn't
+ The analyzer produces this diagnostic when it encounters an identifier
+ that appears to be the name of an enum value, and the name either isn't
defined or isn't visible in the scope in which it's being referenced.
#### Example
@@ -16715,11 +16715,11 @@
#### Description
The analyzer produces this diagnostic when the constructor invoked to
- initialize an enum constant doesn't exist.
+ initialize an enum value doesn't exist.
#### Examples
- The following code produces this diagnostic because the enum constant `c`
+ The following code produces this diagnostic because the enum value `c`
is being initialized by the unnamed constructor, but there's no unnamed
constructor defined in `E`:
@@ -16731,9 +16731,9 @@
}
```
- The following code produces this diagnostic because the enum constant `c`
- is being initialized by the constructor named `x`, but there's no
- constructor named `x` defined in `E`:
+ The following code produces this diagnostic because the enum value `c` is
+ being initialized by the constructor named `x`, but there's no constructor
+ named `x` defined in `E`:
```dart
enum E {
@@ -16745,9 +16745,9 @@
#### Common fixes
- If the enum constant is being initialized by the unnamed constructor and
- one of the named constructors should have been used, then add the name of
- the constructor:
+ If the enum value is being initialized by the unnamed constructor and one
+ of the named constructors should have been used, then add the name of the
+ constructor:
```dart
enum E {
@@ -16757,8 +16757,8 @@
}
```
- If the enum constant is being initialized by the unnamed constructor and
- none of the named constructors are appropriate, then define the unnamed
+ If the enum value is being initialized by the unnamed constructor and none
+ of the named constructors are appropriate, then define the unnamed
constructor:
```dart
@@ -16769,9 +16769,9 @@
}
```
- If the enum constant is being initialized by a named constructor and one
- of the existing constructors should have been used, then change the name
- of the constructor being invoked (or remove it if the unnamed constructor
+ If the enum value is being initialized by a named constructor and one of
+ the existing constructors should have been used, then change the name of
+ the constructor being invoked (or remove it if the unnamed constructor
should be used):
```dart
@@ -16783,9 +16783,9 @@
}
```
- If the enum constant is being initialized by a named constructor and none
- of the existing constructors should have been used, then define a
- constructor with the name that was used:
+ If the enum value is being initialized by a named constructor and none of
+ the existing constructors should have been used, then define a constructor
+ with the name that was used:
```dart
enum E {
@@ -17879,7 +17879,7 @@
#### Description
The analyzer produces this diagnostic when an enum declaration defines a
- member named `values`, whether the member is an enum constant, an instance
+ member named `values`, whether the member is an enum value, an instance
member, or a static member.
Any such member conflicts with the implicit declaration of the static
@@ -18170,14 +18170,14 @@
documentation: |-
#### Description
- The analyzer produces this diagnostic when an enum constant in an enum
- that has type parameters is instantiated and type arguments are provided,
- but the number of type arguments isn't the same as the number of type
+ The analyzer produces this diagnostic when an enum value in an enum that
+ has type parameters is instantiated and type arguments are provided, but
+ the number of type arguments isn't the same as the number of type
parameters.
#### Example
- The following code produces this diagnostic because the enum constant `c`
+ The following code produces this diagnostic because the enum value `c`
provides one type argument even though the enum `E` is declared to have
two type parameters:
@@ -22268,7 +22268,7 @@
#### Example
- The following code produces this diagnostic because the enum constant `e2`
+ The following code produces this diagnostic because the enum value `e2`
isn't handled:
```dart
@@ -24125,7 +24125,7 @@
Most commonly, when complete with local testing, the reference to the
member should be removed.
-
+
If building additional functionality on top of the member, annotate the
newly added member with `@doNotSubmit` as well:
@@ -24133,7 +24133,7 @@
import 'package:meta/meta.dart';
import 'a.dart';
-
+
@doNotSubmit
void emulateCrashWithOtherFunctionality() {
emulateCrash();
diff --git a/pkg/analyzer/tool/diagnostics/diagnostics.md b/pkg/analyzer/tool/diagnostics/diagnostics.md
index 14090ad..0f7304e 100644
--- a/pkg/analyzer/tool/diagnostics/diagnostics.md
+++ b/pkg/analyzer/tool/diagnostics/diagnostics.md
@@ -5257,17 +5257,17 @@
### enum_constant_same_name_as_enclosing
-_The name of the enum constant can't be the same as the enum's name._
+_The name of the enum value can't be the same as the enum's name._
#### Description
-The analyzer produces this diagnostic when an enum constant has the same
-name as the enum in which it's declared.
+The analyzer produces this diagnostic when an enum value has the same name
+as the enum in which it's declared.
#### Example
-The following code produces this diagnostic because the enum constant `E`
-has the same name as the enclosing enum `E`:
+The following code produces this diagnostic because the enum value `E` has
+the same name as the enclosing enum `E`:
```dart
enum E {
@@ -5299,14 +5299,14 @@
#### Description
-The analyzer produces this diagnostic when an enum constant is being
-created using either a factory constructor or a generative constructor
-that isn't marked as being `const`.
+The analyzer produces this diagnostic when an enum value is being created
+using either a factory constructor or a generative constructor that isn't
+marked as being `const`.
#### Example
-The following code produces this diagnostic because the enum constant `e`
-is being initialized by a factory constructor:
+The following code produces this diagnostic because the enum value `e` is
+being initialized by a factory constructor:
```dart
enum E {
@@ -5338,8 +5338,8 @@
The analyzer produces this diagnostic when a mixin that's applied to an
enum declares one or more instance variables. This isn't allowed because
-the enum constants are constant, and there isn't any way for the
-constructor in the enum to initialize any of the mixin's fields.
+the enum values are constant, and there isn't any way for the constructor
+in the enum to initialize any of the mixin's fields.
#### Example
@@ -10875,7 +10875,7 @@
#### Common fixes
-If there's an enum constant with the same value, or if you add such a
+If there's an enum value with the same value, or if you add such a
constant, then reference the constant directly:
```dart
@@ -12576,7 +12576,7 @@
#### Example
-The following code produces this diagnostic because the enum constant `e2`
+The following code produces this diagnostic because the enum value `e2`
isn't handled:
```dart
@@ -21212,8 +21212,8 @@
#### Description
-The analyzer produces this diagnostic when it encounters an identifier that
-appears to be the name of an enum constant, and the name either isn't
+The analyzer produces this diagnostic when it encounters an identifier
+that appears to be the name of an enum value, and the name either isn't
defined or isn't visible in the scope in which it's being referenced.
#### Example
@@ -21256,11 +21256,11 @@
#### Description
The analyzer produces this diagnostic when the constructor invoked to
-initialize an enum constant doesn't exist.
+initialize an enum value doesn't exist.
#### Examples
-The following code produces this diagnostic because the enum constant `c`
+The following code produces this diagnostic because the enum value `c`
is being initialized by the unnamed constructor, but there's no unnamed
constructor defined in `E`:
@@ -21272,9 +21272,9 @@
}
```
-The following code produces this diagnostic because the enum constant `c`
-is being initialized by the constructor named `x`, but there's no
-constructor named `x` defined in `E`:
+The following code produces this diagnostic because the enum value `c` is
+being initialized by the constructor named `x`, but there's no constructor
+named `x` defined in `E`:
```dart
enum E {
@@ -21286,9 +21286,9 @@
#### Common fixes
-If the enum constant is being initialized by the unnamed constructor and
-one of the named constructors should have been used, then add the name of
-the constructor:
+If the enum value is being initialized by the unnamed constructor and one
+of the named constructors should have been used, then add the name of the
+constructor:
```dart
enum E {
@@ -21298,8 +21298,8 @@
}
```
-If the enum constant is being initialized by the unnamed constructor and
-none of the named constructors are appropriate, then define the unnamed
+If the enum value is being initialized by the unnamed constructor and none
+of the named constructors are appropriate, then define the unnamed
constructor:
```dart
@@ -21310,9 +21310,9 @@
}
```
-If the enum constant is being initialized by a named constructor and one
-of the existing constructors should have been used, then change the name
-of the constructor being invoked (or remove it if the unnamed constructor
+If the enum value is being initialized by a named constructor and one of
+the existing constructors should have been used, then change the name of
+the constructor being invoked (or remove it if the unnamed constructor
should be used):
```dart
@@ -21324,9 +21324,9 @@
}
```
-If the enum constant is being initialized by a named constructor and none
-of the existing constructors should have been used, then define a
-constructor with the name that was used:
+If the enum value is being initialized by a named constructor and none of
+the existing constructors should have been used, then define a constructor
+with the name that was used:
```dart
enum E {
@@ -23371,7 +23371,7 @@
#### Description
The analyzer produces this diagnostic when an enum declaration defines a
-member named `values`, whether the member is an enum constant, an instance
+member named `values`, whether the member is an enum value, an instance
member, or a static member.
Any such member conflicts with the implicit declaration of the static
@@ -23644,14 +23644,14 @@
#### Description
-The analyzer produces this diagnostic when an enum constant in an enum
-that has type parameters is instantiated and type arguments are provided,
-but the number of type arguments isn't the same as the number of type
+The analyzer produces this diagnostic when an enum value in an enum that
+has type parameters is instantiated and type arguments are provided, but
+the number of type arguments isn't the same as the number of type
parameters.
#### Example
-The following code produces this diagnostic because the enum constant `c`
+The following code produces this diagnostic because the enum value `c`
provides one type argument even though the enum `E` is declared to have
two type parameters: