fix: raise precedence of is above equality operators in parser
The `is` operator was placed at `PREC_IS` which had lower precedence than `PREC_EQUALITY`, causing expressions like `true == 10 is Num` to parse incorrectly. Moved `PREC_IS` above `PREC_EQUALITY` in the precedence enum to give `is` higher binding power than `==` and `!=`. Added precedence tests in new `test/precedence.wren` file and removed TODO comments about precedence from `test/is/is.wren`.
This commit is contained in:
@@ -28,9 +28,6 @@ IO.print(new Fn { 1 } is Class) // expect: false
|
||||
IO.print("s" is Class) // expect: false
|
||||
IO.print(123 is Class) // expect: false
|
||||
|
||||
// TODO: Non-class on RHS.
|
||||
// TODO: Precedence and associativity.
|
||||
|
||||
// Ignore newline after "is".
|
||||
IO.print(123 is
|
||||
Num) // expect: true
|
||||
Reference in New Issue
Block a user