fail_dot_string_colon.carbon 1.9 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. // AUTOUPDATE
  6. // CHECK:STDERR: fail_dot_string_colon.carbon:[[@LINE+3]]:10: ERROR: Expected identifier after `.`.
  7. // CHECK:STDERR: var x: {."hello": i32, .y: i32} = {};
  8. // CHECK:STDERR: ^
  9. var x: {."hello": i32, .y: i32} = {};
  10. // CHECK:STDOUT: - filename: fail_dot_string_colon.carbon
  11. // CHECK:STDOUT: parse_tree: [
  12. // CHECK:STDOUT: {kind: 'FileStart', text: ''},
  13. // CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
  14. // CHECK:STDOUT: {kind: 'Name', text: 'x'},
  15. // CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
  16. // CHECK:STDOUT: {kind: 'Name', text: '"hello"', has_error: yes},
  17. // CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
  18. // CHECK:STDOUT: {kind: 'Literal', text: 'i32'},
  19. // CHECK:STDOUT: {kind: 'StructFieldUnknown', text: ':', has_error: yes},
  20. // CHECK:STDOUT: {kind: 'StructComma', text: ','},
  21. // CHECK:STDOUT: {kind: 'Name', text: 'y'},
  22. // CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
  23. // CHECK:STDOUT: {kind: 'Literal', text: 'i32'},
  24. // CHECK:STDOUT: {kind: 'StructFieldType', text: ':', subtree_size: 4},
  25. // CHECK:STDOUT: {kind: 'StructTypeLiteral', text: '}', subtree_size: 11},
  26. // CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 13},
  27. // CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
  28. // CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
  29. // CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
  30. // CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 18},
  31. // CHECK:STDOUT: {kind: 'FileEnd', text: ''},
  32. // CHECK:STDOUT: ]