Commit 26e9c3b5 authored by POTTIER Francois's avatar POTTIER Francois

Changed the name of the visitor method for qualified types.

parent 4ae6a675
......@@ -84,18 +84,14 @@ let check_regularity loc tycon (formals : tyvar list) (actuals : core_type list)
a descending method, as it is invoked when going down into the tree. *)
let tycon_visitor_method (tycon : Longident.t) : methode =
(* We support qualified names, and, in that case, use every part of the
(* We support qualified names, and, in that case, use the last part of the
qualified name to obtain the name of the visitor method. A qualified name
is probably a nonlocal type, that is, not part of the current set of type
declarations. *)
must denote a nonlocal type. *)
(* One might like to use [last tycon] directly as the name of the method, but
that could (in theory) create a conflict with the names of other methods.
In order to guarantee the absence of conflicts, we must use a nonempty
prefix. *)
"visit_" ^ String.concat "_" (
map String.uncapitalize_ascii (Longident.flatten tycon)
(* TEMPORARY there could be clashes *)
)
"visit_" ^ Longident.last tycon
(* For every local record type constructor [tycon], there is an ascending
method, which is invoked on the way up, in order to re-build some data
......
......@@ -7,7 +7,7 @@ type t =
| Int of int
| Int32 of int32
| Int64 of int64
| Lazy of t Lazy.t
| Lazy of t lazy_t
| List of t list
| Nativeint of nativeint
| Option of t option
......@@ -18,11 +18,11 @@ type t =
| Tuple2 of (t * t)
| Tuple3 of (t * t * t)
[@@deriving
visitors { variety = "iter" },
visitors { variety = "map" },
visitors { variety = "reduce" },
visitors { variety = "endo" },
visitors { variety = "iter2" },
visitors { variety = "map2" },
visitors { variety = "reduce2" }
visitors { variety = "iter"; concrete = true },
visitors { variety = "map"; concrete = true },
visitors { variety = "reduce"; ancestors=["VisitorsRuntime.addition_monoid"]; concrete = true },
visitors { variety = "endo"; concrete = true },
visitors { variety = "iter2"; concrete = true },
visitors { variety = "map2"; concrete = true },
visitors { variety = "reduce2"; ancestors=["VisitorsRuntime.addition_monoid"]; concrete = true }
]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment