فهرست منبع

minor fix with - T_param

Nicolas Cannasse 16 سال پیش
والد
کامیت
b3dd29eb56
1فایلهای تغییر یافته به همراه7 افزوده شده و 5 حذف شده
  1. 7 5
      typer.ml

+ 7 - 5
typer.ml

@@ -693,12 +693,14 @@ and type_unop ctx op flag e p =
 		| Neg
 		| NegBits ->
 			if set then check_assign ctx e;
-			if classify e.etype = KFloat then
-				ctx.api.tfloat
-			else begin
+			(match classify e.etype with
+			| KFloat -> ctx.api.tfloat
+			| KParam t ->
+				unify ctx e.etype ctx.api.tfloat e.epos;
+				t
+			| _ ->
 				unify ctx e.etype ctx.api.tint e.epos;
-				ctx.api.tint
-			end
+				ctx.api.tint)
 		) in
 		match op, e.eexpr with
 		| Neg , TConst (TInt i) -> mk (TConst (TInt (Int32.neg i))) t p