浏览代码

[display] fix display check for too many arguments

closes #9435
Simon Krajewski 5 年之前
父节点
当前提交
915daa03a0
共有 2 个文件被更改,包括 19 次插入1 次删除
  1. 1 1
      src/typing/calls.ml
  2. 18 0
      tests/display/src/cases/Issue9435.hx

+ 1 - 1
src/typing/calls.ml

@@ -201,7 +201,7 @@ let rec unify_call_args' ctx el args r callp inline force_inline =
 		| (e,p) :: el, [] ->
 			begin match List.rev !skipped with
 				| [] ->
-					if ctx.in_display then begin
+					if ctx.is_display_file && not (Diagnostics.is_diagnostics_run p) then begin
 						let e = type_expr ctx (e,p) WithType.value in
 						(e,false) :: loop el []
 					end	else call_error Too_many_arguments p

+ 18 - 0
tests/display/src/cases/Issue9435.hx

@@ -0,0 +1,18 @@
+package cases;
+
+class Issue9435 extends DisplayTestCase {
+	/**
+		class Main {
+			static function main() {
+				var i:Int;
+				foo(i, {-1-})
+			}
+
+			static function foo(arg:Int) {}
+		}
+	**/
+	function testCatch_noTypeHint() {
+		var fields = toplevel(pos(1));
+		eq(true, hasToplevel(fields, "local", "i"));
+	}
+}