[SR-10588] Diagnostics should support the %select{...}n specifier on strings #52988
Labels
compiler
The Swift compiler in itself
diagnostics QoI
Bug: Diagnostics Quality of Implementation
good first issue
Good for newcomers
improvement
Additional Detail from JIRA
md5: c7d0dceb508174072cd141bfdda6ebbe
Issue Description:
It's not uncommon to have some text that needs to be displayed before or after a string if it's present, but not if it's absent. For example, availability diagnostics can sometimes have a user-specified message that's emitted after the compiler's message; if there is one, it's shown after a colon and a space.
There are currently two ways we can handle this. One is to have two variants of the diagnostic:
The other is to add a boolean parameter saying whether the string should be included and then pass that parameter along with the string, like so:
It would be better to have one message that could handle both cases, perhaps like this:
If you want to take a crack at this, look for a function called
formatDiagnosticArgument()
in DiagnosticEngine.cpp.The text was updated successfully, but these errors were encountered: