fail_dot_string_colon.carbon 1.7 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. // RUN: %{not} %{carbon-run-parser}
  7. // CHECK:STDOUT: [
  8. // CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
  9. // CHECK:STDOUT: {kind: 'DeclaredName', text: 'x'},
  10. // CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
  11. // CHECK:STDOUT: {kind: 'DesignatedName', text: '"hello"', has_error: yes},
  12. // CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
  13. // CHECK:STDOUT: {kind: 'Literal', text: 'i32'},
  14. // CHECK:STDOUT: {kind: 'StructFieldUnknown', text: ':', has_error: yes},
  15. // CHECK:STDOUT: {kind: 'StructComma', text: ','},
  16. // CHECK:STDOUT: {kind: 'DesignatedName', text: 'y'},
  17. // CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
  18. // CHECK:STDOUT: {kind: 'Literal', text: 'i32'},
  19. // CHECK:STDOUT: {kind: 'StructFieldType', text: ':', subtree_size: 4},
  20. // CHECK:STDOUT: {kind: 'StructTypeLiteral', text: '}', subtree_size: 11},
  21. // CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 13},
  22. // CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
  23. // CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
  24. // CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
  25. // CHECK:STDOUT: {kind: 'VariableDeclaration', text: ';', subtree_size: 18},
  26. // CHECK:STDOUT: {kind: 'FileEnd', text: ''},
  27. // CHECK:STDOUT: ]
  28. // CHECK:STDERR: {{.*}}/toolchain/parser/testdata/struct/fail_dot_string_colon.carbon:[[@LINE+1]]:10: Expected identifier after `.`.
  29. var x: {."hello": i32, .y: i32} = {};