Skip to content

Commit 99e9db8

Browse files
authored
Merge pull request #70985 from hamishknight/fix-diag-5.10
[5.10] [Sema] Avoid mentioning `then` in a diagnostic
2 parents 97ddeba + 816305d commit 99e9db8

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,8 +1238,7 @@ ERROR(single_value_stmt_branch_empty,none,
12381238
"expected expression in branch of '%0' expression",
12391239
(StmtKind))
12401240
ERROR(single_value_stmt_branch_must_end_in_result,none,
1241-
"non-expression branch of '%0' expression may only end with a 'throw' "
1242-
"or 'then'",
1241+
"non-expression branch of '%0' expression may only end with a 'throw'",
12431242
(StmtKind))
12441243
ERROR(cannot_jump_in_single_value_stmt,none,
12451244
"cannot '%0' in '%1' when used as expression",

lib/Sema/MiscDiagnostics.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3937,6 +3937,8 @@ class SingleValueStmtUsageChecker final : public ASTWalker {
39373937
continue;
39383938
}
39393939
}
3940+
// TODO: If 'then' statements are enabled by default, the wording of
3941+
// this diagnostic should be tweaked.
39403942
Diags.diagnose(branch->getEndLoc(),
39413943
diag::single_value_stmt_branch_must_end_in_result,
39423944
S->getKind());

0 commit comments

Comments
 (0)