mirror of
https://github.com/typst/typst
synced 2025-05-13 20:46:23 +08:00
Fix "not in" precedence
This commit is contained in:
parent
ebe919220d
commit
03cbdea4b4
@ -562,7 +562,8 @@ fn code_expr_prec(p: &mut Parser, atomic: bool, min_prec: usize) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let binop = if p.eat_if(SyntaxKind::Not) {
|
||||
let binop =
|
||||
if ast::BinOp::NotIn.precedence() >= min_prec && p.eat_if(SyntaxKind::Not) {
|
||||
if p.at(SyntaxKind::In) {
|
||||
Some(ast::BinOp::NotIn)
|
||||
} else {
|
||||
|
@ -23,6 +23,10 @@
|
||||
// Error: 3-12 cannot apply '-' to boolean
|
||||
#{-not true}
|
||||
|
||||
---
|
||||
// Not in handles precedence.
|
||||
#test(-1 not in (1, 2, 3), true)
|
||||
|
||||
---
|
||||
// Parentheses override precedence.
|
||||
#test((1), 1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user