소스 검색

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