mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This is a workaround for <rdar://problem/13986638>, since the compiler doesn't yet generate metadata for oneof types (and the final layout of oneof metadata is TBD). Swift SVN r5360
20 lines
544 B
Swift
20 lines
544 B
Swift
// RUN: %swift -i %s | FileCheck %s
|
|
// <rdar://problem/13986638> Missing Bool metadata when Bool is used as a generic
|
|
// parameter or existential value
|
|
|
|
operator prefix !! {}
|
|
operator infix &&& {}
|
|
|
|
func [prefix] !!<T:LogicValue>(x:T) -> Bool {
|
|
return x.getLogicValue()
|
|
}
|
|
|
|
func &&&(x:LogicValue, y:[auto_closure] () -> LogicValue) -> Bool {
|
|
return x.getLogicValue() ? y().getLogicValue() : false
|
|
}
|
|
|
|
println(!!true) // CHECK: true
|
|
println(!!false) // CHECK: false
|
|
println(true &&& true) // CHECK: true
|
|
println(true &&& false) // CHECK: false
|