File tree Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -254,7 +254,9 @@ extension Parser.Lookahead {
254
254
didSeeAnyAttributes = true
255
255
_ = self . consumeAttributeList ( )
256
256
case . poundIf:
257
- _ = self . consumeIfConfigOfAttributes ( )
257
+ if self . consumeIfConfigOfAttributes ( ) {
258
+ didSeeAnyAttributes = true
259
+ }
258
260
default :
259
261
break ATTRIBUTE_LOOP
260
262
}
Original file line number Diff line number Diff line change @@ -157,6 +157,42 @@ final class DirectiveTests: ParserTestCase {
157
157
)
158
158
}
159
159
160
+ func testPoundIfNestedStructure( ) {
161
+ assertParse (
162
+ """
163
+ #if true
164
+ #if true
165
+ @frozen
166
+ #endif
167
+ #endif
168
+ public struct S {}
169
+ """ ,
170
+ substructure: AttributeListSyntax ( [
171
+ . ifConfigDecl(
172
+ IfConfigDeclSyntax ( clauses: [
173
+ IfConfigClauseSyntax (
174
+ poundKeyword: . poundIfToken( ) ,
175
+ condition: ExprSyntax ( " true " ) ,
176
+ elements: . attributes( [
177
+ . ifConfigDecl(
178
+ IfConfigDeclSyntax ( clauses: [
179
+ IfConfigClauseSyntax (
180
+ poundKeyword: . poundIfToken( ) ,
181
+ condition: ExprSyntax ( " true " ) ,
182
+ elements: . attributes( [
183
+ . attribute( " @frozen " )
184
+ ] )
185
+ )
186
+ ] )
187
+ )
188
+ ] )
189
+ )
190
+ ] )
191
+ )
192
+ ] )
193
+ )
194
+ }
195
+
160
196
func testHasAttribute( ) {
161
197
assertParse (
162
198
"""
You can’t perform that action at this time.
0 commit comments