File tree 4 files changed +40
-0
lines changed
4 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -178,6 +178,27 @@ appears on the left-hand side of more than one _option_ in the same _expression_
178
178
> {{This is {$foo}}}
179
179
> ```
180
180
181
+ ### Duplicate Variant
182
+
183
+ A **_<dfn>Duplicate Variant</dfn>_** error occurs when the same _keys_
184
+ are used for more than one _variant_.
185
+
186
+ > Examples of invalid messages resulting in a _Duplicate Variant_ error:
187
+ >
188
+ > ```
189
+ > .match {$var :string}
190
+ > * {{The first default}}
191
+ > * {{The second default}}
192
+ > ```
193
+ >
194
+ > ```
195
+ > .match {$x :string} {$y :string}
196
+ > * foo {{The first "foo" variant}}
197
+ > bar * {{The "bar" variant}}
198
+ > * |foo| {{The second "foo" variant}}
199
+ > * * {{The default variant}}
200
+ > ```
201
+
181
202
## Resolution Errors
182
203
183
204
**_<dfn>Resolution Errors</dfn>_** occur when the runtime value of a part of a message
Original file line number Diff line number Diff line change @@ -369,6 +369,8 @@ satisfied:
369
369
- At least one _ variant_ MUST exist whose _ keys_ are all equal to the "catch-all" key ` * ` .
370
370
- Each _ selector_ MUST have an _ annotation_ ,
371
371
or contain a _ variable_ that directly or indirectly references a _ declaration_ with an _ annotation_ .
372
+ - Every _ variant_ MUST NOT use the same set of _ keys_ in the same order as another _ variant_ .
373
+ _ Literal_ _ keys_ are compared by their contents, not their syntactical appearance.
372
374
373
375
``` abnf
374
376
matcher = match-statement 1*([s] variant)
Original file line number Diff line number Diff line change 342
342
" missing-selector-annotation" ,
343
343
" duplicate-declaration" ,
344
344
" duplicate-option-name" ,
345
+ " duplicate-variant" ,
345
346
" unresolved-variable" ,
346
347
" unknown-function" ,
347
348
" unsupported-expression" ,
Original file line number Diff line number Diff line change 164
164
"type" : " duplicate-option-name"
165
165
}
166
166
]
167
+ },
168
+ {
169
+ "src" : " .match {$var :string} * {{The first default}} * {{The second default}}" ,
170
+ "expErrors" : [
171
+ {
172
+ "type" : " duplicate-variant"
173
+ }
174
+ ]
175
+ },
176
+ {
177
+ "src" : " .match {$x :string} {$y :string} * foo {{The first foo variant}} bar * {{The bar variant}} * |foo| {{The second foo variant}} * * {{The default variant}}" ,
178
+ "expErrors" : [
179
+ {
180
+ "type" : " duplicate-variant"
181
+ }
182
+ ]
167
183
}
168
184
]
169
185
}
You can’t perform that action at this time.
0 commit comments