associated_constants.carbon 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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/generics/interface/associated_constants.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/interface/associated_constants.carbon
  10. interface Foo {
  11. // TODO: support `let T:! type;`
  12. final let I: i32 = 4;
  13. default let D: bool = true;
  14. }
  15. // CHECK:STDOUT: - filename: associated_constants.carbon
  16. // CHECK:STDOUT: parse_tree: [
  17. // CHECK:STDOUT: {kind: 'FileStart', text: ''},
  18. // CHECK:STDOUT: {kind: 'InterfaceIntroducer', text: 'interface'},
  19. // CHECK:STDOUT: {kind: 'IdentifierName', text: 'Foo'},
  20. // CHECK:STDOUT: {kind: 'InterfaceDefinitionStart', text: '{', subtree_size: 3},
  21. // CHECK:STDOUT: {kind: 'LetIntroducer', text: 'let'},
  22. // CHECK:STDOUT: {kind: 'FinalModifier', text: 'final'},
  23. // CHECK:STDOUT: {kind: 'IdentifierName', text: 'I'},
  24. // CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
  25. // CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 3},
  26. // CHECK:STDOUT: {kind: 'LetInitializer', text: '='},
  27. // CHECK:STDOUT: {kind: 'IntLiteral', text: '4'},
  28. // CHECK:STDOUT: {kind: 'LetDecl', text: ';', subtree_size: 8},
  29. // CHECK:STDOUT: {kind: 'LetIntroducer', text: 'let'},
  30. // CHECK:STDOUT: {kind: 'DefaultModifier', text: 'default'},
  31. // CHECK:STDOUT: {kind: 'IdentifierName', text: 'D'},
  32. // CHECK:STDOUT: {kind: 'BoolTypeLiteral', text: 'bool'},
  33. // CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 3},
  34. // CHECK:STDOUT: {kind: 'LetInitializer', text: '='},
  35. // CHECK:STDOUT: {kind: 'BoolLiteralTrue', text: 'true'},
  36. // CHECK:STDOUT: {kind: 'LetDecl', text: ';', subtree_size: 8},
  37. // CHECK:STDOUT: {kind: 'InterfaceDefinition', text: '}', subtree_size: 20},
  38. // CHECK:STDOUT: {kind: 'FileEnd', text: ''},
  39. // CHECK:STDOUT: ]