Skip to content

Commit

Permalink
Check that the class method type unifies with the field expression ty…
Browse files Browse the repository at this point in the history
…pe instead.

Also check that the field expression is a function to avoid the Dynamic case.
  • Loading branch information
basro committed Jun 20, 2020
1 parent fef40fc commit c51a36f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/optimization/inlineConstructors.ml
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,8 @@ let inline_constructors ctx original_e =
begin match get_io_inline_method io fname with
| Some(c, tl, cf, tf)->
let method_type = apply_params c.cl_params tl cf.cf_type in
if type_iseq_strict method_type efield.etype then
let field_is_function = match efield.etype with | TFun _ -> true | _ -> false in
if field_is_function && Type.does_unify method_type efield.etype then
IOFInlineMethod(io,iv,c,tl,cf,tf)
else begin
cancel_iv iv efield.epos;
Expand Down

0 comments on commit c51a36f

Please sign in to comment.