Raise precedence of "is". Fix #119.

This commit is contained in:
Bob Nystrom
2015-01-18 10:20:13 -08:00
parent ae97e9c3a4
commit d8b678356e
3 changed files with 5 additions and 4 deletions

View File

@ -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, // | &

View File

@ -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

View File

@ -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