@@ -718,7 +718,7 @@ Locators
718
718
During constraint generation and solving, numerous constraints are
719
719
created, broken apart, and solved. During constraint application as
720
720
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
722
722
which they originally came. For example, consider the following type
723
723
checking problem::
724
724
@@ -754,16 +754,16 @@ functions was selected to perform the conversion, so that conversion
754
754
function can be called by constraint application if all else succeeds.
755
755
756
756
*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.
767
767
768
768
When constraints are simplified, the resulting constraints have
769
769
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
812
812
the path of the solver, and can be used to query and recover the
813
813
important decisions made by the solver. However, the locators
814
814
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
816
816
location. For example, the failed constraint "``Int `` conforms to
817
817
``ExpressibleByFloatLiteral ``" can most specifically by centered on the
818
818
floating-point literal ``10.5 ``, but its locator is::
819
819
820
820
function application -> apply argument -> tuple element #0
821
821
822
822
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
824
824
locator (in this case, the application ``f(10.5, x) ``) and then walks
825
825
the path, matching derivation steps to subexpressions. The "function
826
826
application" derivation step extracts the argument (``(10.5,
0 commit comments