diff options
author | Jonas Schievink <[email protected]> | 2021-04-29 01:16:22 +0100 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2021-04-29 01:27:55 +0100 |
commit | caee3a2eebd514f5a2f5e68a9fcd4428fa34d41c (patch) | |
tree | a86dcceb9494cd243a2e1f6c10edd1c7be1f8fb5 /crates/parser | |
parent | 49b219b1035e20143818d409404b5e6f19a7ad1d (diff) |
Correctly parse negated literals as const args
Diffstat (limited to 'crates/parser')
-rw-r--r-- | crates/parser/src/grammar/type_args.rs | 9 |
1 files changed, 9 insertions, 0 deletions
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) { | |||
59 | expressions::literal(p); | 59 | expressions::literal(p); |
60 | m.complete(p, CONST_ARG); | 60 | m.complete(p, CONST_ARG); |
61 | } | 61 | } |
62 | // test const_generic_negated_literal | ||
63 | // fn f() { S::<-1> } | ||
64 | T![-] => { | ||
65 | let lm = p.start(); | ||
66 | p.bump(T![-]); | ||
67 | expressions::literal(p); | ||
68 | lm.complete(p, PREFIX_EXPR); | ||
69 | m.complete(p, CONST_ARG); | ||
70 | } | ||
62 | _ => { | 71 | _ => { |
63 | types::type_(p); | 72 | types::type_(p); |
64 | m.complete(p, TYPE_ARG); | 73 | m.complete(p, TYPE_ARG); |