Mark branch patterns degenerate when they don't bind symbols body needs

This commit is contained in:
Ayaz Hafiz 2022-07-22 17:26:45 -04:00
parent ed6ee71225
commit 4031770836
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
11 changed files with 110 additions and 32 deletions

View file

@ -260,16 +260,19 @@ pub fn sketch_when_branches(
// NB: ordering the guard pattern first seems to be better at catching
// non-exhaustive constructors in the second argument; see the paper to see if
// there is a way to improve this in general.
vec![guard_pattern, sketch_pattern(target_var, &loc_pat.value)],
vec![
guard_pattern,
sketch_pattern(target_var, &loc_pat.pattern.value),
],
)]
} else {
// Simple case
vec![sketch_pattern(target_var, &loc_pat.value)]
vec![sketch_pattern(target_var, &loc_pat.pattern.value)]
};
let row = SketchedRow {
patterns,
region: loc_pat.region,
region: loc_pat.pattern.region,
guard,
redundant_mark: *redundant,
};