fail_modifiers.carbon 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. // CHECK:STDERR: fail_modifiers.carbon:[[@LINE+3]]:1: ERROR: `abstract` not allowed on `interface` declaration.
  7. // CHECK:STDERR: abstract interface Abstract {
  8. // CHECK:STDERR: ^~~~~~~~
  9. abstract interface Abstract {
  10. }
  11. // CHECK:STDERR: fail_modifiers.carbon:[[@LINE+3]]:1: ERROR: `default` not allowed on `interface` declaration.
  12. // CHECK:STDERR: default interface Default;
  13. // CHECK:STDERR: ^~~~~~~
  14. default interface Default;
  15. // CHECK:STDERR: fail_modifiers.carbon:[[@LINE+3]]:1: ERROR: `virtual` not allowed on `interface` declaration.
  16. // CHECK:STDERR: virtual interface Virtual {
  17. // CHECK:STDERR: ^~~~~~~
  18. virtual interface Virtual {
  19. }
  20. // CHECK:STDERR: fail_modifiers.carbon:[[@LINE+3]]:1: ERROR: `protected` not allowed on `interface` declaration at file scope, `protected` is only allowed on class members.
  21. // CHECK:STDERR: protected interface Protected;
  22. // CHECK:STDERR: ^~~~~~~~~
  23. protected interface Protected;
  24. // CHECK:STDOUT: --- fail_modifiers.carbon
  25. // CHECK:STDOUT:
  26. // CHECK:STDOUT: constants {
  27. // CHECK:STDOUT: %.1: type = interface_type @Abstract [template]
  28. // CHECK:STDOUT: %.2: type = interface_type @Default [template]
  29. // CHECK:STDOUT: %.3: type = interface_type @Virtual [template]
  30. // CHECK:STDOUT: %.4: type = interface_type @Protected [template]
  31. // CHECK:STDOUT: }
  32. // CHECK:STDOUT:
  33. // CHECK:STDOUT: file {
  34. // CHECK:STDOUT: package: <namespace> = namespace {.Abstract = %Abstract.decl, .Default = %Default.decl, .Virtual = %Virtual.decl, .Protected = %Protected.decl} [template]
  35. // CHECK:STDOUT: %Abstract.decl = interface_decl @Abstract, () [template = constants.%.1]
  36. // CHECK:STDOUT: %Default.decl = interface_decl @Default, () [template = constants.%.2]
  37. // CHECK:STDOUT: %Virtual.decl = interface_decl @Virtual, () [template = constants.%.3]
  38. // CHECK:STDOUT: %Protected.decl = interface_decl @Protected, () [template = constants.%.4]
  39. // CHECK:STDOUT: }
  40. // CHECK:STDOUT:
  41. // CHECK:STDOUT: interface @Abstract {
  42. // CHECK:STDOUT:
  43. // CHECK:STDOUT: !members:
  44. // CHECK:STDOUT: }
  45. // CHECK:STDOUT:
  46. // CHECK:STDOUT: interface @Default;
  47. // CHECK:STDOUT:
  48. // CHECK:STDOUT: interface @Virtual {
  49. // CHECK:STDOUT:
  50. // CHECK:STDOUT: !members:
  51. // CHECK:STDOUT: }
  52. // CHECK:STDOUT:
  53. // CHECK:STDOUT: interface @Protected;
  54. // CHECK:STDOUT: