File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -2495,6 +2495,41 @@ public func addressOnlyGenericBorrowingConsumeGrandField<T>(_ x: borrowing Addre
2495
2495
let _ = x. moveOnly. k // expected-note {{consumed here}}
2496
2496
}
2497
2497
2498
+ public func addressOnlyGenericLetAccessFieldTest< T> ( _ x: consuming AddressOnlyGeneric < T > ) {
2499
+ let x2 = x
2500
+
2501
+ let _ = x2. moveOnly
2502
+ }
2503
+
2504
+ public func addressOnlyGenericLetAccessFieldTest2< T> ( _ x: consuming AddressOnlyGeneric < T > ) {
2505
+ let x2 = x // expected-error {{'x2' consumed more than once}}
2506
+
2507
+ let _ = x2. moveOnly // expected-note {{consumed here}}
2508
+ let _ = x2. moveOnly // expected-note {{consumed again here}}
2509
+ }
2510
+
2511
+ public func addressOnlyGenericLetAccessFieldTest2a< T> ( _ x: consuming AddressOnlyGeneric < T > ) {
2512
+ let x2 = x // expected-error {{'x2' consumed more than once}}
2513
+
2514
+ let _ = x2. moveOnly // expected-note {{consumed here}}
2515
+ let _ = x2. moveOnly. k // expected-note {{consumed again here}}
2516
+ }
2517
+
2518
+ public func addressOnlyGenericLetAccessFieldTest2b< T> ( _ x: consuming AddressOnlyGeneric < T > ) {
2519
+ let x2 = x // expected-error {{'x2' consumed more than once}}
2520
+
2521
+ let _ = x2. moveOnly // expected-note {{consumed here}}
2522
+ let _ = x2. copyable
2523
+ let _ = x2. moveOnly. k // expected-note {{consumed again here}}
2524
+ }
2525
+
2526
+ public func addressOnlyGenericLetAccessFieldTest3< T> ( _ x: consuming AddressOnlyGeneric < T > ) {
2527
+ let x2 = x
2528
+
2529
+ let _ = x2. moveOnly
2530
+ let _ = x2. copyable
2531
+ }
2532
+
2498
2533
extension AddressOnlyGeneric {
2499
2534
func testNoUseSelf( ) { // expected-error {{'self' is borrowed and cannot be consumed}}
2500
2535
let x = self // expected-note {{consumed here}}
You can’t perform that action at this time.
0 commit comments