Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
unified: Also test for string with interpolation
This worked, but it's nice to have a test for it
  • Loading branch information
asgerf committed Sep 1, 2026
commit 8323982db42d4052d5b49c7d8243594d1c6d32de
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Arbitrary expressions may appear in pattern context
switch x {
case y, y + 1, -y, y...z, "foo", 4, foo().bar, .baz, [42], ["a": 1], try y, y!, y is T, await y:
case y, y + 1, -y, y...z, "foo", 4, foo().bar, .baz, [42], ["a": 1], try y, y!, y is T, await y, "interpolate \(y)":
print("expr")
case true ? y : z:
print("ternary is also valid")
Expand Down Expand Up @@ -189,6 +189,7 @@ sourceFile
name: identifier "T"
isKeyword: is
switchCaseItem
trailingComma: ,
pattern:
expressionPattern
expression:
Expand All @@ -197,6 +198,27 @@ sourceFile
declReferenceExpr
baseName: identifier "y"
awaitKeyword: await
switchCaseItem
pattern:
expressionPattern
expression:
stringLiteralExpr
closingQuote: "
openingQuote: "
segments:
stringSegment
content: stringSegment "interpolate "
expressionSegment
leftParen: (
rightParen: )
backslash: \
expressions:
labeledExpr
expression:
declReferenceExpr
baseName: identifier "y"
stringSegment
content: stringSegment
statements:
codeBlockItem
item:
Expand Down Expand Up @@ -373,6 +395,19 @@ top_level
name_expr
identifier: identifier "y"
operator: prefix_operator "await"
expr_equality_pattern
expr:
string_interpolation_expr
element:
string_literal "interpolate "
call_expr
callee: builtin_expr "interpolation"
argument:
argument
value:
name_expr
identifier: identifier "y"
string_literal
body:
block
stmt:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Arbitrary expressions may appear in pattern context
switch x {
case y, y + 1, -y, y...z, "foo", 4, foo().bar, .baz, [42], ["a": 1], try y, y!, y is T, await y:
case y, y + 1, -y, y...z, "foo", 4, foo().bar, .baz, [42], ["a": 1], try y, y!, y is T, await y, "interpolate \(y)":
print("expr")
case true ? y : z:
print("ternary is also valid")
Expand Down