From caee3a2eebd514f5a2f5e68a9fcd4428fa34d41c Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Thu, 29 Apr 2021 02:16:22 +0200 Subject: Correctly parse negated literals as const args --- crates/parser/src/grammar/type_args.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'crates/parser/src') diff --git a/crates/parser/src/grammar/type_args.rs b/crates/parser/src/grammar/type_args.rs index 42cd426bd..56266b8d4 100644 --- a/crates/parser/src/grammar/type_args.rs +++ b/crates/parser/src/grammar/type_args.rs @@ -59,6 +59,15 @@ fn generic_arg(p: &mut Parser) { expressions::literal(p); m.complete(p, CONST_ARG); } + // test const_generic_negated_literal + // fn f() { S::<-1> } + T![-] => { + let lm = p.start(); + p.bump(T![-]); + expressions::literal(p); + lm.complete(p, PREFIX_EXPR); + m.complete(p, CONST_ARG); + } _ => { types::type_(p); m.complete(p, TYPE_ARG); -- cgit v1.2.3