Skip to content

Commit c4a6c05

Browse files
Merge pull request #4855 from practicalswift/spacing-consistency
[gardening] Increase consistency with regards to spacing after colons
2 parents ddd7aaa + ef8e43b commit c4a6c05

18 files changed

+51
-51
lines changed

benchmark/single-source/DictTest2.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public func run_Dictionary2(_ N: Int) {
1818
let ref_result = 199
1919
var res = 0
2020
for _ in 1...5*N {
21-
var x: [String:Int] = [:]
21+
var x: [String: Int] = [:]
2222
for i in 1...size {
2323
x[String(i, radix:16)] = i
2424
}

benchmark/single-source/DictTest3.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ public func run_Dictionary3(_ N: Int) {
1717
let size1 = 100
1818
let reps = 20
1919
let ref_result = "1 99 20 1980"
20-
var hash1 = [String:Int]()
21-
var hash2 = [String:Int]()
20+
var hash1 = [String: Int]()
21+
var hash2 = [String: Int]()
2222
var res = ""
2323

2424
for _ in 1...N {

test/Constraints/tuple.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ struct MagicKingdom<K> : Kingdom {
168168
typealias King = K
169169
}
170170
func magify<T>(_ t: T) -> MagicKingdom<T> { return MagicKingdom() }
171-
func foo(_ pair: (Int,Int)) -> Victory<(x:Int, y:Int)> {
171+
func foo(_ pair: (Int, Int)) -> Victory<(x: Int, y: Int)> {
172172
return Victory(magify(pair)) // expected-error {{cannot convert return expression of type 'Victory<(Int, Int)>' to return type 'Victory<(x: Int, y: Int)>'}}
173173
}
174174

test/FixCode/fixits-apply.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ protocol NonObjCProtocol {}
238238
@IBOutlet private var ibout3: NonObjCProtocol!
239239
@IBOutlet private let ibout4: IBIssues!
240240
@IBOutlet private var ibout5: [[IBIssues]]!
241-
@IBOutlet private var ibout6: [String:String]!
241+
@IBOutlet private var ibout6: [String: String]!
242242
@IBInspectable static private var ibinspect1: IBIssues!
243243
@IBAction static func ibact() {}
244244
}

test/FixCode/fixits-apply.swift.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ protocol NonObjCProtocol {}
241241
@IBOutlet private var ibout3: NonObjCProtocol!
242242
@IBOutlet private let ibout4: IBIssues!
243243
@IBOutlet private var ibout5: [[IBIssues]]!
244-
@IBOutlet private var ibout6: [String:String]!
244+
@IBOutlet private var ibout6: [String: String]!
245245
@IBInspectable static private var ibinspect1: IBIssues!
246246
@IBAction static func ibact() {}
247247
}

test/Generics/function_decls.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ func f8<T> (x: Int) {} //expected-error{{generic parameter 'T' is not used in fu
2020

2121
public class A<X> {
2222
init<T>(){} //expected-error{{generic parameter 'T' is not used in function signature}}
23-
public func f9<T, U>(x:T, y:X) {} //expected-error{{generic parameter 'U' is not used in function signature}}
24-
public func f10(x:Int) {}
25-
public func f11<T, U>(x:X, y:T) {} //expected-error{{generic parameter 'U' is not used in function signature}}
23+
public func f9<T, U>(x: T, y: X) {} //expected-error{{generic parameter 'U' is not used in function signature}}
24+
public func f10(x: Int) {}
25+
public func f11<T, U>(x: X, y: T) {} //expected-error{{generic parameter 'U' is not used in function signature}}
2626
}
2727

2828
protocol P { associatedtype A }

test/IDE/complete_in_closures.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,8 @@ struct LazyVar3 {
312312
}()
313313
}
314314

315-
func closureTaker(_ theFunc:(theValue:Int) -> ()) {}
316-
func closureTaker2(_ theFunc: (Value1:Int, Value2:Int) -> ()) {}
315+
func closureTaker(_ theFunc:(theValue: Int) -> ()) {}
316+
func closureTaker2(_ theFunc: (Value1: Int, Value2: Int) -> ()) {}
317317
func testClosureParam1() {
318318
closureTaker { (theValue) -> () in
319319
#^CLOSURE_PARAM_1^#

test/Misc/misc_diagnostics.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ func bad_return2() -> (Int, Int) {
7272
}
7373

7474
// <rdar://problem/14096697> QoI: Diagnostics for trying to return values from void functions
75-
func bad_return3(lhs:Int, rhs:Int) {
75+
func bad_return3(lhs: Int, rhs: Int) {
7676
return lhs != 0 // expected-error {{'!=' produces 'Bool', not the expected contextual result type '()'}}
7777
}
7878

7979
class MyBadReturnClass {
8080
static var intProperty = 42
8181
}
8282

83-
func ==(lhs:MyBadReturnClass, rhs:MyBadReturnClass) {
83+
func ==(lhs: MyBadReturnClass, rhs: MyBadReturnClass) {
8484
return MyBadReturnClass.intProperty == MyBadReturnClass.intProperty // expected-error{{binary operator '==' cannot be applied to two 'Int' operands}} // expected-note{{expected an argument list of type '(MyBadReturnClass, MyBadReturnClass)'}}
8585
}
8686

test/Parse/try.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ precedencegroup LowPrecedence {
66
associativity: none
77
lowerThan: AssignmentPrecedence
88
}
9-
func %%%%<T,U>(x:T, y:U) -> Int { return 0 }
9+
func %%%%<T, U>(x: T, y: U) -> Int { return 0 }
1010

1111
// Intentionally has lower precedence between assignments and ?:
1212
infix operator %%% : MiddlingPrecedence
@@ -15,7 +15,7 @@ precedencegroup MiddlingPrecedence {
1515
higherThan: AssignmentPrecedence
1616
lowerThan: TernaryPrecedence
1717
}
18-
func %%%<T,U>(x:T, y:U) -> Int { return 1 }
18+
func %%%<T, U>(x: T, y: U) -> Int { return 1 }
1919

2020
func foo() throws -> Int { return 0 }
2121
func bar() throws -> Int { return 0 }

test/Prototypes/GenericDispatch.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ protocol D : R {
8989

9090
// Dispatch to D's distance() requirement
9191
// Only the author of D needs to see this implementation.
92-
func ~> <I: D>(x:I, args: (_Distance, (I))) -> Int {
92+
func ~> <I: D>(x: I, args: (_Distance, (I))) -> Int {
9393
let other = args.1
9494
return x.distance(other)
9595
}

test/SILOptimizer/bridged_casts_folding.swift

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ var nsDictString: NSDictionary = ["One":"One", "Two":"Two", "Three":"Three", "Fo
197197
// CHECK: function_ref @_TTWu0_Rxs8HashablerGVs10Dictionaryxq__s21_ObjectiveCBridgeable10FoundationZFS1_26_forceBridgeFromObjectiveCfTwx15_ObjectiveCType6resultRGSqx__T_
198198
// CHECK: return
199199
@inline(never)
200-
public func testForcedCastNStoSwiftDictInt() -> [Int:Int] {
201-
var dict: [Int:Int] = forcedCast(nsDictInt)
200+
public func testForcedCastNStoSwiftDictInt() -> [Int: Int] {
201+
var dict: [Int: Int] = forcedCast(nsDictInt)
202202
return dict
203203
}
204204

@@ -207,8 +207,8 @@ public func testForcedCastNStoSwiftDictInt() -> [Int:Int] {
207207
// CHECK: function_ref @_TTWu0_Rxs8HashablerGVs10Dictionaryxq__s21_ObjectiveCBridgeable10FoundationZFS1_34_conditionallyBridgeFromObjectiveCfTwx15_ObjectiveCType6resultRGSqx__Sb
208208
// CHECK: return
209209
@inline(never)
210-
public func testCondCastNStoSwiftDictInt() -> [Int:Int]? {
211-
var dictOpt: [Int:Int]? = condCast(nsDictInt)
210+
public func testCondCastNStoSwiftDictInt() -> [Int: Int]? {
211+
var dictOpt: [Int: Int]? = condCast(nsDictInt)
212212
return dictOpt
213213
}
214214

@@ -217,8 +217,8 @@ public func testCondCastNStoSwiftDictInt() -> [Int:Int]? {
217217
// CHECK: function_ref @_TTWu0_Rxs8HashablerGVs10Dictionaryxq__s21_ObjectiveCBridgeable10FoundationZFS1_26_forceBridgeFromObjectiveCfTwx15_ObjectiveCType6resultRGSqx__T_
218218
// CHECK: return
219219
@inline(never)
220-
public func testForcedCastNStoSwiftDictDouble() -> [Double:Double] {
221-
var dict: [Double:Double] = forcedCast(nsDictDouble)
220+
public func testForcedCastNStoSwiftDictDouble() -> [Double: Double] {
221+
var dict: [Double: Double] = forcedCast(nsDictDouble)
222222
return dict
223223
}
224224

@@ -227,8 +227,8 @@ public func testForcedCastNStoSwiftDictDouble() -> [Double:Double] {
227227
// CHECK: function_ref @_TTWu0_Rxs8HashablerGVs10Dictionaryxq__s21_ObjectiveCBridgeable10FoundationZFS1_34_conditionallyBridgeFromObjectiveCfTwx15_ObjectiveCType6resultRGSqx__Sb
228228
// CHECK: return
229229
@inline(never)
230-
public func testCondCastNStoSwiftDictDouble() -> [Double:Double]? {
231-
var dictOpt: [Double:Double]? = condCast(nsDictDouble)
230+
public func testCondCastNStoSwiftDictDouble() -> [Double: Double]? {
231+
var dictOpt: [Double: Double]? = condCast(nsDictDouble)
232232
return dictOpt
233233
}
234234

@@ -238,8 +238,8 @@ public func testCondCastNStoSwiftDictDouble() -> [Double:Double]? {
238238
// CHECK: function_ref @_TTWu0_Rxs8HashablerGVs10Dictionaryxq__s21_ObjectiveCBridgeable10FoundationZFS1_26_forceBridgeFromObjectiveCfTwx15_ObjectiveCType6resultRGSqx__T_
239239
// CHECK: return
240240
@inline(never)
241-
public func testForcedCastNStoSwiftDictString() -> [String:String] {
242-
var dict: [String:String] = forcedCast(nsDictString)
241+
public func testForcedCastNStoSwiftDictString() -> [String: String] {
242+
var dict: [String: String] = forcedCast(nsDictString)
243243
return dict
244244
}
245245

@@ -248,8 +248,8 @@ public func testForcedCastNStoSwiftDictString() -> [String:String] {
248248
// CHECK: function_ref @_TTWu0_Rxs8HashablerGVs10Dictionaryxq__s21_ObjectiveCBridgeable10FoundationZFS1_34_conditionallyBridgeFromObjectiveCfTwx15_ObjectiveCType6resultRGSqx__Sb
249249
// CHECK: return
250250
@inline(never)
251-
public func testCondCastNStoSwiftDictString() -> [String:String]? {
252-
var dictOpt: [String:String]? = condCast(nsDictString)
251+
public func testCondCastNStoSwiftDictString() -> [String: String]? {
252+
var dictOpt: [String: String]? = condCast(nsDictString)
253253
return dictOpt
254254
}
255255

@@ -258,8 +258,8 @@ public func testCondCastNStoSwiftDictString() -> [String:String]? {
258258
// CHECK: function_ref @_TTWu0_Rxs8HashablerGVs10Dictionaryxq__s21_ObjectiveCBridgeable10FoundationZFS1_26_forceBridgeFromObjectiveCfTwx15_ObjectiveCType6resultRGSqx__T_
259259
// CHECK: return
260260
@inline(never)
261-
public func testForcedCastNSDictStringtoSwiftDictInt() -> [Int:Int] {
262-
var dictOpt: [Int:Int] = forcedCast(nsDictString)
261+
public func testForcedCastNSDictStringtoSwiftDictInt() -> [Int: Int] {
262+
var dictOpt: [Int: Int] = forcedCast(nsDictString)
263263
return dictOpt
264264
}
265265

@@ -269,8 +269,8 @@ public func testForcedCastNSDictStringtoSwiftDictInt() -> [Int:Int] {
269269
// CHECK: function_ref @_TTWu0_Rxs8HashablerGVs10Dictionaryxq__s21_ObjectiveCBridgeable10FoundationZFS1_34_conditionallyBridgeFromObjectiveCfTwx15_ObjectiveCType6resultRGSqx__Sb
270270
// CHECK: return
271271
@inline(never)
272-
public func testCondCastNSDictStringtoSwiftDictInt() -> [Int:Int]? {
273-
var dictOpt: [Int:Int]? = condCast(nsDictString)
272+
public func testCondCastNSDictStringtoSwiftDictInt() -> [Int: Int]? {
273+
var dictOpt: [Int: Int]? = condCast(nsDictString)
274274
return dictOpt
275275
}
276276

@@ -345,7 +345,7 @@ public func testCondCastNStoSwiftSetString() -> Set<String>? {
345345

346346
// Check optimizations of casts from String to NSString
347347

348-
var swiftString:String = "string"
348+
var swiftString: String = "string"
349349

350350
// CHECK-LABEL: sil [noinline] @_TF21bridged_casts_folding29testForcedCastSwiftToNSStringFT_CSo8NSString
351351
// CHECK-NOT: unconditional_checked
@@ -487,9 +487,9 @@ public func testCondCastSwiftToNSArrayString() -> NSArray? {
487487

488488
// Check optimization of casts from Swift Dict to NSDict
489489

490-
var dictInt: [Int:Int] = [1:1, 2:2, 3:3, 4:4]
491-
var dictDouble: [Double:Double] = [1.1 : 1.1, 2.2 : 2.2, 3.3 : 3.3, 4.4 : 4.4]
492-
var dictString: [String:String] = ["One":"One", "Two":"Two", "Three":"Three", "Four":"Four"]
490+
var dictInt: [Int: Int] = [1:1, 2:2, 3:3, 4:4]
491+
var dictDouble: [Double: Double] = [1.1 : 1.1, 2.2 : 2.2, 3.3 : 3.3, 4.4 : 4.4]
492+
var dictString: [String: String] = ["One":"One", "Two":"Two", "Three":"Three", "Four":"Four"]
493493

494494
// CHECK-LABEL: sil [noinline] @_TF21bridged_casts_folding30testForcedCastSwiftToNSDictIntFT_CSo12NSDictionary
495495
// CHECK-NOT: unconditional_checked

test/SILOptimizer/cast_folding_objc_no_foundation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func testAnyObjectToArrayNotBridged(_ a: AnyObject) -> Bool {
4444
// CHECK: checked_cast_addr_br take_always AnyObject in [[SOURCE]] : $*AnyObject to Dictionary<Int, String> in [[TARGET]] : $*Dictionary<Int, String>, bb1, bb2
4545
@inline(never)
4646
func testAnyObjectToDictionary(_ a: AnyObject) -> Bool {
47-
return a is [Int:String]
47+
return a is [Int: String]
4848
}
4949

5050
// CHECK-LABEL: sil hidden [noinline] @_TTSf4g___TF31cast_folding_objc_no_foundation21testAnyObjectToStringFPs9AnyObject_Sb

test/SILOptimizer/let_propagation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public func testAllocAndUseLet() -> Int32 {
9797
// DISABLECHECK-NOT: load
9898
// DISABLECHECK: return
9999
@inline(never)
100-
public func testUseLet(a:A0) -> Int32 {
100+
public func testUseLet(a: A0) -> Int32 {
101101
var counter: Int32
102102
// a.x and a.y should be loaded only once.
103103
counter = a.sum2() + a.sum2()

test/SILOptimizer/unused_containers.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func empty_array_test() {
1515
//CHECK-NEXT: tuple
1616
//CHECK-NEXT: return
1717
func empty_dic_test() {
18-
let unused : [Int:Int] = [:]
18+
let unused : [Int: Int] = [:]
1919
}
2020

2121
//CHECK-LABEL: sil hidden @_TF17unused_containers18unused_string_testFT_T_

test/SourceKit/CursorInfo/cursor_info.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ func paramAutoclosureNoescape1(_ msg: ()->String) {}
157157
func paramAutoclosureNoescape2(_ msg: @autoclosure ()->String) {}
158158
func paramAutoclosureNoescape3(_ msg: @autoclosure @escaping ()->String) {}
159159

160-
func paramDefaultPlaceholder(_ f: StaticString = #function, file: StaticString = #file, line: UInt = #line, col: UInt = #column, arr: [Int] = [], dict: [Int:Int] = [:], opt: Int? = nil, reg: Int = 1) {}
160+
func paramDefaultPlaceholder(_ f: StaticString = #function, file: StaticString = #file, line: UInt = #line, col: UInt = #column, arr: [Int] = [], dict: [Int: Int] = [:], opt: Int? = nil, reg: Int = 1) {}
161161

162162
protocol P3 {
163163
func f(_ s: Self) -> Self

test/stdlib/KVO.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ class Observer : NSObject {
5050
context: nil)
5151
}
5252

53-
override func observeValue(forKeyPath:String?,
54-
of obj:Any?,
55-
change:Dictionary<NSKeyValueChangeKey, Any>?,
56-
context:UnsafeMutableRawPointer?) {
53+
override func observeValue(forKeyPath: String?,
54+
of obj: Any?,
55+
change: Dictionary<NSKeyValueChangeKey, Any>?,
56+
context: UnsafeMutableRawPointer?) {
5757
target!.print()
5858
}
5959
}
@@ -99,10 +99,10 @@ class ObserverKVO : NSObject {
9999
context: &kvoContext)
100100
}
101101

102-
override func observeValue(forKeyPath:String?,
103-
of obj:Any?,
104-
change:Dictionary<NSKeyValueChangeKey, Any>?,
105-
context:UnsafeMutableRawPointer?) {
102+
override func observeValue(forKeyPath: String?,
103+
of obj: Any?,
104+
change: Dictionary<NSKeyValueChangeKey, Any>?,
105+
context: UnsafeMutableRawPointer?) {
106106
if context == &kvoContext {
107107
target!.print()
108108
}

validation-test/stdlib/Algorithm.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ Algorithm.test("invalidOrderings") {
167167
// The routine is based on http://www.cs.dartmouth.edu/~doug/mdmspe.pdf
168168
func makeQSortKiller(_ len: Int) -> [Int] {
169169
var candidate: Int = 0
170-
var keys = [Int:Int]()
170+
var keys = [Int: Int]()
171171
func Compare(_ x: Int, y : Int) -> Bool {
172172
if keys[x] == nil && keys[y] == nil {
173173
if (x == candidate) {

validation-test/stdlib/Sort.swift.gyb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ var Algorithm = TestSuite("Algorithm")
1515
// check correctness of sorting itself.
1616
func expectSortedCollection(_ sortedAry: [Int], _ originalAry: [Int]) {
1717
expectEqual(sortedAry.count, originalAry.count)
18-
var sortedVals = [Int:Int]()
19-
var originalVals = [Int:Int]()
18+
var sortedVals = [Int: Int]()
19+
var originalVals = [Int: Int]()
2020
// Keep track of what values we have in sortedAry.
2121
for e in sortedAry {
2222
if let v = sortedVals[e] {

0 commit comments

Comments
 (0)