Skip to content

Commit 29bdb8e

Browse files
committed
---
yaml --- r: 346975 b: refs/heads/master c: 641cbd0 h: refs/heads/master i: 346973: 3525c01 346971: cf18196 346967: 1a22c8a 346959: efe58e6 346943: 540dfee
1 parent c009b0f commit 29bdb8e

File tree

3 files changed

+44
-5
lines changed

3 files changed

+44
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: face8c35c947f83735e61dd256968d686aa7fbd6
2+
refs/heads/master: 641cbd0a5ec9bef4cc8afec7eae36ed797d5f799
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/test/Interpreter/switch.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,4 +222,19 @@ SwitchTestSuite.test("TupleUnforwarding") {
222222
}
223223
}
224224

225+
protocol P {}
226+
227+
SwitchTestSuite.test("Protocol Conformance Check Leaks") {
228+
do {
229+
let x = LifetimeTracked(0)
230+
let y = LifetimeTracked(1)
231+
switch (x, y) {
232+
case (is P, is P):
233+
break
234+
default:
235+
break
236+
}
237+
}
238+
}
239+
225240
runAllTests()

trunk/test/SILGen/switch.swift

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ func test_isa_1(p: P) {
310310
a()
311311
// CHECK: function_ref @$s6switch1ayyF
312312
// CHECK: br [[CONT:bb[0-9]+]]
313-
313+
314314
// CHECK: [[IS_NOT_X]]:
315315
// CHECK: checked_cast_addr_br copy_on_success P in [[P]] : $*P to Y in {{%.*}} : $*Y, [[IS_Y:bb[0-9]+]], [[IS_NOT_Y:bb[0-9]+]]
316316

@@ -524,7 +524,7 @@ func test_isa_class_2(x: B) -> AnyObject {
524524
// CHECK: [[NO_CASE1]]:
525525
// CHECK: destroy_value [[CAST_D1_COPY]]
526526
// CHECK: br [[NEXT_CASE:bb5]]
527-
527+
528528
// CHECK: [[IS_NOT_D1]]([[NOCAST_D1:%.*]] : @guaranteed $B):
529529
// CHECK: end_borrow [[NOCAST_D1]]
530530
// CHECK: br [[NEXT_CASE]]
@@ -1020,7 +1020,7 @@ func testOptionalEnumMixWithNil(_ a : Int?) -> Int {
10201020
// CHECK-LABEL: sil hidden [ossa] @$s6switch43testMultiPatternsWithOuterScopeSameNamedVar4base6filterySiSg_AEtF
10211021
func testMultiPatternsWithOuterScopeSameNamedVar(base: Int?, filter: Int?) {
10221022
switch(base, filter) {
1023-
1023+
10241024
case (.some(let base), .some(let filter)):
10251025
// CHECK: bb2(%10 : $Int):
10261026
// CHECK-NEXT: debug_value %8 : $Int, let, name "base"
@@ -1034,7 +1034,7 @@ func testMultiPatternsWithOuterScopeSameNamedVar(base: Int?, filter: Int?) {
10341034
// CHECK: bb5([[OTHER_BASE:%.*]] : $Int)
10351035
// CHECK-NEXT: debug_value [[OTHER_BASE]] : $Int, let, name "base"
10361036
// CHECK-NEXT: br bb6([[OTHER_BASE]] : $Int)
1037-
1037+
10381038
// CHECK: bb6([[ARG:%.*]] : $Int):
10391039
print("single: \(base)")
10401040
default:
@@ -1261,3 +1261,27 @@ func partial_address_only_tuple_dispatch_with_fail_case(_ name: Klass, _ value:
12611261
break
12621262
}
12631263
}
1264+
1265+
// This was crashing the ownership verifier at some point and was reported in
1266+
// SR-6664. Just make sure that we still pass the ownership verifier.
1267+
1268+
// `indirect` is necessary; generic parameter is necessary.
1269+
indirect enum SR6664_Base<Element> {
1270+
// Tuple associated value is necessary; one element must be a function,
1271+
// the other must be a non-function using the generic parameter.
1272+
// (The original associated value was `(where: (Element) -> Bool, of: Element?)`,
1273+
// to give you an idea of the variety of types.)
1274+
case index((Int) -> Void, Element)
1275+
1276+
// Function can be in an extension or not. Can have a return value or not. Can
1277+
// have a parameter or not. Can be generic or not.
1278+
func relative() {
1279+
switch self {
1280+
// Matching the case is necessary. You can capture or ignore the associated
1281+
// values.
1282+
case .index:
1283+
// Body doesn't matter.
1284+
break
1285+
}
1286+
}
1287+
}

0 commit comments

Comments
 (0)