Skip to content

Commit 405b473

Browse files
committed
Improve error message if condition is missing from guard statement
1 parent d57c592 commit 405b473

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

Sources/SwiftSyntax/gyb_generated/syntax_nodes/SyntaxStmtNodes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1573,7 +1573,7 @@ public struct GuardStmtSyntax: StmtSyntaxProtocol, SyntaxHashable {
15731573
case 2:
15741574
return nil
15751575
case 3:
1576-
return "conditions"
1576+
return "condition"
15771577
case 4:
15781578
return nil
15791579
case 5:

Tests/SwiftParserTest/translated/GuardTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ final class GuardTests: XCTestCase {
2424
}
2525
""",
2626
diagnostics: [
27-
DiagnosticSpec(message: "expected conditions in 'guard' statement"),
27+
DiagnosticSpec(message: "expected condition in 'guard' statement"),
2828
]
2929
)
3030
}

gyb_syntax_support/StmtNodes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
traits=['WithCodeBlock'],
6464
children=[
6565
Child('GuardKeyword', kind='GuardToken'),
66-
Child('Conditions', kind='ConditionElementList', name_for_diagnostics='conditions',
66+
Child('Conditions', kind='ConditionElementList', name_for_diagnostics='condition',
6767
collection_element_name='Condition'),
6868
Child('ElseKeyword', kind='ElseToken'),
6969
Child('Body', kind='CodeBlock', name_for_diagnostics='body'),

0 commit comments

Comments
 (0)