fail_precedence_and_or.carbon 1.3 KB

12345678910111213141516171819202122232425
  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: 'DeclaredName', 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: 'NameReference', text: 'a'},
  13. // CHECK:STDOUT: {kind: 'NameReference', text: 'b'},
  14. // CHECK:STDOUT: {kind: 'InfixOperator', text: 'and', subtree_size: 3},
  15. // CHECK:STDOUT: {kind: 'NameReference', text: 'c'},
  16. // CHECK:STDOUT: {kind: 'InfixOperator', text: 'or', has_error: yes, subtree_size: 5},
  17. // CHECK:STDOUT: {kind: 'ExpressionStatement', text: ';', subtree_size: 6},
  18. // CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 12},
  19. // CHECK:STDOUT: {kind: 'FileEnd', text: ''},
  20. // CHECK:STDOUT: ]
  21. fn F() {
  22. // CHECK:STDERR: toolchain/parser/testdata/operators/fail_precedence_and_or.carbon:[[@LINE+1]]:11: Parentheses are required to disambiguate operator precedence.
  23. a and b or c;
  24. }