Open simanerush opened 2 years ago
Diagnostic changes don't usually need to go through evolution since you're just using lookahead to pattern match the token stream but not actually changing the parse. This issue is a fine way to catalogue the feature request here. We should close out the other one in favor of this.
Yes, thank you for clarification. I will close the other one!
@CodaFi Maybe we should keep the other one open so that we can close this one once we deal with the diagnostics QoI part?
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.