fail_precedence_or_and.carbon 1.7 KB

1234567891011121314151617181920212223242526272829303132
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // AUTOUPDATE
  6. fn F() {
  7. // CHECK:STDERR: fail_precedence_or_and.carbon:[[@LINE+3]]:10: ERROR: Parentheses are required to disambiguate operator precedence.
  8. // CHECK:STDERR: a or b and c;
  9. // CHECK:STDERR: ^~~
  10. a or b and c;
  11. }
  12. // CHECK:STDOUT: - filename: fail_precedence_or_and.carbon
  13. // CHECK:STDOUT: parse_tree: [
  14. // CHECK:STDOUT: {kind: 'FileStart', text: ''},
  15. // CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
  16. // CHECK:STDOUT: {kind: 'Name', text: 'F'},
  17. // CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
  18. // CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 2},
  19. // CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
  20. // CHECK:STDOUT: {kind: 'NameExpr', text: 'a'},
  21. // CHECK:STDOUT: {kind: 'ShortCircuitOperand', text: 'or', subtree_size: 2},
  22. // CHECK:STDOUT: {kind: 'NameExpr', text: 'b'},
  23. // CHECK:STDOUT: {kind: 'InfixOperator', text: 'or', subtree_size: 4},
  24. // CHECK:STDOUT: {kind: 'ShortCircuitOperand', text: 'and', has_error: yes, subtree_size: 5},
  25. // CHECK:STDOUT: {kind: 'NameExpr', text: 'c'},
  26. // CHECK:STDOUT: {kind: 'InfixOperator', text: 'and', has_error: yes, subtree_size: 7},
  27. // CHECK:STDOUT: {kind: 'ExprStatement', text: ';', subtree_size: 8},
  28. // CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 14},
  29. // CHECK:STDOUT: {kind: 'FileEnd', text: ''},
  30. // CHECK:STDOUT: ]