Skip to content

Commit

Permalink
Test: update for BorrowingSwitch enablement
Browse files Browse the repository at this point in the history
(cherry picked from commit 89ff3fe)
  • Loading branch information
kavon committed May 13, 2024
1 parent 0c2c988 commit 99d417b
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions test/Sema/moveonly_enum.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ enum Foo3 {
}

func test_switch(x: consuming Foo3) {
switch x { // expected-error{{noncopyable binding being pattern-matched must have the 'consume' operator applied}} {{12-12=consume }}
switch x {
default:
break
}
Expand All @@ -32,7 +32,7 @@ func test_switch(x: consuming Foo3) {
break
}

switch (x) { // expected-error{{noncopyable binding being pattern-matched must have the 'consume' operator applied}} {{13-13=consume }}
switch (x) {
default:
break
}
Expand All @@ -43,7 +43,7 @@ func test_switch(x: consuming Foo3) {
}

let _: () -> () = {
switch x { // expected-error{{noncopyable binding being pattern-matched must have the 'consume' operator applied}} {{16-16=consume }}
switch x {
default:
break
}
Expand All @@ -57,7 +57,7 @@ func test_switch(x: consuming Foo3) {
}

let _: () -> () = {
switch (x) { // expected-error{{noncopyable binding being pattern-matched must have the 'consume' operator applied}} {{17-17=consume }}
switch (x) {
default:
break
}
Expand All @@ -72,19 +72,19 @@ func test_switch(x: consuming Foo3) {
}

func test_if_case(x: consuming Foo3) {
if case .bar(let y) = x { _ = y } // expected-error{{noncopyable binding being pattern-matched must have the 'consume' operator applied}} {{27-27=consume }}
if case .bar(let y) = x { _ = y }

guard case .bar(let y) = x else { return } // expected-error{{noncopyable binding being pattern-matched must have the 'consume' operator applied}} {{30-30=consume }}
guard case .bar(let y) = x else { return }
_ = y

if case .bar(let z) = consume x { _ = z }

guard case .bar(let z) = consume x else { return }
_ = z

if case .bar(let a) = (x) { _ = a } // expected-error{{noncopyable binding being pattern-matched must have the 'consume' operator applied}} {{28-28=consume }}
if case .bar(let a) = (x) { _ = a }

guard case .bar(let a) = (x) else { return } // expected-error{{noncopyable binding being pattern-matched must have the 'consume' operator applied}} {{31-31=consume }}
guard case .bar(let a) = (x) else { return }
_ = a

if case .bar(let b) = (consume x) { _ = b }
Expand All @@ -93,11 +93,11 @@ func test_if_case(x: consuming Foo3) {
_ = b

let _: () -> () = {
if case .bar(let y) = x { _ = y } // expected-error{{noncopyable binding being pattern-matched must have the 'consume' operator applied}} {{31-31=consume }}
if case .bar(let y) = x { _ = y }
}

let _: () -> () = {
guard case .bar(let y) = x else { return } // expected-error{{noncopyable binding being pattern-matched must have the 'consume' operator applied}} {{34-34=consume }}
guard case .bar(let y) = x else { return }
_ = y
}

Expand All @@ -111,11 +111,11 @@ func test_if_case(x: consuming Foo3) {
}

let _: () -> () = {
if case .bar(let a) = (x) { _ = a } // expected-error{{noncopyable binding being pattern-matched must have the 'consume' operator applied}} {{32-32=consume }}
if case .bar(let a) = (x) { _ = a }
}

let _: () -> () = {
guard case .bar(let a) = (x) else { return } // expected-error{{noncopyable binding being pattern-matched must have the 'consume' operator applied}} {{35-35=consume }}
guard case .bar(let a) = (x) else { return }
_ = a
}

Expand All @@ -130,7 +130,7 @@ func test_if_case(x: consuming Foo3) {
}

func test_switch_b(x: __owned Foo3) {
switch x { // expected-error{{noncopyable binding being pattern-matched must have the 'consume' operator applied}} {{12-12=consume }}
switch x {
default:
break
}
Expand All @@ -140,7 +140,7 @@ func test_switch_b(x: __owned Foo3) {
break
}

switch (x) { // expected-error{{noncopyable binding being pattern-matched must have the 'consume' operator applied}} {{13-13=consume }}
switch (x) {
default:
break
}
Expand All @@ -151,7 +151,7 @@ func test_switch_b(x: __owned Foo3) {
}

let _: () -> () = {
switch x { // expected-error{{noncopyable binding being pattern-matched must have the 'consume' operator applied}} {{16-16=consume }}
switch x {
default:
break
}
Expand All @@ -165,7 +165,7 @@ func test_switch_b(x: __owned Foo3) {
}

let _: () -> () = {
switch (x) { // expected-error{{noncopyable binding being pattern-matched must have the 'consume' operator applied}} {{17-17=consume }}
switch (x) {
default:
break
}
Expand All @@ -180,19 +180,19 @@ func test_switch_b(x: __owned Foo3) {
}

func test_if_case_b(x: __owned Foo3) {
if case .bar(let y) = x { _ = y } // expected-error{{noncopyable binding being pattern-matched must have the 'consume' operator applied}} {{27-27=consume }}
if case .bar(let y) = x { _ = y }

guard case .bar(let y) = x else { return } // expected-error{{noncopyable binding being pattern-matched must have the 'consume' operator applied}} {{30-30=consume }}
guard case .bar(let y) = x else { return }
_ = y

if case .bar(let z) = consume x { _ = z }

guard case .bar(let z) = consume x else { return }
_ = z

if case .bar(let a) = (x) { _ = a } // expected-error{{noncopyable binding being pattern-matched must have the 'consume' operator applied}} {{28-28=consume }}
if case .bar(let a) = (x) { _ = a }

guard case .bar(let a) = (x) else { return } // expected-error{{noncopyable binding being pattern-matched must have the 'consume' operator applied}} {{31-31=consume }}
guard case .bar(let a) = (x) else { return }
_ = a

if case .bar(let b) = (consume x) { _ = b }
Expand All @@ -201,11 +201,11 @@ func test_if_case_b(x: __owned Foo3) {
_ = b

let _: () -> () = {
if case .bar(let y) = x { _ = y } // expected-error{{noncopyable binding being pattern-matched must have the 'consume' operator applied}} {{31-31=consume }}
if case .bar(let y) = x { _ = y }
}

let _: () -> () = {
guard case .bar(let y) = x else { return } // expected-error{{noncopyable binding being pattern-matched must have the 'consume' operator applied}} {{34-34=consume }}
guard case .bar(let y) = x else { return }
_ = y
}

Expand All @@ -219,11 +219,11 @@ func test_if_case_b(x: __owned Foo3) {
}

let _: () -> () = {
if case .bar(let a) = (x) { _ = a } // expected-error{{noncopyable binding being pattern-matched must have the 'consume' operator applied}} {{32-32=consume }}
if case .bar(let a) = (x) { _ = a }
}

let _: () -> () = {
guard case .bar(let a) = (x) else { return } // expected-error{{noncopyable binding being pattern-matched must have the 'consume' operator applied}} {{35-35=consume }}
guard case .bar(let a) = (x) else { return }
_ = a
}

Expand Down

0 comments on commit 99d417b

Please sign in to comment.