Files
swift-mirror/test/Interpreter/bool_as_generic.swift
Chris Lattner 8c6b2b6b5f adjust testsuite to put @autoclosure on decls instead of types, and remove a
couple of soon-to-be-invalid cases.



Swift SVN r24074
2014-12-22 20:14:11 +00:00

20 lines
542 B
Swift

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