Skip to content

Commit 38cf5fe

Browse files
committed
NOTE should actually be a WARNING.
Updating test as well to check that the fix-it is applied correctly.
1 parent 466ddcb commit 38cf5fe

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

include/swift/AST/DiagnosticsCommon.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ NOTE(previous_decldef,none,
5454
NOTE(brace_stmt_suggest_do,none,
5555
"did you mean to use a 'do' statement?", ())
5656

57-
NOTE(defer_stmt_at_block_end,none,
57+
WARNING(defer_stmt_at_block_end,none,
5858
"'defer' at the end of its scope is redundant and will execute immediately; "
5959
"replace it with 'do'", ())
6060

test/Sema/diag_defer_block_end.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
let x = 1
44
let y = 2
55
if (x > y) {
6-
defer { // expected-note {{'defer' at the end of its scope is redundant and will execute immediately}}
6+
defer { // expected-warning {{'defer' at the end of its scope is redundant and will execute immediately}}{{5-10=do}}
77
print("not so useful defer stmt.")
88
}
99
}
1010

1111
func sr7307(_ value: Bool) {
1212
let negated = !value
13-
defer { // expected-note {{'defer' at the end of its scope is redundant and will execute immediately}}
13+
defer { // expected-warning {{'defer' at the end of its scope is redundant and will execute immediately}}{{5-10=do}}
1414
print("negated value is {negated}")
1515
}
1616
}

0 commit comments

Comments
 (0)