base_misplaced.carbon 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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/class/base_misplaced.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/class/base_misplaced.carbon
  10. base class B {}
  11. // These are rejected by check.
  12. base: B;
  13. fn F() {
  14. base: B;
  15. }
  16. // CHECK:STDOUT: - filename: base_misplaced.carbon
  17. // CHECK:STDOUT: parse_tree: [
  18. // CHECK:STDOUT: {kind: 'FileStart', text: ''},
  19. // CHECK:STDOUT: {kind: 'ClassIntroducer', text: 'class'},
  20. // CHECK:STDOUT: {kind: 'BaseModifier', text: 'base'},
  21. // CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeParams', text: 'B'},
  22. // CHECK:STDOUT: {kind: 'ClassDefinitionStart', text: '{', subtree_size: 4},
  23. // CHECK:STDOUT: {kind: 'ClassDefinition', text: '}', subtree_size: 5},
  24. // CHECK:STDOUT: {kind: 'BaseIntroducer', text: 'base'},
  25. // CHECK:STDOUT: {kind: 'BaseColon', text: ':'},
  26. // CHECK:STDOUT: {kind: 'IdentifierNameExpr', text: 'B'},
  27. // CHECK:STDOUT: {kind: 'BaseDecl', text: ';', subtree_size: 4},
  28. // CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
  29. // CHECK:STDOUT: {kind: 'IdentifierNameBeforeParams', text: 'F'},
  30. // CHECK:STDOUT: {kind: 'TuplePatternStart', text: '('},
  31. // CHECK:STDOUT: {kind: 'TuplePattern', text: ')', subtree_size: 2},
  32. // CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
  33. // CHECK:STDOUT: {kind: 'BaseIntroducer', text: 'base'},
  34. // CHECK:STDOUT: {kind: 'BaseColon', text: ':'},
  35. // CHECK:STDOUT: {kind: 'IdentifierNameExpr', text: 'B'},
  36. // CHECK:STDOUT: {kind: 'BaseDecl', text: ';', subtree_size: 4},
  37. // CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 10},
  38. // CHECK:STDOUT: {kind: 'FileEnd', text: ''},
  39. // CHECK:STDOUT: ]