Skip to content

Commit 89f5b70

Browse files
committed
Update test to ensure that we're actually dealing with existential values
Typed throws took out the existential boxing for us, causing this test to fail. Add more explicit boxing back in so that we still test elimination of it.
1 parent 3fa07a0 commit 89f5b70

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

test/SILOptimizer/existential_box_elimination.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public struct TestError: Error {
2323

2424
@inline(never)
2525
@_optimize(none)
26-
internal func internalImplementation(somethingGood: Bool) -> Result<Int, TestError> {
26+
internal func internalImplementation(somethingGood: Bool) -> Result<Int, any Error> {
2727
return somethingGood ? .success(27) : .failure(TestError(errno:123))
2828
}
2929

@@ -32,12 +32,11 @@ public func publicWrapper(somethingGood: Bool) throws -> Int {
3232
}
3333

3434
// CHECK-LABEL: sil [noinline] @$s4test0A13WithForceCast13somethingGoodSiSb_tF
35-
// CHECK: [[F:%[0-9]+]] = function_ref @$s4test22internalImplementation13somethingGoods6ResultOySiAA9TestErrorVGSb_tF
35+
// CHECK: [[F:%[0-9]+]] = function_ref @$s4test22internalImplementation13somethingGoods6ResultOySis5Error_pGSb_tF
3636
// CHECK: apply [[F]]
3737
// CHECK: switch_enum
3838
// CHECK: bb1:
3939
// CHECK-NOT: alloc_existential_box
40-
// CHECK-NOT: apply
4140
// CHECK: } // end sil function '$s4test0A13WithForceCast13somethingGoodSiSb_tF'
4241
@inline(never)
4342
public func testWithForceCast(somethingGood: Bool) -> Int {
@@ -49,12 +48,11 @@ public func testWithForceCast(somethingGood: Bool) -> Int {
4948
}
5049

5150
// CHECK-LABEL: sil [noinline] @$s4test0A19WithMultipleCatches13somethingGoodSiSb_tF
52-
// CHECK: [[F:%[0-9]+]] = function_ref @$s4test22internalImplementation13somethingGoods6ResultOySiAA9TestErrorVGSb_tF
51+
// CHECK: [[F:%[0-9]+]] = function_ref @$s4test22internalImplementation13somethingGoods6ResultOySis5Error_pGSb_tF
5352
// CHECK: apply [[F]]
5453
// CHECK: switch_enum
5554
// CHECK: bb1:
5655
// CHECK-NOT: alloc_existential_box
57-
// CHECK-NOT: apply
5856
// CHECK: } // end sil function '$s4test0A19WithMultipleCatches13somethingGoodSiSb_tF'
5957
@inline(never)
6058
public func testWithMultipleCatches(somethingGood: Bool) -> Int {

0 commit comments

Comments
 (0)