File tree Expand file tree Collapse file tree 1 file changed +29
-1
lines changed Expand file tree Collapse file tree 1 file changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ Tests.test("global destroyed once") {
45
45
do {
46
46
global = FD ( )
47
47
}
48
- expectEqual ( 0 , LifetimeTracked . instances)
48
+ expectEqual ( 0 , LifetimeTracked . instances)
49
49
}
50
50
51
51
@_moveOnly
@@ -104,3 +104,31 @@ Tests.test("empty struct") {
104
104
let _ = consume e
105
105
}
106
106
}
107
+
108
+ protocol P {
109
+ var name : String { get }
110
+ }
111
+
112
+ Tests . test ( " AddressOnly " ) {
113
+ class Klass : P {
114
+ var name : String { " myName " }
115
+ }
116
+
117
+ @_moveOnly
118
+ struct S < T : P > {
119
+ var t : T
120
+ }
121
+
122
+ let e = S ( t: Klass ( ) )
123
+ expectEqual ( e. t. name, " myName " )
124
+
125
+ func testGeneric< T : P > ( _ x: borrowing S < T > ) {
126
+ expectEqual ( x. t. name, " myName " )
127
+ }
128
+ testGeneric ( e)
129
+
130
+ if e. t. name. count == 5 {
131
+ let _ = consume e
132
+ }
133
+ }
134
+
You can’t perform that action at this time.
0 commit comments