Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a2d7bb4

Browse files
stereotype441Commit Queue
authored and
Commit Queue
committed
[messages] Move TransformSetErrorCodes into a new yaml file in package:analysis_server.
Since these error codes are generated into the analysis server, it makes sense for their yaml source to be located inside the server too. This paves the way for a CL that will remove information about the particular diagnostic classes from the code generation logic; once that happens the only way for the code generation to know where to put the generated error codes will be to look at where their yaml source is defined. Change-Id: I6a6a6964418eb42bdabd129a1a19848a1fc22ebb Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/461982 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Paul Berry <paulberry@google.com>
1 parent 1d326c0 commit a2d7bb4

File tree

5 files changed

+142
-117
lines changed

5 files changed

+142
-117
lines changed

‎pkg/analysis_server/messages.yaml‎

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
2+
# for details. All rights reserved. Use of this source code is governed by a
3+
# BSD-style license that can be found in the LICENSE file.
4+
5+
# Run
6+
#
7+
# dart run pkg/analyzer/tool/messages/generate.dart
8+
#
9+
# to regenerate messages after having edited this file.
10+
11+
# See `pkg/analyzer/messages.yaml` for a description of the contents
12+
# of this file.
13+
14+
TransformSetErrorCode:
15+
conflicting_key:
16+
parameters:
17+
Object p0: the conflicting key
18+
Object p1: the key that it conflicts with
19+
problemMessage: "The key '#p0' can't be used when '#p1' is also used."
20+
hasPublishedDocs: false
21+
expected_primary:
22+
parameters: none
23+
problemMessage: "Expected either an identifier or a string literal."
24+
hasPublishedDocs: false
25+
incompatible_element_kind:
26+
parameters:
27+
Object p0: the old kind
28+
Object p1: the new kind
29+
problemMessage: "An element of kind '#p0' can't be replaced by an element of kind '#p1'."
30+
hasPublishedDocs: false
31+
invalid_change_for_kind:
32+
parameters:
33+
Object p0: the change kind that is invalid
34+
Object p1: the element kind for the transform
35+
problemMessage: "A change of type '#p0' can't be used for an element of kind '#p1'."
36+
hasPublishedDocs: false
37+
invalid_character:
38+
parameters:
39+
Object p0: the character that is invalid
40+
problemMessage: "Invalid character '#p0'."
41+
hasPublishedDocs: false
42+
invalid_key:
43+
parameters:
44+
Object p0: the actual type of the key
45+
problemMessage: "Keys must be of type 'String' but found the type '#p0'."
46+
hasPublishedDocs: false
47+
invalid_required_if:
48+
parameters: none
49+
problemMessage: "The key 'requiredIf' can only be used with optional named parameters."
50+
hasPublishedDocs: false
51+
invalid_value:
52+
parameters:
53+
Object p0: the key with which the value is associated
54+
Object p1: the expected type of the value
55+
Object p2: the actual type of the value
56+
problemMessage: "The value of '#p0' should be of type '#p1' but is of type '#p2'."
57+
hasPublishedDocs: false
58+
invalid_parameter_style:
59+
parameters:
60+
Object p0: the list of valid parameter styles
61+
problemMessage: "The parameter style must be one of the following: #p0."
62+
hasPublishedDocs: false
63+
invalid_value_one_of:
64+
parameters:
65+
Object p0: the key with which the value is associated
66+
Object p1: the allowed values as a comma-separated list
67+
problemMessage: "The value of '#p0' must be one of the following: '#p1'."
68+
hasPublishedDocs: false
69+
missing_key:
70+
parameters:
71+
Object p0: the missing key
72+
problemMessage: "Missing the required key '#p0'."
73+
hasPublishedDocs: false
74+
missing_one_of_multiple_keys:
75+
parameters:
76+
Object p0: the list of valid keys
77+
problemMessage: "Exactly one of the following keys must be provided: #p0."
78+
hasPublishedDocs: false
79+
missing_template_end:
80+
parameters: none
81+
problemMessage: "Missing the end brace for the template."
82+
hasPublishedDocs: false
83+
missing_token:
84+
parameters:
85+
Object p0: a description of the expected kinds of tokens
86+
problemMessage: "Expected to find #p0."
87+
hasPublishedDocs: false
88+
missing_uri:
89+
parameters: none
90+
problemMessage: "At least one URI must be provided."
91+
hasPublishedDocs: false
92+
undefined_variable:
93+
parameters:
94+
Object p0: the missing key
95+
problemMessage: "The variable '#p0' isn't defined."
96+
hasPublishedDocs: false
97+
unexpected_transform_set_token:
98+
parameters:
99+
Object p0: the token that was unexpectedly found
100+
problemMessage: "Didn't expect to find #p0."
101+
hasPublishedDocs: false
102+
unknown_accessor:
103+
parameters:
104+
Object p0: a description of the expected kind of token
105+
problemMessage: "The accessor '#p0' is invalid."
106+
hasPublishedDocs: false
107+
unsupported_key:
108+
parameters:
109+
Object p0: the unsupported key
110+
problemMessage: "The key '#p0' isn't supported."
111+
hasPublishedDocs: false
112+
unsupported_static:
113+
parameters: none
114+
problemMessage: "The key 'static' is only supported for elements in a class, enum, extension, or mixin."
115+
hasPublishedDocs: false
116+
unsupported_version:
117+
parameters: none
118+
problemMessage: "Only version '1' is supported at this time."
119+
hasPublishedDocs: false
120+
wrong_token:
121+
parameters:
122+
Object p0: a description of the expected kind of token
123+
Object p1: a description of the actual kind of token
124+
problemMessage: "Expected to find #p0, but found #p1."
125+
hasPublishedDocs: false
126+
yaml_syntax_error:
127+
parameters:
128+
Object p0: the message produced by the YAML parser
129+
problemMessage: "Parse error: #p0"
130+
hasPublishedDocs: false

‎pkg/analyzer/messages.yaml‎

Lines changed: 0 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -23302,123 +23302,6 @@ TodoCode:
2330223302
hasPublishedDocs: false
2330323303
comment: |-
2330423304
A TODO comment marked as UNDONE.
23305-
TransformSetErrorCode:
23306-
conflicting_key:
23307-
parameters:
23308-
Object p0: the conflicting key
23309-
Object p1: the key that it conflicts with
23310-
problemMessage: "The key '#p0' can't be used when '#p1' is also used."
23311-
hasPublishedDocs: false
23312-
expected_primary:
23313-
parameters: none
23314-
problemMessage: "Expected either an identifier or a string literal."
23315-
hasPublishedDocs: false
23316-
incompatible_element_kind:
23317-
parameters:
23318-
Object p0: the old kind
23319-
Object p1: the new kind
23320-
problemMessage: "An element of kind '#p0' can't be replaced by an element of kind '#p1'."
23321-
hasPublishedDocs: false
23322-
invalid_change_for_kind:
23323-
parameters:
23324-
Object p0: the change kind that is invalid
23325-
Object p1: the element kind for the transform
23326-
problemMessage: "A change of type '#p0' can't be used for an element of kind '#p1'."
23327-
hasPublishedDocs: false
23328-
invalid_character:
23329-
parameters:
23330-
Object p0: the character that is invalid
23331-
problemMessage: "Invalid character '#p0'."
23332-
hasPublishedDocs: false
23333-
invalid_key:
23334-
parameters:
23335-
Object p0: the actual type of the key
23336-
problemMessage: "Keys must be of type 'String' but found the type '#p0'."
23337-
hasPublishedDocs: false
23338-
invalid_required_if:
23339-
parameters: none
23340-
problemMessage: "The key 'requiredIf' can only be used with optional named parameters."
23341-
hasPublishedDocs: false
23342-
invalid_value:
23343-
parameters:
23344-
Object p0: the key with which the value is associated
23345-
Object p1: the expected type of the value
23346-
Object p2: the actual type of the value
23347-
problemMessage: "The value of '#p0' should be of type '#p1' but is of type '#p2'."
23348-
hasPublishedDocs: false
23349-
invalid_parameter_style:
23350-
parameters:
23351-
Object p0: the list of valid parameter styles
23352-
problemMessage: "The parameter style must be one of the following: #p0."
23353-
hasPublishedDocs: false
23354-
invalid_value_one_of:
23355-
parameters:
23356-
Object p0: the key with which the value is associated
23357-
Object p1: the allowed values as a comma-separated list
23358-
problemMessage: "The value of '#p0' must be one of the following: '#p1'."
23359-
hasPublishedDocs: false
23360-
missing_key:
23361-
parameters:
23362-
Object p0: the missing key
23363-
problemMessage: "Missing the required key '#p0'."
23364-
hasPublishedDocs: false
23365-
missing_one_of_multiple_keys:
23366-
parameters:
23367-
Object p0: the list of valid keys
23368-
problemMessage: "Exactly one of the following keys must be provided: #p0."
23369-
hasPublishedDocs: false
23370-
missing_template_end:
23371-
parameters: none
23372-
problemMessage: "Missing the end brace for the template."
23373-
hasPublishedDocs: false
23374-
missing_token:
23375-
parameters:
23376-
Object p0: a description of the expected kinds of tokens
23377-
problemMessage: "Expected to find #p0."
23378-
hasPublishedDocs: false
23379-
missing_uri:
23380-
parameters: none
23381-
problemMessage: "At least one URI must be provided."
23382-
hasPublishedDocs: false
23383-
undefined_variable:
23384-
parameters:
23385-
Object p0: the missing key
23386-
problemMessage: "The variable '#p0' isn't defined."
23387-
hasPublishedDocs: false
23388-
unexpected_transform_set_token:
23389-
parameters:
23390-
Object p0: the token that was unexpectedly found
23391-
problemMessage: "Didn't expect to find #p0."
23392-
hasPublishedDocs: false
23393-
unknown_accessor:
23394-
parameters:
23395-
Object p0: a description of the expected kind of token
23396-
problemMessage: "The accessor '#p0' is invalid."
23397-
hasPublishedDocs: false
23398-
unsupported_key:
23399-
parameters:
23400-
Object p0: the unsupported key
23401-
problemMessage: "The key '#p0' isn't supported."
23402-
hasPublishedDocs: false
23403-
unsupported_static:
23404-
parameters: none
23405-
problemMessage: "The key 'static' is only supported for elements in a class, enum, extension, or mixin."
23406-
hasPublishedDocs: false
23407-
unsupported_version:
23408-
parameters: none
23409-
problemMessage: "Only version '1' is supported at this time."
23410-
hasPublishedDocs: false
23411-
wrong_token:
23412-
parameters:
23413-
Object p0: a description of the expected kind of token
23414-
Object p1: a description of the actual kind of token
23415-
problemMessage: "Expected to find #p0, but found #p1."
23416-
hasPublishedDocs: false
23417-
yaml_syntax_error:
23418-
parameters:
23419-
Object p0: the message produced by the YAML parser
23420-
problemMessage: "Parse error: #p0"
23421-
hasPublishedDocs: false
2342223305
WarningCode:
2342323306
ARGUMENT_TYPE_NOT_ASSIGNABLE_TO_ERROR_HANDLER:
2342423307
parameters:

