expr_category.carbon 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  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/index/expr_category.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/expr_category.carbon
  10. fn F() -> [i32; 3];
  11. fn G(b: [i32; 3]) {
  12. var a: [i32; 3] = (1, 2, 3);
  13. // Indexing a durable array reference gives a durable reference.
  14. var pa: i32* = &a[0];
  15. a[0] = 4;
  16. }
  17. fn ValueBinding(b: [i32; 3]) {
  18. var a: [i32; 3] = (1, 2, 3);
  19. // Index but don't do anything else so we can check that a value binding is
  20. // produced when appropriate.
  21. a[0];
  22. b[0];
  23. F()[0];
  24. }
  25. // CHECK:STDOUT: --- expr_category.carbon
  26. // CHECK:STDOUT:
  27. // CHECK:STDOUT: constants {
  28. // CHECK:STDOUT: %.1: Core.IntLiteral = int_value 32 [template]
  29. // CHECK:STDOUT: %Int.type: type = fn_type @Int [template]
  30. // CHECK:STDOUT: %Int: %Int.type = struct_value () [template]
  31. // CHECK:STDOUT: %i32: type = int_type signed, %.1 [template]
  32. // CHECK:STDOUT: %.2: Core.IntLiteral = int_value 3 [template]
  33. // CHECK:STDOUT: %.3: type = array_type %.2, %i32 [template]
  34. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  35. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  36. // CHECK:STDOUT: %G.type: type = fn_type @G [template]
  37. // CHECK:STDOUT: %G: %G.type = struct_value () [template]
  38. // CHECK:STDOUT: %.5: Core.IntLiteral = int_value 1 [template]
  39. // CHECK:STDOUT: %.6: Core.IntLiteral = int_value 2 [template]
  40. // CHECK:STDOUT: %tuple.type: type = tuple_type (Core.IntLiteral, Core.IntLiteral, Core.IntLiteral) [template]
  41. // CHECK:STDOUT: %.7: Core.IntLiteral = int_value 0 [template]
  42. // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32) [template]
  43. // CHECK:STDOUT: %Convert.type.14: type = fn_type @Convert.2, @impl.1(%.1) [template]
  44. // CHECK:STDOUT: %Convert.14: %Convert.type.14 = struct_value () [template]
  45. // CHECK:STDOUT: %.27: <witness> = interface_witness (%Convert.14) [template]
  46. // CHECK:STDOUT: %.28: <bound method> = bound_method %.5, %Convert.14 [template]
  47. // CHECK:STDOUT: %.29: <specific function> = specific_function %.28, @Convert.2(%.1) [template]
  48. // CHECK:STDOUT: %.30: %i32 = int_value 1 [template]
  49. // CHECK:STDOUT: %.31: <bound method> = bound_method %.6, %Convert.14 [template]
  50. // CHECK:STDOUT: %.32: <specific function> = specific_function %.31, @Convert.2(%.1) [template]
  51. // CHECK:STDOUT: %.33: %i32 = int_value 2 [template]
  52. // CHECK:STDOUT: %.34: <bound method> = bound_method %.2, %Convert.14 [template]
  53. // CHECK:STDOUT: %.35: <specific function> = specific_function %.34, @Convert.2(%.1) [template]
  54. // CHECK:STDOUT: %.36: %i32 = int_value 3 [template]
  55. // CHECK:STDOUT: %array: %.3 = tuple_value (%.30, %.33, %.36) [template]
  56. // CHECK:STDOUT: %.37: type = ptr_type %i32 [template]
  57. // CHECK:STDOUT: %.38: <bound method> = bound_method %.7, %Convert.14 [template]
  58. // CHECK:STDOUT: %.39: <specific function> = specific_function %.38, @Convert.2(%.1) [template]
  59. // CHECK:STDOUT: %.40: %i32 = int_value 0 [template]
  60. // CHECK:STDOUT: %.41: Core.IntLiteral = int_value 4 [template]
  61. // CHECK:STDOUT: %.42: <bound method> = bound_method %.41, %Convert.14 [template]
  62. // CHECK:STDOUT: %.43: <specific function> = specific_function %.42, @Convert.2(%.1) [template]
  63. // CHECK:STDOUT: %.44: %i32 = int_value 4 [template]
  64. // CHECK:STDOUT: %ValueBinding.type: type = fn_type @ValueBinding [template]
  65. // CHECK:STDOUT: %ValueBinding: %ValueBinding.type = struct_value () [template]
  66. // CHECK:STDOUT: }
  67. // CHECK:STDOUT:
  68. // CHECK:STDOUT: imports {
  69. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  70. // CHECK:STDOUT: .Int = %import_ref.1
  71. // CHECK:STDOUT: .ImplicitAs = %import_ref.2
  72. // CHECK:STDOUT: import Core//prelude
  73. // CHECK:STDOUT: import Core//prelude/...
  74. // CHECK:STDOUT: }
  75. // CHECK:STDOUT: }
  76. // CHECK:STDOUT:
  77. // CHECK:STDOUT: file {
  78. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  79. // CHECK:STDOUT: .Core = imports.%Core
  80. // CHECK:STDOUT: .F = %F.decl
  81. // CHECK:STDOUT: .G = %G.decl
  82. // CHECK:STDOUT: .ValueBinding = %ValueBinding.decl
  83. // CHECK:STDOUT: }
  84. // CHECK:STDOUT: %Core.import = import Core
  85. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
  86. // CHECK:STDOUT: %return.patt: %.3 = return_slot_pattern
  87. // CHECK:STDOUT: %return.param_patt: %.3 = out_param_pattern %return.patt, runtime_param0
  88. // CHECK:STDOUT: } {
  89. // CHECK:STDOUT: %.loc11_12.1: Core.IntLiteral = int_value 32 [template = constants.%.1]
  90. // CHECK:STDOUT: %int.make_type_signed: init type = call constants.%Int(%.loc11_12.1) [template = constants.%i32]
  91. // CHECK:STDOUT: %.loc11_17: Core.IntLiteral = int_value 3 [template = constants.%.2]
  92. // CHECK:STDOUT: %.loc11_12.2: type = value_of_initializer %int.make_type_signed [template = constants.%i32]
  93. // CHECK:STDOUT: %.loc11_12.3: type = converted %int.make_type_signed, %.loc11_12.2 [template = constants.%i32]
  94. // CHECK:STDOUT: %.loc11_18: type = array_type %.loc11_17, %i32 [template = constants.%.3]
  95. // CHECK:STDOUT: %return.param: ref %.3 = out_param runtime_param0
  96. // CHECK:STDOUT: %return: ref %.3 = return_slot %return.param
  97. // CHECK:STDOUT: }
  98. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
  99. // CHECK:STDOUT: %b.patt: %.3 = binding_pattern b
  100. // CHECK:STDOUT: %b.param_patt: %.3 = value_param_pattern %b.patt, runtime_param0
  101. // CHECK:STDOUT: } {
  102. // CHECK:STDOUT: %.loc13_10.1: Core.IntLiteral = int_value 32 [template = constants.%.1]
  103. // CHECK:STDOUT: %int.make_type_signed.loc13: init type = call constants.%Int(%.loc13_10.1) [template = constants.%i32]
  104. // CHECK:STDOUT: %.loc13_15: Core.IntLiteral = int_value 3 [template = constants.%.2]
  105. // CHECK:STDOUT: %.loc13_10.2: type = value_of_initializer %int.make_type_signed.loc13 [template = constants.%i32]
  106. // CHECK:STDOUT: %.loc13_10.3: type = converted %int.make_type_signed.loc13, %.loc13_10.2 [template = constants.%i32]
  107. // CHECK:STDOUT: %.loc13_16: type = array_type %.loc13_15, %i32 [template = constants.%.3]
  108. // CHECK:STDOUT: %b.param: %.3 = value_param runtime_param0
  109. // CHECK:STDOUT: %b: %.3 = bind_name b, %b.param
  110. // CHECK:STDOUT: }
  111. // CHECK:STDOUT: %ValueBinding.decl: %ValueBinding.type = fn_decl @ValueBinding [template = constants.%ValueBinding] {
  112. // CHECK:STDOUT: %b.patt: %.3 = binding_pattern b
  113. // CHECK:STDOUT: %b.param_patt: %.3 = value_param_pattern %b.patt, runtime_param0
  114. // CHECK:STDOUT: } {
  115. // CHECK:STDOUT: %.loc21_21.1: Core.IntLiteral = int_value 32 [template = constants.%.1]
  116. // CHECK:STDOUT: %int.make_type_signed.loc21: init type = call constants.%Int(%.loc21_21.1) [template = constants.%i32]
  117. // CHECK:STDOUT: %.loc21_26: Core.IntLiteral = int_value 3 [template = constants.%.2]
  118. // CHECK:STDOUT: %.loc21_21.2: type = value_of_initializer %int.make_type_signed.loc21 [template = constants.%i32]
  119. // CHECK:STDOUT: %.loc21_21.3: type = converted %int.make_type_signed.loc21, %.loc21_21.2 [template = constants.%i32]
  120. // CHECK:STDOUT: %.loc21_27: type = array_type %.loc21_26, %i32 [template = constants.%.3]
  121. // CHECK:STDOUT: %b.param: %.3 = value_param runtime_param0
  122. // CHECK:STDOUT: %b: %.3 = bind_name b, %b.param
  123. // CHECK:STDOUT: }
  124. // CHECK:STDOUT: }
  125. // CHECK:STDOUT:
  126. // CHECK:STDOUT: fn @F() -> %.3;
  127. // CHECK:STDOUT:
  128. // CHECK:STDOUT: fn @G(%b.param_patt: %.3) {
  129. // CHECK:STDOUT: !entry:
  130. // CHECK:STDOUT: %.loc14_11.1: Core.IntLiteral = int_value 32 [template = constants.%.1]
  131. // CHECK:STDOUT: %int.make_type_signed.loc14: init type = call constants.%Int(%.loc14_11.1) [template = constants.%i32]
  132. // CHECK:STDOUT: %.loc14_16: Core.IntLiteral = int_value 3 [template = constants.%.2]
  133. // CHECK:STDOUT: %.loc14_11.2: type = value_of_initializer %int.make_type_signed.loc14 [template = constants.%i32]
  134. // CHECK:STDOUT: %.loc14_11.3: type = converted %int.make_type_signed.loc14, %.loc14_11.2 [template = constants.%i32]
  135. // CHECK:STDOUT: %.loc14_17: type = array_type %.loc14_16, %i32 [template = constants.%.3]
  136. // CHECK:STDOUT: %a.var: ref %.3 = var a
  137. // CHECK:STDOUT: %a: ref %.3 = bind_name a, %a.var
  138. // CHECK:STDOUT: %.loc14_22: Core.IntLiteral = int_value 1 [template = constants.%.5]
  139. // CHECK:STDOUT: %.loc14_25: Core.IntLiteral = int_value 2 [template = constants.%.6]
  140. // CHECK:STDOUT: %.loc14_28: Core.IntLiteral = int_value 3 [template = constants.%.2]
  141. // CHECK:STDOUT: %.loc14_29.1: %tuple.type = tuple_literal (%.loc14_22, %.loc14_25, %.loc14_28)
  142. // CHECK:STDOUT: %.loc14_29.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.14]
  143. // CHECK:STDOUT: %.loc14_29.3: <bound method> = bound_method %.loc14_22, %.loc14_29.2 [template = constants.%.28]
  144. // CHECK:STDOUT: %.loc14_29.4: <specific function> = specific_function %.loc14_29.3, @Convert.2(constants.%.1) [template = constants.%.29]
  145. // CHECK:STDOUT: %int.convert_checked.loc14_29.1: init %i32 = call %.loc14_29.4(%.loc14_22) [template = constants.%.30]
  146. // CHECK:STDOUT: %.loc14_29.5: init %i32 = converted %.loc14_22, %int.convert_checked.loc14_29.1 [template = constants.%.30]
  147. // CHECK:STDOUT: %.loc14_29.6: Core.IntLiteral = int_value 0 [template = constants.%.7]
  148. // CHECK:STDOUT: %.loc14_29.7: ref %i32 = array_index %a.var, %.loc14_29.6
  149. // CHECK:STDOUT: %.loc14_29.8: init %i32 = initialize_from %.loc14_29.5 to %.loc14_29.7 [template = constants.%.30]
  150. // CHECK:STDOUT: %.loc14_29.9: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.14]
  151. // CHECK:STDOUT: %.loc14_29.10: <bound method> = bound_method %.loc14_25, %.loc14_29.9 [template = constants.%.31]
  152. // CHECK:STDOUT: %.loc14_29.11: <specific function> = specific_function %.loc14_29.10, @Convert.2(constants.%.1) [template = constants.%.32]
  153. // CHECK:STDOUT: %int.convert_checked.loc14_29.2: init %i32 = call %.loc14_29.11(%.loc14_25) [template = constants.%.33]
  154. // CHECK:STDOUT: %.loc14_29.12: init %i32 = converted %.loc14_25, %int.convert_checked.loc14_29.2 [template = constants.%.33]
  155. // CHECK:STDOUT: %.loc14_29.13: Core.IntLiteral = int_value 1 [template = constants.%.5]
  156. // CHECK:STDOUT: %.loc14_29.14: ref %i32 = array_index %a.var, %.loc14_29.13
  157. // CHECK:STDOUT: %.loc14_29.15: init %i32 = initialize_from %.loc14_29.12 to %.loc14_29.14 [template = constants.%.33]
  158. // CHECK:STDOUT: %.loc14_29.16: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.14]
  159. // CHECK:STDOUT: %.loc14_29.17: <bound method> = bound_method %.loc14_28, %.loc14_29.16 [template = constants.%.34]
  160. // CHECK:STDOUT: %.loc14_29.18: <specific function> = specific_function %.loc14_29.17, @Convert.2(constants.%.1) [template = constants.%.35]
  161. // CHECK:STDOUT: %int.convert_checked.loc14_29.3: init %i32 = call %.loc14_29.18(%.loc14_28) [template = constants.%.36]
  162. // CHECK:STDOUT: %.loc14_29.19: init %i32 = converted %.loc14_28, %int.convert_checked.loc14_29.3 [template = constants.%.36]
  163. // CHECK:STDOUT: %.loc14_29.20: Core.IntLiteral = int_value 2 [template = constants.%.6]
  164. // CHECK:STDOUT: %.loc14_29.21: ref %i32 = array_index %a.var, %.loc14_29.20
  165. // CHECK:STDOUT: %.loc14_29.22: init %i32 = initialize_from %.loc14_29.19 to %.loc14_29.21 [template = constants.%.36]
  166. // CHECK:STDOUT: %.loc14_29.23: init %.3 = array_init (%.loc14_29.8, %.loc14_29.15, %.loc14_29.22) to %a.var [template = constants.%array]
  167. // CHECK:STDOUT: %.loc14_30: init %.3 = converted %.loc14_29.1, %.loc14_29.23 [template = constants.%array]
  168. // CHECK:STDOUT: assign %a.var, %.loc14_30
  169. // CHECK:STDOUT: %.loc17_11: Core.IntLiteral = int_value 32 [template = constants.%.1]
  170. // CHECK:STDOUT: %int.make_type_signed.loc17: init type = call constants.%Int(%.loc17_11) [template = constants.%i32]
  171. // CHECK:STDOUT: %.loc17_14.1: type = value_of_initializer %int.make_type_signed.loc17 [template = constants.%i32]
  172. // CHECK:STDOUT: %.loc17_14.2: type = converted %int.make_type_signed.loc17, %.loc17_14.1 [template = constants.%i32]
  173. // CHECK:STDOUT: %.loc17_14.3: type = ptr_type %i32 [template = constants.%.37]
  174. // CHECK:STDOUT: %pa.var: ref %.37 = var pa
  175. // CHECK:STDOUT: %pa: ref %.37 = bind_name pa, %pa.var
  176. // CHECK:STDOUT: %a.ref.loc17: ref %.3 = name_ref a, %a
  177. // CHECK:STDOUT: %.loc17_21.1: Core.IntLiteral = int_value 0 [template = constants.%.7]
  178. // CHECK:STDOUT: %.loc17_21.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.14]
  179. // CHECK:STDOUT: %.loc17_21.3: <bound method> = bound_method %.loc17_21.1, %.loc17_21.2 [template = constants.%.38]
  180. // CHECK:STDOUT: %.loc17_21.4: <specific function> = specific_function %.loc17_21.3, @Convert.2(constants.%.1) [template = constants.%.39]
  181. // CHECK:STDOUT: %int.convert_checked.loc17: init %i32 = call %.loc17_21.4(%.loc17_21.1) [template = constants.%.40]
  182. // CHECK:STDOUT: %.loc17_21.5: %i32 = value_of_initializer %int.convert_checked.loc17 [template = constants.%.40]
  183. // CHECK:STDOUT: %.loc17_21.6: %i32 = converted %.loc17_21.1, %.loc17_21.5 [template = constants.%.40]
  184. // CHECK:STDOUT: %.loc17_22: ref %i32 = array_index %a.ref.loc17, %.loc17_21.6
  185. // CHECK:STDOUT: %.loc17_18: %.37 = addr_of %.loc17_22
  186. // CHECK:STDOUT: assign %pa.var, %.loc17_18
  187. // CHECK:STDOUT: %a.ref.loc18: ref %.3 = name_ref a, %a
  188. // CHECK:STDOUT: %.loc18_5.1: Core.IntLiteral = int_value 0 [template = constants.%.7]
  189. // CHECK:STDOUT: %.loc18_5.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.14]
  190. // CHECK:STDOUT: %.loc18_5.3: <bound method> = bound_method %.loc18_5.1, %.loc18_5.2 [template = constants.%.38]
  191. // CHECK:STDOUT: %.loc18_5.4: <specific function> = specific_function %.loc18_5.3, @Convert.2(constants.%.1) [template = constants.%.39]
  192. // CHECK:STDOUT: %int.convert_checked.loc18_5: init %i32 = call %.loc18_5.4(%.loc18_5.1) [template = constants.%.40]
  193. // CHECK:STDOUT: %.loc18_5.5: %i32 = value_of_initializer %int.convert_checked.loc18_5 [template = constants.%.40]
  194. // CHECK:STDOUT: %.loc18_5.6: %i32 = converted %.loc18_5.1, %.loc18_5.5 [template = constants.%.40]
  195. // CHECK:STDOUT: %.loc18_6: ref %i32 = array_index %a.ref.loc18, %.loc18_5.6
  196. // CHECK:STDOUT: %.loc18_10: Core.IntLiteral = int_value 4 [template = constants.%.41]
  197. // CHECK:STDOUT: %.loc18_8.1: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.14]
  198. // CHECK:STDOUT: %.loc18_8.2: <bound method> = bound_method %.loc18_10, %.loc18_8.1 [template = constants.%.42]
  199. // CHECK:STDOUT: %.loc18_8.3: <specific function> = specific_function %.loc18_8.2, @Convert.2(constants.%.1) [template = constants.%.43]
  200. // CHECK:STDOUT: %int.convert_checked.loc18_8: init %i32 = call %.loc18_8.3(%.loc18_10) [template = constants.%.44]
  201. // CHECK:STDOUT: %.loc18_8.4: init %i32 = converted %.loc18_10, %int.convert_checked.loc18_8 [template = constants.%.44]
  202. // CHECK:STDOUT: assign %.loc18_6, %.loc18_8.4
  203. // CHECK:STDOUT: return
  204. // CHECK:STDOUT: }
  205. // CHECK:STDOUT:
  206. // CHECK:STDOUT: fn @ValueBinding(%b.param_patt: %.3) {
  207. // CHECK:STDOUT: !entry:
  208. // CHECK:STDOUT: %.loc22_11.1: Core.IntLiteral = int_value 32 [template = constants.%.1]
  209. // CHECK:STDOUT: %int.make_type_signed.loc22: init type = call constants.%Int(%.loc22_11.1) [template = constants.%i32]
  210. // CHECK:STDOUT: %.loc22_16: Core.IntLiteral = int_value 3 [template = constants.%.2]
  211. // CHECK:STDOUT: %.loc22_11.2: type = value_of_initializer %int.make_type_signed.loc22 [template = constants.%i32]
  212. // CHECK:STDOUT: %.loc22_11.3: type = converted %int.make_type_signed.loc22, %.loc22_11.2 [template = constants.%i32]
  213. // CHECK:STDOUT: %.loc22_17: type = array_type %.loc22_16, %i32 [template = constants.%.3]
  214. // CHECK:STDOUT: %a.var: ref %.3 = var a
  215. // CHECK:STDOUT: %a: ref %.3 = bind_name a, %a.var
  216. // CHECK:STDOUT: %.loc22_22: Core.IntLiteral = int_value 1 [template = constants.%.5]
  217. // CHECK:STDOUT: %.loc22_25: Core.IntLiteral = int_value 2 [template = constants.%.6]
  218. // CHECK:STDOUT: %.loc22_28: Core.IntLiteral = int_value 3 [template = constants.%.2]
  219. // CHECK:STDOUT: %.loc22_29.1: %tuple.type = tuple_literal (%.loc22_22, %.loc22_25, %.loc22_28)
  220. // CHECK:STDOUT: %.loc22_29.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.14]
  221. // CHECK:STDOUT: %.loc22_29.3: <bound method> = bound_method %.loc22_22, %.loc22_29.2 [template = constants.%.28]
  222. // CHECK:STDOUT: %.loc22_29.4: <specific function> = specific_function %.loc22_29.3, @Convert.2(constants.%.1) [template = constants.%.29]
  223. // CHECK:STDOUT: %int.convert_checked.loc22_29.1: init %i32 = call %.loc22_29.4(%.loc22_22) [template = constants.%.30]
  224. // CHECK:STDOUT: %.loc22_29.5: init %i32 = converted %.loc22_22, %int.convert_checked.loc22_29.1 [template = constants.%.30]
  225. // CHECK:STDOUT: %.loc22_29.6: Core.IntLiteral = int_value 0 [template = constants.%.7]
  226. // CHECK:STDOUT: %.loc22_29.7: ref %i32 = array_index %a.var, %.loc22_29.6
  227. // CHECK:STDOUT: %.loc22_29.8: init %i32 = initialize_from %.loc22_29.5 to %.loc22_29.7 [template = constants.%.30]
  228. // CHECK:STDOUT: %.loc22_29.9: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.14]
  229. // CHECK:STDOUT: %.loc22_29.10: <bound method> = bound_method %.loc22_25, %.loc22_29.9 [template = constants.%.31]
  230. // CHECK:STDOUT: %.loc22_29.11: <specific function> = specific_function %.loc22_29.10, @Convert.2(constants.%.1) [template = constants.%.32]
  231. // CHECK:STDOUT: %int.convert_checked.loc22_29.2: init %i32 = call %.loc22_29.11(%.loc22_25) [template = constants.%.33]
  232. // CHECK:STDOUT: %.loc22_29.12: init %i32 = converted %.loc22_25, %int.convert_checked.loc22_29.2 [template = constants.%.33]
  233. // CHECK:STDOUT: %.loc22_29.13: Core.IntLiteral = int_value 1 [template = constants.%.5]
  234. // CHECK:STDOUT: %.loc22_29.14: ref %i32 = array_index %a.var, %.loc22_29.13
  235. // CHECK:STDOUT: %.loc22_29.15: init %i32 = initialize_from %.loc22_29.12 to %.loc22_29.14 [template = constants.%.33]
  236. // CHECK:STDOUT: %.loc22_29.16: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.14]
  237. // CHECK:STDOUT: %.loc22_29.17: <bound method> = bound_method %.loc22_28, %.loc22_29.16 [template = constants.%.34]
  238. // CHECK:STDOUT: %.loc22_29.18: <specific function> = specific_function %.loc22_29.17, @Convert.2(constants.%.1) [template = constants.%.35]
  239. // CHECK:STDOUT: %int.convert_checked.loc22_29.3: init %i32 = call %.loc22_29.18(%.loc22_28) [template = constants.%.36]
  240. // CHECK:STDOUT: %.loc22_29.19: init %i32 = converted %.loc22_28, %int.convert_checked.loc22_29.3 [template = constants.%.36]
  241. // CHECK:STDOUT: %.loc22_29.20: Core.IntLiteral = int_value 2 [template = constants.%.6]
  242. // CHECK:STDOUT: %.loc22_29.21: ref %i32 = array_index %a.var, %.loc22_29.20
  243. // CHECK:STDOUT: %.loc22_29.22: init %i32 = initialize_from %.loc22_29.19 to %.loc22_29.21 [template = constants.%.36]
  244. // CHECK:STDOUT: %.loc22_29.23: init %.3 = array_init (%.loc22_29.8, %.loc22_29.15, %.loc22_29.22) to %a.var [template = constants.%array]
  245. // CHECK:STDOUT: %.loc22_30: init %.3 = converted %.loc22_29.1, %.loc22_29.23 [template = constants.%array]
  246. // CHECK:STDOUT: assign %a.var, %.loc22_30
  247. // CHECK:STDOUT: %a.ref: ref %.3 = name_ref a, %a
  248. // CHECK:STDOUT: %.loc26_5.1: Core.IntLiteral = int_value 0 [template = constants.%.7]
  249. // CHECK:STDOUT: %.loc26_5.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.14]
  250. // CHECK:STDOUT: %.loc26_5.3: <bound method> = bound_method %.loc26_5.1, %.loc26_5.2 [template = constants.%.38]
  251. // CHECK:STDOUT: %.loc26_5.4: <specific function> = specific_function %.loc26_5.3, @Convert.2(constants.%.1) [template = constants.%.39]
  252. // CHECK:STDOUT: %int.convert_checked.loc26: init %i32 = call %.loc26_5.4(%.loc26_5.1) [template = constants.%.40]
  253. // CHECK:STDOUT: %.loc26_5.5: %i32 = value_of_initializer %int.convert_checked.loc26 [template = constants.%.40]
  254. // CHECK:STDOUT: %.loc26_5.6: %i32 = converted %.loc26_5.1, %.loc26_5.5 [template = constants.%.40]
  255. // CHECK:STDOUT: %.loc26_6: ref %i32 = array_index %a.ref, %.loc26_5.6
  256. // CHECK:STDOUT: %b.ref: %.3 = name_ref b, %b
  257. // CHECK:STDOUT: %.loc27_5.1: Core.IntLiteral = int_value 0 [template = constants.%.7]
  258. // CHECK:STDOUT: %.loc27_5.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.14]
  259. // CHECK:STDOUT: %.loc27_5.3: <bound method> = bound_method %.loc27_5.1, %.loc27_5.2 [template = constants.%.38]
  260. // CHECK:STDOUT: %.loc27_5.4: <specific function> = specific_function %.loc27_5.3, @Convert.2(constants.%.1) [template = constants.%.39]
  261. // CHECK:STDOUT: %int.convert_checked.loc27: init %i32 = call %.loc27_5.4(%.loc27_5.1) [template = constants.%.40]
  262. // CHECK:STDOUT: %.loc27_5.5: %i32 = value_of_initializer %int.convert_checked.loc27 [template = constants.%.40]
  263. // CHECK:STDOUT: %.loc27_5.6: %i32 = converted %.loc27_5.1, %.loc27_5.5 [template = constants.%.40]
  264. // CHECK:STDOUT: %.loc27_6.1: ref %.3 = value_as_ref %b.ref
  265. // CHECK:STDOUT: %.loc27_6.2: ref %i32 = array_index %.loc27_6.1, %.loc27_5.6
  266. // CHECK:STDOUT: %.loc27_6.3: %i32 = bind_value %.loc27_6.2
  267. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F]
  268. // CHECK:STDOUT: %.loc28_4.1: ref %.3 = temporary_storage
  269. // CHECK:STDOUT: %F.call: init %.3 = call %F.ref() to %.loc28_4.1
  270. // CHECK:STDOUT: %.loc28_7.1: Core.IntLiteral = int_value 0 [template = constants.%.7]
  271. // CHECK:STDOUT: %.loc28_4.2: ref %.3 = temporary %.loc28_4.1, %F.call
  272. // CHECK:STDOUT: %.loc28_7.2: %Convert.type.2 = interface_witness_access constants.%.27, element0 [template = constants.%Convert.14]
  273. // CHECK:STDOUT: %.loc28_7.3: <bound method> = bound_method %.loc28_7.1, %.loc28_7.2 [template = constants.%.38]
  274. // CHECK:STDOUT: %.loc28_7.4: <specific function> = specific_function %.loc28_7.3, @Convert.2(constants.%.1) [template = constants.%.39]
  275. // CHECK:STDOUT: %int.convert_checked.loc28: init %i32 = call %.loc28_7.4(%.loc28_7.1) [template = constants.%.40]
  276. // CHECK:STDOUT: %.loc28_7.5: %i32 = value_of_initializer %int.convert_checked.loc28 [template = constants.%.40]
  277. // CHECK:STDOUT: %.loc28_7.6: %i32 = converted %.loc28_7.1, %.loc28_7.5 [template = constants.%.40]
  278. // CHECK:STDOUT: %.loc28_8.1: ref %i32 = array_index %.loc28_4.2, %.loc28_7.6
  279. // CHECK:STDOUT: %.loc28_8.2: %i32 = bind_value %.loc28_8.1
  280. // CHECK:STDOUT: return
  281. // CHECK:STDOUT: }
  282. // CHECK:STDOUT: