Skip to content

Commit 7789b72

Browse files
committed
[Test] Adapted test to different borrow scopes.
Borrow scopes were moved when lexical borrow scopes were no longer emitted for owned arguments. Now, they are emitted when guaranteed values are needed. Fixing these diagnostics will be tracked separately. The same issue is already visible elsewhere in this test file, e.g. in castTestSwitch1, castTestSwitch2, and castTestSwitchInLoop.
1 parent a3fa246 commit 7789b72

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

test/SILOptimizer/move_function_kills_copyable_values.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,13 @@ public func patternMatchSwitchLet2(_ x: __owned (Klass?, Klass?)?) {
232232

233233
public func patternMatchSwitchLet3(_ x: __owned (Klass?, Klass?)?) { // expected-error {{'x' used after being moved}}
234234
let _ = _move x // expected-note {{move here}}
235-
switch x { // expected-note {{use here}}
235+
switch x {
236236
case .some((.some(_), .some(let z))): // expected-error {{'z' used after being moved}}
237237
let _ = _move z // expected-note {{move here}}
238238
nonConsumingUse(z) // expected-note {{use here}}
239239
default:
240240
break
241-
}
241+
} // expected-note {{use here}} expected-note {{use here}}
242242
}
243243

244244
////////////////
@@ -296,31 +296,31 @@ public func castTest2(_ x: __owned Klass) -> SubKlass1? { // expected-error {{'x
296296
public func castTestSwitch1(_ x : __owned Klass) { // expected-error {{'x' used after being moved}}
297297
let _ = _move x // expected-note {{move here}}
298298
switch x {
299-
case let k as SubKlass1: // expected-note {{use here}}
299+
case let k as SubKlass1:
300300
print(k)
301301
default:
302302
print("Nope")
303-
}
303+
} // expected-note {{use here}} expected-note {{use here}}
304304
}
305305

306306
public func castTestSwitch2(_ x : __owned Klass) { // expected-error {{'x' used after being moved}}
307307
let _ = _move x // expected-note {{move here}}
308308
switch x {
309309
case let k as SubKlass1:
310310
print(k)
311-
case let k as SubKlass2: // expected-note {{use here}}
311+
case let k as SubKlass2:
312312
print(k)
313313
default:
314314
print("Nope")
315-
}
315+
} // expected-note {{use here}} expected-note {{use here}} expected-note {{use here}}
316316
}
317317

318318
public func castTestSwitchInLoop(_ x : __owned Klass) { // expected-error {{'x' used after being moved}}
319319
let _ = _move x // expected-note {{move here}}
320320

321321
for _ in 0..<1024 {
322322
switch x {
323-
case let k as SubKlass1: // expected-note {{use here}}
323+
case let k as SubKlass1:
324324
print(k)
325325
default:
326326
print("Nope")

0 commit comments

Comments
 (0)