فهرست منبع

do not enforce Haxe type semantics for field-less unops (see #1533)

Simon Krajewski 11 سال پیش
والد
کامیت
634bdef3bd
1فایلهای تغییر یافته به همراه4 افزوده شده و 3 حذف شده
  1. 4 3
      typer.ml

+ 4 - 3
typer.ml

@@ -2207,9 +2207,10 @@ and type_unop ctx op flag e p =
 				let cf,t,r = try loop a.a_unops with Not_found -> error "Invalid operation" p in
 				(match cf.cf_expr with
 				| None ->
-					let e = make {e with etype = apply_params a.a_types pl a.a_this} in
+					let e = {e with etype = apply_params a.a_types pl a.a_this} in
+					let e = mk (TUnop(op,flag,e)) r p in
 					(* unify ctx r e.etype p; *) (* TODO: I'm not sure why this was here (related to #2295) *)
-					{e with etype = r}
+					e
 				| Some _ ->
 					let et = type_module_type ctx (TClassDecl c) None p in
 					let ef = mk (TField (et,FStatic (c,cf))) t p in
@@ -4163,7 +4164,7 @@ let make_macro_api ctx p =
 					"addFeature", Interp.VFunction (Interp.Fun1 (fun v ->
 						Common.add_feature ctx.com (Interp.dec_string v);
 						Interp.VNull
-					));	
+					));
 					"quoteString", Interp.VFunction (Interp.Fun1 (fun v ->
 						Interp.enc_string ("\"" ^ Ast.s_escape (Interp.dec_string v) ^ "\"")
 					));