瀏覽代碼

revert fb0bfc5e37ef2cd46e8cb9eb45f02882a257827d

cloes #7885
see #7699
Simon Krajewski 6 年之前
父節點
當前提交
bd7985b33f
共有 2 個文件被更改,包括 5 次插入37 次删除
  1. 5 17
      src/typing/macroContext.ml
  2. 0 20
      tests/display/src/cases/Issue7699.hx

+ 5 - 17
src/typing/macroContext.ml

@@ -646,23 +646,11 @@ let type_macro ctx mode cpath f (el:Ast.expr list) p =
 				| _ -> ());
 				e
 			with Error (Custom _,_) ->
-				let has_display e =
-					let rec loop e = match fst e with
-						| EDisplay _ -> raise Exit
-						| _ -> Ast.iter_expr loop e
-					in
-					try
-						loop e;
-						false
-					with Exit ->
-						true
-				in
-				if has_display e then
-					(* if the expression has EDisplay, pass it through as-is and hope that unify_call_args deals with it (issue #7699) *)
-					e
-				else
-					(* if it's not a constant, let's make something that is typed as haxe.macro.Expr - for nice error reporting *)
-					(ECheckType((EConst (Ident "null"),p),(CTPath ctexpr,p)),p)
+				(* if it's not a constant, let's make something that is typed as haxe.macro.Expr - for nice error reporting *)
+				(EBlock [
+					(EVars [("__tmp",null_pos),false,Some (CTPath ctexpr,p),Some (EConst (Ident "null"),p)],p);
+					(EConst (Ident "__tmp"),p);
+				],p)
 			) in
 			(* let's track the index by doing [e][index] (we will keep the expression type this way) *)
 			incr index;

+ 0 - 20
tests/display/src/cases/Issue7699.hx

@@ -1,20 +0,0 @@
-package cases;
-
-class Issue7699 extends DisplayTestCase {
-	/**
-		class Main {
-			public static function main() {
-				#if !macro
-				foo("".{-1-});
-				#end
-			}
-
-			static macro function foo(s:String) {
-				return macro {};
-			}
-		}
-	**/
-	function test() {
-		eq(true, hasField(fields(pos(1)), "length", "Int"));
-	}
-}