Skip to content

Commit 5c57745

Browse files
authored
Merge pull request #75023 from Sajjon/cyon_typo_batch__docs
Typos: `docs`
2 parents 9f8e5e8 + ae0e94a commit 5c57745

13 files changed

+25
-25
lines changed

docs/CppInteroperability/UserGuide-CallingSwiftFromC++.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ design for the Swift to C++ interoperability layer.
1212
**NOTE:** This document does not go over the following Swift language features yet:
1313

1414
* Closures
15-
* overriden methods/properties in classes
15+
* overridden methods/properties in classes
1616
* Existential types (any P)
1717
* Nested types
1818
* Operators
@@ -72,7 +72,7 @@ Swift functions that are callable from C++ are available in their corresponding
7272

7373
Fundamental primitive types have a C++ fundamental type that represents them in C++:
7474

75-
|Swift Type |C++ Type |C Type (if different) | |target specifc |
75+
|Swift Type |C++ Type |C Type (if different) | |target specific |
7676
|--- |--- |--- |--- |--- |
7777
|Void (or no return) |void | | | |
7878
|Int |swift::Int |ptrdiff_t |long or long long (windows) |YES |
@@ -295,12 +295,12 @@ As an example, this structure renames its second `init` overload in C++ to expos
295295
296296
```swift
297297
// Swift module 'Weather'
298-
struct Celcius {
299-
var temperatureInCelcius: Double
298+
struct Celsius {
299+
var temperatureInCelsius: Double
300300
301301
// FEEDBACK: could provide a constructor here?
302302
// NOTE: concern about encouraging people not to use labels
303-
init(_ t: Double) { self.temperatureInCelcius = t }
303+
init(_ t: Double) { self.temperatureInCelsius = t }
304304
305305
// FEEDBACK: could the compiler construct the 'initFromFahrenheit' c++ name?
306306
@expose(c++, initFromFahrenheit)
@@ -315,8 +315,8 @@ Both initializers can then be used from C++:
315315
using namespace Weather;
316316

317317
void makeSunnyDay() {
318-
auto morningTemperature = Celcius::init(25);
319-
auto noonTemperature = Celcius::initFromFahrenheit(90);
318+
auto morningTemperature = Celsius::init(25);
319+
auto noonTemperature = Celsius::initFromFahrenheit(90);
320320
}
321321
```
322322

@@ -558,7 +558,7 @@ public:
558558

559559
using UpcType = swift::Tuple<swift::Int, swift::Int, swift::Int, swift::Int>;
560560

561-
// Extracts the associated valus from Barcode.upc enum case
561+
// Extracts the associated values from Barcode.upc enum case
562562
UpcType getUpc() const;
563563

564564
bool isQrCode() const;
@@ -698,7 +698,7 @@ public final class Bicycle: Vehicle {
698698
}
699699
```
700700

701-
Get a corresponding C++ class hierachy in C++:
701+
Get a corresponding C++ class hierarchy in C++:
702702

703703
```c++
704704
class Vehicle { ... };

docs/EmbeddedSwift/UserManual.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,11 @@ For (2), external dependencies are also triggered by specific code needing them,
252252
- dependency: `void *__stack_chk_guard;`
253253
- dependency: `void __stack_chk_fail(void);`
254254
- stack protectors can be disabled with `-disable-stack-protector` swiftc flag
255-
- **atomics instrinsics**
255+
- **atomics intrinsics**
256256
- on CPU architectures that don't have direct load-acquire/store-release support in the ISA, LLVM calls helper functions for atomic operations
257257
- needed by refcounting in the Embedded Swift runtime (so any class usage will trigger this dependency)
258258
- also needed when using atomics from the Synchronization module
259-
- **multiplication/division/modulo instrinsics**
259+
- **multiplication/division/modulo intrinsics**
260260
- on CPU architectures that don't have direct support for the math operations in the ISA
261261
- dependency (on Mach-O): `__divti3`
262262
- dependency (on Mach-O): `__modti3`

docs/Generics/chapters/basic-operation.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ \chapter{Basic Operation}\label{rqm basic operation}
136136
\item If a conformance requirement is made redundant by a same-type requirement that fixes a type parameter to a concrete type (such as $\SameReq{T}{S}$ and $\ConfReq{T}{P}$ where \texttt{S} is a concrete type and $\ConfReq{S}{P}$ is a concrete conformance), the rewrite system cannot be reused for technical reasons; we will talk about this in \ChapRef{concrete conformances}.
137137
\end{enumerate}
138138

139-
The first three only occur with invalid code, and are accompanied by diagnostics. The fourth is not an error, just a rare edge case where our optimization cannot be performed. All conditions are checked for during minimization, and recorded in the form of a flags field. We cannot install the minimization machine if any of these flags are set; doing so would associate a generic signature with a minimization machine that contains rewrite rules not explained by the generic signature itself. This would confuse subsequent generic signature queries. In the event that the above does not cover some other unforseen scenario where equivalence fails to hold, the \IndexFlag{disable-requirement-machine-reuse}\texttt{-disable-requirement-machine-reuse} frontend flag forces minimization machines to be discarded immediately after use, instead of being installed.
139+
The first three only occur with invalid code, and are accompanied by diagnostics. The fourth is not an error, just a rare edge case where our optimization cannot be performed. All conditions are checked for during minimization, and recorded in the form of a flags field. We cannot install the minimization machine if any of these flags are set; doing so would associate a generic signature with a minimization machine that contains rewrite rules not explained by the generic signature itself. This would confuse subsequent generic signature queries. In the event that the above does not cover some other unforeseen scenario where equivalence fails to hold, the \IndexFlag{disable-requirement-machine-reuse}\texttt{-disable-requirement-machine-reuse} frontend flag forces minimization machines to be discarded immediately after use, instead of being installed.
140140

141141
\begin{example}
142142
The compiler builds several requirement machines while type checking the code below:

docs/Generics/chapters/completion.tex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ \section{Associated Types}\label{critical pairs}
742742
\arrow[u, Rightarrow, "\ttgp{0}{0}.(\assocsym{P}{A}.\assocsym{Q}{B}\Rightarrow\assocsym{P}{A}.\texttt{B})"']&&
743743
\end{tikzcd}
744744
\]
745-
Note that this was an overlap of the first kind, so rule (7) is now marked \index{left-simplified rule}\textbf{left-simplified}. Thus, rule (*8) completely supercedes rule (7). Rule (*8) survives minimization and maps to the requirement $\ConfReq{\ttgp{0}{0}.[P]A.[Q]B}{R}$, which appears in the generic signature that we output for this protocol extension:
745+
Note that this was an overlap of the first kind, so rule (7) is now marked \index{left-simplified rule}\textbf{left-simplified}. Thus, rule (*8) completely supersedes rule (7). Rule (*8) survives minimization and maps to the requirement $\ConfReq{\ttgp{0}{0}.[P]A.[Q]B}{R}$, which appears in the generic signature that we output for this protocol extension:
746746
\begin{quote}
747747
\begin{verbatim}
748748
<τ_0_0 where τ_0_0: P, τ_0_0.[P]A.[Q]B: R>
@@ -1075,7 +1075,7 @@ \section{More Critical Pairs}\label{more critical pairs}
10751075
\end{gather*}
10761076
We see that applying $\Sigma_{\ConfReq{X}{S}}$ to \texttt{\ttgp{0}{0}.[S]A} and \texttt{\ttgp{0}{0}.[S]C.[S]B} also outputs identical types: $\AssocType{[S]A}\otimes\ConfReq{X}{S}=\AssocType{[S]B}\otimes\ConfReq{Y}{S}=\texttt{Int}$. Is this the case for \emph{every} conformance to \texttt{S}? That is, is it true that $G_\texttt{S}\vDash\SameReq{\texttt{\ttgp{0}{0}.A}}{\texttt{\ttgp{0}{0}.C.B}}$?
10771077

1078-
We will see the answer is ``yes,'' proving that our function \texttt{f()} type checks. For a visual perspective, we turn to the \index{type parameter graph}type parameter graph\footnote{In our previous formulation, the type parameter graph has a distinguished root node, with every generic parameter as a child of this root. Now, our generic signature only has one generic parameter, so a root node would be superflous; we omit it in what follows.} for $G_\texttt{S}$. \FigRef{protocol s fig} constructs this graph in three steps. Between each step, we have a \index{graph homomorphism}graph homomorphism---in fact, a \index{covering map}covering map, in the sense of \SecRef{protocol component}---transforming one graph into the other:
1078+
We will see the answer is ``yes,'' proving that our function \texttt{f()} type checks. For a visual perspective, we turn to the \index{type parameter graph}type parameter graph\footnote{In our previous formulation, the type parameter graph has a distinguished root node, with every generic parameter as a child of this root. Now, our generic signature only has one generic parameter, so a root node would be superfluous; we omit it in what follows.} for $G_\texttt{S}$. \FigRef{protocol s fig} constructs this graph in three steps. Between each step, we have a \index{graph homomorphism}graph homomorphism---in fact, a \index{covering map}covering map, in the sense of \SecRef{protocol component}---transforming one graph into the other:
10791079
\begin{enumerate}
10801080
\item The first step shows the graph as it would be without the protocol stating any same-type requirements; we get an infinite tree where each interior node is the parent of one other interior node, and two leaf nodes.
10811081

@@ -1681,7 +1681,7 @@ \section{Recursive Conformances}\label{recursive conformances redux}
16811681
\[M_2^{\prime} := \Pres{a,b,n,q}{nn\sim n,\,na\sim b,\,bn\sim b,\,ba\sim bb,\,qb^iq\sim qb^i,\, qb^ia\sim qb^{i+1}}\]
16821682
However, we then add $c$ with defining rewrite rule $qa\sim c$:
16831683
\[M_3 := \Pres{a,b,c,n,q}{nn\sim n,\, qq\sim q,\, qn\sim q,\, nan\sim na,\,qaq\sim qa,\,na\sim b,\,qa\sim c}\]
1684-
Completion suceeds on $M_3$ using a reduction order where $c<b<a$ and $p<n$, and we get a finite convergent rewrite system. We've already listed the numerous rules once, so we won't do it again. Let's call this finite convergent presentation $M_2^\prime$:
1684+
Completion succeeds on $M_3$ using a reduction order where $c<b<a$ and $p<n$, and we get a finite convergent rewrite system. We've already listed the numerous rules once, so we won't do it again. Let's call this finite convergent presentation $M_2^\prime$:
16851685
\[M_3^\prime := \Pres{a,b,c,n,q}{\mbox{\ldots 15 rewrite rules \ldots}}\]
16861686
The minimized rewrite system corresponds to this presentation:
16871687
\[M_4 :=\Pres{a,b,c,n,q}{nn\sim n,\, na\sim b,\, bn\sim b,\, qq\sim q,\, qa\sim c,\, qn\sim q,\, cq\sim c}\]

docs/Generics/chapters/conformance-paths.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ \section{Recursive Conformances}\label{recursive conformances}
566566
\begin{proof}
567567
For $(1)\Rightarrow(2)$, note that the set of generic parameter types is always finite, so it suffices to only consider reduced \index{dependent member type}dependent member types. Suppose we're given an infinite set of reduced dependent member types; we must produce an infinite set of abstract conformances. Each dependent member type \texttt{T.[P]A} is equivalent to an ordered pair consisting of a type witness projection $\AssocType{[P]A}$ and an abstract conformance $\ConfReq{T}{P}$; the first element of the pair is drawn from a finite set, so a counting argument shows that the mapping that takes the second element of each pair must give us an infinite set of abstract conformances.
568568

569-
Furthermore, these abstract conformances must be reduced, meaning their subject types are reduced. To see why, note that whenever \texttt{T.[P]A} is a reduced dependent member type, its base type \texttt{T} must be reduced as well (otherwise, if $G\vDash\SameReq{$\texttt{T}^\prime$}{T}$ with $\texttt{T}^\prime<\texttt{T}$, we could construct from this a derivation of $\SameReq{$\texttt{T}^\prime$.[P]A}{T.[P]A}$ with $\texttt{$\texttt{T}^\prime$.[P]A} < \texttt{T.[P]A}$, contradicting the asumption that \texttt{T.[P]A} is reduced).
569+
Furthermore, these abstract conformances must be reduced, meaning their subject types are reduced. To see why, note that whenever \texttt{T.[P]A} is a reduced dependent member type, its base type \texttt{T} must be reduced as well (otherwise, if $G\vDash\SameReq{$\texttt{T}^\prime$}{T}$ with $\texttt{T}^\prime<\texttt{T}$, we could construct from this a derivation of $\SameReq{$\texttt{T}^\prime$.[P]A}{T.[P]A}$ with $\texttt{$\texttt{T}^\prime$.[P]A} < \texttt{T.[P]A}$, contradicting the assumption that \texttt{T.[P]A} is reduced).
570570

571571
A similar argument establishes $(2)\Rightarrow(1)$. We're given an infinite set of reduced abstract conformances, and we must produce an infinite set of reduced type parameters. Each abstract conformance $\ConfReq{T}{P}$ uniquely determines an ordered pair, consisting of a \index{protocol declaration}protocol declaration $\protosym{P}$ and a type parameter \texttt{T}. The set of protocol declarations is finite, so again, taking the second element of each pair gives us an infinite set of reduced type parameters.
572572
\end{proof}

docs/Generics/chapters/declarations.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ \section{Functions}\label{function decls}
568568

569569
An unqualified reference to a member of an outer nominal type can only be made if the member is static, because there is no ``outer \texttt{self} value'' to invoke the method with; a \emph{value} of the nested type does not contain a \emph{value} of its parent type.
570570

571-
For the same reason, methods inside \index{local type declaration}local types cannot refer to local variables declared outside of the local type. (Constrast this with \index{Java}Java inner classes for example, which can be declared as \texttt{static} or instance members of their outer class; a non-\texttt{static} inner class captures a ``\texttt{this}'' reference from the outer class. Inner classes nested in methods can also capture local variables in Java.)
571+
For the same reason, methods inside \index{local type declaration}local types cannot refer to local variables declared outside of the local type. (Contrast this with \index{Java}Java inner classes for example, which can be declared as \texttt{static} or instance members of their outer class; a non-\texttt{static} inner class captures a ``\texttt{this}'' reference from the outer class. Inner classes nested in methods can also capture local variables in Java.)
572572

573573
\paragraph{Constructor declarations.}
574574
\IndexDefinition{constructor declaration}Constructor declarations are introduced with the \texttt{init} keyword. The parent context of a constructor must be a nominal type or extension.
@@ -1026,7 +1026,7 @@ \subsection*{Declaration Contexts}
10261026
\item \texttt{getSelfInterfaceType()} is similar.
10271027
\end{itemize}
10281028

1029-
Generic prameters and requirements:
1029+
Generic parameters and requirements:
10301030
\begin{itemize}
10311031
\item \texttt{isGenericContext()} answers true if either this generic context or one of its parents has a generic parameter list.
10321032
\item \texttt{isInnermostContextGeneric()} answers if this declaration context itself has a generic parameter list. Compare with \texttt{isGenericContext()}.

docs/Generics/chapters/extensions.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ \section{Direct Lookup}\label{direct lookup}
251251
\paragraph{Member lookup table.}
252252
Every nominal type declaration has an associated \IndexDefinition{member lookup table}\emph{member lookup table}, which is used for direct lookup. This table maps each identifier to a list of value declarations with that name (multiple value declarations can share a name because Swift allows type-based overloading). The declarations in a member lookup table are understood to be members of one or more iterable declaration contexts, which are exactly the type declaration itself and all of its extensions. These iterable declaration contexts might originate from a mix of different module kinds. For example, the nominal type itself might be an \index{Objective-C}Objective-C class from an imported Objective-C module, with one extension declared in a binary Swift module, and another extension defined in the main module, parsed from source.
253253

