in_place_tuple_init.carbon 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  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. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/int.carbon
  6. //
  7. // AUTOUPDATE
  8. // TIP: To test this file alone, run:
  9. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/tuple/in_place_tuple_init.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/tuple/in_place_tuple_init.carbon
  12. // --- in_place_tuple_init.carbon
  13. library "[[@TEST_NAME]]";
  14. fn F() -> (i32, i32);
  15. fn G() -> (i32, i32) {
  16. //@dump-sem-ir-begin
  17. var v: (i32, i32) = F();
  18. v = F();
  19. return F();
  20. //@dump-sem-ir-end
  21. }
  22. fn H() -> i32 {
  23. //@dump-sem-ir-begin
  24. return G().0;
  25. //@dump-sem-ir-end
  26. }
  27. // --- nested_tuple_in_place.carbon
  28. library "[[@TEST_NAME]]";
  29. fn F() -> (i32, i32, i32);
  30. fn G() {
  31. //@dump-sem-ir-begin
  32. var v: ((i32, i32, i32), (i32, i32, i32)) = (F(), F());
  33. //@dump-sem-ir-end
  34. }
  35. fn H() {
  36. //@dump-sem-ir-begin
  37. var v: (i32, (i32, i32, i32), i32) = (1, F(), 2);
  38. //@dump-sem-ir-end
  39. }
  40. // CHECK:STDOUT: --- in_place_tuple_init.carbon
  41. // CHECK:STDOUT:
  42. // CHECK:STDOUT: constants {
  43. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  44. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  45. // CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic]
  46. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  47. // CHECK:STDOUT: %tuple.type.24b: type = tuple_type (type, type) [concrete]
  48. // CHECK:STDOUT: %tuple.type.d07: type = tuple_type (%i32, %i32) [concrete]
  49. // CHECK:STDOUT: %pattern_type.511: type = pattern_type %tuple.type.d07 [concrete]
  50. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  51. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  52. // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
  53. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  54. // CHECK:STDOUT: %ptr.261: type = ptr_type %tuple.type.d07 [concrete]
  55. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
  56. // CHECK:STDOUT: %facet_value: %type_where = facet_value %tuple.type.d07, () [concrete]
  57. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.1e3: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value) [concrete]
  58. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.40e: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.1e3 = struct_value () [concrete]
  59. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete]
  60. // CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete]
  61. // CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete]
  62. // CHECK:STDOUT: %Int.as.Copy.impl.Op.type.afd: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%N) [symbolic]
  63. // CHECK:STDOUT: %Int.as.Copy.impl.Op.6cd: %Int.as.Copy.impl.Op.type.afd = struct_value () [symbolic]
  64. // CHECK:STDOUT: %Copy.impl_witness.a32: <witness> = impl_witness imports.%Copy.impl_witness_table.1ed, @Int.as.Copy.impl(%int_32) [concrete]
  65. // CHECK:STDOUT: %Int.as.Copy.impl.Op.type.276: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%int_32) [concrete]
  66. // CHECK:STDOUT: %Int.as.Copy.impl.Op.f59: %Int.as.Copy.impl.Op.type.276 = struct_value () [concrete]
  67. // CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %i32, (%Copy.impl_witness.a32) [concrete]
  68. // CHECK:STDOUT: %.7fa: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet [concrete]
  69. // CHECK:STDOUT: %Int.as.Copy.impl.Op.specific_fn: <specific function> = specific_function %Int.as.Copy.impl.Op.f59, @Int.as.Copy.impl.Op(%int_32) [concrete]
  70. // CHECK:STDOUT: }
  71. // CHECK:STDOUT:
  72. // CHECK:STDOUT: imports {
  73. // CHECK:STDOUT: %Core.import_ref.d0f6: @Int.as.Copy.impl.%Int.as.Copy.impl.Op.type (%Int.as.Copy.impl.Op.type.afd) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Int.as.Copy.impl.%Int.as.Copy.impl.Op (constants.%Int.as.Copy.impl.Op.6cd)]
  74. // CHECK:STDOUT: %Copy.impl_witness_table.1ed = impl_witness_table (%Core.import_ref.d0f6), @Int.as.Copy.impl [concrete]
  75. // CHECK:STDOUT: }
  76. // CHECK:STDOUT:
  77. // CHECK:STDOUT: fn @G() -> %return.param: %tuple.type.d07 {
  78. // CHECK:STDOUT: !entry:
  79. // CHECK:STDOUT: name_binding_decl {
  80. // CHECK:STDOUT: %v.patt: %pattern_type.511 = binding_pattern v [concrete]
  81. // CHECK:STDOUT: %v.var_patt: %pattern_type.511 = var_pattern %v.patt [concrete]
  82. // CHECK:STDOUT: }
  83. // CHECK:STDOUT: %v.var: ref %tuple.type.d07 = var %v.var_patt
  84. // CHECK:STDOUT: %F.ref.loc7: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
  85. // CHECK:STDOUT: %.loc7_3: ref %tuple.type.d07 = splice_block %v.var {}
  86. // CHECK:STDOUT: %F.call.loc7: init %tuple.type.d07 = call %F.ref.loc7() to %.loc7_3
  87. // CHECK:STDOUT: assign %v.var, %F.call.loc7
  88. // CHECK:STDOUT: %.loc7_19.1: type = splice_block %.loc7_19.3 [concrete = constants.%tuple.type.d07] {
  89. // CHECK:STDOUT: %int_32.loc7_11: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  90. // CHECK:STDOUT: %i32.loc7_11: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  91. // CHECK:STDOUT: %int_32.loc7_16: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  92. // CHECK:STDOUT: %i32.loc7_16: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  93. // CHECK:STDOUT: %.loc7_19.2: %tuple.type.24b = tuple_literal (%i32.loc7_11, %i32.loc7_16)
  94. // CHECK:STDOUT: %.loc7_19.3: type = converted %.loc7_19.2, constants.%tuple.type.d07 [concrete = constants.%tuple.type.d07]
  95. // CHECK:STDOUT: }
  96. // CHECK:STDOUT: %v: ref %tuple.type.d07 = bind_name v, %v.var
  97. // CHECK:STDOUT: %v.ref: ref %tuple.type.d07 = name_ref v, %v
  98. // CHECK:STDOUT: %F.ref.loc8: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
  99. // CHECK:STDOUT: %.loc8: ref %tuple.type.d07 = splice_block %v.ref {}
  100. // CHECK:STDOUT: %F.call.loc8: init %tuple.type.d07 = call %F.ref.loc8() to %.loc8
  101. // CHECK:STDOUT: assign %v.ref, %F.call.loc8
  102. // CHECK:STDOUT: %F.ref.loc9: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
  103. // CHECK:STDOUT: <elided>
  104. // CHECK:STDOUT: %F.call.loc9: init %tuple.type.d07 = call %F.ref.loc9() to %.loc5_8
  105. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound: <bound method> = bound_method %v.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.40e
  106. // CHECK:STDOUT: <elided>
  107. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %v.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn
  108. // CHECK:STDOUT: %addr: %ptr.261 = addr_of %v.var
  109. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method(%addr)
  110. // CHECK:STDOUT: return %F.call.loc9 to %return
  111. // CHECK:STDOUT: }
  112. // CHECK:STDOUT:
  113. // CHECK:STDOUT: fn @H() -> %i32 {
  114. // CHECK:STDOUT: !entry:
  115. // CHECK:STDOUT: %G.ref: %G.type = name_ref G, file.%G.decl [concrete = constants.%G]
  116. // CHECK:STDOUT: %.loc15_12.1: ref %tuple.type.d07 = temporary_storage
  117. // CHECK:STDOUT: %G.call: init %tuple.type.d07 = call %G.ref() to %.loc15_12.1
  118. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0]
  119. // CHECK:STDOUT: %.loc15_12.2: ref %tuple.type.d07 = temporary %.loc15_12.1, %G.call
  120. // CHECK:STDOUT: %tuple.elem0: ref %i32 = tuple_access %.loc15_12.2, element0
  121. // CHECK:STDOUT: %.loc15_13: %i32 = bind_value %tuple.elem0
  122. // CHECK:STDOUT: %impl.elem0: %.7fa = impl_witness_access constants.%Copy.impl_witness.a32, element0 [concrete = constants.%Int.as.Copy.impl.Op.f59]
  123. // CHECK:STDOUT: %bound_method.loc15_13.1: <bound method> = bound_method %.loc15_13, %impl.elem0
  124. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  125. // CHECK:STDOUT: %bound_method.loc15_13.2: <bound method> = bound_method %.loc15_13, %specific_fn
  126. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc15_13.2(%.loc15_13)
  127. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound: <bound method> = bound_method %.loc15_12.2, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.40e
  128. // CHECK:STDOUT: <elided>
  129. // CHECK:STDOUT: %bound_method.loc15_12: <bound method> = bound_method %.loc15_12.2, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn
  130. // CHECK:STDOUT: %addr: %ptr.261 = addr_of %.loc15_12.2
  131. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method.loc15_12(%addr)
  132. // CHECK:STDOUT: return %Int.as.Copy.impl.Op.call to %return
  133. // CHECK:STDOUT: }
  134. // CHECK:STDOUT:
  135. // CHECK:STDOUT: --- nested_tuple_in_place.carbon
  136. // CHECK:STDOUT:
  137. // CHECK:STDOUT: constants {
  138. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  139. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  140. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  141. // CHECK:STDOUT: %tuple.type.ff9: type = tuple_type (type, type, type) [concrete]
  142. // CHECK:STDOUT: %tuple.type.189: type = tuple_type (%i32, %i32, %i32) [concrete]
  143. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  144. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  145. // CHECK:STDOUT: %tuple.type.f9f: type = tuple_type (%tuple.type.ff9, %tuple.type.ff9) [concrete]
  146. // CHECK:STDOUT: %tuple.type.99b: type = tuple_type (%tuple.type.189, %tuple.type.189) [concrete]
  147. // CHECK:STDOUT: %pattern_type.d88: type = pattern_type %tuple.type.99b [concrete]
  148. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
  149. // CHECK:STDOUT: %facet_value.207: %type_where = facet_value %tuple.type.99b, () [concrete]
  150. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.a67: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.207) [concrete]
  151. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.4b6: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.a67 = struct_value () [concrete]
  152. // CHECK:STDOUT: %ptr.8bc: type = ptr_type %tuple.type.99b [concrete]
  153. // CHECK:STDOUT: %tuple.type.3a3: type = tuple_type (type, %tuple.type.ff9, type) [concrete]
  154. // CHECK:STDOUT: %tuple.type.516: type = tuple_type (%i32, %tuple.type.189, %i32) [concrete]
  155. // CHECK:STDOUT: %pattern_type.6b5: type = pattern_type %tuple.type.516 [concrete]
  156. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  157. // CHECK:STDOUT: %int_2.ecc: Core.IntLiteral = int_value 2 [concrete]
  158. // CHECK:STDOUT: %tuple.type.667: type = tuple_type (Core.IntLiteral, %tuple.type.189, Core.IntLiteral) [concrete]
  159. // CHECK:STDOUT: %ImplicitAs.type.d14: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  160. // CHECK:STDOUT: %ImplicitAs.Convert.type.1b6: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%i32) [concrete]
  161. // CHECK:STDOUT: %To: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  162. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.340: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%To) [symbolic]
  163. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.1c0: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.340 = struct_value () [symbolic]
  164. // CHECK:STDOUT: %ImplicitAs.impl_witness.204: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.9e9, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  165. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.584: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  166. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.0f0: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.584 = struct_value () [concrete]
  167. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.d14 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.204) [concrete]
  168. // CHECK:STDOUT: %.1df: type = fn_type_with_self_type %ImplicitAs.Convert.type.1b6, %ImplicitAs.facet [concrete]
  169. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.abf: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.ImplicitAs.impl.Convert.0f0 [concrete]
  170. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.ImplicitAs.impl.Convert.0f0, @Core.IntLiteral.as.ImplicitAs.impl.Convert(%int_32) [concrete]
  171. // CHECK:STDOUT: %bound_method.c11: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  172. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  173. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.b82: <bound method> = bound_method %int_2.ecc, %Core.IntLiteral.as.ImplicitAs.impl.Convert.0f0 [concrete]
  174. // CHECK:STDOUT: %bound_method.8bd: <bound method> = bound_method %int_2.ecc, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  175. // CHECK:STDOUT: %int_2.ef8: %i32 = int_value 2 [concrete]
  176. // CHECK:STDOUT: %facet_value.edd: %type_where = facet_value %tuple.type.516, () [concrete]
  177. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.454: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.edd) [concrete]
  178. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.903: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.454 = struct_value () [concrete]
  179. // CHECK:STDOUT: %ptr.12e: type = ptr_type %tuple.type.516 [concrete]
  180. // CHECK:STDOUT: }
  181. // CHECK:STDOUT:
  182. // CHECK:STDOUT: imports {
  183. // CHECK:STDOUT: %Core.import_ref.ee7: @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.340) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert (constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.1c0)]
  184. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.9e9 = impl_witness_table (%Core.import_ref.ee7), @Core.IntLiteral.as.ImplicitAs.impl [concrete]
  185. // CHECK:STDOUT: }
  186. // CHECK:STDOUT:
  187. // CHECK:STDOUT: fn @G() {
  188. // CHECK:STDOUT: !entry:
  189. // CHECK:STDOUT: name_binding_decl {
  190. // CHECK:STDOUT: %v.patt: %pattern_type.d88 = binding_pattern v [concrete]
  191. // CHECK:STDOUT: %v.var_patt: %pattern_type.d88 = var_pattern %v.patt [concrete]
  192. // CHECK:STDOUT: }
  193. // CHECK:STDOUT: %v.var: ref %tuple.type.99b = var %v.var_patt
  194. // CHECK:STDOUT: %F.ref.loc7_48: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
  195. // CHECK:STDOUT: %tuple.elem0: ref %tuple.type.189 = tuple_access %v.var, element0
  196. // CHECK:STDOUT: %F.call.loc7_50: init %tuple.type.189 = call %F.ref.loc7_48() to %tuple.elem0
  197. // CHECK:STDOUT: %F.ref.loc7_53: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
  198. // CHECK:STDOUT: %tuple.elem1: ref %tuple.type.189 = tuple_access %v.var, element1
  199. // CHECK:STDOUT: %F.call.loc7_55: init %tuple.type.189 = call %F.ref.loc7_53() to %tuple.elem1
  200. // CHECK:STDOUT: %.loc7_56.1: %tuple.type.99b = tuple_literal (%F.call.loc7_50, %F.call.loc7_55)
  201. // CHECK:STDOUT: %.loc7_56.2: init %tuple.type.99b = tuple_init (%F.call.loc7_50, %F.call.loc7_55) to %v.var
  202. // CHECK:STDOUT: %.loc7_3: init %tuple.type.99b = converted %.loc7_56.1, %.loc7_56.2
  203. // CHECK:STDOUT: assign %v.var, %.loc7_3
  204. // CHECK:STDOUT: %.loc7_43.1: type = splice_block %.loc7_43.5 [concrete = constants.%tuple.type.99b] {
  205. // CHECK:STDOUT: %int_32.loc7_12: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  206. // CHECK:STDOUT: %i32.loc7_12: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  207. // CHECK:STDOUT: %int_32.loc7_17: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  208. // CHECK:STDOUT: %i32.loc7_17: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  209. // CHECK:STDOUT: %int_32.loc7_22: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  210. // CHECK:STDOUT: %i32.loc7_22: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  211. // CHECK:STDOUT: %.loc7_25: %tuple.type.ff9 = tuple_literal (%i32.loc7_12, %i32.loc7_17, %i32.loc7_22)
  212. // CHECK:STDOUT: %int_32.loc7_29: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  213. // CHECK:STDOUT: %i32.loc7_29: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  214. // CHECK:STDOUT: %int_32.loc7_34: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  215. // CHECK:STDOUT: %i32.loc7_34: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  216. // CHECK:STDOUT: %int_32.loc7_39: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  217. // CHECK:STDOUT: %i32.loc7_39: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  218. // CHECK:STDOUT: %.loc7_42: %tuple.type.ff9 = tuple_literal (%i32.loc7_29, %i32.loc7_34, %i32.loc7_39)
  219. // CHECK:STDOUT: %.loc7_43.2: %tuple.type.f9f = tuple_literal (%.loc7_25, %.loc7_42)
  220. // CHECK:STDOUT: %.loc7_43.3: type = converted %.loc7_25, constants.%tuple.type.189 [concrete = constants.%tuple.type.189]
  221. // CHECK:STDOUT: %.loc7_43.4: type = converted %.loc7_42, constants.%tuple.type.189 [concrete = constants.%tuple.type.189]
  222. // CHECK:STDOUT: %.loc7_43.5: type = converted %.loc7_43.2, constants.%tuple.type.99b [concrete = constants.%tuple.type.99b]
  223. // CHECK:STDOUT: }
  224. // CHECK:STDOUT: %v: ref %tuple.type.99b = bind_name v, %v.var
  225. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound: <bound method> = bound_method %v.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.4b6
  226. // CHECK:STDOUT: <elided>
  227. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %v.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn
  228. // CHECK:STDOUT: %addr: %ptr.8bc = addr_of %v.var
  229. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method(%addr)
  230. // CHECK:STDOUT: <elided>
  231. // CHECK:STDOUT: }
  232. // CHECK:STDOUT:
  233. // CHECK:STDOUT: fn @H() {
  234. // CHECK:STDOUT: !entry:
  235. // CHECK:STDOUT: name_binding_decl {
  236. // CHECK:STDOUT: %v.patt: %pattern_type.6b5 = binding_pattern v [concrete]
  237. // CHECK:STDOUT: %v.var_patt: %pattern_type.6b5 = var_pattern %v.patt [concrete]
  238. // CHECK:STDOUT: }
  239. // CHECK:STDOUT: %v.var: ref %tuple.type.516 = var %v.var_patt
  240. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  241. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
  242. // CHECK:STDOUT: %tuple.elem1: ref %tuple.type.189 = tuple_access %v.var, element1
  243. // CHECK:STDOUT: %F.call: init %tuple.type.189 = call %F.ref() to %tuple.elem1
  244. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc]
  245. // CHECK:STDOUT: %.loc13_50.1: %tuple.type.667 = tuple_literal (%int_1, %F.call, %int_2)
  246. // CHECK:STDOUT: %impl.elem0.loc13_50.1: %.1df = impl_witness_access constants.%ImplicitAs.impl_witness.204, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0f0]
  247. // CHECK:STDOUT: %bound_method.loc13_50.1: <bound method> = bound_method %int_1, %impl.elem0.loc13_50.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.abf]
  248. // CHECK:STDOUT: %specific_fn.loc13_50.1: <specific function> = specific_function %impl.elem0.loc13_50.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  249. // CHECK:STDOUT: %bound_method.loc13_50.2: <bound method> = bound_method %int_1, %specific_fn.loc13_50.1 [concrete = constants.%bound_method.c11]
  250. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc13_50.1: init %i32 = call %bound_method.loc13_50.2(%int_1) [concrete = constants.%int_1.5d2]
  251. // CHECK:STDOUT: %.loc13_50.2: init %i32 = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc13_50.1 [concrete = constants.%int_1.5d2]
  252. // CHECK:STDOUT: %tuple.elem0: ref %i32 = tuple_access %v.var, element0
  253. // CHECK:STDOUT: %.loc13_50.3: init %i32 = initialize_from %.loc13_50.2 to %tuple.elem0 [concrete = constants.%int_1.5d2]
  254. // CHECK:STDOUT: %impl.elem0.loc13_50.2: %.1df = impl_witness_access constants.%ImplicitAs.impl_witness.204, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0f0]
  255. // CHECK:STDOUT: %bound_method.loc13_50.3: <bound method> = bound_method %int_2, %impl.elem0.loc13_50.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.b82]
  256. // CHECK:STDOUT: %specific_fn.loc13_50.2: <specific function> = specific_function %impl.elem0.loc13_50.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  257. // CHECK:STDOUT: %bound_method.loc13_50.4: <bound method> = bound_method %int_2, %specific_fn.loc13_50.2 [concrete = constants.%bound_method.8bd]
  258. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc13_50.2: init %i32 = call %bound_method.loc13_50.4(%int_2) [concrete = constants.%int_2.ef8]
  259. // CHECK:STDOUT: %.loc13_50.4: init %i32 = converted %int_2, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc13_50.2 [concrete = constants.%int_2.ef8]
  260. // CHECK:STDOUT: %tuple.elem2: ref %i32 = tuple_access %v.var, element2
  261. // CHECK:STDOUT: %.loc13_50.5: init %i32 = initialize_from %.loc13_50.4 to %tuple.elem2 [concrete = constants.%int_2.ef8]
  262. // CHECK:STDOUT: %.loc13_50.6: init %tuple.type.516 = tuple_init (%.loc13_50.3, %F.call, %.loc13_50.5) to %v.var
  263. // CHECK:STDOUT: %.loc13_3: init %tuple.type.516 = converted %.loc13_50.1, %.loc13_50.6
  264. // CHECK:STDOUT: assign %v.var, %.loc13_3
  265. // CHECK:STDOUT: %.loc13_36.1: type = splice_block %.loc13_36.4 [concrete = constants.%tuple.type.516] {
  266. // CHECK:STDOUT: %int_32.loc13_11: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  267. // CHECK:STDOUT: %i32.loc13_11: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  268. // CHECK:STDOUT: %int_32.loc13_17: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  269. // CHECK:STDOUT: %i32.loc13_17: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  270. // CHECK:STDOUT: %int_32.loc13_22: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  271. // CHECK:STDOUT: %i32.loc13_22: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  272. // CHECK:STDOUT: %int_32.loc13_27: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  273. // CHECK:STDOUT: %i32.loc13_27: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  274. // CHECK:STDOUT: %.loc13_30: %tuple.type.ff9 = tuple_literal (%i32.loc13_17, %i32.loc13_22, %i32.loc13_27)
  275. // CHECK:STDOUT: %int_32.loc13_33: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  276. // CHECK:STDOUT: %i32.loc13_33: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  277. // CHECK:STDOUT: %.loc13_36.2: %tuple.type.3a3 = tuple_literal (%i32.loc13_11, %.loc13_30, %i32.loc13_33)
  278. // CHECK:STDOUT: %.loc13_36.3: type = converted %.loc13_30, constants.%tuple.type.189 [concrete = constants.%tuple.type.189]
  279. // CHECK:STDOUT: %.loc13_36.4: type = converted %.loc13_36.2, constants.%tuple.type.516 [concrete = constants.%tuple.type.516]
  280. // CHECK:STDOUT: }
  281. // CHECK:STDOUT: %v: ref %tuple.type.516 = bind_name v, %v.var
  282. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound: <bound method> = bound_method %v.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.903
  283. // CHECK:STDOUT: <elided>
  284. // CHECK:STDOUT: %bound_method.loc13_3: <bound method> = bound_method %v.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn
  285. // CHECK:STDOUT: %addr: %ptr.12e = addr_of %v.var
  286. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method.loc13_3(%addr)
  287. // CHECK:STDOUT: <elided>
  288. // CHECK:STDOUT: }
  289. // CHECK:STDOUT: