Don't suggest removing variable when it's bound in a branch pattern

Instead, suggest prefixing it with an underscore, or replacing with an
underscore.

Closes #3820
This commit is contained in:
Ayaz Hafiz 2022-08-17 11:53:01 -05:00
parent 34c3f266e0
commit b30c90b500
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
4 changed files with 47 additions and 4 deletions

View file

@ -1414,7 +1414,7 @@ fn canonicalize_when_branch<'a>(
if output.references.has_value_lookup(symbol) {
pattern_bound_symbols_body_needs.insert(symbol);
} else {
env.problem(Problem::UnusedDef(symbol, region));
env.problem(Problem::UnusedBranchDef(symbol, region));
}
}