[SR-11148] Separate do and while blocks generate error from legacy diagnostic #53544
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
diagnostics QoI
Bug: Diagnostics Quality of Implementation
good first issue
Good for newcomers
parser
Area → compiler: The legacy C++ parser
Environment
Swift version 5.0.1 (swiftlang-1001.0.82.4 clang-1001.0.46.5)
Additional Detail from JIRA
md5: d1d46fcf6bad8750ff6f9a64bdc59a1b
Issue Description:
A standalone do block without the optional catch block, followed by a while block will generate the error "'do-while' statement is not allowed; use 'repeat-while' instead". This is caused by a diagnostic for dealing with legacy code using "do-while". The error disappears if the statements are separated with a semicolon.
The diagnostic could be improved by suggesting the semicolon or taking the separating newlines into account. cc @belkadan
The text was updated successfully, but these errors were encountered: