Skip to content

Commit

Permalink
[gardening] Add whitespace: "foo,bar" → "foo, bar"
Browse files Browse the repository at this point in the history
  • Loading branch information
practicalswift committed Apr 12, 2016
1 parent ba431a9 commit c760f6d
Show file tree
Hide file tree
Showing 50 changed files with 127 additions and 127 deletions.
40 changes: 20 additions & 20 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```

Expand Down Expand Up @@ -106,7 +106,7 @@ Swift 3.0
typealias StringDictionary<T> = Dictionary<String, T>
typealias IntFunction<T> = (T) -> Int
typealias MatchingTriple<T> = (T, T, T)
typealias BackwardTriple<T1,T2,T3> = (T3, T2, T1)
typealias BackwardTriple<T1, T2, T3> = (T3, T2, T1)
```
etc.

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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<T> {
```swift
enum List<T> {
case Nil
indirect case Cons(head: T, tail: List<T>)
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1934,10 +1934,10 @@ Swift 2.2
2014-10-09 [Roughly Xcode 6.1, and Swift 1.1]
----------

* `HeapBuffer<Value,Element>`, `HeapBufferStorage<Value,Element>`, and
* `HeapBuffer<Value, Element>`, `HeapBufferStorage<Value, Element>`, and
`OnHeap<Value>` were never really useful, because their APIs were
insufficiently public. They have been replaced with a single class,
`ManagedBuffer<Value,Element>`. See also the new function
`ManagedBuffer<Value, Element>`. See also the new function
`isUniquelyReferenced(x)` which is often useful in conjunction with
`ManagedBuffer`.

Expand Down Expand Up @@ -3974,15 +3974,15 @@ Swift 2.2

```swift
func swap<T>(a : @inout T, b : @inout T) {
(a,b) = (b,a)
(a, b) = (b, a)
}
```

You are now required to write:

```swift
func swap<T>(inout a : T, inout b : T) {
(a,b) = (b,a)
(a, b) = (b, a)
}
```

Expand Down
2 changes: 1 addition & 1 deletion benchmark/single-source/ArrayOfGenericPOD.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ struct S<T> {
}
@inline(never)
func genStructArray() {
_ = RefArray<S<Int>>(S(x:3,y:4))
_ = RefArray<S<Int>>(S(x:3, y:4))
// should be a nop
}

Expand Down
4 changes: 2 additions & 2 deletions benchmark/single-source/Prims.swift
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ extension Edge : Hashable {
}
}

func Prims(_ graph : Array<GraphNode>, _ fun : (Int,Int)->Double) -> Array<Int?> {
func Prims(_ graph : Array<GraphNode>, _ fun : (Int, Int)->Double) -> Array<Int?> {
var treeEdges = Array<Int?>(repeating:nil, count:graph.count)

let queue = PriorityQueue(Num:graph.count)
Expand Down Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions docs/ARCOptimization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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::
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/ErrorHandling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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<T,U>(_ array: [T], fn: T -> U) throwsIf(fn) -> [U] {
func map<T, U>(_ array: [T], fn: T -> U) throwsIf(fn) -> [U] {
...
}

Expand Down
2 changes: 1 addition & 1 deletion docs/ErrorHandlingRationale.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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<T,U>(_ array: [T], fn: T throws -> U) throwsIf(fn) -> [U] {
func map<T, U>(_ array: [T], fn: T throws -> U) throwsIf(fn) -> [U] {
...
}
Expand Down
2 changes: 1 addition & 1 deletion docs/HighLevelSILOptimizations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions docs/PatternMatching.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
}

Expand All @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions docs/SIL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)``
Expand Down
4 changes: 2 additions & 2 deletions docs/StringDesign.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions docs/proposals/Accessors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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).

Expand Down
20 changes: 10 additions & 10 deletions docs/proposals/Concurrency.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/proposals/InoutCOWOptimization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)})
Expand Down
2 changes: 1 addition & 1 deletion docs/proposals/archive/MemoryAndConcurrencyModel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
...
Expand Down
2 changes: 1 addition & 1 deletion include/swift/SIL/SILInstruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ class ApplyInstBase<Impl, Base, true>
protected:
template <class... As>
ApplyInstBase(As &&...args)
: ApplyInstBase<Impl,Base,false>(std::forward<As>(args)...) {}
: ApplyInstBase<Impl, Base, false>(std::forward<As>(args)...) {}

public:
using super::getCallee;
Expand Down
2 changes: 1 addition & 1 deletion lib/Sema/CodeSynthesis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
2 changes: 1 addition & 1 deletion lib/Sema/TypeCheckDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4050,7 +4050,7 @@ class DeclChecker : public DeclVisitor<DeclChecker> {

// 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 ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
Loading

0 comments on commit c760f6d

Please sign in to comment.