Skip to content

Commit baeb988

Browse files
authored
Merge pull request #60687 from dfperry5/type-checker-doc-cleanup
Updating to clean up the type checker document a little bit - fixed a…
2 parents b31a955 + 14f7d07 commit baeb988

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

docs/TypeChecker.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ Hindley-Milner type inference algorithm requires exponential time, and
455455
the Swift type system introduces additional complications, especially
456456
overload resolution. However, the problem size for any particular
457457
expression is still fairly small, and the constraint solver can employ
458-
a number of tricks to improve performance. The Performance_ section
458+
a number of tricks to improve performance. The [Performance](#Performance) section
459459
describes some tricks that have been implemented or are planned, and
460460
it is expected that the solver will be extended with additional tricks
461461
going forward.
@@ -530,7 +530,7 @@ The member name may refer to a set of overloaded declarations. In this
530530
case, the type ``C`` is a fresh type variable (call it ``T0``). A
531531
disjunction constraint is introduced, each term of which new overload
532532
set binds a different declaration's type to ``T0``, as described in
533-
the section on Overloading_.
533+
the section on [Overloading](#Overloading).
534534

535535
The kind of member constraint---type or value---also affects the
536536
declaration type ``C``. A type constraint can only refer to member
@@ -677,27 +677,28 @@ resolved overloads explicit. This application process walks the
677677
expression tree from the leaves to the root, rewriting each expression
678678
node based on the kind of expression:
679679

680-
*Declaration references*
680+
#### *Declaration references*
681681
Declaration references are rewritten with the precise type of the
682682
declaration as referenced. For overloaded declaration references, the
683683
``Overload*Expr`` node is replaced with a simple declaration
684684
reference expression. For references to polymorphic functions or
685685
members of generic types, a ``SpecializeExpr`` node is introduced to
686686
provide substitutions for all of the generic parameters.
687687

688-
*Member references*
688+
#### *Member references*
689689
References to members are similar to declaration
690690
references. However, they have the added constraint that the base
691691
expression needs to be a reference. Therefore, an rvalue of
692692
non-reference type will be materialized to produce the necessary
693693
reference.
694694

695-
*Literals*
695+
#### *Literals*
696696
Literals are converted to the appropriate literal type, which
697697
typically involves introducing calls to the witnesses for the
698698
appropriate literal protocols.
699699

700-
*Closures*
700+
#### *Closures*
701+
701702
Since the closure has acquired a complete function type,
702703
the body of the closure is type-checked with that
703704
complete function type.

0 commit comments

Comments
 (0)