Update precedence rules to match design. (#3081)

- Only allow assignment at the top level in an expression statement.
- Allow both negation and complement as subexpressions of both bitwise
  and numeric operators.
- Remove parsing support for postincrement and postdecrement.
- Add parsing support for `as` operator.
- Use the same ambient precedence for types and non-type expressions.

---------

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
This commit is contained in:
Richard Smith
2023-08-10 18:39:37 +00:00
committed by GitHub
co-authored by Chandler Carruth
parent 3cca175a57
commit fc5a9541ce
18 changed files with 634 additions and 99 deletions
@@ -4,9 +4,6 @@
//
// AUTOUPDATE
// CHECK:STDERR: fail_dereference_type.carbon:[[@LINE+9]]:8: Parentheses are required around this unary `*` operator.
// CHECK:STDERR: var p: *i32;
// CHECK:STDERR: ^
// CHECK:STDERR: fail_dereference_type.carbon:[[@LINE+6]]:8: Cannot dereference operand of non-pointer type `type`.
// CHECK:STDERR: var p: *i32;
// CHECK:STDERR: ^