basic.carbon 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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/named_constraint/basic.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/named_constraint/basic.carbon
  10. // --- empty.carbon
  11. constraint Empty {}
  12. // --- with_require.carbon
  13. constraint WithRequire {
  14. // TODO: Add a require statement.
  15. }
  16. // --- forward_decl.carbon
  17. constraint ForwardDeclared;
  18. // CHECK:STDOUT: - filename: empty.carbon
  19. // CHECK:STDOUT: parse_tree: [
  20. // CHECK:STDOUT: {kind: 'FileStart', text: ''},
  21. // CHECK:STDOUT: {kind: 'NamedConstraintIntroducer', text: 'constraint'},
  22. // CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeSignature', text: 'Empty'},
  23. // CHECK:STDOUT: {kind: 'NamedConstraintDefinitionStart', text: '{', subtree_size: 3},
  24. // CHECK:STDOUT: {kind: 'NamedConstraintDefinition', text: '}', subtree_size: 4},
  25. // CHECK:STDOUT: {kind: 'FileEnd', text: ''},
  26. // CHECK:STDOUT: ]
  27. // CHECK:STDOUT: - filename: with_require.carbon
  28. // CHECK:STDOUT: parse_tree: [
  29. // CHECK:STDOUT: {kind: 'FileStart', text: ''},
  30. // CHECK:STDOUT: {kind: 'NamedConstraintIntroducer', text: 'constraint'},
  31. // CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeSignature', text: 'WithRequire'},
  32. // CHECK:STDOUT: {kind: 'NamedConstraintDefinitionStart', text: '{', subtree_size: 3},
  33. // CHECK:STDOUT: {kind: 'NamedConstraintDefinition', text: '}', subtree_size: 4},
  34. // CHECK:STDOUT: {kind: 'FileEnd', text: ''},
  35. // CHECK:STDOUT: ]
  36. // CHECK:STDOUT: - filename: forward_decl.carbon
  37. // CHECK:STDOUT: parse_tree: [
  38. // CHECK:STDOUT: {kind: 'FileStart', text: ''},
  39. // CHECK:STDOUT: {kind: 'NamedConstraintIntroducer', text: 'constraint'},
  40. // CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeSignature', text: 'ForwardDeclared'},
  41. // CHECK:STDOUT: {kind: 'NamedConstraintDecl', text: ';', subtree_size: 3},
  42. // CHECK:STDOUT: {kind: 'FileEnd', text: ''},
  43. // CHECK:STDOUT: ]