|
1 | 1 | // RUN: %empty-directory(%t)
|
2 |
| - // RUN: %target-swift-emit-module-interface(%t.swiftinterface) %s -module-name Test -enable-experimental-feature NonescapableTypes |
3 |
| - // RUN: %target-swift-typecheck-module-from-interface(%t.swiftinterface) -module-name Test |
4 |
| - // RUN: %FileCheck %s < %t.swiftinterface |
| 2 | +// RUN: %target-swift-emit-module-interface(%t.swiftinterface) %s -module-name Test -enable-experimental-feature NonescapableTypes |
| 3 | +// RUN: %target-swift-typecheck-module-from-interface(%t.swiftinterface) -module-name Test |
| 4 | +// RUN: %FileCheck %s < %t.swiftinterface |
5 | 5 |
|
6 |
| - // CHECK: #if compiler(>=5.3) && $NonescapableTypes |
7 |
| - // CHECK: public protocol P : ~Escapable { |
8 |
| - // CHECK: associatedtype A |
9 |
| - // CHECK: } |
10 |
| - // CHECK: #else |
11 |
| - // CHECK: public protocol P { |
12 |
| - // CHECK: associatedtype A |
13 |
| - // CHECK: } |
14 |
| - // CHECK: #endif |
15 |
| - public protocol P: ~Escapable { |
16 |
| - associatedtype A |
17 |
| - } |
| 6 | +// CHECK: #if compiler(>=5.3) && $NonescapableTypes |
| 7 | +// CHECK: public protocol P : ~Escapable { |
| 8 | +// CHECK: associatedtype A |
| 9 | +// CHECK: } |
| 10 | +// CHECK: #else |
| 11 | +// CHECK: public protocol P { |
| 12 | +// CHECK: associatedtype A |
| 13 | +// CHECK: } |
| 14 | +// CHECK: #endif |
| 15 | +public protocol P: ~Escapable { |
| 16 | + associatedtype A |
| 17 | +} |
18 | 18 |
|
19 |
| - // CHECK: #if compiler(>=5.3) && $NonescapableTypes |
20 |
| - // CHECK: public struct X<T> : ~Swift.Escapable where T : ~Escapable { |
21 |
| - // CHECK: } |
22 |
| - // CHECK: #else |
23 |
| - // CHECK: public struct X<T> { |
24 |
| - // CHECK: } |
25 |
| - // CHECK: #endif |
26 |
| - public struct X<T: ~Escapable>: ~Escapable { } |
| 19 | +// CHECK: #if compiler(>=5.3) && $NonescapableTypes |
| 20 | +// CHECK: public struct X<T> : ~Swift.Escapable where T : ~Escapable { |
| 21 | +// CHECK: } |
| 22 | +// CHECK: #else |
| 23 | +// CHECK: public struct X<T> { |
| 24 | +// CHECK: } |
| 25 | +// CHECK: #endif |
| 26 | +public struct X<T: ~Escapable>: ~Escapable { } |
27 | 27 |
|
28 |
| - // CHECK: #if compiler(>=5.3) && $NonescapableTypes |
29 |
| - // CHECK: extension Test.X { |
30 |
| - // CHECK-NEXT: func f() |
31 |
| - // CHECK: } |
32 |
| - // CHECK: #else |
33 |
| - // CHECK: extension Test.X { |
34 |
| - // CHECK-NEXT: func f() |
35 |
| - // CHECK: } |
36 |
| - extension X where T: Escapable { |
37 |
| - public func f() { } |
38 |
| - } |
| 28 | +// CHECK: #if compiler(>=5.3) && $NonescapableTypes |
| 29 | +// CHECK: extension Test.X { |
| 30 | +// CHECK-NEXT: func f() |
| 31 | +// CHECK: } |
| 32 | +// CHECK: #else |
| 33 | +// CHECK: extension Test.X { |
| 34 | +// CHECK-NEXT: func f() |
| 35 | +// CHECK: } |
| 36 | +extension X where T: Escapable { |
| 37 | + public func f() { } |
| 38 | +} |
39 | 39 |
|
40 |
| - // CHECK: #if compiler(>=5.3) && $NonescapableTypes |
41 |
| - // CHECK: extension Test.X where T : ~Escapable { |
42 |
| - // CHECK: public func g(other: borrowing T) |
43 |
| - // CHECK: } |
44 |
| - // CHECK: #else |
45 |
| - // CHECK: extension Test.X { |
46 |
| - // CHECK: public func g(other: borrowing T) |
47 |
| - // CHECK: } |
48 |
| - // CHECK: #endif |
49 |
| - extension X where T: ~Escapable { |
50 |
| - public func g(other: borrowing T) { } |
51 |
| - } |
| 40 | +// CHECK: #if compiler(>=5.3) && $NonescapableTypes |
| 41 | +// CHECK: extension Test.X where T : ~Escapable { |
| 42 | +// CHECK: public func g(other: borrowing T) |
| 43 | +// CHECK: } |
| 44 | +// CHECK: #else |
| 45 | +// CHECK: extension Test.X { |
| 46 | +// CHECK: public func g(other: borrowing T) |
| 47 | +// CHECK: } |
| 48 | +// CHECK: #endif |
| 49 | +extension X where T: ~Escapable { |
| 50 | + public func g(other: borrowing T) { } |
| 51 | +} |
52 | 52 |
|
53 |
| - // CHECK: #if compiler(>=5.3) && $NonescapableTypes |
54 |
| - // CHECK: public enum Y<T> : ~Swift.Escapable where T : ~Escapable { |
55 |
| - // CHECK: case none |
56 |
| - // CHECK: case some(T) |
57 |
| - // CHECK: } |
58 |
| - // CHECK: #else |
59 |
| - // CHECK: public enum Y<T> { |
60 |
| - // CHECK: case none |
61 |
| - // CHECK: case some(T) |
62 |
| - // CHECK: } |
63 |
| - public enum Y<T: ~Escapable>: ~Escapable { |
64 |
| - case none |
65 |
| - case some(T) |
66 |
| - } |
| 53 | +// CHECK: #if compiler(>=5.3) && $NonescapableTypes |
| 54 | +// CHECK: public enum Y<T> : ~Swift.Escapable where T : ~Escapable { |
| 55 | +// CHECK: case none |
| 56 | +// CHECK: case some(T) |
| 57 | +// CHECK: } |
| 58 | +// CHECK: #else |
| 59 | +// CHECK: public enum Y<T> { |
| 60 | +// CHECK: case none |
| 61 | +// CHECK: case some(T) |
| 62 | +// CHECK: } |
| 63 | +public enum Y<T: ~Escapable>: ~Escapable { |
| 64 | + case none |
| 65 | + case some(T) |
| 66 | +} |
67 | 67 |
|
68 |
| - extension Y: Escapable where T: Escapable { } |
| 68 | +extension Y: Escapable where T: Escapable { } |
69 | 69 |
|
70 |
| - // CHECK: #if compiler(>=5.3) && $NonescapableTypes |
71 |
| - // CHECK: @lifetime(y) |
72 |
| - // CHECK: public func derive<T>(_ y: Test.Y<T>) -> Test.Y<T> where T : ~Escapable |
73 |
| - // CHECK: #else |
74 |
| - // CHECK: public func derive<T>(_ y: Test.Y<T>) -> Test.Y<T> |
75 |
| - // CHECK: #endif |
76 |
| - @lifetime(y) |
77 |
| - public func derive<T : ~Escapable>(_ y: Y<T>) -> Y<T> { |
78 |
| - y |
79 |
| - } |
| 70 | +// CHECK: #if compiler(>=5.3) && $NonescapableTypes |
| 71 | +// CHECK: @lifetime(y) |
| 72 | +// CHECK: public func derive<T>(_ y: Test.Y<T>) -> Test.Y<T> where T : ~Escapable |
| 73 | +// CHECK: #else |
| 74 | +// CHECK: public func derive<T>(_ y: Test.Y<T>) -> Test.Y<T> |
| 75 | +// CHECK: #endif |
| 76 | +@lifetime(y) |
| 77 | +public func derive<T : ~Escapable>(_ y: Y<T>) -> Y<T> { |
| 78 | + y |
| 79 | +} |
80 | 80 |
|
81 |
| - // CHECK: #if compiler(>=5.3) && $NonescapableTypes |
82 |
| - // CHECK: public func derive<T>(_ x: Test.X<T>) -> dependsOn(x) Test.X<T> where T : ~Escapable |
83 |
| - // CHECK: #else |
84 |
| - // CHECK: public func derive<T>(_ x: Test.X<T>) -> Test.X<T> |
85 |
| - // CHECK: #endif |
86 |
| - public func derive<T : ~Escapable>(_ x: X<T>) -> dependsOn(x) X<T> { |
87 |
| - x |
88 |
| - } |
| 81 | +// CHECK: #if compiler(>=5.3) && $NonescapableTypes |
| 82 | +// CHECK: public func derive<T>(_ x: Test.X<T>) -> dependsOn(x) Test.X<T> where T : ~Escapable |
| 83 | +// CHECK: #else |
| 84 | +// CHECK: public func derive<T>(_ x: Test.X<T>) -> Test.X<T> |
| 85 | +// CHECK: #endif |
| 86 | +public func derive<T : ~Escapable>(_ x: X<T>) -> dependsOn(x) X<T> { |
| 87 | + x |
| 88 | +} |
0 commit comments