fix: consider assignee expressions in record fields exhaustiveness check

This commit is contained in:
Ryo Yoshida 2022-07-24 22:34:53 +09:00
parent 64758bd481
commit 805ac666ca
No known key found for this signature in database
GPG key ID: E25698A930586171
2 changed files with 35 additions and 1 deletions

View file

@ -305,7 +305,10 @@ pub fn record_literal_missing_fields(
expr: &Expr,
) -> Option<(VariantId, Vec<LocalFieldId>, /*exhaustive*/ bool)> {
let (fields, exhaustive) = match expr {
Expr::RecordLit { fields, spread, .. } => (fields, spread.is_none()),
Expr::RecordLit { fields, spread, ellipsis, is_assignee_expr, .. } => {
let exhaustive = if *is_assignee_expr { !*ellipsis } else { spread.is_none() };
(fields, exhaustive)
}
_ => return None,
};