diff options
author | Laurențiu Nicola <[email protected]> | 2021-02-20 10:36:17 +0000 |
---|---|---|
committer | Laurențiu Nicola <[email protected]> | 2021-02-20 10:36:17 +0000 |
commit | af4148970a800b8df733f961b14403b800d3fb01 (patch) | |
tree | 5b7113aa28a275b450c67f37b3ad8dce53efab3b /crates | |
parent | 20a911f3cc2beb0409ab71cc1560648374745f7f (diff) |
Fix incorrect missing field diagnostic with box patterns
Diffstat (limited to 'crates')
-rw-r--r-- | crates/syntax/src/ast/node_ext.rs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/crates/syntax/src/ast/node_ext.rs b/crates/syntax/src/ast/node_ext.rs index 2fa7b8c1e..52ac97c84 100644 --- a/crates/syntax/src/ast/node_ext.rs +++ b/crates/syntax/src/ast/node_ext.rs | |||
@@ -381,11 +381,20 @@ impl ast::RecordPatField { | |||
381 | if let Some(name_ref) = self.name_ref() { | 381 | if let Some(name_ref) = self.name_ref() { |
382 | return Some(NameOrNameRef::NameRef(name_ref)); | 382 | return Some(NameOrNameRef::NameRef(name_ref)); |
383 | } | 383 | } |
384 | if let Some(ast::Pat::IdentPat(pat)) = self.pat() { | 384 | match self.pat() { |
385 | let name = pat.name()?; | 385 | Some(ast::Pat::IdentPat(pat)) => { |
386 | return Some(NameOrNameRef::Name(name)); | 386 | let name = pat.name()?; |
387 | Some(NameOrNameRef::Name(name)) | ||
388 | } | ||
389 | Some(ast::Pat::BoxPat(pat)) => match pat.pat() { | ||
390 | Some(ast::Pat::IdentPat(pat)) => { | ||
391 | let name = pat.name()?; | ||
392 | Some(NameOrNameRef::Name(name)) | ||
393 | } | ||
394 | _ => None, | ||
395 | }, | ||
396 | _ => None, | ||
387 | } | 397 | } |
388 | None | ||
389 | } | 398 | } |
390 | } | 399 | } |
391 | 400 | ||