Explorar o código

minor fix with - T_param

Nicolas Cannasse %!s(int64=16) %!d(string=hai) anos
pai
achega
b3dd29eb56
Modificáronse 1 ficheiros con 7 adicións e 5 borrados
  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