fail_adapt_modifiers.carbon 2.4 KB

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