Skip to content

Commit dd221a8

Browse files
tplaymeowTimur Guliamov
andauthored
Added fix-it to add the @unchecked Sendable conformance if it is not re-stated (swiftlang#75233)
Co-authored-by: Timur Guliamov <[email protected]>
1 parent 5b5244f commit dd221a8

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6244,8 +6244,9 @@ bool swift::checkSendableConformance(
62446244
return false;
62456245
}
62466246

6247-
nominal->diagnose(diag::restate_unchecked_sendable,
6248-
nominal->getName());
6247+
auto diag =
6248+
nominal->diagnose(diag::restate_unchecked_sendable, nominal->getName());
6249+
addSendableFixIt(nominal, diag, /*unchecked=*/true);
62496250
return false;
62506251
}
62516252

test/Concurrency/concurrent_value_checking.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ class C5: @unchecked Sendable {
361361
var x: Int = 0 // okay
362362
}
363363

364-
// expected-warning@+1 {{class 'C6' must restate inherited '@unchecked Sendable' conformance}}
364+
// expected-warning@+1 {{class 'C6' must restate inherited '@unchecked Sendable' conformance}}{{13-13=, @unchecked Sendable}}
365365
class C6: C5 {
366366
var y: Int = 0 // still okay, it's unsafe
367367
}

0 commit comments

Comments
 (0)