Skip to content

[gardening] Increase consistency with regards to spacing after colons #4855

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 1 commit into from
Sep 23, 2016
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
2 changes: 1 addition & 1 deletion benchmark/single-source/DictTest2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public func run_Dictionary2(_ N: Int) {
let ref_result = 199
var res = 0
for _ in 1...5*N {
var x: [String:Int] = [:]
var x: [String: Int] = [:]
for i in 1...size {
x[String(i, radix:16)] = i
}
Expand Down
4 changes: 2 additions & 2 deletions benchmark/single-source/DictTest3.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public func run_Dictionary3(_ N: Int) {
let size1 = 100
let reps = 20
let ref_result = "1 99 20 1980"
var hash1 = [String:Int]()
var hash2 = [String:Int]()
var hash1 = [String: Int]()
var hash2 = [String: Int]()
var res = ""

for _ in 1...N {
Expand Down
2 changes: 1 addition & 1 deletion test/Constraints/tuple.swift
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ struct MagicKingdom<K> : Kingdom {
typealias King = K
}
func magify<T>(_ t: T) -> MagicKingdom<T> { return MagicKingdom() }
func foo(_ pair: (Int,Int)) -> Victory<(x:Int, y:Int)> {
func foo(_ pair: (Int, Int)) -> Victory<(x: Int, y: Int)> {
return Victory(magify(pair)) // expected-error {{cannot convert return expression of type 'Victory<(Int, Int)>' to return type 'Victory<(x: Int, y: Int)>'}}
}

Expand Down
2 changes: 1 addition & 1 deletion test/FixCode/fixits-apply.swift
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ protocol NonObjCProtocol {}
@IBOutlet private var ibout3: NonObjCProtocol!
@IBOutlet private let ibout4: IBIssues!
@IBOutlet private var ibout5: [[IBIssues]]!
@IBOutlet private var ibout6: [String:String]!
@IBOutlet private var ibout6: [String: String]!
@IBInspectable static private var ibinspect1: IBIssues!
@IBAction static func ibact() {}
}
Expand Down
2 changes: 1 addition & 1 deletion test/FixCode/fixits-apply.swift.result
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ protocol NonObjCProtocol {}
@IBOutlet private var ibout3: NonObjCProtocol!
@IBOutlet private let ibout4: IBIssues!
@IBOutlet private var ibout5: [[IBIssues]]!
@IBOutlet private var ibout6: [String:String]!
@IBOutlet private var ibout6: [String: String]!
@IBInspectable static private var ibinspect1: IBIssues!
@IBAction static func ibact() {}
}
Expand Down
6 changes: 3 additions & 3 deletions test/Generics/function_decls.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ func f8<T> (x: Int) {} //expected-error{{generic parameter 'T' is not used in fu

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

protocol P { associatedtype A }
Expand Down
4 changes: 2 additions & 2 deletions test/IDE/complete_in_closures.swift
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ struct LazyVar3 {
}()
}

func closureTaker(_ theFunc:(theValue:Int) -> ()) {}
func closureTaker2(_ theFunc: (Value1:Int, Value2:Int) -> ()) {}
func closureTaker(_ theFunc:(theValue: Int) -> ()) {}
func closureTaker2(_ theFunc: (Value1: Int, Value2: Int) -> ()) {}
func testClosureParam1() {
closureTaker { (theValue) -> () in
#^CLOSURE_PARAM_1^#
Expand Down
4 changes: 2 additions & 2 deletions test/Misc/misc_diagnostics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ func bad_return2() -> (Int, Int) {
}

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

class MyBadReturnClass {
static var intProperty = 42
}

func ==(lhs:MyBadReturnClass, rhs:MyBadReturnClass) {
func ==(lhs: MyBadReturnClass, rhs: MyBadReturnClass) {
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)'}}
}

Expand Down
4 changes: 2 additions & 2 deletions test/Parse/try.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ precedencegroup LowPrecedence {
associativity: none
lowerThan: AssignmentPrecedence
}
func %%%%<T,U>(x:T, y:U) -> Int { return 0 }
func %%%%<T, U>(x: T, y: U) -> Int { return 0 }

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

func foo() throws -> Int { return 0 }
func bar() throws -> Int { return 0 }
Expand Down
2 changes: 1 addition & 1 deletion test/Prototypes/GenericDispatch.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ protocol D : R {

// Dispatch to D's distance() requirement
// Only the author of D needs to see this implementation.
func ~> <I: D>(x:I, args: (_Distance, (I))) -> Int {
func ~> <I: D>(x: I, args: (_Distance, (I))) -> Int {
let other = args.1
return x.distance(other)
}
Expand Down
40 changes: 20 additions & 20 deletions test/SILOptimizer/bridged_casts_folding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ var nsDictString: NSDictionary = ["One":"One", "Two":"Two", "Three":"Three", "Fo
// CHECK: function_ref @_TTWu0_Rxs8HashablerGVs10Dictionaryxq__s21_ObjectiveCBridgeable10FoundationZFS1_26_forceBridgeFromObjectiveCfTwx15_ObjectiveCType6resultRGSqx__T_
// CHECK: return
@inline(never)
public func testForcedCastNStoSwiftDictInt() -> [Int:Int] {
var dict: [Int:Int] = forcedCast(nsDictInt)
public func testForcedCastNStoSwiftDictInt() -> [Int: Int] {
var dict: [Int: Int] = forcedCast(nsDictInt)
return dict
}

Expand All @@ -207,8 +207,8 @@ public func testForcedCastNStoSwiftDictInt() -> [Int:Int] {
// CHECK: function_ref @_TTWu0_Rxs8HashablerGVs10Dictionaryxq__s21_ObjectiveCBridgeable10FoundationZFS1_34_conditionallyBridgeFromObjectiveCfTwx15_ObjectiveCType6resultRGSqx__Sb
// CHECK: return
@inline(never)
public func testCondCastNStoSwiftDictInt() -> [Int:Int]? {
var dictOpt: [Int:Int]? = condCast(nsDictInt)
public func testCondCastNStoSwiftDictInt() -> [Int: Int]? {
var dictOpt: [Int: Int]? = condCast(nsDictInt)
return dictOpt
}

Expand All @@ -217,8 +217,8 @@ public func testCondCastNStoSwiftDictInt() -> [Int:Int]? {
// CHECK: function_ref @_TTWu0_Rxs8HashablerGVs10Dictionaryxq__s21_ObjectiveCBridgeable10FoundationZFS1_26_forceBridgeFromObjectiveCfTwx15_ObjectiveCType6resultRGSqx__T_
// CHECK: return
@inline(never)
public func testForcedCastNStoSwiftDictDouble() -> [Double:Double] {
var dict: [Double:Double] = forcedCast(nsDictDouble)
public func testForcedCastNStoSwiftDictDouble() -> [Double: Double] {
var dict: [Double: Double] = forcedCast(nsDictDouble)
return dict
}

Expand All @@ -227,8 +227,8 @@ public func testForcedCastNStoSwiftDictDouble() -> [Double:Double] {
// CHECK: function_ref @_TTWu0_Rxs8HashablerGVs10Dictionaryxq__s21_ObjectiveCBridgeable10FoundationZFS1_34_conditionallyBridgeFromObjectiveCfTwx15_ObjectiveCType6resultRGSqx__Sb
// CHECK: return
@inline(never)
public func testCondCastNStoSwiftDictDouble() -> [Double:Double]? {
var dictOpt: [Double:Double]? = condCast(nsDictDouble)
public func testCondCastNStoSwiftDictDouble() -> [Double: Double]? {
var dictOpt: [Double: Double]? = condCast(nsDictDouble)
return dictOpt
}

Expand All @@ -238,8 +238,8 @@ public func testCondCastNStoSwiftDictDouble() -> [Double:Double]? {
// CHECK: function_ref @_TTWu0_Rxs8HashablerGVs10Dictionaryxq__s21_ObjectiveCBridgeable10FoundationZFS1_26_forceBridgeFromObjectiveCfTwx15_ObjectiveCType6resultRGSqx__T_
// CHECK: return
@inline(never)
public func testForcedCastNStoSwiftDictString() -> [String:String] {
var dict: [String:String] = forcedCast(nsDictString)
public func testForcedCastNStoSwiftDictString() -> [String: String] {
var dict: [String: String] = forcedCast(nsDictString)
return dict
}

Expand All @@ -248,8 +248,8 @@ public func testForcedCastNStoSwiftDictString() -> [String:String] {
// CHECK: function_ref @_TTWu0_Rxs8HashablerGVs10Dictionaryxq__s21_ObjectiveCBridgeable10FoundationZFS1_34_conditionallyBridgeFromObjectiveCfTwx15_ObjectiveCType6resultRGSqx__Sb
// CHECK: return
@inline(never)
public func testCondCastNStoSwiftDictString() -> [String:String]? {
var dictOpt: [String:String]? = condCast(nsDictString)
public func testCondCastNStoSwiftDictString() -> [String: String]? {
var dictOpt: [String: String]? = condCast(nsDictString)
return dictOpt
}

Expand All @@ -258,8 +258,8 @@ public func testCondCastNStoSwiftDictString() -> [String:String]? {
// CHECK: function_ref @_TTWu0_Rxs8HashablerGVs10Dictionaryxq__s21_ObjectiveCBridgeable10FoundationZFS1_26_forceBridgeFromObjectiveCfTwx15_ObjectiveCType6resultRGSqx__T_
// CHECK: return
@inline(never)
public func testForcedCastNSDictStringtoSwiftDictInt() -> [Int:Int] {
var dictOpt: [Int:Int] = forcedCast(nsDictString)
public func testForcedCastNSDictStringtoSwiftDictInt() -> [Int: Int] {
var dictOpt: [Int: Int] = forcedCast(nsDictString)
return dictOpt
}

Expand All @@ -269,8 +269,8 @@ public func testForcedCastNSDictStringtoSwiftDictInt() -> [Int:Int] {
// CHECK: function_ref @_TTWu0_Rxs8HashablerGVs10Dictionaryxq__s21_ObjectiveCBridgeable10FoundationZFS1_34_conditionallyBridgeFromObjectiveCfTwx15_ObjectiveCType6resultRGSqx__Sb
// CHECK: return
@inline(never)
public func testCondCastNSDictStringtoSwiftDictInt() -> [Int:Int]? {
var dictOpt: [Int:Int]? = condCast(nsDictString)
public func testCondCastNSDictStringtoSwiftDictInt() -> [Int: Int]? {
var dictOpt: [Int: Int]? = condCast(nsDictString)
return dictOpt
}

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

// Check optimizations of casts from String to NSString

var swiftString:String = "string"
var swiftString: String = "string"

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

// Check optimization of casts from Swift Dict to NSDict

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

// CHECK-LABEL: sil [noinline] @_TF21bridged_casts_folding30testForcedCastSwiftToNSDictIntFT_CSo12NSDictionary
// CHECK-NOT: unconditional_checked
Expand Down
2 changes: 1 addition & 1 deletion test/SILOptimizer/cast_folding_objc_no_foundation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func testAnyObjectToArrayNotBridged(_ a: AnyObject) -> Bool {
// CHECK: checked_cast_addr_br take_always AnyObject in [[SOURCE]] : $*AnyObject to Dictionary<Int, String> in [[TARGET]] : $*Dictionary<Int, String>, bb1, bb2
@inline(never)
func testAnyObjectToDictionary(_ a: AnyObject) -> Bool {
return a is [Int:String]
return a is [Int: String]
}

// CHECK-LABEL: sil hidden [noinline] @_TTSf4g___TF31cast_folding_objc_no_foundation21testAnyObjectToStringFPs9AnyObject_Sb
Expand Down
2 changes: 1 addition & 1 deletion test/SILOptimizer/let_propagation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public func testAllocAndUseLet() -> Int32 {
// DISABLECHECK-NOT: load
// DISABLECHECK: return
@inline(never)
public func testUseLet(a:A0) -> Int32 {
public func testUseLet(a: A0) -> Int32 {
var counter: Int32
// a.x and a.y should be loaded only once.
counter = a.sum2() + a.sum2()
Expand Down
2 changes: 1 addition & 1 deletion test/SILOptimizer/unused_containers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func empty_array_test() {
//CHECK-NEXT: tuple
//CHECK-NEXT: return
func empty_dic_test() {
let unused : [Int:Int] = [:]
let unused : [Int: Int] = [:]
}

//CHECK-LABEL: sil hidden @_TF17unused_containers18unused_string_testFT_T_
Expand Down
2 changes: 1 addition & 1 deletion test/SourceKit/CursorInfo/cursor_info.swift
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func paramAutoclosureNoescape1(_ msg: ()->String) {}
func paramAutoclosureNoescape2(_ msg: @autoclosure ()->String) {}
func paramAutoclosureNoescape3(_ msg: @autoclosure @escaping ()->String) {}

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) {}
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) {}

protocol P3 {
func f(_ s: Self) -> Self
Expand Down
16 changes: 8 additions & 8 deletions test/stdlib/KVO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ class Observer : NSObject {
context: nil)
}

override func observeValue(forKeyPath:String?,
of obj:Any?,
change:Dictionary<NSKeyValueChangeKey, Any>?,
context:UnsafeMutableRawPointer?) {
override func observeValue(forKeyPath: String?,
of obj: Any?,
change: Dictionary<NSKeyValueChangeKey, Any>?,
context: UnsafeMutableRawPointer?) {
target!.print()
}
}
Expand Down Expand Up @@ -99,10 +99,10 @@ class ObserverKVO : NSObject {
context: &kvoContext)
}

override func observeValue(forKeyPath:String?,
of obj:Any?,
change:Dictionary<NSKeyValueChangeKey, Any>?,
context:UnsafeMutableRawPointer?) {
override func observeValue(forKeyPath: String?,
of obj: Any?,
change: Dictionary<NSKeyValueChangeKey, Any>?,
context: UnsafeMutableRawPointer?) {
if context == &kvoContext {
target!.print()
}
Expand Down
2 changes: 1 addition & 1 deletion validation-test/stdlib/Algorithm.swift
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ Algorithm.test("invalidOrderings") {
// The routine is based on http://www.cs.dartmouth.edu/~doug/mdmspe.pdf
func makeQSortKiller(_ len: Int) -> [Int] {
var candidate: Int = 0
var keys = [Int:Int]()
var keys = [Int: Int]()
func Compare(_ x: Int, y : Int) -> Bool {
if keys[x] == nil && keys[y] == nil {
if (x == candidate) {
Expand Down
4 changes: 2 additions & 2 deletions validation-test/stdlib/Sort.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ var Algorithm = TestSuite("Algorithm")
// check correctness of sorting itself.
func expectSortedCollection(_ sortedAry: [Int], _ originalAry: [Int]) {
expectEqual(sortedAry.count, originalAry.count)
var sortedVals = [Int:Int]()
var originalVals = [Int:Int]()
var sortedVals = [Int: Int]()
var originalVals = [Int: Int]()
// Keep track of what values we have in sortedAry.
for e in sortedAry {
if let v = sortedVals[e] {
Expand Down