Make it more explicit that the label's type must be a Tconstr.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/record-disambiguation@13038 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
4e5463f335
commit
81b2f1770e
|
@ -558,16 +558,20 @@ let type_label_a_list ?labels env type_lbl_a opath lid_a_list =
|
|||
fst (Hashtbl.find labels s), []
|
||||
| _ ->
|
||||
let _, label = Typetexp.find_label env lid.loc lid.txt in
|
||||
let lbl_path =
|
||||
match label.lbl_res.desc with
|
||||
| Tconstr(p, _, _) -> p
|
||||
| _ -> assert false
|
||||
in
|
||||
let path =
|
||||
match opath, label.lbl_res.desc with
|
||||
Some (p1,pr), Tconstr(p2,_,_) ->
|
||||
if not (Path.same (expand_path env p1) (expand_path env p2))
|
||||
match opath with
|
||||
Some (p1,pr) ->
|
||||
if not (Path.same (expand_path env p1) (expand_path env lbl_path))
|
||||
&& not pr then
|
||||
Location.prerr_warning lid.loc
|
||||
(Warnings.Not_principal "this type-based record selection");
|
||||
p1
|
||||
| _, Tconstr (p, _, _) -> p
|
||||
| _ -> assert false
|
||||
| _ -> lbl_path
|
||||
in
|
||||
path, snd (Env.find_type_descrs path env)
|
||||
in
|
||||
|
|
Loading…
Reference in New Issue