summaryrefslogtreecommitdiffstats
path: root/typing/ctype.ml
diff options
context:
space:
mode:
Diffstat (limited to 'typing/ctype.ml')
-rw-r--r--typing/ctype.ml12
1 files changed, 9 insertions, 3 deletions
diff --git a/typing/ctype.ml b/typing/ctype.ml
index 5e27441ea..cbd9ec144 100644
--- a/typing/ctype.ml
+++ b/typing/ctype.ml
@@ -1176,9 +1176,15 @@ let rec copy_sep fixed free bound visited ty =
t
end
-let instance_poly fixed univars sch =
- let vars = List.map (fun _ -> newvar ()) univars in
- let pairs = List.map2 (fun u v -> repr u, (v, [])) univars vars in
+let instance_poly ?(keep_names=false) fixed univars sch =
+ let univars = List.map repr univars in
+ let copy_var ty =
+ match ty.desc with
+ Tunivar name -> if keep_names then newty (Tvar name) else newvar ()
+ | _ -> assert false
+ in
+ let vars = List.map copy_var univars in
+ let pairs = List.map2 (fun u v -> u, (v, [])) univars vars in
delayed_copy := [];
let ty = copy_sep fixed (compute_univars sch) [] pairs sch in
List.iter Lazy.force !delayed_copy;