fail_invalid_designators.carbon 2.0 KB

1234567891011121314151617181920212223242526272829303132333435
  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: %{not} %{carbon-run-parser}
  7. // CHECK:STDOUT: [
  8. // CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
  9. // CHECK:STDOUT: {kind: 'DeclaredName', text: 'F'},
  10. // CHECK:STDOUT: {kind: 'ParameterListEnd', 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: 'DesignatorExpression', text: '.', has_error: yes, subtree_size: 2},
  15. // CHECK:STDOUT: {kind: 'ExpressionStatement', text: ';', has_error: yes, subtree_size: 3},
  16. // CHECK:STDOUT: {kind: 'NameReference', text: 'a'},
  17. // CHECK:STDOUT: {kind: 'DesignatedName', text: 'fn', has_error: yes},
  18. // CHECK:STDOUT: {kind: 'DesignatorExpression', text: '.', subtree_size: 3},
  19. // CHECK:STDOUT: {kind: 'ExpressionStatement', text: ';', subtree_size: 4},
  20. // CHECK:STDOUT: {kind: 'NameReference', text: 'a'},
  21. // CHECK:STDOUT: {kind: 'DesignatorExpression', text: '.', has_error: yes, subtree_size: 2},
  22. // CHECK:STDOUT: {kind: 'ExpressionStatement', text: ';', has_error: yes, subtree_size: 3},
  23. // CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 16},
  24. // CHECK:STDOUT: {kind: 'FileEnd', text: ''},
  25. // CHECK:STDOUT: ]
  26. // NOTE: Move to its own directory when more tests are added.
  27. fn F() {
  28. // CHECK:STDERR: {{.*}}/toolchain/parser/testdata/basics/fail_invalid_designators.carbon:[[@LINE+1]]:5: Expected identifier after `.`.
  29. a.;
  30. // CHECK:STDERR: {{.*}}/toolchain/parser/testdata/basics/fail_invalid_designators.carbon:[[@LINE+1]]:5: Expected identifier after `.`.
  31. a.fn;
  32. // CHECK:STDERR: {{.*}}/toolchain/parser/testdata/basics/fail_invalid_designators.carbon:[[@LINE+1]]:5: Expected identifier after `.`.
  33. a.42;
  34. }