Browse Source

fix Int+UInt=UInt generation (close #2082)

Nicolas Cannasse 11 years ago
parent
commit
00b105af68
1 changed files with 4 additions and 1 deletions
  1. 4 1
      genswf9.ml

+ 4 - 1
genswf9.ml

@@ -1626,7 +1626,10 @@ and gen_binop ctx retval op e1 e2 t p =
 			let k1 = classify ctx e1.etype in
 			let k1 = classify ctx e1.etype in
 			let k2 = classify ctx e2.etype in
 			let k2 = classify ctx e2.etype in
 			(match k1, k2 with
 			(match k1, k2 with
-			| KInt, KInt | KUInt, KUInt | KInt, KUInt | KUInt, KInt -> write ctx (HOp iop)
+			| KInt, KInt | KUInt, KUInt | KInt, KUInt | KUInt, KInt ->
+				write ctx (HOp iop);
+				let ret = classify ctx t in
+				if ret <> KInt then coerce ctx ret
 			| _ ->
 			| _ ->
 				write ctx (HOp op);
 				write ctx (HOp op);
 				(* add is a generic operation, so let's make sure we don't loose our type in the process *)
 				(* add is a generic operation, so let's make sure we don't loose our type in the process *)