fail_precedence_or_and.carbon 1.5 KB

1234567891011121314151617181920212223242526272829
  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. // CHECK:STDOUT: [
  7. // CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
  8. // CHECK:STDOUT: {kind: 'Name', text: 'F'},
  9. // CHECK:STDOUT: {kind: 'ParameterListStart', text: '('},
  10. // CHECK:STDOUT: {kind: 'ParameterList', text: ')', subtree_size: 2},
  11. // CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
  12. // CHECK:STDOUT: {kind: 'NameExpression', text: 'a'},
  13. // CHECK:STDOUT: {kind: 'ShortCircuitOperand', text: 'or', subtree_size: 2},
  14. // CHECK:STDOUT: {kind: 'NameExpression', text: 'b'},
  15. // CHECK:STDOUT: {kind: 'InfixOperator', text: 'or', subtree_size: 4},
  16. // CHECK:STDOUT: {kind: 'ShortCircuitOperand', text: 'and', has_error: yes, subtree_size: 5},
  17. // CHECK:STDOUT: {kind: 'NameExpression', text: 'c'},
  18. // CHECK:STDOUT: {kind: 'InfixOperator', text: 'and', has_error: yes, subtree_size: 7},
  19. // CHECK:STDOUT: {kind: 'ExpressionStatement', text: ';', subtree_size: 8},
  20. // CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 14},
  21. // CHECK:STDOUT: {kind: 'FileEnd', text: ''},
  22. // CHECK:STDOUT: ]
  23. fn F() {
  24. // CHECK:STDERR: fail_precedence_or_and.carbon:[[@LINE+3]]:10: Parentheses are required to disambiguate operator precedence.
  25. // CHECK:STDERR: a or b and c;
  26. // CHECK:STDERR: ^
  27. a or b and c;
  28. }