‎pkg/analyzer/test/verify_diagnostics_test.dart‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ class DocumentationValidator {
220220
Future<void> validate() async {
221221
await _validateMessages(feAnalyzerSharedMessages);
222222
await _validateMessages(analyzerMessages);
223+
await _validateMessages(analysisServerMessages);
223224
await _validateMessages(lintMessages);
224225
if (buffer.isNotEmpty) {
225226
fail(buffer.toString());

‎pkg/analyzer_utilities/lib/analyzer_messages.dart‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,16 @@ const transformSetErrorCodeFile = GeneratedDiagnosticFile(
184184
package: AnalyzerDiagnosticPackage.analysisServer,
185185
);
186186

187+
/// Decoded messages from the analysis server's `messages.yaml` file.
188+
final List<AnalyzerMessage> analysisServerMessages = decodeAnalyzerMessagesYaml(
189+
analysisServerPkgPath,
190+
);
191+
192+
/// The path to the `analysis_server` package.
193+
final String analysisServerPkgPath = normalize(
194+
join(pkg_root.packageRoot, 'analysis_server'),
195+
);
196+
187197
/// Decoded messages from the analyzer's `messages.yaml` file.
188198
final List<AnalyzerMessage> analyzerMessages = decodeAnalyzerMessagesYaml(
189199
analyzerPkgPath,

‎pkg/analyzer_utilities/lib/messages.dart‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ final DiagnosticTables diagnosticTables = DiagnosticTables._([
3333
...frontEndMessages,
3434
...feAnalyzerSharedMessages,
3535
...analyzerMessages,
36+
...analysisServerMessages,
3637
...lintMessages,
3738
]);
3839

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /