File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -3277,7 +3277,8 @@ class CheckEffectsCoverage : public EffectsHandlingWalker<CheckEffectsCoverage>
32773277 // the autoclosure expression itself, and the autoclosure must be
32783278 // 'async'.
32793279
3280- // FIXME: 'unsafe' should do what with autoclosures?
3280+ OldFlags.mergeFrom (ContextFlags::HasAnyUnsafe, Self.Flags );
3281+ OldFlags.mergeFrom (ContextFlags::HasAnyUnsafeSite, Self.Flags );
32813282 }
32823283
32833284 void setCoverageForSingleValueStmtExpr () {
Original file line number Diff line number Diff line change @@ -131,8 +131,18 @@ func testKeyPath() {
131131 _ = unsafe \HasProperties . computedUnsafe
132132}
133133
134+ func takesAutoclosure< T> ( _ body: @autoclosure ( ) -> T ) { }
135+
136+ func testAutoclosure( ) {
137+ // expected-warning@+1{{expression uses unsafe constructs but is not marked with 'unsafe'}}{{20-20=unsafe }}
138+ takesAutoclosure ( unsafeFunction ( ) ) // expected-note{{reference to unsafe global function 'unsafeFunction()'}}
139+
140+ unsafe takesAutoclosure( unsafeFunction ( ) )
141+
142+ takesAutoclosure ( unsafe unsafeFunction( ) )
143+ }
144+
134145// Parsing of `unsafe` expressions.
135146func testUnsafePositionError( ) -> Int {
136147 return 3 + unsafe unsafeInt( ) // expected-error{{'unsafe' cannot appear to the right of a non-assignment operator}}
137148}
138-
You can’t perform that action at this time.
0 commit comments