fail_precedence_or_and.carbon 1.5 KB

123456789101112131415161718192021222324252627282930
  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: 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: [
  13. // CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
  14. // CHECK:STDOUT: {kind: 'Name', text: 'F'},
  15. // CHECK:STDOUT: {kind: 'ParameterListStart', text: '('},
  16. // CHECK:STDOUT: {kind: 'ParameterList', text: ')', subtree_size: 2},
  17. // CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
  18. // CHECK:STDOUT: {kind: 'NameExpression', text: 'a'},
  19. // CHECK:STDOUT: {kind: 'ShortCircuitOperand', text: 'or', subtree_size: 2},
  20. // CHECK:STDOUT: {kind: 'NameExpression', text: 'b'},
  21. // CHECK:STDOUT: {kind: 'InfixOperator', text: 'or', subtree_size: 4},
  22. // CHECK:STDOUT: {kind: 'ShortCircuitOperand', text: 'and', has_error: yes, subtree_size: 5},
  23. // CHECK:STDOUT: {kind: 'NameExpression', text: 'c'},
  24. // CHECK:STDOUT: {kind: 'InfixOperator', text: 'and', has_error: yes, subtree_size: 7},
  25. // CHECK:STDOUT: {kind: 'ExpressionStatement', text: ';', subtree_size: 8},
  26. // CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 14},
  27. // CHECK:STDOUT: {kind: 'FileEnd', text: ''},
  28. // CHECK:STDOUT: ]