浏览代码

recurse on contains_pos

Nicolas Cannasse 8 年之前
父节点
当前提交
eff7e787be
共有 1 个文件被更改,包括 11 次插入1 次删除
  1. 11 1
      src/typing/typer.ml

+ 11 - 1
src/typing/typer.ml

@@ -544,10 +544,20 @@ let rec unify_call_args' ctx el args r callp inline force_inline =
 	in
 	(* let force_inline, is_extern = match cf with Some(TInst(c,_),f) -> is_forced_inline (Some c) f, c.cl_extern | _ -> false, false in *)
 	let type_against t e =
+		let contains_pos e p =
+			let rec loop e =
+				if Display.encloses_position p (pos e) && (pos e).pfile = p.pfile then raise Exit;
+				Ast.iter_expr loop e
+			in
+			try
+				loop e; false;
+			with Exit ->
+				true
+		in
 		try
 			let e = type_expr ctx e (WithType t) in
 			AbstractCast.cast_or_unify_raise ctx t e e.epos
-		with Error(l,p) when (match l with Call_error _ | Module_not_found _ -> false | _ -> Display.encloses_position p (pos e) && (pos e).pfile = p.pfile) ->
+		with Error(l,p) when (match l with Call_error _ | Module_not_found _ -> false | _ -> contains_pos e p) ->
 			raise (WithTypeError (l,p))
 	in
 	let rec loop el args = match el,args with