File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -758,6 +758,8 @@ public struct AggStruct {
758
758
759
759
public func aggStructUseMoveOnlyWithoutEscaping( _ x: AggStruct ) {
760
760
}
761
+ public func useKlassPairWithoutConsuming( _ x: KlassPair ) {
762
+ }
761
763
public func aggStructConsume( _ x: __owned AggStruct) {
762
764
}
763
765
@@ -1020,6 +1022,36 @@ public func aggStructConsumeGrandFieldOwnedArg(_ x2: __owned AggStruct) {
1020
1022
}
1021
1023
}
1022
1024
1025
+ public func aggStructConsumeFieldNoError( _ x2: __owned AggStruct) {
1026
+ if boolValue {
1027
+ classConsume ( x2. pair. lhs)
1028
+ } else {
1029
+ classConsume ( x2. pair. rhs)
1030
+ }
1031
+ classConsume ( x2. lhs)
1032
+ }
1033
+
1034
+ public func aggStructConsumeFieldError( _ x2: __owned AggStruct) {
1035
+ // expected-error @-1 {{'x2' has a move only field that was consumed before later uses}}
1036
+ if boolValue {
1037
+ classConsume ( x2. lhs)
1038
+ } else {
1039
+ classConsume ( x2. pair. rhs) // expected-note {{consuming use}}
1040
+ }
1041
+ useKlassPairWithoutConsuming ( x2. pair) // expected-note {{boundary use here}}
1042
+ }
1043
+
1044
+ public func aggStructConsumeFieldError2( _ x2: __owned AggStruct) {
1045
+ // expected-error @-1 {{'x2' consumed more than once}}
1046
+ if boolValue {
1047
+ classConsume ( x2. lhs) // expected-note {{consuming use}}
1048
+ } else {
1049
+ classConsume ( x2. pair. rhs) // expected-note {{consuming use}}
1050
+ }
1051
+ aggStructConsume ( x2) // expected-note {{consuming use}}
1052
+ }
1053
+
1054
+
1023
1055
//////////////////////////////
1024
1056
// Aggregate Generic Struct //
1025
1057
//////////////////////////////
You can’t perform that action at this time.
0 commit comments