Skip to content

Commit a22033f

Browse files
committed
unified: Fix subscriptExpr error
1 parent 6215cbb commit a22033f

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

unified/extractor/src/languages/swift/swift.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,7 @@ fn translation_rules() -> Vec<Rule<SwiftContext>> {
10051005
// report a distinct `subscriptCallExpr`, so giving
10061006
// subscripts their own shape needs only a `subscript_expr` node in
10071007
// ast_types.yml and a remap here.
1008+
coerce_to_pattern!(subscriptCallExpr),
10081009
rule!(
10091010
(subscriptCallExpr calledExpression: @callee arguments: _* @args)
10101011
=>

unified/extractor/tests/corpus/swift/control-flow/switch-expression-pattern.output

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -425,17 +425,15 @@ top_level
425425
name_expr
426426
identifier: identifier "y"
427427
string_literal
428-
call_expr <-- ERROR: The field or_pattern.pattern should contain pattern, but got call_expr
429-
callee:
430-
expr_equality_pattern <-- ERROR: The field call_expr.callee should contain expr_or_type, but got expr_equality_pattern
431-
expr:
428+
expr_equality_pattern
429+
expr:
430+
call_expr
431+
callee:
432432
name_expr
433433
identifier: identifier "y"
434-
argument:
435-
pattern_element <-- ERROR: The field call_expr.argument should contain argument, but got pattern_element
436-
pattern:
437-
expr_equality_pattern
438-
expr: int_literal "4"
434+
argument:
435+
argument
436+
value: int_literal "4"
439437
body:
440438
block
441439
stmt:

0 commit comments

Comments
 (0)