two_entries.carbon 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/two_entries.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/two_entries.carbon
  10. var x: {.a: i32, .b: i32} = {.a = 1, .b = 2};
  11. // CHECK:STDOUT: - filename: two_entries.carbon
  12. // CHECK:STDOUT: parse_tree: [
  13. // CHECK:STDOUT: {kind: 'FileStart', text: ''},
  14. // CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
  15. // CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeParams', text: 'x'},
  16. // CHECK:STDOUT: {kind: 'StructTypeLiteralStart', text: '{'},
  17. // CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeParams', text: 'a'},
  18. // CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
  19. // CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
  20. // CHECK:STDOUT: {kind: 'StructTypeLiteralField', text: ':', subtree_size: 4},
  21. // CHECK:STDOUT: {kind: 'StructTypeLiteralComma', text: ','},
  22. // CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeParams', text: 'b'},
  23. // CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
  24. // CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
  25. // CHECK:STDOUT: {kind: 'StructTypeLiteralField', text: ':', subtree_size: 4},
  26. // CHECK:STDOUT: {kind: 'StructTypeLiteral', text: '}', subtree_size: 11},
  27. // CHECK:STDOUT: {kind: 'VarBindingPattern', text: ':', subtree_size: 13},
  28. // CHECK:STDOUT: {kind: 'VariablePattern', text: 'var', subtree_size: 14},
  29. // CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
  30. // CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
  31. // CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeParams', text: 'a'},
  32. // CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
  33. // CHECK:STDOUT: {kind: 'IntLiteral', text: '1'},
  34. // CHECK:STDOUT: {kind: 'StructLiteralField', text: '=', subtree_size: 4},
  35. // CHECK:STDOUT: {kind: 'StructLiteralComma', text: ','},
  36. // CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeParams', text: 'b'},
  37. // CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
  38. // CHECK:STDOUT: {kind: 'IntLiteral', text: '2'},
  39. // CHECK:STDOUT: {kind: 'StructLiteralField', text: '=', subtree_size: 4},
  40. // CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 11},
  41. // CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 28},
  42. // CHECK:STDOUT: {kind: 'FileEnd', text: ''},
  43. // CHECK:STDOUT: ]