Description
Consider the following syntactically incorrect message:
.local $bar {|foo|} {{{$bar}}}
This is incorrect because the "=" between $bar
and {|foo|}
is missing.
The spec requires the implementation to signal a syntax error, but also provide a partial result.
Should the result of formatting be foo
since the right-hand side of the declaration is syntactically correct, although the declaration itself isn't? Or should it be {$bar}
because no valid declaration for $bar
exists?
There is a similar test case in https://github.com/unicode-org/message-format-wg/blob/main/test/syntax-errors.json#L50 , but this file doesn't specify formatting output for syntactically invalid messages.
The basic issue is that this text from formatting.md:
In a declaration, the resolved value of the expression is bound to a variable, which is available for use by later expressions. Since a variable can be referenced in different ways later, implementations SHOULD NOT immediately fully format the value for output.
doesn't say whether to bind a variable to a resolved value if an error is encountered while processing the declaration.
I'll note that a previous version of the messageformat package included a test file that included the following test:
{
"src": "let $bar {|foo|} {{$bar}}",
"exp": "foo",
"errors": [{ "type": "missing-char" }]
},
which implies that $bar
should be bound to a value in the environment even though processing its declaration should cause the formatter to emit a syntax error. However, I don't see a basis for this (or the other interpretation) in the spec.