Skip to content

Commit caee3a2

Browse files
Correctly parse negated literals as const args
1 parent 49b219b commit caee3a2

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

crates/parser/src/grammar/type_args.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ fn generic_arg(p: &mut Parser) {
5959
expressions::literal(p);
6060
m.complete(p, CONST_ARG);
6161
}
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+
}
6271
_ => {
6372
types::type_(p);
6473
m.complete(p, TYPE_ARG);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fn f() { S::<-1> }

0 commit comments

Comments
 (0)