fail_identifier_in_statements.carbon 1.2 KB

1234567891011121314151617181920212223
  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: {node_index: 6, kind: 'FunctionDeclaration', text: 'fn', subtree_size: 7, children: [
  9. // CHECK:STDOUT: {node_index: 0, kind: 'DeclaredName', text: 'F'},
  10. // CHECK:STDOUT: {node_index: 2, kind: 'ParameterList', text: '(', subtree_size: 2, children: [
  11. // CHECK:STDOUT: {node_index: 1, kind: 'ParameterListEnd', text: ')'}]},
  12. // CHECK:STDOUT: {node_index: 5, kind: 'CodeBlock', text: '{', has_error: yes, subtree_size: 3, children: [
  13. // CHECK:STDOUT: {node_index: 3, kind: 'NameReference', text: 'bar'},
  14. // CHECK:STDOUT: {node_index: 4, kind: 'CodeBlockEnd', text: '}'}]}]},
  15. // CHECK:STDOUT: {node_index: 7, kind: 'FileEnd', text: ''},
  16. // CHECK:STDOUT: ]
  17. fn F() {
  18. // Note: this might become valid depending on the expression syntax. This test
  19. // shouldn't be taken as a sign it should remain invalid.
  20. bar
  21. // CHECK:STDERR: {{.*}}/toolchain/parser/testdata/function/definition/fail_identifier_in_statements.carbon:[[@LINE+1]]:1: Expected `;` after expression.
  22. }