mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
includes a number of QoI things to help people write the correct code. I will commit the testcase for it as the next patch. The bulk of this patch is moving the stdlib, testsuite and validation testsuite to the new syntax. I moved a few uses of "as" patterns back to as? expressions in the stdlib as well. Swift SVN r27959
31 lines
916 B
Swift
31 lines
916 B
Swift
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse %s -verify
|
|
|
|
// REQUIRES: objc_interop
|
|
|
|
import Security
|
|
|
|
let _: CFStringRef = kSecClass
|
|
let _: CFStringRef = kSecClassGenericPassword
|
|
let _: CFDictionaryRef = kSecClassGenericPassword // expected-error {{'CFStringRef' is not convertible to 'CFDictionaryRef'}}
|
|
|
|
func testIntegration() {
|
|
// Based on code in <rdar://problem/17162475>.
|
|
let query = [kSecClass as NSString: kSecClassGenericPassword] as NSDictionary as CFDictionary
|
|
|
|
var dataTypeRef: Unmanaged<AnyObject>? = nil
|
|
let status = SecItemCopyMatching(query, &dataTypeRef)
|
|
|
|
if status == errSecSuccess {
|
|
if let filledRef = dataTypeRef {
|
|
let str: NSString = filledRef.takeRetainedValue() as! NSString
|
|
println("Got: \(str)")
|
|
}
|
|
}
|
|
}
|
|
|
|
func testAuthorizationIsNotCF() {
|
|
var auth = AuthorizationRef()
|
|
_ = AuthorizationCreate(&auth)
|
|
_ = AuthorizationFree(auth)
|
|
}
|