mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
It's not always correct to map a Swift Bool back to ObjCBool in C land, since Bool could have originally been a proper _Bool. Pass the clang::Decl down to type lowering so we can recognize this. We still don't have a great solution for block types, because there's no decl to refer to, and Swift's user-level type system erases the distinction between void(^)(_Bool) and void(^)(BOOL). However, this is enough to let us start using C APIs that traffic in _Bool. Swift SVN r23546
31 lines
786 B
Swift
31 lines
786 B
Swift
// RUN: %target-run-simple-swift
|
|
// FIXME: fails on iOS
|
|
// REQUIRES: OS=macosx
|
|
|
|
import GLKit
|
|
|
|
let x = GLKVector4Make(1, 0, 0, 0)
|
|
let y = GLKVector4Make(0, 1, 0, 0)
|
|
let z = GLKVector4Make(0, 0, 1, 0)
|
|
|
|
|
|
println(GLKVector4DotProduct(x, y)) // CHECK: 0.0
|
|
|
|
let z2 = GLKVector4CrossProduct(x, y)
|
|
println(GLKVector4AllEqualToVector4(z, z2)) // CHECK-NEXT: true
|
|
|
|
infix operator • { precedence 150 }
|
|
infix operator ⨉ { precedence 150 }
|
|
func •(x: GLKVector4, y: GLKVector4) -> Float {
|
|
return GLKVector4DotProduct(x, y)
|
|
}
|
|
func ⨉(x: GLKVector4, y: GLKVector4) -> GLKVector4 {
|
|
return GLKVector4CrossProduct(x, y)
|
|
}
|
|
func ==(x: GLKVector4, y: GLKVector4) -> Bool {
|
|
return GLKVector4AllEqualToVector4(x, y)
|
|
}
|
|
|
|
println(x • y) // CHECK-NEXT: 0.0
|
|
println(x ⨉ y == z) // CHECK-NEXT: true
|