Quellcode durchsuchen

allow parentheses for intersection constraints (#8869)

Aleksandr Kuzmenko vor 5 Jahren
Ursprung
Commit
4f2b86af17
2 geänderte Dateien mit 14 neuen und 0 gelöschten Zeilen
  1. 1 0
      src/syntax/grammar.mly
  2. 13 0
      tests/unit/src/unit/issues/Issue8869.hx

+ 1 - 0
src/syntax/grammar.mly

@@ -926,6 +926,7 @@ and parse_constraint_param s =
 		let cto = (match s with parser
 			| [< '(DblDot,_); s >] ->
 				(match s with parser
+				| [< '(POpen,p1); t = parse_complex_type; '(PClose,p2) >] -> Some t
 				| [< t = parse_complex_type >] -> Some t
 				| [< >] -> serror())
 			| [< >] -> None

+ 13 - 0
tests/unit/src/unit/issues/Issue8869.hx

@@ -0,0 +1,13 @@
+package unit.issues;
+
+class Issue8869 extends Test {
+	function test() {
+		noAssert();
+	}
+
+	function checkIntersectionConstraintInParentheses<T:(haxe.Constraints.Constructible<Void->Void> & Dummy)>(cl:Class<T>) {}
+}
+
+private class Dummy {
+	public function new() {}
+}