Explorar el Código

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

closes #7132
Simon Krajewski hace 7 años
padre
commit
bcea7ec64a
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  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
 			else begin match e.eexpr,follow cf.cf_type with
 				| TConst (TInt i),TAbstract({a_path=[],"Float"},_) ->
 				| TConst (TInt i),TAbstract({a_path=[],"Float"},_) ->
 					(* turn int constant to float constant if expected type is 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
 					mk_cast e cf.cf_type e.epos
 			end
 			end