@@ -1741,21 +1741,21 @@ public func enumAssignToVar5Arg2(_ x2: inout EnumTy) { // expected-error {{missi
1741
1741
public func enumPatternMatchIfLet1( ) {
1742
1742
var x2 = EnumTy . klass ( Klass ( ) ) // expected-error {{'x2' consumed more than once}}
1743
1743
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}}
1745
1745
borrowVal ( x)
1746
1746
}
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}}
1748
1748
borrowVal ( x)
1749
1749
}
1750
1750
}
1751
1751
1752
1752
public func enumPatternMatchIfLet1Arg( _ x2: inout EnumTy ) {
1753
1753
// expected-error @-1 {{missing reinitialization of inout parameter 'x2' after consume}}
1754
1754
// 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}}
1756
1756
borrowVal ( x)
1757
1757
}
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}}
1759
1759
// expected-note @-1 {{consumed again here}}
1760
1760
borrowVal ( x)
1761
1761
}
@@ -1765,15 +1765,15 @@ public func enumPatternMatchIfLet2() {
1765
1765
var x2 = EnumTy . klass ( Klass ( ) ) // expected-error {{'x2' consumed in a loop}}
1766
1766
x2 = EnumTy . klass ( Klass ( ) )
1767
1767
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}}
1769
1769
borrowVal ( x)
1770
1770
}
1771
1771
}
1772
1772
}
1773
1773
1774
1774
public func enumPatternMatchIfLet2Arg( _ x2: inout EnumTy ) { // expected-error {{missing reinitialization of inout parameter 'x2' after consume}}
1775
1775
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}}
1777
1777
borrowVal ( x)
1778
1778
}
1779
1779
}
@@ -1782,7 +1782,7 @@ public func enumPatternMatchIfLet2Arg(_ x2: inout EnumTy) { // expected-error {{
1782
1782
public func enumPatternMatchSwitch1( ) {
1783
1783
var x2 = EnumTy . klass ( Klass ( ) ) // expected-error {{'x2' used after consume}}
1784
1784
x2 = EnumTy . klass ( Klass ( ) )
1785
- switch x2 { // expected-note {{consumed here}}
1785
+ switch consume x2 { // expected-note {{consumed here}}
1786
1786
case let EnumTy . klass( k) :
1787
1787
borrowVal ( k)
1788
1788
borrowVal ( x2) // expected-note {{used here}}
@@ -1792,7 +1792,7 @@ public func enumPatternMatchSwitch1() {
1792
1792
}
1793
1793
1794
1794
public 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}}
1796
1796
case let EnumTy . klass( k) :
1797
1797
borrowVal ( k)
1798
1798
borrowVal ( x2)
@@ -1804,7 +1804,7 @@ public func enumPatternMatchSwitch1Arg(_ x2: inout EnumTy) { // expected-error {
1804
1804
public func enumPatternMatchSwitch2( ) {
1805
1805
var x2 = EnumTy . klass ( Klass ( ) )
1806
1806
x2 = EnumTy . klass ( Klass ( ) )
1807
- switch x2 {
1807
+ switch consume x2 {
1808
1808
case let EnumTy . klass( k) :
1809
1809
borrowVal ( k)
1810
1810
case . int:
@@ -1813,7 +1813,7 @@ public func enumPatternMatchSwitch2() {
1813
1813
}
1814
1814
1815
1815
public 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}}
1817
1817
case let EnumTy . klass( k) :
1818
1818
borrowVal ( k)
1819
1819
case . int:
@@ -1825,7 +1825,7 @@ public func enumPatternMatchSwitch2Arg(_ x2: inout EnumTy) { // expected-error {
1825
1825
public func enumPatternMatchSwitch2WhereClause( ) {
1826
1826
var x2 = EnumTy . klass ( Klass ( ) ) // expected-error {{'x2' used after consume}}
1827
1827
x2 = EnumTy . klass ( Klass ( ) )
1828
- switch x2 { // expected-note {{consumed here}}
1828
+ switch consume x2 { // expected-note {{consumed here}}
1829
1829
case let EnumTy . klass( k)
1830
1830
where x2. doSomething ( ) : // expected-note {{used here}}
1831
1831
borrowVal ( k)
@@ -1837,7 +1837,7 @@ public func enumPatternMatchSwitch2WhereClause() {
1837
1837
}
1838
1838
1839
1839
public 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}}
1841
1841
case let EnumTy . klass( k)
1842
1842
where x2. doSomething ( ) :
1843
1843
borrowVal ( k)
@@ -1851,7 +1851,7 @@ public func enumPatternMatchSwitch2WhereClauseArg(_ x2: inout EnumTy) { // expec
1851
1851
public func enumPatternMatchSwitch2WhereClause2( ) {
1852
1852
var x2 = EnumTy . klass ( Klass ( ) )
1853
1853
x2 = EnumTy . klass ( Klass ( ) )
1854
- switch x2 {
1854
+ switch consume x2 {
1855
1855
case let EnumTy . klass( k)
1856
1856
where boolValue:
1857
1857
borrowVal ( k)
@@ -1863,7 +1863,7 @@ public func enumPatternMatchSwitch2WhereClause2() {
1863
1863
}
1864
1864
1865
1865
public 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}}
1867
1867
case let EnumTy . klass( k)
1868
1868
where boolValue:
1869
1869
borrowVal ( k)
@@ -3968,7 +3968,7 @@ func fieldSensitiveTestReinitFieldMultiBlock4() {
3968
3968
func fieldSensitiveTestReinitEnumMultiBlock( ) {
3969
3969
var e = NonTrivialEnum . first // expected-error {{'e' used after consume}}
3970
3970
e = NonTrivialEnum . second ( Klass ( ) )
3971
- switch e { // expected-note {{consumed here}}
3971
+ switch consume e { // expected-note {{consumed here}}
3972
3972
case . second:
3973
3973
e = NonTrivialEnum . third ( NonTrivialStruct ( ) )
3974
3974
default :
@@ -3980,7 +3980,7 @@ func fieldSensitiveTestReinitEnumMultiBlock() {
3980
3980
func fieldSensitiveTestReinitEnumMultiBlock1( ) {
3981
3981
var e = NonTrivialEnum . first
3982
3982
e = NonTrivialEnum . second ( Klass ( ) )
3983
- switch e {
3983
+ switch consume e {
3984
3984
case . second:
3985
3985
e = NonTrivialEnum . third ( NonTrivialStruct ( ) )
3986
3986
default :
@@ -3993,7 +3993,7 @@ func fieldSensitiveTestReinitEnumMultiBlock2() {
3993
3993
var e = NonTrivialEnum . first
3994
3994
e = NonTrivialEnum . second ( Klass ( ) )
3995
3995
if boolValue {
3996
- switch e {
3996
+ switch consume e {
3997
3997
case . second:
3998
3998
e = NonTrivialEnum . third ( NonTrivialStruct ( ) )
3999
3999
default :
@@ -4398,54 +4398,54 @@ func borrow(_ x: borrowing MyEnum) {}
4398
4398
4399
4399
func testMyEnum( ) {
4400
4400
func test1( _ x: consuming MyEnum ) {
4401
- if case let . first( y) = x {
4401
+ if case let . first( y) = consume x {
4402
4402
_ = y
4403
4403
}
4404
4404
}
4405
4405
4406
4406
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}}
4408
4408
_ = consume x // expected-note {{consumed again here}}
4409
4409
_ = y
4410
4410
}
4411
4411
}
4412
4412
4413
4413
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}}
4415
4415
_ = y
4416
4416
}
4417
4417
_ = consume x // expected-note {{consumed again here}}
4418
4418
}
4419
4419
4420
4420
func test2( _ x: consuming MyEnum ) {
4421
- if case let . third( . first( y) ) = x {
4421
+ if case let . third( . first( y) ) = consume x {
4422
4422
_ = y
4423
4423
}
4424
4424
}
4425
4425
4426
4426
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}}
4428
4428
_ = consume x // expected-note {{consumed again here}}
4429
4429
_ = y
4430
4430
}
4431
4431
}
4432
4432
4433
4433
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}}
4435
4435
_ = y
4436
4436
}
4437
4437
_ = consume x // expected-note {{consumed again here}}
4438
4438
}
4439
4439
4440
4440
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}}
4442
4442
_ = y
4443
4443
}
4444
4444
borrow ( x) // expected-note {{used here}}
4445
4445
}
4446
4446
4447
4447
func test3( _ x: consuming MyEnum ) {
4448
- switch x {
4448
+ switch consume x {
4449
4449
case let . first( y) :
4450
4450
_ = y
4451
4451
break
@@ -4455,7 +4455,7 @@ func testMyEnum() {
4455
4455
}
4456
4456
4457
4457
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}}
4459
4459
case let . first( y) :
4460
4460
_ = y
4461
4461
break
@@ -4466,7 +4466,7 @@ func testMyEnum() {
4466
4466
}
4467
4467
4468
4468
func test4( _ x: consuming MyEnum ) {
4469
- switch x {
4469
+ switch consume x {
4470
4470
case let . third( . first( y) ) :
4471
4471
_ = y
4472
4472
break
@@ -4476,7 +4476,7 @@ func testMyEnum() {
4476
4476
}
4477
4477
4478
4478
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}}
4480
4480
case let . third( . first( y) ) :
4481
4481
_ = y
4482
4482
break
0 commit comments