mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-11 22:28:45 +01:00
Raise precedence of "is". Fix #119.
This commit is contained in:
@ -1311,8 +1311,8 @@ typedef enum
|
||||
PREC_LOWEST,
|
||||
PREC_ASSIGNMENT, // =
|
||||
PREC_LOGIC, // && ||
|
||||
PREC_IS, // is
|
||||
PREC_EQUALITY, // == !=
|
||||
PREC_IS, // is
|
||||
PREC_COMPARISON, // < > <= >=
|
||||
PREC_RANGE, // .. ...
|
||||
PREC_BITWISE, // | &
|
||||
|
||||
@ -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
|
||||
@ -22,6 +22,10 @@ IO.print(false == 2 <= 1) // expect: true
|
||||
// >= has higher precedence than ==.
|
||||
IO.print(false == 1 >= 2) // expect: true
|
||||
|
||||
// is has higher precedence than ==.
|
||||
IO.print(true == 10 is Num) // expect: true
|
||||
IO.print(10 is Num == false) // expect: false
|
||||
|
||||
// Unary - has lower precedence than ..
|
||||
IO.print(-"abc".count) // expect: -3
|
||||
|
||||
Reference in New Issue
Block a user