File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -950,6 +950,12 @@ class AvailabilityScopeBuilder : private ASTWalker {
950950 if (auto accessor = dyn_cast<AccessorDecl>(decl))
951951 return declHasSafeAttr (accessor->getStorage ());
952952
953+ // Attributes for pattern binding declarations are on the first variable.
954+ if (auto pbd = dyn_cast<PatternBindingDecl>(decl)) {
955+ if (auto var = pbd->getAnchoringVarDecl (0 ))
956+ return declHasSafeAttr (var);
957+ }
958+
953959 return false ;
954960 }
955961
Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ func rethrowing(body: (UnsafeType) throws -> Void) rethrows { } // expected-warn
3131class HasStatics {
3232 // expected-note@+1{{make static method 'f' @unsafe to indicate that its use is not memory-safe}}{{3-3=@unsafe }}
3333 static internal func f( _: UnsafeType ) { } // expected-warning{{reference to unsafe struct 'UnsafeType' [Unsafe]}}
34+
35+
3436}
3537
3638@unsafe
@@ -44,6 +46,14 @@ struct HasProperties {
4446 @unsafe var computedUnsafe : Int {
4547 unsafeInt ( )
4648 }
49+
50+ @safe ( unchecked) static var blah : Int = {
51+ unsafeInt ( )
52+ } ( )
53+
54+ @unsafe static var blahUnsafe : Int = {
55+ unsafeInt ( )
56+ } ( )
4757}
4858
4959// Parsing issues
You can’t perform that action at this time.
0 commit comments