fail_todo_use_assoc_const.carbon 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  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/fail_todo_use_assoc_const.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/fail_todo_use_assoc_const.carbon
  10. // --- fail_todo_associated_type_in_signature.carbon
  11. library "[[@TEST_NAME]]";
  12. interface J {
  13. let U:! type;
  14. // CHECK:STDERR: fail_todo_associated_type_in_signature.carbon:[[@LINE+14]]:23: error: cannot implicitly convert from `<associated entity in J>` to `type` [ImplicitAsConversionFailure]
  15. // CHECK:STDERR: fn F[self: Self](u: U) -> U;
  16. // CHECK:STDERR: ^
  17. // CHECK:STDERR: fail_todo_associated_type_in_signature.carbon:[[@LINE+11]]:23: note: type `<associated entity in J>` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote]
  18. // CHECK:STDERR: fn F[self: Self](u: U) -> U;
  19. // CHECK:STDERR: ^
  20. // CHECK:STDERR:
  21. // CHECK:STDERR: fail_todo_associated_type_in_signature.carbon:[[@LINE+7]]:29: error: cannot implicitly convert from `<associated entity in J>` to `type` [ImplicitAsConversionFailure]
  22. // CHECK:STDERR: fn F[self: Self](u: U) -> U;
  23. // CHECK:STDERR: ^
  24. // CHECK:STDERR: fail_todo_associated_type_in_signature.carbon:[[@LINE+4]]:29: note: type `<associated entity in J>` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote]
  25. // CHECK:STDERR: fn F[self: Self](u: U) -> U;
  26. // CHECK:STDERR: ^
  27. // CHECK:STDERR:
  28. fn F[self: Self](u: U) -> U;
  29. }
  30. impl () as J where .U = {} {
  31. fn F[self: Self](u: {}) -> {} { return u; }
  32. }
  33. class C {
  34. // This allows the type to be copyable so it can be returned.
  35. adapt {};
  36. }
  37. impl C as J where .U = C {
  38. fn F[self: Self](u: C) -> C { return self; }
  39. }
  40. // --- fail_todo_use_non-type_in_function.carbon
  41. library "[[@TEST_NAME]]";
  42. interface M {
  43. let Z:! {.b: {}};
  44. fn G() -> {};
  45. }
  46. impl () as M where .Z = {.b = {}} {
  47. fn G() -> {} {
  48. // CHECK:STDERR: fail_todo_use_non-type_in_function.carbon:[[@LINE+7]]:13: error: cannot convert from `type` to `M` with `as` [ExplicitAsConversionFailure]
  49. // CHECK:STDERR: return (Self as M).Z.b;
  50. // CHECK:STDERR: ^~~~~~~~~
  51. // CHECK:STDERR: fail_todo_use_non-type_in_function.carbon:[[@LINE+4]]:13: note: type `type` does not implement interface `Core.As(M)` [MissingImplInMemberAccessNote]
  52. // CHECK:STDERR: return (Self as M).Z.b;
  53. // CHECK:STDERR: ^~~~~~~~~
  54. // CHECK:STDERR:
  55. return (Self as M).Z.b;
  56. }
  57. }
  58. // --- fail_todo_associated_int_in_array.carbon
  59. library "[[@TEST_NAME]]";
  60. interface I {
  61. let N:! i32;
  62. // CHECK:STDERR: fail_todo_associated_int_in_array.carbon:[[@LINE+7]]:32: error: cannot implicitly convert from `<associated entity in I>` to `Core.IntLiteral` [ImplicitAsConversionFailure]
  63. // CHECK:STDERR: fn F[self: Self]() -> [bool; N];
  64. // CHECK:STDERR: ^
  65. // CHECK:STDERR: fail_todo_associated_int_in_array.carbon:[[@LINE+4]]:32: note: type `<associated entity in I>` does not implement interface `Core.ImplicitAs(Core.IntLiteral)` [MissingImplInMemberAccessNote]
  66. // CHECK:STDERR: fn F[self: Self]() -> [bool; N];
  67. // CHECK:STDERR: ^
  68. // CHECK:STDERR:
  69. fn F[self: Self]() -> [bool; N];
  70. }
  71. impl () as I where .N = 2 {
  72. fn F[self: Self]() -> [bool; 2] { return (true, false); }
  73. }
  74. // CHECK:STDOUT: --- fail_todo_associated_type_in_signature.carbon
  75. // CHECK:STDOUT:
  76. // CHECK:STDOUT: constants {
  77. // CHECK:STDOUT: %J.type: type = facet_type <@J> [template]
  78. // CHECK:STDOUT: %Self.ccd: %J.type = bind_symbolic_name Self, 0 [symbolic]
  79. // CHECK:STDOUT: %J.assoc_type: type = assoc_entity_type %J.type [template]
  80. // CHECK:STDOUT: %assoc0.1e6: %J.assoc_type = assoc_entity element0, @J.%U [template]
  81. // CHECK:STDOUT: %Self.as_type.3df: type = facet_access_type %Self.ccd [symbolic]
  82. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  83. // CHECK:STDOUT: %F.type.c14: type = fn_type @F.1 [template]
  84. // CHECK:STDOUT: %F.b71: %F.type.c14 = struct_value () [template]
  85. // CHECK:STDOUT: %assoc1: %J.assoc_type = assoc_entity element1, @J.%F.decl [template]
  86. // CHECK:STDOUT: %.Self: %J.type = bind_symbolic_name .Self [symbolic]
  87. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic]
  88. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self [symbolic]
  89. // CHECK:STDOUT: %J.facet.ad0: %J.type = facet_value %.Self.as_type, %.Self.as_wit [symbolic]
  90. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic]
  91. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  92. // CHECK:STDOUT: %J_where.type.800: type = facet_type <@J where %impl.elem0 = %empty_struct_type> [template]
  93. // CHECK:STDOUT: %impl_witness.f71: <witness> = impl_witness (%empty_struct_type, <error>) [template]
  94. // CHECK:STDOUT: %F.type.159: type = fn_type @F.2 [template]
  95. // CHECK:STDOUT: %F.59d: %F.type.159 = struct_value () [template]
  96. // CHECK:STDOUT: %J.facet.550: %J.type = facet_value %empty_tuple.type, %impl_witness.f71 [template]
  97. // CHECK:STDOUT: %C: type = class_type @C [template]
  98. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  99. // CHECK:STDOUT: %J_where.type.2f6: type = facet_type <@J where %impl.elem0 = %C> [template]
  100. // CHECK:STDOUT: %impl_witness.c2b: <witness> = impl_witness (%C, <error>) [template]
  101. // CHECK:STDOUT: %F.type.01a: type = fn_type @F.3 [template]
  102. // CHECK:STDOUT: %F.686: %F.type.01a = struct_value () [template]
  103. // CHECK:STDOUT: %J.facet.38d: %J.type = facet_value %C, %impl_witness.c2b [template]
  104. // CHECK:STDOUT: }
  105. // CHECK:STDOUT:
  106. // CHECK:STDOUT: imports {
  107. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  108. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  109. // CHECK:STDOUT: import Core//prelude
  110. // CHECK:STDOUT: import Core//prelude/...
  111. // CHECK:STDOUT: }
  112. // CHECK:STDOUT: }
  113. // CHECK:STDOUT:
  114. // CHECK:STDOUT: file {
  115. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  116. // CHECK:STDOUT: .Core = imports.%Core
  117. // CHECK:STDOUT: .J = %J.decl
  118. // CHECK:STDOUT: .C = %C.decl
  119. // CHECK:STDOUT: }
  120. // CHECK:STDOUT: %Core.import = import Core
  121. // CHECK:STDOUT: %J.decl: type = interface_decl @J [template = constants.%J.type] {} {}
  122. // CHECK:STDOUT: impl_decl @impl.1 [template] {} {
  123. // CHECK:STDOUT: %.loc22_7.1: %empty_tuple.type = tuple_literal ()
  124. // CHECK:STDOUT: %.loc22_7.2: type = converted %.loc22_7.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type]
  125. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%J.type]
  126. // CHECK:STDOUT: %.Self: %J.type = bind_symbolic_name .Self [symbolic = constants.%.Self]
  127. // CHECK:STDOUT: %.Self.ref: %J.type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  128. // CHECK:STDOUT: %U.ref: %J.assoc_type = name_ref U, @U.%assoc0 [template = constants.%assoc0.1e6]
  129. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic = constants.%.Self.as_type]
  130. // CHECK:STDOUT: %.loc22_20: type = converted %.Self.ref, %.Self.as_type [symbolic = constants.%.Self.as_type]
  131. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.ref [symbolic = constants.%.Self.as_wit]
  132. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic = constants.%impl.elem0]
  133. // CHECK:STDOUT: %.loc22_26.1: %empty_struct_type = struct_literal ()
  134. // CHECK:STDOUT: %.loc22_26.2: type = converted %.loc22_26.1, constants.%empty_struct_type [template = constants.%empty_struct_type]
  135. // CHECK:STDOUT: %.loc22_14: type = where_expr %.Self [template = constants.%J_where.type.800] {
  136. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc22_26.2
  137. // CHECK:STDOUT: }
  138. // CHECK:STDOUT: }
  139. // CHECK:STDOUT: %impl_witness.loc22: <witness> = impl_witness (constants.%empty_struct_type, <error>) [template = constants.%impl_witness.f71]
  140. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  141. // CHECK:STDOUT: impl_decl @impl.2 [template] {} {
  142. // CHECK:STDOUT: %C.ref.loc31_6: type = name_ref C, file.%C.decl [template = constants.%C]
  143. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%J.type]
  144. // CHECK:STDOUT: %.Self: %J.type = bind_symbolic_name .Self [symbolic = constants.%.Self]
  145. // CHECK:STDOUT: %.Self.ref: %J.type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  146. // CHECK:STDOUT: %U.ref: %J.assoc_type = name_ref U, @U.%assoc0 [template = constants.%assoc0.1e6]
  147. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic = constants.%.Self.as_type]
  148. // CHECK:STDOUT: %.loc31_19: type = converted %.Self.ref, %.Self.as_type [symbolic = constants.%.Self.as_type]
  149. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.ref [symbolic = constants.%.Self.as_wit]
  150. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic = constants.%impl.elem0]
  151. // CHECK:STDOUT: %C.ref.loc31_24: type = name_ref C, file.%C.decl [template = constants.%C]
  152. // CHECK:STDOUT: %.loc31_13: type = where_expr %.Self [template = constants.%J_where.type.2f6] {
  153. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %C.ref.loc31_24
  154. // CHECK:STDOUT: }
  155. // CHECK:STDOUT: }
  156. // CHECK:STDOUT: %impl_witness.loc31: <witness> = impl_witness (constants.%C, <error>) [template = constants.%impl_witness.c2b]
  157. // CHECK:STDOUT: }
  158. // CHECK:STDOUT:
  159. // CHECK:STDOUT: interface @J {
  160. // CHECK:STDOUT: %Self: %J.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.ccd]
  161. // CHECK:STDOUT: %U: type = assoc_const_decl @U [template] {
  162. // CHECK:STDOUT: %assoc0: %J.assoc_type = assoc_entity element0, @J.%U [template = constants.%assoc0.1e6]
  163. // CHECK:STDOUT: }
  164. // CHECK:STDOUT: %F.decl: %F.type.c14 = fn_decl @F.1 [template = constants.%F.b71] {
  165. // CHECK:STDOUT: %self.patt: @F.1.%Self.as_type.loc19_14.1 (%Self.as_type.3df) = binding_pattern self
  166. // CHECK:STDOUT: %self.param_patt: @F.1.%Self.as_type.loc19_14.1 (%Self.as_type.3df) = value_param_pattern %self.patt, runtime_param0
  167. // CHECK:STDOUT: %u.patt: <error> = binding_pattern u
  168. // CHECK:STDOUT: %u.param_patt: <error> = value_param_pattern %u.patt, runtime_param1
  169. // CHECK:STDOUT: %return.patt: <error> = return_slot_pattern
  170. // CHECK:STDOUT: %return.param_patt: <error> = out_param_pattern %return.patt, runtime_param2
  171. // CHECK:STDOUT: } {
  172. // CHECK:STDOUT: %U.ref.loc19_29: %J.assoc_type = name_ref U, @U.%assoc0 [template = constants.%assoc0.1e6]
  173. // CHECK:STDOUT: %.loc19_29: type = converted %U.ref.loc19_29, <error> [template = <error>]
  174. // CHECK:STDOUT: %self.param: @F.1.%Self.as_type.loc19_14.1 (%Self.as_type.3df) = value_param runtime_param0
  175. // CHECK:STDOUT: %.loc19_14.1: type = splice_block %.loc19_14.2 [symbolic = %Self.as_type.loc19_14.1 (constants.%Self.as_type.3df)] {
  176. // CHECK:STDOUT: %Self.ref: %J.type = name_ref Self, @J.%Self [symbolic = %Self (constants.%Self.ccd)]
  177. // CHECK:STDOUT: %Self.as_type.loc19_14.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc19_14.1 (constants.%Self.as_type.3df)]
  178. // CHECK:STDOUT: %.loc19_14.2: type = converted %Self.ref, %Self.as_type.loc19_14.2 [symbolic = %Self.as_type.loc19_14.1 (constants.%Self.as_type.3df)]
  179. // CHECK:STDOUT: }
  180. // CHECK:STDOUT: %self: @F.1.%Self.as_type.loc19_14.1 (%Self.as_type.3df) = bind_name self, %self.param
  181. // CHECK:STDOUT: %u.param: <error> = value_param runtime_param1
  182. // CHECK:STDOUT: %.1: <error> = splice_block <error> [template = <error>] {
  183. // CHECK:STDOUT: %U.ref.loc19_23: %J.assoc_type = name_ref U, @U.%assoc0 [template = constants.%assoc0.1e6]
  184. // CHECK:STDOUT: %.loc19_23: type = converted %U.ref.loc19_23, <error> [template = <error>]
  185. // CHECK:STDOUT: }
  186. // CHECK:STDOUT: %u: <error> = bind_name u, %u.param
  187. // CHECK:STDOUT: %return.param: ref <error> = out_param runtime_param2
  188. // CHECK:STDOUT: %return: ref <error> = return_slot %return.param
  189. // CHECK:STDOUT: }
  190. // CHECK:STDOUT: %assoc1: %J.assoc_type = assoc_entity element1, %F.decl [template = constants.%assoc1]
  191. // CHECK:STDOUT:
  192. // CHECK:STDOUT: !members:
  193. // CHECK:STDOUT: .Self = %Self
  194. // CHECK:STDOUT: .U = @U.%assoc0
  195. // CHECK:STDOUT: .F = %assoc1
  196. // CHECK:STDOUT: witness = (%U, %F.decl)
  197. // CHECK:STDOUT: }
  198. // CHECK:STDOUT:
  199. // CHECK:STDOUT: generic assoc_const @U(@J.%Self: %J.type) {
  200. // CHECK:STDOUT: assoc_const U:! type;
  201. // CHECK:STDOUT: }
  202. // CHECK:STDOUT:
  203. // CHECK:STDOUT: impl @impl.1: %.loc22_7.2 as %.loc22_14 {
  204. // CHECK:STDOUT: %F.decl: %F.type.159 = fn_decl @F.2 [template = constants.%F.59d] {
  205. // CHECK:STDOUT: %self.patt: %empty_tuple.type = binding_pattern self
  206. // CHECK:STDOUT: %self.param_patt: %empty_tuple.type = value_param_pattern %self.patt, runtime_param0
  207. // CHECK:STDOUT: %u.patt: %empty_struct_type = binding_pattern u
  208. // CHECK:STDOUT: %u.param_patt: %empty_struct_type = value_param_pattern %u.patt, runtime_param1
  209. // CHECK:STDOUT: %return.patt: %empty_struct_type = return_slot_pattern
  210. // CHECK:STDOUT: %return.param_patt: %empty_struct_type = out_param_pattern %return.patt, runtime_param2
  211. // CHECK:STDOUT: } {
  212. // CHECK:STDOUT: %.loc23_31.1: %empty_struct_type = struct_literal ()
  213. // CHECK:STDOUT: %.loc23_31.2: type = converted %.loc23_31.1, constants.%empty_struct_type [template = constants.%empty_struct_type]
  214. // CHECK:STDOUT: %self.param: %empty_tuple.type = value_param runtime_param0
  215. // CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.1.%.loc22_7.2 [template = constants.%empty_tuple.type]
  216. // CHECK:STDOUT: %self: %empty_tuple.type = bind_name self, %self.param
  217. // CHECK:STDOUT: %u.param: %empty_struct_type = value_param runtime_param1
  218. // CHECK:STDOUT: %.loc23_24.1: type = splice_block %.loc23_24.3 [template = constants.%empty_struct_type] {
  219. // CHECK:STDOUT: %.loc23_24.2: %empty_struct_type = struct_literal ()
  220. // CHECK:STDOUT: %.loc23_24.3: type = converted %.loc23_24.2, constants.%empty_struct_type [template = constants.%empty_struct_type]
  221. // CHECK:STDOUT: }
  222. // CHECK:STDOUT: %u: %empty_struct_type = bind_name u, %u.param
  223. // CHECK:STDOUT: %return.param: ref %empty_struct_type = out_param runtime_param2
  224. // CHECK:STDOUT: %return: ref %empty_struct_type = return_slot %return.param
  225. // CHECK:STDOUT: }
  226. // CHECK:STDOUT:
  227. // CHECK:STDOUT: !members:
  228. // CHECK:STDOUT: .F = %F.decl
  229. // CHECK:STDOUT: witness = file.%impl_witness.loc22
  230. // CHECK:STDOUT: }
  231. // CHECK:STDOUT:
  232. // CHECK:STDOUT: impl @impl.2: %C.ref.loc31_6 as %.loc31_13 {
  233. // CHECK:STDOUT: %F.decl: %F.type.01a = fn_decl @F.3 [template = constants.%F.686] {
  234. // CHECK:STDOUT: %self.patt: %C = binding_pattern self
  235. // CHECK:STDOUT: %self.param_patt: %C = value_param_pattern %self.patt, runtime_param0
  236. // CHECK:STDOUT: %u.patt: %C = binding_pattern u
  237. // CHECK:STDOUT: %u.param_patt: %C = value_param_pattern %u.patt, runtime_param1
  238. // CHECK:STDOUT: %return.patt: %C = return_slot_pattern
  239. // CHECK:STDOUT: %return.param_patt: %C = out_param_pattern %return.patt, runtime_param2
  240. // CHECK:STDOUT: } {
  241. // CHECK:STDOUT: %C.ref.loc32_29: type = name_ref C, file.%C.decl [template = constants.%C]
  242. // CHECK:STDOUT: %self.param: %C = value_param runtime_param0
  243. // CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.2.%C.ref.loc31_6 [template = constants.%C]
  244. // CHECK:STDOUT: %self: %C = bind_name self, %self.param
  245. // CHECK:STDOUT: %u.param: %C = value_param runtime_param1
  246. // CHECK:STDOUT: %C.ref.loc32_23: type = name_ref C, file.%C.decl [template = constants.%C]
  247. // CHECK:STDOUT: %u: %C = bind_name u, %u.param
  248. // CHECK:STDOUT: %return.param: ref %C = out_param runtime_param2
  249. // CHECK:STDOUT: %return: ref %C = return_slot %return.param
  250. // CHECK:STDOUT: }
  251. // CHECK:STDOUT:
  252. // CHECK:STDOUT: !members:
  253. // CHECK:STDOUT: .F = %F.decl
  254. // CHECK:STDOUT: witness = file.%impl_witness.loc31
  255. // CHECK:STDOUT: }
  256. // CHECK:STDOUT:
  257. // CHECK:STDOUT: class @C {
  258. // CHECK:STDOUT: %.loc28_10: %empty_struct_type = struct_literal ()
  259. // CHECK:STDOUT: %.loc28_11: type = converted %.loc28_10, constants.%empty_struct_type [template = constants.%empty_struct_type]
  260. // CHECK:STDOUT: adapt_decl %.loc28_11 [template]
  261. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  262. // CHECK:STDOUT: complete_type_witness = %complete_type
  263. // CHECK:STDOUT:
  264. // CHECK:STDOUT: !members:
  265. // CHECK:STDOUT: .Self = constants.%C
  266. // CHECK:STDOUT: }
  267. // CHECK:STDOUT:
  268. // CHECK:STDOUT: generic fn @F.1(@J.%Self: %J.type) {
  269. // CHECK:STDOUT: %Self: %J.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.ccd)]
  270. // CHECK:STDOUT: %Self.as_type.loc19_14.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc19_14.1 (constants.%Self.as_type.3df)]
  271. // CHECK:STDOUT:
  272. // CHECK:STDOUT: fn[%self.param_patt: @F.1.%Self.as_type.loc19_14.1 (%Self.as_type.3df)](%u.param_patt: <error>) -> <error>;
  273. // CHECK:STDOUT: }
  274. // CHECK:STDOUT:
  275. // CHECK:STDOUT: fn @F.2[%self.param_patt: %empty_tuple.type](%u.param_patt: %empty_struct_type) -> %empty_struct_type {
  276. // CHECK:STDOUT: !entry:
  277. // CHECK:STDOUT: %u.ref: %empty_struct_type = name_ref u, %u
  278. // CHECK:STDOUT: return %u.ref
  279. // CHECK:STDOUT: }
  280. // CHECK:STDOUT:
  281. // CHECK:STDOUT: fn @F.3[%self.param_patt: %C](%u.param_patt: %C) -> %C {
  282. // CHECK:STDOUT: !entry:
  283. // CHECK:STDOUT: %self.ref: %C = name_ref self, %self
  284. // CHECK:STDOUT: return %self.ref
  285. // CHECK:STDOUT: }
  286. // CHECK:STDOUT:
  287. // CHECK:STDOUT: specific @U(constants.%Self.ccd) {}
  288. // CHECK:STDOUT:
  289. // CHECK:STDOUT: specific @F.1(constants.%Self.ccd) {
  290. // CHECK:STDOUT: %Self => constants.%Self.ccd
  291. // CHECK:STDOUT: %Self.as_type.loc19_14.1 => constants.%Self.as_type.3df
  292. // CHECK:STDOUT: }
  293. // CHECK:STDOUT:
  294. // CHECK:STDOUT: specific @U(constants.%J.facet.ad0) {}
  295. // CHECK:STDOUT:
  296. // CHECK:STDOUT: specific @F.1(constants.%J.facet.550) {
  297. // CHECK:STDOUT: %Self => constants.%J.facet.550
  298. // CHECK:STDOUT: %Self.as_type.loc19_14.1 => constants.%empty_tuple.type
  299. // CHECK:STDOUT: }
  300. // CHECK:STDOUT:
  301. // CHECK:STDOUT: specific @F.1(constants.%J.facet.38d) {
  302. // CHECK:STDOUT: %Self => constants.%J.facet.38d
  303. // CHECK:STDOUT: %Self.as_type.loc19_14.1 => constants.%C
  304. // CHECK:STDOUT: }
  305. // CHECK:STDOUT:
  306. // CHECK:STDOUT: --- fail_todo_use_non-type_in_function.carbon
  307. // CHECK:STDOUT:
  308. // CHECK:STDOUT: constants {
  309. // CHECK:STDOUT: %M.type: type = facet_type <@M> [template]
  310. // CHECK:STDOUT: %Self.bcc: %M.type = bind_symbolic_name Self, 0 [symbolic]
  311. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  312. // CHECK:STDOUT: %struct_type.b.347: type = struct_type {.b: %empty_struct_type} [template]
  313. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  314. // CHECK:STDOUT: %M.assoc_type: type = assoc_entity_type %M.type [template]
  315. // CHECK:STDOUT: %assoc0.e3d: %M.assoc_type = assoc_entity element0, @M.%Z [template]
  316. // CHECK:STDOUT: %G.type.020: type = fn_type @G.1 [template]
  317. // CHECK:STDOUT: %G.91c: %G.type.020 = struct_value () [template]
  318. // CHECK:STDOUT: %assoc1: %M.assoc_type = assoc_entity element1, @M.%G.decl [template]
  319. // CHECK:STDOUT: %.Self: %M.type = bind_symbolic_name .Self [symbolic]
  320. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic]
  321. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self [symbolic]
  322. // CHECK:STDOUT: %M.facet.ba5: %M.type = facet_value %.Self.as_type, %.Self.as_wit [symbolic]
  323. // CHECK:STDOUT: %impl.elem0: %struct_type.b.347 = impl_witness_access %.Self.as_wit, element0 [symbolic]
  324. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [template]
  325. // CHECK:STDOUT: %struct: %struct_type.b.347 = struct_value (%empty_struct) [template]
  326. // CHECK:STDOUT: %M_where.type: type = facet_type <@M where %impl.elem0 = %struct> [template]
  327. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (%struct, @impl.%G.decl) [template]
  328. // CHECK:STDOUT: %G.type.aa2: type = fn_type @G.2 [template]
  329. // CHECK:STDOUT: %G.816: %G.type.aa2 = struct_value () [template]
  330. // CHECK:STDOUT: %M.facet.940: %M.type = facet_value %empty_tuple.type, %impl_witness [template]
  331. // CHECK:STDOUT: }
  332. // CHECK:STDOUT:
  333. // CHECK:STDOUT: imports {
  334. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  335. // CHECK:STDOUT: .As = %Core.As
  336. // CHECK:STDOUT: import Core//prelude
  337. // CHECK:STDOUT: import Core//prelude/...
  338. // CHECK:STDOUT: }
  339. // CHECK:STDOUT: }
  340. // CHECK:STDOUT:
  341. // CHECK:STDOUT: file {
  342. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  343. // CHECK:STDOUT: .Core = imports.%Core
  344. // CHECK:STDOUT: .M = %M.decl
  345. // CHECK:STDOUT: }
  346. // CHECK:STDOUT: %Core.import = import Core
  347. // CHECK:STDOUT: %M.decl: type = interface_decl @M [template = constants.%M.type] {} {}
  348. // CHECK:STDOUT: impl_decl @impl [template] {} {
  349. // CHECK:STDOUT: %.loc8_7.1: %empty_tuple.type = tuple_literal ()
  350. // CHECK:STDOUT: %.loc8_7.2: type = converted %.loc8_7.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type]
  351. // CHECK:STDOUT: %M.ref: type = name_ref M, file.%M.decl [template = constants.%M.type]
  352. // CHECK:STDOUT: %.Self: %M.type = bind_symbolic_name .Self [symbolic = constants.%.Self]
  353. // CHECK:STDOUT: %.Self.ref: %M.type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  354. // CHECK:STDOUT: %Z.ref: %M.assoc_type = name_ref Z, @Z.%assoc0 [template = constants.%assoc0.e3d]
  355. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic = constants.%.Self.as_type]
  356. // CHECK:STDOUT: %.loc8_20: type = converted %.Self.ref, %.Self.as_type [symbolic = constants.%.Self.as_type]
  357. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.ref [symbolic = constants.%.Self.as_wit]
  358. // CHECK:STDOUT: %impl.elem0: %struct_type.b.347 = impl_witness_access %.Self.as_wit, element0 [symbolic = constants.%impl.elem0]
  359. // CHECK:STDOUT: %.loc8_32: %empty_struct_type = struct_literal ()
  360. // CHECK:STDOUT: %.loc8_33.1: %struct_type.b.347 = struct_literal (%.loc8_32)
  361. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [template = constants.%empty_struct]
  362. // CHECK:STDOUT: %.loc8_33.2: %empty_struct_type = converted %.loc8_32, %empty_struct [template = constants.%empty_struct]
  363. // CHECK:STDOUT: %struct: %struct_type.b.347 = struct_value (%.loc8_33.2) [template = constants.%struct]
  364. // CHECK:STDOUT: %.loc8_33.3: %struct_type.b.347 = converted %.loc8_33.1, %struct [template = constants.%struct]
  365. // CHECK:STDOUT: %.loc8_14: type = where_expr %.Self [template = constants.%M_where.type] {
  366. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc8_33.3
  367. // CHECK:STDOUT: }
  368. // CHECK:STDOUT: }
  369. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (constants.%struct, @impl.%G.decl) [template = constants.%impl_witness]
  370. // CHECK:STDOUT: }
  371. // CHECK:STDOUT:
  372. // CHECK:STDOUT: interface @M {
  373. // CHECK:STDOUT: %Self: %M.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.bcc]
  374. // CHECK:STDOUT: %Z: %struct_type.b.347 = assoc_const_decl @Z [template] {
  375. // CHECK:STDOUT: %assoc0: %M.assoc_type = assoc_entity element0, @M.%Z [template = constants.%assoc0.e3d]
  376. // CHECK:STDOUT: }
  377. // CHECK:STDOUT: %G.decl: %G.type.020 = fn_decl @G.1 [template = constants.%G.91c] {
  378. // CHECK:STDOUT: %return.patt: %empty_struct_type = return_slot_pattern
  379. // CHECK:STDOUT: %return.param_patt: %empty_struct_type = out_param_pattern %return.patt, runtime_param0
  380. // CHECK:STDOUT: } {
  381. // CHECK:STDOUT: %.loc5_14.1: %empty_struct_type = struct_literal ()
  382. // CHECK:STDOUT: %.loc5_14.2: type = converted %.loc5_14.1, constants.%empty_struct_type [template = constants.%empty_struct_type]
  383. // CHECK:STDOUT: %return.param: ref %empty_struct_type = out_param runtime_param0
  384. // CHECK:STDOUT: %return: ref %empty_struct_type = return_slot %return.param
  385. // CHECK:STDOUT: }
  386. // CHECK:STDOUT: %assoc1: %M.assoc_type = assoc_entity element1, %G.decl [template = constants.%assoc1]
  387. // CHECK:STDOUT:
  388. // CHECK:STDOUT: !members:
  389. // CHECK:STDOUT: .Self = %Self
  390. // CHECK:STDOUT: .Z = @Z.%assoc0
  391. // CHECK:STDOUT: .G = %assoc1
  392. // CHECK:STDOUT: witness = (%Z, %G.decl)
  393. // CHECK:STDOUT: }
  394. // CHECK:STDOUT:
  395. // CHECK:STDOUT: generic assoc_const @Z(@M.%Self: %M.type) {
  396. // CHECK:STDOUT: assoc_const Z:! %struct_type.b.347;
  397. // CHECK:STDOUT: }
  398. // CHECK:STDOUT:
  399. // CHECK:STDOUT: impl @impl: %.loc8_7.2 as %.loc8_14 {
  400. // CHECK:STDOUT: %G.decl: %G.type.aa2 = fn_decl @G.2 [template = constants.%G.816] {
  401. // CHECK:STDOUT: %return.patt: %empty_struct_type = return_slot_pattern
  402. // CHECK:STDOUT: %return.param_patt: %empty_struct_type = out_param_pattern %return.patt, runtime_param0
  403. // CHECK:STDOUT: } {
  404. // CHECK:STDOUT: %.loc9_14.1: %empty_struct_type = struct_literal ()
  405. // CHECK:STDOUT: %.loc9_14.2: type = converted %.loc9_14.1, constants.%empty_struct_type [template = constants.%empty_struct_type]
  406. // CHECK:STDOUT: %return.param: ref %empty_struct_type = out_param runtime_param0
  407. // CHECK:STDOUT: %return: ref %empty_struct_type = return_slot %return.param
  408. // CHECK:STDOUT: }
  409. // CHECK:STDOUT:
  410. // CHECK:STDOUT: !members:
  411. // CHECK:STDOUT: .G = %G.decl
  412. // CHECK:STDOUT: witness = file.%impl_witness
  413. // CHECK:STDOUT: }
  414. // CHECK:STDOUT:
  415. // CHECK:STDOUT: generic fn @G.1(@M.%Self: %M.type) {
  416. // CHECK:STDOUT: fn() -> %empty_struct_type;
  417. // CHECK:STDOUT: }
  418. // CHECK:STDOUT:
  419. // CHECK:STDOUT: fn @G.2() -> %empty_struct_type {
  420. // CHECK:STDOUT: !entry:
  421. // CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.%.loc8_7.2 [template = constants.%empty_tuple.type]
  422. // CHECK:STDOUT: %M.ref: type = name_ref M, file.%M.decl [template = constants.%M.type]
  423. // CHECK:STDOUT: %.loc17: %M.type = converted %Self.ref, <error> [template = <error>]
  424. // CHECK:STDOUT: %Z.ref: <error> = name_ref Z, <error> [template = <error>]
  425. // CHECK:STDOUT: %b.ref: <error> = name_ref b, <error> [template = <error>]
  426. // CHECK:STDOUT: return <error>
  427. // CHECK:STDOUT: }
  428. // CHECK:STDOUT:
  429. // CHECK:STDOUT: specific @Z(constants.%Self.bcc) {}
  430. // CHECK:STDOUT:
  431. // CHECK:STDOUT: specific @G.1(constants.%Self.bcc) {}
  432. // CHECK:STDOUT:
  433. // CHECK:STDOUT: specific @Z(constants.%M.facet.ba5) {}
  434. // CHECK:STDOUT:
  435. // CHECK:STDOUT: specific @G.1(constants.%M.facet.940) {}
  436. // CHECK:STDOUT:
  437. // CHECK:STDOUT: --- fail_todo_associated_int_in_array.carbon
  438. // CHECK:STDOUT:
  439. // CHECK:STDOUT: constants {
  440. // CHECK:STDOUT: %I.type: type = facet_type <@I> [template]
  441. // CHECK:STDOUT: %Self.826: %I.type = bind_symbolic_name Self, 0 [symbolic]
  442. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
  443. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  444. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
  445. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type %I.type [template]
  446. // CHECK:STDOUT: %assoc0.73c: %I.assoc_type = assoc_entity element0, @I.%N [template]
  447. // CHECK:STDOUT: %Self.as_type.b70: type = facet_access_type %Self.826 [symbolic]
  448. // CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template]
  449. // CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template]
  450. // CHECK:STDOUT: %F.type.cf0: type = fn_type @F.1 [template]
  451. // CHECK:STDOUT: %F.bc6: %F.type.cf0 = struct_value () [template]
  452. // CHECK:STDOUT: %assoc1: %I.assoc_type = assoc_entity element1, @I.%F.decl [template]
  453. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic]
  454. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic]
  455. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self [symbolic]
  456. // CHECK:STDOUT: %I.facet.1f7: %I.type = facet_value %.Self.as_type, %.Self.as_wit [symbolic]
  457. // CHECK:STDOUT: %impl.elem0: %i32 = impl_witness_access %.Self.as_wit, element0 [symbolic]
  458. // CHECK:STDOUT: %int_2.ecc: Core.IntLiteral = int_value 2 [template]
  459. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [template]
  460. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [template]
  461. // CHECK:STDOUT: %impl_witness.d39: <witness> = impl_witness (imports.%Core.import_ref.a5b), @impl.1(%int_32) [template]
  462. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.1(%int_32) [template]
  463. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [template]
  464. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, %impl_witness.d39 [template]
  465. // CHECK:STDOUT: %.a0b: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [template]
  466. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_2.ecc, %Convert.956 [template]
  467. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.bound, @Convert.2(%int_32) [template]
  468. // CHECK:STDOUT: %int_2.ef8: %i32 = int_value 2 [template]
  469. // CHECK:STDOUT: %I_where.type: type = facet_type <@I where %impl.elem0 = %int_2.ef8> [template]
  470. // CHECK:STDOUT: %impl_witness.2c9: <witness> = impl_witness (%int_2.ef8, <error>) [template]
  471. // CHECK:STDOUT: %array_type: type = array_type %int_2.ecc, bool [template]
  472. // CHECK:STDOUT: %F.type.9f6: type = fn_type @F.2 [template]
  473. // CHECK:STDOUT: %F.572: %F.type.9f6 = struct_value () [template]
  474. // CHECK:STDOUT: %I.facet.7b2: %I.type = facet_value %empty_tuple.type, %impl_witness.2c9 [template]
  475. // CHECK:STDOUT: %true: bool = bool_literal true [template]
  476. // CHECK:STDOUT: %false: bool = bool_literal false [template]
  477. // CHECK:STDOUT: %tuple.type: type = tuple_type (bool, bool) [template]
  478. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template]
  479. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template]
  480. // CHECK:STDOUT: %array: %array_type = tuple_value (%true, %false) [template]
  481. // CHECK:STDOUT: }
  482. // CHECK:STDOUT:
  483. // CHECK:STDOUT: imports {
  484. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  485. // CHECK:STDOUT: .Int = %Core.Int
  486. // CHECK:STDOUT: .Bool = %Core.Bool
  487. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  488. // CHECK:STDOUT: import Core//prelude
  489. // CHECK:STDOUT: import Core//prelude/...
  490. // CHECK:STDOUT: }
  491. // CHECK:STDOUT: }
  492. // CHECK:STDOUT:
  493. // CHECK:STDOUT: file {
  494. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  495. // CHECK:STDOUT: .Core = imports.%Core
  496. // CHECK:STDOUT: .I = %I.decl
  497. // CHECK:STDOUT: }
  498. // CHECK:STDOUT: %Core.import = import Core
  499. // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%I.type] {} {}
  500. // CHECK:STDOUT: impl_decl @impl.44 [template] {} {
  501. // CHECK:STDOUT: %.loc15_7.1: %empty_tuple.type = tuple_literal ()
  502. // CHECK:STDOUT: %.loc15_7.2: type = converted %.loc15_7.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type]
  503. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%I.type]
  504. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic = constants.%.Self]
  505. // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  506. // CHECK:STDOUT: %N.ref: %I.assoc_type = name_ref N, @N.%assoc0 [template = constants.%assoc0.73c]
  507. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic = constants.%.Self.as_type]
  508. // CHECK:STDOUT: %.loc15_20: type = converted %.Self.ref, %.Self.as_type [symbolic = constants.%.Self.as_type]
  509. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.ref [symbolic = constants.%.Self.as_wit]
  510. // CHECK:STDOUT: %impl.elem0.loc15_20: %i32 = impl_witness_access %.Self.as_wit, element0 [symbolic = constants.%impl.elem0]
  511. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.ecc]
  512. // CHECK:STDOUT: %impl.elem0.loc15_25: %.a0b = impl_witness_access constants.%impl_witness.d39, element0 [template = constants.%Convert.956]
  513. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_2, %impl.elem0.loc15_25 [template = constants.%Convert.bound]
  514. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %bound_method, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn]
  515. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %specific_fn(%int_2) [template = constants.%int_2.ef8]
  516. // CHECK:STDOUT: %.loc15_25.1: %i32 = value_of_initializer %int.convert_checked [template = constants.%int_2.ef8]
  517. // CHECK:STDOUT: %.loc15_25.2: %i32 = converted %int_2, %.loc15_25.1 [template = constants.%int_2.ef8]
  518. // CHECK:STDOUT: %.loc15_14: type = where_expr %.Self [template = constants.%I_where.type] {
  519. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc15_20, %.loc15_25.2
  520. // CHECK:STDOUT: }
  521. // CHECK:STDOUT: }
  522. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (constants.%int_2.ef8, <error>) [template = constants.%impl_witness.2c9]
  523. // CHECK:STDOUT: }
  524. // CHECK:STDOUT:
  525. // CHECK:STDOUT: interface @I {
  526. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.826]
  527. // CHECK:STDOUT: %N: %i32 = assoc_const_decl @N [template] {
  528. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%N [template = constants.%assoc0.73c]
  529. // CHECK:STDOUT: }
  530. // CHECK:STDOUT: %F.decl: %F.type.cf0 = fn_decl @F.1 [template = constants.%F.bc6] {
  531. // CHECK:STDOUT: %self.patt: @F.1.%Self.as_type.loc12_14.1 (%Self.as_type.b70) = binding_pattern self
  532. // CHECK:STDOUT: %self.param_patt: @F.1.%Self.as_type.loc12_14.1 (%Self.as_type.b70) = value_param_pattern %self.patt, runtime_param0
  533. // CHECK:STDOUT: %return.patt: <error> = return_slot_pattern
  534. // CHECK:STDOUT: %return.param_patt: <error> = out_param_pattern %return.patt, runtime_param1
  535. // CHECK:STDOUT: } {
  536. // CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool]
  537. // CHECK:STDOUT: %N.ref: %I.assoc_type = name_ref N, @N.%assoc0 [template = constants.%assoc0.73c]
  538. // CHECK:STDOUT: %.loc12_26.1: type = value_of_initializer %bool.make_type [template = bool]
  539. // CHECK:STDOUT: %.loc12_26.2: type = converted %bool.make_type, %.loc12_26.1 [template = bool]
  540. // CHECK:STDOUT: %.loc12_32: Core.IntLiteral = converted %N.ref, <error> [template = <error>]
  541. // CHECK:STDOUT: %array_type: type = array_type <error>, bool [template = <error>]
  542. // CHECK:STDOUT: %self.param: @F.1.%Self.as_type.loc12_14.1 (%Self.as_type.b70) = value_param runtime_param0
  543. // CHECK:STDOUT: %.loc12_14.1: type = splice_block %.loc12_14.2 [symbolic = %Self.as_type.loc12_14.1 (constants.%Self.as_type.b70)] {
  544. // CHECK:STDOUT: %Self.ref: %I.type = name_ref Self, @I.%Self [symbolic = %Self (constants.%Self.826)]
  545. // CHECK:STDOUT: %Self.as_type.loc12_14.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc12_14.1 (constants.%Self.as_type.b70)]
  546. // CHECK:STDOUT: %.loc12_14.2: type = converted %Self.ref, %Self.as_type.loc12_14.2 [symbolic = %Self.as_type.loc12_14.1 (constants.%Self.as_type.b70)]
  547. // CHECK:STDOUT: }
  548. // CHECK:STDOUT: %self: @F.1.%Self.as_type.loc12_14.1 (%Self.as_type.b70) = bind_name self, %self.param
  549. // CHECK:STDOUT: %return.param: ref <error> = out_param runtime_param1
  550. // CHECK:STDOUT: %return: ref <error> = return_slot %return.param
  551. // CHECK:STDOUT: }
  552. // CHECK:STDOUT: %assoc1: %I.assoc_type = assoc_entity element1, %F.decl [template = constants.%assoc1]
  553. // CHECK:STDOUT:
  554. // CHECK:STDOUT: !members:
  555. // CHECK:STDOUT: .Self = %Self
  556. // CHECK:STDOUT: .N = @N.%assoc0
  557. // CHECK:STDOUT: .F = %assoc1
  558. // CHECK:STDOUT: witness = (%N, %F.decl)
  559. // CHECK:STDOUT: }
  560. // CHECK:STDOUT:
  561. // CHECK:STDOUT: generic assoc_const @N(@I.%Self: %I.type) {
  562. // CHECK:STDOUT: assoc_const N:! %i32;
  563. // CHECK:STDOUT: }
  564. // CHECK:STDOUT:
  565. // CHECK:STDOUT: impl @impl.44: %.loc15_7.2 as %.loc15_14 {
  566. // CHECK:STDOUT: %F.decl: %F.type.9f6 = fn_decl @F.2 [template = constants.%F.572] {
  567. // CHECK:STDOUT: %self.patt: %empty_tuple.type = binding_pattern self
  568. // CHECK:STDOUT: %self.param_patt: %empty_tuple.type = value_param_pattern %self.patt, runtime_param0
  569. // CHECK:STDOUT: %return.patt: %array_type = return_slot_pattern
  570. // CHECK:STDOUT: %return.param_patt: %array_type = out_param_pattern %return.patt, runtime_param1
  571. // CHECK:STDOUT: } {
  572. // CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool]
  573. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2.ecc]
  574. // CHECK:STDOUT: %.loc16_26.1: type = value_of_initializer %bool.make_type [template = bool]
  575. // CHECK:STDOUT: %.loc16_26.2: type = converted %bool.make_type, %.loc16_26.1 [template = bool]
  576. // CHECK:STDOUT: %array_type: type = array_type %int_2, bool [template = constants.%array_type]
  577. // CHECK:STDOUT: %self.param: %empty_tuple.type = value_param runtime_param0
  578. // CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.44.%.loc15_7.2 [template = constants.%empty_tuple.type]
  579. // CHECK:STDOUT: %self: %empty_tuple.type = bind_name self, %self.param
  580. // CHECK:STDOUT: %return.param: ref %array_type = out_param runtime_param1
  581. // CHECK:STDOUT: %return: ref %array_type = return_slot %return.param
  582. // CHECK:STDOUT: }
  583. // CHECK:STDOUT:
  584. // CHECK:STDOUT: !members:
  585. // CHECK:STDOUT: .F = %F.decl
  586. // CHECK:STDOUT: witness = file.%impl_witness
  587. // CHECK:STDOUT: }
  588. // CHECK:STDOUT:
  589. // CHECK:STDOUT: generic fn @F.1(@I.%Self: %I.type) {
  590. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.826)]
  591. // CHECK:STDOUT: %Self.as_type.loc12_14.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc12_14.1 (constants.%Self.as_type.b70)]
  592. // CHECK:STDOUT:
  593. // CHECK:STDOUT: fn[%self.param_patt: @F.1.%Self.as_type.loc12_14.1 (%Self.as_type.b70)]() -> <error>;
  594. // CHECK:STDOUT: }
  595. // CHECK:STDOUT:
  596. // CHECK:STDOUT: fn @F.2[%self.param_patt: %empty_tuple.type]() -> %return.param_patt: %array_type {
  597. // CHECK:STDOUT: !entry:
  598. // CHECK:STDOUT: %true: bool = bool_literal true [template = constants.%true]
  599. // CHECK:STDOUT: %false: bool = bool_literal false [template = constants.%false]
  600. // CHECK:STDOUT: %.loc16_56.1: %tuple.type = tuple_literal (%true, %false)
  601. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0]
  602. // CHECK:STDOUT: %.loc16_56.2: ref bool = array_index %return, %int_0
  603. // CHECK:STDOUT: %.loc16_56.3: init bool = initialize_from %true to %.loc16_56.2 [template = constants.%true]
  604. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1]
  605. // CHECK:STDOUT: %.loc16_56.4: ref bool = array_index %return, %int_1
  606. // CHECK:STDOUT: %.loc16_56.5: init bool = initialize_from %false to %.loc16_56.4 [template = constants.%false]
  607. // CHECK:STDOUT: %.loc16_56.6: init %array_type = array_init (%.loc16_56.3, %.loc16_56.5) to %return [template = constants.%array]
  608. // CHECK:STDOUT: %.loc16_57: init %array_type = converted %.loc16_56.1, %.loc16_56.6 [template = constants.%array]
  609. // CHECK:STDOUT: return %.loc16_57 to %return
  610. // CHECK:STDOUT: }
  611. // CHECK:STDOUT:
  612. // CHECK:STDOUT: specific @N(constants.%Self.826) {}
  613. // CHECK:STDOUT:
  614. // CHECK:STDOUT: specific @F.1(constants.%Self.826) {
  615. // CHECK:STDOUT: %Self => constants.%Self.826
  616. // CHECK:STDOUT: %Self.as_type.loc12_14.1 => constants.%Self.as_type.b70
  617. // CHECK:STDOUT: }
  618. // CHECK:STDOUT:
  619. // CHECK:STDOUT: specific @N(constants.%I.facet.1f7) {}
  620. // CHECK:STDOUT:
  621. // CHECK:STDOUT: specific @F.1(constants.%I.facet.7b2) {
  622. // CHECK:STDOUT: %Self => constants.%I.facet.7b2
  623. // CHECK:STDOUT: %Self.as_type.loc12_14.1 => constants.%empty_tuple.type
  624. // CHECK:STDOUT: }
  625. // CHECK:STDOUT: