Files
swift-mirror/test/Interpreter/bool_as_generic.swift
2015-12-10 14:56:32 -08:00

21 lines
551 B
Swift

// RUN: %target-run-simple-swift | FileCheck %s
// REQUIRES: executable_test
// <rdar://problem/13986638> Missing Bool metadata when Bool is used as a generic
// parameter or existential value
prefix operator !! {}
infix operator &&& {}
prefix func !!<T : Boolean>(x: T) -> Bool {
return x.boolValue
}
func &&&(x: Boolean, @autoclosure y: () -> Boolean) -> Bool {
return x.boolValue ? y().boolValue : false
}
print(!!true) // CHECK: true
print(!!false) // CHECK: false
print(true &&& true) // CHECK: true
print(true &&& false) // CHECK: false