Skip to content

Commit b1ee283

Browse files
committed
[TypeChecker/Doc] NFC: Locators now refer to a generic AST node instead of expression
1 parent 5f06f33 commit b1ee283

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

docs/TypeChecker.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ Locators
718718
During constraint generation and solving, numerous constraints are
719719
created, broken apart, and solved. During constraint application as
720720
well as during diagnostics emission, it is important to track the
721-
relationship between the constraints and the actual expressions from
721+
relationship between the constraints and the actual AST nodes from
722722
which they originally came. For example, consider the following type
723723
checking problem::
724724

@@ -754,16 +754,16 @@ functions was selected to perform the conversion, so that conversion
754754
function can be called by constraint application if all else succeeds.
755755

756756
*Locators* address both issues by tracking the location and derivation
757-
of constraints. Each locator is anchored at a specific expression,
758-
i.e., the function application ``f(10.5, x)``, and contains a path of
759-
zero or more derivation steps from that anchor. For example, the
760-
"``T(f)`` ==Fn ``T0 -> T1``" constraint has a locator that is
761-
anchored at the function application and a path with the "apply
762-
function" derivation step, meaning that this is the function being
763-
applied. Similarly, the "``(T2, X) <c T0`` constraint has a
764-
locator anchored at the function application and a path with the
765-
"apply argument" derivation step, meaning that this is the argument
766-
to the function.
757+
of constraints. Each locator is anchored at a specific AST node
758+
(expression, pattern, declaration etc.) i.e., the function application
759+
``f(10.5, x)``, and contains a path of zero or more derivation steps
760+
from that anchor. For example, the "``T(f)`` ==Fn ``T0 -> T1``"
761+
constraint has a locator that is anchored at the function application
762+
and a path with the "apply function" derivation step, meaning that
763+
this is the function being applied. Similarly, the "``(T2, X) <c T0``
764+
constraint has a locator anchored at the function application and a
765+
path with the "apply argument" derivation step, meaning that this is
766+
the argument to the function.
767767

768768
When constraints are simplified, the resulting constraints have
769769
locators with longer paths. For example, when a conversion constraint between two
@@ -812,15 +812,15 @@ Locators provide the derivation of location information that follows
812812
the path of the solver, and can be used to query and recover the
813813
important decisions made by the solver. However, the locators
814814
determined by the solver may not directly refer to the most specific
815-
expression for the purposes of identifying the corresponding source
815+
AST node for the purposes of identifying the corresponding source
816816
location. For example, the failed constraint "``Int`` conforms to
817817
``ExpressibleByFloatLiteral``" can most specifically by centered on the
818818
floating-point literal ``10.5``, but its locator is::
819819

820820
function application -> apply argument -> tuple element #0
821821

822822
The process of locator simplification maps a locator to its most
823-
specific expression. Essentially, it starts at the anchor of the
823+
specific AST node. Essentially, it starts at the anchor of the
824824
locator (in this case, the application ``f(10.5, x)``) and then walks
825825
the path, matching derivation steps to subexpressions. The "function
826826
application" derivation step extracts the argument (``(10.5,

0 commit comments

Comments
 (0)