fail_unbraced.carbon 1.6 KB

12345678910111213141516171819202122232425262728293031323334
  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. fn F() {
  8. while (a)
  9. // CHECK:STDERR: fail_unbraced.carbon:[[@LINE+3]]:5: ERROR: Expected braced code block.
  10. // CHECK:STDERR: break;
  11. // CHECK:STDERR: ^
  12. break;
  13. }
  14. // CHECK:STDOUT: - filename: fail_unbraced.carbon
  15. // CHECK:STDOUT: parse_tree: [
  16. // CHECK:STDOUT: {kind: 'FileStart', text: ''},
  17. // CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
  18. // CHECK:STDOUT: {kind: 'Name', text: 'F'},
  19. // CHECK:STDOUT: {kind: 'ParamListStart', text: '('},
  20. // CHECK:STDOUT: {kind: 'ParamList', text: ')', subtree_size: 2},
  21. // CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
  22. // CHECK:STDOUT: {kind: 'WhileConditionStart', text: '('},
  23. // CHECK:STDOUT: {kind: 'NameExpr', text: 'a'},
  24. // CHECK:STDOUT: {kind: 'WhileCondition', text: ')', subtree_size: 3},
  25. // CHECK:STDOUT: {kind: 'CodeBlockStart', text: 'break', has_error: yes},
  26. // CHECK:STDOUT: {kind: 'BreakStatementStart', text: 'break'},
  27. // CHECK:STDOUT: {kind: 'BreakStatement', text: ';', subtree_size: 2},
  28. // CHECK:STDOUT: {kind: 'CodeBlock', text: 'break', has_error: yes, subtree_size: 4},
  29. // CHECK:STDOUT: {kind: 'WhileStatement', text: 'while', subtree_size: 8},
  30. // CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 14},
  31. // CHECK:STDOUT: {kind: 'FileEnd', text: ''},
  32. // CHECK:STDOUT: ]