Emit diagnostics for parsing disambiguation #60295
Labels
diagnostics QoI
Bug: Diagnostics Quality of Implementation
improvement
parser
Area → compiler: The legacy C++ parser
As a regular user of the Swift programming language, I get frustrated when I see diagnostics for the following cases dealing with cast destination types:
let _ = 1 as Int16 < 7
let _ = 1 as Int16 << 7
In both cases, I see
error: expected type
diagnostics, even though the context of the expression does not imply any presence of the type after<
.Proposed Solution:
I would like to see more helpful diagnostics. For example, here is what Rust does in the same situation:
Alternatives
The alternative would be silencing the
expected error
diagnostics, and this was already attempted in my PR #60088. However, @CodaFi provided a great feedback which says,I tend to agree with that, so therefore I think it's best to change the diagnostics in this case instead of proceeding with the alternative solution in my PR.
The text was updated successfully, but these errors were encountered: