diff --git a/unified/extractor/tests/corpus/swift/closures.txt b/unified/extractor/tests/corpus/swift/closures.txt index 57dbfe793812..0afea480a19f 100644 --- a/unified/extractor/tests/corpus/swift/closures.txt +++ b/unified/extractor/tests/corpus/swift/closures.txt @@ -7,54 +7,49 @@ let f = { (x: Int) -> Int in x * 2 } --- source_file - property_declaration - name: - pattern - bound_identifier: simple_identifier "f" - value: - lambda_literal - type: - lambda_function_type - return_type: - type - name: - user_type - type_identifier "Int" - lambda_function_type_parameters - lambda_parameter - name: simple_identifier "x" - type: - type - name: - user_type - type_identifier "Int" - statements - multiplicative_expression - lhs: simple_identifier "x" - op: * - rhs: integer_literal "2" - value_binding_pattern - mutability: let + statement: + property_declaration + binding: + value_binding_pattern + mutability: let + declarator: + property_binding + name: + pattern + bound_identifier: simple_identifier "f" + value: + lambda_literal + statement: + multiplicative_expression + lhs: simple_identifier "x" + op: * + rhs: integer_literal "2" + type: + lambda_function_type + params: + lambda_function_type_parameters + parameter: + lambda_parameter + name: simple_identifier "x" + type: + type + name: + user_type + part: + simple_user_type + name: type_identifier "Int" + return_type: + type + name: + user_type + part: + simple_user_type + name: type_identifier "Int" --- top_level body: - variable_declaration_stmt - variable_declarator: - variable_declarator - value: - lambda_expr - body: - binary_expr - operator: operator "*" - left: - name_expr - identifier: identifier "x" - right: int_literal "2" - pattern: - var_pattern - identifier: identifier "f" === Closure with shorthand parameters @@ -65,41 +60,28 @@ let f = { $0 + $1 } --- source_file - property_declaration - name: - pattern - bound_identifier: simple_identifier "f" - value: - lambda_literal - statements - additive_expression - lhs: simple_identifier "$0" - op: + - rhs: simple_identifier "$1" - value_binding_pattern - mutability: let + statement: + property_declaration + binding: + value_binding_pattern + mutability: let + declarator: + property_binding + name: + pattern + bound_identifier: simple_identifier "f" + value: + lambda_literal + statement: + additive_expression + lhs: simple_identifier "$0" + op: + + rhs: simple_identifier "$1" --- top_level body: - variable_declaration_stmt - variable_declarator: - variable_declarator - value: - lambda_expr - body: - binary_expr - operator: operator "+" - left: - name_expr - identifier: identifier "$0" - right: - name_expr - identifier: identifier "$1" - pattern: - var_pattern - identifier: identifier "f" === Trailing closure @@ -110,40 +92,28 @@ xs.map { $0 * 2 } --- source_file - call_expression - navigation_expression + statement: + call_expression + function: + navigation_expression + suffix: + navigation_suffix + suffix: simple_identifier "map" + target: simple_identifier "xs" suffix: - navigation_suffix - suffix: simple_identifier "map" - target: simple_identifier "xs" - call_suffix - lambda_literal - statements - multiplicative_expression - lhs: simple_identifier "$0" - op: * - rhs: integer_literal "2" + call_suffix + lambda: + lambda_literal + statement: + multiplicative_expression + lhs: simple_identifier "$0" + op: * + rhs: integer_literal "2" --- top_level body: - call_expr - argument: - lambda_expr - body: - binary_expr - operator: operator "*" - left: - name_expr - identifier: identifier "$0" - right: int_literal "2" - function: - member_access_expr - target: - name_expr - identifier: identifier "xs" - member: identifier "map" === Closure with capture list @@ -154,50 +124,45 @@ let f = { [weak self] in self?.doThing() } --- source_file - property_declaration - name: - pattern - bound_identifier: simple_identifier "f" - value: - lambda_literal - captures: - capture_list - capture_list_item - name: simple_identifier "self" - ownership_modifier - statements - call_expression - navigation_expression - suffix: - navigation_suffix - suffix: simple_identifier "doThing" - target: - optional_chain_marker - self_expression - call_suffix - value_arguments - value_binding_pattern - mutability: let + statement: + property_declaration + binding: + value_binding_pattern + mutability: let + declarator: + property_binding + name: + pattern + bound_identifier: simple_identifier "f" + value: + lambda_literal + captures: + capture_list + item: + capture_list_item + name: simple_identifier "self" + ownership: + ownership_modifier + statement: + call_expression + function: + navigation_expression + suffix: + navigation_suffix + suffix: simple_identifier "doThing" + target: + optional_chain_marker + expr: + self_expression + suffix: + call_suffix + arguments: + value_arguments --- top_level body: - variable_declaration_stmt - variable_declarator: - variable_declarator - value: - lambda_expr - body: - call_expr - argument: - function: - member_access_expr - target: unsupported_node "self?" - member: identifier "doThing" - pattern: - var_pattern - identifier: identifier "f" === Multi-statement closure @@ -211,71 +176,63 @@ let f = { (x: Int) -> Int in --- source_file - property_declaration - name: - pattern - bound_identifier: simple_identifier "f" - value: - lambda_literal - type: - lambda_function_type - return_type: - type - name: - user_type - type_identifier "Int" - lambda_function_type_parameters - lambda_parameter - name: simple_identifier "x" - type: - type - name: - user_type - type_identifier "Int" - statements - property_declaration - name: - pattern - bound_identifier: simple_identifier "y" - value: - additive_expression - lhs: simple_identifier "x" - op: + - rhs: integer_literal "1" - value_binding_pattern - mutability: let - control_transfer_statement - result: - multiplicative_expression - lhs: simple_identifier "y" - op: * - rhs: integer_literal "2" - value_binding_pattern - mutability: let + statement: + property_declaration + binding: + value_binding_pattern + mutability: let + declarator: + property_binding + name: + pattern + bound_identifier: simple_identifier "f" + value: + lambda_literal + statement: + property_declaration + binding: + value_binding_pattern + mutability: let + declarator: + property_binding + name: + pattern + bound_identifier: simple_identifier "y" + value: + additive_expression + lhs: simple_identifier "x" + op: + + rhs: integer_literal "1" + control_transfer_statement + kind: return + result: + multiplicative_expression + lhs: simple_identifier "y" + op: * + rhs: integer_literal "2" + type: + lambda_function_type + params: + lambda_function_type_parameters + parameter: + lambda_parameter + name: simple_identifier "x" + type: + type + name: + user_type + part: + simple_user_type + name: type_identifier "Int" + return_type: + type + name: + user_type + part: + simple_user_type + name: type_identifier "Int" --- top_level body: - variable_declaration_stmt - variable_declarator: - variable_declarator - value: - lambda_expr - body: - variable_declaration_stmt - variable_declarator: - variable_declarator - value: - binary_expr - operator: operator "+" - left: - name_expr - identifier: identifier "x" - right: int_literal "1" - pattern: - var_pattern - identifier: identifier "y" - pattern: - var_pattern - identifier: identifier "f" diff --git a/unified/extractor/tests/corpus/swift/collections.txt b/unified/extractor/tests/corpus/swift/collections.txt index 9a1186ac77d5..afafc1e69ef2 100644 --- a/unified/extractor/tests/corpus/swift/collections.txt +++ b/unified/extractor/tests/corpus/swift/collections.txt @@ -7,30 +7,27 @@ let xs = [1, 2, 3] --- source_file - property_declaration - name: - pattern - bound_identifier: simple_identifier "xs" - value: - array_literal - element: - integer_literal "1" - integer_literal "2" - integer_literal "3" - value_binding_pattern - mutability: let + statement: + property_declaration + binding: + value_binding_pattern + mutability: let + declarator: + property_binding + name: + pattern + bound_identifier: simple_identifier "xs" + value: + array_literal + element: + integer_literal "1" + integer_literal "2" + integer_literal "3" --- top_level body: - variable_declaration_stmt - variable_declarator: - variable_declarator - value: unsupported_node "[1, 2, 3]" - pattern: - var_pattern - identifier: identifier "xs" === Empty array literal with type @@ -41,36 +38,36 @@ let xs: [Int] = [] --- source_file - property_declaration - name: - pattern - bound_identifier: simple_identifier "xs" - value: - array_literal - value_binding_pattern - mutability: let - type_annotation - type: - type + statement: + property_declaration + binding: + value_binding_pattern + mutability: let + declarator: + property_binding name: - array_type - element: + pattern + bound_identifier: simple_identifier "xs" + type: + type_annotation + type: type name: - user_type - type_identifier "Int" + array_type + element: + type + name: + user_type + part: + simple_user_type + name: type_identifier "Int" + value: + array_literal --- top_level body: - variable_declaration_stmt - variable_declarator: - variable_declarator - value: unsupported_node "[]" - pattern: - var_pattern - identifier: identifier "xs" === Dictionary literal @@ -81,34 +78,34 @@ let d = ["a": 1, "b": 2] --- source_file - property_declaration - name: - pattern - bound_identifier: simple_identifier "d" - value: - dictionary_literal - key: - line_string_literal - text: line_str_text "a" - line_string_literal - text: line_str_text "b" - value: - integer_literal "1" - integer_literal "2" - value_binding_pattern - mutability: let + statement: + property_declaration + binding: + value_binding_pattern + mutability: let + declarator: + property_binding + name: + pattern + bound_identifier: simple_identifier "d" + value: + dictionary_literal + element: + dictionary_literal_item + key: + line_string_literal + text: line_str_text "a" + value: integer_literal "1" + dictionary_literal_item + key: + line_string_literal + text: line_str_text "b" + value: integer_literal "2" --- top_level body: - variable_declaration_stmt - variable_declarator: - variable_declarator - value: unsupported_node "[\"a\": 1, \"b\": 2]" - pattern: - var_pattern - identifier: identifier "d" === Set literal @@ -119,41 +116,45 @@ let s: Set = [1, 2, 3] --- source_file - property_declaration - name: - pattern - bound_identifier: simple_identifier "s" - value: - array_literal - element: - integer_literal "1" - integer_literal "2" - integer_literal "3" - value_binding_pattern - mutability: let - type_annotation - type: - type + statement: + property_declaration + binding: + value_binding_pattern + mutability: let + declarator: + property_binding name: - user_type - type_identifier "Set" - type_arguments + pattern + bound_identifier: simple_identifier "s" + type: + type_annotation + type: type name: user_type - type_identifier "Int" + part: + simple_user_type + arguments: + type_arguments + argument: + type + name: + user_type + part: + simple_user_type + name: type_identifier "Int" + name: type_identifier "Set" + value: + array_literal + element: + integer_literal "1" + integer_literal "2" + integer_literal "3" --- top_level body: - variable_declaration_stmt - variable_declarator: - variable_declarator - value: unsupported_node "[1, 2, 3]" - pattern: - var_pattern - identifier: identifier "s" === Tuple literal @@ -164,31 +165,32 @@ let t = (1, "two", 3.0) --- source_file - property_declaration - name: - pattern - bound_identifier: simple_identifier "t" - value: - tuple_expression - value: - integer_literal "1" - line_string_literal - text: line_str_text "two" - real_literal "3.0" - value_binding_pattern - mutability: let + statement: + property_declaration + binding: + value_binding_pattern + mutability: let + declarator: + property_binding + name: + pattern + bound_identifier: simple_identifier "t" + value: + tuple_expression + element: + tuple_expression_item + value: integer_literal "1" + tuple_expression_item + value: + line_string_literal + text: line_str_text "two" + tuple_expression_item + value: real_literal "3.0" --- top_level body: - variable_declaration_stmt - variable_declarator: - variable_declarator - value: unsupported_node "(1, \"two\", 3.0)" - pattern: - var_pattern - identifier: identifier "t" === Subscript access @@ -202,22 +204,29 @@ let first = xs[0] --- source_file + statement: + property_declaration + binding: + value_binding_pattern + mutability: let + declarator: + property_binding + name: + pattern + bound_identifier: simple_identifier "first" + value: + call_expression + function: simple_identifier "xs" + suffix: + call_suffix + arguments: + value_arguments + argument: + value_argument + value: integer_literal "0" comment "// TODO: tree-sitter-swift parses `xs[0]` as a call_expression (same shape" comment "// as `xs(0)`), so the mapping currently produces a call_expr. Update the" comment "// parser / add a separate subscript_expr node and remap when fixed." - property_declaration - name: - pattern - bound_identifier: simple_identifier "first" - value: - call_expression - simple_identifier "xs" - call_suffix - value_arguments - value_argument - value: integer_literal "0" - value_binding_pattern - mutability: let --- @@ -226,18 +235,6 @@ top_level unsupported_node "// TODO: tree-sitter-swift parses `xs[0]` as a call_expression (same shape" unsupported_node "// as `xs(0)`), so the mapping currently produces a call_expr. Update the" unsupported_node "// parser / add a separate subscript_expr node and remap when fixed." - variable_declaration_stmt - variable_declarator: - variable_declarator - value: - call_expr - argument: int_literal "0" - function: - name_expr - identifier: identifier "xs" - pattern: - var_pattern - identifier: identifier "first" === Dictionary subscript @@ -250,23 +247,30 @@ let v = d["key"] --- source_file + statement: + property_declaration + binding: + value_binding_pattern + mutability: let + declarator: + property_binding + name: + pattern + bound_identifier: simple_identifier "v" + value: + call_expression + function: simple_identifier "d" + suffix: + call_suffix + arguments: + value_arguments + argument: + value_argument + value: + line_string_literal + text: line_str_text "key" comment "// TODO: same parser issue as the array subscript case above —" comment "// `d[\"key\"]` is parsed as `call_expression(d, (\"key\"))`." - property_declaration - name: - pattern - bound_identifier: simple_identifier "v" - value: - call_expression - simple_identifier "d" - call_suffix - value_arguments - value_argument - value: - line_string_literal - text: line_str_text "key" - value_binding_pattern - mutability: let --- @@ -274,18 +278,6 @@ top_level body: unsupported_node "// TODO: same parser issue as the array subscript case above —" unsupported_node "// `d[\"key\"]` is parsed as `call_expression(d, (\"key\"))`." - variable_declaration_stmt - variable_declarator: - variable_declarator - value: - call_expr - argument: string_literal "\"key\"" - function: - name_expr - identifier: identifier "d" - pattern: - var_pattern - identifier: identifier "v" === Tuple member access @@ -296,27 +288,24 @@ let n = t.0 --- source_file - property_declaration - name: - pattern - bound_identifier: simple_identifier "n" - value: - navigation_expression - suffix: - navigation_suffix - suffix: integer_literal "0" - target: simple_identifier "t" - value_binding_pattern - mutability: let + statement: + property_declaration + binding: + value_binding_pattern + mutability: let + declarator: + property_binding + name: + pattern + bound_identifier: simple_identifier "n" + value: + navigation_expression + suffix: + navigation_suffix + suffix: integer_literal "0" + target: simple_identifier "t" --- top_level body: - variable_declaration_stmt - variable_declarator: - variable_declarator - value: unsupported_node "t.0" - pattern: - var_pattern - identifier: identifier "n" diff --git a/unified/extractor/tests/corpus/swift/control-flow.txt b/unified/extractor/tests/corpus/swift/control-flow.txt index f8526183d4d9..600e1126cbff 100644 --- a/unified/extractor/tests/corpus/swift/control-flow.txt +++ b/unified/extractor/tests/corpus/swift/control-flow.txt @@ -9,41 +9,32 @@ if x > 0 { --- source_file - if_statement - condition: - if_condition - comparison_expression - lhs: simple_identifier "x" - op: > - rhs: integer_literal "0" - statements - call_expression - simple_identifier "print" - call_suffix - value_arguments - value_argument - value: simple_identifier "x" + statement: + if_statement + body: + block + statement: + call_expression + function: simple_identifier "print" + suffix: + call_suffix + arguments: + value_arguments + argument: + value_argument + value: simple_identifier "x" + condition: + if_condition + kind: + comparison_expression + lhs: simple_identifier "x" + op: > + rhs: integer_literal "0" --- top_level body: - if_stmt - condition: - expr_condition - expr: unsupported_node "x > 0" - then: - block_stmt - body: - expr_stmt - expr: - call_expr - argument: - name_expr - identifier: identifier "x" - function: - name_expr - identifier: identifier "print" === If-else @@ -58,67 +49,47 @@ if x > 0 { --- source_file - if_statement - condition: - if_condition - comparison_expression - lhs: simple_identifier "x" - op: > - rhs: integer_literal "0" - statements - call_expression - simple_identifier "print" - call_suffix - value_arguments - value_argument - value: simple_identifier "x" - else "else" - statements - call_expression - simple_identifier "print" - call_suffix - value_arguments - value_argument - value: - prefix_expression - operation: - - target: simple_identifier "x" + statement: + if_statement + body: + block + statement: + call_expression + function: simple_identifier "print" + suffix: + call_suffix + arguments: + value_arguments + argument: + value_argument + value: simple_identifier "x" + condition: + if_condition + kind: + comparison_expression + lhs: simple_identifier "x" + op: > + rhs: integer_literal "0" + else_branch: + block + statement: + call_expression + function: simple_identifier "print" + suffix: + call_suffix + arguments: + value_arguments + argument: + value_argument + value: + prefix_expression + operation: - + target: simple_identifier "x" --- top_level body: - if_stmt - condition: - expr_condition - expr: unsupported_node "x > 0" - else: - block_stmt - body: - expr_stmt - expr: - call_expr - argument: - unary_expr - operator: operator "-" - operand: - name_expr - identifier: identifier "x" - function: - name_expr - identifier: identifier "print" - then: - block_stmt - body: - expr_stmt - expr: - call_expr - argument: - name_expr - identifier: identifier "x" - function: - name_expr - identifier: identifier "print" === If-else-if chain @@ -135,87 +106,65 @@ if x > 0 { --- source_file - if_statement - condition: - if_condition - comparison_expression - lhs: simple_identifier "x" - op: > - rhs: integer_literal "0" - statements - call_expression - simple_identifier "print" - call_suffix - value_arguments - value_argument - value: integer_literal "1" - else "else" + statement: if_statement + body: + block + statement: + call_expression + function: simple_identifier "print" + suffix: + call_suffix + arguments: + value_arguments + argument: + value_argument + value: integer_literal "1" condition: if_condition - comparison_expression - lhs: simple_identifier "x" - op: < - rhs: integer_literal "0" - statements - call_expression - simple_identifier "print" - call_suffix - value_arguments - value_argument - value: integer_literal "2" - else "else" - statements - call_expression - simple_identifier "print" - call_suffix - value_arguments - value_argument - value: integer_literal "3" + kind: + comparison_expression + lhs: simple_identifier "x" + op: > + rhs: integer_literal "0" + else_branch: + if_statement + body: + block + statement: + call_expression + function: simple_identifier "print" + suffix: + call_suffix + arguments: + value_arguments + argument: + value_argument + value: integer_literal "2" + condition: + if_condition + kind: + comparison_expression + lhs: simple_identifier "x" + op: < + rhs: integer_literal "0" + else_branch: + block + statement: + call_expression + function: simple_identifier "print" + suffix: + call_suffix + arguments: + value_arguments + argument: + value_argument + value: integer_literal "3" --- top_level body: - if_stmt - condition: - expr_condition - expr: unsupported_node "x > 0" - else: - if_stmt - condition: - expr_condition - expr: unsupported_node "x < 0" - else: - block_stmt - body: - expr_stmt - expr: - call_expr - argument: int_literal "3" - function: - name_expr - identifier: identifier "print" - then: - block_stmt - body: - expr_stmt - expr: - call_expr - argument: int_literal "2" - function: - name_expr - identifier: identifier "print" - then: - block_stmt - body: - expr_stmt - expr: - call_expr - argument: int_literal "1" - function: - name_expr - identifier: identifier "print" === If-let optional binding @@ -228,42 +177,36 @@ if let value = optional { --- source_file - if_statement - condition: - if_condition - if_let_binding - bound_identifier: simple_identifier "value" - value_binding_pattern - mutability: let - simple_identifier "optional" - statements - call_expression - simple_identifier "print" - call_suffix - value_arguments - value_argument - value: simple_identifier "value" + statement: + if_statement + body: + block + statement: + call_expression + function: simple_identifier "print" + suffix: + call_suffix + arguments: + value_arguments + argument: + value_argument + value: simple_identifier "value" + condition: + if_condition + kind: + if_let_binding + pattern: + pattern + binding: + value_binding_pattern + mutability: let + bound_identifier: simple_identifier "value" + value: simple_identifier "optional" --- top_level body: - if_stmt - condition: - expr_condition - expr: unsupported_node "let value = optional" - then: - block_stmt - body: - expr_stmt - expr: - call_expr - argument: - name_expr - identifier: identifier "value" - function: - name_expr - identifier: identifier "print" === Guard let @@ -274,22 +217,29 @@ guard let value = optional else { return } --- source_file - guard_statement - condition: - if_condition - if_let_binding - bound_identifier: simple_identifier "value" - value_binding_pattern - mutability: let - simple_identifier "optional" - else "else" - statements - control_transfer_statement + statement: + guard_statement + body: + block + statement: + control_transfer_statement + kind: return + condition: + if_condition + kind: + if_let_binding + pattern: + pattern + binding: + value_binding_pattern + mutability: let + bound_identifier: simple_identifier "value" + value: simple_identifier "optional" --- top_level - body: unsupported_node "guard let value = optional else { return }" + body: === Ternary expression @@ -300,36 +250,33 @@ let y = x > 0 ? 1 : -1 --- source_file - property_declaration - name: - pattern - bound_identifier: simple_identifier "y" - value: - ternary_expression - condition: - comparison_expression - lhs: simple_identifier "x" - op: > - rhs: integer_literal "0" - if_false: - prefix_expression - operation: - - target: integer_literal "1" - if_true: integer_literal "1" - value_binding_pattern - mutability: let + statement: + property_declaration + binding: + value_binding_pattern + mutability: let + declarator: + property_binding + name: + pattern + bound_identifier: simple_identifier "y" + value: + ternary_expression + condition: + comparison_expression + lhs: simple_identifier "x" + op: > + rhs: integer_literal "0" + if_false: + prefix_expression + operation: - + target: integer_literal "1" + if_true: integer_literal "1" --- top_level body: - variable_declaration_stmt - variable_declarator: - variable_declarator - value: unsupported_node "x > 0 ? 1 : -1" - pattern: - var_pattern - identifier: identifier "y" === Switch statement @@ -347,53 +294,69 @@ default: --- source_file - switch_statement - expr: simple_identifier "x" - switch_entry - switch_pattern - pattern - integer_literal "1" - statements - call_expression - simple_identifier "print" - call_suffix - value_arguments - value_argument - value: - line_string_literal - text: line_str_text "one" - switch_entry - switch_pattern - pattern - integer_literal "2" - switch_pattern - pattern - integer_literal "3" - statements - call_expression - simple_identifier "print" - call_suffix - value_arguments - value_argument - value: - line_string_literal - text: line_str_text "two or three" - switch_entry - default_keyword "default" - statements - call_expression - simple_identifier "print" - call_suffix - value_arguments - value_argument - value: - line_string_literal - text: line_str_text "other" + statement: + switch_statement + entry: + switch_entry + pattern: + switch_pattern + pattern: + pattern + kind: integer_literal "1" + statement: + call_expression + function: simple_identifier "print" + suffix: + call_suffix + arguments: + value_arguments + argument: + value_argument + value: + line_string_literal + text: line_str_text "one" + switch_entry + pattern: + switch_pattern + pattern: + pattern + kind: integer_literal "2" + switch_pattern + pattern: + pattern + kind: integer_literal "3" + statement: + call_expression + function: simple_identifier "print" + suffix: + call_suffix + arguments: + value_arguments + argument: + value_argument + value: + line_string_literal + text: line_str_text "two or three" + switch_entry + default: default_keyword "default" + statement: + call_expression + function: simple_identifier "print" + suffix: + call_suffix + arguments: + value_arguments + argument: + value_argument + value: + line_string_literal + text: line_str_text "other" + expr: simple_identifier "x" --- top_level - body: unsupported_node "switch x {\ncase 1:\n print(\"one\")\ncase 2, 3:\n print(\"two or three\")\ndefault:\n print(\"other\")\n}" + body: === Switch with binding pattern @@ -409,40 +372,76 @@ case .square(let s): --- source_file - switch_statement - expr: simple_identifier "shape" - switch_entry - switch_pattern - pattern - simple_identifier "circle" - pattern - bound_identifier: simple_identifier "r" - value_binding_pattern - mutability: let - statements - call_expression - simple_identifier "print" - call_suffix - value_arguments - value_argument - value: simple_identifier "r" - switch_entry - switch_pattern - pattern - simple_identifier "square" - pattern - bound_identifier: simple_identifier "s" - value_binding_pattern - mutability: let - statements - call_expression - simple_identifier "print" - call_suffix - value_arguments - value_argument - value: simple_identifier "s" + statement: + switch_statement + entry: + switch_entry + pattern: + switch_pattern + pattern: + pattern + kind: + case_pattern + arguments: + tuple_pattern + item: + tuple_pattern_item + pattern: + pattern + kind: + binding_pattern + binding: + value_binding_pattern + mutability: let + pattern: + pattern + bound_identifier: simple_identifier "r" + name: simple_identifier "circle" + statement: + call_expression + function: simple_identifier "print" + suffix: + call_suffix + arguments: + value_arguments + argument: + value_argument + value: simple_identifier "r" + switch_entry + pattern: + switch_pattern + pattern: + pattern + kind: + case_pattern + arguments: + tuple_pattern + item: + tuple_pattern_item + pattern: + pattern + kind: + binding_pattern + binding: + value_binding_pattern + mutability: let + pattern: + pattern + bound_identifier: simple_identifier "s" + name: simple_identifier "square" + statement: + call_expression + function: simple_identifier "print" + suffix: + call_suffix + arguments: + value_arguments + argument: + value_argument + value: simple_identifier "s" + expr: simple_identifier "shape" --- top_level - body: unsupported_node "switch shape {\ncase .circle(let r):\n print(r)\ncase .square(let s):\n print(s)\n}" + body: diff --git a/unified/extractor/tests/corpus/swift/desugar.txt b/unified/extractor/tests/corpus/swift/desugar.txt index 4e0defef0226..9f9ffeb070a8 100644 --- a/unified/extractor/tests/corpus/swift/desugar.txt +++ b/unified/extractor/tests/corpus/swift/desugar.txt @@ -7,19 +7,16 @@ Additive expression is desugared --- source_file - additive_expression - lhs: integer_literal "1" - op: + - rhs: integer_literal "2" + statement: + additive_expression + lhs: integer_literal "1" + op: + + rhs: integer_literal "2" --- top_level body: - binary_expr - operator: operator "+" - left: int_literal "1" - right: int_literal "2" === Another additive expression is desugared @@ -30,20 +27,13 @@ foo + bar --- source_file - additive_expression - lhs: simple_identifier "foo" - op: + - rhs: simple_identifier "bar" + statement: + additive_expression + lhs: simple_identifier "foo" + op: + + rhs: simple_identifier "bar" --- top_level body: - binary_expr - operator: operator "+" - left: - name_expr - identifier: identifier "foo" - right: - name_expr - identifier: identifier "bar" diff --git a/unified/extractor/tests/corpus/swift/functions.txt b/unified/extractor/tests/corpus/swift/functions.txt index 3329a6255f35..0a8210a4cf76 100644 --- a/unified/extractor/tests/corpus/swift/functions.txt +++ b/unified/extractor/tests/corpus/swift/functions.txt @@ -9,24 +9,28 @@ func greet() { --- source_file - function_declaration - body: - function_body - statements - call_expression - simple_identifier "print" - call_suffix - value_arguments - value_argument - value: - line_string_literal - text: line_str_text "hello" - name: simple_identifier "greet" + statement: + function_declaration + body: + block + statement: + call_expression + function: simple_identifier "print" + suffix: + call_suffix + arguments: + value_arguments + argument: + value_argument + value: + line_string_literal + text: line_str_text "hello" + name: simple_identifier "greet" --- top_level - body: unsupported_node "func greet() {\n print(\"hello\")\n}" + body: === Function with parameters and return type @@ -39,43 +43,56 @@ func add(_ a: Int, _ b: Int) -> Int { --- source_file - function_declaration - body: - function_body - statements - control_transfer_statement - result: - additive_expression - lhs: simple_identifier "a" - op: + - rhs: simple_identifier "b" - name: simple_identifier "add" - return_type: - type - name: - user_type - type_identifier "Int" - parameter - external_name: simple_identifier "_" - name: simple_identifier "a" - type: + statement: + function_declaration + body: + block + statement: + control_transfer_statement + kind: return + result: + additive_expression + lhs: simple_identifier "a" + op: + + rhs: simple_identifier "b" + name: simple_identifier "add" + parameter: + function_parameter + parameter: + parameter + external_name: simple_identifier "_" + name: simple_identifier "a" + type: + type + name: + user_type + part: + simple_user_type + name: type_identifier "Int" + function_parameter + parameter: + parameter + external_name: simple_identifier "_" + name: simple_identifier "b" + type: + type + name: + user_type + part: + simple_user_type + name: type_identifier "Int" + return_type: type name: user_type - type_identifier "Int" - parameter - external_name: simple_identifier "_" - name: simple_identifier "b" - type: - type - name: - user_type - type_identifier "Int" + part: + simple_user_type + name: type_identifier "Int" --- top_level - body: unsupported_node "func add(_ a: Int, _ b: Int) -> Int {\n return a + b\n}" + body: === Function with named parameters @@ -88,30 +105,39 @@ func greet(person name: String) { --- source_file - function_declaration - body: - function_body - statements - call_expression - simple_identifier "print" - call_suffix - value_arguments - value_argument - value: simple_identifier "name" - name: simple_identifier "greet" - parameter - external_name: simple_identifier "person" - name: simple_identifier "name" - type: - type - name: - user_type - type_identifier "String" + statement: + function_declaration + body: + block + statement: + call_expression + function: simple_identifier "print" + suffix: + call_suffix + arguments: + value_arguments + argument: + value_argument + value: simple_identifier "name" + name: simple_identifier "greet" + parameter: + function_parameter + parameter: + parameter + external_name: simple_identifier "person" + name: simple_identifier "name" + type: + type + name: + user_type + part: + simple_user_type + name: type_identifier "String" --- top_level - body: unsupported_node "func greet(person name: String) {\n print(name)\n}" + body: === Function with default parameter value @@ -124,32 +150,41 @@ func greet(name: String = "world") { --- source_file - function_declaration - body: - function_body - statements - call_expression - simple_identifier "print" - call_suffix - value_arguments - value_argument - value: simple_identifier "name" - default_value: - line_string_literal - text: line_str_text "world" - name: simple_identifier "greet" - parameter - name: simple_identifier "name" - type: - type - name: - user_type - type_identifier "String" + statement: + function_declaration + body: + block + statement: + call_expression + function: simple_identifier "print" + suffix: + call_suffix + arguments: + value_arguments + argument: + value_argument + value: simple_identifier "name" + name: simple_identifier "greet" + parameter: + function_parameter + default_value: + line_string_literal + text: line_str_text "world" + parameter: + parameter + name: simple_identifier "name" + type: + type + name: + user_type + part: + simple_user_type + name: type_identifier "String" --- top_level - body: unsupported_node "func greet(name: String = \"world\") {\n print(name)\n}" + body: === Variadic function @@ -162,44 +197,58 @@ func sum(_ values: Int...) -> Int { --- source_file - function_declaration - body: - function_body - statements - control_transfer_statement - result: - call_expression - navigation_expression + statement: + function_declaration + body: + block + statement: + control_transfer_statement + kind: return + result: + call_expression + function: + navigation_expression + suffix: + navigation_suffix + suffix: simple_identifier "reduce" + target: simple_identifier "values" suffix: - navigation_suffix - suffix: simple_identifier "reduce" - target: simple_identifier "values" - call_suffix - value_arguments - value_argument - value: integer_literal "0" - value_argument - value: - referenceable_operator - name: simple_identifier "sum" - return_type: - type - name: - user_type - type_identifier "Int" - parameter - external_name: simple_identifier "_" - name: simple_identifier "values" - type: + call_suffix + arguments: + value_arguments + argument: + value_argument + value: integer_literal "0" + value_argument + value: + referenceable_operator + operator: + + name: simple_identifier "sum" + parameter: + function_parameter + parameter: + parameter + external_name: simple_identifier "_" + name: simple_identifier "values" + type: + type + name: + user_type + part: + simple_user_type + name: type_identifier "Int" + return_type: type name: user_type - type_identifier "Int" + part: + simple_user_type + name: type_identifier "Int" --- top_level - body: unsupported_node "func sum(_ values: Int...) -> Int {\n return values.reduce(0, +)\n}" + body: === Function call @@ -210,26 +259,23 @@ foo(1, 2) --- source_file - call_expression - simple_identifier "foo" - call_suffix - value_arguments - value_argument - value: integer_literal "1" - value_argument - value: integer_literal "2" + statement: + call_expression + function: simple_identifier "foo" + suffix: + call_suffix + arguments: + value_arguments + argument: + value_argument + value: integer_literal "1" + value_argument + value: integer_literal "2" --- top_level body: - call_expr - argument: - int_literal "1" - int_literal "2" - function: - name_expr - identifier: identifier "foo" === Function call with labelled arguments @@ -240,27 +286,26 @@ greet(person: "Bob") --- source_file - call_expression - simple_identifier "greet" - call_suffix - value_arguments - value_argument - name: - value_argument_label - simple_identifier "person" - value: - line_string_literal - text: line_str_text "Bob" + statement: + call_expression + function: simple_identifier "greet" + suffix: + call_suffix + arguments: + value_arguments + argument: + value_argument + name: + value_argument_label + name: simple_identifier "person" + value: + line_string_literal + text: line_str_text "Bob" --- top_level body: - call_expr - argument: string_literal "\"Bob\"" - function: - name_expr - identifier: identifier "greet" === Method call @@ -271,29 +316,26 @@ list.append(1) --- source_file - call_expression - navigation_expression + statement: + call_expression + function: + navigation_expression + suffix: + navigation_suffix + suffix: simple_identifier "append" + target: simple_identifier "list" suffix: - navigation_suffix - suffix: simple_identifier "append" - target: simple_identifier "list" - call_suffix - value_arguments - value_argument - value: integer_literal "1" + call_suffix + arguments: + value_arguments + argument: + value_argument + value: integer_literal "1" --- top_level body: - call_expr - argument: int_literal "1" - function: - member_access_expr - target: - name_expr - identifier: identifier "list" - member: identifier "append" === Generic function @@ -306,31 +348,42 @@ func identity(_ x: T) -> T { --- source_file - function_declaration - body: - function_body - statements - control_transfer_statement - result: simple_identifier "x" - name: simple_identifier "identity" - return_type: - type - name: - user_type - type_identifier "T" - type_parameters - type_parameter - type_identifier "T" - parameter - external_name: simple_identifier "_" - name: simple_identifier "x" - type: + statement: + function_declaration + body: + block + statement: + control_transfer_statement + kind: return + result: simple_identifier "x" + name: simple_identifier "identity" + parameter: + function_parameter + parameter: + parameter + external_name: simple_identifier "_" + name: simple_identifier "x" + type: + type + name: + user_type + part: + simple_user_type + name: type_identifier "T" + return_type: type name: user_type - type_identifier "T" + part: + simple_user_type + name: type_identifier "T" + type_parameters: + type_parameters + parameter: + type_parameter + name: type_identifier "T" --- top_level - body: unsupported_node "func identity(_ x: T) -> T {\n return x\n}" + body: diff --git a/unified/extractor/tests/corpus/swift/literals.txt b/unified/extractor/tests/corpus/swift/literals.txt index 5f44733e136e..5044831a869b 100644 --- a/unified/extractor/tests/corpus/swift/literals.txt +++ b/unified/extractor/tests/corpus/swift/literals.txt @@ -7,12 +7,12 @@ Integer literal --- source_file - integer_literal "42" + statement: integer_literal "42" --- top_level - body: int_literal "42" + body: === Negative integer literal @@ -23,17 +23,15 @@ Negative integer literal --- source_file - prefix_expression - operation: - - target: integer_literal "7" + statement: + prefix_expression + operation: - + target: integer_literal "7" --- top_level body: - unary_expr - operator: operator "-" - operand: int_literal "7" === Floating-point literal @@ -44,12 +42,12 @@ Floating-point literal --- source_file - real_literal "3.14" + statement: real_literal "3.14" --- top_level - body: unsupported_node "3.14" + body: === Boolean literals @@ -61,15 +59,14 @@ false --- source_file - boolean_literal - boolean_literal + statement: + boolean_literal + boolean_literal --- top_level body: - unsupported_node "true" - unsupported_node "false" === Nil literal @@ -80,6 +77,7 @@ nil --- source_file + statement: nil --- @@ -95,13 +93,14 @@ String literal --- source_file - line_string_literal - text: line_str_text "hello" + statement: + line_string_literal + text: line_str_text "hello" --- top_level - body: string_literal "\"hello\"" + body: === String with interpolation @@ -112,13 +111,14 @@ String with interpolation --- source_file - line_string_literal - interpolation: - interpolated_expression - value: simple_identifier "name" - text: line_str_text "hello " + statement: + line_string_literal + interpolation: + interpolated_expression + value: simple_identifier "name" + text: line_str_text "hello " --- top_level - body: string_literal "\"hello \\(name)\"" + body: diff --git a/unified/extractor/tests/corpus/swift/loops.txt b/unified/extractor/tests/corpus/swift/loops.txt index 62d0d097bb02..8b9f3410d35d 100644 --- a/unified/extractor/tests/corpus/swift/loops.txt +++ b/unified/extractor/tests/corpus/swift/loops.txt @@ -9,28 +9,34 @@ for x in [1, 2, 3] { --- source_file - for_statement - collection: - array_literal - element: - integer_literal "1" - integer_literal "2" - integer_literal "3" - item: - pattern - bound_identifier: simple_identifier "x" - statements - call_expression - simple_identifier "print" - call_suffix - value_arguments - value_argument - value: simple_identifier "x" + statement: + for_statement + body: + block + statement: + call_expression + function: simple_identifier "print" + suffix: + call_suffix + arguments: + value_arguments + argument: + value_argument + value: simple_identifier "x" + collection: + array_literal + element: + integer_literal "1" + integer_literal "2" + integer_literal "3" + item: + pattern + bound_identifier: simple_identifier "x" --- top_level - body: unsupported_node "for x in [1, 2, 3] {\n print(x)\n}" + body: === For-in over range @@ -43,27 +49,33 @@ for i in 0..<10 { --- source_file - for_statement - collection: - range_expression - end: integer_literal "10" - op: ..< - start: integer_literal "0" - item: - pattern - bound_identifier: simple_identifier "i" - statements - call_expression - simple_identifier "print" - call_suffix - value_arguments - value_argument - value: simple_identifier "i" + statement: + for_statement + body: + block + statement: + call_expression + function: simple_identifier "print" + suffix: + call_suffix + arguments: + value_arguments + argument: + value_argument + value: simple_identifier "i" + collection: + range_expression + end: integer_literal "10" + op: ..< + start: integer_literal "0" + item: + pattern + bound_identifier: simple_identifier "i" --- top_level - body: unsupported_node "for i in 0..<10 {\n print(i)\n}" + body: === For-in with where clause @@ -76,29 +88,37 @@ for x in xs where x > 0 { --- source_file - for_statement - collection: simple_identifier "xs" - item: - pattern - bound_identifier: simple_identifier "x" - where_clause - where_keyword "where" - comparison_expression - lhs: simple_identifier "x" - op: > - rhs: integer_literal "0" - statements - call_expression - simple_identifier "print" - call_suffix - value_arguments - value_argument - value: simple_identifier "x" + statement: + for_statement + body: + block + statement: + call_expression + function: simple_identifier "print" + suffix: + call_suffix + arguments: + value_arguments + argument: + value_argument + value: simple_identifier "x" + collection: simple_identifier "xs" + item: + pattern + bound_identifier: simple_identifier "x" + where: + where_clause + expr: + comparison_expression + lhs: simple_identifier "x" + op: > + rhs: integer_literal "0" + keyword: where_keyword "where" --- top_level - body: unsupported_node "for x in xs where x > 0 {\n print(x)\n}" + body: === While loop @@ -111,25 +131,29 @@ while x > 0 { --- source_file - while_statement - condition: - if_condition - comparison_expression - lhs: simple_identifier "x" - op: > - rhs: integer_literal "0" - statements - assignment - operator: -= - result: integer_literal "1" - target: - directly_assignable_expression - simple_identifier "x" + statement: + while_statement + body: + block + statement: + assignment + operator: -= + result: integer_literal "1" + target: + directly_assignable_expression + expr: simple_identifier "x" + condition: + if_condition + kind: + comparison_expression + lhs: simple_identifier "x" + op: > + rhs: integer_literal "0" --- top_level - body: unsupported_node "while x > 0 {\n x -= 1\n}" + body: === Repeat-while loop @@ -142,25 +166,29 @@ repeat { --- source_file - repeat_while_statement - condition: - if_condition - comparison_expression - lhs: simple_identifier "x" - op: > - rhs: integer_literal "0" - statements - assignment - operator: -= - result: integer_literal "1" - target: - directly_assignable_expression - simple_identifier "x" + statement: + repeat_while_statement + body: + block + statement: + assignment + operator: -= + result: integer_literal "1" + target: + directly_assignable_expression + expr: simple_identifier "x" + condition: + if_condition + kind: + comparison_expression + lhs: simple_identifier "x" + op: > + rhs: integer_literal "0" --- top_level - body: unsupported_node "repeat {\n x -= 1\n} while x > 0" + body: === Break and continue @@ -175,38 +203,52 @@ for x in xs { --- source_file - for_statement - collection: simple_identifier "xs" - item: - pattern - bound_identifier: simple_identifier "x" - statements - if_statement - condition: - if_condition - comparison_expression - lhs: simple_identifier "x" - op: < - rhs: integer_literal "0" - statements - control_transfer_statement - if_statement - condition: - if_condition - comparison_expression - lhs: simple_identifier "x" - op: > - rhs: integer_literal "100" - statements - control_transfer_statement - call_expression - simple_identifier "print" - call_suffix - value_arguments - value_argument - value: simple_identifier "x" + statement: + for_statement + body: + block + statement: + if_statement + body: + block + statement: + control_transfer_statement + kind: continue + condition: + if_condition + kind: + comparison_expression + lhs: simple_identifier "x" + op: < + rhs: integer_literal "0" + if_statement + body: + block + statement: + control_transfer_statement + kind: break + condition: + if_condition + kind: + comparison_expression + lhs: simple_identifier "x" + op: > + rhs: integer_literal "100" + call_expression + function: simple_identifier "print" + suffix: + call_suffix + arguments: + value_arguments + argument: + value_argument + value: simple_identifier "x" + collection: simple_identifier "xs" + item: + pattern + bound_identifier: simple_identifier "x" --- top_level - body: unsupported_node "for x in xs {\n if x < 0 { continue }\n if x > 100 { break }\n print(x)\n}" + body: diff --git a/unified/extractor/tests/corpus/swift/operators.txt b/unified/extractor/tests/corpus/swift/operators.txt index 173f6e929769..f1a4a5fcdb26 100644 --- a/unified/extractor/tests/corpus/swift/operators.txt +++ b/unified/extractor/tests/corpus/swift/operators.txt @@ -7,23 +7,16 @@ a + b --- source_file - additive_expression - lhs: simple_identifier "a" - op: + - rhs: simple_identifier "b" + statement: + additive_expression + lhs: simple_identifier "a" + op: + + rhs: simple_identifier "b" --- top_level body: - binary_expr - operator: operator "+" - left: - name_expr - identifier: identifier "a" - right: - name_expr - identifier: identifier "b" === Subtraction @@ -34,23 +27,16 @@ a - b --- source_file - additive_expression - lhs: simple_identifier "a" - op: - - rhs: simple_identifier "b" + statement: + additive_expression + lhs: simple_identifier "a" + op: - + rhs: simple_identifier "b" --- top_level body: - binary_expr - operator: operator "-" - left: - name_expr - identifier: identifier "a" - right: - name_expr - identifier: identifier "b" === Multiplication @@ -61,23 +47,16 @@ a * b --- source_file - multiplicative_expression - lhs: simple_identifier "a" - op: * - rhs: simple_identifier "b" + statement: + multiplicative_expression + lhs: simple_identifier "a" + op: * + rhs: simple_identifier "b" --- top_level body: - binary_expr - operator: operator "*" - left: - name_expr - identifier: identifier "a" - right: - name_expr - identifier: identifier "b" === Division @@ -88,23 +67,16 @@ a / b --- source_file - multiplicative_expression - lhs: simple_identifier "a" - op: / - rhs: simple_identifier "b" + statement: + multiplicative_expression + lhs: simple_identifier "a" + op: / + rhs: simple_identifier "b" --- top_level body: - binary_expr - operator: operator "/" - left: - name_expr - identifier: identifier "a" - right: - name_expr - identifier: identifier "b" === Operator precedence: addition and multiplication @@ -115,33 +87,20 @@ a + b * c --- source_file - additive_expression - lhs: simple_identifier "a" - op: + - rhs: - multiplicative_expression - lhs: simple_identifier "b" - op: * - rhs: simple_identifier "c" + statement: + additive_expression + lhs: simple_identifier "a" + op: + + rhs: + multiplicative_expression + lhs: simple_identifier "b" + op: * + rhs: simple_identifier "c" --- top_level body: - binary_expr - operator: operator "+" - left: - name_expr - identifier: identifier "a" - right: - binary_expr - operator: operator "*" - left: - name_expr - identifier: identifier "b" - right: - name_expr - identifier: identifier "c" === Parenthesised expression @@ -152,27 +111,24 @@ Parenthesised expression --- source_file - multiplicative_expression - lhs: - tuple_expression - value: - additive_expression - lhs: simple_identifier "a" - op: + - rhs: simple_identifier "b" - op: * - rhs: simple_identifier "c" + statement: + multiplicative_expression + lhs: + tuple_expression + element: + tuple_expression_item + value: + additive_expression + lhs: simple_identifier "a" + op: + + rhs: simple_identifier "b" + op: * + rhs: simple_identifier "c" --- top_level body: - binary_expr - operator: operator "*" - left: unsupported_node "(a + b)" - right: - name_expr - identifier: identifier "c" === Comparison @@ -183,23 +139,16 @@ a < b --- source_file - comparison_expression - lhs: simple_identifier "a" - op: < - rhs: simple_identifier "b" + statement: + comparison_expression + lhs: simple_identifier "a" + op: < + rhs: simple_identifier "b" --- top_level body: - binary_expr - operator: operator "<" - left: - name_expr - identifier: identifier "a" - right: - name_expr - identifier: identifier "b" === Equality @@ -210,23 +159,16 @@ a == b --- source_file - equality_expression - lhs: simple_identifier "a" - op: == - rhs: simple_identifier "b" + statement: + equality_expression + lhs: simple_identifier "a" + op: == + rhs: simple_identifier "b" --- top_level body: - binary_expr - operator: operator "==" - left: - name_expr - identifier: identifier "a" - right: - name_expr - identifier: identifier "b" === Logical and @@ -237,23 +179,16 @@ a && b --- source_file - conjunction_expression - lhs: simple_identifier "a" - op: && - rhs: simple_identifier "b" + statement: + conjunction_expression + lhs: simple_identifier "a" + op: && + rhs: simple_identifier "b" --- top_level body: - binary_expr - operator: operator "&&" - left: - name_expr - identifier: identifier "a" - right: - name_expr - identifier: identifier "b" === Logical or @@ -264,23 +199,16 @@ a || b --- source_file - disjunction_expression - lhs: simple_identifier "a" - op: || - rhs: simple_identifier "b" + statement: + disjunction_expression + lhs: simple_identifier "a" + op: || + rhs: simple_identifier "b" --- top_level body: - binary_expr - operator: operator "||" - left: - name_expr - identifier: identifier "a" - right: - name_expr - identifier: identifier "b" === Logical not @@ -291,19 +219,15 @@ Logical not --- source_file - prefix_expression - operation: bang "!" - target: simple_identifier "a" + statement: + prefix_expression + operation: bang "!" + target: simple_identifier "a" --- top_level body: - unary_expr - operator: operator "!" - operand: - name_expr - identifier: identifier "a" === Range operator @@ -314,16 +238,13 @@ Range operator --- source_file - range_expression - end: integer_literal "10" - op: ... - start: integer_literal "1" + statement: + range_expression + end: integer_literal "10" + op: ... + start: integer_literal "1" --- top_level body: - binary_expr - operator: operator "..." - left: int_literal "1" - right: int_literal "10" diff --git a/unified/extractor/tests/corpus/swift/optionals-and-errors.txt b/unified/extractor/tests/corpus/swift/optionals-and-errors.txt index c4f9118eedca..572e9181a681 100644 --- a/unified/extractor/tests/corpus/swift/optionals-and-errors.txt +++ b/unified/extractor/tests/corpus/swift/optionals-and-errors.txt @@ -7,32 +7,33 @@ let x: Int? = nil --- source_file - property_declaration - name: - pattern - bound_identifier: simple_identifier "x" - value: nil - value_binding_pattern - mutability: let - type_annotation - type: - type + statement: + property_declaration + binding: + value_binding_pattern + mutability: let + declarator: + property_binding name: - optional_type - wrapped: - user_type - type_identifier "Int" + pattern + bound_identifier: simple_identifier "x" + type: + type_annotation + type: + type + name: + optional_type + wrapped: + user_type + part: + simple_user_type + name: type_identifier "Int" + value: nil --- top_level body: - variable_declaration_stmt - variable_declarator: - variable_declarator - pattern: - var_pattern - identifier: identifier "x" === Optional chaining @@ -43,41 +44,36 @@ let n = obj?.foo?.bar --- source_file - property_declaration - name: - pattern - bound_identifier: simple_identifier "n" - value: - navigation_expression - suffix: - navigation_suffix - suffix: simple_identifier "bar" - target: - optional_chain_marker + statement: + property_declaration + binding: + value_binding_pattern + mutability: let + declarator: + property_binding + name: + pattern + bound_identifier: simple_identifier "n" + value: navigation_expression suffix: navigation_suffix - suffix: simple_identifier "foo" + suffix: simple_identifier "bar" target: optional_chain_marker - simple_identifier "obj" - value_binding_pattern - mutability: let + expr: + navigation_expression + suffix: + navigation_suffix + suffix: simple_identifier "foo" + target: + optional_chain_marker + expr: simple_identifier "obj" --- top_level body: - variable_declaration_stmt - variable_declarator: - variable_declarator - value: - member_access_expr - target: unsupported_node "obj?.foo?" - member: identifier "bar" - pattern: - var_pattern - identifier: identifier "n" === Force unwrap @@ -88,28 +84,25 @@ let n = opt! --- source_file - property_declaration - name: - pattern - bound_identifier: simple_identifier "n" - value: - postfix_expression - operation: bang "!" - target: simple_identifier "opt" - value_binding_pattern - mutability: let + statement: + property_declaration + binding: + value_binding_pattern + mutability: let + declarator: + property_binding + name: + pattern + bound_identifier: simple_identifier "n" + value: + postfix_expression + operation: bang "!" + target: simple_identifier "opt" --- top_level body: - variable_declaration_stmt - variable_declarator: - variable_declarator - value: unsupported_node "opt!" - pattern: - var_pattern - identifier: identifier "n" === Nil-coalescing @@ -120,28 +113,25 @@ let n = opt ?? 0 --- source_file - property_declaration - name: - pattern - bound_identifier: simple_identifier "n" - value: - nil_coalescing_expression - if_nil: integer_literal "0" - value: simple_identifier "opt" - value_binding_pattern - mutability: let + statement: + property_declaration + binding: + value_binding_pattern + mutability: let + declarator: + property_binding + name: + pattern + bound_identifier: simple_identifier "n" + value: + nil_coalescing_expression + if_nil: integer_literal "0" + value: simple_identifier "opt" --- top_level body: - variable_declaration_stmt - variable_declarator: - variable_declarator - value: unsupported_node "opt ?? 0" - pattern: - var_pattern - identifier: identifier "n" === Throwing function @@ -154,25 +144,29 @@ func read() throws -> String { --- source_file - function_declaration - body: - function_body - statements - control_transfer_statement - result: - line_string_literal - name: simple_identifier "read" - return_type: - type - name: - user_type - type_identifier "String" - throws "throws" + statement: + function_declaration + body: + block + statement: + control_transfer_statement + kind: return + result: + line_string_literal + name: simple_identifier "read" + return_type: + type + name: + user_type + part: + simple_user_type + name: type_identifier "String" + throws: throws "throws" --- top_level - body: unsupported_node "func read() throws -> String {\n return \"\"\n}" + body: === Do-catch @@ -187,29 +181,41 @@ do { --- source_file - do_statement - statements - try_expression - expr: - call_expression - simple_identifier "foo" - call_suffix - value_arguments - try_operator - catch_block - catch_keyword "catch" - statements - call_expression - simple_identifier "print" - call_suffix - value_arguments - value_argument - value: simple_identifier "error" + statement: + do_statement + body: + block + statement: + try_expression + expr: + call_expression + function: simple_identifier "foo" + suffix: + call_suffix + arguments: + value_arguments + operator: + try_operator + catch: + catch_block + body: + block + statement: + call_expression + function: simple_identifier "print" + suffix: + call_suffix + arguments: + value_arguments + argument: + value_argument + value: simple_identifier "error" + keyword: catch_keyword "catch" --- top_level - body: unsupported_node "do {\n try foo()\n} catch {\n print(error)\n}" + body: === Try? expression @@ -220,32 +226,32 @@ let result = try? foo() --- source_file - property_declaration - name: - pattern - bound_identifier: simple_identifier "result" - value: - try_expression - expr: - call_expression - simple_identifier "foo" - call_suffix - value_arguments - try_operator - value_binding_pattern - mutability: let + statement: + property_declaration + binding: + value_binding_pattern + mutability: let + declarator: + property_binding + name: + pattern + bound_identifier: simple_identifier "result" + value: + try_expression + expr: + call_expression + function: simple_identifier "foo" + suffix: + call_suffix + arguments: + value_arguments + operator: + try_operator --- top_level body: - variable_declaration_stmt - variable_declarator: - variable_declarator - value: unsupported_node "try? foo()" - pattern: - var_pattern - identifier: identifier "result" === Try! expression @@ -256,29 +262,29 @@ let result = try! foo() --- source_file - property_declaration - name: - pattern - bound_identifier: simple_identifier "result" - value: - try_expression - expr: - call_expression - simple_identifier "foo" - call_suffix - value_arguments - try_operator - value_binding_pattern - mutability: let + statement: + property_declaration + binding: + value_binding_pattern + mutability: let + declarator: + property_binding + name: + pattern + bound_identifier: simple_identifier "result" + value: + try_expression + expr: + call_expression + function: simple_identifier "foo" + suffix: + call_suffix + arguments: + value_arguments + operator: + try_operator --- top_level body: - variable_declaration_stmt - variable_declarator: - variable_declarator - value: unsupported_node "try! foo()" - pattern: - var_pattern - identifier: identifier "result" diff --git a/unified/extractor/tests/corpus/swift/types.txt b/unified/extractor/tests/corpus/swift/types.txt index 873749aa6ce6..0bebaa1238f3 100644 --- a/unified/extractor/tests/corpus/swift/types.txt +++ b/unified/extractor/tests/corpus/swift/types.txt @@ -7,16 +7,17 @@ class Foo {} --- source_file - class_declaration - body: - class_body - declaration_kind: class - name: type_identifier "Foo" + statement: + class_declaration + body: + class_body + declaration_kind: class + name: type_identifier "Foo" --- top_level - body: unsupported_node "class Foo {}" + body: === Class with stored properties @@ -30,40 +31,54 @@ class Point { --- source_file - class_declaration - body: - class_body - property_declaration - name: - pattern - bound_identifier: simple_identifier "x" - value_binding_pattern - mutability: var - type_annotation - type: - type - name: - user_type - type_identifier "Int" - property_declaration - name: - pattern - bound_identifier: simple_identifier "y" - value_binding_pattern - mutability: var - type_annotation - type: - type - name: - user_type - type_identifier "Int" - declaration_kind: class - name: type_identifier "Point" + statement: + class_declaration + body: + class_body + member: + property_declaration + binding: + value_binding_pattern + mutability: var + declarator: + property_binding + name: + pattern + bound_identifier: simple_identifier "x" + type: + type_annotation + type: + type + name: + user_type + part: + simple_user_type + name: type_identifier "Int" + property_declaration + binding: + value_binding_pattern + mutability: var + declarator: + property_binding + name: + pattern + bound_identifier: simple_identifier "y" + type: + type_annotation + type: + type + name: + user_type + part: + simple_user_type + name: type_identifier "Int" + declaration_kind: class + name: type_identifier "Point" --- top_level - body: unsupported_node "class Point {\n var x: Int\n var y: Int\n}" + body: === Class with initializer @@ -79,51 +94,64 @@ class Point { --- source_file - class_declaration - body: - class_body - property_declaration - name: - pattern - bound_identifier: simple_identifier "x" - value_binding_pattern - mutability: var - type_annotation - type: - type - name: - user_type - type_identifier "Int" - init_declaration - body: - function_body - statements - assignment - operator: = - result: simple_identifier "x" - target: - directly_assignable_expression - navigation_expression - suffix: - navigation_suffix - suffix: simple_identifier "x" - target: - self_expression - name: init - parameter - name: simple_identifier "x" - type: - type - name: - user_type - type_identifier "Int" - declaration_kind: class - name: type_identifier "Point" + statement: + class_declaration + body: + class_body + member: + property_declaration + binding: + value_binding_pattern + mutability: var + declarator: + property_binding + name: + pattern + bound_identifier: simple_identifier "x" + type: + type_annotation + type: + type + name: + user_type + part: + simple_user_type + name: type_identifier "Int" + init_declaration + body: + block + statement: + assignment + operator: = + result: simple_identifier "x" + target: + directly_assignable_expression + expr: + navigation_expression + suffix: + navigation_suffix + suffix: simple_identifier "x" + target: + self_expression + parameter: + function_parameter + parameter: + parameter + name: simple_identifier "x" + type: + type + name: + user_type + part: + simple_user_type + name: type_identifier "Int" + declaration_kind: class + name: type_identifier "Point" --- top_level - body: unsupported_node "class Point {\n var x: Int\n init(x: Int) {\n self.x = x\n }\n}" + body: === Class with method @@ -139,34 +167,39 @@ class Counter { --- source_file - class_declaration - body: - class_body - property_declaration - name: - pattern - bound_identifier: simple_identifier "n" - value: integer_literal "0" - value_binding_pattern - mutability: var - function_declaration - body: - function_body - statements - assignment - operator: += - result: integer_literal "1" - target: - directly_assignable_expression - simple_identifier "n" - name: simple_identifier "bump" - declaration_kind: class - name: type_identifier "Counter" + statement: + class_declaration + body: + class_body + member: + property_declaration + binding: + value_binding_pattern + mutability: var + declarator: + property_binding + name: + pattern + bound_identifier: simple_identifier "n" + value: integer_literal "0" + function_declaration + body: + block + statement: + assignment + operator: += + result: integer_literal "1" + target: + directly_assignable_expression + expr: simple_identifier "n" + name: simple_identifier "bump" + declaration_kind: class + name: type_identifier "Counter" --- top_level - body: unsupported_node "class Counter {\n var n = 0\n func bump() {\n n += 1\n }\n}" + body: === Class inheritance @@ -177,20 +210,24 @@ class Dog: Animal {} --- source_file - class_declaration - body: - class_body - declaration_kind: class - name: type_identifier "Dog" - inheritance_specifier - inherits_from: - user_type - type_identifier "Animal" + statement: + class_declaration + body: + class_body + declaration_kind: class + inherits: + inheritance_specifier + inherits_from: + user_type + part: + simple_user_type + name: type_identifier "Animal" + name: type_identifier "Dog" --- top_level - body: unsupported_node "class Dog: Animal {}" + body: === Struct @@ -204,40 +241,54 @@ struct Point { --- source_file - class_declaration - body: - class_body - property_declaration - name: - pattern - bound_identifier: simple_identifier "x" - value_binding_pattern - mutability: let - type_annotation - type: - type - name: - user_type - type_identifier "Int" - property_declaration - name: - pattern - bound_identifier: simple_identifier "y" - value_binding_pattern - mutability: let - type_annotation - type: - type - name: - user_type - type_identifier "Int" - declaration_kind: struct - name: type_identifier "Point" + statement: + class_declaration + body: + class_body + member: + property_declaration + binding: + value_binding_pattern + mutability: let + declarator: + property_binding + name: + pattern + bound_identifier: simple_identifier "x" + type: + type_annotation + type: + type + name: + user_type + part: + simple_user_type + name: type_identifier "Int" + property_declaration + binding: + value_binding_pattern + mutability: let + declarator: + property_binding + name: + pattern + bound_identifier: simple_identifier "y" + type: + type_annotation + type: + type + name: + user_type + part: + simple_user_type + name: type_identifier "Int" + declaration_kind: struct + name: type_identifier "Point" --- top_level - body: unsupported_node "struct Point {\n let x: Int\n let y: Int\n}" + body: === Enum with cases @@ -253,24 +304,34 @@ enum Direction { --- source_file - class_declaration - body: - enum_class_body - enum_entry - name: simple_identifier "north" - enum_entry - name: simple_identifier "south" - enum_entry - name: simple_identifier "east" - enum_entry - name: simple_identifier "west" - declaration_kind: enum - name: type_identifier "Direction" + statement: + class_declaration + body: + enum_class_body + member: + enum_entry + case: + enum_case_entry + name: simple_identifier "north" + enum_entry + case: + enum_case_entry + name: simple_identifier "south" + enum_entry + case: + enum_case_entry + name: simple_identifier "east" + enum_entry + case: + enum_case_entry + name: simple_identifier "west" + declaration_kind: enum + name: type_identifier "Direction" --- top_level - body: unsupported_node "enum Direction {\n case north\n case south\n case east\n case west\n}" + body: === Enum with associated values @@ -284,34 +345,50 @@ enum Shape { --- source_file - class_declaration - body: - enum_class_body - enum_entry - data_contents: - enum_type_parameters - simple_identifier "radius" - type - name: - user_type - type_identifier "Double" - name: simple_identifier "circle" - enum_entry - data_contents: - enum_type_parameters - simple_identifier "side" - type - name: - user_type - type_identifier "Double" - name: simple_identifier "square" - declaration_kind: enum - name: type_identifier "Shape" + statement: + class_declaration + body: + enum_class_body + member: + enum_entry + case: + enum_case_entry + data_contents: + enum_type_parameters + parameter: + enum_type_parameter + name: simple_identifier "radius" + type: + type + name: + user_type + part: + simple_user_type + name: type_identifier "Double" + name: simple_identifier "circle" + enum_entry + case: + enum_case_entry + data_contents: + enum_type_parameters + parameter: + enum_type_parameter + name: simple_identifier "side" + type: + type + name: + user_type + part: + simple_user_type + name: type_identifier "Double" + name: simple_identifier "square" + declaration_kind: enum + name: type_identifier "Shape" --- top_level - body: unsupported_node "enum Shape {\n case circle(radius: Double)\n case square(side: Double)\n}" + body: === Protocol declaration @@ -324,18 +401,19 @@ protocol Drawable { --- source_file - protocol_declaration - body: - protocol_body - protocol_function_declaration - name: simple_identifier "draw" - declaration_kind: protocol - name: type_identifier "Drawable" + statement: + protocol_declaration + body: + protocol_body + member: + protocol_function_declaration + name: simple_identifier "draw" + name: type_identifier "Drawable" --- top_level - body: unsupported_node "protocol Drawable {\n func draw()\n}" + body: === Extension @@ -348,36 +426,43 @@ extension Int { --- source_file - class_declaration - body: - class_body - function_declaration - body: - function_body - statements - control_transfer_statement - result: - multiplicative_expression - lhs: - self_expression - op: * - rhs: - self_expression - name: simple_identifier "squared" - return_type: - type - name: - user_type - type_identifier "Int" - declaration_kind: extension - name: - user_type - type_identifier "Int" + statement: + class_declaration + body: + class_body + member: + function_declaration + body: + block + statement: + control_transfer_statement + kind: return + result: + multiplicative_expression + lhs: + self_expression + op: * + rhs: + self_expression + name: simple_identifier "squared" + return_type: + type + name: + user_type + part: + simple_user_type + name: type_identifier "Int" + declaration_kind: extension + name: + user_type + part: + simple_user_type + name: type_identifier "Int" --- top_level - body: unsupported_node "extension Int {\n func squared() -> Int { return self * self }\n}" + body: === Computed property @@ -394,61 +479,82 @@ class Rect { --- source_file - class_declaration - body: - class_body - property_declaration - name: - pattern - bound_identifier: simple_identifier "w" - value_binding_pattern - mutability: var - type_annotation - type: - type - name: - user_type - type_identifier "Double" - property_declaration - name: - pattern - bound_identifier: simple_identifier "h" - value_binding_pattern - mutability: var - type_annotation - type: - type - name: - user_type - type_identifier "Double" - property_declaration - computed_value: - computed_property - statements - control_transfer_statement - result: - multiplicative_expression - lhs: simple_identifier "w" - op: * - rhs: simple_identifier "h" - name: - pattern - bound_identifier: simple_identifier "area" - value_binding_pattern - mutability: var - type_annotation - type: - type - name: - user_type - type_identifier "Double" - declaration_kind: class - name: type_identifier "Rect" + statement: + class_declaration + body: + class_body + member: + property_declaration + binding: + value_binding_pattern + mutability: var + declarator: + property_binding + name: + pattern + bound_identifier: simple_identifier "w" + type: + type_annotation + type: + type + name: + user_type + part: + simple_user_type + name: type_identifier "Double" + property_declaration + binding: + value_binding_pattern + mutability: var + declarator: + property_binding + name: + pattern + bound_identifier: simple_identifier "h" + type: + type_annotation + type: + type + name: + user_type + part: + simple_user_type + name: type_identifier "Double" + property_declaration + binding: + value_binding_pattern + mutability: var + declarator: + property_binding + computed_value: + computed_property + statement: + control_transfer_statement + kind: return + result: + multiplicative_expression + lhs: simple_identifier "w" + op: * + rhs: simple_identifier "h" + name: + pattern + bound_identifier: simple_identifier "area" + type: + type_annotation + type: + type + name: + user_type + part: + simple_user_type + name: type_identifier "Double" + declaration_kind: class + name: type_identifier "Rect" --- top_level - body: unsupported_node "class Rect {\n var w: Double\n var h: Double\n var area: Double {\n return w * h\n }\n}" + body: === Property with getter and setter @@ -465,50 +571,71 @@ class Box { --- source_file - class_declaration - body: - class_body - property_declaration - name: - pattern - bound_identifier: simple_identifier "_v" - value: integer_literal "0" - modifiers - visibility_modifier - value_binding_pattern - mutability: var - property_declaration - computed_value: - computed_property - computed_getter - getter_specifier - statements - control_transfer_statement - result: simple_identifier "_v" - computed_setter - setter_specifier - statements - assignment - operator: = - result: simple_identifier "newValue" - target: - directly_assignable_expression - simple_identifier "_v" - name: - pattern - bound_identifier: simple_identifier "v" - value_binding_pattern - mutability: var - type_annotation - type: - type - name: - user_type - type_identifier "Int" - declaration_kind: class - name: type_identifier "Box" + statement: + class_declaration + body: + class_body + member: + property_declaration + binding: + value_binding_pattern + mutability: var + declarator: + property_binding + name: + pattern + bound_identifier: simple_identifier "_v" + value: integer_literal "0" + modifiers: + modifiers + modifier: + visibility_modifier + property_declaration + binding: + value_binding_pattern + mutability: var + declarator: + property_binding + computed_value: + computed_property + accessor: + computed_getter + body: + block + statement: + control_transfer_statement + kind: return + result: simple_identifier "_v" + specifier: + getter_specifier + computed_setter + body: + block + statement: + assignment + operator: = + result: simple_identifier "newValue" + target: + directly_assignable_expression + expr: simple_identifier "_v" + specifier: + setter_specifier + name: + pattern + bound_identifier: simple_identifier "v" + type: + type_annotation + type: + type + name: + user_type + part: + simple_user_type + name: type_identifier "Int" + declaration_kind: class + name: type_identifier "Box" --- top_level - body: unsupported_node "class Box {\n private var _v = 0\n var v: Int {\n get { return _v }\n set { _v = newValue }\n }\n}" + body: diff --git a/unified/extractor/tests/corpus/swift/variables.txt b/unified/extractor/tests/corpus/swift/variables.txt index 3fe7686a8c31..1911ddd02b1e 100644 --- a/unified/extractor/tests/corpus/swift/variables.txt +++ b/unified/extractor/tests/corpus/swift/variables.txt @@ -7,25 +7,22 @@ let x = 1 --- source_file - property_declaration - name: - pattern - bound_identifier: simple_identifier "x" - value: integer_literal "1" - value_binding_pattern - mutability: let + statement: + property_declaration + binding: + value_binding_pattern + mutability: let + declarator: + property_binding + name: + pattern + bound_identifier: simple_identifier "x" + value: integer_literal "1" --- top_level body: - variable_declaration_stmt - variable_declarator: - variable_declarator - value: int_literal "1" - pattern: - var_pattern - identifier: identifier "x" === Var binding @@ -36,25 +33,22 @@ var x = 1 --- source_file - property_declaration - name: - pattern - bound_identifier: simple_identifier "x" - value: integer_literal "1" - value_binding_pattern - mutability: var + statement: + property_declaration + binding: + value_binding_pattern + mutability: var + declarator: + property_binding + name: + pattern + bound_identifier: simple_identifier "x" + value: integer_literal "1" --- top_level body: - variable_declaration_stmt - variable_declarator: - variable_declarator - value: int_literal "1" - pattern: - var_pattern - identifier: identifier "x" === Let with type annotation @@ -65,31 +59,31 @@ let x: Int = 1 --- source_file - property_declaration - name: - pattern - bound_identifier: simple_identifier "x" - value: integer_literal "1" - value_binding_pattern - mutability: let - type_annotation - type: - type + statement: + property_declaration + binding: + value_binding_pattern + mutability: let + declarator: + property_binding name: - user_type - type_identifier "Int" + pattern + bound_identifier: simple_identifier "x" + type: + type_annotation + type: + type + name: + user_type + part: + simple_user_type + name: type_identifier "Int" + value: integer_literal "1" --- top_level body: - variable_declaration_stmt - variable_declarator: - variable_declarator - value: int_literal "1" - pattern: - var_pattern - identifier: identifier "x" === Var without initialiser @@ -100,29 +94,30 @@ var x: Int --- source_file - property_declaration - name: - pattern - bound_identifier: simple_identifier "x" - value_binding_pattern - mutability: var - type_annotation - type: - type + statement: + property_declaration + binding: + value_binding_pattern + mutability: var + declarator: + property_binding name: - user_type - type_identifier "Int" + pattern + bound_identifier: simple_identifier "x" + type: + type_annotation + type: + type + name: + user_type + part: + simple_user_type + name: type_identifier "Int" --- top_level body: - variable_declaration_stmt - variable_declarator: - variable_declarator - pattern: - var_pattern - identifier: identifier "x" === Tuple destructuring binding @@ -133,34 +128,32 @@ let (a, b) = pair --- source_file - property_declaration - name: - pattern - pattern - simple_identifier "a" - pattern - simple_identifier "b" - value: simple_identifier "pair" - value_binding_pattern - mutability: let + statement: + property_declaration + binding: + value_binding_pattern + mutability: let + declarator: + property_binding + name: + pattern + kind: + tuple_pattern + item: + tuple_pattern_item + pattern: + pattern + kind: simple_identifier "a" + tuple_pattern_item + pattern: + pattern + kind: simple_identifier "b" + value: simple_identifier "pair" --- top_level body: - variable_declaration_stmt - variable_declarator: - variable_declarator - value: - name_expr - identifier: identifier "pair" - pattern: - tuple_pattern - element: - var_pattern - identifier: identifier "a" - var_pattern - identifier: identifier "b" === Multiple bindings on one line @@ -171,34 +164,27 @@ let x = 1, y = 2 --- source_file - property_declaration - name: - pattern - bound_identifier: simple_identifier "x" - pattern - bound_identifier: simple_identifier "y" - value: - integer_literal "1" - integer_literal "2" - value_binding_pattern - mutability: let + statement: + property_declaration + binding: + value_binding_pattern + mutability: let + declarator: + property_binding + name: + pattern + bound_identifier: simple_identifier "x" + value: integer_literal "1" + property_binding + name: + pattern + bound_identifier: simple_identifier "y" + value: integer_literal "2" --- top_level body: - variable_declaration_stmt - variable_declarator: - variable_declarator - value: int_literal "1" - pattern: - var_pattern - identifier: identifier "x" - variable_declarator - value: int_literal "2" - pattern: - var_pattern - identifier: identifier "y" === Assignment @@ -209,17 +195,18 @@ x = 1 --- source_file - assignment - operator: = - result: integer_literal "1" - target: - directly_assignable_expression - simple_identifier "x" + statement: + assignment + operator: = + result: integer_literal "1" + target: + directly_assignable_expression + expr: simple_identifier "x" --- top_level - body: unsupported_node "x = 1" + body: === Compound assignment @@ -230,14 +217,15 @@ x += 1 --- source_file - assignment - operator: += - result: integer_literal "1" - target: - directly_assignable_expression - simple_identifier "x" + statement: + assignment + operator: += + result: integer_literal "1" + target: + directly_assignable_expression + expr: simple_identifier "x" --- top_level - body: unsupported_node "x += 1" + body: diff --git a/unified/ql/test/library-tests/BasicTest/test.expected b/unified/ql/test/library-tests/BasicTest/test.expected index 1d6bb8def2b5..5298ec6f982f 100644 --- a/unified/ql/test/library-tests/BasicTest/test.expected +++ b/unified/ql/test/library-tests/BasicTest/test.expected @@ -1,18 +1,9 @@ nameExpr -| name_expr.swift:1:9:1:9 | NameExpr | y | unsupported -| test.swift:1:1:1:17 | | | | test.swift:3:1:3:38 | | | -| test.swift:4:1:14:1 | | | | test.swift:16:1:16:32 | | | -| test.swift:17:1:21:1 | | | | test.swift:23:1:23:37 | | | -| test.swift:24:1:32:1 | | | | test.swift:34:1:34:49 | | | -| test.swift:35:1:55:1 | | | | test.swift:57:1:57:30 | | | -| test.swift:58:1:70:1 | | | | test.swift:72:1:72:37 | | | -| test.swift:73:1:82:1 | | | | test.swift:84:1:84:24 | | | -| test.swift:85:1:88:1 | | |