fail_unbraced.carbon 1.5 KB

123456789101112131415161718192021222324252627282930
  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. // TODO: This should have an error.
  6. // AUTOUPDATE
  7. // RUN: %{not} %{carbon-run-parser}
  8. // CHECK:STDOUT: [
  9. // CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
  10. // CHECK:STDOUT: {kind: 'DeclaredName', text: 'F'},
  11. // CHECK:STDOUT: {kind: 'ParameterListEnd', text: ')'},
  12. // CHECK:STDOUT: {kind: 'ParameterList', text: '(', subtree_size: 2},
  13. // CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
  14. // CHECK:STDOUT: {kind: 'NameReference', text: 'a'},
  15. // CHECK:STDOUT: {kind: 'ConditionEnd', text: ')'},
  16. // CHECK:STDOUT: {kind: 'Condition', text: '(', subtree_size: 3},
  17. // CHECK:STDOUT: {kind: 'CodeBlockStart', text: 'break', has_error: yes},
  18. // CHECK:STDOUT: {kind: 'StatementEnd', text: ';'},
  19. // CHECK:STDOUT: {kind: 'BreakStatement', text: 'break', subtree_size: 2},
  20. // CHECK:STDOUT: {kind: 'CodeBlock', text: 'break', has_error: yes, subtree_size: 4},
  21. // CHECK:STDOUT: {kind: 'WhileStatement', text: 'while', subtree_size: 8},
  22. // CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 14},
  23. // CHECK:STDOUT: {kind: 'FileEnd', text: ''},
  24. // CHECK:STDOUT: ]
  25. fn F() {
  26. while (a)
  27. // CHECK:STDERR: {{.*}}/toolchain/parser/testdata/while/fail_unbraced.carbon:[[@LINE+1]]:5: Expected braced code block.
  28. break;
  29. }