init_dependent_bound.carbon 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  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]]:12: error: cannot evaluate type expression [TypeExprEvaluationFailure]
  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: %Int.type: type = generic_class_type @Int [concrete]
  35. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  36. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  37. // CHECK:STDOUT: %N.51e: %i32 = bind_symbolic_name N, 0 [symbolic]
  38. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  39. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  40. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  41. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  42. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  43. // CHECK:STDOUT: %ImplicitAs.type.2fd: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [concrete]
  44. // CHECK:STDOUT: %Convert.type.71e: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [concrete]
  45. // CHECK:STDOUT: %From: Core.IntLiteral = bind_symbolic_name From, 0 [symbolic]
  46. // CHECK:STDOUT: %Convert.type.708: type = fn_type @Convert.3, @impl.971(%From) [symbolic]
  47. // CHECK:STDOUT: %Convert.c68: %Convert.type.708 = struct_value () [symbolic]
  48. // CHECK:STDOUT: %ImplicitAs.impl_witness.a11: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.1d9, @impl.971(%int_32) [concrete]
  49. // CHECK:STDOUT: %Convert.type.4ad: type = fn_type @Convert.3, @impl.971(%int_32) [concrete]
  50. // CHECK:STDOUT: %Convert.960: %Convert.type.4ad = struct_value () [concrete]
  51. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.2fd = facet_value %i32, (%ImplicitAs.impl_witness.a11) [concrete]
  52. // CHECK:STDOUT: %.0ea: type = fn_type_with_self_type %Convert.type.71e, %ImplicitAs.facet [concrete]
  53. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %N.51e, %Convert.960 [symbolic]
  54. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.960, @Convert.3(%int_32) [concrete]
  55. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %N.51e, %Convert.specific_fn [symbolic]
  56. // CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %bound_method(%N.51e) [symbolic]
  57. // CHECK:STDOUT: %array_type: type = array_type %int.convert_checked, %i32 [symbolic]
  58. // CHECK:STDOUT: %require_complete.7cb: <witness> = require_complete_type %array_type [symbolic]
  59. // CHECK:STDOUT: %pattern_type.ccc: type = pattern_type %array_type [symbolic]
  60. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete]
  61. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete]
  62. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete]
  63. // CHECK:STDOUT: %tuple.type: type = tuple_type (Core.IntLiteral, Core.IntLiteral, Core.IntLiteral) [concrete]
  64. // CHECK:STDOUT: }
  65. // CHECK:STDOUT:
  66. // CHECK:STDOUT: imports {
  67. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  68. // CHECK:STDOUT: .Int = %Core.Int
  69. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  70. // CHECK:STDOUT: import Core//prelude
  71. // CHECK:STDOUT: import Core//prelude/...
  72. // CHECK:STDOUT: }
  73. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  74. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  75. // CHECK:STDOUT: %Core.import_ref.85c: @impl.971.%Convert.type (%Convert.type.708) = import_ref Core//prelude/types/int, loc23_44, loaded [symbolic = @impl.971.%Convert (constants.%Convert.c68)]
  76. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.1d9 = impl_witness_table (%Core.import_ref.85c), @impl.971 [concrete]
  77. // CHECK:STDOUT: }
  78. // CHECK:STDOUT:
  79. // CHECK:STDOUT: file {
  80. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  81. // CHECK:STDOUT: .Core = imports.%Core
  82. // CHECK:STDOUT: .F = %F.decl
  83. // CHECK:STDOUT: }
  84. // CHECK:STDOUT: %Core.import = import Core
  85. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  86. // CHECK:STDOUT: %N.patt: %pattern_type.7ce = symbolic_binding_pattern N, 0 [concrete]
  87. // CHECK:STDOUT: } {
  88. // CHECK:STDOUT: %.loc4: type = splice_block %i32.loc4 [concrete = constants.%i32] {
  89. // CHECK:STDOUT: %int_32.loc4: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  90. // CHECK:STDOUT: %i32.loc4: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  91. // CHECK:STDOUT: }
  92. // CHECK:STDOUT: %N.loc4_6.1: %i32 = bind_symbolic_name N, 0 [symbolic = %N.loc4_6.2 (constants.%N.51e)]
  93. // CHECK:STDOUT: }
  94. // CHECK:STDOUT: }
  95. // CHECK:STDOUT:
  96. // CHECK:STDOUT: generic fn @F(%N.loc4_6.1: %i32) {
  97. // CHECK:STDOUT: %N.loc4_6.2: %i32 = bind_symbolic_name N, 0 [symbolic = %N.loc4_6.2 (constants.%N.51e)]
  98. // CHECK:STDOUT:
  99. // CHECK:STDOUT: !definition:
  100. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %N.loc4_6.2, constants.%Convert.960 [symbolic = %Convert.bound (constants.%Convert.bound)]
  101. // CHECK:STDOUT: %bound_method.loc9_23.3: <bound method> = bound_method %N.loc4_6.2, constants.%Convert.specific_fn [symbolic = %bound_method.loc9_23.3 (constants.%bound_method)]
  102. // CHECK:STDOUT: %int.convert_checked.loc9_23.2: init Core.IntLiteral = call %bound_method.loc9_23.3(%N.loc4_6.2) [symbolic = %int.convert_checked.loc9_23.2 (constants.%int.convert_checked)]
  103. // CHECK:STDOUT: %array_type.loc9_24.2: type = array_type %int.convert_checked.loc9_23.2, constants.%i32 [symbolic = %array_type.loc9_24.2 (constants.%array_type)]
  104. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %array_type.loc9_24.2 [symbolic = %require_complete (constants.%require_complete.7cb)]
  105. // CHECK:STDOUT: %pattern_type: type = pattern_type %array_type.loc9_24.2 [symbolic = %pattern_type (constants.%pattern_type.ccc)]
  106. // CHECK:STDOUT:
  107. // CHECK:STDOUT: fn() {
  108. // CHECK:STDOUT: !entry:
  109. // CHECK:STDOUT: name_binding_decl {
  110. // CHECK:STDOUT: %arr.patt: @F.%pattern_type (%pattern_type.ccc) = binding_pattern arr [concrete]
  111. // CHECK:STDOUT: %arr.var_patt: @F.%pattern_type (%pattern_type.ccc) = var_pattern %arr.patt [concrete]
  112. // CHECK:STDOUT: }
  113. // CHECK:STDOUT: %arr.var: ref @F.%array_type.loc9_24.2 (%array_type) = var %arr.var_patt
  114. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
  115. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
  116. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3]
  117. // CHECK:STDOUT: %.loc9_36: %tuple.type = tuple_literal (%int_1, %int_2, %int_3)
  118. // CHECK:STDOUT: assign %arr.var, <error>
  119. // CHECK:STDOUT: %.loc9_24: type = splice_block %array_type.loc9_24.1 [symbolic = %array_type.loc9_24.2 (constants.%array_type)] {
  120. // CHECK:STDOUT: %int_32.loc9: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  121. // CHECK:STDOUT: %i32.loc9: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  122. // CHECK:STDOUT: %N.ref: %i32 = name_ref N, %N.loc4_6.1 [symbolic = %N.loc4_6.2 (constants.%N.51e)]
  123. // CHECK:STDOUT: %impl.elem0: %.0ea = impl_witness_access constants.%ImplicitAs.impl_witness.a11, element0 [concrete = constants.%Convert.960]
  124. // CHECK:STDOUT: %bound_method.loc9_23.1: <bound method> = bound_method %N.ref, %impl.elem0 [symbolic = %Convert.bound (constants.%Convert.bound)]
  125. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.3(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  126. // CHECK:STDOUT: %bound_method.loc9_23.2: <bound method> = bound_method %N.ref, %specific_fn [symbolic = %bound_method.loc9_23.3 (constants.%bound_method)]
  127. // CHECK:STDOUT: %int.convert_checked.loc9_23.1: init Core.IntLiteral = call %bound_method.loc9_23.2(%N.ref) [symbolic = %int.convert_checked.loc9_23.2 (constants.%int.convert_checked)]
  128. // 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)]
  129. // CHECK:STDOUT: %.loc9_23.2: Core.IntLiteral = converted %N.ref, %.loc9_23.1 [symbolic = %int.convert_checked.loc9_23.2 (constants.%int.convert_checked)]
  130. // CHECK:STDOUT: %array_type.loc9_24.1: type = array_type %.loc9_23.2, %i32.loc9 [symbolic = %array_type.loc9_24.2 (constants.%array_type)]
  131. // CHECK:STDOUT: }
  132. // CHECK:STDOUT: %arr: ref @F.%array_type.loc9_24.2 (%array_type) = bind_name arr, %arr.var
  133. // CHECK:STDOUT: return
  134. // CHECK:STDOUT: }
  135. // CHECK:STDOUT: }
  136. // CHECK:STDOUT:
  137. // CHECK:STDOUT: specific @F(constants.%N.51e) {
  138. // CHECK:STDOUT: %N.loc4_6.2 => constants.%N.51e
  139. // CHECK:STDOUT: }
  140. // CHECK:STDOUT:
  141. // CHECK:STDOUT: --- fail_todo_init_template_dependent_bound.carbon
  142. // CHECK:STDOUT:
  143. // CHECK:STDOUT: constants {
  144. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  145. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  146. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  147. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  148. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  149. // CHECK:STDOUT: %N.51e: %i32 = bind_symbolic_name N, 0, template [template]
  150. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  151. // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
  152. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  153. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete]
  154. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete]
  155. // CHECK:STDOUT: %int_3.1ba: Core.IntLiteral = int_value 3 [concrete]
  156. // CHECK:STDOUT: %tuple.type: type = tuple_type (Core.IntLiteral, Core.IntLiteral, Core.IntLiteral) [concrete]
  157. // CHECK:STDOUT: %H.type: type = fn_type @H [concrete]
  158. // CHECK:STDOUT: %H: %H.type = struct_value () [concrete]
  159. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  160. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  161. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  162. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  163. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  164. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  165. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  166. // CHECK:STDOUT: %ImplicitAs.type.2fd: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [concrete]
  167. // CHECK:STDOUT: %From: Core.IntLiteral = bind_symbolic_name From, 0 [symbolic]
  168. // CHECK:STDOUT: %Convert.type.708: type = fn_type @Convert.3, @impl.971(%From) [symbolic]
  169. // CHECK:STDOUT: %Convert.c68: %Convert.type.708 = struct_value () [symbolic]
  170. // CHECK:STDOUT: %Convert.type.71e: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [concrete]
  171. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  172. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  173. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  174. // CHECK:STDOUT: %ImplicitAs.facet.921: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  175. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet.921 [concrete]
  176. // CHECK:STDOUT: %Convert.bound.b30: <bound method> = bound_method %int_3.1ba, %Convert.956 [concrete]
  177. // CHECK:STDOUT: %Convert.specific_fn.b6f: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  178. // CHECK:STDOUT: %bound_method.047: <bound method> = bound_method %int_3.1ba, %Convert.specific_fn.b6f [concrete]
  179. // CHECK:STDOUT: %int_3.822: %i32 = int_value 3 [concrete]
  180. // CHECK:STDOUT: %G.specific_fn: <specific function> = specific_function %G, @G(%int_3.822) [concrete]
  181. // CHECK:STDOUT: %ImplicitAs.impl_witness.a11: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.1d9, @impl.971(%int_32) [concrete]
  182. // CHECK:STDOUT: %Convert.type.4ad: type = fn_type @Convert.3, @impl.971(%int_32) [concrete]
  183. // CHECK:STDOUT: %Convert.960: %Convert.type.4ad = struct_value () [concrete]
  184. // CHECK:STDOUT: %ImplicitAs.facet.f49: %ImplicitAs.type.2fd = facet_value %i32, (%ImplicitAs.impl_witness.a11) [concrete]
  185. // CHECK:STDOUT: %.0ea: type = fn_type_with_self_type %Convert.type.71e, %ImplicitAs.facet.f49 [concrete]
  186. // CHECK:STDOUT: %Convert.bound.2d6: <bound method> = bound_method %int_3.822, %Convert.960 [concrete]
  187. // CHECK:STDOUT: %Convert.specific_fn.8a8: <specific function> = specific_function %Convert.960, @Convert.3(%int_32) [concrete]
  188. // CHECK:STDOUT: %bound_method.c6f: <bound method> = bound_method %int_3.822, %Convert.specific_fn.8a8 [concrete]
  189. // CHECK:STDOUT: %inst.splice_block: <instruction> = inst_value [concrete] {
  190. // CHECK:STDOUT: %.df7: Core.IntLiteral = splice_block %.dd0 [concrete = %int_3.1ba] {
  191. // CHECK:STDOUT: %impl.elem0: %.0ea = impl_witness_access %ImplicitAs.impl_witness.a11, element0 [concrete = %Convert.960]
  192. // CHECK:STDOUT: %bound_method.8d1: <bound method> = bound_method %int_3.822, %impl.elem0 [concrete = %Convert.bound.2d6]
  193. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.3(%int_32) [concrete = %Convert.specific_fn.8a8]
  194. // CHECK:STDOUT: %bound_method.9ef: <bound method> = bound_method %int_3.822, %specific_fn [concrete = %bound_method.c6f]
  195. // CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %bound_method.9ef(%int_3.822) [concrete = %int_3.1ba]
  196. // CHECK:STDOUT: %.5d1: Core.IntLiteral = value_of_initializer %int.convert_checked [concrete = %int_3.1ba]
  197. // CHECK:STDOUT: %.dd0: Core.IntLiteral = converted %int_3.822, %.5d1 [concrete = %int_3.1ba]
  198. // CHECK:STDOUT: }
  199. // CHECK:STDOUT: }
  200. // CHECK:STDOUT: }
  201. // CHECK:STDOUT:
  202. // CHECK:STDOUT: imports {
  203. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  204. // CHECK:STDOUT: .Int = %Core.Int
  205. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  206. // CHECK:STDOUT: import Core//prelude
  207. // CHECK:STDOUT: import Core//prelude/...
  208. // CHECK:STDOUT: }
  209. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  210. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  211. // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)]
  212. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  213. // CHECK:STDOUT: %Core.import_ref.85c: @impl.971.%Convert.type (%Convert.type.708) = import_ref Core//prelude/types/int, loc23_44, loaded [symbolic = @impl.971.%Convert (constants.%Convert.c68)]
  214. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.1d9 = impl_witness_table (%Core.import_ref.85c), @impl.971 [concrete]
  215. // CHECK:STDOUT: }
  216. // CHECK:STDOUT:
  217. // CHECK:STDOUT: file {
  218. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  219. // CHECK:STDOUT: .Core = imports.%Core
  220. // CHECK:STDOUT: .G = %G.decl
  221. // CHECK:STDOUT: .H = %H.decl
  222. // CHECK:STDOUT: }
  223. // CHECK:STDOUT: %Core.import = import Core
  224. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {
  225. // CHECK:STDOUT: %N.patt: %pattern_type.7ce = symbolic_binding_pattern N, 0, template [concrete]
  226. // CHECK:STDOUT: } {
  227. // CHECK:STDOUT: %.loc5: type = splice_block %i32.loc5 [concrete = constants.%i32] {
  228. // CHECK:STDOUT: %int_32.loc5: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  229. // CHECK:STDOUT: %i32.loc5: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  230. // CHECK:STDOUT: }
  231. // CHECK:STDOUT: %N.loc5_15.1: %i32 = bind_symbolic_name N, 0, template [template = %N.loc5_15.2 (constants.%N.51e)]
  232. // CHECK:STDOUT: }
  233. // CHECK:STDOUT: %H.decl: %H.type = fn_decl @H [concrete = constants.%H] {} {}
  234. // CHECK:STDOUT: }
  235. // CHECK:STDOUT:
  236. // CHECK:STDOUT: generic fn @G(%N.loc5_15.1: %i32) {
  237. // CHECK:STDOUT: %N.loc5_15.2: %i32 = bind_symbolic_name N, 0, template [template = %N.loc5_15.2 (constants.%N.51e)]
  238. // CHECK:STDOUT:
  239. // CHECK:STDOUT: !definition:
  240. // CHECK:STDOUT: %.loc10_23.2: <instruction> = convert_to_value_action %N.ref, Core.IntLiteral [template]
  241. // CHECK:STDOUT:
  242. // CHECK:STDOUT: fn() {
  243. // CHECK:STDOUT: !entry:
  244. // CHECK:STDOUT: name_binding_decl {
  245. // CHECK:STDOUT: %arr.patt: <error> = binding_pattern arr [concrete]
  246. // CHECK:STDOUT: %arr.var_patt: <error> = var_pattern %arr.patt [concrete]
  247. // CHECK:STDOUT: }
  248. // CHECK:STDOUT: %arr.var: ref <error> = var %arr.var_patt [concrete = <error>]
  249. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
  250. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
  251. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba]
  252. // CHECK:STDOUT: %.loc10_36: %tuple.type = tuple_literal (%int_1, %int_2, %int_3)
  253. // CHECK:STDOUT: assign %arr.var, <error>
  254. // CHECK:STDOUT: %.1: <error> = splice_block <error> [concrete = <error>] {
  255. // CHECK:STDOUT: %int_32.loc10: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  256. // CHECK:STDOUT: %i32.loc10: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  257. // CHECK:STDOUT: %N.ref: %i32 = name_ref N, %N.loc5_15.1 [template = %N.loc5_15.2 (constants.%N.51e)]
  258. // CHECK:STDOUT: %.loc10_23.1: Core.IntLiteral = splice_inst %.loc10_23.2
  259. // CHECK:STDOUT: %array_type: type = array_type %.loc10_23.1, %i32.loc10
  260. // CHECK:STDOUT: }
  261. // CHECK:STDOUT: %arr: <error> = bind_name arr, <error>
  262. // CHECK:STDOUT: return
  263. // CHECK:STDOUT: }
  264. // CHECK:STDOUT: }
  265. // CHECK:STDOUT:
  266. // CHECK:STDOUT: fn @H() {
  267. // CHECK:STDOUT: !entry:
  268. // CHECK:STDOUT: %G.ref: %G.type = name_ref G, file.%G.decl [concrete = constants.%G]
  269. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba]
  270. // CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  271. // CHECK:STDOUT: %bound_method.loc13_13.1: <bound method> = bound_method %int_3, %impl.elem0 [concrete = constants.%Convert.bound.b30]
  272. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn.b6f]
  273. // CHECK:STDOUT: %bound_method.loc13_13.2: <bound method> = bound_method %int_3, %specific_fn [concrete = constants.%bound_method.047]
  274. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc13_13.2(%int_3) [concrete = constants.%int_3.822]
  275. // CHECK:STDOUT: %.loc13_13.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_3.822]
  276. // CHECK:STDOUT: %.loc13_13.2: %i32 = converted %int_3, %.loc13_13.1 [concrete = constants.%int_3.822]
  277. // CHECK:STDOUT: %G.specific_fn: <specific function> = specific_function %G.ref, @G(constants.%int_3.822) [concrete = constants.%G.specific_fn]
  278. // CHECK:STDOUT: %G.call: init %empty_tuple.type = call %G.specific_fn()
  279. // CHECK:STDOUT: return
  280. // CHECK:STDOUT: }
  281. // CHECK:STDOUT:
  282. // CHECK:STDOUT: specific @G(constants.%N.51e) {
  283. // CHECK:STDOUT: %N.loc5_15.2 => constants.%N.51e
  284. // CHECK:STDOUT: }
  285. // CHECK:STDOUT:
  286. // CHECK:STDOUT: specific @G(constants.%int_3.822) {
  287. // CHECK:STDOUT: %N.loc5_15.2 => constants.%int_3.822
  288. // CHECK:STDOUT:
  289. // CHECK:STDOUT: !definition:
  290. // CHECK:STDOUT: %.loc10_23.2 => constants.%inst.splice_block
  291. // CHECK:STDOUT: }
  292. // CHECK:STDOUT: