Skip to content

Commit 0945239

Browse files
committed
Propose fixing some typos
1 parent 33996de commit 0945239

7 files changed

+34
-37
lines changed

docs/ABI/GenericSignature.md

+13-14
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ Consider the following generic signature:
4141
The constraint `C1.Element: Equatable` is redundant (because it can be proven based on `C1.Element == C2.Element` and `C2.Element: Equatable`). Similarly, `C2.Element: Equatable` is redundant (based on `C1.Element == C2.Element` and `C1.Element: Equatable`). Either one of these constraints can be removed without changing the semantics of the generic signature, and the resulting generic signature will be minimal (there are no redundant constraints that remain). As such, there are two minimal generic signatures that describe this set of constraints:
4242

4343
```swift
44-
<C1, C2 where C1: Collection, C2: Collection, C1.Element: Equatable,
44+
<C1, C2 where C1: Collection, C2: Collection, C1.Element: Equatable,
4545
C1.Element == C2.Element>
4646
```
4747

4848
and
4949

5050
```swift
51-
<C1, C2 where C1: Collection, C2: Collection, C1.Element == C2.Element,
51+
<C1, C2 where C1: Collection, C2: Collection, C1.Element == C2.Element,
5252
C2.Element: Equatable>
5353
```
5454

@@ -60,19 +60,19 @@ A generic signature is *canonical* when each of its constraints is [canonical](#
6060

6161
1. Generic type parameters are listed first
6262
ordered by [type parameter ordering](#type-parameter-ordering)
63-
2. Constraints follow, ordered first by the
64-
[type parameter ordering](#type-parameter-ordering) of the left-hand
63+
2. Constraints follow, ordered first by the
64+
[type parameter ordering](#type-parameter-ordering) of the left-hand
6565
operand and then by constraint kind. The left-hand side of a constraint
6666
is always a type parameter (call it `T`).
6767
Constraints are ordered as follows:
6868
1. A superclass constraint `T: C`, where `C` is a class.
6969
2. A layout constraint (e.g., `T: some-layout`), where the right-hand
70-
side is `AnyObject` or one of the non-user-visible layout constraints
70+
side is `AnyObject` or one of the non-user-visible layout constraints
7171
like `_Trivial`.
72-
3. Conformance constraints `T: P`, where `P` is a protocol. The
73-
conformance constraints for a given type parameter `T` are further
72+
3. Conformance constraints `T: P`, where `P` is a protocol. The
73+
conformance constraints for a given type parameter `T` are further
7474
sorted using the [protocol ordering](#protocol-ordering).
75-
4. A same-type constraint `T == U`, where `U` is either a type parameter
75+
4. A same-type constraint `T == U`, where `U` is either a type parameter
7676
or a concrete type.
7777

7878
### Type parameter ordering
@@ -117,7 +117,7 @@ Each equivalence class has a corresponding *anchor*, which is a type parameter t
117117

118118
A layout or conformance constraint is canonical when its left-hand side is the anchor of its equivalence class. A superclass constraint is canonical when its left-hand side is the anchor of its equivalence class and its right-hand side is a canonical concrete (class) type. Same-type constraint canonicalization is discussed in detail in the following section, but some basic rules apply: the left-hand side is always a type parameter, and the right-hand side is either a type parameter that follows the left-hand side (according to the [type parameter ordering](#type-parameter-ordering)) or is a canonical concrete type.
119119

120-
### Same-type constaints
120+
### Same-type constraints
121121

122122
The canonical form of superclass, layout, and conformance constraints are directly canonicalizable once the equivalence classes are known. Same-type constraints, on the other hand, are responsible for forming those equivalence classes. Let's expand our running example to include a third `Collection`:
123123

@@ -138,13 +138,13 @@ or
138138
C1.Element == C2.Element, C2.Element == C3.Element
139139
```
140140

141-
or
141+
or
142142

143143
```swift
144144
C1.Element == C3.Element, C2.Element == C3.Element
145145
```
146146

147-
All of these sets of constraints have the same effect (i.e., form the same equivalence class), but the second one happens to be the canonical form.
147+
All of these sets of constraints have the same effect (i.e., form the same equivalence class), but the second one happens to be the canonical form.
148148

149149
The canonical form is determined by first dividing all of the types in the same equivalence class into distinct components. Two types `T1` and `T2` are in the same component if the same type constraint `T1 == T2` can be proven true based on other known constraints in the generic signature (i.e., if `T1 == T2` would be redundant). For example, `C1.Element` and `C1.SubSequence.Elemenent` are in the same component, because `C1: Collection` and the `Collection` protocol contains the constraint `Element == SubSequence.Element`. However, `C1.Element` and `C2.Element` are in different components.
150150

@@ -162,15 +162,15 @@ For the first case, consider a function that operates on `String` collections:
162162
```swift
163163
func manyStrings<C1: Collection, C2: Collection, C3: Collection>(
164164
c1: C1, c2: C2, c3: C3)
165-
where C1.Element == String, C1.Element == C2.Element,
165+
where C1.Element == String, C1.Element == C2.Element,
166166
C1.Element == C3.SubSequence.Element
167167
{ }
168168
```
169169

170170
The minimal canonical generic signature for this function is:
171171

172172
```swift
173-
<C1, C2, C3 where C1: Collection, C2: Collection, C3: Collection,
173+
<C1, C2, C3 where C1: Collection, C2: Collection, C3: Collection,
174174
C1.Element == String, C2.Element == String, C3.Element == String>
175175
```
176176

@@ -189,4 +189,3 @@ protocol Collection: Sequence where SubSequence: Collection {
189189
```
190190

191191
This protocol introduces a number of constraints: `Self: Sequence` (stated as inheritance), `Self.SubSequence: Collection` (in the protocol where clause), `Self.Indices: Collection` (associated type declaration) and `Self.Indices.Element == Index` (associated type where clause). These constraints, which are directly implied by `Self: Collection`, form the *requirement signature* of a protocol. As with other generic signatures used for the ABI, the requirement signature is minimal and canonical according to the rules described elsewhere in this document.
192-

docs/ABI/KeyPaths.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ way that it can be transformed in-place into a key path object with a one-time
1010
initialization in the common case where the entire path is fully specialized
1111
and crosses no resilience boundaries.
1212

13-
## ABI Concerns For Key Paths
13+
## ABI Concerns For Key Paths
1414

1515
For completeness, this document describes the layout of both key path objects
1616
and patterns; note however that the instantiated runtime layout of key path
1717
objects is an implementation detail of the Swift runtime, and *only key path
1818
patterns* are strictly ABI, since they are emitted by the compiler. The
1919
runtime has the freedom to change the runtime layout of key path objects, but
2020
will have to maintain the ability to instantiate from key path patterns emitted
21-
by previous ABI-stable versions of the Swift complier.
21+
by previous ABI-stable versions of the Swift compiler.
2222

2323
## Key Path Objects
2424

@@ -202,10 +202,10 @@ Value in bit 30&29 | Description
202202
`2*sizeof(Int)` | **Is Equal**
203203
`3*sizeof(Int)` | **Hash**
204204

205-
The *destroy* function, if not null, has signature
205+
The *destroy* function, if not null, has signature
206206
`@convention(thin) (UnsafeMutableRawPointer) -> ()` and is invoked to
207207
destroy the captures when the key path object is deallocated.
208-
208+
209209
The *copy* function has signature
210210
`@convention(thin) (_ src: UnsafeRawPointer,
211211
_ dest: UnsafeMutableRawPointer) -> ()`

docs/DebuggingTheCompiler.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ There is another useful script to view the CFG of a disassembled function:
257257
It splits a disassembled function up into basic blocks which can then be
258258
used with viewcfg::
259259

260-
(lldb) disassemble
260+
(lldb) disassemble
261261
<copy-paste output to file.s>
262262
$ blockifyasm < file.s | viewcfg
263263

@@ -458,7 +458,7 @@ That will write the types log to the file passed to the -f option.
458458

459459
**NOTE** Module loading can happen as a side-effect of other operations in lldb
460460
(e.g. the "file" command). To be sure that one has enabled logging before /any/
461-
module loading has occured, place the command into either::
461+
module loading has occurred, place the command into either::
462462

463463
~/.lldbinit
464464
$PWD/.lldbinit
@@ -483,8 +483,8 @@ following non-exhaustive list of state:
483483
1. The unparsed, textual expression passed to the compiler.
484484
2. The parsed expression.
485485
3. The initial SILGen.
486-
4. SILGen after SILLinking has occured.
487-
5. SILGen after SILLinking and Guaranteed Optimizations have occured.
486+
4. SILGen after SILLinking has occurred.
487+
5. SILGen after SILLinking and Guaranteed Optimizations have occurred.
488488
6. The resulting LLVM IR.
489489
7. The assembly code that will be used by the JIT.
490490

docs/Generics.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ The exact syntax of the @_specialize function attribute is defined as: ::
747747
@_specialize(exported: false, kind: partial, where K: _Trivial64)
748748
func dictFunction<K, V>(dict: Dictionary<K, V>) {
749749
}
750-
750+
751751
If 'exported' is set, the corresponding specialization would have a public
752752
visibility and can be used by clients. If 'exported' is omitted, it's value
753753
is assumed to be 'false'.
@@ -757,7 +757,7 @@ produce an error if you forget to specify the type for some of the generic
757757
parameters in the 'where' clause. If 'kind' is 'partial' it means a partial
758758
specialization. If 'kind' is omitted, its value is assumed to be 'full.
759759

760-
The requirements in the where clause may be same-type constaints like 'T == Int',
760+
The requirements in the where clause may be same-type constraints like 'T == Int',
761761
but they may also specify so-called layout constraints like 'T: _Trivial'.
762762

763763
The following layout constraints are currently supported:
@@ -773,7 +773,7 @@ The following layout constraints are currently supported:
773773
exactly 'SizeInBits' bits.
774774
* _TrivialAtMost(SizeInBits) - like _Trivial, but the size of the type should
775775
be at most 'SizeInBits' bits.
776-
776+
777777

778778
Existential Types and Generics
779779
------------------------------

docs/SIL.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -3188,7 +3188,7 @@ executing the ``begin_apply``) were being "called" by the ``yield``:
31883188
- The convention attributes are the same as the parameter convention
31893189
attributes, interpreted as if the ``yield`` were the "call" and the
31903190
``begin_apply`` marked the entry to the "callee". For example,
3191-
an ``@in Any`` yield transferrs ownership of the ``Any`` value
3191+
an ``@in Any`` yield transfers ownership of the ``Any`` value
31923192
reference from the coroutine to the caller, which must destroy
31933193
or move the value from that position before ending or aborting the
31943194
coroutine.
@@ -3714,7 +3714,7 @@ destructure_struct
37143714
// %0 must be a struct of type $S
37153715
// %eltN must have the same type as the Nth field of $S
37163716

3717-
Given a struct, split the struct into its constituant fields.
3717+
Given a struct, split the struct into its constituent fields.
37183718

37193719
object
37203720
``````
@@ -3729,7 +3729,7 @@ object
37293729

37303730
Constructs a statically initialized object. This instruction can only appear
37313731
as final instruction in a global variable static initializer list.
3732-
3732+
37333733
ref_element_addr
37343734
````````````````
37353735
::
@@ -4026,7 +4026,7 @@ container may use one of several representations:
40264026
Said value might be replaced with one of the _addr instructions above
40274027
before IR generation.
40284028
The following instructions manipulate "loadable" opaque existential containers:
4029-
4029+
40304030
* `init_existential_value`_
40314031
* `open_existential_value`_
40324032
* `deinit_existential_value`_

docs/StandardLibraryProgrammersManual.md

+5-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ TODO: Should this subsume or link to [AccessControlInStdlib.rst](https://github.
1212
1. Library Organization
1313
1. What files are where
1414
1. Brief about CMakeLists
15-
1. Brief about GroupInfo.json
15+
1. Brief about GroupInfo.json
1616
1. What tests are where
1717
1. Furthermore, should there be a split between whitebox tests and blackbox tests?
1818
1. What benchmarks are where
@@ -23,7 +23,7 @@ TODO: Should this subsume or link to [AccessControlInStdlib.rst](https://github.
2323
1. Protocol hierarchy
2424
1. Customization hooks
2525
1. Use of classes, COW implementation, buffers, etc
26-
1. Compatiblity, `@available`, etc.
26+
1. Compatibility, `@available`, etc.
2727
1. Resilience, ABI stability, `@_inlineable`, `@_versioned`, etc
2828
1. Strings and ICU
2929
1. Lifetimes
@@ -75,8 +75,8 @@ if _fastPath(...) {
7575
...
7676
if _fastPath(...) {
7777
// 9% of the time we execute this: very conservative inlining
78-
...
79-
return
78+
...
79+
return
8080
}
8181

8282
// 1% of the time we execute this: very conservative inlining
@@ -87,7 +87,7 @@ return
8787
*NOTE: these are due for a rename and possibly a redesign. They conflate multiple notions that don’t match the average standard library programmer’s intuition.*
8888

8989

90-
#### `_onFastPath`
90+
#### `_onFastPath`
9191

9292
This should be rarely used. It informs the SIL optimizer that any code dominated by it should be treated as the innermost loop of a performance critical section of code. It cranks optimizer heuristics to 11. Injudicious use of this will degrade performance and bloat binary size.
9393

@@ -170,5 +170,3 @@ The standard library utilizes thread local storage (TLS) to cache expensive comp
170170
3. If the field is not trivially destructable, update `_destroyTLS` to properly destroy the value.
171171
172172
See [ThreadLocalStorage.swift](https://github.com/apple/swift/blob/master/stdlib/public/core/ThreadLocalStorage.swift) for more details.
173-
174-

docs/refactoring/SwiftLocalRefactoring.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ Though a little more complex than its counterpart in the aforementioned String
162162
Localization refactoring, this implementation is self-explaining too. Lines 3
163163
to 4 check the kind of the given range, which has to be a single expression
164164
to proceed with the extraction. Lines 5 to 7 ensure the extracted expression has
165-
a well-formed type. Further conditions that need to be checked are ommitted in
165+
a well-formed type. Further conditions that need to be checked are omitted in
166166
the example for now. Interested readers can refer to [Refactoring.cpp] for
167167
more details. For the code change part, we can use the same [RangeInfo] instance
168168
to emit textual edits:

0 commit comments

Comments
 (0)