diff --git a/CHANGELOG.md b/CHANGELOG.md index f13230df488e0..3fdf1906b6138 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,23 +26,23 @@ Swift 3.0 unsafeBitCast(nullablePointer, to: Int.self) ``` -* [SE-0046] (https://github.com/apple/swift-evolution/blob/master/proposals/0046-first-label.md) Function parameters now have consistent labelling across all function parameters. With this update the first parameter declarations will now match the existing behavior of the second and later parameters. This change makes the language simpler. +* [SE-0046] (https://github.com/apple/swift-evolution/blob/master/proposals/0046-first-label.md) Function parameters now have consistent labelling across all function parameters. With this update the first parameter declarations will now match the existing behavior of the second and later parameters. This change makes the language simpler. - Functions that were written and called as follows + Functions that were written and called as follows ```swift func foo(x: Int, y: Int) { } foo(1, y: 2) - + func bar(a a: Int, b: Int) { - } + } bar(a: 3, b: 4) ``` will now be written as (to achieve the same behavior): ```swift func foo(_ x: Int, y: Int) {} foo(1, y: 2) - func bar(a: Int, b: Int) {} + func bar(a: Int, b: Int) {} bar(a: 3, b: 4) ``` @@ -106,7 +106,7 @@ Swift 3.0 typealias StringDictionary = Dictionary typealias IntFunction = (T) -> Int typealias MatchingTriple = (T, T, T) - typealias BackwardTriple = (T3, T2, T1) + typealias BackwardTriple = (T3, T2, T1) ``` etc. @@ -176,7 +176,7 @@ Swift 2.2 The `typealias` keyword is still allowed (but deprecated and produces a warning) in Swift 2.2. This warning will become an error in Swift 3.0. -* Curried function syntax has been deprecated, and is slated to be removed in +* Curried function syntax has been deprecated, and is slated to be removed in Swift 3.0. * The `++` and `--` operators have been deprecated, and are slated to be removed in @@ -193,12 +193,12 @@ Swift 2.2 ``` should move to being written as: - + ```swift foo(x.0, x.b) ``` - For more information and rationale, see + For more information and rationale, see [SE-0029](https://github.com/apple/swift-evolution/blob/master/proposals/0029-remove-implicit-tuple-splat.md). * New `#file`, `#line`, `#column`, and `#function` expressions have been introduced to @@ -316,7 +316,7 @@ Swift 2.2 let buttonFactory = UIButton.init(type:) ``` - + For more information, see [SE-0021](https://github.com/apple/swift-evolution/blob/master/proposals/0021-generalized-naming.md). * There is a new build configuration function, `#if swift(>=x.y)`, which @@ -343,14 +343,14 @@ Swift 2.2 ```swift let sel = #selector(insertSubview(_:aboveSubview:)) // sel has type Selector ``` - + Along with this change, the use of string literals as selectors has been deprecated, e.g., ```swift let sel: Selector = "insertSubview:aboveSubview:" ``` - + Generally, such string literals should be replaced with uses of `#selector`, and the compiler will provide Fix-Its that use `#selector`. In cases where this is not possible (e.g., when referring @@ -360,7 +360,7 @@ Swift 2.2 ```swift let sel = Selector("propertyName") ``` - + Note that the compiler is now checking the string literals used to construct Selectors to ensure that they are well-formed Objective-C selectors and that there is an `@objc` method with that selector. @@ -889,8 +889,8 @@ Swift 2.2 value for the enum to be stored indirectly, allowing for recursive data structures to be defined. For example: - ```swift - enum List { + ```swift + enum List { case Nil indirect case Cons(head: T, tail: List) } @@ -1138,7 +1138,7 @@ Swift 2.2 needs to be written as: ```swift - var (a,b) : (Int, Float) = foo() + var (a, b) : (Int, Float) = foo() ``` if an explicit type annotation is needed. The former syntax was ambiguous @@ -1934,10 +1934,10 @@ Swift 2.2 2014-10-09 [Roughly Xcode 6.1, and Swift 1.1] ---------- -* `HeapBuffer`, `HeapBufferStorage`, and +* `HeapBuffer`, `HeapBufferStorage`, and `OnHeap` were never really useful, because their APIs were insufficiently public. They have been replaced with a single class, - `ManagedBuffer`. See also the new function + `ManagedBuffer`. See also the new function `isUniquelyReferenced(x)` which is often useful in conjunction with `ManagedBuffer`. @@ -3974,7 +3974,7 @@ Swift 2.2 ```swift func swap(a : @inout T, b : @inout T) { - (a,b) = (b,a) + (a, b) = (b, a) } ``` @@ -3982,7 +3982,7 @@ Swift 2.2 ```swift func swap(inout a : T, inout b : T) { - (a,b) = (b,a) + (a, b) = (b, a) } ``` diff --git a/benchmark/single-source/ArrayOfGenericPOD.swift b/benchmark/single-source/ArrayOfGenericPOD.swift index fe655866108c2..14842eff9b2db 100644 --- a/benchmark/single-source/ArrayOfGenericPOD.swift +++ b/benchmark/single-source/ArrayOfGenericPOD.swift @@ -53,7 +53,7 @@ struct S { } @inline(never) func genStructArray() { - _ = RefArray>(S(x:3,y:4)) + _ = RefArray>(S(x:3, y:4)) // should be a nop } diff --git a/benchmark/single-source/Prims.swift b/benchmark/single-source/Prims.swift index e8e421445eea6..b83d3164dbc44 100644 --- a/benchmark/single-source/Prims.swift +++ b/benchmark/single-source/Prims.swift @@ -183,7 +183,7 @@ extension Edge : Hashable { } } -func Prims(_ graph : Array, _ fun : (Int,Int)->Double) -> Array { +func Prims(_ graph : Array, _ fun : (Int, Int)->Double) -> Array { var treeEdges = Array(repeating:nil, count:graph.count) let queue = PriorityQueue(Num:graph.count) @@ -226,7 +226,7 @@ public func run_Prims(_ N: Int) { // Prim's algorithm is designed for undirected graphs. // Due to that, in our set all the edges are paired, i.e. for any - // edge (start,end,C) there is also an edge (end,start,C). + // edge (start, end, C) there is also an edge (end, start, C). let edges : [(Int, Int, Double)] = [ (26, 47, 921), (20, 25, 971), diff --git a/docs/ARCOptimization.rst b/docs/ARCOptimization.rst index 0237a8ecef53d..50edba8eaa08d 100644 --- a/docs/ARCOptimization.rst +++ b/docs/ARCOptimization.rst @@ -91,7 +91,7 @@ Definitions ----------- Let ``I`` be a SIL instruction with n operands and m results. We say that ``I`` -is a (i,j) RC Identity preserving instruction if performing a ``retain_value`` +is a (i, j) RC Identity preserving instruction if performing a ``retain_value`` on the ith SSA argument immediately before ``I`` is executed is equivalent to performing a ``retain_value`` on the jth SSA result of ``I`` immediately following the execution of ``I``. For example in the following, if:: @@ -118,7 +118,7 @@ such that: - ``%a`` is the jth result of ``I``. - ``%b`` is the ith argument of ``I``. -- ``I`` is (i,j) RC identity preserving. +- ``I`` is (i, j) RC identity preserving. Due to the nature of SSA form, we can not even speak of symmetry or reflexivity. But we do get transitivity! Easily if ``%b ~rci %a`` and ``%c ~rci diff --git a/docs/ErrorHandling.rst b/docs/ErrorHandling.rst index 74dadb48bdca8..cdf32074f0336 100644 --- a/docs/ErrorHandling.rst +++ b/docs/ErrorHandling.rst @@ -637,7 +637,7 @@ can be done in a fairly simple way: a function can declare that it throws if any of a set of named arguments do. As an example (using strawman syntax):: - func map(_ array: [T], fn: T -> U) throwsIf(fn) -> [U] { + func map(_ array: [T], fn: T -> U) throwsIf(fn) -> [U] { ... } diff --git a/docs/ErrorHandlingRationale.rst b/docs/ErrorHandlingRationale.rst index 4c0fd0961af69..f28bbefbe00a8 100644 --- a/docs/ErrorHandlingRationale.rst +++ b/docs/ErrorHandlingRationale.rst @@ -1458,7 +1458,7 @@ done in a fairly simple way: a function can declare that it throws if any of a set of named arguments do. As an example (using strawman syntax):: - func map(_ array: [T], fn: T throws -> U) throwsIf(fn) -> [U] { + func map(_ array: [T], fn: T throws -> U) throwsIf(fn) -> [U] { ... } diff --git a/docs/HighLevelSILOptimizations.rst b/docs/HighLevelSILOptimizations.rst index 85e1d49d525cb..8375a8806e687 100644 --- a/docs/HighLevelSILOptimizations.rst +++ b/docs/HighLevelSILOptimizations.rst @@ -249,7 +249,7 @@ interferes-with guards If ``OpA`` guards ``OpB``, then the sequence of operations - ``OpA,OpB`` must be preserved on any control flow path on which the + ``OpA, OpB`` must be preserved on any control flow path on which the sequence originally appears. An operation can only interfere-with or guard another if they may operate on the same Array. diff --git a/docs/PatternMatching.rst b/docs/PatternMatching.rst index 80e02ce635cb6..25e493e69a7dc 100644 --- a/docs/PatternMatching.rst +++ b/docs/PatternMatching.rst @@ -206,7 +206,7 @@ see the pattern grammar):: case (0, var y): return 1 case (var x, var y) - return foo(x-1,y) + foo(x,y-1) + return foo(x - 1, y) + foo(x, y - 1) } It's tempting to just say that an unsound name binding (i.e. a name @@ -401,7 +401,7 @@ The current Swift approximation is:: func length(_ list : List) : Int { switch list { case .nil: return 0 - case .cons(_,var tail): return 1 + length(tail) + case .cons(_, var tail): return 1 + length(tail) } } @@ -410,7 +410,7 @@ function body. We could remove those with something like this:: func length(_ list : List) : Int = switch list { case .nil: return 0 - case .cons(_,var tail): return 1 + length(tail) + case .cons(_, var tail): return 1 + length(tail) } Anyway, that's easy to add later if we see the need. diff --git a/docs/SIL.rst b/docs/SIL.rst index 0da3141b778ca..1ee1089175c7d 100644 --- a/docs/SIL.rst +++ b/docs/SIL.rst @@ -306,13 +306,13 @@ unrestricted type, it is lowered as if the pattern were replaced with a type sharing the same structure but replacing all materializable types with fresh type variables. -For example, if ``g`` has type ``Generator<(Int,Int) -> Float>``, ``g.fn`` is -lowered using the pattern ``() -> T``, which eventually causes ``(Int,Int) +For example, if ``g`` has type ``Generator<(Int, Int) -> Float>``, ``g.fn`` is +lowered using the pattern ``() -> T``, which eventually causes ``(Int, Int) -> Float`` to be lowered using the pattern ``T``, which is the same as lowering it with the pattern ``U -> V``; the result is that ``g.fn`` has the following lowered type:: - @callee_owned () -> @owned @callee_owned (@in (Int,Int)) -> @out Float. + @callee_owned () -> @owned @callee_owned (@in (Int, Int)) -> @out Float. As another example, suppose that ``h`` has type ``Generator<(Int, inout Int) -> Float>``. Neither ``(Int, inout Int)`` diff --git a/docs/StringDesign.rst b/docs/StringDesign.rst index 65dc90a6cec1c..e48625ca7f94b 100644 --- a/docs/StringDesign.rst +++ b/docs/StringDesign.rst @@ -744,7 +744,7 @@ Indexing doSomethingWith(\ **someString[i]**\ ) } - var (i,j) = **someString.indices().bounds** + var (i, j) = **someString.indices().bounds** while (i != j) { doSomethingElseWith(\ **someString[i]**\ ) ++i @@ -981,7 +981,7 @@ Building :Swift: .. parsed-literal:: func **+** (lhs: String, rhs: String) -> String - func [infix,assignment] **+=** (lhs: [inout] String, rhs: String) + func [infix, assignment] **+=** (lhs: [inout] String, rhs: String) func **append**\ (_ suffix: String) diff --git a/docs/proposals/Accessors.rst b/docs/proposals/Accessors.rst index 6c218aaebf651..0c33781992681 100644 --- a/docs/proposals/Accessors.rst +++ b/docs/proposals/Accessors.rst @@ -168,7 +168,7 @@ Unnecessary subobject accesses The first is that they may load or store more than is necessary. -As an obvious example, imagine a variable of type ``(Int,Int)``; even +As an obvious example, imagine a variable of type ``(Int, Int)``; even if my code only accesses the first element of the tuple, full-value accesses force me to read or write the second element as well. That means that, even if I'm purely overwriting the first element, I @@ -177,7 +177,7 @@ value to use for the second element when performing the full-value store. Additionally, while unnecessarily loading the second element of an -``(Int,Int)`` pair might seem trivial, consider that the tuple could +``(Int, Int)`` pair might seem trivial, consider that the tuple could actually have twenty elements, or that the second element might be non-trivial to copy (e.g. if it's a retainable pointer). diff --git a/docs/proposals/Concurrency.rst b/docs/proposals/Concurrency.rst index 89e4bc5675fe5..e27d6c692aa5e 100644 --- a/docs/proposals/Concurrency.rst +++ b/docs/proposals/Concurrency.rst @@ -584,14 +584,14 @@ code runs significantly faster. var product = Matrix(A.size) // Extract 4 quarters from matrices A and B. let half = A.size/2 - let A11 = A.slice(half ,0 , 0) - let A12 = A.slice(half ,0 , half) - let A21 = A.slice(half ,half, 0) - let A22 = A.slice(half ,half, half) - let B11 = B.slice(half ,0 , 0) - let B12 = B.slice(half ,0 , half) - let B21 = B.slice(half ,half, 0) - let B22 = B.slice(half ,half, half) + let A11 = A.slice(half, 0, 0) + let A12 = A.slice(half, 0, half) + let A21 = A.slice(half, half, 0) + let A22 = A.slice(half, half, half) + let B11 = B.slice(half, 0, 0) + let B12 = B.slice(half, 0, half) + let B21 = B.slice(half, half, 0) + let B22 = B.slice(half, half, half) // Multiply each of the sub blocks. let C11_1 = async((A11, B11), callback: ParallelMatMul) @@ -610,8 +610,8 @@ code runs significantly faster. let C22 = C22_1.await() + C22_2.await() // Save the matrix slices into the correct locations. - product.update(C11, 0 , 0) - product.update(C12, 0 , half) + product.update(C11, 0, 0) + product.update(C12, 0, half) product.update(C21, half, 0) product.update(C22, half, half) return product diff --git a/docs/proposals/InoutCOWOptimization.rst b/docs/proposals/InoutCOWOptimization.rst index 1d76914a64a4b..eb353fedecada 100644 --- a/docs/proposals/InoutCOWOptimization.rst +++ b/docs/proposals/InoutCOWOptimization.rst @@ -52,7 +52,7 @@ could be written as follows: ... @mutating func quickSort(_ compare: (StreamType.Element, StreamType.Element) -> Bool) { - let (start,end) = (startIndex, endIndex) + let (start, end) = (startIndex, endIndex) if start != end && start.succ() != end { let pivot = self[start] let mid = partition({compare($0, pivot)}) diff --git a/docs/proposals/archive/MemoryAndConcurrencyModel.rst b/docs/proposals/archive/MemoryAndConcurrencyModel.rst index 983798c13c140..acbfbb62004d2 100644 --- a/docs/proposals/archive/MemoryAndConcurrencyModel.rst +++ b/docs/proposals/archive/MemoryAndConcurrencyModel.rst @@ -54,7 +54,7 @@ definition. These kinds are: compiler rejects) immutable data that is pointing to mutable data. For example:: - struct [immutable,inout] IList { data : int, next : List } + struct [immutable, inout] IList { data : int, next : List } ... var a = IList(1, IList(2, IList(3, nil))) ... diff --git a/include/swift/SIL/SILInstruction.h b/include/swift/SIL/SILInstruction.h index 9b67b5d0ee6a9..405e8d360374e 100644 --- a/include/swift/SIL/SILInstruction.h +++ b/include/swift/SIL/SILInstruction.h @@ -788,7 +788,7 @@ class ApplyInstBase protected: template ApplyInstBase(As &&...args) - : ApplyInstBase(std::forward(args)...) {} + : ApplyInstBase(std::forward(args)...) {} public: using super::getCallee; diff --git a/lib/Sema/CodeSynthesis.cpp b/lib/Sema/CodeSynthesis.cpp index 15068ecd663a3..9898bf4ea5601 100644 --- a/lib/Sema/CodeSynthesis.cpp +++ b/lib/Sema/CodeSynthesis.cpp @@ -2142,7 +2142,7 @@ void TypeChecker::addImplicitDestructor(ClassDecl *CD) { typeCheckDecl(DD, /*isFirstPass=*/true); // Create an empty body for the destructor. - DD->setBody(BraceStmt::create(Context, CD->getLoc(), { }, CD->getLoc(),true)); + DD->setBody(BraceStmt::create(Context, CD->getLoc(), { }, CD->getLoc(), true)); CD->addMember(DD); CD->setHasDestructor(); } diff --git a/lib/Sema/TypeCheckDecl.cpp b/lib/Sema/TypeCheckDecl.cpp index 47651f422f766..af043cb6e63aa 100644 --- a/lib/Sema/TypeCheckDecl.cpp +++ b/lib/Sema/TypeCheckDecl.cpp @@ -4050,7 +4050,7 @@ class DeclChecker : public DeclVisitor { // If we found both, point at them. if (prefixOp) { - TC.diagnose(prefixOp, diag::unary_operator_declaration_here,false) + TC.diagnose(prefixOp, diag::unary_operator_declaration_here, false) .fixItInsert(FD->getLoc(), "prefix "); TC.diagnose(postfixOp, diag::unary_operator_declaration_here, true) .fixItInsert(FD->getLoc(), "postfix "); diff --git a/stdlib/private/StdlibCollectionUnittest/CheckMutableCollectionType.swift.gyb b/stdlib/private/StdlibCollectionUnittest/CheckMutableCollectionType.swift.gyb index 9672d18b215a8..c8cc33036a59a 100644 --- a/stdlib/private/StdlibCollectionUnittest/CheckMutableCollectionType.swift.gyb +++ b/stdlib/private/StdlibCollectionUnittest/CheckMutableCollectionType.swift.gyb @@ -50,7 +50,7 @@ public let partitionExhaustiveTests = [ PartitionExhaustiveTest([ 10, 20, 30, 40, 50, 60, 70 ]), ] -public func withInvalidOrderings(_ body: ((Int,Int) -> Bool) -> Void) { +public func withInvalidOrderings(_ body: ((Int, Int) -> Bool) -> Void) { // Test some ordering predicates that don't create strict weak orderings body { (_,_) in true } body { (_,_) in false } diff --git a/stdlib/private/StdlibUnittest/StdlibUnittest.swift.gyb b/stdlib/private/StdlibUnittest/StdlibUnittest.swift.gyb index 3a5d8e64402d4..6ba2dad3334c4 100644 --- a/stdlib/private/StdlibUnittest/StdlibUnittest.swift.gyb +++ b/stdlib/private/StdlibUnittest/StdlibUnittest.swift.gyb @@ -161,7 +161,7 @@ public func expectationFailure( } public func expectEqual( - _ expected: T, _ actual: T, ${TRACE}, sameValue equal: (T,T) -> Bool + _ expected: T, _ actual: T, ${TRACE}, sameValue equal: (T, T) -> Bool ) { if !equal(expected, actual) { expectationFailure( @@ -190,7 +190,7 @@ public func expectOptionalEqual( } public func expectOptionalEqual( - _ expected: T, _ actual: T?, ${TRACE}, sameValue equal: (T,T) -> Bool + _ expected: T, _ actual: T?, ${TRACE}, sameValue equal: (T, T) -> Bool ) { if (actual == nil) || !equal(expected, actual!) { expectationFailure( @@ -2265,8 +2265,8 @@ public func check${traversal}Collection< checkRandomAccessIndex( instances, distances: distances, - distanceOracle: { (x:Int,y:Int) in Distance(IntMax(y - x)) }, - advanceOracle: { x,y in nextN(distances[y], instances[x]) }, + distanceOracle: { (x: Int, y: Int) in Distance(IntMax(y - x)) }, + advanceOracle: { x, y in nextN(distances[y], instances[x]) }, startIndex: collection.startIndex, endIndex: next5(partWay1), ${trace}) % end diff --git a/stdlib/public/SDK/Foundation/NSStringAPI.swift b/stdlib/public/SDK/Foundation/NSStringAPI.swift index 7be5673d4a2cd..b8085b4750812 100644 --- a/stdlib/public/SDK/Foundation/NSStringAPI.swift +++ b/stdlib/public/SDK/Foundation/NSStringAPI.swift @@ -1686,7 +1686,7 @@ extension String { /// /// Locale-independent case-insensitive operation, and other needs, /// can be achieved by calling - /// `rangeOfString(_:options:_,range:_locale:_)`. + /// `rangeOfString(_:options:_, range:_locale:_)`. /// /// Equivalent to /// diff --git a/stdlib/public/SDK/simd/simd.swift.gyb b/stdlib/public/SDK/simd/simd.swift.gyb index c7c2522ae11f1..4b0ae41eb6ab7 100644 --- a/stdlib/public/SDK/simd/simd.swift.gyb +++ b/stdlib/public/SDK/simd/simd.swift.gyb @@ -280,7 +280,7 @@ public func abs(_ x: ${vectype}) -> ${vectype} { @warn_unused_result public func min(_ x: ${vectype}, _ y: ${vectype}) -> ${vectype} { return ${vectype}(${', '.join(map(lambda c: \ - 'min(x.' + c + ',y.' + c + ')', \ + 'min(x.' + c + ', y.' + c + ')', \ component[:size]))}) } @@ -290,7 +290,7 @@ public func min(_ x: ${vectype}, _ y: ${vectype}) -> ${vectype} { @warn_unused_result public func max(_ x: ${vectype}, _ y: ${vectype}) -> ${vectype} { return ${vectype}(${', '.join(map(lambda c: \ - 'max(x.' + c + ',y.' + c + ')', \ + 'max(x.' + c + ', y.' + c + ')', \ component[:size]))}) } @@ -472,21 +472,21 @@ public func smoothstep(_ x: ${vectype}, edge1: ${vectype}) -> ${vectype} { let t = clamp((x-edge0)/(edge1-edge0), min: 0, max: 1) - return t*t*(${vectype}(3) - 2*t) + return t * t * (${vectype}(3) - 2 * t) } /// Dot product of `x` and `y`. @inline(__always) @warn_unused_result public func dot(_ x: ${vectype}, _ y: ${vectype}) -> ${type} { - return reduce_add(x*y) + return reduce_add(x * y) } /// Projection of `x` onto `y`. @inline(__always) @warn_unused_result public func project(_ x: ${vectype}, _ y: ${vectype}) -> ${vectype} { - return dot(x,y)/dot(y,y)*y + return dot(x, y) / dot(y, y) * y } /// Length of `x`, squared. This is more efficient to compute than the length, @@ -504,7 +504,7 @@ public func project(_ x: ${vectype}, _ y: ${vectype}) -> ${vectype} { @inline(__always) @warn_unused_result public func length_squared(_ x: ${vectype}) -> ${type} { - return dot(x,x) + return dot(x, x) } /// Length (two-norm or "Euclidean norm") of `x`. @@ -555,7 +555,7 @@ public func normalize(_ x: ${vectype}) -> ${vectype} { @inline(__always) @warn_unused_result public func reflect(_ x: ${vectype}, n: ${vectype}) -> ${vectype} { - return x - 2*dot(x,n)*n + return x - 2 * dot(x, n) * n } /// The refraction direction given unit incident vector `x`, unit surface @@ -568,8 +568,8 @@ public func refract(_ x: ${vectype}, n: ${vectype}, eta: ${type}) -> ${vectype} { - let k = 1 - eta*eta*(1 - dot(x,n)*dot(x,n)) - if k >= 0 { return eta*x - (eta*dot(x,n) + sqrt(k))*n } + let k = 1 - eta * eta * (1 - dot(x, n) * dot(x, n)) + if k >= 0 { return eta * x - (eta * dot(x, n) + sqrt(k)) * n } return ${vectype}(0) } diff --git a/stdlib/public/core/FixedPoint.swift.gyb b/stdlib/public/core/FixedPoint.swift.gyb index 8d2cb801ba755..03ac6fd7d36e4 100644 --- a/stdlib/public/core/FixedPoint.swift.gyb +++ b/stdlib/public/core/FixedPoint.swift.gyb @@ -409,7 +409,7 @@ extension ${Self} : RandomAccessIndex { // Operations that return an overflow bit in addition to a partial result, // helpful for checking for overflow when you want to handle it. extension ${Self} { -% for Method,op in [('add', 'add'), ('subtract', 'sub'), ('multiply', 'mul')]: +% for Method, op in [('add', 'add'), ('subtract', 'sub'), ('multiply', 'mul')]: /// ${Method.capitalize()} `lhs` and `rhs`, returning a result and a /// `Bool` that is `true` iff the operation caused an arithmetic /// overflow. @@ -420,7 +420,7 @@ extension ${Self} { } % end -% for Method,op in [('divide', 'div'), ('remainder', 'rem')]: +% for Method, op in [('divide', 'div'), ('remainder', 'rem')]: /// Divide `lhs` and `rhs`, returning /// ${'a result' if op == 'div' else 'the remainder'} and a `Bool` /// that is `true` iff the operation caused an arithmetic overflow. @@ -539,7 +539,7 @@ extension ${Self} { // FIXME: must use condfail in these operators, rather than // overflowChecked, pending so that we don't // foil static checking for numeric overflows. -% for op,method in ('+','add'), ('*','mul'), ('-','sub'): +% for op, method in ('+','add'), ('*','mul'), ('-','sub'): @_transparent public func ${op} (lhs: ${Self}, rhs: ${Self}) -> ${Self} { let (result, error) = Builtin.${sign}${method}_with_overflow_${BuiltinName}( @@ -550,7 +550,7 @@ public func ${op} (lhs: ${Self}, rhs: ${Self}) -> ${Self} { } % end -% for op,inst in [('/', 'div'), ('%', 'rem')]: +% for op, inst in [('/', 'div'), ('%', 'rem')]: @_transparent public func ${op}(lhs: ${Self}, rhs: ${Self}) -> ${Self} { Builtin.condfail((rhs == 0)._value) @@ -573,8 +573,8 @@ public prefix func ~(rhs: ${Self}) -> ${Self} { % for op, name in ( % ('==','eq'), ('!=','ne'), -% ('<',sign+'lt'), ('<=',sign+'le'), -% ('>',sign+'gt'), ('>=',sign+'ge')): +% ('<', sign + 'lt'), ('<=', sign + 'le'), +% ('>', sign + 'gt'), ('>=', sign + 'ge')): @_transparent public func ${op} (lhs: ${Self}, rhs: ${Self}) -> Bool { return Bool(Builtin.cmp_${name}_${BuiltinName}(lhs._value, rhs._value)) diff --git a/stdlib/public/core/FloatingPoint.swift.gyb b/stdlib/public/core/FloatingPoint.swift.gyb index 69a6f83feee9f..be20ac88377ca 100644 --- a/stdlib/public/core/FloatingPoint.swift.gyb +++ b/stdlib/public/core/FloatingPoint.swift.gyb @@ -33,7 +33,7 @@ builtinIntLiteralBits = 2048 def allInts(): for bits in allIntBits: for signed in False, True: - yield bits,signed + yield bits, signed def baseIntName(name): return 'Int' if name == 'Int' else 'Int' + str(name) diff --git a/stdlib/public/core/HashedCollections.swift.gyb b/stdlib/public/core/HashedCollections.swift.gyb index b6a83f1062ef3..49eb12469908e 100644 --- a/stdlib/public/core/HashedCollections.swift.gyb +++ b/stdlib/public/core/HashedCollections.swift.gyb @@ -3383,7 +3383,7 @@ internal enum _Variant${Self}Storage<${TypeParametersDecl}> : _HashStorage { let idealBucket = nativeStorage._bucket(nativeStorage.key(at: b)) // Does this element belong between start and hole? We need - // two separate tests depending on whether [start,hole] wraps + // two separate tests depending on whether [start, hole] wraps // around the end of the buffer let c0 = idealBucket >= start let c1 = idealBucket <= hole @@ -3772,7 +3772,7 @@ elif Self == 'Dictionary': /// /// 2. Subscripting with an index, yielding a key-value pair: /// -/// (k,v) = d[i]""" +/// (k, v) = d[i]""" }% ${SubscriptingWithIndexDoc} diff --git a/stdlib/public/core/HeapBuffer.swift b/stdlib/public/core/HeapBuffer.swift index 168b7692ad8a7..e3efff9b554e5 100644 --- a/stdlib/public/core/HeapBuffer.swift +++ b/stdlib/public/core/HeapBuffer.swift @@ -45,14 +45,14 @@ class _HeapBufferStorage : NonObjectiveCBase { public override init() {} /// The type used to actually manage instances of - /// `_HeapBufferStorage`. + /// `_HeapBufferStorage`. typealias Buffer = _HeapBuffer deinit { Buffer(self)._value.deinitialize() } @warn_unused_result - final func __getInstanceSizeAndAlignMask() -> (Int,Int) { + final func __getInstanceSizeAndAlignMask() -> (Int, Int) { return Buffer(self)._allocatedSizeAndAlignMask() } } @@ -139,7 +139,7 @@ struct _HeapBuffer : Equatable { } public // @testable - init(_ storage: _HeapBufferStorage) { + init(_ storage: _HeapBufferStorage) { self._storage = Builtin.castToNativeObject(storage) } diff --git a/stdlib/public/core/IntegerArithmetic.swift.gyb b/stdlib/public/core/IntegerArithmetic.swift.gyb index fb8b8b051bcea..7af338109c059 100644 --- a/stdlib/public/core/IntegerArithmetic.swift.gyb +++ b/stdlib/public/core/IntegerArithmetic.swift.gyb @@ -31,7 +31,7 @@ integerBinaryOps = [ /// be satisfied by types conforming to that protocol. @_show_in_interface public protocol _IntegerArithmetic { -% for name,_,Action,result in integerBinaryOps: +% for name, _, Action, result in integerBinaryOps: /// ${Action} `lhs` and `rhs`, returning ${result} and a `Bool` that is /// `true` iff the operation caused an arithmetic overflow. static func ${name}WithOverflow(_ lhs: Self, _ rhs: Self) -> (Self, overflow: Bool) @@ -42,7 +42,7 @@ public protocol _IntegerArithmetic { public protocol IntegerArithmetic : _IntegerArithmetic, Comparable { // Checked arithmetic functions. Specific implementations in // FixedPoint.swift.gyb support static checking for integer types. -% for name,op,Action,result in integerBinaryOps: +% for name, op, Action, result in integerBinaryOps: /// ${Action} `lhs` and `rhs`, returning ${result} and trapping in case of /// arithmetic overflow (except in -Ounchecked builds). @warn_unused_result @@ -55,7 +55,7 @@ public protocol IntegerArithmetic : _IntegerArithmetic, Comparable { func toIntMax() -> IntMax } -% for name,op,Action,result in integerBinaryOps: +% for name, op, Action, result in integerBinaryOps: /// ${Action} `lhs` and `rhs`, returning ${result} and trapping in case of /// arithmetic overflow (except in -Ounchecked builds). @_transparent diff --git a/stdlib/public/core/IntegerParsing.swift.gyb b/stdlib/public/core/IntegerParsing.swift.gyb index e847f98837159..43f366ca8c37d 100644 --- a/stdlib/public/core/IntegerParsing.swift.gyb +++ b/stdlib/public/core/IntegerParsing.swift.gyb @@ -132,7 +132,7 @@ extension ${Self} { if let value = _parseAsciiAs${'' if signed else 'U'}IntMax( text.utf16, radix, ${'' if signed else 'U'}IntMax(${Self}.max)) { self.init( - ${'' if Self in (IntMax,UIntMax) else 'truncatingBitPattern:'} value) + ${'' if Self in (IntMax, UIntMax) else 'truncatingBitPattern:'} value) } else { return nil diff --git a/stdlib/public/core/ManagedBuffer.swift b/stdlib/public/core/ManagedBuffer.swift index 2a5e466e396ef..28d2cb02b90e9 100644 --- a/stdlib/public/core/ManagedBuffer.swift +++ b/stdlib/public/core/ManagedBuffer.swift @@ -20,7 +20,7 @@ public class NonObjectiveCBase { public init() {} } -/// A base class of `ManagedBuffer`, used during +/// A base class of `ManagedBuffer`, used during /// instance creation. /// /// During instance creation, in particular during @@ -35,7 +35,7 @@ public class ManagedProtoBuffer : NonObjectiveCBase { /// idea to store this information in the "value" area when /// an instance is created. public final var capacity: Int { - let p = ManagedBufferPointer(self) + let p = ManagedBufferPointer(self) return p.capacity } @@ -102,7 +102,7 @@ public class ManagedBuffer initialValue: (ManagedProtoBuffer) -> Value ) -> ManagedBuffer { - let p = ManagedBufferPointer( + let p = ManagedBufferPointer( bufferClass: self, minimumCapacity: minimumCapacity, initialValue: { buffer, _ in @@ -146,7 +146,7 @@ public class ManagedBuffer /// -------------------- /// /// class MyBuffer { // non-@objc -/// typealias Manager = ManagedBufferPointer<(Int,String), Element> +/// typealias Manager = ManagedBufferPointer<(Int, String), Element> /// deinit { /// Manager(unsafeBufferObject: self).withUnsafeMutablePointers { /// (pointerToValue, pointerToElements) -> Void in diff --git a/stdlib/public/core/Mirror.swift b/stdlib/public/core/Mirror.swift index f04d93737b9a4..04c1a889e9b95 100644 --- a/stdlib/public/core/Mirror.swift +++ b/stdlib/public/core/Mirror.swift @@ -701,7 +701,7 @@ public protocol CustomPlaygroundQuickLookable { /// /// struct IntPairs { /// var elements: [(Int, Int)] -/// init(_ pairs: DictionaryLiteral) { +/// init(_ pairs: DictionaryLiteral) { /// elements = Array(pairs) /// } /// } diff --git a/stdlib/public/core/StringBuffer.swift b/stdlib/public/core/StringBuffer.swift index b10746b8c4d41..2a2fc78ccd36b 100644 --- a/stdlib/public/core/StringBuffer.swift +++ b/stdlib/public/core/StringBuffer.swift @@ -43,7 +43,7 @@ struct _StringBufferIVars { } // FIXME: Wanted this to be a subclass of -// _HeapBuffer<_StringBufferIVars,UTF16.CodeUnit>, but +// _HeapBuffer<_StringBufferIVars, UTF16.CodeUnit>, but // (Can't call static method of derived // class of generic class with dependent argument type) prevents it. public struct _StringBuffer { diff --git a/stdlib/public/runtime/Reflection.mm b/stdlib/public/runtime/Reflection.mm index 11f848c70f924..747c46407be1b 100644 --- a/stdlib/public/runtime/Reflection.mm +++ b/stdlib/public/runtime/Reflection.mm @@ -933,9 +933,9 @@ void swift_ObjCMirror_subscript(String *outString, #error __USER_LABEL_PREFIX__ is undefined #endif -#define GLUE_EXPANDED(a,b) a##b -#define GLUE(a,b) GLUE_EXPANDED(a,b) -#define SYMBOL_NAME(name) GLUE(__USER_LABEL_PREFIX__,name) +#define GLUE_EXPANDED(a, b) a##b +#define GLUE(a, b) GLUE_EXPANDED(a, b) +#define SYMBOL_NAME(name) GLUE(__USER_LABEL_PREFIX__, name) #define QUOTE_EXPANDED(literal) #literal #define QUOTE(literal) QUOTE_EXPANDED(literal) diff --git a/test/1_stdlib/BridgeStorage.swift.gyb b/test/1_stdlib/BridgeStorage.swift.gyb index cd73a6dc143d0..7c79cd52b3856 100644 --- a/test/1_stdlib/BridgeStorage.swift.gyb +++ b/test/1_stdlib/BridgeStorage.swift.gyb @@ -120,7 +120,7 @@ var unTaggedNSString : NSString { % for Self in ['_BridgeStorage']: allTests.test("${Self}") { - typealias B = ${Self} + typealias B = ${Self} let oy: NSString = "oy" expectTrue(B(objC: oy).objCInstance == oy) diff --git a/test/1_stdlib/Tuple.swift.gyb b/test/1_stdlib/Tuple.swift.gyb index 407f6c38f0ac5..5093157681f94 100644 --- a/test/1_stdlib/Tuple.swift.gyb +++ b/test/1_stdlib/Tuple.swift.gyb @@ -18,7 +18,7 @@ var TupleTestSuite = TestSuite("Tuple") % maxArity = 6 # the highest arity the operators are defined for func testEquality( - _ lhs: (A,B,C), equal: Bool, to rhs: (A,B,C), + _ lhs: (A, B, C), equal: Bool, to rhs: (A, B, C), //===--- TRACE boilerplate ----------------------------------------------===// @autoclosure _ message: ()->String = "", showFrame: Bool = true, @@ -92,7 +92,7 @@ enum Ordering : Equatable { } func testOrdering( - _ lhs: (A,B,C), _ ordering: Ordering, _ rhs: (A, B, C), + _ lhs: (A, B, C), _ ordering: Ordering, _ rhs: (A, B, C), //===--- TRACE boilerplate ----------------------------------------------===// @autoclosure _ message: ()->String = "", showFrame: Bool = true, diff --git a/test/1_stdlib/simd.swift.gyb b/test/1_stdlib/simd.swift.gyb index a21ad0052e91c..7752fde13381a 100644 --- a/test/1_stdlib/simd.swift.gyb +++ b/test/1_stdlib/simd.swift.gyb @@ -316,9 +316,9 @@ simdTestSuite.test("matrix elements") { ${mat}[i] = ${type}(i+1)*${basis}[i] } expectEqual( - ${mat}, ${mattype}(diagonal:${range(1,diagsize+1)}), sameValue: same) + ${mat}, ${mattype}(diagonal:${range(1, diagsize + 1)}), sameValue: same) for i in 0..<${cols} { - expectEqual(${mat}[i], ${type}(i+1)*${basis}[i], sameValue: same) + expectEqual(${mat}[i], ${type}(i + 1)*${basis}[i], sameValue: same) } // Check getting and setting elements (and transpose). diff --git a/test/IRGen/argument_attrs.sil b/test/IRGen/argument_attrs.sil index 0616b511beb11..e8755fbed5d59 100644 --- a/test/IRGen/argument_attrs.sil +++ b/test/IRGen/argument_attrs.sil @@ -2,7 +2,7 @@ import Builtin -struct Huge { var x,y,z,w,a,b,c,d: Builtin.Int32 } +struct Huge { var x, y, z, w, a, b, c, d: Builtin.Int32 } // CHECK-LABEL: define{{( protected)?}} void @arguments_in_def(i32* nocapture dereferenceable(4), i32* noalias nocapture dereferenceable(4), i32* noalias nocapture dereferenceable(4), %V14argument_attrs4Huge* noalias nocapture dereferenceable(32), %swift.opaque* noalias nocapture, %swift.opaque* noalias nocapture, %swift.type* %T) sil @arguments_in_def : $@convention(thin) (@inout Builtin.Int32, @in Builtin.Int32, @in_guaranteed Builtin.Int32, Huge, @in T, @in ()) -> () { diff --git a/test/IRGen/generic_classes.sil b/test/IRGen/generic_classes.sil index 9a32622430851..50691f343d37f 100644 --- a/test/IRGen/generic_classes.sil +++ b/test/IRGen/generic_classes.sil @@ -163,7 +163,7 @@ class GenericInheritsGeneric : RootGeneric { override init() } -sil @_TFC15generic_classes22GenericInheritsGenericD : $@convention(method) (GenericInheritsGeneric) -> () +sil @_TFC15generic_classes22GenericInheritsGenericD : $@convention(method) (GenericInheritsGeneric) -> () sil @_TFC15generic_classes22GenericInheritsGeneric7zippityU___fGS0_Q_Q0__FT_T_ : $@convention(method) (@guaranteed GenericInheritsGeneric) -> () @@ -200,7 +200,7 @@ class RecursiveGenericInheritsGeneric : RootGeneric { override init() } sil_vtable RecursiveGenericInheritsGeneric {} -sil @_TFC15generic_classes31RecursiveGenericInheritsGenericD : $@convention(method) (RecursiveGenericInheritsGeneric) -> () +sil @_TFC15generic_classes31RecursiveGenericInheritsGenericD : $@convention(method) (RecursiveGenericInheritsGeneric) -> () // CHECK: define{{( protected)?}} [[ROOTGENERIC]]* @RootGeneric_fragile_dependent_alloc diff --git a/test/IRGen/objc_simd.sil b/test/IRGen/objc_simd.sil index 8ec64e3dc9d3f..e346dfa59f4db 100644 --- a/test/IRGen/objc_simd.sil +++ b/test/IRGen/objc_simd.sil @@ -5,7 +5,7 @@ import simd // Work around rdar://problem/20577079 with a Swift function that touches all // the fields of float4, forcing it to be validated. -func forceStuff(x: float4, y: float3) -> (Float,Float,Float,Float) { +func forceStuff(x: float4, y: float3) -> (Float, Float, Float, Float) { if true { return (y.x, y.y, y.z, y.x) } else { diff --git a/test/IRGen/sil_witness_methods.sil b/test/IRGen/sil_witness_methods.sil index e40dc626b7097..489bac5366991 100644 --- a/test/IRGen/sil_witness_methods.sil +++ b/test/IRGen/sil_witness_methods.sil @@ -7,7 +7,7 @@ sil_stage canonical struct Foo {} class Bar {} sil_vtable Bar {} -sil @_TFC19sil_witness_methods3BarD : $@convention(method) (Bar) -> () +sil @_TFC19sil_witness_methods3BarD : $@convention(method) (Bar) -> () struct X {} struct Y {} diff --git a/test/IRGen/typed_boxes.sil b/test/IRGen/typed_boxes.sil index 82572d1575398..a7abe345dc832 100644 --- a/test/IRGen/typed_boxes.sil +++ b/test/IRGen/typed_boxes.sil @@ -38,7 +38,7 @@ entry: @_alignment(32) struct OverAligned { - var x,y,z,w: Builtin.Int64 + var x, y, z, w: Builtin.Int64 } // CHECK-LABEL: define{{( protected)?}} void @pod_box_32_32 diff --git a/test/Prototypes/Integers.swift.gyb b/test/Prototypes/Integers.swift.gyb index a2609b9cdd5ab..62475f232d31f 100644 --- a/test/Prototypes/Integers.swift.gyb +++ b/test/Prototypes/Integers.swift.gyb @@ -357,16 +357,16 @@ public func > (lhs: T, rhs: U) -> Bool { // These two versions of the operators are not ordered with respect to // one another: // -// (T,T) -> Bool -// (T,U) -> Bool +// (T, T) -> Bool +// (T, U) -> Bool // // so we define: // -// (T,T) -> Bool +// (T, T) -> Bool @_transparent @warn_unused_result -public func != (lhs:T, rhs: T) -> Bool { +public func != (lhs: T, rhs: T) -> Bool { return !(lhs == rhs) } diff --git a/test/SILOptimizer/cse.sil b/test/SILOptimizer/cse.sil index 1563e447bc9aa..40e07ad042153 100644 --- a/test/SILOptimizer/cse.sil +++ b/test/SILOptimizer/cse.sil @@ -727,7 +727,7 @@ bb2: // CHECK-NOT: value_metatype $@objc_metatype // CHECK: strong_release // CHECK: return -sil @cse_value_metatype : $@convention(thin) (@owned T) -> @owned (AnyObject,AnyObject) { +sil @cse_value_metatype : $@convention(thin) (@owned T) -> @owned (AnyObject, AnyObject) { bb0(%0 : $T): %2 = value_metatype $@objc_metatype T.Type, %0 : $T %4 = objc_metatype_to_object %2 : $@objc_metatype T.Type to $AnyObject @@ -788,7 +788,7 @@ bb0(%0 : $B, %1 : $B): // CHECK-NOT: objc_metatype_to_object // CHECK: strong_release // CHECK: return -sil @cse_objc_metatype_to_object : $@convention(thin) (@owned T) -> @owned (AnyObject,AnyObject) { +sil @cse_objc_metatype_to_object : $@convention(thin) (@owned T) -> @owned (AnyObject, AnyObject) { bb0(%0 : $T): %2 = value_metatype $@objc_metatype T.Type, %0 : $T %4 = objc_metatype_to_object %2 : $@objc_metatype T.Type to $AnyObject @@ -824,7 +824,7 @@ bb0(%0 : $XX): // CHECK-NOT: raw_pointer_to_ref // CHECK: tuple // CHECK: return -sil @cse_raw_pointer_to_ref : $@convention(thin) (Builtin.RawPointer) -> @owned(C,C) { +sil @cse_raw_pointer_to_ref : $@convention(thin) (Builtin.RawPointer) -> @owned(C, C) { bb0(%0 : $Builtin.RawPointer): %1 = raw_pointer_to_ref %0 : $Builtin.RawPointer to $C %2 = raw_pointer_to_ref %0 : $Builtin.RawPointer to $C diff --git a/test/SILOptimizer/definite_init.sil b/test/SILOptimizer/definite_init.sil index f45d8cb9f41bc..b68c1857b67ec 100644 --- a/test/SILOptimizer/definite_init.sil +++ b/test/SILOptimizer/definite_init.sil @@ -44,7 +44,7 @@ bb0: // func used_by_inout(a : Int) -> (Int, Int) { // var t = a // takes_Int_inout(&a) -// return (t,a) +// return (t, a) //} // CHECK-LABEL: sil @used_by_inout sil @used_by_inout : $@convention(thin) (Int) -> (Int, Int) { diff --git a/test/SILOptimizer/predictable_memopt.sil b/test/SILOptimizer/predictable_memopt.sil index d0f285af74496..6f52ae3938a2b 100644 --- a/test/SILOptimizer/predictable_memopt.sil +++ b/test/SILOptimizer/predictable_memopt.sil @@ -59,7 +59,7 @@ sil @takes_Int_inout : $@convention(thin) (@inout Int) -> () // func used_by_inout(a : Int) -> (Int, Int) { // var t = a // takes_Int_inout(&a) -// return (t,a) +// return (t, a) //} // CHECK-LABEL: sil @used_by_inout sil @used_by_inout : $@convention(thin) (Int) -> (Int, Int) { diff --git a/test/SILOptimizer/sil_combine.sil b/test/SILOptimizer/sil_combine.sil index 3ae39fad26cde..3a469271702b5 100644 --- a/test/SILOptimizer/sil_combine.sil +++ b/test/SILOptimizer/sil_combine.sil @@ -6,7 +6,7 @@ import Builtin import Swift class RawBuffer {} -class HeapBufferStorage : RawBuffer {} +class HeapBufferStorage : RawBuffer {} enum FakeOptional { case none @@ -2604,7 +2604,7 @@ class CC4 { // Function that takes different kinds of arguments: @in, @guaranteed, @owned, sil @closure_with_in_guaranteed_owned_in_args : $@convention(method) (@in CC2, @guaranteed CC1, @owned CC3, @in CC4) -> Optional -// Test the peephole performing apply{partial_apply(x,y,z)}(a) -> apply(a,x,y,z) +// Test the peephole performing apply{partial_apply(x, y, z)}(a) -> apply(a, x, y, z) // We need to check the following: // - all arguments of a partial_apply, which are either results of a stack_alloc or consumed indirect arguments // should be copied into temporaries. This should happen just before that partial_apply instruction. diff --git a/test/SILOptimizer/sil_combine_uncheck.sil b/test/SILOptimizer/sil_combine_uncheck.sil index 479716490aab6..c5b425faf0e12 100644 --- a/test/SILOptimizer/sil_combine_uncheck.sil +++ b/test/SILOptimizer/sil_combine_uncheck.sil @@ -6,7 +6,7 @@ import Builtin import Swift class RawBuffer {} -class HeapBufferStorage : RawBuffer {} +class HeapBufferStorage : RawBuffer {} class C { } diff --git a/unittests/Basic/UnicodeGraphemeBreakTest.cpp.gyb b/unittests/Basic/UnicodeGraphemeBreakTest.cpp.gyb index bad7caea02d6e..b1f4697390fe5 100644 --- a/unittests/Basic/UnicodeGraphemeBreakTest.cpp.gyb +++ b/unittests/Basic/UnicodeGraphemeBreakTest.cpp.gyb @@ -45,7 +45,7 @@ static std::vector FindGraphemeClusterBoundaries(StringRef Str) { } TEST(ExtractExtendedGraphemeCluster, TestsFromUnicodeSpec) { -% for subject_string,expected_boundaries in grapheme_cluster_break_tests: +% for subject_string, expected_boundaries in grapheme_cluster_break_tests: EXPECT_EQ((std::vector{ ${', '.join([ str(x) for x in expected_boundaries ])} }), FindGraphemeClusterBoundaries("${subject_string}")); % end diff --git a/utils/analyze_deps.rb b/utils/analyze_deps.rb index db5beea48d3ad..22a8c6501bb94 100755 --- a/utils/analyze_deps.rb +++ b/utils/analyze_deps.rb @@ -27,7 +27,7 @@ # We cheat here and dump everything into the same bucket. names = {} -files.each do |k,v| +files.each do |k, v| v['provides'].each do |name| names[name] ||= [] names[name] << k @@ -44,7 +44,7 @@ all_deps = {} all_private_deps = {} -files.each do |k,v| +files.each do |k, v| deps = Set.new() private_deps = Set.new() v['top-level'].each do |name| @@ -80,7 +80,7 @@ # Graphviz output! puts 'digraph dependencies {' -all_deps.each do |k,v| +all_deps.each do |k, v| v.each do |dep| puts "\t\"#{dep}\" -> \"#{k}\"" end @@ -88,7 +88,7 @@ puts "\t\"#{k}\"" end end -all_private_deps.each do |k,v| +all_private_deps.each do |k, v| v.each do |dep| puts "\t\"#{dep}\" -> \"#{k}\" [style=dotted]" end diff --git a/utils/gyb.py b/utils/gyb.py index ff485ae88b66c..7a03d5798691e 100755 --- a/utils/gyb.py +++ b/utils/gyb.py @@ -152,7 +152,7 @@ def tokenize_python_to_unmatched_close_curly(source_text, start, line_starts): def tokenize_template(template_text): r"""Given the text of a template, returns an iterator over - (tokenType,token,match) tuples. + (tokenType, token, match) tuples. **Note**: this is template syntax tokenization, not Python tokenization. @@ -165,13 +165,13 @@ def tokenize_template(template_text): then refined by ParseContext.token_generator. >>> from pprint import * - >>> pprint(list((kind, text) for kind,text,_ in tokenize_template( + >>> pprint(list((kind, text) for kind, text, _ in tokenize_template( ... '%for x in range(10):\n% print x\n%end\njuicebox'))) [('gybLines', '%for x in range(10):\n% print x'), ('gybLinesClose', '%end'), ('literal', 'juicebox')] - >>> pprint(list((kind, text) for kind,text,_ in tokenize_template( + >>> pprint(list((kind, text) for kind, text, _ in tokenize_template( ... '''Nothing ... % if x: ... % for i in range(3): diff --git a/validation-test/stdlib/NumericDiagnostics.swift.gyb b/validation-test/stdlib/NumericDiagnostics.swift.gyb index 9b2dd1f3c9a64..ee508dba80b3a 100644 --- a/validation-test/stdlib/NumericDiagnostics.swift.gyb +++ b/validation-test/stdlib/NumericDiagnostics.swift.gyb @@ -3,7 +3,7 @@ // REQUIRES: executable_test % from SwiftIntTypes import all_numeric_type_names, numeric_type_names_macintosh_only, \ -% all_integer_type_names,all_integer_binary_operator_names, all_integer_or_real_binary_operator_names, \ +% all_integer_type_names, all_integer_binary_operator_names, all_integer_or_real_binary_operator_names, \ % all_arithmetic_comparison_operator_names, all_integer_assignment_operator_names, \ % all_integer_or_real_assignment_operator_names diff --git a/validation-test/stdlib/UnicodeTrie.swift.gyb b/validation-test/stdlib/UnicodeTrie.swift.gyb index bf8439d6482d4..821c177c0b3fa 100644 --- a/validation-test/stdlib/UnicodeTrie.swift.gyb +++ b/validation-test/stdlib/UnicodeTrie.swift.gyb @@ -35,7 +35,7 @@ import Foundation var graphemeBreakPropertyTable = [ // 'as Int' annotations are needed to help prevent the type-checker from // blowing the stack. -% for start_code_point,end_code_point,value in grapheme_cluster_break_property_table.property_value_ranges: +% for start_code_point, end_code_point, value in grapheme_cluster_break_property_table.property_value_ranges: (${start_code_point} as Int, ${end_code_point} as Int, _GraphemeClusterBreakPropertyValue.${value}), % end ] @@ -164,7 +164,7 @@ UnicodeTrie.test("GraphemeClusterSegmentation/UnicodeSpec") { // Test segmentation algorithm using test data from the Unicode // specification. -% for code_points,expected_boundaries in grapheme_cluster_break_tests: +% for code_points, expected_boundaries in grapheme_cluster_break_tests: do { let scalars: [UInt32] = [ ${", ".join([ str(cp) for cp in code_points ])} ]