Skip to content

Commit f82d7f7

Browse files
authored
Merge pull request #70984 from hamishknight/fix-diag
[Sema] Avoid mentioning `then` in a diagnostic
2 parents 07a6743 + 72cbea6 commit f82d7f7

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
@@ -1274,8 +1274,7 @@ ERROR(single_value_stmt_branch_empty,none,
12741274
"expected expression in branch of '%0' expression",
12751275
(StmtKind))
12761276
ERROR(single_value_stmt_branch_must_end_in_result,none,
1277-
"non-expression branch of '%0' expression may only end with a 'throw' "
1278-
"or 'then'",
1277+
"non-expression branch of '%0' expression may only end with a 'throw'",
12791278
(StmtKind))
12801279
ERROR(cannot_jump_in_single_value_stmt,none,
12811280
"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
@@ -3938,6 +3938,8 @@ class SingleValueStmtUsageChecker final : public ASTWalker {
39383938
continue;
39393939
}
39403940
}
3941+
// TODO: If 'then' statements are enabled by default, the wording of
3942+
// this diagnostic should be tweaked.
39413943
Diags.diagnose(branch->getEndLoc(),
39423944
diag::single_value_stmt_branch_must_end_in_result,
39433945
S->getKind());

0 commit comments

Comments
 (0)