Correctly parse negated literals as const args

This commit is contained in:
Jonas Schievink 2021-04-29 02:16:22 +02:00
parent 49b219b103
commit caee3a2eeb
3 changed files with 40 additions and 0 deletions

View file

@ -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);