Prechádzať zdrojové kódy

[parser] fix arrow function parsing hole

closes #10852
Simon Krajewski 2 rokov pred
rodič
commit
c02d444156

+ 1 - 1
src/syntax/grammar.mly

@@ -1545,7 +1545,7 @@ and expr_next' e1 = parser
 		let e2 = check_signature_mark e2 p1 p2 in
 		expr_next (EArray (e1,e2), punion (pos e1) p2) s
 	| [< '(Arrow,pa); s >] ->
-		let er = expr s in
+		let er = secure_expr s in
 		arrow_function (snd e1) [arrow_first_param e1 s] er s
 	| [< '(Binop OpGt,p1); s >] ->
 		(match s with parser

+ 6 - 0
tests/misc/projects/Issue10852/Main.hx

@@ -0,0 +1,6 @@
+class Main {
+    static function main() {
+        foo((o) ->);
+    }
+    static function foo(?f:Dynamic->Bool) {}
+}

+ 2 - 0
tests/misc/projects/Issue10852/compile-fail.hxml

@@ -0,0 +1,2 @@
+--main Main
+--interp

+ 1 - 0
tests/misc/projects/Issue10852/compile-fail.hxml.stderr

@@ -0,0 +1 @@
+Main.hx:3: characters 19-20 : Expected expression