Skip to content

Commit 118adf7

Browse files
committed
[SwiftSyntax] Support shorthand if-let
1 parent 9bcc6fc commit 118adf7

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// RUN: %target-typecheck-verify-swift -verify-syntax-tree
2+
3+
func foo(x: Int?) {
4+
if let x {
5+
print(x)
6+
}
7+
}

utils/gyb_syntax_support/StmtNodes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@
234234
Child('Pattern', kind='Pattern'),
235235
Child('TypeAnnotation', kind='TypeAnnotation',
236236
is_optional=True),
237-
Child('Initializer', kind='InitializerClause'),
237+
Child('Initializer', kind='InitializerClause',
238+
is_optional=True),
238239
]),
239240

240241
# unavailability-condition -> '#unavailable' '(' availability-spec ')'

0 commit comments

Comments
 (0)