generic_redeclaration.carbon 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750
  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. // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
  6. // EXTRA-ARGS: --dump-sem-ir-ranges=if-present
  7. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/destroy.carbon
  8. //
  9. // AUTOUPDATE
  10. // TIP: To test this file alone, run:
  11. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/generic_redeclaration.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/generic_redeclaration.carbon
  14. // --- fail_todo_same_self_and_interface.carbon
  15. library "[[@TEST_NAME]]";
  16. interface Interface {}
  17. interface I {}
  18. interface J {}
  19. interface K {}
  20. interface L {}
  21. // TODO: Put these in a match_first so the test will pass again.
  22. impl forall [T:! I] T as Interface;
  23. impl forall [T:! J] T as Interface;
  24. impl forall [T:! K] T as Interface;
  25. impl forall [T:! L] T as Interface;
  26. // These are different impls, so they are not redefinitions, even though the
  27. // self type and constraint type are the same.
  28. impl forall [T:! I] T as Interface {}
  29. // CHECK:STDERR: fail_todo_same_self_and_interface.carbon:[[@LINE+7]]:1: error: found non-final `impl` with the same type structure as another non-final `impl` [ImplNonFinalSameTypeStructure]
  30. // CHECK:STDERR: impl forall [T:! J] T as Interface {}
  31. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  32. // CHECK:STDERR: fail_todo_same_self_and_interface.carbon:[[@LINE-4]]:1: note: other `impl` here [ImplNonFinalSameTypeStructureNote]
  33. // CHECK:STDERR: impl forall [T:! I] T as Interface {}
  34. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  35. // CHECK:STDERR:
  36. impl forall [T:! J] T as Interface {}
  37. // CHECK:STDERR: fail_todo_same_self_and_interface.carbon:[[@LINE+7]]:1: error: found non-final `impl` with the same type structure as another non-final `impl` [ImplNonFinalSameTypeStructure]
  38. // CHECK:STDERR: impl forall [T:! K] T as Interface {}
  39. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  40. // CHECK:STDERR: fail_todo_same_self_and_interface.carbon:[[@LINE-12]]:1: note: other `impl` here [ImplNonFinalSameTypeStructureNote]
  41. // CHECK:STDERR: impl forall [T:! I] T as Interface {}
  42. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  43. // CHECK:STDERR:
  44. impl forall [T:! K] T as Interface {}
  45. // CHECK:STDERR: fail_todo_same_self_and_interface.carbon:[[@LINE+7]]:1: error: found non-final `impl` with the same type structure as another non-final `impl` [ImplNonFinalSameTypeStructure]
  46. // CHECK:STDERR: impl forall [T:! L] T as Interface {}
  47. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  48. // CHECK:STDERR: fail_todo_same_self_and_interface.carbon:[[@LINE-20]]:1: note: other `impl` here [ImplNonFinalSameTypeStructureNote]
  49. // CHECK:STDERR: impl forall [T:! I] T as Interface {}
  50. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  51. // CHECK:STDERR:
  52. impl forall [T:! L] T as Interface {}
  53. // --- fail_same_self_and_interface_redefined.carbon
  54. library "[[@TEST_NAME]]";
  55. interface I {}
  56. interface J {}
  57. impl forall [T:! I] T as J {}
  58. // CHECK:STDERR: fail_same_self_and_interface_redefined.carbon:[[@LINE+7]]:1: error: redefinition of `impl T as J` [ImplRedefinition]
  59. // CHECK:STDERR: impl forall [T:! I] T as J {}
  60. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  61. // CHECK:STDERR: fail_same_self_and_interface_redefined.carbon:[[@LINE-4]]:1: note: previous definition was here [ImplPreviousDefinition]
  62. // CHECK:STDERR: impl forall [T:! I] T as J {}
  63. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  64. // CHECK:STDERR:
  65. impl forall [T:! I] T as J {}
  66. // --- fail_same_type_different_spelling.carbon
  67. library "[[@TEST_NAME]]";
  68. class C;
  69. interface I {}
  70. // Since the spelling is different, it's not caught as a redefinition, but it
  71. // is diagnosed as an overlapping impl without using a `match_first` block.
  72. impl C as I {}
  73. // CHECK:STDERR: fail_same_type_different_spelling.carbon:[[@LINE+7]]:1: error: found non-final `impl` with the same type structure as another non-final `impl` [ImplNonFinalSameTypeStructure]
  74. // CHECK:STDERR: impl (C, C).0 as I {}
  75. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
  76. // CHECK:STDERR: fail_same_type_different_spelling.carbon:[[@LINE-4]]:1: note: other `impl` here [ImplNonFinalSameTypeStructureNote]
  77. // CHECK:STDERR: impl C as I {}
  78. // CHECK:STDERR: ^~~~~~~~~~~~~
  79. // CHECK:STDERR:
  80. impl (C, C).0 as I {}
  81. // --- fail_redefinition_generic_regions.carbon
  82. interface I {}
  83. impl forall [T:! type] T as I {
  84. fn A() {}
  85. }
  86. // CHECK:STDERR: fail_redefinition_generic_regions.carbon:[[@LINE+7]]:1: error: redefinition of `impl T as I` [ImplRedefinition]
  87. // CHECK:STDERR: impl forall [T:! type] T as I {
  88. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  89. // CHECK:STDERR: fail_redefinition_generic_regions.carbon:[[@LINE-7]]:1: note: previous definition was here [ImplPreviousDefinition]
  90. // CHECK:STDERR: impl forall [T:! type] T as I {
  91. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  92. // CHECK:STDERR:
  93. impl forall [T:! type] T as I {
  94. // Although not referenced, B has the same generic region index of A, and
  95. // makes C a different index. We used to merge, and this was a crash.
  96. fn B() {}
  97. fn C() -> () { return (); }
  98. fn D() -> () {
  99. return C();
  100. }
  101. }
  102. // CHECK:STDOUT: --- fail_todo_same_self_and_interface.carbon
  103. // CHECK:STDOUT:
  104. // CHECK:STDOUT: constants {
  105. // CHECK:STDOUT: %Interface.type: type = facet_type <@Interface> [concrete]
  106. // CHECK:STDOUT: %Self.719: %Interface.type = bind_symbolic_name Self, 0 [symbolic]
  107. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  108. // CHECK:STDOUT: %Self.826: %I.type = bind_symbolic_name Self, 0 [symbolic]
  109. // CHECK:STDOUT: %J.type: type = facet_type <@J> [concrete]
  110. // CHECK:STDOUT: %Self.ccd: %J.type = bind_symbolic_name Self, 0 [symbolic]
  111. // CHECK:STDOUT: %K.type: type = facet_type <@K> [concrete]
  112. // CHECK:STDOUT: %Self.09f: %K.type = bind_symbolic_name Self, 0 [symbolic]
  113. // CHECK:STDOUT: %L.type: type = facet_type <@L> [concrete]
  114. // CHECK:STDOUT: %Self.1d2: %L.type = bind_symbolic_name Self, 0 [symbolic]
  115. // CHECK:STDOUT: %T.826: %I.type = bind_symbolic_name T, 0 [symbolic]
  116. // CHECK:STDOUT: %pattern_type.2b5: type = pattern_type %I.type [concrete]
  117. // CHECK:STDOUT: %T.as_type.b70: type = facet_access_type %T.826 [symbolic]
  118. // CHECK:STDOUT: %Interface.impl_witness.a14: <witness> = impl_witness file.%Interface.impl_witness_table.loc12, @impl.c3d(%T.826) [symbolic]
  119. // CHECK:STDOUT: %T.ccd: %J.type = bind_symbolic_name T, 0 [symbolic]
  120. // CHECK:STDOUT: %pattern_type.28e: type = pattern_type %J.type [concrete]
  121. // CHECK:STDOUT: %T.as_type.3df: type = facet_access_type %T.ccd [symbolic]
  122. // CHECK:STDOUT: %Interface.impl_witness.608: <witness> = impl_witness file.%Interface.impl_witness_table.loc13, @impl.793(%T.ccd) [symbolic]
  123. // CHECK:STDOUT: %T.09f: %K.type = bind_symbolic_name T, 0 [symbolic]
  124. // CHECK:STDOUT: %pattern_type.4a6: type = pattern_type %K.type [concrete]
  125. // CHECK:STDOUT: %T.as_type.037: type = facet_access_type %T.09f [symbolic]
  126. // CHECK:STDOUT: %Interface.impl_witness.b9e: <witness> = impl_witness file.%Interface.impl_witness_table.loc14, @impl.c93(%T.09f) [symbolic]
  127. // CHECK:STDOUT: %T.1d2: %L.type = bind_symbolic_name T, 0 [symbolic]
  128. // CHECK:STDOUT: %pattern_type.86b: type = pattern_type %L.type [concrete]
  129. // CHECK:STDOUT: %T.as_type.0ed: type = facet_access_type %T.1d2 [symbolic]
  130. // CHECK:STDOUT: %Interface.impl_witness.e9d: <witness> = impl_witness file.%Interface.impl_witness_table.loc15, @impl.9e6(%T.1d2) [symbolic]
  131. // CHECK:STDOUT: }
  132. // CHECK:STDOUT:
  133. // CHECK:STDOUT: imports {
  134. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  135. // CHECK:STDOUT: import Core//prelude
  136. // CHECK:STDOUT: }
  137. // CHECK:STDOUT: }
  138. // CHECK:STDOUT:
  139. // CHECK:STDOUT: file {
  140. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  141. // CHECK:STDOUT: .Core = imports.%Core
  142. // CHECK:STDOUT: .Interface = %Interface.decl
  143. // CHECK:STDOUT: .I = %I.decl
  144. // CHECK:STDOUT: .J = %J.decl
  145. // CHECK:STDOUT: .K = %K.decl
  146. // CHECK:STDOUT: .L = %L.decl
  147. // CHECK:STDOUT: }
  148. // CHECK:STDOUT: %Core.import = import Core
  149. // CHECK:STDOUT: %Interface.decl: type = interface_decl @Interface [concrete = constants.%Interface.type] {} {}
  150. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  151. // CHECK:STDOUT: %J.decl: type = interface_decl @J [concrete = constants.%J.type] {} {}
  152. // CHECK:STDOUT: %K.decl: type = interface_decl @K [concrete = constants.%K.type] {} {}
  153. // CHECK:STDOUT: %L.decl: type = interface_decl @L [concrete = constants.%L.type] {} {}
  154. // CHECK:STDOUT: impl_decl @impl.c3d [concrete] {
  155. // CHECK:STDOUT: %T.patt: %pattern_type.2b5 = symbolic_binding_pattern T, 0 [concrete]
  156. // CHECK:STDOUT: } {
  157. // CHECK:STDOUT: %T.ref.loc12: %I.type = name_ref T, %T.loc12_14.1 [symbolic = %T.loc12_14.2 (constants.%T.826)]
  158. // CHECK:STDOUT: %T.as_type.loc12_21.1: type = facet_access_type %T.ref.loc12 [symbolic = %T.as_type.loc12_21.2 (constants.%T.as_type.b70)]
  159. // CHECK:STDOUT: %.loc12: type = converted %T.ref.loc12, %T.as_type.loc12_21.1 [symbolic = %T.as_type.loc12_21.2 (constants.%T.as_type.b70)]
  160. // CHECK:STDOUT: %Interface.ref.loc12: type = name_ref Interface, file.%Interface.decl [concrete = constants.%Interface.type]
  161. // CHECK:STDOUT: %I.ref.loc12: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  162. // CHECK:STDOUT: %T.loc12_14.1: %I.type = bind_symbolic_name T, 0 [symbolic = %T.loc12_14.2 (constants.%T.826)]
  163. // CHECK:STDOUT: }
  164. // CHECK:STDOUT: %Interface.impl_witness_table.loc12 = impl_witness_table (), @impl.c3d [concrete]
  165. // CHECK:STDOUT: %Interface.impl_witness.loc12: <witness> = impl_witness %Interface.impl_witness_table.loc12, @impl.c3d(constants.%T.826) [symbolic = @impl.c3d.%Interface.impl_witness (constants.%Interface.impl_witness.a14)]
  166. // CHECK:STDOUT: impl_decl @impl.793 [concrete] {
  167. // CHECK:STDOUT: %T.patt: %pattern_type.28e = symbolic_binding_pattern T, 0 [concrete]
  168. // CHECK:STDOUT: } {
  169. // CHECK:STDOUT: %T.ref.loc13: %J.type = name_ref T, %T.loc13_14.1 [symbolic = %T.loc13_14.2 (constants.%T.ccd)]
  170. // CHECK:STDOUT: %T.as_type.loc13_21.1: type = facet_access_type %T.ref.loc13 [symbolic = %T.as_type.loc13_21.2 (constants.%T.as_type.3df)]
  171. // CHECK:STDOUT: %.loc13: type = converted %T.ref.loc13, %T.as_type.loc13_21.1 [symbolic = %T.as_type.loc13_21.2 (constants.%T.as_type.3df)]
  172. // CHECK:STDOUT: %Interface.ref.loc13: type = name_ref Interface, file.%Interface.decl [concrete = constants.%Interface.type]
  173. // CHECK:STDOUT: %J.ref.loc13: type = name_ref J, file.%J.decl [concrete = constants.%J.type]
  174. // CHECK:STDOUT: %T.loc13_14.1: %J.type = bind_symbolic_name T, 0 [symbolic = %T.loc13_14.2 (constants.%T.ccd)]
  175. // CHECK:STDOUT: }
  176. // CHECK:STDOUT: %Interface.impl_witness_table.loc13 = impl_witness_table (), @impl.793 [concrete]
  177. // CHECK:STDOUT: %Interface.impl_witness.loc13: <witness> = impl_witness %Interface.impl_witness_table.loc13, @impl.793(constants.%T.ccd) [symbolic = @impl.793.%Interface.impl_witness (constants.%Interface.impl_witness.608)]
  178. // CHECK:STDOUT: impl_decl @impl.c93 [concrete] {
  179. // CHECK:STDOUT: %T.patt: %pattern_type.4a6 = symbolic_binding_pattern T, 0 [concrete]
  180. // CHECK:STDOUT: } {
  181. // CHECK:STDOUT: %T.ref.loc14: %K.type = name_ref T, %T.loc14_14.1 [symbolic = %T.loc14_14.2 (constants.%T.09f)]
  182. // CHECK:STDOUT: %T.as_type.loc14_21.1: type = facet_access_type %T.ref.loc14 [symbolic = %T.as_type.loc14_21.2 (constants.%T.as_type.037)]
  183. // CHECK:STDOUT: %.loc14: type = converted %T.ref.loc14, %T.as_type.loc14_21.1 [symbolic = %T.as_type.loc14_21.2 (constants.%T.as_type.037)]
  184. // CHECK:STDOUT: %Interface.ref.loc14: type = name_ref Interface, file.%Interface.decl [concrete = constants.%Interface.type]
  185. // CHECK:STDOUT: %K.ref.loc14: type = name_ref K, file.%K.decl [concrete = constants.%K.type]
  186. // CHECK:STDOUT: %T.loc14_14.1: %K.type = bind_symbolic_name T, 0 [symbolic = %T.loc14_14.2 (constants.%T.09f)]
  187. // CHECK:STDOUT: }
  188. // CHECK:STDOUT: %Interface.impl_witness_table.loc14 = impl_witness_table (), @impl.c93 [concrete]
  189. // CHECK:STDOUT: %Interface.impl_witness.loc14: <witness> = impl_witness %Interface.impl_witness_table.loc14, @impl.c93(constants.%T.09f) [symbolic = @impl.c93.%Interface.impl_witness (constants.%Interface.impl_witness.b9e)]
  190. // CHECK:STDOUT: impl_decl @impl.9e6 [concrete] {
  191. // CHECK:STDOUT: %T.patt: %pattern_type.86b = symbolic_binding_pattern T, 0 [concrete]
  192. // CHECK:STDOUT: } {
  193. // CHECK:STDOUT: %T.ref.loc15: %L.type = name_ref T, %T.loc15_14.1 [symbolic = %T.loc15_14.2 (constants.%T.1d2)]
  194. // CHECK:STDOUT: %T.as_type.loc15_21.1: type = facet_access_type %T.ref.loc15 [symbolic = %T.as_type.loc15_21.2 (constants.%T.as_type.0ed)]
  195. // CHECK:STDOUT: %.loc15: type = converted %T.ref.loc15, %T.as_type.loc15_21.1 [symbolic = %T.as_type.loc15_21.2 (constants.%T.as_type.0ed)]
  196. // CHECK:STDOUT: %Interface.ref.loc15: type = name_ref Interface, file.%Interface.decl [concrete = constants.%Interface.type]
  197. // CHECK:STDOUT: %L.ref.loc15: type = name_ref L, file.%L.decl [concrete = constants.%L.type]
  198. // CHECK:STDOUT: %T.loc15_14.1: %L.type = bind_symbolic_name T, 0 [symbolic = %T.loc15_14.2 (constants.%T.1d2)]
  199. // CHECK:STDOUT: }
  200. // CHECK:STDOUT: %Interface.impl_witness_table.loc15 = impl_witness_table (), @impl.9e6 [concrete]
  201. // CHECK:STDOUT: %Interface.impl_witness.loc15: <witness> = impl_witness %Interface.impl_witness_table.loc15, @impl.9e6(constants.%T.1d2) [symbolic = @impl.9e6.%Interface.impl_witness (constants.%Interface.impl_witness.e9d)]
  202. // CHECK:STDOUT: impl_decl @impl.c3d [concrete] {
  203. // CHECK:STDOUT: %T.patt: %pattern_type.2b5 = symbolic_binding_pattern T, 0 [concrete]
  204. // CHECK:STDOUT: } {
  205. // CHECK:STDOUT: %T.ref.loc19: %I.type = name_ref T, %T.loc19 [symbolic = %T.loc12_14.2 (constants.%T.826)]
  206. // CHECK:STDOUT: %T.as_type.loc19: type = facet_access_type %T.ref.loc19 [symbolic = %T.as_type.loc12_21.2 (constants.%T.as_type.b70)]
  207. // CHECK:STDOUT: %.loc19: type = converted %T.ref.loc19, %T.as_type.loc19 [symbolic = %T.as_type.loc12_21.2 (constants.%T.as_type.b70)]
  208. // CHECK:STDOUT: %Interface.ref.loc19: type = name_ref Interface, file.%Interface.decl [concrete = constants.%Interface.type]
  209. // CHECK:STDOUT: %I.ref.loc19: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  210. // CHECK:STDOUT: %T.loc19: %I.type = bind_symbolic_name T, 0 [symbolic = %T.loc12_14.2 (constants.%T.826)]
  211. // CHECK:STDOUT: }
  212. // CHECK:STDOUT: impl_decl @impl.793 [concrete] {
  213. // CHECK:STDOUT: %T.patt: %pattern_type.28e = symbolic_binding_pattern T, 0 [concrete]
  214. // CHECK:STDOUT: } {
  215. // CHECK:STDOUT: %T.ref.loc27: %J.type = name_ref T, %T.loc27 [symbolic = %T.loc13_14.2 (constants.%T.ccd)]
  216. // CHECK:STDOUT: %T.as_type.loc27: type = facet_access_type %T.ref.loc27 [symbolic = %T.as_type.loc13_21.2 (constants.%T.as_type.3df)]
  217. // CHECK:STDOUT: %.loc27: type = converted %T.ref.loc27, %T.as_type.loc27 [symbolic = %T.as_type.loc13_21.2 (constants.%T.as_type.3df)]
  218. // CHECK:STDOUT: %Interface.ref.loc27: type = name_ref Interface, file.%Interface.decl [concrete = constants.%Interface.type]
  219. // CHECK:STDOUT: %J.ref.loc27: type = name_ref J, file.%J.decl [concrete = constants.%J.type]
  220. // CHECK:STDOUT: %T.loc27: %J.type = bind_symbolic_name T, 0 [symbolic = %T.loc13_14.2 (constants.%T.ccd)]
  221. // CHECK:STDOUT: }
  222. // CHECK:STDOUT: impl_decl @impl.c93 [concrete] {
  223. // CHECK:STDOUT: %T.patt: %pattern_type.4a6 = symbolic_binding_pattern T, 0 [concrete]
  224. // CHECK:STDOUT: } {
  225. // CHECK:STDOUT: %T.ref.loc35: %K.type = name_ref T, %T.loc35 [symbolic = %T.loc14_14.2 (constants.%T.09f)]
  226. // CHECK:STDOUT: %T.as_type.loc35: type = facet_access_type %T.ref.loc35 [symbolic = %T.as_type.loc14_21.2 (constants.%T.as_type.037)]
  227. // CHECK:STDOUT: %.loc35: type = converted %T.ref.loc35, %T.as_type.loc35 [symbolic = %T.as_type.loc14_21.2 (constants.%T.as_type.037)]
  228. // CHECK:STDOUT: %Interface.ref.loc35: type = name_ref Interface, file.%Interface.decl [concrete = constants.%Interface.type]
  229. // CHECK:STDOUT: %K.ref.loc35: type = name_ref K, file.%K.decl [concrete = constants.%K.type]
  230. // CHECK:STDOUT: %T.loc35: %K.type = bind_symbolic_name T, 0 [symbolic = %T.loc14_14.2 (constants.%T.09f)]
  231. // CHECK:STDOUT: }
  232. // CHECK:STDOUT: impl_decl @impl.9e6 [concrete] {
  233. // CHECK:STDOUT: %T.patt: %pattern_type.86b = symbolic_binding_pattern T, 0 [concrete]
  234. // CHECK:STDOUT: } {
  235. // CHECK:STDOUT: %T.ref.loc43: %L.type = name_ref T, %T.loc43 [symbolic = %T.loc15_14.2 (constants.%T.1d2)]
  236. // CHECK:STDOUT: %T.as_type.loc43: type = facet_access_type %T.ref.loc43 [symbolic = %T.as_type.loc15_21.2 (constants.%T.as_type.0ed)]
  237. // CHECK:STDOUT: %.loc43: type = converted %T.ref.loc43, %T.as_type.loc43 [symbolic = %T.as_type.loc15_21.2 (constants.%T.as_type.0ed)]
  238. // CHECK:STDOUT: %Interface.ref.loc43: type = name_ref Interface, file.%Interface.decl [concrete = constants.%Interface.type]
  239. // CHECK:STDOUT: %L.ref.loc43: type = name_ref L, file.%L.decl [concrete = constants.%L.type]
  240. // CHECK:STDOUT: %T.loc43: %L.type = bind_symbolic_name T, 0 [symbolic = %T.loc15_14.2 (constants.%T.1d2)]
  241. // CHECK:STDOUT: }
  242. // CHECK:STDOUT: }
  243. // CHECK:STDOUT:
  244. // CHECK:STDOUT: interface @Interface {
  245. // CHECK:STDOUT: %Self: %Interface.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.719]
  246. // CHECK:STDOUT:
  247. // CHECK:STDOUT: !members:
  248. // CHECK:STDOUT: .Self = %Self
  249. // CHECK:STDOUT: witness = ()
  250. // CHECK:STDOUT: }
  251. // CHECK:STDOUT:
  252. // CHECK:STDOUT: interface @I {
  253. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.826]
  254. // CHECK:STDOUT:
  255. // CHECK:STDOUT: !members:
  256. // CHECK:STDOUT: .Self = %Self
  257. // CHECK:STDOUT: witness = ()
  258. // CHECK:STDOUT: }
  259. // CHECK:STDOUT:
  260. // CHECK:STDOUT: interface @J {
  261. // CHECK:STDOUT: %Self: %J.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.ccd]
  262. // CHECK:STDOUT:
  263. // CHECK:STDOUT: !members:
  264. // CHECK:STDOUT: .Self = %Self
  265. // CHECK:STDOUT: witness = ()
  266. // CHECK:STDOUT: }
  267. // CHECK:STDOUT:
  268. // CHECK:STDOUT: interface @K {
  269. // CHECK:STDOUT: %Self: %K.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.09f]
  270. // CHECK:STDOUT:
  271. // CHECK:STDOUT: !members:
  272. // CHECK:STDOUT: .Self = %Self
  273. // CHECK:STDOUT: witness = ()
  274. // CHECK:STDOUT: }
  275. // CHECK:STDOUT:
  276. // CHECK:STDOUT: interface @L {
  277. // CHECK:STDOUT: %Self: %L.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1d2]
  278. // CHECK:STDOUT:
  279. // CHECK:STDOUT: !members:
  280. // CHECK:STDOUT: .Self = %Self
  281. // CHECK:STDOUT: witness = ()
  282. // CHECK:STDOUT: }
  283. // CHECK:STDOUT:
  284. // CHECK:STDOUT: generic impl @impl.c3d(%T.loc12_14.1: %I.type) {
  285. // CHECK:STDOUT: %T.loc12_14.2: %I.type = bind_symbolic_name T, 0 [symbolic = %T.loc12_14.2 (constants.%T.826)]
  286. // CHECK:STDOUT: %T.as_type.loc12_21.2: type = facet_access_type %T.loc12_14.2 [symbolic = %T.as_type.loc12_21.2 (constants.%T.as_type.b70)]
  287. // CHECK:STDOUT: %Interface.impl_witness: <witness> = impl_witness file.%Interface.impl_witness_table.loc12, @impl.c3d(%T.loc12_14.2) [symbolic = %Interface.impl_witness (constants.%Interface.impl_witness.a14)]
  288. // CHECK:STDOUT:
  289. // CHECK:STDOUT: !definition:
  290. // CHECK:STDOUT:
  291. // CHECK:STDOUT: impl: %.loc12 as %Interface.ref.loc12 {
  292. // CHECK:STDOUT: !members:
  293. // CHECK:STDOUT: witness = file.%Interface.impl_witness.loc12
  294. // CHECK:STDOUT: }
  295. // CHECK:STDOUT: }
  296. // CHECK:STDOUT:
  297. // CHECK:STDOUT: generic impl @impl.793(%T.loc13_14.1: %J.type) {
  298. // CHECK:STDOUT: %T.loc13_14.2: %J.type = bind_symbolic_name T, 0 [symbolic = %T.loc13_14.2 (constants.%T.ccd)]
  299. // CHECK:STDOUT: %T.as_type.loc13_21.2: type = facet_access_type %T.loc13_14.2 [symbolic = %T.as_type.loc13_21.2 (constants.%T.as_type.3df)]
  300. // CHECK:STDOUT: %Interface.impl_witness: <witness> = impl_witness file.%Interface.impl_witness_table.loc13, @impl.793(%T.loc13_14.2) [symbolic = %Interface.impl_witness (constants.%Interface.impl_witness.608)]
  301. // CHECK:STDOUT:
  302. // CHECK:STDOUT: !definition:
  303. // CHECK:STDOUT:
  304. // CHECK:STDOUT: impl: %.loc13 as %Interface.ref.loc13 {
  305. // CHECK:STDOUT: !members:
  306. // CHECK:STDOUT: witness = file.%Interface.impl_witness.loc13
  307. // CHECK:STDOUT: }
  308. // CHECK:STDOUT: }
  309. // CHECK:STDOUT:
  310. // CHECK:STDOUT: generic impl @impl.c93(%T.loc14_14.1: %K.type) {
  311. // CHECK:STDOUT: %T.loc14_14.2: %K.type = bind_symbolic_name T, 0 [symbolic = %T.loc14_14.2 (constants.%T.09f)]
  312. // CHECK:STDOUT: %T.as_type.loc14_21.2: type = facet_access_type %T.loc14_14.2 [symbolic = %T.as_type.loc14_21.2 (constants.%T.as_type.037)]
  313. // CHECK:STDOUT: %Interface.impl_witness: <witness> = impl_witness file.%Interface.impl_witness_table.loc14, @impl.c93(%T.loc14_14.2) [symbolic = %Interface.impl_witness (constants.%Interface.impl_witness.b9e)]
  314. // CHECK:STDOUT:
  315. // CHECK:STDOUT: !definition:
  316. // CHECK:STDOUT:
  317. // CHECK:STDOUT: impl: %.loc14 as %Interface.ref.loc14 {
  318. // CHECK:STDOUT: !members:
  319. // CHECK:STDOUT: witness = file.%Interface.impl_witness.loc14
  320. // CHECK:STDOUT: }
  321. // CHECK:STDOUT: }
  322. // CHECK:STDOUT:
  323. // CHECK:STDOUT: generic impl @impl.9e6(%T.loc15_14.1: %L.type) {
  324. // CHECK:STDOUT: %T.loc15_14.2: %L.type = bind_symbolic_name T, 0 [symbolic = %T.loc15_14.2 (constants.%T.1d2)]
  325. // CHECK:STDOUT: %T.as_type.loc15_21.2: type = facet_access_type %T.loc15_14.2 [symbolic = %T.as_type.loc15_21.2 (constants.%T.as_type.0ed)]
  326. // CHECK:STDOUT: %Interface.impl_witness: <witness> = impl_witness file.%Interface.impl_witness_table.loc15, @impl.9e6(%T.loc15_14.2) [symbolic = %Interface.impl_witness (constants.%Interface.impl_witness.e9d)]
  327. // CHECK:STDOUT:
  328. // CHECK:STDOUT: !definition:
  329. // CHECK:STDOUT:
  330. // CHECK:STDOUT: impl: %.loc15 as %Interface.ref.loc15 {
  331. // CHECK:STDOUT: !members:
  332. // CHECK:STDOUT: witness = file.%Interface.impl_witness.loc15
  333. // CHECK:STDOUT: }
  334. // CHECK:STDOUT: }
  335. // CHECK:STDOUT:
  336. // CHECK:STDOUT: specific @impl.c3d(constants.%T.826) {
  337. // CHECK:STDOUT: %T.loc12_14.2 => constants.%T.826
  338. // CHECK:STDOUT: %T.as_type.loc12_21.2 => constants.%T.as_type.b70
  339. // CHECK:STDOUT: %Interface.impl_witness => constants.%Interface.impl_witness.a14
  340. // CHECK:STDOUT: }
  341. // CHECK:STDOUT:
  342. // CHECK:STDOUT: specific @impl.793(constants.%T.ccd) {
  343. // CHECK:STDOUT: %T.loc13_14.2 => constants.%T.ccd
  344. // CHECK:STDOUT: %T.as_type.loc13_21.2 => constants.%T.as_type.3df
  345. // CHECK:STDOUT: %Interface.impl_witness => constants.%Interface.impl_witness.608
  346. // CHECK:STDOUT: }
  347. // CHECK:STDOUT:
  348. // CHECK:STDOUT: specific @impl.c93(constants.%T.09f) {
  349. // CHECK:STDOUT: %T.loc14_14.2 => constants.%T.09f
  350. // CHECK:STDOUT: %T.as_type.loc14_21.2 => constants.%T.as_type.037
  351. // CHECK:STDOUT: %Interface.impl_witness => constants.%Interface.impl_witness.b9e
  352. // CHECK:STDOUT: }
  353. // CHECK:STDOUT:
  354. // CHECK:STDOUT: specific @impl.9e6(constants.%T.1d2) {
  355. // CHECK:STDOUT: %T.loc15_14.2 => constants.%T.1d2
  356. // CHECK:STDOUT: %T.as_type.loc15_21.2 => constants.%T.as_type.0ed
  357. // CHECK:STDOUT: %Interface.impl_witness => constants.%Interface.impl_witness.e9d
  358. // CHECK:STDOUT: }
  359. // CHECK:STDOUT:
  360. // CHECK:STDOUT: --- fail_same_self_and_interface_redefined.carbon
  361. // CHECK:STDOUT:
  362. // CHECK:STDOUT: constants {
  363. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  364. // CHECK:STDOUT: %Self.826: %I.type = bind_symbolic_name Self, 0 [symbolic]
  365. // CHECK:STDOUT: %J.type: type = facet_type <@J> [concrete]
  366. // CHECK:STDOUT: %Self.ccd: %J.type = bind_symbolic_name Self, 0 [symbolic]
  367. // CHECK:STDOUT: %T: %I.type = bind_symbolic_name T, 0 [symbolic]
  368. // CHECK:STDOUT: %pattern_type: type = pattern_type %I.type [concrete]
  369. // CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic]
  370. // CHECK:STDOUT: %J.impl_witness: <witness> = impl_witness file.%J.impl_witness_table, @impl.bfd509.1(%T) [symbolic]
  371. // CHECK:STDOUT: }
  372. // CHECK:STDOUT:
  373. // CHECK:STDOUT: imports {
  374. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  375. // CHECK:STDOUT: import Core//prelude
  376. // CHECK:STDOUT: }
  377. // CHECK:STDOUT: }
  378. // CHECK:STDOUT:
  379. // CHECK:STDOUT: file {
  380. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  381. // CHECK:STDOUT: .Core = imports.%Core
  382. // CHECK:STDOUT: .I = %I.decl
  383. // CHECK:STDOUT: .J = %J.decl
  384. // CHECK:STDOUT: }
  385. // CHECK:STDOUT: %Core.import = import Core
  386. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  387. // CHECK:STDOUT: %J.decl: type = interface_decl @J [concrete = constants.%J.type] {} {}
  388. // CHECK:STDOUT: impl_decl @impl.bfd509.1 [concrete] {
  389. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  390. // CHECK:STDOUT: } {
  391. // CHECK:STDOUT: %T.ref: %I.type = name_ref T, %T.loc7_14.1 [symbolic = %T.loc7_14.2 (constants.%T)]
  392. // CHECK:STDOUT: %T.as_type.loc7_21.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc7_21.2 (constants.%T.as_type)]
  393. // CHECK:STDOUT: %.loc7: type = converted %T.ref, %T.as_type.loc7_21.1 [symbolic = %T.as_type.loc7_21.2 (constants.%T.as_type)]
  394. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type]
  395. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  396. // CHECK:STDOUT: %T.loc7_14.1: %I.type = bind_symbolic_name T, 0 [symbolic = %T.loc7_14.2 (constants.%T)]
  397. // CHECK:STDOUT: }
  398. // CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (), @impl.bfd509.1 [concrete]
  399. // CHECK:STDOUT: %J.impl_witness: <witness> = impl_witness %J.impl_witness_table, @impl.bfd509.1(constants.%T) [symbolic = @impl.bfd509.1.%J.impl_witness (constants.%J.impl_witness)]
  400. // CHECK:STDOUT: impl_decl @impl.bfd509.2 [concrete] {
  401. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  402. // CHECK:STDOUT: } {
  403. // CHECK:STDOUT: %T.ref: %I.type = name_ref T, %T.loc15_14.1 [symbolic = %T.loc15_14.2 (constants.%T)]
  404. // CHECK:STDOUT: %T.as_type.loc15_21.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc15_21.2 (constants.%T.as_type)]
  405. // CHECK:STDOUT: %.loc15: type = converted %T.ref, %T.as_type.loc15_21.1 [symbolic = %T.as_type.loc15_21.2 (constants.%T.as_type)]
  406. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type]
  407. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  408. // CHECK:STDOUT: %T.loc15_14.1: %I.type = bind_symbolic_name T, 0 [symbolic = %T.loc15_14.2 (constants.%T)]
  409. // CHECK:STDOUT: }
  410. // CHECK:STDOUT: }
  411. // CHECK:STDOUT:
  412. // CHECK:STDOUT: interface @I {
  413. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.826]
  414. // CHECK:STDOUT:
  415. // CHECK:STDOUT: !members:
  416. // CHECK:STDOUT: .Self = %Self
  417. // CHECK:STDOUT: witness = ()
  418. // CHECK:STDOUT: }
  419. // CHECK:STDOUT:
  420. // CHECK:STDOUT: interface @J {
  421. // CHECK:STDOUT: %Self: %J.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.ccd]
  422. // CHECK:STDOUT:
  423. // CHECK:STDOUT: !members:
  424. // CHECK:STDOUT: .Self = %Self
  425. // CHECK:STDOUT: witness = ()
  426. // CHECK:STDOUT: }
  427. // CHECK:STDOUT:
  428. // CHECK:STDOUT: generic impl @impl.bfd509.1(%T.loc7_14.1: %I.type) {
  429. // CHECK:STDOUT: %T.loc7_14.2: %I.type = bind_symbolic_name T, 0 [symbolic = %T.loc7_14.2 (constants.%T)]
  430. // CHECK:STDOUT: %T.as_type.loc7_21.2: type = facet_access_type %T.loc7_14.2 [symbolic = %T.as_type.loc7_21.2 (constants.%T.as_type)]
  431. // CHECK:STDOUT: %J.impl_witness: <witness> = impl_witness file.%J.impl_witness_table, @impl.bfd509.1(%T.loc7_14.2) [symbolic = %J.impl_witness (constants.%J.impl_witness)]
  432. // CHECK:STDOUT:
  433. // CHECK:STDOUT: !definition:
  434. // CHECK:STDOUT:
  435. // CHECK:STDOUT: impl: %.loc7 as %J.ref {
  436. // CHECK:STDOUT: !members:
  437. // CHECK:STDOUT: witness = file.%J.impl_witness
  438. // CHECK:STDOUT: }
  439. // CHECK:STDOUT: }
  440. // CHECK:STDOUT:
  441. // CHECK:STDOUT: generic impl @impl.bfd509.2(%T.loc15_14.1: %I.type) {
  442. // CHECK:STDOUT: %T.loc15_14.2: %I.type = bind_symbolic_name T, 0 [symbolic = %T.loc15_14.2 (constants.%T)]
  443. // CHECK:STDOUT: %T.as_type.loc15_21.2: type = facet_access_type %T.loc15_14.2 [symbolic = %T.as_type.loc15_21.2 (constants.%T.as_type)]
  444. // CHECK:STDOUT:
  445. // CHECK:STDOUT: !definition:
  446. // CHECK:STDOUT:
  447. // CHECK:STDOUT: impl: %.loc15 as %J.ref {
  448. // CHECK:STDOUT: !members:
  449. // CHECK:STDOUT: witness = <error>
  450. // CHECK:STDOUT: }
  451. // CHECK:STDOUT: }
  452. // CHECK:STDOUT:
  453. // CHECK:STDOUT: specific @impl.bfd509.1(constants.%T) {
  454. // CHECK:STDOUT: %T.loc7_14.2 => constants.%T
  455. // CHECK:STDOUT: %T.as_type.loc7_21.2 => constants.%T.as_type
  456. // CHECK:STDOUT: %J.impl_witness => constants.%J.impl_witness
  457. // CHECK:STDOUT: }
  458. // CHECK:STDOUT:
  459. // CHECK:STDOUT: specific @impl.bfd509.2(constants.%T) {
  460. // CHECK:STDOUT: %T.loc15_14.2 => constants.%T
  461. // CHECK:STDOUT: %T.as_type.loc15_21.2 => constants.%T.as_type
  462. // CHECK:STDOUT: }
  463. // CHECK:STDOUT:
  464. // CHECK:STDOUT: --- fail_same_type_different_spelling.carbon
  465. // CHECK:STDOUT:
  466. // CHECK:STDOUT: constants {
  467. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  468. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  469. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  470. // CHECK:STDOUT: %I.impl_witness.215123.1: <witness> = impl_witness file.%I.impl_witness_table.loc9 [concrete]
  471. // CHECK:STDOUT: %tuple.type: type = tuple_type (type, type) [concrete]
  472. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete]
  473. // CHECK:STDOUT: %tuple: %tuple.type = tuple_value (%C, %C) [concrete]
  474. // CHECK:STDOUT: %I.impl_witness.215123.2: <witness> = impl_witness file.%I.impl_witness_table.loc17 [concrete]
  475. // CHECK:STDOUT: }
  476. // CHECK:STDOUT:
  477. // CHECK:STDOUT: imports {
  478. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  479. // CHECK:STDOUT: import Core//prelude
  480. // CHECK:STDOUT: }
  481. // CHECK:STDOUT: }
  482. // CHECK:STDOUT:
  483. // CHECK:STDOUT: file {
  484. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  485. // CHECK:STDOUT: .Core = imports.%Core
  486. // CHECK:STDOUT: .C = %C.decl
  487. // CHECK:STDOUT: .I = %I.decl
  488. // CHECK:STDOUT: }
  489. // CHECK:STDOUT: %Core.import = import Core
  490. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  491. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  492. // CHECK:STDOUT: impl_decl @impl.7704ae.1 [concrete] {} {
  493. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  494. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  495. // CHECK:STDOUT: }
  496. // CHECK:STDOUT: %I.impl_witness_table.loc9 = impl_witness_table (), @impl.7704ae.1 [concrete]
  497. // CHECK:STDOUT: %I.impl_witness.loc9: <witness> = impl_witness %I.impl_witness_table.loc9 [concrete = constants.%I.impl_witness.215123.1]
  498. // CHECK:STDOUT: impl_decl @impl.7704ae.2 [concrete] {} {
  499. // CHECK:STDOUT: %C.ref.loc17_7: type = name_ref C, file.%C.decl [concrete = constants.%C]
  500. // CHECK:STDOUT: %C.ref.loc17_10: type = name_ref C, file.%C.decl [concrete = constants.%C]
  501. // CHECK:STDOUT: %.loc17_11.1: %tuple.type = tuple_literal (%C.ref.loc17_7, %C.ref.loc17_10)
  502. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0]
  503. // CHECK:STDOUT: %tuple: %tuple.type = tuple_value (%C.ref.loc17_7, %C.ref.loc17_10) [concrete = constants.%tuple]
  504. // CHECK:STDOUT: %.loc17_11.2: %tuple.type = converted %.loc17_11.1, %tuple [concrete = constants.%tuple]
  505. // CHECK:STDOUT: %tuple.elem0: type = tuple_access %.loc17_11.2, element0 [concrete = constants.%C]
  506. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  507. // CHECK:STDOUT: }
  508. // CHECK:STDOUT: %I.impl_witness_table.loc17 = impl_witness_table (), @impl.7704ae.2 [concrete]
  509. // CHECK:STDOUT: %I.impl_witness.loc17: <witness> = impl_witness %I.impl_witness_table.loc17 [concrete = constants.%I.impl_witness.215123.2]
  510. // CHECK:STDOUT: }
  511. // CHECK:STDOUT:
  512. // CHECK:STDOUT: interface @I {
  513. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  514. // CHECK:STDOUT:
  515. // CHECK:STDOUT: !members:
  516. // CHECK:STDOUT: .Self = %Self
  517. // CHECK:STDOUT: witness = ()
  518. // CHECK:STDOUT: }
  519. // CHECK:STDOUT:
  520. // CHECK:STDOUT: impl @impl.7704ae.1: %C.ref as %I.ref {
  521. // CHECK:STDOUT: !members:
  522. // CHECK:STDOUT: witness = file.%I.impl_witness.loc9
  523. // CHECK:STDOUT: }
  524. // CHECK:STDOUT:
  525. // CHECK:STDOUT: impl @impl.7704ae.2: %tuple.elem0 as %I.ref {
  526. // CHECK:STDOUT: !members:
  527. // CHECK:STDOUT: witness = file.%I.impl_witness.loc17
  528. // CHECK:STDOUT: }
  529. // CHECK:STDOUT:
  530. // CHECK:STDOUT: class @C;
  531. // CHECK:STDOUT:
  532. // CHECK:STDOUT: --- fail_redefinition_generic_regions.carbon
  533. // CHECK:STDOUT:
  534. // CHECK:STDOUT: constants {
  535. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  536. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  537. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  538. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  539. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness file.%I.impl_witness_table, @impl.2caff2.1(%T) [symbolic]
  540. // CHECK:STDOUT: %A.type: type = fn_type @A, @impl.2caff2.1(%T) [symbolic]
  541. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  542. // CHECK:STDOUT: %A: %A.type = struct_value () [symbolic]
  543. // CHECK:STDOUT: %B.type: type = fn_type @B, @impl.2caff2.2(%T) [symbolic]
  544. // CHECK:STDOUT: %B: %B.type = struct_value () [symbolic]
  545. // CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete]
  546. // CHECK:STDOUT: %C.type: type = fn_type @C, @impl.2caff2.2(%T) [symbolic]
  547. // CHECK:STDOUT: %C: %C.type = struct_value () [symbolic]
  548. // CHECK:STDOUT: %D.type: type = fn_type @D, @impl.2caff2.2(%T) [symbolic]
  549. // CHECK:STDOUT: %D: %D.type = struct_value () [symbolic]
  550. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  551. // CHECK:STDOUT: %C.specific_fn: <specific function> = specific_function %C, @C(%T) [symbolic]
  552. // CHECK:STDOUT: }
  553. // CHECK:STDOUT:
  554. // CHECK:STDOUT: imports {
  555. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  556. // CHECK:STDOUT: import Core//prelude
  557. // CHECK:STDOUT: }
  558. // CHECK:STDOUT: }
  559. // CHECK:STDOUT:
  560. // CHECK:STDOUT: file {
  561. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  562. // CHECK:STDOUT: .Core = imports.%Core
  563. // CHECK:STDOUT: .I = %I.decl
  564. // CHECK:STDOUT: }
  565. // CHECK:STDOUT: %Core.import = import Core
  566. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  567. // CHECK:STDOUT: impl_decl @impl.2caff2.1 [concrete] {
  568. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  569. // CHECK:STDOUT: } {
  570. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc4_14.1 [symbolic = %T.loc4_14.2 (constants.%T)]
  571. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  572. // CHECK:STDOUT: %T.loc4_14.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_14.2 (constants.%T)]
  573. // CHECK:STDOUT: }
  574. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (), @impl.2caff2.1 [concrete]
  575. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table, @impl.2caff2.1(constants.%T) [symbolic = @impl.2caff2.1.%I.impl_witness (constants.%I.impl_witness)]
  576. // CHECK:STDOUT: impl_decl @impl.2caff2.2 [concrete] {
  577. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  578. // CHECK:STDOUT: } {
  579. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc15_14.1 [symbolic = %T.loc15_14.2 (constants.%T)]
  580. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  581. // CHECK:STDOUT: %T.loc15_14.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc15_14.2 (constants.%T)]
  582. // CHECK:STDOUT: }
  583. // CHECK:STDOUT: }
  584. // CHECK:STDOUT:
  585. // CHECK:STDOUT: interface @I {
  586. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  587. // CHECK:STDOUT:
  588. // CHECK:STDOUT: !members:
  589. // CHECK:STDOUT: .Self = %Self
  590. // CHECK:STDOUT: witness = ()
  591. // CHECK:STDOUT: }
  592. // CHECK:STDOUT:
  593. // CHECK:STDOUT: generic impl @impl.2caff2.1(%T.loc4_14.1: type) {
  594. // CHECK:STDOUT: %T.loc4_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_14.2 (constants.%T)]
  595. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness file.%I.impl_witness_table, @impl.2caff2.1(%T.loc4_14.2) [symbolic = %I.impl_witness (constants.%I.impl_witness)]
  596. // CHECK:STDOUT:
  597. // CHECK:STDOUT: !definition:
  598. // CHECK:STDOUT: %A.type: type = fn_type @A, @impl.2caff2.1(%T.loc4_14.2) [symbolic = %A.type (constants.%A.type)]
  599. // CHECK:STDOUT: %A: @impl.2caff2.1.%A.type (%A.type) = struct_value () [symbolic = %A (constants.%A)]
  600. // CHECK:STDOUT:
  601. // CHECK:STDOUT: impl: %T.ref as %I.ref {
  602. // CHECK:STDOUT: %A.decl: @impl.2caff2.1.%A.type (%A.type) = fn_decl @A [symbolic = @impl.2caff2.1.%A (constants.%A)] {} {}
  603. // CHECK:STDOUT:
  604. // CHECK:STDOUT: !members:
  605. // CHECK:STDOUT: .A = %A.decl
  606. // CHECK:STDOUT: witness = file.%I.impl_witness
  607. // CHECK:STDOUT: }
  608. // CHECK:STDOUT: }
  609. // CHECK:STDOUT:
  610. // CHECK:STDOUT: generic impl @impl.2caff2.2(%T.loc15_14.1: type) {
  611. // CHECK:STDOUT: %T.loc15_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc15_14.2 (constants.%T)]
  612. // CHECK:STDOUT:
  613. // CHECK:STDOUT: !definition:
  614. // CHECK:STDOUT: %B.type: type = fn_type @B, @impl.2caff2.2(%T.loc15_14.2) [symbolic = %B.type (constants.%B.type)]
  615. // CHECK:STDOUT: %B: @impl.2caff2.2.%B.type (%B.type) = struct_value () [symbolic = %B (constants.%B)]
  616. // CHECK:STDOUT: %C.type: type = fn_type @C, @impl.2caff2.2(%T.loc15_14.2) [symbolic = %C.type (constants.%C.type)]
  617. // CHECK:STDOUT: %C: @impl.2caff2.2.%C.type (%C.type) = struct_value () [symbolic = %C (constants.%C)]
  618. // CHECK:STDOUT: %D.type: type = fn_type @D, @impl.2caff2.2(%T.loc15_14.2) [symbolic = %D.type (constants.%D.type)]
  619. // CHECK:STDOUT: %D: @impl.2caff2.2.%D.type (%D.type) = struct_value () [symbolic = %D (constants.%D)]
  620. // CHECK:STDOUT:
  621. // CHECK:STDOUT: impl: %T.ref as %I.ref {
  622. // CHECK:STDOUT: %B.decl: @impl.2caff2.2.%B.type (%B.type) = fn_decl @B [symbolic = @impl.2caff2.2.%B (constants.%B)] {} {}
  623. // CHECK:STDOUT: %C.decl: @impl.2caff2.2.%C.type (%C.type) = fn_decl @C [symbolic = @impl.2caff2.2.%C (constants.%C)] {
  624. // CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern [concrete]
  625. // CHECK:STDOUT: %return.param_patt: %pattern_type.cb1 = out_param_pattern %return.patt, call_param0 [concrete]
  626. // CHECK:STDOUT: } {
  627. // CHECK:STDOUT: %.loc19_14.1: %empty_tuple.type = tuple_literal ()
  628. // CHECK:STDOUT: %.loc19_14.2: type = converted %.loc19_14.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  629. // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0
  630. // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param
  631. // CHECK:STDOUT: }
  632. // CHECK:STDOUT: %D.decl: @impl.2caff2.2.%D.type (%D.type) = fn_decl @D [symbolic = @impl.2caff2.2.%D (constants.%D)] {
  633. // CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern [concrete]
  634. // CHECK:STDOUT: %return.param_patt: %pattern_type.cb1 = out_param_pattern %return.patt, call_param0 [concrete]
  635. // CHECK:STDOUT: } {
  636. // CHECK:STDOUT: %.loc20_14.1: %empty_tuple.type = tuple_literal ()
  637. // CHECK:STDOUT: %.loc20_14.2: type = converted %.loc20_14.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  638. // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0
  639. // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param
  640. // CHECK:STDOUT: }
  641. // CHECK:STDOUT:
  642. // CHECK:STDOUT: !members:
  643. // CHECK:STDOUT: .B = %B.decl
  644. // CHECK:STDOUT: .C = %C.decl
  645. // CHECK:STDOUT: .D = %D.decl
  646. // CHECK:STDOUT: witness = <error>
  647. // CHECK:STDOUT: }
  648. // CHECK:STDOUT: }
  649. // CHECK:STDOUT:
  650. // CHECK:STDOUT: generic fn @A(@impl.2caff2.1.%T.loc4_14.1: type) {
  651. // CHECK:STDOUT: !definition:
  652. // CHECK:STDOUT:
  653. // CHECK:STDOUT: fn() {
  654. // CHECK:STDOUT: !entry:
  655. // CHECK:STDOUT: return
  656. // CHECK:STDOUT: }
  657. // CHECK:STDOUT: }
  658. // CHECK:STDOUT:
  659. // CHECK:STDOUT: generic fn @B(@impl.2caff2.2.%T.loc15_14.1: type) {
  660. // CHECK:STDOUT: !definition:
  661. // CHECK:STDOUT:
  662. // CHECK:STDOUT: fn() {
  663. // CHECK:STDOUT: !entry:
  664. // CHECK:STDOUT: return
  665. // CHECK:STDOUT: }
  666. // CHECK:STDOUT: }
  667. // CHECK:STDOUT:
  668. // CHECK:STDOUT: generic fn @C(@impl.2caff2.2.%T.loc15_14.1: type) {
  669. // CHECK:STDOUT: !definition:
  670. // CHECK:STDOUT:
  671. // CHECK:STDOUT: fn() -> %empty_tuple.type {
  672. // CHECK:STDOUT: !entry:
  673. // CHECK:STDOUT: %.loc19_26: %empty_tuple.type = tuple_literal ()
  674. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple]
  675. // CHECK:STDOUT: %.loc19_27: %empty_tuple.type = converted %.loc19_26, %empty_tuple [concrete = constants.%empty_tuple]
  676. // CHECK:STDOUT: return %.loc19_27
  677. // CHECK:STDOUT: }
  678. // CHECK:STDOUT: }
  679. // CHECK:STDOUT:
  680. // CHECK:STDOUT: generic fn @D(@impl.2caff2.2.%T.loc15_14.1: type) {
  681. // CHECK:STDOUT: !definition:
  682. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  683. // CHECK:STDOUT: %C.type: type = fn_type @C, @impl.2caff2.2(%T) [symbolic = %C.type (constants.%C.type)]
  684. // CHECK:STDOUT: %C: @D.%C.type (%C.type) = struct_value () [symbolic = %C (constants.%C)]
  685. // CHECK:STDOUT: %C.specific_fn.loc21_12.2: <specific function> = specific_function %C, @C(%T) [symbolic = %C.specific_fn.loc21_12.2 (constants.%C.specific_fn)]
  686. // CHECK:STDOUT:
  687. // CHECK:STDOUT: fn() -> %empty_tuple.type {
  688. // CHECK:STDOUT: !entry:
  689. // CHECK:STDOUT: %.loc21_12: @D.%C.type (%C.type) = specific_constant @impl.2caff2.2.%C.decl, @impl.2caff2.2(constants.%T) [symbolic = %C (constants.%C)]
  690. // CHECK:STDOUT: %C.ref: @D.%C.type (%C.type) = name_ref C, %.loc21_12 [symbolic = %C (constants.%C)]
  691. // CHECK:STDOUT: %C.specific_fn.loc21_12.1: <specific function> = specific_function %C.ref, @C(constants.%T) [symbolic = %C.specific_fn.loc21_12.2 (constants.%C.specific_fn)]
  692. // CHECK:STDOUT: %C.call: init %empty_tuple.type = call %C.specific_fn.loc21_12.1()
  693. // CHECK:STDOUT: %.loc21_14.1: ref %empty_tuple.type = temporary_storage
  694. // CHECK:STDOUT: %.loc21_14.2: ref %empty_tuple.type = temporary %.loc21_14.1, %C.call
  695. // CHECK:STDOUT: %tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple]
  696. // CHECK:STDOUT: %.loc21_15: %empty_tuple.type = converted %C.call, %tuple [concrete = constants.%empty_tuple]
  697. // CHECK:STDOUT: return %.loc21_15
  698. // CHECK:STDOUT: }
  699. // CHECK:STDOUT: }
  700. // CHECK:STDOUT:
  701. // CHECK:STDOUT: specific @impl.2caff2.1(constants.%T) {
  702. // CHECK:STDOUT: %T.loc4_14.2 => constants.%T
  703. // CHECK:STDOUT: %I.impl_witness => constants.%I.impl_witness
  704. // CHECK:STDOUT:
  705. // CHECK:STDOUT: !definition:
  706. // CHECK:STDOUT: %A.type => constants.%A.type
  707. // CHECK:STDOUT: %A => constants.%A
  708. // CHECK:STDOUT: }
  709. // CHECK:STDOUT:
  710. // CHECK:STDOUT: specific @A(constants.%T) {}
  711. // CHECK:STDOUT:
  712. // CHECK:STDOUT: specific @impl.2caff2.2(constants.%T) {
  713. // CHECK:STDOUT: %T.loc15_14.2 => constants.%T
  714. // CHECK:STDOUT:
  715. // CHECK:STDOUT: !definition:
  716. // CHECK:STDOUT: %B.type => constants.%B.type
  717. // CHECK:STDOUT: %B => constants.%B
  718. // CHECK:STDOUT: %C.type => constants.%C.type
  719. // CHECK:STDOUT: %C => constants.%C
  720. // CHECK:STDOUT: %D.type => constants.%D.type
  721. // CHECK:STDOUT: %D => constants.%D
  722. // CHECK:STDOUT: }
  723. // CHECK:STDOUT:
  724. // CHECK:STDOUT: specific @B(constants.%T) {}
  725. // CHECK:STDOUT:
  726. // CHECK:STDOUT: specific @C(constants.%T) {
  727. // CHECK:STDOUT: !definition:
  728. // CHECK:STDOUT: }
  729. // CHECK:STDOUT:
  730. // CHECK:STDOUT: specific @D(constants.%T) {}
  731. // CHECK:STDOUT: