@@ -84,7 +84,7 @@ if (tree_sitter_version_supports_emoji()) {
8484
8585module . exports = grammar ( {
8686 name : "swift" ,
87- supertypes : ( $ ) => [ $ . expression ] ,
87+ supertypes : ( $ ) => [ $ . expression , $ . unannotated_type ] ,
8888 conflicts : ( $ ) => [
8989 // @Type (... could either be an annotation constructor invocation or an annotated expression
9090 [ $ . attribute ] ,
@@ -405,9 +405,9 @@ module.exports = grammar({
405405 _type : ( $ ) =>
406406 prec . right (
407407 PRECS . ty ,
408- seq ( optional ( $ . type_modifiers ) , field ( "name" , $ . _unannotated_type ) )
408+ seq ( optional ( $ . type_modifiers ) , field ( "name" , $ . unannotated_type ) )
409409 ) ,
410- _unannotated_type : ( $ ) =>
410+ unannotated_type : ( $ ) =>
411411 prec . right (
412412 PRECS . ty ,
413413 choice (
@@ -465,7 +465,7 @@ module.exports = grammar({
465465 ) ,
466466 function_type : ( $ ) =>
467467 seq (
468- field ( "params" , choice ( $ . tuple_type , $ . _unannotated_type ) ) ,
468+ field ( "params" , choice ( $ . tuple_type , $ . unannotated_type ) ) ,
469469 optional ( $ . _async_keyword ) ,
470470 optional ( choice ( $ . throws_clause , $ . throws ) ) ,
471471 $ . _arrow_operator ,
@@ -484,18 +484,18 @@ module.exports = grammar({
484484 repeat1 ( alias ( $ . _immediate_quest , "?" ) )
485485 )
486486 ) ,
487- metatype : ( $ ) => seq ( $ . _unannotated_type , "." , choice ( "Type" , "Protocol" ) ) ,
487+ metatype : ( $ ) => seq ( $ . unannotated_type , "." , choice ( "Type" , "Protocol" ) ) ,
488488 _quest : ( $ ) => "?" ,
489489 _immediate_quest : ( $ ) => token . immediate ( "?" ) ,
490- opaque_type : ( $ ) => prec . right ( seq ( "some" , $ . _unannotated_type ) ) ,
491- existential_type : ( $ ) => prec . right ( seq ( "any" , $ . _unannotated_type ) ) ,
492- type_parameter_pack : ( $ ) => prec . left ( seq ( "each" , $ . _unannotated_type ) ) ,
493- type_pack_expansion : ( $ ) => prec . left ( seq ( "repeat" , $ . _unannotated_type ) ) ,
490+ opaque_type : ( $ ) => prec . right ( seq ( "some" , $ . unannotated_type ) ) ,
491+ existential_type : ( $ ) => prec . right ( seq ( "any" , $ . unannotated_type ) ) ,
492+ type_parameter_pack : ( $ ) => prec . left ( seq ( "each" , $ . unannotated_type ) ) ,
493+ type_pack_expansion : ( $ ) => prec . left ( seq ( "repeat" , $ . unannotated_type ) ) ,
494494 protocol_composition_type : ( $ ) =>
495495 prec . left (
496496 seq (
497- $ . _unannotated_type ,
498- repeat1 ( seq ( "&" , prec . right ( $ . _unannotated_type ) ) )
497+ $ . unannotated_type ,
498+ repeat1 ( seq ( "&" , prec . right ( $ . unannotated_type ) ) )
499499 )
500500 ) ,
501501 suppressed_constraint : ( $ ) =>
@@ -1498,7 +1498,7 @@ module.exports = grammar({
14981498 _macro_signature : ( $ ) =>
14991499 seq (
15001500 $ . _function_value_parameters ,
1501- optional ( seq ( $ . _arrow_operator , $ . _unannotated_type ) )
1501+ optional ( seq ( $ . _arrow_operator , $ . unannotated_type ) )
15021502 ) ,
15031503 macro_definition : ( $ ) =>
15041504 seq (
@@ -1524,7 +1524,7 @@ module.exports = grammar({
15241524 ) ,
15251525 seq (
15261526 field ( "declaration_kind" , "extension" ) ,
1527- field ( "name" , $ . _unannotated_type ) ,
1527+ field ( "name" , $ . unannotated_type ) ,
15281528 optional ( $ . type_parameters ) ,
15291529 optional ( seq ( ":" , $ . _inheritance_specifiers ) ) ,
15301530 optional ( $ . type_constraints ) ,
@@ -1594,7 +1594,7 @@ module.exports = grammar({
15941594 choice (
15951595 $ . identifier ,
15961596 seq (
1597- $ . _unannotated_type ,
1597+ $ . unannotated_type ,
15981598 optional ( seq ( "." , sep1 ( $ . simple_identifier , "." ) ) )
15991599 )
16001600 ) ,
@@ -1667,7 +1667,7 @@ module.exports = grammar({
16671667 _async_modifier : ( $ ) => token ( "async" ) ,
16681668 throws : ( $ ) => choice ( $ . _throws_keyword , $ . _rethrows_keyword ) ,
16691669 throws_clause : ( $ ) =>
1670- seq ( $ . _throws_keyword , "(" , field ( "type" , $ . _unannotated_type ) , ")" ) ,
1670+ seq ( $ . _throws_keyword , "(" , field ( "type" , $ . unannotated_type ) , ")" ) ,
16711671 enum_class_body : ( $ ) =>
16721672 seq ( "{" , repeat ( choice ( $ . enum_entry , $ . _type_level_declaration ) ) , "}" ) ,
16731673 enum_entry : ( $ ) =>
0 commit comments