mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Parse] Avoid parsing unsafe expression before binary or postfix op (#81429)
rdar://150751248
This commit is contained in:
@@ -200,6 +200,8 @@ func unsafeFun() {
|
||||
_ = color
|
||||
|
||||
if unsafe { }
|
||||
|
||||
_ = unsafe ? 1 : 0
|
||||
}
|
||||
|
||||
func moreUnsafeFunc(unsafe: [Int]) {
|
||||
@@ -218,6 +220,13 @@ func yetMoreUnsafeFunc(unsafe: () -> Void) {
|
||||
// expected-warning@-1{{no unsafe operations occur within 'unsafe' expression}}
|
||||
}
|
||||
|
||||
func yetMoreMoreUnsafeFunc(unsafe: Int?) {
|
||||
_ = unsafe!
|
||||
if let unsafe {
|
||||
_ = unsafe + 1
|
||||
}
|
||||
}
|
||||
|
||||
// @safe suppresses unsafe-type-related diagnostics on an entity
|
||||
struct MyArray<Element> {
|
||||
@safe func withUnsafeBufferPointer<R, E>(
|
||||
|
||||
Reference in New Issue
Block a user