瀏覽代碼

[typer] don't have float constants typed as Int...

closes #7132
Simon Krajewski 7 年之前
父節點
當前提交
bcea7ec64a
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/typing/typeloadFields.ml

+ 1 - 1
src/typing/typeloadFields.ml

@@ -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