Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate Option Name error is a data model error? This is where an implementation might detect it.
Also, note that other text a bit later seems to suggest that this isn't fatal:
"always resolves to some mapping" means that the option array is returned. For at least some messages, the results might be recoverable (i.e. only replacing the expression with the fallback rather than the whole message)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current formatting spec language assumes that it's dealing with a valid message, i.e. one with no data model errors. Duplicate Option Name errors are primarily defined in
errors.md
, but for messages coming from syntax, they're also defined here:message-format-wg/spec/syntax.md
Lines 567 to 568 in e761964
and as with all other data model errors they're required to be detected and emitted before formatting:
message-format-wg/spec/errors.md
Lines 11 to 14 in e761964
So in order to get to this point in formatting, the current spec text must presume that this error has already been checked, and that therefore the condition for triggering it can't happen. So this statement should be removed to remove the current uncertainty it presents.
We also explicitly only allow for Resolution and Formatting errors to be ignored in expressions that aren't being formatted, and not data model errors:
message-format-wg/spec/errors.md
Lines 19 to 21 in e761964
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @eemeli. You're right, we do have that text in
errors.md
, etc.I guess what I'm grappling with is: did we make the right choice here. @catamorphism and @mihnita might weigh in about how they've implemented the checks required by data model (that is, when do they check for duplicate options or missing variant keys or duplicate declarations). I'm fine with blowing up the message for all of these with the possible exception of duplicate option names (and even there I still want to blow up)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like I mentioned in #703 (just repeating it here to make the threads easier to follow) my implementation does a "static checking" pass for data model errors that are not checked during parsing, which is consistent with what @eemeli is saying.