Skip to content

Commit 6a7655e

Browse files
Suyash SrijanSuyash Srijan
authored andcommitted
[test] add SILGen test
1 parent 7356f41 commit 6a7655e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/SILGen/enum.swift

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,4 +233,23 @@ func useTrailingClosureGeneric<T>(t: T) {
233233
_ = TrailingClosureGeneric<T>.noLabel { t }
234234
_ = TrailingClosureGeneric<T>.twoElementsLabel(x: t) { t }
235235
_ = TrailingClosureGeneric<T>.twoElementsNoLabel(t) { t }
236+
}
237+
238+
enum SR7799 {
239+
case one
240+
case two
241+
}
242+
243+
// CHECK-LABEL: sil hidden [ossa] @$s4enum6sr77993baryAA6SR7799OSg_tF : $@convention(thin) (Optional<SR7799>) -> () {
244+
// CHECK: bb0(%0 : $Optional<SR7799>):
245+
// CHECK-NEXT: debug_value %0 : $Optional<SR7799>, let, name "bar", argno 1
246+
// CHECK-NEXT: switch_enum %0 : $Optional<SR7799>, case #Optional.some!enumelt.1: bb1, default bb4
247+
// CHECK: bb1(%3 : $SR7799):
248+
// CHECK-NEXT: switch_enum %3 : $SR7799, case #SR7799.one!enumelt: bb2, case #SR7799.two!enumelt: bb3
249+
func sr7799(bar: SR7799?) {
250+
switch bar {
251+
case .one: print("one")
252+
case .two?: print("two")
253+
default: print("default")
254+
}
236255
}

0 commit comments

Comments
 (0)