From 4d97f5f037c1b061215d4b0fb32d48a1b8be836f Mon Sep 17 00:00:00 2001 From: Pavan Kumar Sunkara Date: Sat, 5 Sep 2020 03:06:05 +0200 Subject: Rename record_field_pat to record_pat_field --- crates/hir/src/semantics.rs | 8 +- crates/hir/src/source_analyzer.rs | 4 +- crates/hir_ty/src/infer.rs | 6 +- crates/hir_ty/src/infer/pat.rs | 2 +- crates/ide_db/src/defs.rs | 10 +- crates/parser/src/grammar/patterns.rs | 4 +- .../inline/ok/0102_record_field_pat_list.rast | 132 --------------------- .../parser/inline/ok/0102_record_field_pat_list.rs | 6 - .../inline/ok/0102_record_pat_field_list.rast | 132 +++++++++++++++++++++ .../parser/inline/ok/0102_record_pat_field_list.rs | 6 + .../parser/inline/ok/0145_record_field_pat.rast | 75 ------------ .../parser/inline/ok/0145_record_field_pat.rs | 4 - .../parser/inline/ok/0145_record_pat_field.rast | 75 ++++++++++++ .../parser/inline/ok/0145_record_pat_field.rs | 4 + 14 files changed, 234 insertions(+), 234 deletions(-) delete mode 100644 crates/syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast delete mode 100644 crates/syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rs create mode 100644 crates/syntax/test_data/parser/inline/ok/0102_record_pat_field_list.rast create mode 100644 crates/syntax/test_data/parser/inline/ok/0102_record_pat_field_list.rs delete mode 100644 crates/syntax/test_data/parser/inline/ok/0145_record_field_pat.rast delete mode 100644 crates/syntax/test_data/parser/inline/ok/0145_record_field_pat.rs create mode 100644 crates/syntax/test_data/parser/inline/ok/0145_record_pat_field.rast create mode 100644 crates/syntax/test_data/parser/inline/ok/0145_record_pat_field.rs (limited to 'crates') diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs index 1594d4f0f..0516a05b4 100644 --- a/crates/hir/src/semantics.rs +++ b/crates/hir/src/semantics.rs @@ -207,8 +207,8 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> { self.imp.resolve_record_field(field) } - pub fn resolve_record_field_pat(&self, field: &ast::RecordPatField) -> Option { - self.imp.resolve_record_field_pat(field) + pub fn resolve_record_pat_field(&self, field: &ast::RecordPatField) -> Option { + self.imp.resolve_record_pat_field(field) } pub fn resolve_macro_call(&self, macro_call: &ast::MacroCall) -> Option { @@ -433,8 +433,8 @@ impl<'db> SemanticsImpl<'db> { self.analyze(field.syntax()).resolve_record_field(self.db, field) } - fn resolve_record_field_pat(&self, field: &ast::RecordPatField) -> Option { - self.analyze(field.syntax()).resolve_record_field_pat(self.db, field) + fn resolve_record_pat_field(&self, field: &ast::RecordPatField) -> Option { + self.analyze(field.syntax()).resolve_record_pat_field(self.db, field) } fn resolve_macro_call(&self, macro_call: &ast::MacroCall) -> Option { diff --git a/crates/hir/src/source_analyzer.rs b/crates/hir/src/source_analyzer.rs index 1d13c4f1d..1aef0f33f 100644 --- a/crates/hir/src/source_analyzer.rs +++ b/crates/hir/src/source_analyzer.rs @@ -179,13 +179,13 @@ impl SourceAnalyzer { Some((struct_field.into(), local)) } - pub(crate) fn resolve_record_field_pat( + pub(crate) fn resolve_record_pat_field( &self, _db: &dyn HirDatabase, field: &ast::RecordPatField, ) -> Option { let pat_id = self.pat_id(&field.pat()?)?; - let struct_field = self.infer.as_ref()?.record_field_pat_resolution(pat_id)?; + let struct_field = self.infer.as_ref()?.record_pat_field_resolution(pat_id)?; Some(struct_field.into()) } diff --git a/crates/hir_ty/src/infer.rs b/crates/hir_ty/src/infer.rs index 03b00b101..2b53b8297 100644 --- a/crates/hir_ty/src/infer.rs +++ b/crates/hir_ty/src/infer.rs @@ -125,7 +125,7 @@ pub struct InferenceResult { field_resolutions: FxHashMap, /// For each field in record literal, records the field it resolves to. record_field_resolutions: FxHashMap, - record_field_pat_resolutions: FxHashMap, + record_pat_field_resolutions: FxHashMap, /// For each struct literal, records the variant it resolves to. variant_resolutions: FxHashMap, /// For each associated item record what it resolves to @@ -146,8 +146,8 @@ impl InferenceResult { pub fn record_field_resolution(&self, expr: ExprId) -> Option { self.record_field_resolutions.get(&expr).copied() } - pub fn record_field_pat_resolution(&self, pat: PatId) -> Option { - self.record_field_pat_resolutions.get(&pat).copied() + pub fn record_pat_field_resolution(&self, pat: PatId) -> Option { + self.record_pat_field_resolutions.get(&pat).copied() } pub fn variant_resolution_for_expr(&self, id: ExprId) -> Option { self.variant_resolutions.get(&id.into()).copied() diff --git a/crates/hir_ty/src/infer/pat.rs b/crates/hir_ty/src/infer/pat.rs index 4dd4f9802..dde38bc39 100644 --- a/crates/hir_ty/src/infer/pat.rs +++ b/crates/hir_ty/src/infer/pat.rs @@ -70,7 +70,7 @@ impl<'a> InferenceContext<'a> { let matching_field = var_data.as_ref().and_then(|it| it.field(&subpat.name)); if let Some(local_id) = matching_field { let field_def = FieldId { parent: def.unwrap(), local_id }; - self.result.record_field_pat_resolutions.insert(subpat.pat, field_def); + self.result.record_pat_field_resolutions.insert(subpat.pat, field_def); } let expected_ty = diff --git a/crates/ide_db/src/defs.rs b/crates/ide_db/src/defs.rs index 0d0affc27..f8c7aa491 100644 --- a/crates/ide_db/src/defs.rs +++ b/crates/ide_db/src/defs.rs @@ -157,9 +157,9 @@ pub fn classify_name(sema: &Semantics, name: &ast::Name) -> Option ast::IdentPat(it) => { let local = sema.to_def(&it)?; - if let Some(record_field_pat) = it.syntax().parent().and_then(ast::RecordPatField::cast) { - if record_field_pat.name_ref().is_none() { - if let Some(field) = sema.resolve_record_field_pat(&record_field_pat) { + if let Some(record_pat_field) = it.syntax().parent().and_then(ast::RecordPatField::cast) { + if record_pat_field.name_ref().is_none() { + if let Some(field) = sema.resolve_record_pat_field(&record_pat_field) { let field = Definition::Field(field); return Some(NameClass::FieldShorthand { local, field }); } @@ -275,8 +275,8 @@ pub fn classify_name_ref( } } - if let Some(record_field_pat) = ast::RecordPatField::cast(parent.clone()) { - if let Some(field) = sema.resolve_record_field_pat(&record_field_pat) { + if let Some(record_pat_field) = ast::RecordPatField::cast(parent.clone()) { + if let Some(field) = sema.resolve_record_pat_field(&record_pat_field) { let field = Definition::Field(field); return Some(NameRefClass::Definition(field)); } diff --git a/crates/parser/src/grammar/patterns.rs b/crates/parser/src/grammar/patterns.rs index 796f206e1..7e7f73dee 100644 --- a/crates/parser/src/grammar/patterns.rs +++ b/crates/parser/src/grammar/patterns.rs @@ -188,7 +188,7 @@ fn tuple_pat_fields(p: &mut Parser) { p.expect(T![')']); } -// test record_field_pat_list +// test record_pat_field_list // fn foo() { // let S {} = (); // let S { f, ref mut g } = (); @@ -208,7 +208,7 @@ fn record_pat_field_list(p: &mut Parser) { c => { let m = p.start(); match c { - // test record_field_pat + // test record_pat_field // fn foo() { // let S { 0: 1 } = (); // let S { x: 1 } = (); diff --git a/crates/syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast b/crates/syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast deleted file mode 100644 index 866e60ed8..000000000 --- a/crates/syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast +++ /dev/null @@ -1,132 +0,0 @@ -SOURCE_FILE@0..119 - FN@0..118 - FN_KW@0..2 "fn" - WHITESPACE@2..3 " " - NAME@3..6 - IDENT@3..6 "foo" - PARAM_LIST@6..8 - L_PAREN@6..7 "(" - R_PAREN@7..8 ")" - WHITESPACE@8..9 " " - BLOCK_EXPR@9..118 - L_CURLY@9..10 "{" - WHITESPACE@10..15 "\n " - LET_STMT@15..29 - LET_KW@15..18 "let" - WHITESPACE@18..19 " " - RECORD_PAT@19..23 - PATH@19..20 - PATH_SEGMENT@19..20 - NAME_REF@19..20 - IDENT@19..20 "S" - WHITESPACE@20..21 " " - RECORD_PAT_FIELD_LIST@21..23 - L_CURLY@21..22 "{" - R_CURLY@22..23 "}" - WHITESPACE@23..24 " " - EQ@24..25 "=" - WHITESPACE@25..26 " " - TUPLE_EXPR@26..28 - L_PAREN@26..27 "(" - R_PAREN@27..28 ")" - SEMICOLON@28..29 ";" - WHITESPACE@29..34 "\n " - LET_STMT@34..62 - LET_KW@34..37 "let" - WHITESPACE@37..38 " " - RECORD_PAT@38..56 - PATH@38..39 - PATH_SEGMENT@38..39 - NAME_REF@38..39 - IDENT@38..39 "S" - WHITESPACE@39..40 " " - RECORD_PAT_FIELD_LIST@40..56 - L_CURLY@40..41 "{" - WHITESPACE@41..42 " " - RECORD_PAT_FIELD@42..43 - IDENT_PAT@42..43 - NAME@42..43 - IDENT@42..43 "f" - COMMA@43..44 "," - WHITESPACE@44..45 " " - RECORD_PAT_FIELD@45..54 - IDENT_PAT@45..54 - REF_KW@45..48 "ref" - WHITESPACE@48..49 " " - MUT_KW@49..52 "mut" - WHITESPACE@52..53 " " - NAME@53..54 - IDENT@53..54 "g" - WHITESPACE@54..55 " " - R_CURLY@55..56 "}" - WHITESPACE@56..57 " " - EQ@57..58 "=" - WHITESPACE@58..59 " " - TUPLE_EXPR@59..61 - L_PAREN@59..60 "(" - R_PAREN@60..61 ")" - SEMICOLON@61..62 ";" - WHITESPACE@62..67 "\n " - LET_STMT@67..90 - LET_KW@67..70 "let" - WHITESPACE@70..71 " " - RECORD_PAT@71..84 - PATH@71..72 - PATH_SEGMENT@71..72 - NAME_REF@71..72 - IDENT@71..72 "S" - WHITESPACE@72..73 " " - RECORD_PAT_FIELD_LIST@73..84 - L_CURLY@73..74 "{" - WHITESPACE@74..75 " " - RECORD_PAT_FIELD@75..79 - NAME_REF@75..76 - IDENT@75..76 "h" - COLON@76..77 ":" - WHITESPACE@77..78 " " - WILDCARD_PAT@78..79 - UNDERSCORE@78..79 "_" - COMMA@79..80 "," - WHITESPACE@80..81 " " - DOT2@81..83 ".." - R_CURLY@83..84 "}" - WHITESPACE@84..85 " " - EQ@85..86 "=" - WHITESPACE@86..87 " " - TUPLE_EXPR@87..89 - L_PAREN@87..88 "(" - R_PAREN@88..89 ")" - SEMICOLON@89..90 ";" - WHITESPACE@90..95 "\n " - LET_STMT@95..116 - LET_KW@95..98 "let" - WHITESPACE@98..99 " " - RECORD_PAT@99..110 - PATH@99..100 - PATH_SEGMENT@99..100 - NAME_REF@99..100 - IDENT@99..100 "S" - WHITESPACE@100..101 " " - RECORD_PAT_FIELD_LIST@101..110 - L_CURLY@101..102 "{" - WHITESPACE@102..103 " " - RECORD_PAT_FIELD@103..107 - NAME_REF@103..104 - IDENT@103..104 "h" - COLON@104..105 ":" - WHITESPACE@105..106 " " - WILDCARD_PAT@106..107 - UNDERSCORE@106..107 "_" - COMMA@107..108 "," - WHITESPACE@108..109 " " - R_CURLY@109..110 "}" - WHITESPACE@110..111 " " - EQ@111..112 "=" - WHITESPACE@112..113 " " - TUPLE_EXPR@113..115 - L_PAREN@113..114 "(" - R_PAREN@114..115 ")" - SEMICOLON@115..116 ";" - WHITESPACE@116..117 "\n" - R_CURLY@117..118 "}" - WHITESPACE@118..119 "\n" diff --git a/crates/syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rs b/crates/syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rs deleted file mode 100644 index da3412fa8..000000000 --- a/crates/syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rs +++ /dev/null @@ -1,6 +0,0 @@ -fn foo() { - let S {} = (); - let S { f, ref mut g } = (); - let S { h: _, ..} = (); - let S { h: _, } = (); -} diff --git a/crates/syntax/test_data/parser/inline/ok/0102_record_pat_field_list.rast b/crates/syntax/test_data/parser/inline/ok/0102_record_pat_field_list.rast new file mode 100644 index 000000000..866e60ed8 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0102_record_pat_field_list.rast @@ -0,0 +1,132 @@ +SOURCE_FILE@0..119 + FN@0..118 + FN_KW@0..2 "fn" + WHITESPACE@2..3 " " + NAME@3..6 + IDENT@3..6 "foo" + PARAM_LIST@6..8 + L_PAREN@6..7 "(" + R_PAREN@7..8 ")" + WHITESPACE@8..9 " " + BLOCK_EXPR@9..118 + L_CURLY@9..10 "{" + WHITESPACE@10..15 "\n " + LET_STMT@15..29 + LET_KW@15..18 "let" + WHITESPACE@18..19 " " + RECORD_PAT@19..23 + PATH@19..20 + PATH_SEGMENT@19..20 + NAME_REF@19..20 + IDENT@19..20 "S" + WHITESPACE@20..21 " " + RECORD_PAT_FIELD_LIST@21..23 + L_CURLY@21..22 "{" + R_CURLY@22..23 "}" + WHITESPACE@23..24 " " + EQ@24..25 "=" + WHITESPACE@25..26 " " + TUPLE_EXPR@26..28 + L_PAREN@26..27 "(" + R_PAREN@27..28 ")" + SEMICOLON@28..29 ";" + WHITESPACE@29..34 "\n " + LET_STMT@34..62 + LET_KW@34..37 "let" + WHITESPACE@37..38 " " + RECORD_PAT@38..56 + PATH@38..39 + PATH_SEGMENT@38..39 + NAME_REF@38..39 + IDENT@38..39 "S" + WHITESPACE@39..40 " " + RECORD_PAT_FIELD_LIST@40..56 + L_CURLY@40..41 "{" + WHITESPACE@41..42 " " + RECORD_PAT_FIELD@42..43 + IDENT_PAT@42..43 + NAME@42..43 + IDENT@42..43 "f" + COMMA@43..44 "," + WHITESPACE@44..45 " " + RECORD_PAT_FIELD@45..54 + IDENT_PAT@45..54 + REF_KW@45..48 "ref" + WHITESPACE@48..49 " " + MUT_KW@49..52 "mut" + WHITESPACE@52..53 " " + NAME@53..54 + IDENT@53..54 "g" + WHITESPACE@54..55 " " + R_CURLY@55..56 "}" + WHITESPACE@56..57 " " + EQ@57..58 "=" + WHITESPACE@58..59 " " + TUPLE_EXPR@59..61 + L_PAREN@59..60 "(" + R_PAREN@60..61 ")" + SEMICOLON@61..62 ";" + WHITESPACE@62..67 "\n " + LET_STMT@67..90 + LET_KW@67..70 "let" + WHITESPACE@70..71 " " + RECORD_PAT@71..84 + PATH@71..72 + PATH_SEGMENT@71..72 + NAME_REF@71..72 + IDENT@71..72 "S" + WHITESPACE@72..73 " " + RECORD_PAT_FIELD_LIST@73..84 + L_CURLY@73..74 "{" + WHITESPACE@74..75 " " + RECORD_PAT_FIELD@75..79 + NAME_REF@75..76 + IDENT@75..76 "h" + COLON@76..77 ":" + WHITESPACE@77..78 " " + WILDCARD_PAT@78..79 + UNDERSCORE@78..79 "_" + COMMA@79..80 "," + WHITESPACE@80..81 " " + DOT2@81..83 ".." + R_CURLY@83..84 "}" + WHITESPACE@84..85 " " + EQ@85..86 "=" + WHITESPACE@86..87 " " + TUPLE_EXPR@87..89 + L_PAREN@87..88 "(" + R_PAREN@88..89 ")" + SEMICOLON@89..90 ";" + WHITESPACE@90..95 "\n " + LET_STMT@95..116 + LET_KW@95..98 "let" + WHITESPACE@98..99 " " + RECORD_PAT@99..110 + PATH@99..100 + PATH_SEGMENT@99..100 + NAME_REF@99..100 + IDENT@99..100 "S" + WHITESPACE@100..101 " " + RECORD_PAT_FIELD_LIST@101..110 + L_CURLY@101..102 "{" + WHITESPACE@102..103 " " + RECORD_PAT_FIELD@103..107 + NAME_REF@103..104 + IDENT@103..104 "h" + COLON@104..105 ":" + WHITESPACE@105..106 " " + WILDCARD_PAT@106..107 + UNDERSCORE@106..107 "_" + COMMA@107..108 "," + WHITESPACE@108..109 " " + R_CURLY@109..110 "}" + WHITESPACE@110..111 " " + EQ@111..112 "=" + WHITESPACE@112..113 " " + TUPLE_EXPR@113..115 + L_PAREN@113..114 "(" + R_PAREN@114..115 ")" + SEMICOLON@115..116 ";" + WHITESPACE@116..117 "\n" + R_CURLY@117..118 "}" + WHITESPACE@118..119 "\n" diff --git a/crates/syntax/test_data/parser/inline/ok/0102_record_pat_field_list.rs b/crates/syntax/test_data/parser/inline/ok/0102_record_pat_field_list.rs new file mode 100644 index 000000000..da3412fa8 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0102_record_pat_field_list.rs @@ -0,0 +1,6 @@ +fn foo() { + let S {} = (); + let S { f, ref mut g } = (); + let S { h: _, ..} = (); + let S { h: _, } = (); +} diff --git a/crates/syntax/test_data/parser/inline/ok/0145_record_field_pat.rast b/crates/syntax/test_data/parser/inline/ok/0145_record_field_pat.rast deleted file mode 100644 index 925409bdf..000000000 --- a/crates/syntax/test_data/parser/inline/ok/0145_record_field_pat.rast +++ /dev/null @@ -1,75 +0,0 @@ -SOURCE_FILE@0..63 - FN@0..62 - FN_KW@0..2 "fn" - WHITESPACE@2..3 " " - NAME@3..6 - IDENT@3..6 "foo" - PARAM_LIST@6..8 - L_PAREN@6..7 "(" - R_PAREN@7..8 ")" - WHITESPACE@8..9 " " - BLOCK_EXPR@9..62 - L_CURLY@9..10 "{" - WHITESPACE@10..15 "\n " - LET_STMT@15..35 - LET_KW@15..18 "let" - WHITESPACE@18..19 " " - RECORD_PAT@19..29 - PATH@19..20 - PATH_SEGMENT@19..20 - NAME_REF@19..20 - IDENT@19..20 "S" - WHITESPACE@20..21 " " - RECORD_PAT_FIELD_LIST@21..29 - L_CURLY@21..22 "{" - WHITESPACE@22..23 " " - RECORD_PAT_FIELD@23..27 - NAME_REF@23..24 - INT_NUMBER@23..24 "0" - COLON@24..25 ":" - WHITESPACE@25..26 " " - LITERAL_PAT@26..27 - LITERAL@26..27 - INT_NUMBER@26..27 "1" - WHITESPACE@27..28 " " - R_CURLY@28..29 "}" - WHITESPACE@29..30 " " - EQ@30..31 "=" - WHITESPACE@31..32 " " - TUPLE_EXPR@32..34 - L_PAREN@32..33 "(" - R_PAREN@33..34 ")" - SEMICOLON@34..35 ";" - WHITESPACE@35..40 "\n " - LET_STMT@40..60 - LET_KW@40..43 "let" - WHITESPACE@43..44 " " - RECORD_PAT@44..54 - PATH@44..45 - PATH_SEGMENT@44..45 - NAME_REF@44..45 - IDENT@44..45 "S" - WHITESPACE@45..46 " " - RECORD_PAT_FIELD_LIST@46..54 - L_CURLY@46..47 "{" - WHITESPACE@47..48 " " - RECORD_PAT_FIELD@48..52 - NAME_REF@48..49 - IDENT@48..49 "x" - COLON@49..50 ":" - WHITESPACE@50..51 " " - LITERAL_PAT@51..52 - LITERAL@51..52 - INT_NUMBER@51..52 "1" - WHITESPACE@52..53 " " - R_CURLY@53..54 "}" - WHITESPACE@54..55 " " - EQ@55..56 "=" - WHITESPACE@56..57 " " - TUPLE_EXPR@57..59 - L_PAREN@57..58 "(" - R_PAREN@58..59 ")" - SEMICOLON@59..60 ";" - WHITESPACE@60..61 "\n" - R_CURLY@61..62 "}" - WHITESPACE@62..63 "\n" diff --git a/crates/syntax/test_data/parser/inline/ok/0145_record_field_pat.rs b/crates/syntax/test_data/parser/inline/ok/0145_record_field_pat.rs deleted file mode 100644 index 26b1d5f89..000000000 --- a/crates/syntax/test_data/parser/inline/ok/0145_record_field_pat.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn foo() { - let S { 0: 1 } = (); - let S { x: 1 } = (); -} diff --git a/crates/syntax/test_data/parser/inline/ok/0145_record_pat_field.rast b/crates/syntax/test_data/parser/inline/ok/0145_record_pat_field.rast new file mode 100644 index 000000000..925409bdf --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0145_record_pat_field.rast @@ -0,0 +1,75 @@ +SOURCE_FILE@0..63 + FN@0..62 + FN_KW@0..2 "fn" + WHITESPACE@2..3 " " + NAME@3..6 + IDENT@3..6 "foo" + PARAM_LIST@6..8 + L_PAREN@6..7 "(" + R_PAREN@7..8 ")" + WHITESPACE@8..9 " " + BLOCK_EXPR@9..62 + L_CURLY@9..10 "{" + WHITESPACE@10..15 "\n " + LET_STMT@15..35 + LET_KW@15..18 "let" + WHITESPACE@18..19 " " + RECORD_PAT@19..29 + PATH@19..20 + PATH_SEGMENT@19..20 + NAME_REF@19..20 + IDENT@19..20 "S" + WHITESPACE@20..21 " " + RECORD_PAT_FIELD_LIST@21..29 + L_CURLY@21..22 "{" + WHITESPACE@22..23 " " + RECORD_PAT_FIELD@23..27 + NAME_REF@23..24 + INT_NUMBER@23..24 "0" + COLON@24..25 ":" + WHITESPACE@25..26 " " + LITERAL_PAT@26..27 + LITERAL@26..27 + INT_NUMBER@26..27 "1" + WHITESPACE@27..28 " " + R_CURLY@28..29 "}" + WHITESPACE@29..30 " " + EQ@30..31 "=" + WHITESPACE@31..32 " " + TUPLE_EXPR@32..34 + L_PAREN@32..33 "(" + R_PAREN@33..34 ")" + SEMICOLON@34..35 ";" + WHITESPACE@35..40 "\n " + LET_STMT@40..60 + LET_KW@40..43 "let" + WHITESPACE@43..44 " " + RECORD_PAT@44..54 + PATH@44..45 + PATH_SEGMENT@44..45 + NAME_REF@44..45 + IDENT@44..45 "S" + WHITESPACE@45..46 " " + RECORD_PAT_FIELD_LIST@46..54 + L_CURLY@46..47 "{" + WHITESPACE@47..48 " " + RECORD_PAT_FIELD@48..52 + NAME_REF@48..49 + IDENT@48..49 "x" + COLON@49..50 ":" + WHITESPACE@50..51 " " + LITERAL_PAT@51..52 + LITERAL@51..52 + INT_NUMBER@51..52 "1" + WHITESPACE@52..53 " " + R_CURLY@53..54 "}" + WHITESPACE@54..55 " " + EQ@55..56 "=" + WHITESPACE@56..57 " " + TUPLE_EXPR@57..59 + L_PAREN@57..58 "(" + R_PAREN@58..59 ")" + SEMICOLON@59..60 ";" + WHITESPACE@60..61 "\n" + R_CURLY@61..62 "}" + WHITESPACE@62..63 "\n" diff --git a/crates/syntax/test_data/parser/inline/ok/0145_record_pat_field.rs b/crates/syntax/test_data/parser/inline/ok/0145_record_pat_field.rs new file mode 100644 index 000000000..26b1d5f89 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0145_record_pat_field.rs @@ -0,0 +1,4 @@ +fn foo() { + let S { 0: 1 } = (); + let S { x: 1 } = (); +} -- cgit v1.2.3