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 {
950
950
if (auto accessor = dyn_cast<AccessorDecl>(decl))
951
951
return declHasSafeAttr (accessor->getStorage ());
952
952
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
+
953
959
return false ;
954
960
}
955
961
Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ func rethrowing(body: (UnsafeType) throws -> Void) rethrows { } // expected-warn
31
31
class HasStatics {
32
32
// expected-note@+1{{make static method 'f' @unsafe to indicate that its use is not memory-safe}}{{3-3=@unsafe }}
33
33
static internal func f( _: UnsafeType ) { } // expected-warning{{reference to unsafe struct 'UnsafeType' [Unsafe]}}
34
+
35
+
34
36
}
35
37
36
38
@unsafe
@@ -44,6 +46,14 @@ struct HasProperties {
44
46
@unsafe var computedUnsafe : Int {
45
47
unsafeInt ( )
46
48
}
49
+
50
+ @safe ( unchecked) static var blah : Int = {
51
+ unsafeInt ( )
52
+ } ( )
53
+
54
+ @unsafe static var blahUnsafe : Int = {
55
+ unsafeInt ( )
56
+ } ( )
47
57
}
48
58
49
59
// Parsing issues
You can’t perform that action at this time.
0 commit comments