Commit a607ad3a authored by POTTIER Francois's avatar POTTIER Francois

Do not allow [polymorphic] mode for fold visitors.

parent d2f1ecb3
......@@ -341,8 +341,11 @@ let visitor_method_type (decl : type_declaration) : core_type =
(* [fold_result_type ty] is the result type of the visitor code generated
by [visit_type ... ty], when [scheme] is [Fold]. *)
let fold_result_type ty =
ty_any (* TEMPORARY *)
let fold_result_type _ty =
(* This function is currently unimplemented and unused, because we
do not allow [polymorphic] to be [true] when [scheme] is [Fold].
Thus, we do not generate any type annotations for ascending methods. *)
ty_any
(* -------------------------------------------------------------------------- *)
......
......@@ -250,4 +250,14 @@ end)
let ancestors =
map Longident.parse (("VisitorsRuntime." ^ variety) :: ancestors)
(* If [scheme] is [Fold], then [polymorphic] must be [false]. Indeed,
we currently cannot generate polymorphic type annotations in that
case, as we cannot guess the return types of the visitor methods. *)
let () =
if scheme = Fold && polymorphic then
raise_errorf ~loc
"%s: cannot generate polymorphic\n\
type annotations for fold visitors."
plugin
end
......@@ -10,9 +10,7 @@ and 'info expr =
visitors { variety = "endo"; polymorphic = true },
visitors { variety = "reduce"; polymorphic = true },
visitors { variety = "mapreduce"; polymorphic = true },
visitors { variety = "fold"; polymorphic = true },
visitors { variety = "iter2"; polymorphic = true },
visitors { variety = "map2"; polymorphic = true },
visitors { variety = "reduce2"; polymorphic = true },
visitors { variety = "mapreduce2"; polymorphic = true },
visitors { variety = "fold2"; polymorphic = true }]
visitors { variety = "mapreduce2"; polymorphic = 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