unified: drop element field on _parenthesized_type

Same pattern we've seen many times before: a field on an anonymous node
gets attached to the parent node instead.

I'm not 100% sure this is the right solution, but it seemed wrong to
just make `_parenthesized_type` named instead (we don't usually name
parentheticals). At the very least, this cleans up the spurious
navigation_expression.element and tuple_type_item.element fields.
This commit is contained in:
Taus
2026-05-08 21:03:56 +00:00
parent e9822f67ee
commit 31386f566c
2 changed files with 2 additions and 7 deletions

View File

@@ -567,10 +567,7 @@ module.exports = grammar({
_parenthesized_type: ($) =>
seq(
"(",
field(
"element",
choice($.opaque_type, $.existential_type, $.dictionary_type)
),
choice($.opaque_type, $.existential_type, $.dictionary_type),
")"
),
navigation_expression: ($) =>

View File

@@ -314,7 +314,6 @@ named:
rhs: expression
mutation_modifier:
navigation_expression:
element?: [dictionary_type, existential_type, opaque_type]
suffix: navigation_suffix
target+: ["(", ")", array_type, dictionary_type, existential_type, expression, opaque_type, user_type]
navigation_suffix:
@@ -459,8 +458,7 @@ named:
$children?: tuple_type_item
element*: tuple_type_item
tuple_type_item:
$children*: [parameter_modifiers, wildcard_pattern]
element?: [dictionary_type, existential_type, opaque_type]
$children*: [dictionary_type, existential_type, opaque_type, parameter_modifiers, wildcard_pattern]
name?: simple_identifier
type?: type
type: