From 31386f566c9dfa7de21c928181bf20f1816572b7 Mon Sep 17 00:00:00 2001 From: Taus Date: Fri, 8 May 2026 21:03:56 +0000 Subject: [PATCH] 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. --- unified/extractor/tree-sitter-swift/grammar.js | 5 +---- unified/extractor/tree-sitter-swift/node-types.yml | 4 +--- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/unified/extractor/tree-sitter-swift/grammar.js b/unified/extractor/tree-sitter-swift/grammar.js index 51a680e05a1..4d20431a070 100644 --- a/unified/extractor/tree-sitter-swift/grammar.js +++ b/unified/extractor/tree-sitter-swift/grammar.js @@ -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: ($) => diff --git a/unified/extractor/tree-sitter-swift/node-types.yml b/unified/extractor/tree-sitter-swift/node-types.yml index 5c4098db84f..7ac626492d4 100644 --- a/unified/extractor/tree-sitter-swift/node-types.yml +++ b/unified/extractor/tree-sitter-swift/node-types.yml @@ -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: