Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
647ac70
unified: Add string interpolation expression
asgerf Aug 14, 2026
e06d667
unified: Regenerate QL
asgerf Aug 14, 2026
41ae049
unified: Add string interpolation corpus test
asgerf Aug 14, 2026
5ae4fca
unified: Naive rules for string interpolations
asgerf Aug 14, 2026
9ff9d65
unified: Set in_pattern=true when translating patterns
asgerf Aug 26, 2026
3dbf730
unified: Include type_test_pattern in pattern type
asgerf Aug 26, 2026
0c05a19
unified: Add corpus with with 'case .foo, T.foo, [T].foo'
asgerf Aug 26, 2026
4173b02
unified: Set and check ctx.in_pattern in more places
asgerf Aug 26, 2026
b806266
unified: Change tuple.element to Argument
asgerf Aug 26, 2026
0ca3c94
unified: Fix mapping of tuple patterns
asgerf Aug 26, 2026
3a04adb
unified: Collapse single-element tuples
asgerf Aug 26, 2026
acb1a35
unified: Permit patterns in unresolved operator sequences
asgerf Aug 27, 2026
bc0a4bf
unified: Regenerate QL
asgerf Aug 27, 2026
a707d4b
unified: Use top-level rules for patternExpr and wildcard
asgerf Aug 27, 2026
c19b61b
unified: Handle 'asExpr' in pattern context
asgerf Aug 27, 2026
d4aacba
unified: Make type_test_pattern.pattern optional
asgerf Aug 27, 2026
9f0a124
unified: support 'case is T'
asgerf Aug 27, 2026
77c3018
unified: Use the new 'where' syntax for tuples
asgerf Aug 27, 2026
a036680
unified: Use 'where' syntax for constructor_pattern
asgerf Aug 27, 2026
389e064
unified: Remove superfluous rule
asgerf Aug 27, 2026
2b6f6d8
unified: Use 'where' clause in labeledExpr rule
asgerf Aug 27, 2026
c8d55e5
unified: Use where in optionalChainingExpr
asgerf Aug 27, 2026
63976db
unified: 'where' syntaxin asExpr
asgerf Aug 27, 2026
08ee7df
unified: Make update_corpus.sh run fewer tests
asgerf Aug 28, 2026
8358fd1
unified: Add test with arbitrary expressions in pattern context
asgerf Aug 28, 2026
d95f6c6
unified: "Coerce" expr to pattern
asgerf Aug 28, 2026
a066692
unified: Factor the pattern into a macro
asgerf Aug 28, 2026
1f8de18
unified: Apply coercion macro to other exprs
asgerf Aug 28, 2026
8323982
unified: Also test for string with interpolation
asgerf Aug 28, 2026
54dd65e
unified: Move prefixOperatorExpr to a more meaningful place
asgerf Aug 28, 2026
6215cbb
unified: Add subscriptExpr test
asgerf Aug 28, 2026
a22033f
unified: Fix subscriptExpr error
asgerf Aug 28, 2026
c1ef3f1
unified: Drive-by fix: Explicitly unsupport subscriptCallExpr
asgerf Aug 28, 2026
3b56e52
unified: Fix issue with '_' as an assignment target
asgerf Aug 28, 2026
6490cce
unified: Use the coercion macro for literals
asgerf Sep 1, 2026
1a89962
unified: Do not emit plain strings as interpolations
asgerf Sep 1, 2026
dfc9d60
unified: Update BasicTest output
asgerf Sep 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions unified/extractor/ast_types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ supertypes:
- boolean_literal
- string_literal
- regex_literal
- string_interpolation_expr
- builtin_expr
- binary_expr
- unary_expr
Expand Down Expand Up @@ -39,17 +40,13 @@ supertypes:
expr_or_type:
- expr
- type_expr
# An element of an `unresolved_operator_sequence`: either an operand (`expr`)
# or one of the infix operators separating the operands.
expr_or_operator:
- expr
- infix_operator
pattern:
- name_pattern
- tuple_pattern
- constructor_pattern
- or_pattern
- conditional_pattern
- type_test_pattern
- ignore_pattern
- expr_equality_pattern
- bulk_importing_pattern
Expand Down Expand Up @@ -130,6 +127,11 @@ named:
# A regex literal
regex_literal:

# A string interpolation expression. Constant parts are stored as string literals.
string_interpolation_expr:
modifier*: modifier
element*: expr

# Application of a binary operator, such as `a + b`
binary_expr:
left: expr
Expand All @@ -151,11 +153,13 @@ named:
# determine (e.g. one imported from another module), it leaves that chain
# unresolved and emits it here rather than guessing a (possibly wrong)
# structure. The `element`s alternate operands (`expr`) and infix operators.
# Note that these can contain assignment operators, and the LHS of an assignment operator can be a pattern
unresolved_operator_sequence:
element*: expr_or_operator
# An inline union is used here to avoid generating a somewhat Swift-specific and not-that-useful union type in the public AST
element*: [expr, pattern, infix_operator]

# Plain assignment
assign_expr:
# Plain assignment
target: expr_or_pattern
value: expr

Expand Down Expand Up @@ -224,7 +228,7 @@ named:

# A tuple expression, such as `(a, b, c)`.
tuple_expr:
element*: expr
element*: argument

# A parameter.
#
Expand Down Expand Up @@ -462,7 +466,7 @@ named:
# In Swift: `if let y = x as? Foo` is a pattern_guard_expr containing a type_test_pattern
# In Java: `x instanceof Foo y` is a type_test_pattern wrapping a name_pattern
type_test_pattern:
pattern: pattern
pattern?: pattern
type: type_expr

# A '*' pattern that imports all members of the incoming value into the local scope
Expand Down
Loading
Loading