Skip to content

Commit 29754b0

Browse files
committed
Unified: Extend Swift corpus with freestanding macro invocations
1 parent e37391e commit 29754b0

2 files changed

Lines changed: 137 additions & 0 deletions

File tree

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
#expect(value == 42)
2+
3+
#custom<Int>(value) {
4+
value
5+
} completion: {
6+
value
7+
}
8+
9+
#Preview {
10+
let previewValue = 42
11+
previewValue
12+
}
13+
14+
---
15+
16+
sourceFile
17+
endOfFileToken: endOfFile
18+
statements:
19+
codeBlockItem
20+
item:
21+
macroExpansionExpr
22+
leftParen: (
23+
rightParen: )
24+
arguments:
25+
labeledExpr
26+
expression:
27+
infixOperatorExpr
28+
operator:
29+
binaryOperatorExpr
30+
operator: binaryOperator "=="
31+
leftOperand:
32+
declReferenceExpr
33+
baseName: identifier "value"
34+
rightOperand:
35+
integerLiteralExpr
36+
literal: integerLiteral "42"
37+
additionalTrailingClosures:
38+
macroName: identifier "expect"
39+
pound: #
40+
codeBlockItem
41+
item:
42+
macroExpansionExpr
43+
leftParen: (
44+
rightParen: )
45+
arguments:
46+
labeledExpr
47+
expression:
48+
declReferenceExpr
49+
baseName: identifier "value"
50+
additionalTrailingClosures:
51+
multipleTrailingClosureElement
52+
colon: :
53+
label: identifier "completion"
54+
closure:
55+
closureExpr
56+
leftBrace: {
57+
rightBrace: }
58+
statements:
59+
codeBlockItem
60+
item:
61+
declReferenceExpr
62+
baseName: identifier "value"
63+
trailingClosure:
64+
closureExpr
65+
leftBrace: {
66+
rightBrace: }
67+
statements:
68+
codeBlockItem
69+
item:
70+
declReferenceExpr
71+
baseName: identifier "value"
72+
genericArgumentClause:
73+
genericArgumentClause
74+
arguments:
75+
genericArgument
76+
argument:
77+
identifierType
78+
name: identifier "Int"
79+
leftAngle: <
80+
rightAngle: >
81+
macroName: identifier "custom"
82+
pound: #
83+
codeBlockItem
84+
item:
85+
macroExpansionExpr
86+
arguments:
87+
additionalTrailingClosures:
88+
trailingClosure:
89+
closureExpr
90+
leftBrace: {
91+
rightBrace: }
92+
statements:
93+
codeBlockItem
94+
item:
95+
variableDecl
96+
attributes:
97+
modifiers:
98+
bindingSpecifier: let
99+
bindings:
100+
patternBinding
101+
initializer:
102+
initializerClause
103+
equal: =
104+
value:
105+
integerLiteralExpr
106+
literal: integerLiteral "42"
107+
pattern:
108+
identifierPattern
109+
identifier: identifier "previewValue"
110+
codeBlockItem
111+
item:
112+
declReferenceExpr
113+
baseName: identifier "previewValue"
114+
macroName: identifier "Preview"
115+
pound: #
116+
117+
---
118+
119+
top_level source="⟨body⟩"
120+
body:
121+
block source="⟨stmt⟩\n\n⟨stmt⟩\n\n⟨stmt⟩"
122+
stmt:
123+
unsupported_node "#expect(value == 42)" source="#expect(value == 42)"
124+
unsupported_node "#custom<Int>(value) {\n value\n} completion: {\n value\n}" source="#custom<Int>(value) {\n value\n} completion: {\n value\n}"
125+
unsupported_node "#Preview {\n let previewValue = 42\n previewValue\n}" source="#Preview {\n let previewValue = 42\n previewValue\n}"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#expect(value == 42)
2+
3+
#custom<Int>(value) {
4+
value
5+
} completion: {
6+
value
7+
}
8+
9+
#Preview {
10+
let previewValue = 42
11+
previewValue
12+
}

0 commit comments

Comments
 (0)