forked from swiftlang/swift
- Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconditional-assign.swift
30 lines (29 loc) · 940 Bytes
/
conditional-assign.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// RUN: %target-swift-frontend %s -Xllvm -sil-print-debuginfo -emit-sil -g -o - | %FileCheck %s
publicprotocolDelegateA{}
publicprotocolDelegateB{}
publicprotocolWithDelegate
{
vardelegate:DelegateA?{get}
func f()throws->Int
}
publicenumErr:Swift.Error{
case s(Int)
}
publicclassC{}
publicclassM{
letfield:C
varvalue:Int
// Verify that definite initialization doesn't create a bogus description of
// self pointing to the liveness bitvector.
// CHECK-LABEL: sil @$s4main1MC4fromAcA12WithDelegate_p_tKcfc
// CHECK: bb0
// CHECK-NOT: alloc_stack $Builtin.Int2{{.*}}let
// CHECK: } // end sil function '$s4main1MC4fromAcA12WithDelegate_p_tKcfc'
publicinit(from d:WithDelegate)throws{
guardlet delegate = d.delegate as?DelegateB
else{throwErr.s(0)}
self.field =C()
leti:Int=try d.f()
value = i
}
}