Skip to content

Commit e1de97e

Browse files
committed
Merge pull request #239 from sukolsak/fix-typos
Fix typos and formatting in TypeChecker.rst
2 parents 4ebb461 + 5fc4690 commit e1de97e

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

docs/TypeChecker.rst

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,12 @@ the Swift type system:
126126
to the second, which includes subtyping and equality. Additionally,
127127
it allows a user-defined conversion function to be
128128
called. Conversion constraints are written ``X <c Y``, read as
129-
```X`` can be converted to ``Y```.
129+
"``X`` can be converted to ``Y``."
130130

131131
**Construction**
132132
A construction constraint, written ``X <C Y`` requires that the
133133
second type be a nominal type with a constructor that accepts a
134-
value of the first type. For example, the constraint``Int <C
134+
value of the first type. For example, the constraint ``Int <C
135135
String`` is satisfiable because ``String`` has a constructor that
136136
accepts an ``Int``.
137137

@@ -146,11 +146,11 @@ the Swift type system:
146146

147147
**Conformance**
148148
A conformance constraint ``X conforms to Y`` specifies that the
149-
first type (''X'') must conform to the protocol ``Y``.
149+
first type (``X``) must conform to the protocol ``Y``.
150150

151151
**Checked cast**
152152
A constraint describing a checked cast from the first type to the
153-
second, i.e., for ''x as T''.
153+
second, i.e., for ``x as T``.
154154

155155
**Applicable function**
156156
An applicable function requires that both types are function types
@@ -266,7 +266,7 @@ and types generated from the primary expression kinds are:
266266
i.e., the result type of the function.
267267

268268
**Construction**
269-
A type construction``A(b)``, where ``A`` refers to a type, generates
269+
A type construction ``A(b)``, where ``A`` refers to a type, generates
270270
a construction constraint ``T(b) <C A``, which requires that ``A``
271271
have a constructor that accepts ``b``. The type of the expression is
272272
``A``.
@@ -368,18 +368,18 @@ that will be bound to the enum type and ``T1`` is a fresh type
368368
variable that will be bound to the type of the selected member. The
369369
issue noted in the prior section is that this constraint does not give
370370
the solver enough information to determine ``T0`` without
371-
guesswork. However, we note that the type of a enum member actually
371+
guesswork. However, we note that the type of an enum member actually
372372
has a regular structure. For example, consider the ``Optional`` type::
373373

374374
enum Optional<T> {
375375
case None
376376
case Some(T)
377377
}
378378

379-
The type of ``Optional<T>.Vone`` is ``Optional<T>``, while the type of
379+
The type of ``Optional<T>.None`` is ``Optional<T>``, while the type of
380380
``Optional<T>.Some`` is ``(T) -> Optional<T>``. In fact, the
381-
type of a enum element can have one of two forms: it can be ``T0``,
382-
for a enum element that has no extra data, or it can be ``T2 -> T0``,
381+
type of an enum element can have one of two forms: it can be ``T0``,
382+
for an enum element that has no extra data, or it can be ``T2 -> T0``,
383383
where ``T2`` is the data associated with the enum element. For the
384384
latter case, the actual arguments are parsed as part of the unresolved
385385
member reference, so that a function application constraint describes
@@ -403,8 +403,8 @@ concrete type, so long as that type conforms to the protocol
403403
``Comparable``. The type of ``min`` is (internally) written as ``<T :
404404
Comparable> (x: T, y: T) -> T``, which can be read as "for all ``T``,
405405
where ``T`` conforms to ``Comparable``, the type of the function is
406-
``(x: T, y: T) -> T``. Different uses of the ``min`` function may
407-
have different bindings for the generic parameter``T``.
406+
``(x: T, y: T) -> T``." Different uses of the ``min`` function may
407+
have different bindings for the generic parameter ``T``.
408408

409409
When the constraint generator encounters a reference to a generic
410410
function, it immediately replaces each of the generic parameters within
@@ -433,8 +433,8 @@ solver. For example, consider the following generic dictionary type::
433433
// ...
434434
}
435435

436-
When the constraint solver encounters the expression ``
437-
Dictionary()``, it opens up the type ``Dictionary``---which has not
436+
When the constraint solver encounters the expression ``Dictionary()``,
437+
it opens up the type ``Dictionary``---which has not
438438
been provided with any specific generic arguments---to the type
439439
``Dictionary<T0, T1>``, for fresh type variables ``T0`` and ``T1``,
440440
and introduces the constraint ``T0 conforms to Hashable``. This allows
@@ -530,7 +530,7 @@ constraint ``A.member == B`` can be simplified when the type of ``A``
530530
is determined to be a nominal or tuple type, in which case name lookup
531531
can resolve the member name to an actual declaration. That declaration
532532
has some type ``C``, so the member constraint is simplified to the
533-
exact equality constraint``B := C``.
533+
exact equality constraint ``B := C``.
534534

535535
The member name may refer to a set of overloaded declarations. In this
536536
case, the type ``C`` is a fresh type variable (call it ``T0``). A
@@ -736,12 +736,12 @@ checking problem::
736736
f(10.5, x)
737737

738738
This constraint system generates the constraints "``T(f)`` ==Fn ``T0
739-
-> T1``" (for fresh variables ``T0`` and ``T1``), "``(T2, X)`` <c
740-
``T0``" (for fresh variable ``T2``) and "``T2 conforms to
739+
-> T1``" (for fresh variables ``T0`` and ``T1``), "``(T2, X) <c
740+
T0``" (for fresh variable ``T2``) and "``T2`` conforms to
741741
``FloatLiteralConvertible``". As part of the solution, after ``T0`` is
742742
replaced with ``(i : Int, s : String)``, the second of
743-
these constraints is broken down into "``T2 <c ``Int``" and "``X`` <c
744-
``String``". These two constraints are interesting for different
743+
these constraints is broken down into "``T2 <c Int``" and "``X <c
744+
String``". These two constraints are interesting for different
745745
reasons: the first will fail, because ``Int`` does not conform to
746746
``FloatLiteralConvertible``. The second will succeed by selecting one
747747
of the (overloaded) conversion functions.
@@ -762,7 +762,7 @@ zero or more derivation steps from that anchor. For example, the
762762
"``T(f)`` ==Fn ``T0 -> T1``" constraint has a locator that is
763763
anchored at the function application and a path with the "apply
764764
function" derivation step, meaning that this is the function being
765-
applied. Similarly, the "``(T2, X)`` <c ``T0`` constraint has a
765+
applied. Similarly, the "``(T2, X) <c T0`` constraint has a
766766
locator anchored at the function application and a path with the
767767
"apply argument" derivation step, meaning that this is the argument
768768
to the function.

0 commit comments

Comments
 (0)