Skip to content

Commit

Permalink
[typer] don't have float constants typed as Int...
Browse files Browse the repository at this point in the history
closes #7132
  • Loading branch information
Simn committed Jun 6, 2018
1 parent f1e00ac commit bcea7ec
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/typing/typeloadFields.ml
Expand Up @@ -623,7 +623,7 @@ let bind_var (ctx,cctx,fctx) cf e =
else begin match e.eexpr,follow cf.cf_type with
| TConst (TInt i),TAbstract({a_path=[],"Float"},_) ->
(* turn int constant to float constant if expected type is float *)
{e with eexpr = TConst (TFloat (Int32.to_string i))}
{e with eexpr = TConst (TFloat (Int32.to_string i)); etype = cf.cf_type}
| _ ->
mk_cast e cf.cf_type e.epos
end
Expand Down

0 comments on commit bcea7ec

Please sign in to comment.