Browse Source

Allow bools as const params (#6958)

Ben Morris 7 years ago
parent
commit
2e57b3ae5e
2 changed files with 13 additions and 1 deletions
  1. 3 1
      src/syntax/grammar.mly
  2. 10 0
      tests/unit/src/unit/issues/Issue6948.hx

+ 3 - 1
src/syntax/grammar.mly

@@ -484,6 +484,8 @@ and parse_type_path_or_const = parser
 	| [< '(BkOpen,p1); l = parse_array_decl; '(BkClose,p2); s >] -> TPExpr (EArrayDecl l, punion p1 p2)
 	| [< t = parse_complex_type >] -> TPType t
 	| [< '(Const c,p) >] -> TPExpr (EConst c,p)
+	| [< '(Kwd True,p) >] -> TPExpr (EConst (Ident "true"),p)
+	| [< '(Kwd False,p) >] -> TPExpr (EConst (Ident "false"),p)
 	| [< e = expr >] -> TPExpr e
 	| [< >] -> serror()
 
@@ -1154,4 +1156,4 @@ and toplevel_expr s =
 and secure_expr s =
 	match s with parser
 	| [< e = expr >] -> e
-	| [< >] -> serror()
+	| [< >] -> serror()

+ 10 - 0
tests/unit/src/unit/issues/Issue6948.hx

@@ -0,0 +1,10 @@
+package unit.issues;
+
+class Issue6948 extends Test {
+	function test() {
+		var gen:Gen<true> = null;
+	}
+}
+
+@:generic
+class Gen<@:const T>{}