init_dependent_bound.carbon 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  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/array/init_dependent_bound.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/init_dependent_bound.carbon
  10. // --- fail_init_dependent_bound.carbon
  11. library "[[@TEST_NAME]]";
  12. fn F(N:! i32) {
  13. // CHECK:STDERR: fail_init_dependent_bound.carbon:[[@LINE+4]]:28: error: cannot initialize array with dependent bound from a list of initializers [ArrayInitDependentBound]
  14. // CHECK:STDERR: var arr: array(i32, N) = (1, 2, 3);
  15. // CHECK:STDERR: ^~~~~~~~~
  16. // CHECK:STDERR:
  17. var arr: array(i32, N) = (1, 2, 3);
  18. }
  19. // --- fail_todo_init_template_dependent_bound.carbon
  20. library "[[@TEST_NAME]]";
  21. // TODO: This should be valid.
  22. fn G(template N:! i32) {
  23. // CHECK:STDERR: fail_todo_init_template_dependent_bound.carbon:[[@LINE+4]]:28: error: cannot initialize array with dependent bound from a list of initializers [ArrayInitDependentBound]
  24. // CHECK:STDERR: var arr: array(i32, N) = (1, 2, 3);
  25. // CHECK:STDERR: ^~~~~~~~~
  26. // CHECK:STDERR:
  27. var arr: array(i32, N) = (1, 2, 3);
  28. }
  29. fn H() { G(3); }
  30. // CHECK:STDOUT: --- fail_init_dependent_bound.carbon
  31. // CHECK:STDOUT:
  32. // CHECK:STDOUT: constants {
  33. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  34. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  35. // CHECK:STDOUT: %N.51e: %i32 = bind_symbolic_name N, 0 [symbolic]
  36. // CHECK:STDOUT: %N.patt.8e2: %i32 = symbolic_binding_pattern N, 0 [symbolic]
  37. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  38. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  39. // CHECK:STDOUT: %ImplicitAs.type.2fd: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [concrete]
  40. // CHECK:STDOUT: %Convert.type.71e: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [concrete]
  41. // CHECK:STDOUT: %impl_witness.023: <witness> = impl_witness (imports.%Core.import_ref.85c), @impl.971(%int_32) [concrete]
  42. // CHECK:STDOUT: %Convert.type.4ad: type = fn_type @Convert.3, @impl.971(%int_32) [concrete]
  43. // CHECK:STDOUT: %Convert.960: %Convert.type.4ad = struct_value () [concrete]
  44. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.2fd = facet_value %i32, %impl_witness.023 [concrete]
  45. // CHECK:STDOUT: %.10e: type = fn_type_with_self_type %Convert.type.71e, %ImplicitAs.facet [concrete]
  46. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %N.51e, %Convert.960 [symbolic]
  47. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.bound, @Convert.3(%int_32) [symbolic]
  48. // CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %Convert.specific_fn(%N.51e) [symbolic]
  49. // CHECK:STDOUT: %array_type: type = array_type %int.convert_checked, %i32 [symbolic]
  50. // CHECK:STDOUT: %require_complete.9dc: <witness> = require_complete_type %array_type [symbolic]
  51. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete]
  52. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete]
  53. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete]
  54. // CHECK:STDOUT: %tuple.type: type = tuple_type (Core.IntLiteral, Core.IntLiteral, Core.IntLiteral) [concrete]
  55. // CHECK:STDOUT: }
  56. // CHECK:STDOUT:
  57. // CHECK:STDOUT: imports {
  58. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  59. // CHECK:STDOUT: .Int = %Core.Int
  60. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  61. // CHECK:STDOUT: import Core//prelude
  62. // CHECK:STDOUT: import Core//prelude/...
  63. // CHECK:STDOUT: }
  64. // CHECK:STDOUT: }
  65. // CHECK:STDOUT:
  66. // CHECK:STDOUT: file {
  67. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  68. // CHECK:STDOUT: .Core = imports.%Core
  69. // CHECK:STDOUT: .F = %F.decl
  70. // CHECK:STDOUT: }
  71. // CHECK:STDOUT: %Core.import = import Core
  72. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  73. // CHECK:STDOUT: %N.patt.loc4_6.1: %i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc4_6.2 (constants.%N.patt.8e2)]
  74. // CHECK:STDOUT: %N.param_patt: %i32 = value_param_pattern %N.patt.loc4_6.1, runtime_param<none> [symbolic = %N.patt.loc4_6.2 (constants.%N.patt.8e2)]
  75. // CHECK:STDOUT: } {
  76. // CHECK:STDOUT: %N.param: %i32 = value_param runtime_param<none>
  77. // CHECK:STDOUT: %.loc4: type = splice_block %i32.loc4 [concrete = constants.%i32] {
  78. // CHECK:STDOUT: %int_32.loc4: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  79. // CHECK:STDOUT: %i32.loc4: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  80. // CHECK:STDOUT: }
  81. // CHECK:STDOUT: %N.loc4_6.1: %i32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc4_6.2 (constants.%N.51e)]
  82. // CHECK:STDOUT: }
  83. // CHECK:STDOUT: }
  84. // CHECK:STDOUT:
  85. // CHECK:STDOUT: generic fn @F(%N.loc4_6.1: %i32) {
  86. // CHECK:STDOUT: %N.loc4_6.2: %i32 = bind_symbolic_name N, 0 [symbolic = %N.loc4_6.2 (constants.%N.51e)]
  87. // CHECK:STDOUT: %N.patt.loc4_6.2: %i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc4_6.2 (constants.%N.patt.8e2)]
  88. // CHECK:STDOUT:
  89. // CHECK:STDOUT: !definition:
  90. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %N.loc4_6.2, constants.%Convert.960 [symbolic = %Convert.bound (constants.%Convert.bound)]
  91. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.bound, @Convert.3(constants.%int_32) [symbolic = %Convert.specific_fn (constants.%Convert.specific_fn)]
  92. // CHECK:STDOUT: %int.convert_checked.loc9_23.2: init Core.IntLiteral = call %Convert.specific_fn(%N.loc4_6.2) [symbolic = %int.convert_checked.loc9_23.2 (constants.%int.convert_checked)]
  93. // CHECK:STDOUT: %array_type.loc9_24.2: type = array_type %int.convert_checked.loc9_23.2, %i32 [symbolic = %array_type.loc9_24.2 (constants.%array_type)]
  94. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type @F.%array_type.loc9_24.2 (%array_type) [symbolic = %require_complete (constants.%require_complete.9dc)]
  95. // CHECK:STDOUT:
  96. // CHECK:STDOUT: fn(%N.param_patt: %i32) {
  97. // CHECK:STDOUT: !entry:
  98. // CHECK:STDOUT: name_binding_decl {
  99. // CHECK:STDOUT: %arr.patt: @F.%array_type.loc9_24.2 (%array_type) = binding_pattern arr
  100. // CHECK:STDOUT: %.loc9_3: @F.%array_type.loc9_24.2 (%array_type) = var_pattern %arr.patt
  101. // CHECK:STDOUT: }
  102. // CHECK:STDOUT: %arr.var: ref @F.%array_type.loc9_24.2 (%array_type) = var arr
  103. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
  104. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
  105. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3]
  106. // CHECK:STDOUT: %.loc9_36: %tuple.type = tuple_literal (%int_1, %int_2, %int_3)
  107. // CHECK:STDOUT: assign %arr.var, <error>
  108. // CHECK:STDOUT: %.loc9_24: type = splice_block %array_type.loc9_24.1 [symbolic = %array_type.loc9_24.2 (constants.%array_type)] {
  109. // CHECK:STDOUT: %int_32.loc9: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  110. // CHECK:STDOUT: %i32.loc9: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  111. // CHECK:STDOUT: %N.ref: %i32 = name_ref N, %N.loc4_6.1 [symbolic = %N.loc4_6.2 (constants.%N.51e)]
  112. // CHECK:STDOUT: %impl.elem0: %.10e = impl_witness_access constants.%impl_witness.023, element0 [concrete = constants.%Convert.960]
  113. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %N.ref, %impl.elem0 [symbolic = %Convert.bound (constants.%Convert.bound)]
  114. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %bound_method, @Convert.3(constants.%int_32) [symbolic = %Convert.specific_fn (constants.%Convert.specific_fn)]
  115. // CHECK:STDOUT: %int.convert_checked.loc9_23.1: init Core.IntLiteral = call %specific_fn(%N.ref) [symbolic = %int.convert_checked.loc9_23.2 (constants.%int.convert_checked)]
  116. // CHECK:STDOUT: %.loc9_23.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc9_23.1 [symbolic = %int.convert_checked.loc9_23.2 (constants.%int.convert_checked)]
  117. // CHECK:STDOUT: %.loc9_23.2: Core.IntLiteral = converted %N.ref, %.loc9_23.1 [symbolic = %int.convert_checked.loc9_23.2 (constants.%int.convert_checked)]
  118. // CHECK:STDOUT: %array_type.loc9_24.1: type = array_type %.loc9_23.2, %i32 [symbolic = %array_type.loc9_24.2 (constants.%array_type)]
  119. // CHECK:STDOUT: }
  120. // CHECK:STDOUT: %arr: ref @F.%array_type.loc9_24.2 (%array_type) = bind_name arr, %arr.var
  121. // CHECK:STDOUT: return
  122. // CHECK:STDOUT: }
  123. // CHECK:STDOUT: }
  124. // CHECK:STDOUT:
  125. // CHECK:STDOUT: specific @F(constants.%N.51e) {
  126. // CHECK:STDOUT: %N.loc4_6.2 => constants.%N.51e
  127. // CHECK:STDOUT: %N.patt.loc4_6.2 => constants.%N.51e
  128. // CHECK:STDOUT: }
  129. // CHECK:STDOUT:
  130. // CHECK:STDOUT: --- fail_todo_init_template_dependent_bound.carbon
  131. // CHECK:STDOUT:
  132. // CHECK:STDOUT: constants {
  133. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  134. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  135. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  136. // CHECK:STDOUT: %N.51e: %i32 = bind_symbolic_name N, 0, template [template]
  137. // CHECK:STDOUT: %N.patt.8e2: %i32 = symbolic_binding_pattern N, 0, template [template]
  138. // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
  139. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  140. // CHECK:STDOUT: %ImplicitAs.type.2fd: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [concrete]
  141. // CHECK:STDOUT: %Convert.type.71e: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [concrete]
  142. // CHECK:STDOUT: %impl_witness.023: <witness> = impl_witness (imports.%Core.import_ref.85c), @impl.971(%int_32) [concrete]
  143. // CHECK:STDOUT: %Convert.type.4ad: type = fn_type @Convert.3, @impl.971(%int_32) [concrete]
  144. // CHECK:STDOUT: %Convert.960: %Convert.type.4ad = struct_value () [concrete]
  145. // CHECK:STDOUT: %ImplicitAs.facet.e25: %ImplicitAs.type.2fd = facet_value %i32, %impl_witness.023 [concrete]
  146. // CHECK:STDOUT: %.10e: type = fn_type_with_self_type %Convert.type.71e, %ImplicitAs.facet.e25 [concrete]
  147. // CHECK:STDOUT: %Convert.bound.588: <bound method> = bound_method %N.51e, %Convert.960 [template]
  148. // CHECK:STDOUT: %Convert.specific_fn.18b: <specific function> = specific_function %Convert.bound.588, @Convert.3(%int_32) [template]
  149. // CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %Convert.specific_fn.18b(%N.51e) [template]
  150. // CHECK:STDOUT: %array_type.b04: type = array_type %int.convert_checked, %i32 [template]
  151. // CHECK:STDOUT: %require_complete.9dc: <witness> = require_complete_type %array_type.b04 [template]
  152. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete]
  153. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete]
  154. // CHECK:STDOUT: %int_3.1ba: Core.IntLiteral = int_value 3 [concrete]
  155. // CHECK:STDOUT: %tuple.type: type = tuple_type (Core.IntLiteral, Core.IntLiteral, Core.IntLiteral) [concrete]
  156. // CHECK:STDOUT: %H.type: type = fn_type @H [concrete]
  157. // CHECK:STDOUT: %H: %H.type = struct_value () [concrete]
  158. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  159. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  160. // CHECK:STDOUT: %impl_witness.d39: <witness> = impl_witness (imports.%Core.import_ref.a5b), @impl.4f9(%int_32) [concrete]
  161. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  162. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  163. // CHECK:STDOUT: %ImplicitAs.facet.f7f: %ImplicitAs.type.205 = facet_value Core.IntLiteral, %impl_witness.d39 [concrete]
  164. // CHECK:STDOUT: %.a0b: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet.f7f [concrete]
  165. // CHECK:STDOUT: %Convert.bound.b30: <bound method> = bound_method %int_3.1ba, %Convert.956 [concrete]
  166. // CHECK:STDOUT: %Convert.specific_fn.b42: <specific function> = specific_function %Convert.bound.b30, @Convert.2(%int_32) [concrete]
  167. // CHECK:STDOUT: %int_3.822: %i32 = int_value 3 [concrete]
  168. // CHECK:STDOUT: %G.specific_fn: <specific function> = specific_function %G, @G(%int_3.822) [concrete]
  169. // CHECK:STDOUT: %Convert.bound.2d6: <bound method> = bound_method %int_3.822, %Convert.960 [concrete]
  170. // CHECK:STDOUT: %Convert.specific_fn.377: <specific function> = specific_function %Convert.bound.2d6, @Convert.3(%int_32) [concrete]
  171. // CHECK:STDOUT: %array_type.3fb: type = array_type %int_3.1ba, %i32 [concrete]
  172. // CHECK:STDOUT: %complete_type.cbf: <witness> = complete_type_witness %array_type.3fb [concrete]
  173. // CHECK:STDOUT: }
  174. // CHECK:STDOUT:
  175. // CHECK:STDOUT: imports {
  176. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  177. // CHECK:STDOUT: .Int = %Core.Int
  178. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  179. // CHECK:STDOUT: import Core//prelude
  180. // CHECK:STDOUT: import Core//prelude/...
  181. // CHECK:STDOUT: }
  182. // CHECK:STDOUT: }
  183. // CHECK:STDOUT:
  184. // CHECK:STDOUT: file {
  185. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  186. // CHECK:STDOUT: .Core = imports.%Core
  187. // CHECK:STDOUT: .G = %G.decl
  188. // CHECK:STDOUT: .H = %H.decl
  189. // CHECK:STDOUT: }
  190. // CHECK:STDOUT: %Core.import = import Core
  191. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {
  192. // CHECK:STDOUT: %N.patt.loc5_15.1: %i32 = symbolic_binding_pattern N, 0, template [template = %N.patt.loc5_15.2 (constants.%N.patt.8e2)]
  193. // CHECK:STDOUT: %N.param_patt: %i32 = value_param_pattern %N.patt.loc5_15.1, runtime_param<none> [template = %N.patt.loc5_15.2 (constants.%N.patt.8e2)]
  194. // CHECK:STDOUT: } {
  195. // CHECK:STDOUT: %N.param: %i32 = value_param runtime_param<none>
  196. // CHECK:STDOUT: %.loc5: type = splice_block %i32.loc5 [concrete = constants.%i32] {
  197. // CHECK:STDOUT: %int_32.loc5: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  198. // CHECK:STDOUT: %i32.loc5: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  199. // CHECK:STDOUT: }
  200. // CHECK:STDOUT: %N.loc5_15.1: %i32 = bind_symbolic_name N, 0, template, %N.param [template = %N.loc5_15.2 (constants.%N.51e)]
  201. // CHECK:STDOUT: }
  202. // CHECK:STDOUT: %H.decl: %H.type = fn_decl @H [concrete = constants.%H] {} {}
  203. // CHECK:STDOUT: }
  204. // CHECK:STDOUT:
  205. // CHECK:STDOUT: generic fn @G(%N.loc5_15.1: %i32) {
  206. // CHECK:STDOUT: %N.loc5_15.2: %i32 = bind_symbolic_name N, 0, template [template = %N.loc5_15.2 (constants.%N.51e)]
  207. // CHECK:STDOUT: %N.patt.loc5_15.2: %i32 = symbolic_binding_pattern N, 0, template [template = %N.patt.loc5_15.2 (constants.%N.patt.8e2)]
  208. // CHECK:STDOUT:
  209. // CHECK:STDOUT: !definition:
  210. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %N.loc5_15.2, constants.%Convert.960 [template = %Convert.bound (constants.%Convert.bound.588)]
  211. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.bound, @Convert.3(constants.%int_32) [template = %Convert.specific_fn (constants.%Convert.specific_fn.18b)]
  212. // CHECK:STDOUT: %int.convert_checked.loc10_23.2: init Core.IntLiteral = call %Convert.specific_fn(%N.loc5_15.2) [template = %int.convert_checked.loc10_23.2 (constants.%int.convert_checked)]
  213. // CHECK:STDOUT: %array_type.loc10_24.2: type = array_type %int.convert_checked.loc10_23.2, %i32 [template = %array_type.loc10_24.2 (constants.%array_type.b04)]
  214. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type @G.%array_type.loc10_24.2 (%array_type.b04) [template = %require_complete (constants.%require_complete.9dc)]
  215. // CHECK:STDOUT:
  216. // CHECK:STDOUT: fn(%N.param_patt: %i32) {
  217. // CHECK:STDOUT: !entry:
  218. // CHECK:STDOUT: name_binding_decl {
  219. // CHECK:STDOUT: %arr.patt: @G.%array_type.loc10_24.2 (%array_type.b04) = binding_pattern arr
  220. // CHECK:STDOUT: %.loc10_3: @G.%array_type.loc10_24.2 (%array_type.b04) = var_pattern %arr.patt
  221. // CHECK:STDOUT: }
  222. // CHECK:STDOUT: %arr.var: ref @G.%array_type.loc10_24.2 (%array_type.b04) = var arr
  223. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
  224. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
  225. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba]
  226. // CHECK:STDOUT: %.loc10_36: %tuple.type = tuple_literal (%int_1, %int_2, %int_3)
  227. // CHECK:STDOUT: assign %arr.var, <error>
  228. // CHECK:STDOUT: %.loc10_24: type = splice_block %array_type.loc10_24.1 [template = %array_type.loc10_24.2 (constants.%array_type.b04)] {
  229. // CHECK:STDOUT: %int_32.loc10: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  230. // CHECK:STDOUT: %i32.loc10: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  231. // CHECK:STDOUT: %N.ref: %i32 = name_ref N, %N.loc5_15.1 [template = %N.loc5_15.2 (constants.%N.51e)]
  232. // CHECK:STDOUT: %impl.elem0: %.10e = impl_witness_access constants.%impl_witness.023, element0 [concrete = constants.%Convert.960]
  233. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %N.ref, %impl.elem0 [template = %Convert.bound (constants.%Convert.bound.588)]
  234. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %bound_method, @Convert.3(constants.%int_32) [template = %Convert.specific_fn (constants.%Convert.specific_fn.18b)]
  235. // CHECK:STDOUT: %int.convert_checked.loc10_23.1: init Core.IntLiteral = call %specific_fn(%N.ref) [template = %int.convert_checked.loc10_23.2 (constants.%int.convert_checked)]
  236. // CHECK:STDOUT: %.loc10_23.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc10_23.1 [template = %int.convert_checked.loc10_23.2 (constants.%int.convert_checked)]
  237. // CHECK:STDOUT: %.loc10_23.2: Core.IntLiteral = converted %N.ref, %.loc10_23.1 [template = %int.convert_checked.loc10_23.2 (constants.%int.convert_checked)]
  238. // CHECK:STDOUT: %array_type.loc10_24.1: type = array_type %.loc10_23.2, %i32 [template = %array_type.loc10_24.2 (constants.%array_type.b04)]
  239. // CHECK:STDOUT: }
  240. // CHECK:STDOUT: %arr: ref @G.%array_type.loc10_24.2 (%array_type.b04) = bind_name arr, %arr.var
  241. // CHECK:STDOUT: return
  242. // CHECK:STDOUT: }
  243. // CHECK:STDOUT: }
  244. // CHECK:STDOUT:
  245. // CHECK:STDOUT: fn @H() {
  246. // CHECK:STDOUT: !entry:
  247. // CHECK:STDOUT: %G.ref: %G.type = name_ref G, file.%G.decl [concrete = constants.%G]
  248. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba]
  249. // CHECK:STDOUT: %impl.elem0: %.a0b = impl_witness_access constants.%impl_witness.d39, element0 [concrete = constants.%Convert.956]
  250. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_3, %impl.elem0 [concrete = constants.%Convert.bound.b30]
  251. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %bound_method, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn.b42]
  252. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %specific_fn(%int_3) [concrete = constants.%int_3.822]
  253. // CHECK:STDOUT: %.loc13_13.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_3.822]
  254. // CHECK:STDOUT: %.loc13_13.2: %i32 = converted %int_3, %.loc13_13.1 [concrete = constants.%int_3.822]
  255. // CHECK:STDOUT: %G.specific_fn: <specific function> = specific_function %G.ref, @G(constants.%int_3.822) [concrete = constants.%G.specific_fn]
  256. // CHECK:STDOUT: %G.call: init %empty_tuple.type = call %G.specific_fn()
  257. // CHECK:STDOUT: return
  258. // CHECK:STDOUT: }
  259. // CHECK:STDOUT:
  260. // CHECK:STDOUT: specific @G(constants.%N.51e) {
  261. // CHECK:STDOUT: %N.loc5_15.2 => constants.%N.51e
  262. // CHECK:STDOUT: %N.patt.loc5_15.2 => constants.%N.51e
  263. // CHECK:STDOUT: }
  264. // CHECK:STDOUT:
  265. // CHECK:STDOUT: specific @G(constants.%int_3.822) {
  266. // CHECK:STDOUT: %N.loc5_15.2 => constants.%int_3.822
  267. // CHECK:STDOUT: %N.patt.loc5_15.2 => constants.%int_3.822
  268. // CHECK:STDOUT:
  269. // CHECK:STDOUT: !definition:
  270. // CHECK:STDOUT: %Convert.bound => constants.%Convert.bound.2d6
  271. // CHECK:STDOUT: %Convert.specific_fn => constants.%Convert.specific_fn.377
  272. // CHECK:STDOUT: %int.convert_checked.loc10_23.2 => constants.%int_3.1ba
  273. // CHECK:STDOUT: %array_type.loc10_24.2 => constants.%array_type.3fb
  274. // CHECK:STDOUT: %require_complete => constants.%complete_type.cbf
  275. // CHECK:STDOUT: }
  276. // CHECK:STDOUT: