diff --git a/docs/CppInteroperability/UserGuide-CallingSwiftFromC++.md b/docs/CppInteroperability/UserGuide-CallingSwiftFromC++.md index b29b0d2519b80..f90f2644b9157 100644 --- a/docs/CppInteroperability/UserGuide-CallingSwiftFromC++.md +++ b/docs/CppInteroperability/UserGuide-CallingSwiftFromC++.md @@ -12,7 +12,7 @@ design for the Swift to C++ interoperability layer. **NOTE:** This document does not go over the following Swift language features yet: * Closures -* overriden methods/properties in classes +* overridden methods/properties in classes * Existential types (any P) * Nested types * Operators @@ -72,7 +72,7 @@ Swift functions that are callable from C++ are available in their corresponding Fundamental primitive types have a C++ fundamental type that represents them in C++: -|Swift Type |C++ Type |C Type (if different) | |target specifc | +|Swift Type |C++ Type |C Type (if different) | |target specific | |--- |--- |--- |--- |--- | |Void (or no return) |void | | | | |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 ```swift // Swift module 'Weather' -struct Celcius { - var temperatureInCelcius: Double +struct Celsius { + var temperatureInCelsius: Double // FEEDBACK: could provide a constructor here? // NOTE: concern about encouraging people not to use labels - init(_ t: Double) { self.temperatureInCelcius = t } + init(_ t: Double) { self.temperatureInCelsius = t } // FEEDBACK: could the compiler construct the 'initFromFahrenheit' c++ name? @expose(c++, initFromFahrenheit) @@ -315,8 +315,8 @@ Both initializers can then be used from C++: using namespace Weather; void makeSunnyDay() { - auto morningTemperature = Celcius::init(25); - auto noonTemperature = Celcius::initFromFahrenheit(90); + auto morningTemperature = Celsius::init(25); + auto noonTemperature = Celsius::initFromFahrenheit(90); } ``` @@ -558,7 +558,7 @@ public: using UpcType = swift::Tuple; - // Extracts the associated valus from Barcode.upc enum case + // Extracts the associated values from Barcode.upc enum case UpcType getUpc() const; bool isQrCode() const; @@ -698,7 +698,7 @@ public final class Bicycle: Vehicle { } ``` -Get a corresponding C++ class hierachy in C++: +Get a corresponding C++ class hierarchy in C++: ```c++ class Vehicle { ... }; diff --git a/docs/EmbeddedSwift/UserManual.md b/docs/EmbeddedSwift/UserManual.md index e7e12012cb52f..7f8d62553aef5 100644 --- a/docs/EmbeddedSwift/UserManual.md +++ b/docs/EmbeddedSwift/UserManual.md @@ -252,11 +252,11 @@ For (2), external dependencies are also triggered by specific code needing them, - dependency: `void *__stack_chk_guard;` - dependency: `void __stack_chk_fail(void);` - stack protectors can be disabled with `-disable-stack-protector` swiftc flag -- **atomics instrinsics** +- **atomics intrinsics** - on CPU architectures that don't have direct load-acquire/store-release support in the ISA, LLVM calls helper functions for atomic operations - needed by refcounting in the Embedded Swift runtime (so any class usage will trigger this dependency) - also needed when using atomics from the Synchronization module -- **multiplication/division/modulo instrinsics** +- **multiplication/division/modulo intrinsics** - on CPU architectures that don't have direct support for the math operations in the ISA - dependency (on Mach-O): `__divti3` - dependency (on Mach-O): `__modti3` diff --git a/docs/Generics/chapters/basic-operation.tex b/docs/Generics/chapters/basic-operation.tex index a2b4b55b6dccf..3a48cfe570a3d 100644 --- a/docs/Generics/chapters/basic-operation.tex +++ b/docs/Generics/chapters/basic-operation.tex @@ -136,7 +136,7 @@ \chapter{Basic Operation}\label{rqm basic operation} \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}. \end{enumerate} -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. +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. \begin{example} The compiler builds several requirement machines while type checking the code below: diff --git a/docs/Generics/chapters/completion.tex b/docs/Generics/chapters/completion.tex index 75cd8f6b95779..d78b708717b96 100644 --- a/docs/Generics/chapters/completion.tex +++ b/docs/Generics/chapters/completion.tex @@ -742,7 +742,7 @@ \section{Associated Types}\label{critical pairs} \arrow[u, Rightarrow, "\ttgp{0}{0}.(\assocsym{P}{A}.\assocsym{Q}{B}\Rightarrow\assocsym{P}{A}.\texttt{B})"']&& \end{tikzcd} \] -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: +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: \begin{quote} \begin{verbatim} <τ_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} \end{gather*} 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}}$? -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: +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: \begin{enumerate} \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. @@ -1681,7 +1681,7 @@ \section{Recursive Conformances}\label{recursive conformances redux} \[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}}\] However, we then add $c$ with defining rewrite rule $qa\sim c$: \[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}\] -Completion suceeds on $M_3$ using a reduction order where $c} forwards method calls to the underlying \texttt{GenericSignatureImpl}. +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}. 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: \begin{Verbatim} diff --git a/docs/Generics/chapters/monoids.tex b/docs/Generics/chapters/monoids.tex index 9978db5a82095..50655b7e0e51f 100644 --- a/docs/Generics/chapters/monoids.tex +++ b/docs/Generics/chapters/monoids.tex @@ -360,7 +360,7 @@ \section{Finitely-Presented Monoids}\label{finitely presented monoids} \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. \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. \end{itemize} -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. +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. \end{example} \paragraph{Mathematical aside.} diff --git a/docs/Generics/chapters/symbols-terms-and-rules.tex b/docs/Generics/chapters/symbols-terms-and-rules.tex index 9499551707418..331538127ca70 100644 --- a/docs/Generics/chapters/symbols-terms-and-rules.tex +++ b/docs/Generics/chapters/symbols-terms-and-rules.tex @@ -993,7 +993,7 @@ \subsection*{Symbols} \IndexSource{rule builder} collectRulesFromReferencedProtocols() is actually the algorithm from the previous section. -\apiref{rewriting::Trie}{tempalte class} +\apiref{rewriting::Trie}{template class} \IndexSource{trie} See also \SecRef{completion sourceref}. diff --git a/docs/Generics/chapters/type-resolution.tex b/docs/Generics/chapters/type-resolution.tex index 5630f4dfc3701..71177ff7e39ee 100644 --- a/docs/Generics/chapters/type-resolution.tex +++ b/docs/Generics/chapters/type-resolution.tex @@ -464,7 +464,7 @@ \section{Member Type Representations}\label{member type repr} func celebratePetBirthday(_ age: Pet.Age) {} \end{Verbatim} -Due to pecularities of type substitution, protocol type aliases that are also \index{generic type alias}generic are always considered to depend on \texttt{Self}, even if their underlying type does not reference \texttt{Self}, so they \index{limitation!generic type alias with protocol base}cannot be referenced with a protocol base. (In structural resolution stage, a generic type alias cannot be referenced with a \index{limitation!generic type alias with type parameter base}type parameter base, either. Perhaps it is best not to stick generic type aliases inside protocols, at all.) +Due to peculiarities of type substitution, protocol type aliases that are also \index{generic type alias}generic are always considered to depend on \texttt{Self}, even if their underlying type does not reference \texttt{Self}, so they \index{limitation!generic type alias with protocol base}cannot be referenced with a protocol base. (In structural resolution stage, a generic type alias cannot be referenced with a \index{limitation!generic type alias with type parameter base}type parameter base, either. Perhaps it is best not to stick generic type aliases inside protocols, at all.) \paragraph{General principle.} Let's say that $H$ is the generic signature of the current context, and \texttt{T} is the resolved base type of our member type representation, obtained via a recursive call to type resolution. We perform a \index{qualified lookup}qualified lookup after considering the base type \texttt{T}: \begin{itemize} diff --git a/docs/SIL.rst b/docs/SIL.rst index 75d29dfefff0c..a693416695eee 100644 --- a/docs/SIL.rst +++ b/docs/SIL.rst @@ -3747,7 +3747,7 @@ of ``scalar_pack_index``, ``pack_pack_index``, or ``dynamic_pack_index``), and it must index into a pack type with the same shape as the indexed pack type. -Third, additional restrictions must be satisifed depending on which +Third, additional restrictions must be satisfied depending on which pack indexing instruction the pack index is: - For ``scalar_pack_index``, the projected element type must be the diff --git a/docs/Swift3Compatibility.md b/docs/Swift3Compatibility.md index 992702443a4ea..23d52a870a5f3 100644 --- a/docs/Swift3Compatibility.md +++ b/docs/Swift3Compatibility.md @@ -106,7 +106,7 @@ Any other changes are likely to break clients, even more so if overrides are a p - If it's a parameter for a top-level function, a struct or enum method, or a class method you call but don't override, there should be no problem. - If it's an index for a subscript you call but don't override, there should be no problem. -Unfortunately, the remaining changes are clearly unsafe, but may still happen because of APIs that were mis-annotated. +Unfortunately, the remaining changes are clearly unsafe, but may still happen because of APIs that were misannotated. - If it's a property or a subscript element, this change **breaks source compatibility.** - If it's a result type for a top-level function, struct or enum method, or class method, this change **breaks source compatibility.**