summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2005-04-05 09:07:42 +0000
committerJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2005-04-05 09:07:42 +0000
commitc681a7edcf1567c384bdfd30bcc3dac795c3b669 (patch)
tree71e0159533abb75a647027d7b2df9b4f24775060
parent827d03d59f03e5d1d4b9603c129609e5084356a3 (diff)
fix PR#3577 (only check variance for (semi-)abstract types)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@6832 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--typing/includecore.ml13
1 files changed, 10 insertions, 3 deletions
diff --git a/typing/includecore.ml b/typing/includecore.ml
index b81774b2c..e8b26908b 100644
--- a/typing/includecore.ml
+++ b/typing/includecore.ml
@@ -137,9 +137,16 @@ let type_declarations env id decl1 decl2 =
Ctype.equal env true decl1.type_params decl2.type_params &&
Ctype.equal env false [ty1] [ty2]
end &&
- List.for_all2
- (fun (co1,cn1,ct1) (co2,cn2,ct2) -> (not co1 || co2) && (not cn1 || cn2))
- decl1.type_variance decl2.type_variance
+ if match decl2.type_kind with
+ | Type_record(_,_,priv) | Type_variant(_,priv) -> priv = Private
+ | Type_abstract ->
+ match decl2.type_manifest with None -> true
+ | Some ty -> Btype.has_constr_row (Ctype.expand_head env ty)
+ then
+ List.for_all2
+ (fun (co1,cn1,ct1) (co2,cn2,ct2) -> (not co1 || co2) && (not cn1 || cn2))
+ decl1.type_variance decl2.type_variance
+ else true
(* Inclusion between exception declarations *)