missing_precedence_not.carbon 1.9 KB

12345678910111213141516171819202122232425262728293031
  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. // RUN: %{carbon-run-parser}
  7. // CHECK:STDOUT: [
  8. // CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
  9. // CHECK:STDOUT: {kind: 'DeclaredName', text: 'F'},
  10. // CHECK:STDOUT: {kind: 'ParameterListStart', text: '('},
  11. // CHECK:STDOUT: {kind: 'ParameterList', text: ')', subtree_size: 2},
  12. // CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
  13. // CHECK:STDOUT: {kind: 'NameReference', text: 'a'},
  14. // CHECK:STDOUT: {kind: 'PrefixOperator', text: 'not', subtree_size: 2},
  15. // CHECK:STDOUT: {kind: 'NameReference', text: 'b'},
  16. // CHECK:STDOUT: {kind: 'PrefixOperator', text: 'not', subtree_size: 2},
  17. // CHECK:STDOUT: {kind: 'InfixOperator', text: 'and', subtree_size: 5},
  18. // CHECK:STDOUT: {kind: 'NameReference', text: 'c'},
  19. // CHECK:STDOUT: {kind: 'PrefixOperator', text: 'not', subtree_size: 2},
  20. // CHECK:STDOUT: {kind: 'InfixOperator', text: 'and', subtree_size: 8},
  21. // CHECK:STDOUT: {kind: 'ExpressionStatement', text: ';', subtree_size: 9},
  22. // CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 15},
  23. // CHECK:STDOUT: {kind: 'FileEnd', text: ''},
  24. // CHECK:STDOUT: ]
  25. fn F() {
  26. // CHECK:STDERR: {{.*}}/toolchain/parser/testdata/operators/missing_precedence_not.carbon:[[@LINE+3]]:3: Whitespace is required before this unary operator.
  27. // CHECK:STDERR: {{.*}}/toolchain/parser/testdata/operators/missing_precedence_not.carbon:[[@LINE+2]]:13: Whitespace is required before this unary operator.
  28. // CHECK:STDERR: {{.*}}/toolchain/parser/testdata/operators/missing_precedence_not.carbon:[[@LINE+1]]:23: Whitespace is required before this unary operator.
  29. not a and not b and not c;
  30. }