Skip to content

Commit 10443d3

Browse files
committed
[move-only] Add a test that shows the previous commit allows consume on var without errors to work.
I found that in the given case, an extra allocation was being emitted causing us to in the success case to have an extra copy. In the previous commit, as part of updating the codegen for consume, I also ensured that we wouldn't have that extra allocation any more by handling the lvalue directly. rdar://109222496 (cherry picked from commit 2a07d76)
1 parent 12e7b83 commit 10443d3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

test/SILOptimizer/moveonly_addresschecker_diagnostics.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3749,6 +3749,13 @@ func moveOperatorTest2(_ k: consuming Klass) {
37493749
let _ = k3
37503750
}
37513751

3752+
// No diagnostics here.
3753+
func moveOperatorTestSuccess() {
3754+
var k = Klass()
3755+
k = Klass()
3756+
let _ = consume k
3757+
}
3758+
37523759
/////////////////////////////////////////
37533760
// Black hole initialization test case//
37543761
/////////////////////////////////////////

0 commit comments

Comments
 (0)