You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When there is a case expression with no matched patterns, we attempt to improve the error by running the first column through exhaustiveness checking (See #3561, here).
This works fine, for example, matching on values of type Bool, Result(_, _) suggest True, _ and False, _.
This could be improved to suggest all four possible patterns, although as discussed in the above PR, this grows exponentially, so maybe requires more discussion.
But one way it could definitely be improved is the following:
When matching on values of type, for example, Int, Bool, where the first type has infinite patterns, it only suggests _, _, since only the first subject is checked.
My suggestion for this is to do checking for all subjects, but cap the maximum number of paths, at say 64, so we don't end up emitting thousands of missing patterns. (Rust Analyzer does this, though I don't remember what the number is).
That way we get good suggestions without overrunning the user with too many patterns.
The text was updated successfully, but these errors were encountered:
When there is a case expression with no matched patterns, we attempt to improve the error by running the first column through exhaustiveness checking (See #3561, here).
This works fine, for example, matching on values of type
Bool, Result(_, _)
suggestTrue, _
andFalse, _
.This could be improved to suggest all four possible patterns, although as discussed in the above PR, this grows exponentially, so maybe requires more discussion.
But one way it could definitely be improved is the following:
When matching on values of type, for example,
Int, Bool
, where the first type has infinite patterns, it only suggests_, _
, since only the first subject is checked.My suggestion for this is to do checking for all subjects, but cap the maximum number of paths, at say 64, so we don't end up emitting thousands of missing patterns. (Rust Analyzer does this, though I don't remember what the number is).
That way we get good suggestions without overrunning the user with too many patterns.
The text was updated successfully, but these errors were encountered: