Files
swift-mirror/test/Interpreter/bool_as_generic.swift
Joe Groff 9a8ff4322f runtime: Stub out metadata for Bool.
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
2013-05-28 15:50:49 +00:00

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