8
8
// Each FIXME line is a case that the current implementation misses.
9
9
// The model is currently being refined, so this isn't set in stone.
10
10
//
11
- // TODO: Ensure that each of these cases is covered by
11
+ // TODO: Move all static cases (search for // Error:) into
12
+ // a set of -verify tests (noescape_static_diagnostics.swift).
13
+ // and a set of separate SILGen-only tests to check [unknown] markers.
14
+ //
15
+ // TODO: Ensure that each dynamic case is covered by
12
16
// Interpreter/enforce_exclusive_access.swift.
13
17
14
18
// Helper
@@ -22,12 +26,6 @@ func doTwo(_: ()->(), _: ()->()) {}
22
26
// Helper
23
27
func doOneInout( _: ( ) -> ( ) , _: inout Int ) { }
24
28
25
- // Helper
26
- struct Frob {
27
- mutating func outerMut( ) { doOne { innerMut ( ) } }
28
- mutating func innerMut( ) { }
29
- }
30
-
31
29
// FIXME: statically prohibit a call to a non-escaping closure
32
30
// parameter using another non-escaping closure parameter as an argument.
33
31
func reentrantNoescape( fn: ( ( ) -> ( ) ) -> ( ) ) {
@@ -40,6 +38,12 @@ func reentrantNoescape(fn: (() -> ()) -> ()) {
40
38
// fn(c)
41
39
// }
42
40
41
+ // Helper
42
+ struct Frob {
43
+ mutating func outerMut( ) { doOne { innerMut ( ) } }
44
+ mutating func innerMut( ) { }
45
+ }
46
+
43
47
// Allow nested mutable access via closures.
44
48
func nestedNoEscape( f: inout Frob ) {
45
49
doOne { f. outerMut ( ) }
@@ -296,7 +300,7 @@ func readWriteBox() {
296
300
// doTwo({ _ = x }, c)
297
301
// }
298
302
299
- // Error on noescape read + write inout.
303
+ // Error: noescape read + write inout.
300
304
func readWriteInout( ) {
301
305
var x = 3
302
306
// Around the call: [read] [dynamic]
@@ -321,7 +325,7 @@ func readWriteInout() {
321
325
// FIXME-CHECK: end_access [[ACCESS]]
322
326
// CHECK-LABEL: } // end sil function '_T027access_enforcement_noescape14readWriteInoutyyFyycfU_'
323
327
324
- // Error on noescape read + write inout of an inout.
328
+ // Error: noescape read + write inout of an inout.
325
329
func inoutReadWriteInout( x: inout Int ) {
326
330
// Around the call: [read] [static]
327
331
// Around the call: [modify] [static] // Error
@@ -345,7 +349,7 @@ func inoutReadWriteInout(x: inout Int) {
345
349
// FIXME-CHECK: end_access [[ACCESS]]
346
350
// CHECK-LABEL: } // end sil function '_T027access_enforcement_noescape19inoutReadWriteInoutySiz1x_tFyycfU_'
347
351
348
- // Error: cannout capture inout.
352
+ // Trap on boxed read + write inout.
349
353
func readBoxWriteInout( ) {
350
354
var x = 3
351
355
let c = { _ = x }
@@ -478,7 +482,7 @@ func writeWriteBox() {
478
482
// doTwo({ x = 42 }, c)
479
483
// }
480
484
481
- /// Error on noescape write + write inout.
485
+ /// Error: on noescape write + write inout.
482
486
func writeWriteInout( ) {
483
487
var x = 3
484
488
// Around the call: [modify] [dynamic]
@@ -502,7 +506,7 @@ func writeWriteInout() {
502
506
// FIXME-CHECK: end_access [[ACCESS]]
503
507
// CHECK-LABEL: } // end sil function '_T027access_enforcement_noescape15writeWriteInoutyyFyycfU_'
504
508
505
- // Error on noescape write + write inout.
509
+ // Error: on noescape write + write inout.
506
510
func inoutWriteWriteInout( x: inout Int ) {
507
511
// Around the call: [modify] [static]
508
512
// Around the call: [modify] [static] // Error
0 commit comments