fail_unbraced.carbon 1.5 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. // TODO: This should have an error.
  6. // AUTOUPDATE
  7. // CHECK:STDOUT: [
  8. // CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
  9. // CHECK:STDOUT: {kind: 'Name', 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: 'WhileConditionStart', text: '('},
  14. // CHECK:STDOUT: {kind: 'NameExpression', text: 'a'},
  15. // CHECK:STDOUT: {kind: 'WhileCondition', text: ')', subtree_size: 3},
  16. // CHECK:STDOUT: {kind: 'CodeBlockStart', text: 'break', has_error: yes},
  17. // CHECK:STDOUT: {kind: 'BreakStatementStart', text: 'break'},
  18. // CHECK:STDOUT: {kind: 'BreakStatement', text: ';', subtree_size: 2},
  19. // CHECK:STDOUT: {kind: 'CodeBlock', text: 'break', has_error: yes, subtree_size: 4},
  20. // CHECK:STDOUT: {kind: 'WhileStatement', text: 'while', subtree_size: 8},
  21. // CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 14},
  22. // CHECK:STDOUT: {kind: 'FileEnd', text: ''},
  23. // CHECK:STDOUT: ]
  24. fn F() {
  25. while (a)
  26. // CHECK:STDERR: fail_unbraced.carbon:[[@LINE+3]]:5: Expected braced code block.
  27. // CHECK:STDERR: break;
  28. // CHECK:STDERR: ^
  29. break;
  30. }