mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Always emit "unsafe does not cover any unsafe constructs" warning
Check for unsafe constructs in all modes, so that we can emit the "unsafe does not cover any unsafe constructs" warning consistently. One does not need to write "unsafe" outside of strict memory safety mode, but if you do... it needs to cover unsafe behavior.
This commit is contained in:
@@ -361,11 +361,11 @@ func testSequenceExpr() async throws(Never) {
|
||||
|
||||
_ = unsafe await try! getIntAsync() + getIntAsync()
|
||||
// expected-warning@-1 {{'try' must precede 'await'}}
|
||||
|
||||
// expected-warning@-2{{no unsafe operations occur within 'unsafe' expression}}
|
||||
_ = try unsafe await try! getIntAsync() + getIntAsync()
|
||||
// expected-warning@-1 {{'try' must precede 'await'}}
|
||||
// expected-warning@-2 {{no calls to throwing functions occur within 'try' expression}}
|
||||
|
||||
// expected-warning@-3{{no unsafe operations occur within 'unsafe' expression}}
|
||||
try _ = (try! getInt()) + getInt()
|
||||
// expected-error@-1:29 {{thrown expression type 'any Error' cannot be converted to error type 'Never'}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user