generic_redeclaration.carbon 41 KB

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