Open ijackson opened 1 year ago
Came here to file the same issue. I feel like I've been running into this relatively often, and the current diagnostics also look unhelpful when viewed in an IDE (in my case, VS Code):
See how all the errant spans are pretty far away from the actual problem.
Refactoring from match
to if let
(or, I suppose, while let
, as the OP suggests) is common and I've caught myself making this mistake a bunch of times.
Code
Current output
Desired output
Rationale and extra context
When refactoring or reorganising, one often ends up inserting and removing
match
(replacing thematch
with anif let
or some combinator like.map
). If thematch
isn't deleted, the parser goes badly astray.It would be nice if it revisited the assumption that the
match
was correct, but that may be hard. Easier is probably to just point to the match statement.Other cases
Deleting the
let
as the compiler suggests produces this:Anything else?
No response