diff options
| author | Alain Frisch <alain@frisch.fr> | 2008-04-09 16:32:09 +0000 |
|---|---|---|
| committer | Alain Frisch <alain@frisch.fr> | 2008-04-09 16:32:09 +0000 |
| commit | 7332e6d6d3aa8743e167a506581962d105bf7788 (patch) | |
| tree | ee8827eeca7bb8fcae8207422c42a19160e256e4 /typing/typeclass.ml | |
| parent | cbfeebb112b7a3e396e26606fd3b7cd0a198e79d (diff) | |
| download | ocaml-cducetrunk.tar.gz | |
Merge from diff ocaml3100/ocaml3102: cvs update -j ocaml3100 -j ocaml3102 -kkcducetrunk
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/cducetrunk@8864 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'typing/typeclass.ml')
| -rw-r--r-- | typing/typeclass.ml | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/typing/typeclass.ml b/typing/typeclass.ml index 947f4271a3..972333455d 100644 --- a/typing/typeclass.ml +++ b/typing/typeclass.ml @@ -673,7 +673,8 @@ and class_structure cl_num final val_env met_env loc (spat, str) = Vars.fold (fun name (mut, vr, ty) l -> if vr = Virtual then name :: l else l) sign.cty_vars [] in - if mets <> [] then raise(Error(loc, Virtual_class(true, mets, vals))); + if mets <> [] || vals <> [] then + raise(Error(loc, Virtual_class(true, mets, vals))); let self_methods = List.fold_right (fun (lab,kind,ty) rem -> @@ -782,7 +783,7 @@ and class_expr cl_num val_env met_env scl = class_expr cl_num val_env met_env sfun | Pcl_fun (l, None, spat, scl') -> if !Clflags.principal then Ctype.begin_def (); - let (pat, pv, val_env, met_env) = + let (pat, pv, val_env', met_env) = Typecore.type_class_arg_pattern cl_num val_env met_env l spat in if !Clflags.principal then begin @@ -793,7 +794,7 @@ and class_expr cl_num val_env met_env scl = List.map (function (id, id', ty) -> (id, - Typecore.type_exp val_env + Typecore.type_exp val_env' {pexp_desc = Pexp_ident (Longident.Lident (Ident.name id)); pexp_loc = Location.none})) pv @@ -810,7 +811,7 @@ and class_expr cl_num val_env met_env scl = exp_type = Ctype.none; exp_env = Env.empty }] in Ctype.raise_nongen_level (); - let cl = class_expr cl_num val_env met_env scl' in + let cl = class_expr cl_num val_env' met_env scl' in Ctype.end_def (); if Btype.is_optional l && not_function cl.cl_type then Location.prerr_warning pat.pat_loc @@ -1475,16 +1476,16 @@ let report_error ppf = function "This pattern cannot match self: it only matches values of type" Printtyp.type_expr ty | Unbound_class cl -> - fprintf ppf "Unbound class@ %a" + fprintf ppf "@[Unbound class@ %a@]" Printtyp.longident cl | Unbound_class_2 cl -> - fprintf ppf "The class@ %a@ is not yet completely defined" + fprintf ppf "@[The class@ %a@ is not yet completely defined@]" Printtyp.longident cl | Unbound_class_type cl -> - fprintf ppf "Unbound class type@ %a" + fprintf ppf "@[Unbound class type@ %a@]" Printtyp.longident cl | Unbound_class_type_2 cl -> - fprintf ppf "The class type@ %a@ is not yet completely defined" + fprintf ppf "@[The class type@ %a@ is not yet completely defined@]" Printtyp.longident cl | Abbrev_type_clash (abbrev, actual, expected) -> (* XXX Afficher une trace ? *) |
