diff options
| author | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 2013-02-19 02:45:09 +0000 |
|---|---|---|
| committer | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 2013-02-19 02:45:09 +0000 |
| commit | c76b791ca4b77a4d2c14b46d30fc99b4a8b3e45c (patch) | |
| tree | d23be7d97d340fcb0bb92f23081a77861ee7246d /typing | |
| parent | 8364a09153255933c8b8783f611220fe0f4f39ce (diff) | |
| download | ocaml-c76b791ca4b77a4d2c14b46d30fc99b4a8b3e45c.tar.gz | |
Add warning 42 for disambiguated labels and constructors (compatibility with old versions)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13297 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'typing')
| -rw-r--r-- | typing/typecore.ml | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/typing/typecore.ml b/typing/typecore.ml index f082484947..f13e715852 100644 --- a/typing/typecore.ml +++ b/typing/typecore.ml @@ -597,7 +597,8 @@ end) = struct let disambiguate ?(warn=Location.prerr_warning) ?(check_lk=fun _ _ -> ()) ?scope lid env opath lbls = - match opath with + let scope = match scope with None -> lbls | Some l -> l in + let lbl = match opath with None -> begin match lbls with [] -> unbound_name_error env lid @@ -609,7 +610,6 @@ end) = struct lbl end | Some(tpath0, tpath, pr) -> - let scope = match scope with None -> lbls | Some l -> l in let warn_pr () = let kind = if type_kind = "record" then "field" else "constructor" in warn lid.loc @@ -651,6 +651,14 @@ end) = struct in raise (Error (lid.loc, env, Name_type_mismatch (type_kind, lid.txt, tp, tpl))) + in + begin match scope with + (lab1,_)::_ when lab1 == lbl -> () + | _ -> + Location.prerr_warning lid.loc + (Warnings.Disambiguated_name(get_name lbl)) + end; + lbl end module Label = NameChoice (struct |
