fail_modifiers.carbon 2.8 KB

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