@@ -126,12 +126,12 @@ the Swift type system:
126
126
to the second, which includes subtyping and equality. Additionally,
127
127
it allows a user-defined conversion function to be
128
128
called. Conversion constraints are written ``X <c Y ``, read as
129
- `` ` X `` can be converted to ``Y` ``.
129
+ "`` X `` can be converted to ``Y ``."
130
130
131
131
**Construction **
132
132
A construction constraint, written ``X <C Y `` requires that the
133
133
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
135
135
String `` is satisfiable because ``String `` has a constructor that
136
136
accepts an ``Int ``.
137
137
@@ -146,11 +146,11 @@ the Swift type system:
146
146
147
147
**Conformance **
148
148
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 ``.
150
150
151
151
**Checked cast **
152
152
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 `` .
154
154
155
155
**Applicable function **
156
156
An applicable function requires that both types are function types
@@ -266,7 +266,7 @@ and types generated from the primary expression kinds are:
266
266
i.e., the result type of the function.
267
267
268
268
**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
270
270
a construction constraint ``T(b) <C A ``, which requires that ``A ``
271
271
have a constructor that accepts ``b ``. The type of the expression is
272
272
``A ``.
@@ -368,18 +368,18 @@ that will be bound to the enum type and ``T1`` is a fresh type
368
368
variable that will be bound to the type of the selected member. The
369
369
issue noted in the prior section is that this constraint does not give
370
370
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
372
372
has a regular structure. For example, consider the ``Optional `` type::
373
373
374
374
enum Optional<T> {
375
375
case None
376
376
case Some(T)
377
377
}
378
378
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
380
380
``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 ``,
383
383
where ``T2 `` is the data associated with the enum element. For the
384
384
latter case, the actual arguments are parsed as part of the unresolved
385
385
member reference, so that a function application constraint describes
@@ -403,8 +403,8 @@ concrete type, so long as that type conforms to the protocol
403
403
``Comparable ``. The type of ``min `` is (internally) written as ``<T :
404
404
Comparable> (x: T, y: T) -> T ``, which can be read as "for all ``T ``,
405
405
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 ``.
408
408
409
409
When the constraint generator encounters a reference to a generic
410
410
function, it immediately replaces each of the generic parameters within
@@ -433,8 +433,8 @@ solver. For example, consider the following generic dictionary type::
433
433
// ...
434
434
}
435
435
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
438
438
been provided with any specific generic arguments---to the type
439
439
``Dictionary<T0, T1> ``, for fresh type variables ``T0 `` and ``T1 ``,
440
440
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``
530
530
is determined to be a nominal or tuple type, in which case name lookup
531
531
can resolve the member name to an actual declaration. That declaration
532
532
has some type ``C ``, so the member constraint is simplified to the
533
- exact equality constraint``B := C``.
533
+ exact equality constraint ``B := C ``.
534
534
535
535
The member name may refer to a set of overloaded declarations. In this
536
536
case, the type ``C `` is a fresh type variable (call it ``T0 ``). A
@@ -736,12 +736,12 @@ checking problem::
736
736
f(10.5, x)
737
737
738
738
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
741
741
``FloatLiteralConvertible ``". As part of the solution, after ``T0 `` is
742
742
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
745
745
reasons: the first will fail, because ``Int `` does not conform to
746
746
``FloatLiteralConvertible ``. The second will succeed by selecting one
747
747
of the (overloaded) conversion functions.
@@ -762,7 +762,7 @@ zero or more derivation steps from that anchor. For example, the
762
762
"``T(f) `` ==Fn ``T0 -> T1 ``" constraint has a locator that is
763
763
anchored at the function application and a path with the "apply
764
764
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
766
766
locator anchored at the function application and a path with the
767
767
"apply argument" derivation step, meaning that this is the argument
768
768
to the function.
0 commit comments