fail_adapt_modifiers.carbon 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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/check/testdata/class/adapter/fail_adapt_modifiers.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/adapter/fail_adapt_modifiers.carbon
  10. class B {}
  11. class C1 {
  12. // CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+4]]:3: error: `private` not allowed on `adapt` declaration [ModifierNotAllowedOnDeclaration]
  13. // CHECK:STDERR: private adapt B;
  14. // CHECK:STDERR: ^~~~~~~
  15. // CHECK:STDERR:
  16. private adapt B;
  17. }
  18. class C2 {
  19. // CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+4]]:3: error: `abstract` not allowed on `adapt` declaration [ModifierNotAllowedOnDeclaration]
  20. // CHECK:STDERR: abstract adapt B;
  21. // CHECK:STDERR: ^~~~~~~~
  22. // CHECK:STDERR:
  23. abstract adapt B;
  24. }
  25. class C3 {
  26. // CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+4]]:3: error: `default` not allowed on `adapt` declaration [ModifierNotAllowedOnDeclaration]
  27. // CHECK:STDERR: default adapt B;
  28. // CHECK:STDERR: ^~~~~~~
  29. // CHECK:STDERR:
  30. default adapt B;
  31. }
  32. class C4 {
  33. // CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+7]]:10: error: `extend` repeated on declaration [ModifierRepeated]
  34. // CHECK:STDERR: extend extend adapt B;
  35. // CHECK:STDERR: ^~~~~~
  36. // CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+4]]:3: note: `extend` previously appeared here [ModifierPrevious]
  37. // CHECK:STDERR: extend extend adapt B;
  38. // CHECK:STDERR: ^~~~~~
  39. // CHECK:STDERR:
  40. extend extend adapt B;
  41. }
  42. class C5 {
  43. // CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+4]]:3: error: `base` not allowed on `adapt` declaration [ModifierNotAllowedOnDeclaration]
  44. // CHECK:STDERR: base adapt B;
  45. // CHECK:STDERR: ^~~~
  46. // CHECK:STDERR:
  47. base adapt B;
  48. }
  49. class C6 {
  50. // CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+4]]:10: error: `base` not allowed on `adapt` declaration [ModifierNotAllowedOnDeclaration]
  51. // CHECK:STDERR: extend base adapt B;
  52. // CHECK:STDERR: ^~~~
  53. // CHECK:STDERR:
  54. extend base adapt B;
  55. }