summaryrefslogtreecommitdiff
path: root/typing
diff options
context:
space:
mode:
authorJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2015-01-17 00:44:02 +0000
committerJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2015-01-17 00:44:02 +0000
commitb17021713afb693a6272b4c482c0fcf7d40e917a (patch)
tree68730381c2352275cdb50a26b451a24982f2e9f6 /typing
parent9d56bcdf08d4b071827940ca5fd542041f35282e (diff)
downloadocaml-b17021713afb693a6272b4c482c0fcf7d40e917a.tar.gz
partial fix of PR#6744
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15781 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'typing')
-rw-r--r--typing/ctype.ml13
1 files changed, 13 insertions, 0 deletions
diff --git a/typing/ctype.ml b/typing/ctype.ml
index 10c9b8d42c..9d09da913f 100644
--- a/typing/ctype.ml
+++ b/typing/ctype.ml
@@ -2744,6 +2744,19 @@ and unify_row_field env fixed1 fixed2 more l f1 f2 =
if List.memq ty tl then remq tl tl' else ty :: remq tl tl'
in
let tl2' = remq tl2 tl1 and tl1' = remq tl1 tl2 in
+ (* PR#6744 *)
+ let split_univars =
+ List.partition
+ (fun ty -> try occur_univar !env ty; true with Unify _ -> false) in
+ let (tl1',tlu1) = split_univars tl1'
+ and (tl2',tlu2) = split_univars tl2' in
+ begin match tlu1, tlu2 with
+ [], [] -> ()
+ | (tu1::tlu1), (tu2::_) ->
+ (* Attempt to merge all the types containing univars *)
+ List.iter (unify env tu1) (tlu1@tlu2)
+ | (tu::_, []) | ([], tu::_) -> occur_univar !env tu
+ end;
(* Is this handling of levels really principal? *)
List.iter (update_level !env (repr more).level) (tl1' @ tl2');
let e = ref None in