fail_comma_repeat_in_value.carbon 1.6 KB

123456789101112131415161718192021222324252627282930
  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_comma_repeat_in_value.carbon:[[@LINE+3]]:16: Expected `.field = value`.
  7. // CHECK:STDERR: var x: {.a = 0,,} = {};
  8. // CHECK:STDERR: ^
  9. var x: {.a = 0,,} = {};
  10. // CHECK:STDOUT: [
  11. // CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
  12. // CHECK:STDOUT: {kind: 'Name', text: 'x'},
  13. // CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
  14. // CHECK:STDOUT: {kind: 'Name', text: 'a'},
  15. // CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
  16. // CHECK:STDOUT: {kind: 'Literal', text: '0'},
  17. // CHECK:STDOUT: {kind: 'StructFieldValue', text: '=', subtree_size: 4},
  18. // CHECK:STDOUT: {kind: 'StructComma', text: ','},
  19. // CHECK:STDOUT: {kind: 'StructFieldUnknown', text: ',', has_error: yes},
  20. // CHECK:STDOUT: {kind: 'StructComma', text: ','},
  21. // CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 9},
  22. // CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 11},
  23. // CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
  24. // CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
  25. // CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
  26. // CHECK:STDOUT: {kind: 'VariableDeclaration', text: ';', subtree_size: 16},
  27. // CHECK:STDOUT: {kind: 'FileEnd', text: ''},
  28. // CHECK:STDOUT: ]