make the dummy method disappear when finalizing a class

master
Thomas Refis 2018-02-17 11:12:37 +00:00
parent e524660a68
commit 86e1c8a4e0
4 changed files with 16 additions and 1 deletions

Binary file not shown.

Binary file not shown.

View File

@ -3547,7 +3547,7 @@ let match_class_types ?(trace=true) env pat_sch subj_sch =
| _ -> CM_Hide_public lab::err
end
in
if Concr.mem lab sign1.csig_concr then err
if lab = dummy_method || Concr.mem lab sign1.csig_concr then err
else CM_Hide_virtual ("method", lab) :: err)
miss1 []
in

View File

@ -1572,6 +1572,21 @@ let final_decl env define_class
raise(Error(cl.pci_loc, env, Non_collapsable_conjunction (id, clty, trace)))
end;
(* make the dummy method disappear *)
begin
let self_type = Ctype.self_type clty.cty_type in
let methods, _ =
Ctype.flatten_fields
(Ctype.object_fields (Ctype.expand_head env self_type))
in
List.iter (fun (lab,kind,_) ->
if lab = dummy_method then
match Btype.field_kind_repr kind with
Fvar r -> Btype.set_kind r Fabsent
| _ -> ()
) methods
end;
List.iter Ctype.generalize clty.cty_params;
generalize_class_type true clty.cty_type;
Misc.may Ctype.generalize clty.cty_new;