fail_extra_token_in_value.carbon 1.9 KB

123456789101112131415161718192021222324252627282930313233
  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:STDERR: fail_extra_token_in_value.carbon:[[@LINE+3]]:28: ERROR: Expected `,` or `}`.
  7. // CHECK:STDERR: var x: {.a: i32} = {.a = 0 banana};
  8. // CHECK:STDERR: ^~~~~~
  9. var x: {.a: i32} = {.a = 0 banana};
  10. // CHECK:STDOUT: - filename: fail_extra_token_in_value.carbon
  11. // CHECK:STDOUT: parse_tree: [
  12. // CHECK:STDOUT: {kind: 'FileStart', text: ''},
  13. // CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
  14. // CHECK:STDOUT: {kind: 'IdentifierName', text: 'x'},
  15. // CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
  16. // CHECK:STDOUT: {kind: 'IdentifierName', text: 'a'},
  17. // CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
  18. // CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
  19. // CHECK:STDOUT: {kind: 'StructFieldType', text: ':', subtree_size: 4},
  20. // CHECK:STDOUT: {kind: 'StructTypeLiteral', text: '}', subtree_size: 6},
  21. // CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 8},
  22. // CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
  23. // CHECK:STDOUT: {kind: 'IdentifierName', text: 'a'},
  24. // CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
  25. // CHECK:STDOUT: {kind: 'IntLiteral', text: '0'},
  26. // CHECK:STDOUT: {kind: 'StructFieldValue', text: '=', subtree_size: 4},
  27. // CHECK:STDOUT: {kind: 'StructLiteral', text: '}', has_error: yes, subtree_size: 6},
  28. // CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 7},
  29. // CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 17},
  30. // CHECK:STDOUT: {kind: 'FileEnd', text: ''},
  31. // CHECK:STDOUT: ]