diff options
author | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 2009-03-10 04:47:04 +0000 |
---|---|---|
committer | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 2009-03-10 04:47:04 +0000 |
commit | 0cf7c0578f1abdc840018947f73fe535fc4c1f24 (patch) | |
tree | 006d403be82ae142350b4e56c388357a036b6ab7 | |
parent | 5035e812ed5827de7c63e1703ddd689afc4c784a (diff) | |
download | ocaml-3.10.tar.gz |
fix unsoundness in variance checking for private types3.10
git-svn-id: http://caml.inria.fr/svn/ocaml/version/3.10@9183 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | typing/typedecl.ml | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/typing/typedecl.ml b/typing/typedecl.ml index f0ce9836c6..1472ec3a57 100644 --- a/typing/typedecl.ml +++ b/typing/typedecl.ml @@ -509,7 +509,7 @@ let compute_variance_decl env check decl (required, loc) = in List.iter2 (fun (ty, co, cn, ct) (c, n) -> - if ty.desc <> Tvar || priv = Private then begin + if ty.desc <> Tvar then begin co := c; cn := n; ct := n; compute_variance env tvl2 c n n ty end) @@ -528,6 +528,7 @@ let compute_variance_decl env check decl (required, loc) = incr pos; if !co && not c || !cn && not n then raise (Error(loc, Bad_variance (!pos, (!co,!cn), (c,n)))); + if priv = Private then (c, n, n) else let ct = if decl.type_kind = Type_abstract then ct else cn in (!co, !cn, !ct)) tvl0 required |