mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
20 lines
714 B
Swift
20 lines
714 B
Swift
// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | FileCheck %s
|
|
|
|
struct __CurrentErrno {}
|
|
struct CErrorOr<T>
|
|
{
|
|
var value : T?
|
|
init(x : __CurrentErrno) {
|
|
// CHECK: define hidden void @_TFV20generic_enum_closure8CErrorOrCfT1xVS_14__CurrentErrno_GS0_x_
|
|
// CHECK-NOT: define
|
|
// This is a SIL-level debug_value_addr instruction.
|
|
// CHECK: call void @llvm.dbg.value({{.*}}, metadata ![[SELF:.*]], metadata !{{[0-9]+}})
|
|
// CHECK-DAG: ![[SELF]] = !DILocalVariable(name: "self", arg:{{.*}} type: !"_TtGV20generic_enum_closure8CErrorOrQq_S0__"
|
|
value = .none
|
|
}
|
|
func isError() -> Bool {
|
|
assert(value != nil, "the object should not contain an error")
|
|
return false
|
|
}
|
|
}
|