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") {
4545 do {
4646 global = FD ( )
4747 }
48- expectEqual ( 0 , LifetimeTracked . instances)
48+ expectEqual ( 0 , LifetimeTracked . instances)
4949}
5050
5151@_moveOnly
@@ -104,3 +104,31 @@ Tests.test("empty struct") {
104104 let _ = consume e
105105 }
106106}
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