[SR-8504] Confusing error message for '<' comparison after 'as' cast #51024
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
parser
Area → compiler: The legacy C++ parser
Additional Detail from JIRA
md5: 16c5ef9515b96271e36bca5ac9b9e349
Issue Description:
The following code is invalid, as the `as? ...` starts parsing a following type, and
Int < ...
looks like the start of a generic type.There's a huge spew of error messages:
The fix for the syntax error is separating the
as ...
from the comparison, e.g.(x as? Int) < Int(0)
)The text was updated successfully, but these errors were encountered: