fail_then_expr_missing.carbon 1.7 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. // AUTOUPDATE
  6. // CHECK:STDOUT: [
  7. // CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
  8. // CHECK:STDOUT: {kind: 'DeclaredName', text: 'F'},
  9. // CHECK:STDOUT: {kind: 'ParameterListStart', text: '('},
  10. // CHECK:STDOUT: {kind: 'ParameterList', text: ')', subtree_size: 2},
  11. // CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
  12. // CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
  13. // CHECK:STDOUT: {kind: 'DeclaredName', text: 'n'},
  14. // CHECK:STDOUT: {kind: 'Literal', text: 'i32'},
  15. // CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
  16. // CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
  17. // CHECK:STDOUT: {kind: 'Literal', text: 'true'},
  18. // CHECK:STDOUT: {kind: 'IfExpressionIf', text: 'if', subtree_size: 2},
  19. // CHECK:STDOUT: {kind: 'InvalidParse', text: ';', has_error: yes},
  20. // CHECK:STDOUT: {kind: 'IfExpressionThen', text: 'then', has_error: yes, subtree_size: 2},
  21. // CHECK:STDOUT: {kind: 'InvalidParse', text: ';', has_error: yes},
  22. // CHECK:STDOUT: {kind: 'IfExpressionElse', text: 'if', has_error: yes, subtree_size: 6},
  23. // CHECK:STDOUT: {kind: 'VariableDeclaration', text: ';', subtree_size: 12},
  24. // CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 18},
  25. // CHECK:STDOUT: {kind: 'FileEnd', text: ''},
  26. // CHECK:STDOUT: ]
  27. fn F() {
  28. // CHECK:STDERR: fail_then_expr_missing.carbon:[[@LINE+1]]:28: Expected expression.
  29. var n: i32 = if true then;
  30. }