254-
The lookup table is populated lazily, in a manner resembling a state machine. Say we're asked to perform a direct lookup for some given name. If this is the first direct lookup, we populate the member lookup table with \emph{all} members from any \emph{parsed} iterable declaration contexts, which might trigger delayed parsing. Each entry in the member lookup table stores a ``complete'' bit. The ``complete'' bit of these initially-populated entries is \emph{not} set, meaning that the entry only contains those members that were parsed from source. If any iterable declaration contexts originate from binary and imported modules, direct lookup then asks each lazy member loader to selectively load only those members with the given name. (Parsed declaration contexts do not offer this level of lazyness, because there is no way to parse a subset of the members only.) After the lazy member loaders do their work, the lookup table entry for this name is now complete, and the ``complete'' bit is set. Later when direct lookup finds a member lookup table entry with the ``complete'' bit set, it knows this entry is fully populated, and the stored list of declarations is returned immediately without querying the lazy member loaders.
254+
The lookup table is populated lazily, in a manner resembling a state machine. Say we're asked to perform a direct lookup for some given name. If this is the first direct lookup, we populate the member lookup table with \emph{all} members from any \emph{parsed} iterable declaration contexts, which might trigger delayed parsing. Each entry in the member lookup table stores a ``complete'' bit. The ``complete'' bit of these initially-populated entries is \emph{not} set, meaning that the entry only contains those members that were parsed from source. If any iterable declaration contexts originate from binary and imported modules, direct lookup then asks each lazy member loader to selectively load only those members with the given name. (Parsed declaration contexts do not offer this level of laziness, because there is no way to parse a subset of the members only.) After the lazy member loaders do their work, the lookup table entry for this name is now complete, and the ``complete'' bit is set. Later when direct lookup finds a member lookup table entry with the ``complete'' bit set, it knows this entry is fully populated, and the stored list of declarations is returned immediately without querying the lazy member loaders.
255255

256256
This \emph{lazy member loading} mechanism ensures that only those members which are actually referenced in a compilation session are loaded from serialized and imported iterable declaration contexts.
257257

docs/Generics/chapters/generic-signatures.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1377,7 +1377,7 @@ \section{Source Code Reference}\label{genericsigsourceref}
13771377

13781378
\IndexSource{canonical generic signature}
13791379
\apiref{CanGenericSignature}{class}
1380-
The \texttt{CanGenericSignature} class wraps a \texttt{GenericSignatureImpl *} pointer which is known to be canonical. The pointer can be recovered with the \texttt{getPointer()} method. There is an implicit conversion from \texttt{CanGenenericSiganture} to \texttt{GenericSignature}. The \texttt{operator->} forwards method calls to the underlying \texttt{GenericSignatureImpl}.
1380+
The \texttt{CanGenericSignature} class wraps a \texttt{GenericSignatureImpl *} pointer which is known to be canonical. The pointer can be recovered with the \texttt{getPointer()} method. There is an implicit conversion from \texttt{CanGenericSignature} to \texttt{GenericSignature}. The \texttt{operator->} forwards method calls to the underlying \texttt{GenericSignatureImpl}.
13811381

13821382
The \texttt{operator==} and \texttt{operator!=} operators are used to test \texttt{CanGenericSignature} for pointer equality. The \texttt{isEqual()} method of \texttt{GenericSignatureImpl} implements canonical equality on arbitrary generic signatures by first canonicalizing both sides, then checking the resulting canonical signatures for pointer equality. Therefore, the following are equivalent:
13831383
\begin{Verbatim}

docs/Generics/chapters/monoids.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ \section{Finitely-Presented Monoids}\label{finitely presented monoids}
360360
\item For every pair of distinct prime numbers $p$ and $q$, we have $p\cdot q\sim q\cdot p$, so our binary operation is commutative.
361361
\item For every prime number $p$, we have $0\cdot p\sim 0$ and $p\cdot 0\sim 0$, so that zero behaves like the \index{zero element}zero element.
362362
\end{itemize}
363-
In fact, no ``smaller'' presentation exists. It is perhaps surprising to constrast this with $(\mathbb{N},+,0)$, which just the free monoid with one generator.
363+
In fact, no ``smaller'' presentation exists. It is perhaps surprising to contrast this with $(\mathbb{N},+,0)$, which just the free monoid with one generator.
364364
\end{example}
365365

366366
\paragraph{Mathematical aside.}

docs/Generics/chapters/symbols-terms-and-rules.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,7 @@ \subsection*{Symbols}
993993
\IndexSource{rule builder}
994994
collectRulesFromReferencedProtocols() is actually the algorithm from the previous section.
995995

996-
\apiref{rewriting::Trie}{tempalte class}
996+
\apiref{rewriting::Trie}{template class}
997997
\IndexSource{trie}
998998

999999
See also \SecRef{completion sourceref}.

0 commit comments

Comments
 (0)