Skip to content

[SE-0066] Adopt new function type syntax #351

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Foundation/NSTimer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ public class NSTimer : NSObject {
}

internal var _timer: CFRunLoopTimer? // has to be optional because this is a chicken/egg problem with initialization in swift
internal var _fire: NSTimer -> Void = { (_: NSTimer) in }
internal var _fire: (NSTimer) -> Void = { (_: NSTimer) in }

/// Alternative API for timer creation with a block.
/// - Experiment: This is a draft API currently under consideration for official import into Foundation as a suitable alternative to creation via selector
/// - Note: Since this API is under consideration it may be either removed or revised in the near future
/// - Warning: Capturing the timer or the owner of the timer inside of the block may cause retain cycles. Use with caution
public init(fireDate: NSDate, interval: NSTimeInterval, repeats: Bool, fire: NSTimer -> Void ) {
public init(fireDate: NSDate, interval: NSTimeInterval, repeats: Bool, fire: (NSTimer) -> Void ) {
super.init()
_fire = fire
var context = CFRunLoopTimerContext()
Expand All @@ -53,7 +53,7 @@ public class NSTimer : NSObject {
/// - Experiment: This is a draft API currently under consideration for official import into Foundation as a suitable alternative to creation via selector
/// - Note: Since this API is under consideration it may be either removed or revised in the near future
/// - Warning: Capturing the timer or the owner of the timer inside of the block may cause retain cycles. Use with caution
public class func scheduledTimer(_ ti: NSTimeInterval, repeats: Bool, fire: NSTimer -> Void) -> NSTimer {
public class func scheduledTimer(_ ti: NSTimeInterval, repeats: Bool, fire: (NSTimer) -> Void) -> NSTimer {
let timer = NSTimer(fireDate: NSDate(timeIntervalSinceNow: ti), interval: ti, repeats: repeats, fire: fire)
CFRunLoopAddTimer(CFRunLoopGetCurrent(), timer._timer!, kCFRunLoopDefaultMode)
return timer
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSAffineTransform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
class TestNSAffineTransform : XCTestCase {
private let accuracyThreshold = 0.001

static var allTests: [(String, TestNSAffineTransform -> () throws -> Void)] {
static var allTests: [(String, (TestNSAffineTransform) -> () throws -> Void)] {
return [
("test_BasicConstruction", test_BasicConstruction),
("test_IdentityTransformation", test_IdentityTransformation),
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSArray.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import SwiftXCTest

class TestNSArray : XCTestCase {

static var allTests: [(String, TestNSArray -> () throws -> Void)] {
static var allTests: [(String, (TestNSArray) -> () throws -> Void)] {
return [
("test_BasicConstruction", test_BasicConstruction),
("test_enumeration", test_enumeration),
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSAttributedString.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

class TestNSAttributedString : XCTestCase {

static var allTests: [(String, TestNSAttributedString -> () throws -> Void)] {
static var allTests: [(String, (TestNSAttributedString) -> () throws -> Void)] {
return [
("test_initWithString", test_initWithString),
("test_initWithStringAndAttributes", test_initWithStringAndAttributes)
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSBundle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

class TestNSBundle : XCTestCase {

static var allTests: [(String, TestNSBundle -> () throws -> Void)] {
static var allTests: [(String, (TestNSBundle) -> () throws -> Void)] {
return [
("test_paths", test_paths),
("test_resources", test_resources),
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSByteCountFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

class TestNSByteCountFormatter : XCTestCase {

static var allTests: [(String, TestNSByteCountFormatter -> () throws -> Void)] {
static var allTests: [(String, (TestNSByteCountFormatter) -> () throws -> Void)] {
return [
("test_DefaultValues", test_DefaultValues)
]
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSCalendar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import CoreFoundation

class TestNSCalendar: XCTestCase {

static var allTests: [(String, TestNSCalendar -> () throws -> Void)] {
static var allTests: [(String, (TestNSCalendar) -> () throws -> Void)] {
return [
("test_gettingDatesOnGregorianCalendar", test_gettingDatesOnGregorianCalendar ),
("test_gettingDatesOnHebrewCalendar", test_gettingDatesOnHebrewCalendar ),
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSCharacterSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import SwiftXCTest

class TestNSCharacterSet : XCTestCase {

static var allTests: [(String, TestNSCharacterSet -> () throws -> Void)] {
static var allTests: [(String, (TestNSCharacterSet) -> () throws -> Void)] {
return [
("test_Predefines", test_Predefines),
("test_Range", test_Range),
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSCompoundPredicate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class TestNSCompoundPredicate: XCTestCase {

static var allTests: [(String, TestNSCompoundPredicate -> () throws -> Void)] {
static var allTests: [(String, (TestNSCompoundPredicate) -> () throws -> Void)] {
return [
("test_NotPredicate", test_NotPredicate),
("test_AndPredicateWithNoSubpredicates", test_AndPredicateWithNoSubpredicates),
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class TestNSData: XCTestCase {

static var allTests: [(String, TestNSData -> () throws -> Void)] {
static var allTests: [(String, (TestNSData) -> () throws -> Void)] {
return [
("test_description", test_description),
("test_emptyDescription", test_emptyDescription),
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSDate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

class TestNSDate : XCTestCase {

static var allTests: [(String, TestNSDate -> () throws -> Void)] {
static var allTests: [(String, (TestNSDate) -> () throws -> Void)] {
return [
("test_BasicConstruction", test_BasicConstruction),
("test_InitTimeIntervalSince1970", test_InitTimeIntervalSince1970),
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSDateFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class TestNSDateFormatter: XCTestCase {
let DEFAULT_LOCALE = "en_US"
let DEFAULT_TIMEZONE = "GMT"

static var allTests : [(String, TestNSDateFormatter -> () throws -> Void)] {
static var allTests : [(String, (TestNSDateFormatter) -> () throws -> Void)] {
return [
("test_BasicConstruction", test_BasicConstruction),
("test_dateStyleShort", test_dateStyleShort),
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSDictionary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import SwiftXCTest

class TestNSDictionary : XCTestCase {

static var allTests: [(String, TestNSDictionary -> () throws -> Void)] {
static var allTests: [(String, (TestNSDictionary) -> () throws -> Void)] {
return [
("test_BasicConstruction", test_BasicConstruction),
("test_ArrayConstruction", test_ArrayConstruction),
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSFileHandle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#endif

class TestNSFileHandle : XCTestCase {
static var allTests : [(String, TestNSFileHandle -> () throws -> ())] {
static var allTests : [(String, (TestNSFileHandle) -> () throws -> ())] {
return [
("test_pipe", test_pipe),
]
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSFileManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class TestNSFileManager : XCTestCase {

static var allTests: [(String, TestNSFileManager -> () throws -> Void)] {
static var allTests: [(String, (TestNSFileManager) -> () throws -> Void)] {
return [
("test_createDirectory", test_createDirectory ),
("test_createFile", test_createFile ),
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSGeometry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

class TestNSGeometry : XCTestCase {

static var allTests: [(String, TestNSGeometry -> () throws -> Void)] {
static var allTests: [(String, (TestNSGeometry) -> () throws -> Void)] {
return [
("test_CGFloat_BasicConstruction", test_CGFloat_BasicConstruction),
("test_CGFloat_Equality", test_CGFloat_Equality),
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSHTTPCookie.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class TestNSHTTPCookie: XCTestCase {

static var allTests: [(String, TestNSHTTPCookie -> () throws -> Void)] {
static var allTests: [(String, (TestNSHTTPCookie) -> () throws -> Void)] {
return [
("test_BasicConstruction", test_BasicConstruction),
("test_RequestHeaderFields", test_RequestHeaderFields)
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSIndexPath.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

class TestNSIndexPath: XCTestCase {

static var allTests: [(String, TestNSIndexPath -> () throws -> Void)] {
static var allTests: [(String, (TestNSIndexPath) -> () throws -> Void)] {
return [
("test_BasicConstruction", test_BasicConstruction)
]
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSIndexSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import SwiftXCTest

class TestNSIndexSet : XCTestCase {

static var allTests: [(String, TestNSIndexSet -> () throws -> Void)] {
static var allTests: [(String, (TestNSIndexSet) -> () throws -> Void)] {
return [
("test_BasicConstruction", test_BasicConstruction),
("test_enumeration", test_enumeration),
Expand Down
10 changes: 5 additions & 5 deletions TestFoundation/TestNSJSONSerialization.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class TestNSJSONSerialization : XCTestCase {
NSUTF32LittleEndianStringEncoding, NSUTF32BigEndianStringEncoding
]

static var allTests: [(String, TestNSJSONSerialization -> () throws -> Void)] {
static var allTests: [(String, (TestNSJSONSerialization) -> () throws -> Void)] {
return JSONObjectWithDataTests
+ deserializationTests
+ isValidJSONObjectTests
Expand All @@ -37,7 +37,7 @@ class TestNSJSONSerialization : XCTestCase {
//MARK: - JSONObjectWithData
extension TestNSJSONSerialization {

class var JSONObjectWithDataTests: [(String, TestNSJSONSerialization -> () throws -> Void)] {
class var JSONObjectWithDataTests: [(String, (TestNSJSONSerialization) -> () throws -> Void)] {
return [
("test_JSONObjectWithData_emptyObject", test_JSONObjectWithData_emptyObject),
("test_JSONObjectWithData_encodingDetection", test_JSONObjectWithData_encodingDetection),
Expand Down Expand Up @@ -85,7 +85,7 @@ extension TestNSJSONSerialization {
//MARK: - JSONDeserialization
extension TestNSJSONSerialization {

class var deserializationTests: [(String, TestNSJSONSerialization -> () throws -> Void)] {
class var deserializationTests: [(String, (TestNSJSONSerialization) -> () throws -> Void)] {
return [
("test_deserialize_emptyObject", test_deserialize_emptyObject),
("test_deserialize_multiStringObject", test_deserialize_multiStringObject),
Expand Down Expand Up @@ -475,7 +475,7 @@ extension TestNSJSONSerialization {
// MARK: - isValidJSONObjectTests
extension TestNSJSONSerialization {

class var isValidJSONObjectTests: [(String, TestNSJSONSerialization -> () throws -> Void)] {
class var isValidJSONObjectTests: [(String, (TestNSJSONSerialization) -> () throws -> Void)] {
return [
("test_isValidJSONObjectTrue", test_isValidJSONObjectTrue),
("test_isValidJSONObjectFalse", test_isValidJSONObjectFalse),
Expand Down Expand Up @@ -583,7 +583,7 @@ extension TestNSJSONSerialization {
// MARK: - serializationTests
extension TestNSJSONSerialization {

class var serializationTests: [(String, TestNSJSONSerialization -> () throws -> Void)] {
class var serializationTests: [(String, (TestNSJSONSerialization) -> () throws -> Void)] {
return [
("test_serialize_emptyObject", test_serialize_emptyObject),
("test_serialize_null", test_serialize_null),
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSKeyedArchiver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class UserClass : NSObject, NSSecureCoding {
}

class TestNSKeyedArchiver : XCTestCase {
static var allTests: [(String, TestNSKeyedArchiver -> () throws -> Void)] {
static var allTests: [(String, (TestNSKeyedArchiver) -> () throws -> Void)] {
return [
("test_archive_array", test_archive_array),
("test_archive_charptr", test_archive_charptr),
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSKeyedUnarchiver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


class TestNSKeyedUnarchiver : XCTestCase {
static var allTests: [(String, TestNSKeyedUnarchiver -> () throws -> Void)] {
static var allTests: [(String, (TestNSKeyedUnarchiver) -> () throws -> Void)] {
return [
("test_unarchive_array", test_unarchive_array),
("test_unarchive_complex", test_unarchive_complex),
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSLocale.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#endif

class TestNSLocale : XCTestCase {
static var allTests: [(String, TestNSLocale -> () throws -> Void)] {
static var allTests: [(String, (TestNSLocale) -> () throws -> Void)] {
return [
("test_constants", test_constants),
]
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSNotificationCenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


class TestNSNotificationCenter : XCTestCase {
static var allTests: [(String, TestNSNotificationCenter -> () throws -> Void)] {
static var allTests: [(String, (TestNSNotificationCenter) -> () throws -> Void)] {
return [
("test_defaultCenter", test_defaultCenter),
("test_postNotification", test_postNotification),
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSNotificationQueue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


class TestNSNotificationQueue : XCTestCase {
static var allTests : [(String, TestNSNotificationQueue -> () throws -> Void)] {
static var allTests : [(String, (TestNSNotificationQueue) -> () throws -> Void)] {
return [
("test_defaultQueue", test_defaultQueue),
("test_postNowToDefaultQueueWithoutCoalescing", test_postNowToDefaultQueueWithoutCoalescing),
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSNull.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

class TestNSNull : XCTestCase {

static var allTests: [(String, TestNSNull -> () throws -> Void)] {
static var allTests: [(String, (TestNSNull) -> () throws -> Void)] {
return [
("test_alwaysEqual", test_alwaysEqual)
]
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSNumber.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import SwiftXCTest


class TestNSNumber : XCTestCase {
static var allTests: [(String, TestNSNumber -> () throws -> Void)] {
static var allTests: [(String, (TestNSNumber) -> () throws -> Void)] {
return [
("test_NumberWithBool", test_NumberWithBool ),
("test_numberWithChar", test_numberWithChar ),
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSNumberFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import CoreFoundation

class TestNSNumberFormatter: XCTestCase {

static var allTests: [(String, TestNSNumberFormatter -> () throws -> Void)] {
static var allTests: [(String, (TestNSNumberFormatter) -> () throws -> Void)] {
return [
("test_currencyCode", test_currencyCode),
("test_decimalSeparator", test_decimalSeparator),
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSOperationQueue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import SwiftXCTest
#endif

class TestNSOperationQueue : XCTestCase {
static var allTests: [(String, TestNSOperationQueue -> () throws -> Void)] {
static var allTests: [(String, (TestNSOperationQueue) -> () throws -> Void)] {
return [
("test_OperationCount", test_OperationCount)
]
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSOrderedSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

class TestNSOrderedSet : XCTestCase {

static var allTests: [(String, TestNSOrderedSet -> () throws -> Void)] {
static var allTests: [(String, (TestNSOrderedSet) -> () throws -> Void)] {
return [
("test_BasicConstruction", test_BasicConstruction),
("test_Enumeration", test_Enumeration),
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSPipe.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import SwiftXCTest

class TestNSPipe : XCTestCase {

static var allTests: [(String, TestNSPipe -> () throws -> Void)] {
static var allTests: [(String, (TestNSPipe) -> () throws -> Void)] {
return [
// Currently disabled until NSString implements dataUsingEncoding
// ("test_NSPipe", test_NSPipe)
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSPredicate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class TestNSPredicate: XCTestCase {

static var allTests : [(String, TestNSPredicate -> () throws -> Void)] {
static var allTests : [(String, (TestNSPredicate) -> () throws -> Void)] {
return [
("test_BooleanPredicate", test_BooleanPredicate),
("test_BlockPredicateWithoutVariableBindings", test_BlockPredicateWithoutVariableBindings),
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSProcessInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

class TestNSProcessInfo : XCTestCase {

static var allTests: [(String, TestNSProcessInfo -> () throws -> Void)] {
static var allTests: [(String, (TestNSProcessInfo) -> () throws -> Void)] {
return [
("test_operatingSystemVersion", test_operatingSystemVersion ),
("test_processName", test_processName ),
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSPropertyList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import SwiftXCTest


class TestNSPropertyList : XCTestCase {
static var allTests: [(String, TestNSPropertyList -> () throws -> Void)] {
static var allTests: [(String, (TestNSPropertyList) -> () throws -> Void)] {
return [
("test_BasicConstruction", test_BasicConstruction ),
("test_decode", test_decode ),
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSRange.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import SwiftXCTest

class TestNSRange : XCTestCase {

static var allTests: [(String, TestNSRange -> () throws -> Void)] {
static var allTests: [(String, (TestNSRange) -> () throws -> Void)] {
return [
// currently disabled due to pending requirements for NSString
// ("test_NSRangeFromString", test_NSRangeFromString ),
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSRegularExpression.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import SwiftXCTest

class TestNSRegularExpression : XCTestCase {

static var allTests : [(String, TestNSRegularExpression -> () throws -> Void)] {
static var allTests : [(String, (TestNSRegularExpression) -> () throws -> Void)] {
return [
("test_simpleRegularExpressions", test_simpleRegularExpressions),
("test_regularExpressionReplacement", test_regularExpressionReplacement),
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSRunLoop.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


class TestNSRunLoop : XCTestCase {
static var allTests : [(String, TestNSRunLoop -> () throws -> Void)] {
static var allTests : [(String, (TestNSRunLoop) -> () throws -> Void)] {
return [
("test_constants", test_constants),
("test_runLoopInit", test_runLoopInit),
Expand Down
2 changes: 1 addition & 1 deletion TestFoundation/TestNSScanner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

class TestNSScanner : XCTestCase {

static var allTests: [(String, TestNSScanner -> () throws -> Void)] {
static var allTests: [(String, (TestNSScanner) -> () throws -> Void)] {
return [
("test_scanInteger", test_scanInteger),
]
Expand Down
Loading