Skip to content

Commit 8c1c0be

Browse files
committed
update the last of the testsuite to have parens around function type parameters.
1 parent 7e20199 commit 8c1c0be

File tree

9 files changed

+39
-39
lines changed

9 files changed

+39
-39
lines changed

test/1_stdlib/Optional.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ OptionalTests.test("??") {
209209
}
210210

211211
OptionalTests.test("flatMap") {
212-
let half: Int32 -> Int16? =
212+
let half: (Int32) -> Int16? =
213213
{ if $0 % 2 == 0 { return Int16($0 / 2) } else { return .none } }
214214

215215
expectOptionalEqual(2 as Int16, half(4))

test/1_stdlib/Runtime.swift

+16-16
Original file line numberDiff line numberDiff line change
@@ -255,25 +255,25 @@ Runtime.test("dynamicCasting with as") {
255255
expectTrue(((someP1Ref2 as AnyObject) as? P1)!.boolValue)
256256
expectEmpty(((someNotP1Ref as AnyObject) as? P1))
257257

258-
let doesThrow: Int throws -> Int = { $0 }
259-
let doesNotThrow: String -> String = { $0 }
258+
let doesThrow: (Int) throws -> Int = { $0 }
259+
let doesNotThrow: (String) -> String = { $0 }
260260

261261
var any: Any = doesThrow
262262

263-
expectTrue(doesThrow as Any is Int throws -> Int)
264-
expectFalse(doesThrow as Any is String throws -> Int)
265-
expectFalse(doesThrow as Any is String throws -> String)
266-
expectFalse(doesThrow as Any is Int throws -> String)
267-
expectFalse(doesThrow as Any is Int -> Int)
268-
expectFalse(doesThrow as Any is String throws -> String)
269-
expectFalse(doesThrow as Any is String -> String)
270-
expectTrue(doesNotThrow as Any is String throws -> String)
271-
expectTrue(doesNotThrow as Any is String -> String)
272-
expectFalse(doesNotThrow as Any is Int -> String)
273-
expectFalse(doesNotThrow as Any is Int -> Int)
274-
expectFalse(doesNotThrow as Any is String -> Int)
275-
expectFalse(doesNotThrow as Any is Int throws -> Int)
276-
expectFalse(doesNotThrow as Any is Int -> Int)
263+
expectTrue(doesThrow as Any is (Int) throws -> Int)
264+
expectFalse(doesThrow as Any is (String) throws -> Int)
265+
expectFalse(doesThrow as Any is (String) throws -> String)
266+
expectFalse(doesThrow as Any is (Int) throws -> String)
267+
expectFalse(doesThrow as Any is (Int) -> Int)
268+
expectFalse(doesThrow as Any is (String) throws -> String)
269+
expectFalse(doesThrow as Any is (String) -> String)
270+
expectTrue(doesNotThrow as Any is (String) throws -> String)
271+
expectTrue(doesNotThrow as Any is (String) -> String)
272+
expectFalse(doesNotThrow as Any is (Int) -> String)
273+
expectFalse(doesNotThrow as Any is (Int) -> Int)
274+
expectFalse(doesNotThrow as Any is (String) -> Int)
275+
expectFalse(doesNotThrow as Any is (Int) throws -> Int)
276+
expectFalse(doesNotThrow as Any is (Int) -> Int)
277277
}
278278

279279
extension Int {

test/1_stdlib/RuntimeObjC.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -422,10 +422,10 @@ Runtime.test("Generic class ObjC runtime names") {
422422
expectEqual("_TtGC1a12GenericClassMVS_11PlainStruct_",
423423
NSStringFromClass(GenericClass<PlainStruct.Type>.self))
424424
expectEqual("_TtGC1a12GenericClassFMVS_11PlainStructS1__",
425-
NSStringFromClass(GenericClass<PlainStruct.Type -> PlainStruct>.self))
425+
NSStringFromClass(GenericClass<(PlainStruct.Type) -> PlainStruct>.self))
426426

427427
expectEqual("_TtGC1a12GenericClassFzMVS_11PlainStructS1__",
428-
NSStringFromClass(GenericClass<PlainStruct.Type throws -> PlainStruct>.self))
428+
NSStringFromClass(GenericClass<(PlainStruct.Type) throws -> PlainStruct>.self))
429429
expectEqual("_TtGC1a12GenericClassFTVS_11PlainStructROS_9PlainEnum_Si_",
430430
NSStringFromClass(GenericClass<(PlainStruct, inout PlainEnum) -> Int>.self))
431431

test/1_stdlib/UnsafePointer.swift.gyb

+2-2
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ func checkPointerCorrectness(_ check: Check,
235235
}
236236
}
237237

238-
let checkPtr: ((UnsafeMutablePointer<Missile> ->
239-
(UnsafeMutablePointer<Missile>, count: Int) -> Void), Bool) -> Check -> Void
238+
let checkPtr: (((UnsafeMutablePointer<Missile>) ->
239+
(UnsafeMutablePointer<Missile>, count: Int) -> Void), Bool) -> (Check) -> Void
240240
= { (f, m) in return { checkPointerCorrectness($0, f, m) } }
241241

