fail_redeclaration_introducer.carbon 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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. class A;
  7. // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE+6]]:1: ERROR: Class redeclared with different inheritance kind.
  8. // CHECK:STDERR: base class A {}
  9. // CHECK:STDERR: ^~~~~~~~~~~~~~
  10. // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE-4]]:1: Previously declared here.
  11. // CHECK:STDERR: class A;
  12. // CHECK:STDERR: ^~~~~~~~
  13. base class A {}
  14. class B;
  15. // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE+6]]:1: ERROR: Class redeclared with different inheritance kind.
  16. // CHECK:STDERR: abstract class B {}
  17. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
  18. // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE-4]]:1: Previously declared here.
  19. // CHECK:STDERR: class B;
  20. // CHECK:STDERR: ^~~~~~~~
  21. abstract class B {}
  22. base class C;
  23. // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE+6]]:1: ERROR: Class redeclared with different inheritance kind.
  24. // CHECK:STDERR: class C {}
  25. // CHECK:STDERR: ^~~~~~~~~
  26. // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE-4]]:1: Previously declared here.
  27. // CHECK:STDERR: base class C;
  28. // CHECK:STDERR: ^~~~~~~~~~~~~
  29. class C {}
  30. base class D;
  31. // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE+6]]:1: ERROR: Class redeclared with different inheritance kind.
  32. // CHECK:STDERR: abstract class D {}
  33. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
  34. // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE-4]]:1: Previously declared here.
  35. // CHECK:STDERR: base class D;
  36. // CHECK:STDERR: ^~~~~~~~~~~~~
  37. abstract class D {}
  38. abstract class E;
  39. // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE+6]]:1: ERROR: Class redeclared with different inheritance kind.
  40. // CHECK:STDERR: class E {}
  41. // CHECK:STDERR: ^~~~~~~~~
  42. // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE-4]]:1: Previously declared here.
  43. // CHECK:STDERR: abstract class E;
  44. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~
  45. class E {}
  46. abstract class F;
  47. // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE+6]]:1: ERROR: Class redeclared with different inheritance kind.
  48. // CHECK:STDERR: base class F {}
  49. // CHECK:STDERR: ^~~~~~~~~~~~~~
  50. // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE-4]]:1: Previously declared here.
  51. // CHECK:STDERR: abstract class F;
  52. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~
  53. base class F {}
  54. class G {}
  55. // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE+6]]:1: ERROR: Class redeclared with different inheritance kind.
  56. // CHECK:STDERR: abstract class G;
  57. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~
  58. // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE-4]]:1: Previously declared here.
  59. // CHECK:STDERR: class G {}
  60. // CHECK:STDERR: ^~~~~~~~~
  61. abstract class G;
  62. // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE+6]]:1: ERROR: Class redeclared with different inheritance kind.
  63. // CHECK:STDERR: base class G;
  64. // CHECK:STDERR: ^~~~~~~~~~~~~
  65. // CHECK:STDERR: fail_redeclaration_introducer.carbon:[[@LINE-11]]:1: Previously declared here.
  66. // CHECK:STDERR: class G {}
  67. // CHECK:STDERR: ^~~~~~~~~
  68. base class G;
  69. // CHECK:STDOUT: --- fail_redeclaration_introducer.carbon
  70. // CHECK:STDOUT:
  71. // CHECK:STDOUT: constants {
  72. // CHECK:STDOUT: %A: type = class_type @A [template]
  73. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  74. // CHECK:STDOUT: %B: type = class_type @B [template]
  75. // CHECK:STDOUT: %C: type = class_type @C [template]
  76. // CHECK:STDOUT: %D: type = class_type @D [template]
  77. // CHECK:STDOUT: %E: type = class_type @E [template]
  78. // CHECK:STDOUT: %F: type = class_type @F [template]
  79. // CHECK:STDOUT: %G: type = class_type @G [template]
  80. // CHECK:STDOUT: }
  81. // CHECK:STDOUT:
  82. // CHECK:STDOUT: file {
  83. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  84. // CHECK:STDOUT: .A = %A.decl.loc7
  85. // CHECK:STDOUT: .B = %B.decl.loc16
  86. // CHECK:STDOUT: .C = %C.decl.loc25
  87. // CHECK:STDOUT: .D = %D.decl.loc34
  88. // CHECK:STDOUT: .E = %E.decl.loc43
  89. // CHECK:STDOUT: .F = %F.decl.loc52
  90. // CHECK:STDOUT: .G = %G.decl.loc61
  91. // CHECK:STDOUT: }
  92. // CHECK:STDOUT: %A.decl.loc7: type = class_decl @A [template = constants.%A] {}
  93. // CHECK:STDOUT: %A.decl.loc14: type = class_decl @A [template = constants.%A] {}
  94. // CHECK:STDOUT: %B.decl.loc16: type = class_decl @B [template = constants.%B] {}
  95. // CHECK:STDOUT: %B.decl.loc23: type = class_decl @B [template = constants.%B] {}
  96. // CHECK:STDOUT: %C.decl.loc25: type = class_decl @C [template = constants.%C] {}
  97. // CHECK:STDOUT: %C.decl.loc32: type = class_decl @C [template = constants.%C] {}
  98. // CHECK:STDOUT: %D.decl.loc34: type = class_decl @D [template = constants.%D] {}
  99. // CHECK:STDOUT: %D.decl.loc41: type = class_decl @D [template = constants.%D] {}
  100. // CHECK:STDOUT: %E.decl.loc43: type = class_decl @E [template = constants.%E] {}
  101. // CHECK:STDOUT: %E.decl.loc50: type = class_decl @E [template = constants.%E] {}
  102. // CHECK:STDOUT: %F.decl.loc52: type = class_decl @F [template = constants.%F] {}
  103. // CHECK:STDOUT: %F.decl.loc59: type = class_decl @F [template = constants.%F] {}
  104. // CHECK:STDOUT: %G.decl.loc61: type = class_decl @G [template = constants.%G] {}
  105. // CHECK:STDOUT: %G.decl.loc68: type = class_decl @G [template = constants.%G] {}
  106. // CHECK:STDOUT: %G.decl.loc75: type = class_decl @G [template = constants.%G] {}
  107. // CHECK:STDOUT: }
  108. // CHECK:STDOUT:
  109. // CHECK:STDOUT: class @A {
  110. // CHECK:STDOUT: !members:
  111. // CHECK:STDOUT: .Self = constants.%A
  112. // CHECK:STDOUT: }
  113. // CHECK:STDOUT:
  114. // CHECK:STDOUT: class @B {
  115. // CHECK:STDOUT: !members:
  116. // CHECK:STDOUT: .Self = constants.%B
  117. // CHECK:STDOUT: }
  118. // CHECK:STDOUT:
  119. // CHECK:STDOUT: class @C {
  120. // CHECK:STDOUT: !members:
  121. // CHECK:STDOUT: .Self = constants.%C
  122. // CHECK:STDOUT: }
  123. // CHECK:STDOUT:
  124. // CHECK:STDOUT: class @D {
  125. // CHECK:STDOUT: !members:
  126. // CHECK:STDOUT: .Self = constants.%D
  127. // CHECK:STDOUT: }
  128. // CHECK:STDOUT:
  129. // CHECK:STDOUT: class @E {
  130. // CHECK:STDOUT: !members:
  131. // CHECK:STDOUT: .Self = constants.%E
  132. // CHECK:STDOUT: }
  133. // CHECK:STDOUT:
  134. // CHECK:STDOUT: class @F {
  135. // CHECK:STDOUT: !members:
  136. // CHECK:STDOUT: .Self = constants.%F
  137. // CHECK:STDOUT: }
  138. // CHECK:STDOUT:
  139. // CHECK:STDOUT: class @G {
  140. // CHECK:STDOUT: !members:
  141. // CHECK:STDOUT: .Self = constants.%G
  142. // CHECK:STDOUT: }
  143. // CHECK:STDOUT: