Skip to content

Commit

Permalink
the default is now MAX priority
Browse files Browse the repository at this point in the history
We are going to start enforcing the invariant that an expression
with priority N can only directly things of higher priority.
In that case for something like this:

```
enum Expr {
    Id(Id),
    Literal(Literal),

    #[precedence(1, left)]
    Add(Expr, Expr),

    #[precedence(2, left)]
    Mul(Expr, Expr),
}
```

you want Id/Literal to be max priority so they can be embedded
into anything.
  • Loading branch information
nikomatsakis committed Nov 7, 2023
1 parent 2b49e23 commit 61226f9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/formality-core/src/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl Precedence {

impl Default for Precedence {
fn default() -> Self {
Self::new(0, Associativity::None)
Self::new(std::usize::MAX, Associativity::None)
}
}

Expand Down

0 comments on commit 61226f9

Please sign in to comment.