@@ -1741,21 +1741,21 @@ public func enumAssignToVar5Arg2(_ x2: inout EnumTy) { // expected-error {{missi
17411741public func enumPatternMatchIfLet1( ) {
17421742 var x2 = EnumTy . klass ( Klass ( ) ) // expected-error {{'x2' consumed more than once}}
17431743 x2 = EnumTy . klass ( Klass ( ) )
1744- if case let EnumTy . klass( x) = x2 { // expected-note {{consumed here}}
1744+ if case let EnumTy . klass( x) = consume x2 { // expected-note {{consumed here}}
17451745 borrowVal ( x)
17461746 }
1747- if case let EnumTy . klass( x) = x2 { // expected-note {{consumed again here}}
1747+ if case let EnumTy . klass( x) = consume x2 { // expected-note {{consumed again here}}
17481748 borrowVal ( x)
17491749 }
17501750}
17511751
17521752public func enumPatternMatchIfLet1Arg( _ x2: inout EnumTy ) {
17531753 // expected-error @-1 {{missing reinitialization of inout parameter 'x2' after consume}}
17541754 // expected-error @-2 {{'x2' consumed more than once}}
1755- if case let EnumTy . klass( x) = x2 { // expected-note {{consumed here}}
1755+ if case let EnumTy . klass( x) = consume x2 { // expected-note {{consumed here}}
17561756 borrowVal ( x)
17571757 }
1758- if case let EnumTy . klass( x) = x2 { // expected-note {{consumed here}}
1758+ if case let EnumTy . klass( x) = consume x2 { // expected-note {{consumed here}}
17591759 // expected-note @-1 {{consumed again here}}
17601760 borrowVal ( x)
17611761 }
@@ -1765,15 +1765,15 @@ public func enumPatternMatchIfLet2() {
17651765 var x2 = EnumTy . klass ( Klass ( ) ) // expected-error {{'x2' consumed in a loop}}
17661766 x2 = EnumTy . klass ( Klass ( ) )
17671767 for _ in 0 ..< 1024 {
1768- if case let EnumTy . klass( x) = x2 { // expected-note {{consumed here}}
1768+ if case let EnumTy . klass( x) = consume x2 { // expected-note {{consumed here}}
17691769 borrowVal ( x)
17701770 }
17711771 }
17721772}
17731773
17741774public func enumPatternMatchIfLet2Arg( _ x2: inout EnumTy ) { // expected-error {{missing reinitialization of inout parameter 'x2' after consume}}
17751775 for _ in 0 ..< 1024 {
1776- if case let EnumTy . klass( x) = x2 { // expected-note {{consumed here}}
1776+ if case let EnumTy . klass( x) = consume x2 { // expected-note {{consumed here}}
17771777 borrowVal ( x)
17781778 }
17791779 }
@@ -1782,7 +1782,7 @@ public func enumPatternMatchIfLet2Arg(_ x2: inout EnumTy) { // expected-error {{
17821782public func enumPatternMatchSwitch1( ) {
17831783 var x2 = EnumTy . klass ( Klass ( ) ) // expected-error {{'x2' used after consume}}
17841784 x2 = EnumTy . klass ( Klass ( ) )
1785- switch x2 { // expected-note {{consumed here}}
1785+ switch consume x2 { // expected-note {{consumed here}}
17861786 case let EnumTy . klass( k) :
17871787 borrowVal ( k)
17881788 borrowVal ( x2) // expected-note {{used here}}
@@ -1792,7 +1792,7 @@ public func enumPatternMatchSwitch1() {
17921792}
17931793
17941794public func enumPatternMatchSwitch1Arg( _ x2: inout EnumTy ) { // expected-error {{missing reinitialization of inout parameter 'x2' after consume}}
1795- switch x2 { // expected-note {{consumed here}}
1795+ switch consume x2 { // expected-note {{consumed here}}
17961796 case let EnumTy . klass( k) :
17971797 borrowVal ( k)
17981798 borrowVal ( x2)
@@ -1804,7 +1804,7 @@ public func enumPatternMatchSwitch1Arg(_ x2: inout EnumTy) { // expected-error {
18041804public func enumPatternMatchSwitch2( ) {
18051805 var x2 = EnumTy . klass ( Klass ( ) )
18061806 x2 = EnumTy . klass ( Klass ( ) )
1807- switch x2 {
1807+ switch consume x2 {
18081808 case let EnumTy . klass( k) :
18091809 borrowVal ( k)
18101810 case . int:
@@ -1813,7 +1813,7 @@ public func enumPatternMatchSwitch2() {
18131813}
18141814
18151815public func enumPatternMatchSwitch2Arg( _ x2: inout EnumTy ) { // expected-error {{missing reinitialization of inout parameter 'x2' after consume}}
1816- switch x2 { // expected-note {{consumed here}}
1816+ switch consume x2 { // expected-note {{consumed here}}
18171817 case let EnumTy . klass( k) :
18181818 borrowVal ( k)
18191819 case . int:
@@ -1825,7 +1825,7 @@ public func enumPatternMatchSwitch2Arg(_ x2: inout EnumTy) { // expected-error {
18251825public func enumPatternMatchSwitch2WhereClause( ) {
18261826 var x2 = EnumTy . klass ( Klass ( ) ) // expected-error {{'x2' used after consume}}
18271827 x2 = EnumTy . klass ( Klass ( ) )
1828- switch x2 { // expected-note {{consumed here}}
1828+ switch consume x2 { // expected-note {{consumed here}}
18291829 case let EnumTy . klass( k)
18301830 where x2. doSomething ( ) : // expected-note {{used here}}
18311831 borrowVal ( k)
@@ -1837,7 +1837,7 @@ public func enumPatternMatchSwitch2WhereClause() {
18371837}
18381838
18391839public func enumPatternMatchSwitch2WhereClauseArg( _ x2: inout EnumTy ) { // expected-error {{missing reinitialization of inout parameter 'x2' after consume}}
1840- switch x2 { // expected-note {{consumed here}}
1840+ switch consume x2 { // expected-note {{consumed here}}
18411841 case let EnumTy . klass( k)
18421842 where x2. doSomething ( ) :
18431843 borrowVal ( k)
@@ -1851,7 +1851,7 @@ public func enumPatternMatchSwitch2WhereClauseArg(_ x2: inout EnumTy) { // expec
18511851public func enumPatternMatchSwitch2WhereClause2( ) {
18521852 var x2 = EnumTy . klass ( Klass ( ) )
18531853 x2 = EnumTy . klass ( Klass ( ) )
1854- switch x2 {
1854+ switch consume x2 {
18551855 case let EnumTy . klass( k)
18561856 where boolValue:
18571857 borrowVal ( k)
@@ -1863,7 +1863,7 @@ public func enumPatternMatchSwitch2WhereClause2() {
18631863}
18641864
18651865public func enumPatternMatchSwitch2WhereClause2Arg( _ x2: inout EnumTy ) { // expected-error {{missing reinitialization of inout parameter 'x2' after consume}}
1866- switch x2 { // expected-note {{consumed here}}
1866+ switch consume x2 { // expected-note {{consumed here}}
18671867 case let EnumTy . klass( k)
18681868 where boolValue:
18691869 borrowVal ( k)
@@ -3968,7 +3968,7 @@ func fieldSensitiveTestReinitFieldMultiBlock4() {
39683968func fieldSensitiveTestReinitEnumMultiBlock( ) {
39693969 var e = NonTrivialEnum . first // expected-error {{'e' used after consume}}
39703970 e = NonTrivialEnum . second ( Klass ( ) )
3971- switch e { // expected-note {{consumed here}}
3971+ switch consume e { // expected-note {{consumed here}}
39723972 case . second:
39733973 e = NonTrivialEnum . third ( NonTrivialStruct ( ) )
39743974 default :
@@ -3980,7 +3980,7 @@ func fieldSensitiveTestReinitEnumMultiBlock() {
39803980func fieldSensitiveTestReinitEnumMultiBlock1( ) {
39813981 var e = NonTrivialEnum . first
39823982 e = NonTrivialEnum . second ( Klass ( ) )
3983- switch e {
3983+ switch consume e {
39843984 case . second:
39853985 e = NonTrivialEnum . third ( NonTrivialStruct ( ) )
39863986 default :
@@ -3993,7 +3993,7 @@ func fieldSensitiveTestReinitEnumMultiBlock2() {
39933993 var e = NonTrivialEnum . first
39943994 e = NonTrivialEnum . second ( Klass ( ) )
39953995 if boolValue {
3996- switch e {
3996+ switch consume e {
39973997 case . second:
39983998 e = NonTrivialEnum . third ( NonTrivialStruct ( ) )
39993999 default :
@@ -4398,54 +4398,54 @@ func borrow(_ x: borrowing MyEnum) {}
43984398
43994399func testMyEnum( ) {
44004400 func test1( _ x: consuming MyEnum ) {
4401- if case let . first( y) = x {
4401+ if case let . first( y) = consume x {
44024402 _ = y
44034403 }
44044404 }
44054405
44064406 func test1a( _ x: consuming MyEnum ) { // expected-error {{'x' consumed more than once}}
4407- if case let . first( y) = x { // expected-note {{consumed here}}
4407+ if case let . first( y) = consume x { // expected-note {{consumed here}}
44084408 _ = consume x // expected-note {{consumed again here}}
44094409 _ = y
44104410 }
44114411 }
44124412
44134413 func test1b( _ x: consuming MyEnum ) { // expected-error {{'x' consumed more than once}}
4414- if case let . first( y) = x { // expected-note {{consumed here}}
4414+ if case let . first( y) = consume x { // expected-note {{consumed here}}
44154415 _ = y
44164416 }
44174417 _ = consume x // expected-note {{consumed again here}}
44184418 }
44194419
44204420 func test2( _ x: consuming MyEnum ) {
4421- if case let . third( . first( y) ) = x {
4421+ if case let . third( . first( y) ) = consume x {
44224422 _ = y
44234423 }
44244424 }
44254425
44264426 func test2a( _ x: consuming MyEnum ) { // expected-error {{'x' consumed more than once}}
4427- if case let . third( . first( y) ) = x { // expected-note {{consumed here}}
4427+ if case let . third( . first( y) ) = consume x { // expected-note {{consumed here}}
44284428 _ = consume x // expected-note {{consumed again here}}
44294429 _ = y
44304430 }
44314431 }
44324432
44334433 func test2b( _ x: consuming MyEnum ) { // expected-error {{'x' consumed more than once}}
4434- if case let . third( . first( y) ) = x { // expected-note {{consumed here}}
4434+ if case let . third( . first( y) ) = consume x { // expected-note {{consumed here}}
44354435 _ = y
44364436 }
44374437 _ = consume x // expected-note {{consumed again here}}
44384438 }
44394439
44404440 func test2c( _ x: consuming MyEnum ) { // expected-error {{'x' used after consume}}
4441- if case let . third( . first( y) ) = x { // expected-note {{consumed here}}
4441+ if case let . third( . first( y) ) = consume x { // expected-note {{consumed here}}
44424442 _ = y
44434443 }
44444444 borrow ( x) // expected-note {{used here}}
44454445 }
44464446
44474447 func test3( _ x: consuming MyEnum ) {
4448- switch x {
4448+ switch consume x {
44494449 case let . first( y) :
44504450 _ = y
44514451 break
@@ -4455,7 +4455,7 @@ func testMyEnum() {
44554455 }
44564456
44574457 func test3a( _ x: consuming MyEnum ) { // expected-error {{'x' consumed more than once}}
4458- switch x { // expected-note {{consumed here}}
4458+ switch consume x { // expected-note {{consumed here}}
44594459 case let . first( y) :
44604460 _ = y
44614461 break
@@ -4466,7 +4466,7 @@ func testMyEnum() {
44664466 }
44674467
44684468 func test4( _ x: consuming MyEnum ) {
4469- switch x {
4469+ switch consume x {
44704470 case let . third( . first( y) ) :
44714471 _ = y
44724472 break
@@ -4476,7 +4476,7 @@ func testMyEnum() {
44764476 }
44774477
44784478 func test4a( _ x: consuming MyEnum ) { // expected-error {{'x' consumed more than once}}
4479- switch x { // expected-note {{consumed here}}
4479+ switch consume x { // expected-note {{consumed here}}
44804480 case let . third( . first( y) ) :
44814481 _ = y
44824482 break
0 commit comments