242242
UnsafeMutablePointerTestSuite.test("moveInitializeBackwardFrom") {

test/DebugInfo/thunks.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import Foundation
55

66
class Foo : NSObject {
7-
dynamic func foo(_ f: Int64 -> Int64, x: Int64) -> Int64 {
7+
dynamic func foo(_ f: (Int64) -> Int64, x: Int64) -> Int64 {
88
return f(x)
99
}
1010
}

test/PrintAsObjC/blocks.swift

+11-11
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ typealias MyInt = Int
6060
(Int32) -> (UInt32)) ->
6161
((Int8) -> (UInt8))) {}
6262

63-
func returnsBlockWithInput() -> (NSObject -> ())? {
63+
func returnsBlockWithInput() -> ((NSObject) -> ())? {
6464
return nil
6565
}
6666
func returnsBlockWithParenthesizedInput() -> ((NSObject) -> ())? {
@@ -70,27 +70,27 @@ typealias MyInt = Int
7070
return nil
7171
}
7272

73-
func blockWithTypealias(_ input: MyTuple -> MyInt) {}
74-
func blockWithSimpleTypealias(_ input: MyInt -> MyInt) {}
73+
func blockWithTypealias(_ input: (MyTuple) -> MyInt) {}
74+
func blockWithSimpleTypealias(_ input: (MyInt) -> MyInt) {}
7575

7676
func namedArguments(_ input: (f1: Float, f2: Float, d1: Double, d2: Double) -> ()) {}
7777
func blockTakesNamedBlock(_ input: (block: () -> ()) -> ()) {}
7878
func returnsBlockWithNamedInput() -> ((object: NSObject) -> ())? {
7979
return nil
8080
}
8181

82-
func blockWithTypealiasWithNames(_ input: MyNamedTuple -> MyInt) {}
82+
func blockWithTypealiasWithNames(_ input: (MyNamedTuple) -> MyInt) {}
8383

8484
func blockWithKeyword(_ _Nullable: (`class`: Int) -> Int) {}
8585

86-
func functionPointers(_ input: @convention(c) Int -> Int)
87-
-> @convention(c) Int -> Int {
86+
func functionPointers(_ input: @convention(c) (Int) -> Int)
87+
-> @convention(c) (Int) -> Int {
8888
return input
8989
}
9090

9191
func functionPointerTakesAndReturnsFunctionPointer(
92-
_ input: @convention(c) Int -> Int
93-
-> @convention(c) Int -> Int
92+
_ input: @convention(c) (Int) -> (Int)
93+
-> @convention(c) (Int) -> Int
9494
) {
9595
}
9696

@@ -99,10 +99,10 @@ typealias MyInt = Int
9999
return input
100100
}
101101

102-
var savedBlock: (Int -> Int)?
102+
var savedBlock: ((Int) -> Int)?
103103
var savedBlockWithName: ((x: Int) -> Int)?
104-
var savedFunctionPointer: @convention(c) Int -> Int = { $0 }
105-
var savedFunctionPointer2: (@convention(c) Int -> Int)? = { $0 }
104+
var savedFunctionPointer: @convention(c) (Int) -> Int = { $0 }
105+
var savedFunctionPointer2: (@convention(c) (Int) -> Int)? = { $0 }
106106
var savedFunctionPointerWithName: @convention(c) (x: Int) -> Int = { $0 }
107107

108108
// The following uses a clang keyword as the name.

test/PrintAsObjC/cdecl.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@
1515

1616
/// What a nightmare!
1717
@_cdecl("block_nightmare")
18-
public func block_nightmare(x: @convention(block) Int -> Float)
19-
-> @convention(block) CChar -> Double { return { _ in 0 } }
18+
public func block_nightmare(x: @convention(block) (Int) -> Float)
19+
-> @convention(block) (CChar) -> Double { return { _ in 0 } }
2020

2121
// CHECK-LABEL: void foo_bar(NSInteger x, NSInteger y);
2222
@_cdecl("foo_bar")
2323
func foo(x: Int, bar y: Int) {}
2424

2525
// CHECK-LABEL: double (* _Nonnull function_pointer_nightmare(float (* _Nonnull x)(NSInteger)))(char);
2626
@_cdecl("function_pointer_nightmare")
27-
func function_pointer_nightmare(x: @convention(c) Int -> Float)
28-
-> @convention(c) CChar -> Double { return { _ in 0 } }
27+
func function_pointer_nightmare(x: @convention(c) (Int) -> Float)
28+
-> @convention(c) (CChar) -> Double { return { _ in 0 } }
2929

3030
// CHECK-LABEL: void has_keyword_arg_names(NSInteger auto_, NSInteger union_);
3131
@_cdecl("has_keyword_arg_names")

test/PrintAsObjC/classes.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ public class NonObjCClass { }
593593

594594
init() throws { }
595595
init(string: String) throws { }
596-
init(fn: Int -> Int) throws { }
596+
init(fn: (Int) -> Int) throws { }
597597
}
598598

599599
@objc class Spoon: Fungible {}

test/Serialization/Inputs/def_basic.sil

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ bb0:
200200
%O = unchecked_ref_cast %C : $C to $Builtin.UnknownObject
201201

202202
// CHECK: class_method {{.*}} : $C, #C.doIt!1
203-
%2 = class_method %C : $C, #C.doIt!1 : C -> () -> (), $@convention(method) (@guaranteed C) -> ()
203+
%2 = class_method %C : $C, #C.doIt!1 : (C) -> () -> (), $@convention(method) (@guaranteed C) -> ()
204204

205205
// CHECK: alloc_ref $D
206206
%D = alloc_ref $D

0 commit comments

Comments
 (0)