summaryrefslogtreecommitdiff
path: root/typing/printtyp.ml
diff options
context:
space:
mode:
authoroctachron <octa@polychoron.fr>2022-10-21 19:02:07 +0200
committerFlorian Angeletti <florian.angeletti@inria.fr>2023-01-02 15:39:24 +0100
commit949fc82370d9d297d82de26441bbcb497c77809e (patch)
treeefa01ba0770086f886a5939aeff89151fab6a76e /typing/printtyp.ml
parentfc7e37af5a64e68ca40f2cb8b438707b6397e27d (diff)
downloadocaml-949fc82370d9d297d82de26441bbcb497c77809e.tar.gz
review: another ordinal description
Diffstat (limited to 'typing/printtyp.ml')
-rw-r--r--typing/printtyp.ml9
1 files changed, 4 insertions, 5 deletions
diff --git a/typing/printtyp.ml b/typing/printtyp.ml
index f8a8d8315f..385c5e63fa 100644
--- a/typing/printtyp.ml
+++ b/typing/printtyp.ml
@@ -271,14 +271,13 @@ let with_hidden ids f =
protect_refs [ R(bound_in_recursion, updated )] f
let human_id id index =
+ (* The identifier with index [k] is the (k+1)-th most recent identifier in
+ the printing environment. We print them as [name/(k+1)] except for [k=0]
+ which is printed as [name] rather than [name/1].
+ *)
if index = 0 then
Ident.name id
else
- (* We print the most k-time overshadowed identifier as `name/(k+1)`.
- This naming scheme has the advantage of creating a non-ambiguous gap
- between the identifier in scope, which is printed as `name`, and the
- most recent shadowed identifier, printed as `name/2`.
- *)
let ordinal = index + 1 in
String.concat "/" [Ident.name id; string_of_int ordinal]