finish fixing PR#5322

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@11158 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Jacques Garrigue 2011-07-29 01:44:00 +00:00
parent d89c73b659
commit 173c44001c
4 changed files with 16 additions and 6 deletions

View File

@ -20,8 +20,7 @@ Standard library:
with user-provided hash functions.
Bug Fixes:
- type abbreviations expanding to a universal type variable were not working
correctly during unification
- PR#5322: type abbreviations expanding to a universal type variable
OCaml 3.12.1:
----------------------

View File

@ -0,0 +1,3 @@
BASEDIR=../..
include $(BASEDIR)/makefiles/Makefile.okbad
include $(BASEDIR)/makefiles/Makefile.common

View File

@ -0,0 +1,7 @@
type 'par t = 'par
module M : sig val x : <m : 'a. 'a> end =
struct let x : <m : 'a. 'a t> = Obj.magic () end
let ident v = v
class alias = object method alias : 'a . 'a t -> 'a = ident end

View File

@ -2060,9 +2060,7 @@ let rec moregen inst_nongen type_pairs env t1 t2 =
try
match (t1.desc, t2.desc) with
(Tunivar, Tunivar) ->
unify_univar t1 t2 !univar_pairs
| (Tvar, _) when may_instantiate inst_nongen t1 ->
(Tvar, _) when may_instantiate inst_nongen t1 ->
moregen_occur env t1.level t2;
occur env t1 t2;
link_type t1 t2
@ -2091,7 +2089,8 @@ let rec moregen inst_nongen type_pairs env t1 t2 =
| (Tconstr (p1, tl1, _), Tconstr (p2, tl2, _))
when Path.same p1 p2 ->
moregen_list inst_nongen type_pairs env tl1 tl2
| Tpackage (p1, n1, tl1), Tpackage (p2, n2, tl2) when Path.same p1 p2 && n1 = n2 ->
| (Tpackage (p1, n1, tl1), Tpackage (p2, n2, tl2))
when Path.same p1 p2 && n1 = n2 ->
moregen_list inst_nongen type_pairs env tl1 tl2
| (Tvariant row1, Tvariant row2) ->
moregen_row inst_nongen type_pairs env row1 row2
@ -2106,6 +2105,8 @@ let rec moregen inst_nongen type_pairs env t1 t2 =
| (Tpoly (t1, tl1), Tpoly (t2, tl2)) ->
enter_poly env univar_pairs t1 tl1 t2 tl2
(moregen inst_nongen type_pairs env)
| (Tunivar, Tunivar) ->
unify_univar t1' t2' !univar_pairs
| (_, _) ->
raise (Unify [])
end