adapt_copy.carbon 98 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197
  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/uint.carbon
  6. // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
  7. // EXTRA-ARGS: --dump-sem-ir-ranges=if-present
  8. //
  9. // AUTOUPDATE
  10. // TIP: To test this file alone, run:
  11. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/adapter/adapt_copy.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/adapter/adapt_copy.carbon
  14. // TODO: Decide whether an adapter for a copyable type is copyable. As
  15. // demonstrated in this test, our behavior is currently inconsistent.
  16. // --- fail_adapt_copyable.carbon
  17. library "[[@TEST_NAME]]";
  18. class AdaptCopyable {
  19. adapt i32;
  20. }
  21. fn F(c: AdaptCopyable) -> AdaptCopyable {
  22. // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+7]]:26: error: cannot copy value of type `AdaptCopyable` [CopyOfUncopyableType]
  23. // CHECK:STDERR: var d: AdaptCopyable = c;
  24. // CHECK:STDERR: ^
  25. // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+4]]:26: note: type `AdaptCopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote]
  26. // CHECK:STDERR: var d: AdaptCopyable = c;
  27. // CHECK:STDERR: ^
  28. // CHECK:STDERR:
  29. var d: AdaptCopyable = c;
  30. // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+7]]:10: error: cannot copy value of type `AdaptCopyable` [CopyOfUncopyableType]
  31. // CHECK:STDERR: return d;
  32. // CHECK:STDERR: ^
  33. // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+4]]:10: note: type `AdaptCopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote]
  34. // CHECK:STDERR: return d;
  35. // CHECK:STDERR: ^
  36. // CHECK:STDERR:
  37. return d;
  38. }
  39. fn InTuple(c: (AdaptCopyable, u32)) -> (AdaptCopyable, u32) {
  40. // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+7]]:33: error: cannot copy value of type `AdaptCopyable` [CopyOfUncopyableType]
  41. // CHECK:STDERR: var d: (AdaptCopyable, u32) = c;
  42. // CHECK:STDERR: ^
  43. // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+4]]:33: note: type `AdaptCopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote]
  44. // CHECK:STDERR: var d: (AdaptCopyable, u32) = c;
  45. // CHECK:STDERR: ^
  46. // CHECK:STDERR:
  47. var d: (AdaptCopyable, u32) = c;
  48. // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+7]]:10: error: cannot copy value of type `AdaptCopyable` [CopyOfUncopyableType]
  49. // CHECK:STDERR: return d;
  50. // CHECK:STDERR: ^
  51. // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+4]]:10: note: type `AdaptCopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote]
  52. // CHECK:STDERR: return d;
  53. // CHECK:STDERR: ^
  54. // CHECK:STDERR:
  55. return d;
  56. }
  57. // --- adapt_copyable_tuple.carbon
  58. library "[[@TEST_NAME]]";
  59. class AdaptTuple {
  60. adapt (i32, i32);
  61. }
  62. fn F(c: AdaptTuple) -> AdaptTuple {
  63. var d: AdaptTuple = c;
  64. return d;
  65. }
  66. fn InTuple(c: (AdaptTuple, u32)) -> (AdaptTuple, u32) {
  67. var d: (AdaptTuple, u32) = c;
  68. return d;
  69. }
  70. // --- fail_adapt_not_copyable.carbon
  71. library "[[@TEST_NAME]]";
  72. class Noncopyable {
  73. // TODO: Ensure this remains non-copyable once we have rules for class copyability.
  74. }
  75. class AdaptNoncopyable {
  76. adapt Noncopyable;
  77. }
  78. fn G(a: AdaptNoncopyable) -> AdaptNoncopyable {
  79. // CHECK:STDERR: fail_adapt_not_copyable.carbon:[[@LINE+7]]:29: error: cannot copy value of type `AdaptNoncopyable` [CopyOfUncopyableType]
  80. // CHECK:STDERR: var b: AdaptNoncopyable = a;
  81. // CHECK:STDERR: ^
  82. // CHECK:STDERR: fail_adapt_not_copyable.carbon:[[@LINE+4]]:29: note: type `AdaptNoncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote]
  83. // CHECK:STDERR: var b: AdaptNoncopyable = a;
  84. // CHECK:STDERR: ^
  85. // CHECK:STDERR:
  86. var b: AdaptNoncopyable = a;
  87. // CHECK:STDERR: fail_adapt_not_copyable.carbon:[[@LINE+7]]:10: error: cannot copy value of type `AdaptNoncopyable` [CopyOfUncopyableType]
  88. // CHECK:STDERR: return b;
  89. // CHECK:STDERR: ^
  90. // CHECK:STDERR: fail_adapt_not_copyable.carbon:[[@LINE+4]]:10: note: type `AdaptNoncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote]
  91. // CHECK:STDERR: return b;
  92. // CHECK:STDERR: ^
  93. // CHECK:STDERR:
  94. return b;
  95. }
  96. // --- fail_adapt_not_copyable_indirect.carbon
  97. library "[[@TEST_NAME]]";
  98. class Noncopyable {
  99. // TODO: Ensure this remains non-copyable once we have rules for class copyability.
  100. }
  101. class AdaptNoncopyableIndirect {
  102. adapt (i32, Noncopyable, i32);
  103. }
  104. fn H(a: AdaptNoncopyableIndirect) -> AdaptNoncopyableIndirect {
  105. // CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+10]]:3: error: cannot copy value of type `Noncopyable` [CopyOfUncopyableType]
  106. // CHECK:STDERR: var b: AdaptNoncopyableIndirect = a;
  107. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  108. // CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+7]]:3: note: type `Noncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote]
  109. // CHECK:STDERR: var b: AdaptNoncopyableIndirect = a;
  110. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  111. // CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+4]]:37: note: in copy of `AdaptNoncopyableIndirect` [InCopy]
  112. // CHECK:STDERR: var b: AdaptNoncopyableIndirect = a;
  113. // CHECK:STDERR: ^
  114. // CHECK:STDERR:
  115. var b: AdaptNoncopyableIndirect = a;
  116. // CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+10]]:3: error: cannot copy value of type `Noncopyable` [CopyOfUncopyableType]
  117. // CHECK:STDERR: return b;
  118. // CHECK:STDERR: ^~~~~~~~~
  119. // CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+7]]:3: note: type `Noncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessNote]
  120. // CHECK:STDERR: return b;
  121. // CHECK:STDERR: ^~~~~~~~~
  122. // CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+4]]:10: note: in copy of `AdaptNoncopyableIndirect` [InCopy]
  123. // CHECK:STDERR: return b;
  124. // CHECK:STDERR: ^
  125. // CHECK:STDERR:
  126. return b;
  127. }
  128. // --- adapt_copyable_struct.carbon
  129. library "[[@TEST_NAME]]";
  130. class AdaptStruct {
  131. adapt {.e: i32, .f: i32};
  132. }
  133. fn I(g: AdaptStruct) -> AdaptStruct {
  134. var h: AdaptStruct = g;
  135. return h;
  136. }
  137. fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) {
  138. var d: (AdaptStruct, u32) = c;
  139. return d;
  140. }
  141. // CHECK:STDOUT: --- fail_adapt_copyable.carbon
  142. // CHECK:STDOUT:
  143. // CHECK:STDOUT: constants {
  144. // CHECK:STDOUT: %AdaptCopyable: type = class_type @AdaptCopyable [concrete]
  145. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  146. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  147. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  148. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  149. // CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic]
  150. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  151. // CHECK:STDOUT: %i32.builtin: type = int_type signed, %int_32 [concrete]
  152. // CHECK:STDOUT: %complete_type.f8a: <witness> = complete_type_witness %i32.builtin [concrete]
  153. // CHECK:STDOUT: %pattern_type.cdf: type = pattern_type %AdaptCopyable [concrete]
  154. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  155. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  156. // CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete]
  157. // CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete]
  158. // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
  159. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
  160. // CHECK:STDOUT: %facet_value.567: %type_where = facet_value %AdaptCopyable, () [concrete]
  161. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.ab6: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.567) [concrete]
  162. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.dd7: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.ab6 = struct_value () [concrete]
  163. // CHECK:STDOUT: %ptr.4c1: type = ptr_type %AdaptCopyable [concrete]
  164. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.166: <specific function> = specific_function %DestroyT.binding.as_type.as.Destroy.impl.Op.dd7, @DestroyT.binding.as_type.as.Destroy.impl.Op(%facet_value.567) [concrete]
  165. // CHECK:STDOUT: %UInt.type: type = generic_class_type @UInt [concrete]
  166. // CHECK:STDOUT: %UInt.generic: %UInt.type = struct_value () [concrete]
  167. // CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(%int_32) [concrete]
  168. // CHECK:STDOUT: %tuple.type.24b: type = tuple_type (type, type) [concrete]
  169. // CHECK:STDOUT: %tuple.type.2a3: type = tuple_type (%AdaptCopyable, %u32) [concrete]
  170. // CHECK:STDOUT: %pattern_type.813: type = pattern_type %tuple.type.2a3 [concrete]
  171. // CHECK:STDOUT: %InTuple.type: type = fn_type @InTuple [concrete]
  172. // CHECK:STDOUT: %InTuple: %InTuple.type = struct_value () [concrete]
  173. // CHECK:STDOUT: %ptr.c30: type = ptr_type %tuple.type.2a3 [concrete]
  174. // CHECK:STDOUT: %UInt.as.Copy.impl.Op.type.cb3: type = fn_type @UInt.as.Copy.impl.Op, @UInt.as.Copy.impl(%N) [symbolic]
  175. // CHECK:STDOUT: %UInt.as.Copy.impl.Op.ee7: %UInt.as.Copy.impl.Op.type.cb3 = struct_value () [symbolic]
  176. // CHECK:STDOUT: %Copy.impl_witness.61c: <witness> = impl_witness imports.%Copy.impl_witness_table.46a, @UInt.as.Copy.impl(%int_32) [concrete]
  177. // CHECK:STDOUT: %UInt.as.Copy.impl.Op.type.31e: type = fn_type @UInt.as.Copy.impl.Op, @UInt.as.Copy.impl(%int_32) [concrete]
  178. // CHECK:STDOUT: %UInt.as.Copy.impl.Op.1bb: %UInt.as.Copy.impl.Op.type.31e = struct_value () [concrete]
  179. // CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %u32, (%Copy.impl_witness.61c) [concrete]
  180. // CHECK:STDOUT: %.fbf: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet [concrete]
  181. // CHECK:STDOUT: %UInt.as.Copy.impl.Op.specific_fn: <specific function> = specific_function %UInt.as.Copy.impl.Op.1bb, @UInt.as.Copy.impl.Op(%int_32) [concrete]
  182. // CHECK:STDOUT: %facet_value.6a4: %type_where = facet_value %tuple.type.2a3, () [concrete]
  183. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.fb2: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.6a4) [concrete]
  184. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.4b1: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.fb2 = struct_value () [concrete]
  185. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.272: <specific function> = specific_function %DestroyT.binding.as_type.as.Destroy.impl.Op.4b1, @DestroyT.binding.as_type.as.Destroy.impl.Op(%facet_value.6a4) [concrete]
  186. // CHECK:STDOUT: }
  187. // CHECK:STDOUT:
  188. // CHECK:STDOUT: imports {
  189. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  190. // CHECK:STDOUT: .Int = %Core.Int
  191. // CHECK:STDOUT: .Copy = %Core.Copy
  192. // CHECK:STDOUT: .Destroy = %Core.Destroy
  193. // CHECK:STDOUT: .UInt = %Core.UInt
  194. // CHECK:STDOUT: import Core//prelude
  195. // CHECK:STDOUT: import Core//prelude/...
  196. // CHECK:STDOUT: }
  197. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  198. // CHECK:STDOUT: %Core.Copy: type = import_ref Core//prelude/parts/copy, Copy, loaded [concrete = constants.%Copy.type]
  199. // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type]
  200. // CHECK:STDOUT: %Core.UInt: %UInt.type = import_ref Core//prelude/parts/uint, UInt, loaded [concrete = constants.%UInt.generic]
  201. // CHECK:STDOUT: %Core.import_ref.ba6: @UInt.as.Copy.impl.%UInt.as.Copy.impl.Op.type (%UInt.as.Copy.impl.Op.type.cb3) = import_ref Core//prelude/parts/uint, loc{{\d+_\d+}}, loaded [symbolic = @UInt.as.Copy.impl.%UInt.as.Copy.impl.Op (constants.%UInt.as.Copy.impl.Op.ee7)]
  202. // CHECK:STDOUT: %Copy.impl_witness_table.46a = impl_witness_table (%Core.import_ref.ba6), @UInt.as.Copy.impl [concrete]
  203. // CHECK:STDOUT: }
  204. // CHECK:STDOUT:
  205. // CHECK:STDOUT: file {
  206. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  207. // CHECK:STDOUT: .Core = imports.%Core
  208. // CHECK:STDOUT: .AdaptCopyable = %AdaptCopyable.decl
  209. // CHECK:STDOUT: .F = %F.decl
  210. // CHECK:STDOUT: .InTuple = %InTuple.decl
  211. // CHECK:STDOUT: }
  212. // CHECK:STDOUT: %Core.import = import Core
  213. // CHECK:STDOUT: %AdaptCopyable.decl: type = class_decl @AdaptCopyable [concrete = constants.%AdaptCopyable] {} {}
  214. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  215. // CHECK:STDOUT: %c.patt: %pattern_type.cdf = binding_pattern c [concrete]
  216. // CHECK:STDOUT: %c.param_patt: %pattern_type.cdf = value_param_pattern %c.patt, call_param0 [concrete]
  217. // CHECK:STDOUT: %return.patt: %pattern_type.cdf = return_slot_pattern [concrete]
  218. // CHECK:STDOUT: %return.param_patt: %pattern_type.cdf = out_param_pattern %return.patt, call_param1 [concrete]
  219. // CHECK:STDOUT: } {
  220. // CHECK:STDOUT: %AdaptCopyable.ref.loc8_27: type = name_ref AdaptCopyable, file.%AdaptCopyable.decl [concrete = constants.%AdaptCopyable]
  221. // CHECK:STDOUT: %c.param: %AdaptCopyable = value_param call_param0
  222. // CHECK:STDOUT: %AdaptCopyable.ref.loc8_9: type = name_ref AdaptCopyable, file.%AdaptCopyable.decl [concrete = constants.%AdaptCopyable]
  223. // CHECK:STDOUT: %c: %AdaptCopyable = bind_name c, %c.param
  224. // CHECK:STDOUT: %return.param: ref %AdaptCopyable = out_param call_param1
  225. // CHECK:STDOUT: %return: ref %AdaptCopyable = return_slot %return.param
  226. // CHECK:STDOUT: }
  227. // CHECK:STDOUT: %InTuple.decl: %InTuple.type = fn_decl @InTuple [concrete = constants.%InTuple] {
  228. // CHECK:STDOUT: %c.patt: %pattern_type.813 = binding_pattern c [concrete]
  229. // CHECK:STDOUT: %c.param_patt: %pattern_type.813 = value_param_pattern %c.patt, call_param0 [concrete]
  230. // CHECK:STDOUT: %return.patt: %pattern_type.813 = return_slot_pattern [concrete]
  231. // CHECK:STDOUT: %return.param_patt: %pattern_type.813 = out_param_pattern %return.patt, call_param1 [concrete]
  232. // CHECK:STDOUT: } {
  233. // CHECK:STDOUT: %AdaptCopyable.ref.loc27_41: type = name_ref AdaptCopyable, file.%AdaptCopyable.decl [concrete = constants.%AdaptCopyable]
  234. // CHECK:STDOUT: %int_32.loc27_56: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  235. // CHECK:STDOUT: %u32.loc27_56: type = class_type @UInt, @UInt(constants.%int_32) [concrete = constants.%u32]
  236. // CHECK:STDOUT: %.loc27_59.1: %tuple.type.24b = tuple_literal (%AdaptCopyable.ref.loc27_41, %u32.loc27_56)
  237. // CHECK:STDOUT: %.loc27_59.2: type = converted %.loc27_59.1, constants.%tuple.type.2a3 [concrete = constants.%tuple.type.2a3]
  238. // CHECK:STDOUT: %c.param: %tuple.type.2a3 = value_param call_param0
  239. // CHECK:STDOUT: %.loc27_34.1: type = splice_block %.loc27_34.3 [concrete = constants.%tuple.type.2a3] {
  240. // CHECK:STDOUT: %AdaptCopyable.ref.loc27_16: type = name_ref AdaptCopyable, file.%AdaptCopyable.decl [concrete = constants.%AdaptCopyable]
  241. // CHECK:STDOUT: %int_32.loc27_31: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  242. // CHECK:STDOUT: %u32.loc27_31: type = class_type @UInt, @UInt(constants.%int_32) [concrete = constants.%u32]
  243. // CHECK:STDOUT: %.loc27_34.2: %tuple.type.24b = tuple_literal (%AdaptCopyable.ref.loc27_16, %u32.loc27_31)
  244. // CHECK:STDOUT: %.loc27_34.3: type = converted %.loc27_34.2, constants.%tuple.type.2a3 [concrete = constants.%tuple.type.2a3]
  245. // CHECK:STDOUT: }
  246. // CHECK:STDOUT: %c: %tuple.type.2a3 = bind_name c, %c.param
  247. // CHECK:STDOUT: %return.param: ref %tuple.type.2a3 = out_param call_param1
  248. // CHECK:STDOUT: %return: ref %tuple.type.2a3 = return_slot %return.param
  249. // CHECK:STDOUT: }
  250. // CHECK:STDOUT: }
  251. // CHECK:STDOUT:
  252. // CHECK:STDOUT: class @AdaptCopyable {
  253. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  254. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  255. // CHECK:STDOUT: adapt_decl %i32 [concrete]
  256. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%i32.builtin [concrete = constants.%complete_type.f8a]
  257. // CHECK:STDOUT: complete_type_witness = %complete_type
  258. // CHECK:STDOUT:
  259. // CHECK:STDOUT: !members:
  260. // CHECK:STDOUT: .Self = constants.%AdaptCopyable
  261. // CHECK:STDOUT: }
  262. // CHECK:STDOUT:
  263. // CHECK:STDOUT: fn @F(%c.param: %AdaptCopyable) -> %AdaptCopyable {
  264. // CHECK:STDOUT: !entry:
  265. // CHECK:STDOUT: name_binding_decl {
  266. // CHECK:STDOUT: %d.patt: %pattern_type.cdf = binding_pattern d [concrete]
  267. // CHECK:STDOUT: %d.var_patt: %pattern_type.cdf = var_pattern %d.patt [concrete]
  268. // CHECK:STDOUT: }
  269. // CHECK:STDOUT: %d.var: ref %AdaptCopyable = var %d.var_patt
  270. // CHECK:STDOUT: %c.ref: %AdaptCopyable = name_ref c, %c
  271. // CHECK:STDOUT: assign %d.var, <error>
  272. // CHECK:STDOUT: %AdaptCopyable.ref.loc16: type = name_ref AdaptCopyable, file.%AdaptCopyable.decl [concrete = constants.%AdaptCopyable]
  273. // CHECK:STDOUT: %d: ref %AdaptCopyable = bind_name d, %d.var
  274. // CHECK:STDOUT: %d.ref: ref %AdaptCopyable = name_ref d, %d
  275. // CHECK:STDOUT: %.loc24: %AdaptCopyable = bind_value %d.ref
  276. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound: <bound method> = bound_method %d.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.dd7
  277. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn: <specific function> = specific_function constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.dd7, @DestroyT.binding.as_type.as.Destroy.impl.Op(constants.%facet_value.567) [concrete = constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.166]
  278. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %d.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn
  279. // CHECK:STDOUT: %addr: %ptr.4c1 = addr_of %d.var
  280. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method(%addr)
  281. // CHECK:STDOUT: return <error> to %return
  282. // CHECK:STDOUT: }
  283. // CHECK:STDOUT:
  284. // CHECK:STDOUT: fn @InTuple(%c.param: %tuple.type.2a3) -> %return.param: %tuple.type.2a3 {
  285. // CHECK:STDOUT: !entry:
  286. // CHECK:STDOUT: name_binding_decl {
  287. // CHECK:STDOUT: %d.patt: %pattern_type.813 = binding_pattern d [concrete]
  288. // CHECK:STDOUT: %d.var_patt: %pattern_type.813 = var_pattern %d.patt [concrete]
  289. // CHECK:STDOUT: }
  290. // CHECK:STDOUT: %d.var: ref %tuple.type.2a3 = var %d.var_patt
  291. // CHECK:STDOUT: %c.ref: %tuple.type.2a3 = name_ref c, %c
  292. // CHECK:STDOUT: %tuple.elem0.loc35_33.1: %AdaptCopyable = tuple_access %c.ref, element0
  293. // CHECK:STDOUT: %tuple.elem0.loc35_33.2: ref %AdaptCopyable = tuple_access %d.var, element0
  294. // CHECK:STDOUT: %.loc35_33.1: init %AdaptCopyable = initialize_from <error> to %tuple.elem0.loc35_33.2 [concrete = <error>]
  295. // CHECK:STDOUT: %tuple.elem1.loc35_33.1: %u32 = tuple_access %c.ref, element1
  296. // CHECK:STDOUT: %impl.elem0.loc35: %.fbf = impl_witness_access constants.%Copy.impl_witness.61c, element0 [concrete = constants.%UInt.as.Copy.impl.Op.1bb]
  297. // CHECK:STDOUT: %bound_method.loc35_33.1: <bound method> = bound_method %tuple.elem1.loc35_33.1, %impl.elem0.loc35
  298. // CHECK:STDOUT: %specific_fn.loc35: <specific function> = specific_function %impl.elem0.loc35, @UInt.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%UInt.as.Copy.impl.Op.specific_fn]
  299. // CHECK:STDOUT: %bound_method.loc35_33.2: <bound method> = bound_method %tuple.elem1.loc35_33.1, %specific_fn.loc35
  300. // CHECK:STDOUT: %UInt.as.Copy.impl.Op.call.loc35: init %u32 = call %bound_method.loc35_33.2(%tuple.elem1.loc35_33.1)
  301. // CHECK:STDOUT: %tuple.elem1.loc35_33.2: ref %u32 = tuple_access %d.var, element1
  302. // CHECK:STDOUT: %.loc35_33.2: init %u32 = initialize_from %UInt.as.Copy.impl.Op.call.loc35 to %tuple.elem1.loc35_33.2
  303. // CHECK:STDOUT: %.loc35_33.3: init %tuple.type.2a3 = tuple_init (%.loc35_33.1, %.loc35_33.2) to %d.var
  304. // CHECK:STDOUT: %.loc35_3: init %tuple.type.2a3 = converted %c.ref, %.loc35_33.3
  305. // CHECK:STDOUT: assign %d.var, %.loc35_3
  306. // CHECK:STDOUT: %.loc35_29.1: type = splice_block %.loc35_29.3 [concrete = constants.%tuple.type.2a3] {
  307. // CHECK:STDOUT: %AdaptCopyable.ref.loc35: type = name_ref AdaptCopyable, file.%AdaptCopyable.decl [concrete = constants.%AdaptCopyable]
  308. // CHECK:STDOUT: %int_32.loc35: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  309. // CHECK:STDOUT: %u32.loc35: type = class_type @UInt, @UInt(constants.%int_32) [concrete = constants.%u32]
  310. // CHECK:STDOUT: %.loc35_29.2: %tuple.type.24b = tuple_literal (%AdaptCopyable.ref.loc35, %u32.loc35)
  311. // CHECK:STDOUT: %.loc35_29.3: type = converted %.loc35_29.2, constants.%tuple.type.2a3 [concrete = constants.%tuple.type.2a3]
  312. // CHECK:STDOUT: }
  313. // CHECK:STDOUT: %d: ref %tuple.type.2a3 = bind_name d, %d.var
  314. // CHECK:STDOUT: %d.ref: ref %tuple.type.2a3 = name_ref d, %d
  315. // CHECK:STDOUT: %tuple.elem0.loc43_10.1: ref %AdaptCopyable = tuple_access %d.ref, element0
  316. // CHECK:STDOUT: %.loc43_10.1: %AdaptCopyable = bind_value %tuple.elem0.loc43_10.1
  317. // CHECK:STDOUT: %tuple.elem0.loc43_10.2: ref %AdaptCopyable = tuple_access %return, element0
  318. // CHECK:STDOUT: %.loc43_10.2: init %AdaptCopyable = initialize_from <error> to %tuple.elem0.loc43_10.2 [concrete = <error>]
  319. // CHECK:STDOUT: %tuple.elem1.loc43_10.1: ref %u32 = tuple_access %d.ref, element1
  320. // CHECK:STDOUT: %.loc43_10.3: %u32 = bind_value %tuple.elem1.loc43_10.1
  321. // CHECK:STDOUT: %impl.elem0.loc43: %.fbf = impl_witness_access constants.%Copy.impl_witness.61c, element0 [concrete = constants.%UInt.as.Copy.impl.Op.1bb]
  322. // CHECK:STDOUT: %bound_method.loc43_10.1: <bound method> = bound_method %.loc43_10.3, %impl.elem0.loc43
  323. // CHECK:STDOUT: %specific_fn.loc43: <specific function> = specific_function %impl.elem0.loc43, @UInt.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%UInt.as.Copy.impl.Op.specific_fn]
  324. // CHECK:STDOUT: %bound_method.loc43_10.2: <bound method> = bound_method %.loc43_10.3, %specific_fn.loc43
  325. // CHECK:STDOUT: %UInt.as.Copy.impl.Op.call.loc43: init %u32 = call %bound_method.loc43_10.2(%.loc43_10.3)
  326. // CHECK:STDOUT: %tuple.elem1.loc43_10.2: ref %u32 = tuple_access %return, element1
  327. // CHECK:STDOUT: %.loc43_10.4: init %u32 = initialize_from %UInt.as.Copy.impl.Op.call.loc43 to %tuple.elem1.loc43_10.2
  328. // CHECK:STDOUT: %.loc43_10.5: init %tuple.type.2a3 = tuple_init (%.loc43_10.2, %.loc43_10.4) to %return
  329. // CHECK:STDOUT: %.loc43_11: init %tuple.type.2a3 = converted %d.ref, %.loc43_10.5
  330. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound: <bound method> = bound_method %d.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.4b1
  331. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn: <specific function> = specific_function constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.4b1, @DestroyT.binding.as_type.as.Destroy.impl.Op(constants.%facet_value.6a4) [concrete = constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.272]
  332. // CHECK:STDOUT: %bound_method.loc35_3: <bound method> = bound_method %d.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn
  333. // CHECK:STDOUT: %addr: %ptr.c30 = addr_of %d.var
  334. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method.loc35_3(%addr)
  335. // CHECK:STDOUT: return %.loc43_11 to %return
  336. // CHECK:STDOUT: }
  337. // CHECK:STDOUT:
  338. // CHECK:STDOUT: --- adapt_copyable_tuple.carbon
  339. // CHECK:STDOUT:
  340. // CHECK:STDOUT: constants {
  341. // CHECK:STDOUT: %AdaptTuple: type = class_type @AdaptTuple [concrete]
  342. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  343. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  344. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  345. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  346. // CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic]
  347. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  348. // CHECK:STDOUT: %tuple.type.24b: type = tuple_type (type, type) [concrete]
  349. // CHECK:STDOUT: %tuple.type.d07: type = tuple_type (%i32, %i32) [concrete]
  350. // CHECK:STDOUT: %complete_type.65d: <witness> = complete_type_witness %tuple.type.d07 [concrete]
  351. // CHECK:STDOUT: %pattern_type.562: type = pattern_type %AdaptTuple [concrete]
  352. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  353. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  354. // CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete]
  355. // CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete]
  356. // CHECK:STDOUT: %Int.as.Copy.impl.Op.type.afd: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%N) [symbolic]
  357. // CHECK:STDOUT: %Int.as.Copy.impl.Op.6cd: %Int.as.Copy.impl.Op.type.afd = struct_value () [symbolic]
  358. // CHECK:STDOUT: %Copy.impl_witness.a32: <witness> = impl_witness imports.%Copy.impl_witness_table.1ed, @Int.as.Copy.impl(%int_32) [concrete]
  359. // CHECK:STDOUT: %Int.as.Copy.impl.Op.type.276: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%int_32) [concrete]
  360. // CHECK:STDOUT: %Int.as.Copy.impl.Op.f59: %Int.as.Copy.impl.Op.type.276 = struct_value () [concrete]
  361. // CHECK:STDOUT: %Copy.facet.c49: %Copy.type = facet_value %i32, (%Copy.impl_witness.a32) [concrete]
  362. // CHECK:STDOUT: %.7fa: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet.c49 [concrete]
  363. // 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]
  364. // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
  365. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
  366. // CHECK:STDOUT: %facet_value.a7e: %type_where = facet_value %AdaptTuple, () [concrete]
  367. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.a2d: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.a7e) [concrete]
  368. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.b1b: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.a2d = struct_value () [concrete]
  369. // CHECK:STDOUT: %ptr.ca3: type = ptr_type %AdaptTuple [concrete]
  370. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.305: <specific function> = specific_function %DestroyT.binding.as_type.as.Destroy.impl.Op.b1b, @DestroyT.binding.as_type.as.Destroy.impl.Op(%facet_value.a7e) [concrete]
  371. // CHECK:STDOUT: %UInt.type: type = generic_class_type @UInt [concrete]
  372. // CHECK:STDOUT: %UInt.generic: %UInt.type = struct_value () [concrete]
  373. // CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(%int_32) [concrete]
  374. // CHECK:STDOUT: %tuple.type.f69: type = tuple_type (%AdaptTuple, %u32) [concrete]
  375. // CHECK:STDOUT: %pattern_type.c9e: type = pattern_type %tuple.type.f69 [concrete]
  376. // CHECK:STDOUT: %InTuple.type: type = fn_type @InTuple [concrete]
  377. // CHECK:STDOUT: %InTuple: %InTuple.type = struct_value () [concrete]
  378. // CHECK:STDOUT: %UInt.as.Copy.impl.Op.type.cb3: type = fn_type @UInt.as.Copy.impl.Op, @UInt.as.Copy.impl(%N) [symbolic]
  379. // CHECK:STDOUT: %UInt.as.Copy.impl.Op.ee7: %UInt.as.Copy.impl.Op.type.cb3 = struct_value () [symbolic]
  380. // CHECK:STDOUT: %Copy.impl_witness.61c: <witness> = impl_witness imports.%Copy.impl_witness_table.46a, @UInt.as.Copy.impl(%int_32) [concrete]
  381. // CHECK:STDOUT: %UInt.as.Copy.impl.Op.type.31e: type = fn_type @UInt.as.Copy.impl.Op, @UInt.as.Copy.impl(%int_32) [concrete]
  382. // CHECK:STDOUT: %UInt.as.Copy.impl.Op.1bb: %UInt.as.Copy.impl.Op.type.31e = struct_value () [concrete]
  383. // CHECK:STDOUT: %Copy.facet.9a3: %Copy.type = facet_value %u32, (%Copy.impl_witness.61c) [concrete]
  384. // CHECK:STDOUT: %.fbf: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet.9a3 [concrete]
  385. // CHECK:STDOUT: %UInt.as.Copy.impl.Op.specific_fn: <specific function> = specific_function %UInt.as.Copy.impl.Op.1bb, @UInt.as.Copy.impl.Op(%int_32) [concrete]
  386. // CHECK:STDOUT: %facet_value.262: %type_where = facet_value %tuple.type.f69, () [concrete]
  387. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.327: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.262) [concrete]
  388. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.18b: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.327 = struct_value () [concrete]
  389. // CHECK:STDOUT: %ptr.ed5: type = ptr_type %tuple.type.f69 [concrete]
  390. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.dce: <specific function> = specific_function %DestroyT.binding.as_type.as.Destroy.impl.Op.18b, @DestroyT.binding.as_type.as.Destroy.impl.Op(%facet_value.262) [concrete]
  391. // CHECK:STDOUT: }
  392. // CHECK:STDOUT:
  393. // CHECK:STDOUT: imports {
  394. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  395. // CHECK:STDOUT: .Int = %Core.Int
  396. // CHECK:STDOUT: .Copy = %Core.Copy
  397. // CHECK:STDOUT: .Destroy = %Core.Destroy
  398. // CHECK:STDOUT: .UInt = %Core.UInt
  399. // CHECK:STDOUT: import Core//prelude
  400. // CHECK:STDOUT: import Core//prelude/...
  401. // CHECK:STDOUT: }
  402. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  403. // CHECK:STDOUT: %Core.Copy: type = import_ref Core//prelude/parts/copy, Copy, loaded [concrete = constants.%Copy.type]
  404. // 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)]
  405. // CHECK:STDOUT: %Copy.impl_witness_table.1ed = impl_witness_table (%Core.import_ref.d0f6), @Int.as.Copy.impl [concrete]
  406. // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type]
  407. // CHECK:STDOUT: %Core.UInt: %UInt.type = import_ref Core//prelude/parts/uint, UInt, loaded [concrete = constants.%UInt.generic]
  408. // CHECK:STDOUT: %Core.import_ref.ba6: @UInt.as.Copy.impl.%UInt.as.Copy.impl.Op.type (%UInt.as.Copy.impl.Op.type.cb3) = import_ref Core//prelude/parts/uint, loc{{\d+_\d+}}, loaded [symbolic = @UInt.as.Copy.impl.%UInt.as.Copy.impl.Op (constants.%UInt.as.Copy.impl.Op.ee7)]
  409. // CHECK:STDOUT: %Copy.impl_witness_table.46a = impl_witness_table (%Core.import_ref.ba6), @UInt.as.Copy.impl [concrete]
  410. // CHECK:STDOUT: }
  411. // CHECK:STDOUT:
  412. // CHECK:STDOUT: file {
  413. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  414. // CHECK:STDOUT: .Core = imports.%Core
  415. // CHECK:STDOUT: .AdaptTuple = %AdaptTuple.decl
  416. // CHECK:STDOUT: .F = %F.decl
  417. // CHECK:STDOUT: .InTuple = %InTuple.decl
  418. // CHECK:STDOUT: }
  419. // CHECK:STDOUT: %Core.import = import Core
  420. // CHECK:STDOUT: %AdaptTuple.decl: type = class_decl @AdaptTuple [concrete = constants.%AdaptTuple] {} {}
  421. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  422. // CHECK:STDOUT: %c.patt: %pattern_type.562 = binding_pattern c [concrete]
  423. // CHECK:STDOUT: %c.param_patt: %pattern_type.562 = value_param_pattern %c.patt, call_param0 [concrete]
  424. // CHECK:STDOUT: %return.patt: %pattern_type.562 = return_slot_pattern [concrete]
  425. // CHECK:STDOUT: %return.param_patt: %pattern_type.562 = out_param_pattern %return.patt, call_param1 [concrete]
  426. // CHECK:STDOUT: } {
  427. // CHECK:STDOUT: %AdaptTuple.ref.loc8_24: type = name_ref AdaptTuple, file.%AdaptTuple.decl [concrete = constants.%AdaptTuple]
  428. // CHECK:STDOUT: %c.param: %AdaptTuple = value_param call_param0
  429. // CHECK:STDOUT: %AdaptTuple.ref.loc8_9: type = name_ref AdaptTuple, file.%AdaptTuple.decl [concrete = constants.%AdaptTuple]
  430. // CHECK:STDOUT: %c: %AdaptTuple = bind_name c, %c.param
  431. // CHECK:STDOUT: %return.param: ref %AdaptTuple = out_param call_param1
  432. // CHECK:STDOUT: %return: ref %AdaptTuple = return_slot %return.param
  433. // CHECK:STDOUT: }
  434. // CHECK:STDOUT: %InTuple.decl: %InTuple.type = fn_decl @InTuple [concrete = constants.%InTuple] {
  435. // CHECK:STDOUT: %c.patt: %pattern_type.c9e = binding_pattern c [concrete]
  436. // CHECK:STDOUT: %c.param_patt: %pattern_type.c9e = value_param_pattern %c.patt, call_param0 [concrete]
  437. // CHECK:STDOUT: %return.patt: %pattern_type.c9e = return_slot_pattern [concrete]
  438. // CHECK:STDOUT: %return.param_patt: %pattern_type.c9e = out_param_pattern %return.patt, call_param1 [concrete]
  439. // CHECK:STDOUT: } {
  440. // CHECK:STDOUT: %AdaptTuple.ref.loc13_38: type = name_ref AdaptTuple, file.%AdaptTuple.decl [concrete = constants.%AdaptTuple]
  441. // CHECK:STDOUT: %int_32.loc13_50: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  442. // CHECK:STDOUT: %u32.loc13_50: type = class_type @UInt, @UInt(constants.%int_32) [concrete = constants.%u32]
  443. // CHECK:STDOUT: %.loc13_53.1: %tuple.type.24b = tuple_literal (%AdaptTuple.ref.loc13_38, %u32.loc13_50)
  444. // CHECK:STDOUT: %.loc13_53.2: type = converted %.loc13_53.1, constants.%tuple.type.f69 [concrete = constants.%tuple.type.f69]
  445. // CHECK:STDOUT: %c.param: %tuple.type.f69 = value_param call_param0
  446. // CHECK:STDOUT: %.loc13_31.1: type = splice_block %.loc13_31.3 [concrete = constants.%tuple.type.f69] {
  447. // CHECK:STDOUT: %AdaptTuple.ref.loc13_16: type = name_ref AdaptTuple, file.%AdaptTuple.decl [concrete = constants.%AdaptTuple]
  448. // CHECK:STDOUT: %int_32.loc13_28: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  449. // CHECK:STDOUT: %u32.loc13_28: type = class_type @UInt, @UInt(constants.%int_32) [concrete = constants.%u32]
  450. // CHECK:STDOUT: %.loc13_31.2: %tuple.type.24b = tuple_literal (%AdaptTuple.ref.loc13_16, %u32.loc13_28)
  451. // CHECK:STDOUT: %.loc13_31.3: type = converted %.loc13_31.2, constants.%tuple.type.f69 [concrete = constants.%tuple.type.f69]
  452. // CHECK:STDOUT: }
  453. // CHECK:STDOUT: %c: %tuple.type.f69 = bind_name c, %c.param
  454. // CHECK:STDOUT: %return.param: ref %tuple.type.f69 = out_param call_param1
  455. // CHECK:STDOUT: %return: ref %tuple.type.f69 = return_slot %return.param
  456. // CHECK:STDOUT: }
  457. // CHECK:STDOUT: }
  458. // CHECK:STDOUT:
  459. // CHECK:STDOUT: class @AdaptTuple {
  460. // CHECK:STDOUT: %int_32.loc5_10: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  461. // CHECK:STDOUT: %i32.loc5_10: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  462. // CHECK:STDOUT: %int_32.loc5_15: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  463. // CHECK:STDOUT: %i32.loc5_15: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  464. // CHECK:STDOUT: %.loc5_18: %tuple.type.24b = tuple_literal (%i32.loc5_10, %i32.loc5_15)
  465. // CHECK:STDOUT: %.loc5_19: type = converted %.loc5_18, constants.%tuple.type.d07 [concrete = constants.%tuple.type.d07]
  466. // CHECK:STDOUT: adapt_decl %.loc5_19 [concrete]
  467. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%tuple.type.d07 [concrete = constants.%complete_type.65d]
  468. // CHECK:STDOUT: complete_type_witness = %complete_type
  469. // CHECK:STDOUT:
  470. // CHECK:STDOUT: !members:
  471. // CHECK:STDOUT: .Self = constants.%AdaptTuple
  472. // CHECK:STDOUT: }
  473. // CHECK:STDOUT:
  474. // CHECK:STDOUT: fn @F(%c.param: %AdaptTuple) -> %return.param: %AdaptTuple {
  475. // CHECK:STDOUT: !entry:
  476. // CHECK:STDOUT: name_binding_decl {
  477. // CHECK:STDOUT: %d.patt: %pattern_type.562 = binding_pattern d [concrete]
  478. // CHECK:STDOUT: %d.var_patt: %pattern_type.562 = var_pattern %d.patt [concrete]
  479. // CHECK:STDOUT: }
  480. // CHECK:STDOUT: %d.var: ref %AdaptTuple = var %d.var_patt
  481. // CHECK:STDOUT: %c.ref: %AdaptTuple = name_ref c, %c
  482. // CHECK:STDOUT: %.loc9_3.1: %tuple.type.d07 = as_compatible %c.ref
  483. // CHECK:STDOUT: %tuple.elem0.loc9_3.1: %i32 = tuple_access %.loc9_3.1, element0
  484. // CHECK:STDOUT: %impl.elem0.loc9_3.1: %.7fa = impl_witness_access constants.%Copy.impl_witness.a32, element0 [concrete = constants.%Int.as.Copy.impl.Op.f59]
  485. // CHECK:STDOUT: %bound_method.loc9_3.1: <bound method> = bound_method %tuple.elem0.loc9_3.1, %impl.elem0.loc9_3.1
  486. // CHECK:STDOUT: %specific_fn.loc9_3.1: <specific function> = specific_function %impl.elem0.loc9_3.1, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  487. // CHECK:STDOUT: %bound_method.loc9_3.2: <bound method> = bound_method %tuple.elem0.loc9_3.1, %specific_fn.loc9_3.1
  488. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc9_3.1: init %i32 = call %bound_method.loc9_3.2(%tuple.elem0.loc9_3.1)
  489. // CHECK:STDOUT: %.loc9_3.2: ref %tuple.type.d07 = as_compatible %d.var
  490. // CHECK:STDOUT: %tuple.elem0.loc9_3.2: ref %i32 = tuple_access %.loc9_3.2, element0
  491. // CHECK:STDOUT: %.loc9_3.3: init %i32 = initialize_from %Int.as.Copy.impl.Op.call.loc9_3.1 to %tuple.elem0.loc9_3.2
  492. // CHECK:STDOUT: %tuple.elem1.loc9_3.1: %i32 = tuple_access %.loc9_3.1, element1
  493. // CHECK:STDOUT: %impl.elem0.loc9_3.2: %.7fa = impl_witness_access constants.%Copy.impl_witness.a32, element0 [concrete = constants.%Int.as.Copy.impl.Op.f59]
  494. // CHECK:STDOUT: %bound_method.loc9_3.3: <bound method> = bound_method %tuple.elem1.loc9_3.1, %impl.elem0.loc9_3.2
  495. // CHECK:STDOUT: %specific_fn.loc9_3.2: <specific function> = specific_function %impl.elem0.loc9_3.2, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  496. // CHECK:STDOUT: %bound_method.loc9_3.4: <bound method> = bound_method %tuple.elem1.loc9_3.1, %specific_fn.loc9_3.2
  497. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc9_3.2: init %i32 = call %bound_method.loc9_3.4(%tuple.elem1.loc9_3.1)
  498. // CHECK:STDOUT: %tuple.elem1.loc9_3.2: ref %i32 = tuple_access %.loc9_3.2, element1
  499. // CHECK:STDOUT: %.loc9_3.4: init %i32 = initialize_from %Int.as.Copy.impl.Op.call.loc9_3.2 to %tuple.elem1.loc9_3.2
  500. // CHECK:STDOUT: %.loc9_3.5: init %tuple.type.d07 = tuple_init (%.loc9_3.3, %.loc9_3.4) to %.loc9_3.2
  501. // CHECK:STDOUT: %.loc9_3.6: init %AdaptTuple = as_compatible %.loc9_3.5
  502. // CHECK:STDOUT: %.loc9_3.7: init %AdaptTuple = converted %c.ref, %.loc9_3.6
  503. // CHECK:STDOUT: assign %d.var, %.loc9_3.7
  504. // CHECK:STDOUT: %AdaptTuple.ref.loc9: type = name_ref AdaptTuple, file.%AdaptTuple.decl [concrete = constants.%AdaptTuple]
  505. // CHECK:STDOUT: %d: ref %AdaptTuple = bind_name d, %d.var
  506. // CHECK:STDOUT: %d.ref: ref %AdaptTuple = name_ref d, %d
  507. // CHECK:STDOUT: %.loc10_11.1: ref %tuple.type.d07 = as_compatible %d.ref
  508. // CHECK:STDOUT: %tuple.elem0.loc10_11.1: ref %i32 = tuple_access %.loc10_11.1, element0
  509. // CHECK:STDOUT: %.loc10_11.2: %i32 = bind_value %tuple.elem0.loc10_11.1
  510. // CHECK:STDOUT: %impl.elem0.loc10_11.1: %.7fa = impl_witness_access constants.%Copy.impl_witness.a32, element0 [concrete = constants.%Int.as.Copy.impl.Op.f59]
  511. // CHECK:STDOUT: %bound_method.loc10_11.1: <bound method> = bound_method %.loc10_11.2, %impl.elem0.loc10_11.1
  512. // CHECK:STDOUT: %specific_fn.loc10_11.1: <specific function> = specific_function %impl.elem0.loc10_11.1, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  513. // CHECK:STDOUT: %bound_method.loc10_11.2: <bound method> = bound_method %.loc10_11.2, %specific_fn.loc10_11.1
  514. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc10_11.1: init %i32 = call %bound_method.loc10_11.2(%.loc10_11.2)
  515. // CHECK:STDOUT: %.loc10_11.3: ref %tuple.type.d07 = as_compatible %return
  516. // CHECK:STDOUT: %tuple.elem0.loc10_11.2: ref %i32 = tuple_access %.loc10_11.3, element0
  517. // CHECK:STDOUT: %.loc10_11.4: init %i32 = initialize_from %Int.as.Copy.impl.Op.call.loc10_11.1 to %tuple.elem0.loc10_11.2
  518. // CHECK:STDOUT: %tuple.elem1.loc10_11.1: ref %i32 = tuple_access %.loc10_11.1, element1
  519. // CHECK:STDOUT: %.loc10_11.5: %i32 = bind_value %tuple.elem1.loc10_11.1
  520. // CHECK:STDOUT: %impl.elem0.loc10_11.2: %.7fa = impl_witness_access constants.%Copy.impl_witness.a32, element0 [concrete = constants.%Int.as.Copy.impl.Op.f59]
  521. // CHECK:STDOUT: %bound_method.loc10_11.3: <bound method> = bound_method %.loc10_11.5, %impl.elem0.loc10_11.2
  522. // CHECK:STDOUT: %specific_fn.loc10_11.2: <specific function> = specific_function %impl.elem0.loc10_11.2, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  523. // CHECK:STDOUT: %bound_method.loc10_11.4: <bound method> = bound_method %.loc10_11.5, %specific_fn.loc10_11.2
  524. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc10_11.2: init %i32 = call %bound_method.loc10_11.4(%.loc10_11.5)
  525. // CHECK:STDOUT: %tuple.elem1.loc10_11.2: ref %i32 = tuple_access %.loc10_11.3, element1
  526. // CHECK:STDOUT: %.loc10_11.6: init %i32 = initialize_from %Int.as.Copy.impl.Op.call.loc10_11.2 to %tuple.elem1.loc10_11.2
  527. // CHECK:STDOUT: %.loc10_11.7: init %tuple.type.d07 = tuple_init (%.loc10_11.4, %.loc10_11.6) to %.loc10_11.3
  528. // CHECK:STDOUT: %.loc10_11.8: init %AdaptTuple = as_compatible %.loc10_11.7
  529. // CHECK:STDOUT: %.loc10_11.9: init %AdaptTuple = converted %d.ref, %.loc10_11.8
  530. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound: <bound method> = bound_method %d.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.b1b
  531. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn: <specific function> = specific_function constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.b1b, @DestroyT.binding.as_type.as.Destroy.impl.Op(constants.%facet_value.a7e) [concrete = constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.305]
  532. // CHECK:STDOUT: %bound_method.loc9_3.5: <bound method> = bound_method %d.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn
  533. // CHECK:STDOUT: %addr: %ptr.ca3 = addr_of %d.var
  534. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method.loc9_3.5(%addr)
  535. // CHECK:STDOUT: return %.loc10_11.9 to %return
  536. // CHECK:STDOUT: }
  537. // CHECK:STDOUT:
  538. // CHECK:STDOUT: fn @InTuple(%c.param: %tuple.type.f69) -> %return.param: %tuple.type.f69 {
  539. // CHECK:STDOUT: !entry:
  540. // CHECK:STDOUT: name_binding_decl {
  541. // CHECK:STDOUT: %d.patt: %pattern_type.c9e = binding_pattern d [concrete]
  542. // CHECK:STDOUT: %d.var_patt: %pattern_type.c9e = var_pattern %d.patt [concrete]
  543. // CHECK:STDOUT: }
  544. // CHECK:STDOUT: %d.var: ref %tuple.type.f69 = var %d.var_patt
  545. // CHECK:STDOUT: %c.ref: %tuple.type.f69 = name_ref c, %c
  546. // CHECK:STDOUT: %tuple.elem0.loc14_30.1: %AdaptTuple = tuple_access %c.ref, element0
  547. // CHECK:STDOUT: %.loc14_30.1: %tuple.type.d07 = as_compatible %tuple.elem0.loc14_30.1
  548. // CHECK:STDOUT: %tuple.elem0.loc14_30.2: %i32 = tuple_access %.loc14_30.1, element0
  549. // CHECK:STDOUT: %impl.elem0.loc14_30.1: %.7fa = impl_witness_access constants.%Copy.impl_witness.a32, element0 [concrete = constants.%Int.as.Copy.impl.Op.f59]
  550. // CHECK:STDOUT: %bound_method.loc14_30.1: <bound method> = bound_method %tuple.elem0.loc14_30.2, %impl.elem0.loc14_30.1
  551. // CHECK:STDOUT: %specific_fn.loc14_30.1: <specific function> = specific_function %impl.elem0.loc14_30.1, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  552. // CHECK:STDOUT: %bound_method.loc14_30.2: <bound method> = bound_method %tuple.elem0.loc14_30.2, %specific_fn.loc14_30.1
  553. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc14_30.1: init %i32 = call %bound_method.loc14_30.2(%tuple.elem0.loc14_30.2)
  554. // CHECK:STDOUT: %tuple.elem0.loc14_30.3: ref %AdaptTuple = tuple_access %d.var, element0
  555. // CHECK:STDOUT: %.loc14_30.2: ref %tuple.type.d07 = as_compatible %tuple.elem0.loc14_30.3
  556. // CHECK:STDOUT: %tuple.elem0.loc14_30.4: ref %i32 = tuple_access %.loc14_30.2, element0
  557. // CHECK:STDOUT: %.loc14_30.3: init %i32 = initialize_from %Int.as.Copy.impl.Op.call.loc14_30.1 to %tuple.elem0.loc14_30.4
  558. // CHECK:STDOUT: %tuple.elem1.loc14_30.1: %i32 = tuple_access %.loc14_30.1, element1
  559. // CHECK:STDOUT: %impl.elem0.loc14_30.2: %.7fa = impl_witness_access constants.%Copy.impl_witness.a32, element0 [concrete = constants.%Int.as.Copy.impl.Op.f59]
  560. // CHECK:STDOUT: %bound_method.loc14_30.3: <bound method> = bound_method %tuple.elem1.loc14_30.1, %impl.elem0.loc14_30.2
  561. // CHECK:STDOUT: %specific_fn.loc14_30.2: <specific function> = specific_function %impl.elem0.loc14_30.2, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  562. // CHECK:STDOUT: %bound_method.loc14_30.4: <bound method> = bound_method %tuple.elem1.loc14_30.1, %specific_fn.loc14_30.2
  563. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc14_30.2: init %i32 = call %bound_method.loc14_30.4(%tuple.elem1.loc14_30.1)
  564. // CHECK:STDOUT: %tuple.elem1.loc14_30.2: ref %i32 = tuple_access %.loc14_30.2, element1
  565. // CHECK:STDOUT: %.loc14_30.4: init %i32 = initialize_from %Int.as.Copy.impl.Op.call.loc14_30.2 to %tuple.elem1.loc14_30.2
  566. // CHECK:STDOUT: %.loc14_30.5: init %tuple.type.d07 = tuple_init (%.loc14_30.3, %.loc14_30.4) to %.loc14_30.2
  567. // CHECK:STDOUT: %.loc14_30.6: init %AdaptTuple = as_compatible %.loc14_30.5
  568. // CHECK:STDOUT: %.loc14_30.7: init %AdaptTuple = converted %tuple.elem0.loc14_30.1, %.loc14_30.6
  569. // CHECK:STDOUT: %tuple.elem1.loc14_30.3: %u32 = tuple_access %c.ref, element1
  570. // CHECK:STDOUT: %impl.elem0.loc14_30.3: %.fbf = impl_witness_access constants.%Copy.impl_witness.61c, element0 [concrete = constants.%UInt.as.Copy.impl.Op.1bb]
  571. // CHECK:STDOUT: %bound_method.loc14_30.5: <bound method> = bound_method %tuple.elem1.loc14_30.3, %impl.elem0.loc14_30.3
  572. // CHECK:STDOUT: %specific_fn.loc14_30.3: <specific function> = specific_function %impl.elem0.loc14_30.3, @UInt.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%UInt.as.Copy.impl.Op.specific_fn]
  573. // CHECK:STDOUT: %bound_method.loc14_30.6: <bound method> = bound_method %tuple.elem1.loc14_30.3, %specific_fn.loc14_30.3
  574. // CHECK:STDOUT: %UInt.as.Copy.impl.Op.call.loc14: init %u32 = call %bound_method.loc14_30.6(%tuple.elem1.loc14_30.3)
  575. // CHECK:STDOUT: %tuple.elem1.loc14_30.4: ref %u32 = tuple_access %d.var, element1
  576. // CHECK:STDOUT: %.loc14_30.8: init %u32 = initialize_from %UInt.as.Copy.impl.Op.call.loc14 to %tuple.elem1.loc14_30.4
  577. // CHECK:STDOUT: %.loc14_30.9: init %tuple.type.f69 = tuple_init (%.loc14_30.7, %.loc14_30.8) to %d.var
  578. // CHECK:STDOUT: %.loc14_3: init %tuple.type.f69 = converted %c.ref, %.loc14_30.9
  579. // CHECK:STDOUT: assign %d.var, %.loc14_3
  580. // CHECK:STDOUT: %.loc14_26.1: type = splice_block %.loc14_26.3 [concrete = constants.%tuple.type.f69] {
  581. // CHECK:STDOUT: %AdaptTuple.ref.loc14: type = name_ref AdaptTuple, file.%AdaptTuple.decl [concrete = constants.%AdaptTuple]
  582. // CHECK:STDOUT: %int_32.loc14: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  583. // CHECK:STDOUT: %u32.loc14: type = class_type @UInt, @UInt(constants.%int_32) [concrete = constants.%u32]
  584. // CHECK:STDOUT: %.loc14_26.2: %tuple.type.24b = tuple_literal (%AdaptTuple.ref.loc14, %u32.loc14)
  585. // CHECK:STDOUT: %.loc14_26.3: type = converted %.loc14_26.2, constants.%tuple.type.f69 [concrete = constants.%tuple.type.f69]
  586. // CHECK:STDOUT: }
  587. // CHECK:STDOUT: %d: ref %tuple.type.f69 = bind_name d, %d.var
  588. // CHECK:STDOUT: %d.ref: ref %tuple.type.f69 = name_ref d, %d
  589. // CHECK:STDOUT: %tuple.elem0.loc15_10.1: ref %AdaptTuple = tuple_access %d.ref, element0
  590. // CHECK:STDOUT: %.loc15_10.1: ref %tuple.type.d07 = as_compatible %tuple.elem0.loc15_10.1
  591. // CHECK:STDOUT: %tuple.elem0.loc15_10.2: ref %i32 = tuple_access %.loc15_10.1, element0
  592. // CHECK:STDOUT: %.loc15_10.2: %i32 = bind_value %tuple.elem0.loc15_10.2
  593. // CHECK:STDOUT: %impl.elem0.loc15_10.1: %.7fa = impl_witness_access constants.%Copy.impl_witness.a32, element0 [concrete = constants.%Int.as.Copy.impl.Op.f59]
  594. // CHECK:STDOUT: %bound_method.loc15_10.1: <bound method> = bound_method %.loc15_10.2, %impl.elem0.loc15_10.1
  595. // CHECK:STDOUT: %specific_fn.loc15_10.1: <specific function> = specific_function %impl.elem0.loc15_10.1, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  596. // CHECK:STDOUT: %bound_method.loc15_10.2: <bound method> = bound_method %.loc15_10.2, %specific_fn.loc15_10.1
  597. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc15_10.1: init %i32 = call %bound_method.loc15_10.2(%.loc15_10.2)
  598. // CHECK:STDOUT: %tuple.elem0.loc15_10.3: ref %AdaptTuple = tuple_access %return, element0
  599. // CHECK:STDOUT: %.loc15_10.3: ref %tuple.type.d07 = as_compatible %tuple.elem0.loc15_10.3
  600. // CHECK:STDOUT: %tuple.elem0.loc15_10.4: ref %i32 = tuple_access %.loc15_10.3, element0
  601. // CHECK:STDOUT: %.loc15_10.4: init %i32 = initialize_from %Int.as.Copy.impl.Op.call.loc15_10.1 to %tuple.elem0.loc15_10.4
  602. // CHECK:STDOUT: %tuple.elem1.loc15_10.1: ref %i32 = tuple_access %.loc15_10.1, element1
  603. // CHECK:STDOUT: %.loc15_10.5: %i32 = bind_value %tuple.elem1.loc15_10.1
  604. // CHECK:STDOUT: %impl.elem0.loc15_10.2: %.7fa = impl_witness_access constants.%Copy.impl_witness.a32, element0 [concrete = constants.%Int.as.Copy.impl.Op.f59]
  605. // CHECK:STDOUT: %bound_method.loc15_10.3: <bound method> = bound_method %.loc15_10.5, %impl.elem0.loc15_10.2
  606. // CHECK:STDOUT: %specific_fn.loc15_10.2: <specific function> = specific_function %impl.elem0.loc15_10.2, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  607. // CHECK:STDOUT: %bound_method.loc15_10.4: <bound method> = bound_method %.loc15_10.5, %specific_fn.loc15_10.2
  608. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc15_10.2: init %i32 = call %bound_method.loc15_10.4(%.loc15_10.5)
  609. // CHECK:STDOUT: %tuple.elem1.loc15_10.2: ref %i32 = tuple_access %.loc15_10.3, element1
  610. // CHECK:STDOUT: %.loc15_10.6: init %i32 = initialize_from %Int.as.Copy.impl.Op.call.loc15_10.2 to %tuple.elem1.loc15_10.2
  611. // CHECK:STDOUT: %.loc15_10.7: init %tuple.type.d07 = tuple_init (%.loc15_10.4, %.loc15_10.6) to %.loc15_10.3
  612. // CHECK:STDOUT: %.loc15_10.8: init %AdaptTuple = as_compatible %.loc15_10.7
  613. // CHECK:STDOUT: %.loc15_10.9: init %AdaptTuple = converted %tuple.elem0.loc15_10.1, %.loc15_10.8
  614. // CHECK:STDOUT: %tuple.elem1.loc15_10.3: ref %u32 = tuple_access %d.ref, element1
  615. // CHECK:STDOUT: %.loc15_10.10: %u32 = bind_value %tuple.elem1.loc15_10.3
  616. // CHECK:STDOUT: %impl.elem0.loc15_10.3: %.fbf = impl_witness_access constants.%Copy.impl_witness.61c, element0 [concrete = constants.%UInt.as.Copy.impl.Op.1bb]
  617. // CHECK:STDOUT: %bound_method.loc15_10.5: <bound method> = bound_method %.loc15_10.10, %impl.elem0.loc15_10.3
  618. // CHECK:STDOUT: %specific_fn.loc15_10.3: <specific function> = specific_function %impl.elem0.loc15_10.3, @UInt.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%UInt.as.Copy.impl.Op.specific_fn]
  619. // CHECK:STDOUT: %bound_method.loc15_10.6: <bound method> = bound_method %.loc15_10.10, %specific_fn.loc15_10.3
  620. // CHECK:STDOUT: %UInt.as.Copy.impl.Op.call.loc15: init %u32 = call %bound_method.loc15_10.6(%.loc15_10.10)
  621. // CHECK:STDOUT: %tuple.elem1.loc15_10.4: ref %u32 = tuple_access %return, element1
  622. // CHECK:STDOUT: %.loc15_10.11: init %u32 = initialize_from %UInt.as.Copy.impl.Op.call.loc15 to %tuple.elem1.loc15_10.4
  623. // CHECK:STDOUT: %.loc15_10.12: init %tuple.type.f69 = tuple_init (%.loc15_10.9, %.loc15_10.11) to %return
  624. // CHECK:STDOUT: %.loc15_11: init %tuple.type.f69 = converted %d.ref, %.loc15_10.12
  625. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound: <bound method> = bound_method %d.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.18b
  626. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn: <specific function> = specific_function constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.18b, @DestroyT.binding.as_type.as.Destroy.impl.Op(constants.%facet_value.262) [concrete = constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.dce]
  627. // CHECK:STDOUT: %bound_method.loc14_3: <bound method> = bound_method %d.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn
  628. // CHECK:STDOUT: %addr: %ptr.ed5 = addr_of %d.var
  629. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method.loc14_3(%addr)
  630. // CHECK:STDOUT: return %.loc15_11 to %return
  631. // CHECK:STDOUT: }
  632. // CHECK:STDOUT:
  633. // CHECK:STDOUT: --- fail_adapt_not_copyable.carbon
  634. // CHECK:STDOUT:
  635. // CHECK:STDOUT: constants {
  636. // CHECK:STDOUT: %Noncopyable: type = class_type @Noncopyable [concrete]
  637. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  638. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  639. // CHECK:STDOUT: %AdaptNoncopyable: type = class_type @AdaptNoncopyable [concrete]
  640. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  641. // CHECK:STDOUT: %pattern_type.8f9: type = pattern_type %AdaptNoncopyable [concrete]
  642. // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
  643. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  644. // CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete]
  645. // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
  646. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
  647. // CHECK:STDOUT: %facet_value: %type_where = facet_value %AdaptNoncopyable, () [concrete]
  648. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.f8a: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value) [concrete]
  649. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.e55: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.f8a = struct_value () [concrete]
  650. // CHECK:STDOUT: %ptr.ed9: type = ptr_type %AdaptNoncopyable [concrete]
  651. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn: <specific function> = specific_function %DestroyT.binding.as_type.as.Destroy.impl.Op.e55, @DestroyT.binding.as_type.as.Destroy.impl.Op(%facet_value) [concrete]
  652. // CHECK:STDOUT: }
  653. // CHECK:STDOUT:
  654. // CHECK:STDOUT: imports {
  655. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  656. // CHECK:STDOUT: .Copy = %Core.Copy
  657. // CHECK:STDOUT: .Destroy = %Core.Destroy
  658. // CHECK:STDOUT: import Core//prelude
  659. // CHECK:STDOUT: import Core//prelude/...
  660. // CHECK:STDOUT: }
  661. // CHECK:STDOUT: %Core.Copy: type = import_ref Core//prelude/parts/copy, Copy, loaded [concrete = constants.%Copy.type]
  662. // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type]
  663. // CHECK:STDOUT: }
  664. // CHECK:STDOUT:
  665. // CHECK:STDOUT: file {
  666. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  667. // CHECK:STDOUT: .Core = imports.%Core
  668. // CHECK:STDOUT: .Noncopyable = %Noncopyable.decl
  669. // CHECK:STDOUT: .AdaptNoncopyable = %AdaptNoncopyable.decl
  670. // CHECK:STDOUT: .G = %G.decl
  671. // CHECK:STDOUT: }
  672. // CHECK:STDOUT: %Core.import = import Core
  673. // CHECK:STDOUT: %Noncopyable.decl: type = class_decl @Noncopyable [concrete = constants.%Noncopyable] {} {}
  674. // CHECK:STDOUT: %AdaptNoncopyable.decl: type = class_decl @AdaptNoncopyable [concrete = constants.%AdaptNoncopyable] {} {}
  675. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {
  676. // CHECK:STDOUT: %a.patt: %pattern_type.8f9 = binding_pattern a [concrete]
  677. // CHECK:STDOUT: %a.param_patt: %pattern_type.8f9 = value_param_pattern %a.patt, call_param0 [concrete]
  678. // CHECK:STDOUT: %return.patt: %pattern_type.8f9 = return_slot_pattern [concrete]
  679. // CHECK:STDOUT: %return.param_patt: %pattern_type.8f9 = out_param_pattern %return.patt, call_param1 [concrete]
  680. // CHECK:STDOUT: } {
  681. // CHECK:STDOUT: %AdaptNoncopyable.ref.loc12_30: type = name_ref AdaptNoncopyable, file.%AdaptNoncopyable.decl [concrete = constants.%AdaptNoncopyable]
  682. // CHECK:STDOUT: %a.param: %AdaptNoncopyable = value_param call_param0
  683. // CHECK:STDOUT: %AdaptNoncopyable.ref.loc12_9: type = name_ref AdaptNoncopyable, file.%AdaptNoncopyable.decl [concrete = constants.%AdaptNoncopyable]
  684. // CHECK:STDOUT: %a: %AdaptNoncopyable = bind_name a, %a.param
  685. // CHECK:STDOUT: %return.param: ref %AdaptNoncopyable = out_param call_param1
  686. // CHECK:STDOUT: %return: ref %AdaptNoncopyable = return_slot %return.param
  687. // CHECK:STDOUT: }
  688. // CHECK:STDOUT: }
  689. // CHECK:STDOUT:
  690. // CHECK:STDOUT: class @Noncopyable {
  691. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357]
  692. // CHECK:STDOUT: complete_type_witness = %complete_type
  693. // CHECK:STDOUT:
  694. // CHECK:STDOUT: !members:
  695. // CHECK:STDOUT: .Self = constants.%Noncopyable
  696. // CHECK:STDOUT: }
  697. // CHECK:STDOUT:
  698. // CHECK:STDOUT: class @AdaptNoncopyable {
  699. // CHECK:STDOUT: %Noncopyable.ref: type = name_ref Noncopyable, file.%Noncopyable.decl [concrete = constants.%Noncopyable]
  700. // CHECK:STDOUT: adapt_decl %Noncopyable.ref [concrete]
  701. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357]
  702. // CHECK:STDOUT: complete_type_witness = %complete_type
  703. // CHECK:STDOUT:
  704. // CHECK:STDOUT: !members:
  705. // CHECK:STDOUT: .Self = constants.%AdaptNoncopyable
  706. // CHECK:STDOUT: .Noncopyable = <poisoned>
  707. // CHECK:STDOUT: }
  708. // CHECK:STDOUT:
  709. // CHECK:STDOUT: fn @G(%a.param: %AdaptNoncopyable) -> %return.param: %AdaptNoncopyable {
  710. // CHECK:STDOUT: !entry:
  711. // CHECK:STDOUT: name_binding_decl {
  712. // CHECK:STDOUT: %b.patt: %pattern_type.8f9 = binding_pattern b [concrete]
  713. // CHECK:STDOUT: %b.var_patt: %pattern_type.8f9 = var_pattern %b.patt [concrete]
  714. // CHECK:STDOUT: }
  715. // CHECK:STDOUT: %b.var: ref %AdaptNoncopyable = var %b.var_patt
  716. // CHECK:STDOUT: %a.ref: %AdaptNoncopyable = name_ref a, %a
  717. // CHECK:STDOUT: assign %b.var, <error>
  718. // CHECK:STDOUT: %AdaptNoncopyable.ref.loc20: type = name_ref AdaptNoncopyable, file.%AdaptNoncopyable.decl [concrete = constants.%AdaptNoncopyable]
  719. // CHECK:STDOUT: %b: ref %AdaptNoncopyable = bind_name b, %b.var
  720. // CHECK:STDOUT: %b.ref: ref %AdaptNoncopyable = name_ref b, %b
  721. // CHECK:STDOUT: %.loc28: %AdaptNoncopyable = bind_value %b.ref
  722. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound: <bound method> = bound_method %b.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.e55
  723. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn: <specific function> = specific_function constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.e55, @DestroyT.binding.as_type.as.Destroy.impl.Op(constants.%facet_value) [concrete = constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn]
  724. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %b.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn
  725. // CHECK:STDOUT: %addr: %ptr.ed9 = addr_of %b.var
  726. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method(%addr)
  727. // CHECK:STDOUT: return <error> to %return
  728. // CHECK:STDOUT: }
  729. // CHECK:STDOUT:
  730. // CHECK:STDOUT: --- fail_adapt_not_copyable_indirect.carbon
  731. // CHECK:STDOUT:
  732. // CHECK:STDOUT: constants {
  733. // CHECK:STDOUT: %Noncopyable: type = class_type @Noncopyable [concrete]
  734. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  735. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  736. // CHECK:STDOUT: %AdaptNoncopyableIndirect: type = class_type @AdaptNoncopyableIndirect [concrete]
  737. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  738. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  739. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  740. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  741. // CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic]
  742. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  743. // CHECK:STDOUT: %tuple.type.ff9: type = tuple_type (type, type, type) [concrete]
  744. // CHECK:STDOUT: %tuple.type.c9a: type = tuple_type (%i32, %Noncopyable, %i32) [concrete]
  745. // CHECK:STDOUT: %complete_type.201: <witness> = complete_type_witness %tuple.type.c9a [concrete]
  746. // CHECK:STDOUT: %pattern_type.7e5: type = pattern_type %AdaptNoncopyableIndirect [concrete]
  747. // CHECK:STDOUT: %H.type: type = fn_type @H [concrete]
  748. // CHECK:STDOUT: %H: %H.type = struct_value () [concrete]
  749. // CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete]
  750. // CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete]
  751. // CHECK:STDOUT: %Int.as.Copy.impl.Op.type.afd: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%N) [symbolic]
  752. // CHECK:STDOUT: %Int.as.Copy.impl.Op.6cd: %Int.as.Copy.impl.Op.type.afd = struct_value () [symbolic]
  753. // CHECK:STDOUT: %Copy.impl_witness.a32: <witness> = impl_witness imports.%Copy.impl_witness_table.1ed, @Int.as.Copy.impl(%int_32) [concrete]
  754. // CHECK:STDOUT: %Int.as.Copy.impl.Op.type.276: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%int_32) [concrete]
  755. // CHECK:STDOUT: %Int.as.Copy.impl.Op.f59: %Int.as.Copy.impl.Op.type.276 = struct_value () [concrete]
  756. // CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %i32, (%Copy.impl_witness.a32) [concrete]
  757. // CHECK:STDOUT: %.7fa: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet [concrete]
  758. // 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]
  759. // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
  760. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
  761. // CHECK:STDOUT: %facet_value: %type_where = facet_value %AdaptNoncopyableIndirect, () [concrete]
  762. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.08c: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value) [concrete]
  763. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.926: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.08c = struct_value () [concrete]
  764. // CHECK:STDOUT: %ptr.921: type = ptr_type %AdaptNoncopyableIndirect [concrete]
  765. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn: <specific function> = specific_function %DestroyT.binding.as_type.as.Destroy.impl.Op.926, @DestroyT.binding.as_type.as.Destroy.impl.Op(%facet_value) [concrete]
  766. // CHECK:STDOUT: }
  767. // CHECK:STDOUT:
  768. // CHECK:STDOUT: imports {
  769. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  770. // CHECK:STDOUT: .Int = %Core.Int
  771. // CHECK:STDOUT: .Copy = %Core.Copy
  772. // CHECK:STDOUT: .Destroy = %Core.Destroy
  773. // CHECK:STDOUT: import Core//prelude
  774. // CHECK:STDOUT: import Core//prelude/...
  775. // CHECK:STDOUT: }
  776. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  777. // CHECK:STDOUT: %Core.Copy: type = import_ref Core//prelude/parts/copy, Copy, loaded [concrete = constants.%Copy.type]
  778. // 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)]
  779. // CHECK:STDOUT: %Copy.impl_witness_table.1ed = impl_witness_table (%Core.import_ref.d0f6), @Int.as.Copy.impl [concrete]
  780. // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type]
  781. // CHECK:STDOUT: }
  782. // CHECK:STDOUT:
  783. // CHECK:STDOUT: file {
  784. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  785. // CHECK:STDOUT: .Core = imports.%Core
  786. // CHECK:STDOUT: .Noncopyable = %Noncopyable.decl
  787. // CHECK:STDOUT: .AdaptNoncopyableIndirect = %AdaptNoncopyableIndirect.decl
  788. // CHECK:STDOUT: .H = %H.decl
  789. // CHECK:STDOUT: }
  790. // CHECK:STDOUT: %Core.import = import Core
  791. // CHECK:STDOUT: %Noncopyable.decl: type = class_decl @Noncopyable [concrete = constants.%Noncopyable] {} {}
  792. // CHECK:STDOUT: %AdaptNoncopyableIndirect.decl: type = class_decl @AdaptNoncopyableIndirect [concrete = constants.%AdaptNoncopyableIndirect] {} {}
  793. // CHECK:STDOUT: %H.decl: %H.type = fn_decl @H [concrete = constants.%H] {
  794. // CHECK:STDOUT: %a.patt: %pattern_type.7e5 = binding_pattern a [concrete]
  795. // CHECK:STDOUT: %a.param_patt: %pattern_type.7e5 = value_param_pattern %a.patt, call_param0 [concrete]
  796. // CHECK:STDOUT: %return.patt: %pattern_type.7e5 = return_slot_pattern [concrete]
  797. // CHECK:STDOUT: %return.param_patt: %pattern_type.7e5 = out_param_pattern %return.patt, call_param1 [concrete]
  798. // CHECK:STDOUT: } {
  799. // CHECK:STDOUT: %AdaptNoncopyableIndirect.ref.loc12_38: type = name_ref AdaptNoncopyableIndirect, file.%AdaptNoncopyableIndirect.decl [concrete = constants.%AdaptNoncopyableIndirect]
  800. // CHECK:STDOUT: %a.param: %AdaptNoncopyableIndirect = value_param call_param0
  801. // CHECK:STDOUT: %AdaptNoncopyableIndirect.ref.loc12_9: type = name_ref AdaptNoncopyableIndirect, file.%AdaptNoncopyableIndirect.decl [concrete = constants.%AdaptNoncopyableIndirect]
  802. // CHECK:STDOUT: %a: %AdaptNoncopyableIndirect = bind_name a, %a.param
  803. // CHECK:STDOUT: %return.param: ref %AdaptNoncopyableIndirect = out_param call_param1
  804. // CHECK:STDOUT: %return: ref %AdaptNoncopyableIndirect = return_slot %return.param
  805. // CHECK:STDOUT: }
  806. // CHECK:STDOUT: }
  807. // CHECK:STDOUT:
  808. // CHECK:STDOUT: class @Noncopyable {
  809. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357]
  810. // CHECK:STDOUT: complete_type_witness = %complete_type
  811. // CHECK:STDOUT:
  812. // CHECK:STDOUT: !members:
  813. // CHECK:STDOUT: .Self = constants.%Noncopyable
  814. // CHECK:STDOUT: }
  815. // CHECK:STDOUT:
  816. // CHECK:STDOUT: class @AdaptNoncopyableIndirect {
  817. // CHECK:STDOUT: %int_32.loc9_10: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  818. // CHECK:STDOUT: %i32.loc9_10: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  819. // CHECK:STDOUT: %Noncopyable.ref: type = name_ref Noncopyable, file.%Noncopyable.decl [concrete = constants.%Noncopyable]
  820. // CHECK:STDOUT: %int_32.loc9_28: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  821. // CHECK:STDOUT: %i32.loc9_28: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  822. // CHECK:STDOUT: %.loc9_31: %tuple.type.ff9 = tuple_literal (%i32.loc9_10, %Noncopyable.ref, %i32.loc9_28)
  823. // CHECK:STDOUT: %.loc9_32: type = converted %.loc9_31, constants.%tuple.type.c9a [concrete = constants.%tuple.type.c9a]
  824. // CHECK:STDOUT: adapt_decl %.loc9_32 [concrete]
  825. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%tuple.type.c9a [concrete = constants.%complete_type.201]
  826. // CHECK:STDOUT: complete_type_witness = %complete_type
  827. // CHECK:STDOUT:
  828. // CHECK:STDOUT: !members:
  829. // CHECK:STDOUT: .Self = constants.%AdaptNoncopyableIndirect
  830. // CHECK:STDOUT: .Noncopyable = <poisoned>
  831. // CHECK:STDOUT: }
  832. // CHECK:STDOUT:
  833. // CHECK:STDOUT: fn @H(%a.param: %AdaptNoncopyableIndirect) -> %return.param: %AdaptNoncopyableIndirect {
  834. // CHECK:STDOUT: !entry:
  835. // CHECK:STDOUT: name_binding_decl {
  836. // CHECK:STDOUT: %b.patt: %pattern_type.7e5 = binding_pattern b [concrete]
  837. // CHECK:STDOUT: %b.var_patt: %pattern_type.7e5 = var_pattern %b.patt [concrete]
  838. // CHECK:STDOUT: }
  839. // CHECK:STDOUT: %b.var: ref %AdaptNoncopyableIndirect = var %b.var_patt
  840. // CHECK:STDOUT: %a.ref: %AdaptNoncopyableIndirect = name_ref a, %a
  841. // CHECK:STDOUT: %.loc23_3.1: %tuple.type.c9a = as_compatible %a.ref
  842. // CHECK:STDOUT: %tuple.elem0.loc23_3.1: %i32 = tuple_access %.loc23_3.1, element0
  843. // CHECK:STDOUT: %impl.elem0.loc23: %.7fa = impl_witness_access constants.%Copy.impl_witness.a32, element0 [concrete = constants.%Int.as.Copy.impl.Op.f59]
  844. // CHECK:STDOUT: %bound_method.loc23_3.1: <bound method> = bound_method %tuple.elem0.loc23_3.1, %impl.elem0.loc23
  845. // CHECK:STDOUT: %specific_fn.loc23: <specific function> = specific_function %impl.elem0.loc23, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  846. // CHECK:STDOUT: %bound_method.loc23_3.2: <bound method> = bound_method %tuple.elem0.loc23_3.1, %specific_fn.loc23
  847. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc23: init %i32 = call %bound_method.loc23_3.2(%tuple.elem0.loc23_3.1)
  848. // CHECK:STDOUT: %.loc23_3.2: ref %tuple.type.c9a = as_compatible %b.var
  849. // CHECK:STDOUT: %tuple.elem0.loc23_3.2: ref %i32 = tuple_access %.loc23_3.2, element0
  850. // CHECK:STDOUT: %.loc23_3.3: init %i32 = initialize_from %Int.as.Copy.impl.Op.call.loc23 to %tuple.elem0.loc23_3.2
  851. // CHECK:STDOUT: %tuple.elem1.loc23: %Noncopyable = tuple_access %.loc23_3.1, element1
  852. // CHECK:STDOUT: assign %b.var, <error>
  853. // CHECK:STDOUT: %AdaptNoncopyableIndirect.ref.loc23: type = name_ref AdaptNoncopyableIndirect, file.%AdaptNoncopyableIndirect.decl [concrete = constants.%AdaptNoncopyableIndirect]
  854. // CHECK:STDOUT: %b: ref %AdaptNoncopyableIndirect = bind_name b, %b.var
  855. // CHECK:STDOUT: %b.ref: ref %AdaptNoncopyableIndirect = name_ref b, %b
  856. // CHECK:STDOUT: %.loc34_11.1: ref %tuple.type.c9a = as_compatible %b.ref
  857. // CHECK:STDOUT: %tuple.elem0.loc34_11.1: ref %i32 = tuple_access %.loc34_11.1, element0
  858. // CHECK:STDOUT: %.loc34_11.2: %i32 = bind_value %tuple.elem0.loc34_11.1
  859. // CHECK:STDOUT: %impl.elem0.loc34: %.7fa = impl_witness_access constants.%Copy.impl_witness.a32, element0 [concrete = constants.%Int.as.Copy.impl.Op.f59]
  860. // CHECK:STDOUT: %bound_method.loc34_11.1: <bound method> = bound_method %.loc34_11.2, %impl.elem0.loc34
  861. // CHECK:STDOUT: %specific_fn.loc34: <specific function> = specific_function %impl.elem0.loc34, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  862. // CHECK:STDOUT: %bound_method.loc34_11.2: <bound method> = bound_method %.loc34_11.2, %specific_fn.loc34
  863. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc34: init %i32 = call %bound_method.loc34_11.2(%.loc34_11.2)
  864. // CHECK:STDOUT: %.loc34_11.3: ref %tuple.type.c9a = as_compatible %return
  865. // CHECK:STDOUT: %tuple.elem0.loc34_11.2: ref %i32 = tuple_access %.loc34_11.3, element0
  866. // CHECK:STDOUT: %.loc34_11.4: init %i32 = initialize_from %Int.as.Copy.impl.Op.call.loc34 to %tuple.elem0.loc34_11.2
  867. // CHECK:STDOUT: %tuple.elem1.loc34: ref %Noncopyable = tuple_access %.loc34_11.1, element1
  868. // CHECK:STDOUT: %.loc34_11.5: %Noncopyable = bind_value %tuple.elem1.loc34
  869. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound: <bound method> = bound_method %b.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.926
  870. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn: <specific function> = specific_function constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.926, @DestroyT.binding.as_type.as.Destroy.impl.Op(constants.%facet_value) [concrete = constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn]
  871. // CHECK:STDOUT: %bound_method.loc23_3.3: <bound method> = bound_method %b.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn
  872. // CHECK:STDOUT: %addr: %ptr.921 = addr_of %b.var
  873. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method.loc23_3.3(%addr)
  874. // CHECK:STDOUT: return <error> to %return
  875. // CHECK:STDOUT: }
  876. // CHECK:STDOUT:
  877. // CHECK:STDOUT: --- adapt_copyable_struct.carbon
  878. // CHECK:STDOUT:
  879. // CHECK:STDOUT: constants {
  880. // CHECK:STDOUT: %AdaptStruct: type = class_type @AdaptStruct [concrete]
  881. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  882. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  883. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  884. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  885. // CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic]
  886. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  887. // CHECK:STDOUT: %struct_type.e.f: type = struct_type {.e: %i32, .f: %i32} [concrete]
  888. // CHECK:STDOUT: %complete_type.511: <witness> = complete_type_witness %struct_type.e.f [concrete]
  889. // CHECK:STDOUT: %pattern_type.f45: type = pattern_type %AdaptStruct [concrete]
  890. // CHECK:STDOUT: %I.type: type = fn_type @I [concrete]
  891. // CHECK:STDOUT: %I: %I.type = struct_value () [concrete]
  892. // CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete]
  893. // CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete]
  894. // CHECK:STDOUT: %Int.as.Copy.impl.Op.type.afd: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%N) [symbolic]
  895. // CHECK:STDOUT: %Int.as.Copy.impl.Op.6cd: %Int.as.Copy.impl.Op.type.afd = struct_value () [symbolic]
  896. // CHECK:STDOUT: %Copy.impl_witness.a32: <witness> = impl_witness imports.%Copy.impl_witness_table.1ed, @Int.as.Copy.impl(%int_32) [concrete]
  897. // CHECK:STDOUT: %Int.as.Copy.impl.Op.type.276: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%int_32) [concrete]
  898. // CHECK:STDOUT: %Int.as.Copy.impl.Op.f59: %Int.as.Copy.impl.Op.type.276 = struct_value () [concrete]
  899. // CHECK:STDOUT: %Copy.facet.c49: %Copy.type = facet_value %i32, (%Copy.impl_witness.a32) [concrete]
  900. // CHECK:STDOUT: %.7fa: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet.c49 [concrete]
  901. // 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]
  902. // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
  903. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
  904. // CHECK:STDOUT: %facet_value.14c: %type_where = facet_value %AdaptStruct, () [concrete]
  905. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.a77: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.14c) [concrete]
  906. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.e5f: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.a77 = struct_value () [concrete]
  907. // CHECK:STDOUT: %ptr.e10: type = ptr_type %AdaptStruct [concrete]
  908. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.f51: <specific function> = specific_function %DestroyT.binding.as_type.as.Destroy.impl.Op.e5f, @DestroyT.binding.as_type.as.Destroy.impl.Op(%facet_value.14c) [concrete]
  909. // CHECK:STDOUT: %UInt.type: type = generic_class_type @UInt [concrete]
  910. // CHECK:STDOUT: %UInt.generic: %UInt.type = struct_value () [concrete]
  911. // CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(%int_32) [concrete]
  912. // CHECK:STDOUT: %tuple.type.24b: type = tuple_type (type, type) [concrete]
  913. // CHECK:STDOUT: %tuple.type.80b: type = tuple_type (%AdaptStruct, %u32) [concrete]
  914. // CHECK:STDOUT: %pattern_type.31d: type = pattern_type %tuple.type.80b [concrete]
  915. // CHECK:STDOUT: %InTuple.type: type = fn_type @InTuple [concrete]
  916. // CHECK:STDOUT: %InTuple: %InTuple.type = struct_value () [concrete]
  917. // CHECK:STDOUT: %UInt.as.Copy.impl.Op.type.cb3: type = fn_type @UInt.as.Copy.impl.Op, @UInt.as.Copy.impl(%N) [symbolic]
  918. // CHECK:STDOUT: %UInt.as.Copy.impl.Op.ee7: %UInt.as.Copy.impl.Op.type.cb3 = struct_value () [symbolic]
  919. // CHECK:STDOUT: %Copy.impl_witness.61c: <witness> = impl_witness imports.%Copy.impl_witness_table.46a, @UInt.as.Copy.impl(%int_32) [concrete]
  920. // CHECK:STDOUT: %UInt.as.Copy.impl.Op.type.31e: type = fn_type @UInt.as.Copy.impl.Op, @UInt.as.Copy.impl(%int_32) [concrete]
  921. // CHECK:STDOUT: %UInt.as.Copy.impl.Op.1bb: %UInt.as.Copy.impl.Op.type.31e = struct_value () [concrete]
  922. // CHECK:STDOUT: %Copy.facet.9a3: %Copy.type = facet_value %u32, (%Copy.impl_witness.61c) [concrete]
  923. // CHECK:STDOUT: %.fbf: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet.9a3 [concrete]
  924. // CHECK:STDOUT: %UInt.as.Copy.impl.Op.specific_fn: <specific function> = specific_function %UInt.as.Copy.impl.Op.1bb, @UInt.as.Copy.impl.Op(%int_32) [concrete]
  925. // CHECK:STDOUT: %facet_value.03e: %type_where = facet_value %tuple.type.80b, () [concrete]
  926. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.28d: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.03e) [concrete]
  927. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.41f: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.28d = struct_value () [concrete]
  928. // CHECK:STDOUT: %ptr.b09: type = ptr_type %tuple.type.80b [concrete]
  929. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.ee0: <specific function> = specific_function %DestroyT.binding.as_type.as.Destroy.impl.Op.41f, @DestroyT.binding.as_type.as.Destroy.impl.Op(%facet_value.03e) [concrete]
  930. // CHECK:STDOUT: }
  931. // CHECK:STDOUT:
  932. // CHECK:STDOUT: imports {
  933. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  934. // CHECK:STDOUT: .Int = %Core.Int
  935. // CHECK:STDOUT: .Copy = %Core.Copy
  936. // CHECK:STDOUT: .Destroy = %Core.Destroy
  937. // CHECK:STDOUT: .UInt = %Core.UInt
  938. // CHECK:STDOUT: import Core//prelude
  939. // CHECK:STDOUT: import Core//prelude/...
  940. // CHECK:STDOUT: }
  941. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  942. // CHECK:STDOUT: %Core.Copy: type = import_ref Core//prelude/parts/copy, Copy, loaded [concrete = constants.%Copy.type]
  943. // 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)]
  944. // CHECK:STDOUT: %Copy.impl_witness_table.1ed = impl_witness_table (%Core.import_ref.d0f6), @Int.as.Copy.impl [concrete]
  945. // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type]
  946. // CHECK:STDOUT: %Core.UInt: %UInt.type = import_ref Core//prelude/parts/uint, UInt, loaded [concrete = constants.%UInt.generic]
  947. // CHECK:STDOUT: %Core.import_ref.ba6: @UInt.as.Copy.impl.%UInt.as.Copy.impl.Op.type (%UInt.as.Copy.impl.Op.type.cb3) = import_ref Core//prelude/parts/uint, loc{{\d+_\d+}}, loaded [symbolic = @UInt.as.Copy.impl.%UInt.as.Copy.impl.Op (constants.%UInt.as.Copy.impl.Op.ee7)]
  948. // CHECK:STDOUT: %Copy.impl_witness_table.46a = impl_witness_table (%Core.import_ref.ba6), @UInt.as.Copy.impl [concrete]
  949. // CHECK:STDOUT: }
  950. // CHECK:STDOUT:
  951. // CHECK:STDOUT: file {
  952. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  953. // CHECK:STDOUT: .Core = imports.%Core
  954. // CHECK:STDOUT: .AdaptStruct = %AdaptStruct.decl
  955. // CHECK:STDOUT: .I = %I.decl
  956. // CHECK:STDOUT: .InTuple = %InTuple.decl
  957. // CHECK:STDOUT: }
  958. // CHECK:STDOUT: %Core.import = import Core
  959. // CHECK:STDOUT: %AdaptStruct.decl: type = class_decl @AdaptStruct [concrete = constants.%AdaptStruct] {} {}
  960. // CHECK:STDOUT: %I.decl: %I.type = fn_decl @I [concrete = constants.%I] {
  961. // CHECK:STDOUT: %g.patt: %pattern_type.f45 = binding_pattern g [concrete]
  962. // CHECK:STDOUT: %g.param_patt: %pattern_type.f45 = value_param_pattern %g.patt, call_param0 [concrete]
  963. // CHECK:STDOUT: %return.patt: %pattern_type.f45 = return_slot_pattern [concrete]
  964. // CHECK:STDOUT: %return.param_patt: %pattern_type.f45 = out_param_pattern %return.patt, call_param1 [concrete]
  965. // CHECK:STDOUT: } {
  966. // CHECK:STDOUT: %AdaptStruct.ref.loc8_25: type = name_ref AdaptStruct, file.%AdaptStruct.decl [concrete = constants.%AdaptStruct]
  967. // CHECK:STDOUT: %g.param: %AdaptStruct = value_param call_param0
  968. // CHECK:STDOUT: %AdaptStruct.ref.loc8_9: type = name_ref AdaptStruct, file.%AdaptStruct.decl [concrete = constants.%AdaptStruct]
  969. // CHECK:STDOUT: %g: %AdaptStruct = bind_name g, %g.param
  970. // CHECK:STDOUT: %return.param: ref %AdaptStruct = out_param call_param1
  971. // CHECK:STDOUT: %return: ref %AdaptStruct = return_slot %return.param
  972. // CHECK:STDOUT: }
  973. // CHECK:STDOUT: %InTuple.decl: %InTuple.type = fn_decl @InTuple [concrete = constants.%InTuple] {
  974. // CHECK:STDOUT: %c.patt: %pattern_type.31d = binding_pattern c [concrete]
  975. // CHECK:STDOUT: %c.param_patt: %pattern_type.31d = value_param_pattern %c.patt, call_param0 [concrete]
  976. // CHECK:STDOUT: %return.patt: %pattern_type.31d = return_slot_pattern [concrete]
  977. // CHECK:STDOUT: %return.param_patt: %pattern_type.31d = out_param_pattern %return.patt, call_param1 [concrete]
  978. // CHECK:STDOUT: } {
  979. // CHECK:STDOUT: %AdaptStruct.ref.loc13_39: type = name_ref AdaptStruct, file.%AdaptStruct.decl [concrete = constants.%AdaptStruct]
  980. // CHECK:STDOUT: %int_32.loc13_52: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  981. // CHECK:STDOUT: %u32.loc13_52: type = class_type @UInt, @UInt(constants.%int_32) [concrete = constants.%u32]
  982. // CHECK:STDOUT: %.loc13_55.1: %tuple.type.24b = tuple_literal (%AdaptStruct.ref.loc13_39, %u32.loc13_52)
  983. // CHECK:STDOUT: %.loc13_55.2: type = converted %.loc13_55.1, constants.%tuple.type.80b [concrete = constants.%tuple.type.80b]
  984. // CHECK:STDOUT: %c.param: %tuple.type.80b = value_param call_param0
  985. // CHECK:STDOUT: %.loc13_32.1: type = splice_block %.loc13_32.3 [concrete = constants.%tuple.type.80b] {
  986. // CHECK:STDOUT: %AdaptStruct.ref.loc13_16: type = name_ref AdaptStruct, file.%AdaptStruct.decl [concrete = constants.%AdaptStruct]
  987. // CHECK:STDOUT: %int_32.loc13_29: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  988. // CHECK:STDOUT: %u32.loc13_29: type = class_type @UInt, @UInt(constants.%int_32) [concrete = constants.%u32]
  989. // CHECK:STDOUT: %.loc13_32.2: %tuple.type.24b = tuple_literal (%AdaptStruct.ref.loc13_16, %u32.loc13_29)
  990. // CHECK:STDOUT: %.loc13_32.3: type = converted %.loc13_32.2, constants.%tuple.type.80b [concrete = constants.%tuple.type.80b]
  991. // CHECK:STDOUT: }
  992. // CHECK:STDOUT: %c: %tuple.type.80b = bind_name c, %c.param
  993. // CHECK:STDOUT: %return.param: ref %tuple.type.80b = out_param call_param1
  994. // CHECK:STDOUT: %return: ref %tuple.type.80b = return_slot %return.param
  995. // CHECK:STDOUT: }
  996. // CHECK:STDOUT: }
  997. // CHECK:STDOUT:
  998. // CHECK:STDOUT: class @AdaptStruct {
  999. // CHECK:STDOUT: %int_32.loc5_14: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1000. // CHECK:STDOUT: %i32.loc5_14: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  1001. // CHECK:STDOUT: %int_32.loc5_23: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1002. // CHECK:STDOUT: %i32.loc5_23: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  1003. // CHECK:STDOUT: %struct_type.e.f: type = struct_type {.e: %i32, .f: %i32} [concrete = constants.%struct_type.e.f]
  1004. // CHECK:STDOUT: adapt_decl %struct_type.e.f [concrete]
  1005. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%struct_type.e.f [concrete = constants.%complete_type.511]
  1006. // CHECK:STDOUT: complete_type_witness = %complete_type
  1007. // CHECK:STDOUT:
  1008. // CHECK:STDOUT: !members:
  1009. // CHECK:STDOUT: .Self = constants.%AdaptStruct
  1010. // CHECK:STDOUT: }
  1011. // CHECK:STDOUT:
  1012. // CHECK:STDOUT: fn @I(%g.param: %AdaptStruct) -> %return.param: %AdaptStruct {
  1013. // CHECK:STDOUT: !entry:
  1014. // CHECK:STDOUT: name_binding_decl {
  1015. // CHECK:STDOUT: %h.patt: %pattern_type.f45 = binding_pattern h [concrete]
  1016. // CHECK:STDOUT: %h.var_patt: %pattern_type.f45 = var_pattern %h.patt [concrete]
  1017. // CHECK:STDOUT: }
  1018. // CHECK:STDOUT: %h.var: ref %AdaptStruct = var %h.var_patt
  1019. // CHECK:STDOUT: %g.ref: %AdaptStruct = name_ref g, %g
  1020. // CHECK:STDOUT: %.loc9_3.1: %struct_type.e.f = as_compatible %g.ref
  1021. // CHECK:STDOUT: %.loc9_3.2: %i32 = struct_access %.loc9_3.1, element0
  1022. // CHECK:STDOUT: %impl.elem0.loc9_3.1: %.7fa = impl_witness_access constants.%Copy.impl_witness.a32, element0 [concrete = constants.%Int.as.Copy.impl.Op.f59]
  1023. // CHECK:STDOUT: %bound_method.loc9_3.1: <bound method> = bound_method %.loc9_3.2, %impl.elem0.loc9_3.1
  1024. // CHECK:STDOUT: %specific_fn.loc9_3.1: <specific function> = specific_function %impl.elem0.loc9_3.1, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  1025. // CHECK:STDOUT: %bound_method.loc9_3.2: <bound method> = bound_method %.loc9_3.2, %specific_fn.loc9_3.1
  1026. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc9_3.1: init %i32 = call %bound_method.loc9_3.2(%.loc9_3.2)
  1027. // CHECK:STDOUT: %.loc9_3.3: ref %struct_type.e.f = as_compatible %h.var
  1028. // CHECK:STDOUT: %.loc9_3.4: ref %i32 = struct_access %.loc9_3.3, element0
  1029. // CHECK:STDOUT: %.loc9_3.5: init %i32 = initialize_from %Int.as.Copy.impl.Op.call.loc9_3.1 to %.loc9_3.4
  1030. // CHECK:STDOUT: %.loc9_3.6: %i32 = struct_access %.loc9_3.1, element1
  1031. // CHECK:STDOUT: %impl.elem0.loc9_3.2: %.7fa = impl_witness_access constants.%Copy.impl_witness.a32, element0 [concrete = constants.%Int.as.Copy.impl.Op.f59]
  1032. // CHECK:STDOUT: %bound_method.loc9_3.3: <bound method> = bound_method %.loc9_3.6, %impl.elem0.loc9_3.2
  1033. // CHECK:STDOUT: %specific_fn.loc9_3.2: <specific function> = specific_function %impl.elem0.loc9_3.2, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  1034. // CHECK:STDOUT: %bound_method.loc9_3.4: <bound method> = bound_method %.loc9_3.6, %specific_fn.loc9_3.2
  1035. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc9_3.2: init %i32 = call %bound_method.loc9_3.4(%.loc9_3.6)
  1036. // CHECK:STDOUT: %.loc9_3.7: ref %i32 = struct_access %.loc9_3.3, element1
  1037. // CHECK:STDOUT: %.loc9_3.8: init %i32 = initialize_from %Int.as.Copy.impl.Op.call.loc9_3.2 to %.loc9_3.7
  1038. // CHECK:STDOUT: %.loc9_3.9: init %struct_type.e.f = struct_init (%.loc9_3.5, %.loc9_3.8) to %.loc9_3.3
  1039. // CHECK:STDOUT: %.loc9_3.10: init %AdaptStruct = as_compatible %.loc9_3.9
  1040. // CHECK:STDOUT: %.loc9_3.11: init %AdaptStruct = converted %g.ref, %.loc9_3.10
  1041. // CHECK:STDOUT: assign %h.var, %.loc9_3.11
  1042. // CHECK:STDOUT: %AdaptStruct.ref.loc9: type = name_ref AdaptStruct, file.%AdaptStruct.decl [concrete = constants.%AdaptStruct]
  1043. // CHECK:STDOUT: %h: ref %AdaptStruct = bind_name h, %h.var
  1044. // CHECK:STDOUT: %h.ref: ref %AdaptStruct = name_ref h, %h
  1045. // CHECK:STDOUT: %.loc10_11.1: ref %struct_type.e.f = as_compatible %h.ref
  1046. // CHECK:STDOUT: %.loc10_11.2: ref %i32 = struct_access %.loc10_11.1, element0
  1047. // CHECK:STDOUT: %.loc10_11.3: %i32 = bind_value %.loc10_11.2
  1048. // CHECK:STDOUT: %impl.elem0.loc10_11.1: %.7fa = impl_witness_access constants.%Copy.impl_witness.a32, element0 [concrete = constants.%Int.as.Copy.impl.Op.f59]
  1049. // CHECK:STDOUT: %bound_method.loc10_11.1: <bound method> = bound_method %.loc10_11.3, %impl.elem0.loc10_11.1
  1050. // CHECK:STDOUT: %specific_fn.loc10_11.1: <specific function> = specific_function %impl.elem0.loc10_11.1, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  1051. // CHECK:STDOUT: %bound_method.loc10_11.2: <bound method> = bound_method %.loc10_11.3, %specific_fn.loc10_11.1
  1052. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc10_11.1: init %i32 = call %bound_method.loc10_11.2(%.loc10_11.3)
  1053. // CHECK:STDOUT: %.loc10_11.4: ref %struct_type.e.f = as_compatible %return
  1054. // CHECK:STDOUT: %.loc10_11.5: ref %i32 = struct_access %.loc10_11.4, element0
  1055. // CHECK:STDOUT: %.loc10_11.6: init %i32 = initialize_from %Int.as.Copy.impl.Op.call.loc10_11.1 to %.loc10_11.5
  1056. // CHECK:STDOUT: %.loc10_11.7: ref %i32 = struct_access %.loc10_11.1, element1
  1057. // CHECK:STDOUT: %.loc10_11.8: %i32 = bind_value %.loc10_11.7
  1058. // CHECK:STDOUT: %impl.elem0.loc10_11.2: %.7fa = impl_witness_access constants.%Copy.impl_witness.a32, element0 [concrete = constants.%Int.as.Copy.impl.Op.f59]
  1059. // CHECK:STDOUT: %bound_method.loc10_11.3: <bound method> = bound_method %.loc10_11.8, %impl.elem0.loc10_11.2
  1060. // CHECK:STDOUT: %specific_fn.loc10_11.2: <specific function> = specific_function %impl.elem0.loc10_11.2, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  1061. // CHECK:STDOUT: %bound_method.loc10_11.4: <bound method> = bound_method %.loc10_11.8, %specific_fn.loc10_11.2
  1062. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc10_11.2: init %i32 = call %bound_method.loc10_11.4(%.loc10_11.8)
  1063. // CHECK:STDOUT: %.loc10_11.9: ref %i32 = struct_access %.loc10_11.4, element1
  1064. // CHECK:STDOUT: %.loc10_11.10: init %i32 = initialize_from %Int.as.Copy.impl.Op.call.loc10_11.2 to %.loc10_11.9
  1065. // CHECK:STDOUT: %.loc10_11.11: init %struct_type.e.f = struct_init (%.loc10_11.6, %.loc10_11.10) to %.loc10_11.4
  1066. // CHECK:STDOUT: %.loc10_11.12: init %AdaptStruct = as_compatible %.loc10_11.11
  1067. // CHECK:STDOUT: %.loc10_11.13: init %AdaptStruct = converted %h.ref, %.loc10_11.12
  1068. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound: <bound method> = bound_method %h.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.e5f
  1069. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn: <specific function> = specific_function constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.e5f, @DestroyT.binding.as_type.as.Destroy.impl.Op(constants.%facet_value.14c) [concrete = constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.f51]
  1070. // CHECK:STDOUT: %bound_method.loc9_3.5: <bound method> = bound_method %h.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn
  1071. // CHECK:STDOUT: %addr: %ptr.e10 = addr_of %h.var
  1072. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method.loc9_3.5(%addr)
  1073. // CHECK:STDOUT: return %.loc10_11.13 to %return
  1074. // CHECK:STDOUT: }
  1075. // CHECK:STDOUT:
  1076. // CHECK:STDOUT: fn @InTuple(%c.param: %tuple.type.80b) -> %return.param: %tuple.type.80b {
  1077. // CHECK:STDOUT: !entry:
  1078. // CHECK:STDOUT: name_binding_decl {
  1079. // CHECK:STDOUT: %d.patt: %pattern_type.31d = binding_pattern d [concrete]
  1080. // CHECK:STDOUT: %d.var_patt: %pattern_type.31d = var_pattern %d.patt [concrete]
  1081. // CHECK:STDOUT: }
  1082. // CHECK:STDOUT: %d.var: ref %tuple.type.80b = var %d.var_patt
  1083. // CHECK:STDOUT: %c.ref: %tuple.type.80b = name_ref c, %c
  1084. // CHECK:STDOUT: %tuple.elem0.loc14_31.1: %AdaptStruct = tuple_access %c.ref, element0
  1085. // CHECK:STDOUT: %.loc14_31.1: %struct_type.e.f = as_compatible %tuple.elem0.loc14_31.1
  1086. // CHECK:STDOUT: %.loc14_31.2: %i32 = struct_access %.loc14_31.1, element0
  1087. // CHECK:STDOUT: %impl.elem0.loc14_31.1: %.7fa = impl_witness_access constants.%Copy.impl_witness.a32, element0 [concrete = constants.%Int.as.Copy.impl.Op.f59]
  1088. // CHECK:STDOUT: %bound_method.loc14_31.1: <bound method> = bound_method %.loc14_31.2, %impl.elem0.loc14_31.1
  1089. // CHECK:STDOUT: %specific_fn.loc14_31.1: <specific function> = specific_function %impl.elem0.loc14_31.1, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  1090. // CHECK:STDOUT: %bound_method.loc14_31.2: <bound method> = bound_method %.loc14_31.2, %specific_fn.loc14_31.1
  1091. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc14_31.1: init %i32 = call %bound_method.loc14_31.2(%.loc14_31.2)
  1092. // CHECK:STDOUT: %tuple.elem0.loc14_31.2: ref %AdaptStruct = tuple_access %d.var, element0
  1093. // CHECK:STDOUT: %.loc14_31.3: ref %struct_type.e.f = as_compatible %tuple.elem0.loc14_31.2
  1094. // CHECK:STDOUT: %.loc14_31.4: ref %i32 = struct_access %.loc14_31.3, element0
  1095. // CHECK:STDOUT: %.loc14_31.5: init %i32 = initialize_from %Int.as.Copy.impl.Op.call.loc14_31.1 to %.loc14_31.4
  1096. // CHECK:STDOUT: %.loc14_31.6: %i32 = struct_access %.loc14_31.1, element1
  1097. // CHECK:STDOUT: %impl.elem0.loc14_31.2: %.7fa = impl_witness_access constants.%Copy.impl_witness.a32, element0 [concrete = constants.%Int.as.Copy.impl.Op.f59]
  1098. // CHECK:STDOUT: %bound_method.loc14_31.3: <bound method> = bound_method %.loc14_31.6, %impl.elem0.loc14_31.2
  1099. // CHECK:STDOUT: %specific_fn.loc14_31.2: <specific function> = specific_function %impl.elem0.loc14_31.2, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  1100. // CHECK:STDOUT: %bound_method.loc14_31.4: <bound method> = bound_method %.loc14_31.6, %specific_fn.loc14_31.2
  1101. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc14_31.2: init %i32 = call %bound_method.loc14_31.4(%.loc14_31.6)
  1102. // CHECK:STDOUT: %.loc14_31.7: ref %i32 = struct_access %.loc14_31.3, element1
  1103. // CHECK:STDOUT: %.loc14_31.8: init %i32 = initialize_from %Int.as.Copy.impl.Op.call.loc14_31.2 to %.loc14_31.7
  1104. // CHECK:STDOUT: %.loc14_31.9: init %struct_type.e.f = struct_init (%.loc14_31.5, %.loc14_31.8) to %.loc14_31.3
  1105. // CHECK:STDOUT: %.loc14_31.10: init %AdaptStruct = as_compatible %.loc14_31.9
  1106. // CHECK:STDOUT: %.loc14_31.11: init %AdaptStruct = converted %tuple.elem0.loc14_31.1, %.loc14_31.10
  1107. // CHECK:STDOUT: %tuple.elem1.loc14_31.1: %u32 = tuple_access %c.ref, element1
  1108. // CHECK:STDOUT: %impl.elem0.loc14_31.3: %.fbf = impl_witness_access constants.%Copy.impl_witness.61c, element0 [concrete = constants.%UInt.as.Copy.impl.Op.1bb]
  1109. // CHECK:STDOUT: %bound_method.loc14_31.5: <bound method> = bound_method %tuple.elem1.loc14_31.1, %impl.elem0.loc14_31.3
  1110. // CHECK:STDOUT: %specific_fn.loc14_31.3: <specific function> = specific_function %impl.elem0.loc14_31.3, @UInt.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%UInt.as.Copy.impl.Op.specific_fn]
  1111. // CHECK:STDOUT: %bound_method.loc14_31.6: <bound method> = bound_method %tuple.elem1.loc14_31.1, %specific_fn.loc14_31.3
  1112. // CHECK:STDOUT: %UInt.as.Copy.impl.Op.call.loc14: init %u32 = call %bound_method.loc14_31.6(%tuple.elem1.loc14_31.1)
  1113. // CHECK:STDOUT: %tuple.elem1.loc14_31.2: ref %u32 = tuple_access %d.var, element1
  1114. // CHECK:STDOUT: %.loc14_31.12: init %u32 = initialize_from %UInt.as.Copy.impl.Op.call.loc14 to %tuple.elem1.loc14_31.2
  1115. // CHECK:STDOUT: %.loc14_31.13: init %tuple.type.80b = tuple_init (%.loc14_31.11, %.loc14_31.12) to %d.var
  1116. // CHECK:STDOUT: %.loc14_3: init %tuple.type.80b = converted %c.ref, %.loc14_31.13
  1117. // CHECK:STDOUT: assign %d.var, %.loc14_3
  1118. // CHECK:STDOUT: %.loc14_27.1: type = splice_block %.loc14_27.3 [concrete = constants.%tuple.type.80b] {
  1119. // CHECK:STDOUT: %AdaptStruct.ref.loc14: type = name_ref AdaptStruct, file.%AdaptStruct.decl [concrete = constants.%AdaptStruct]
  1120. // CHECK:STDOUT: %int_32.loc14: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1121. // CHECK:STDOUT: %u32.loc14: type = class_type @UInt, @UInt(constants.%int_32) [concrete = constants.%u32]
  1122. // CHECK:STDOUT: %.loc14_27.2: %tuple.type.24b = tuple_literal (%AdaptStruct.ref.loc14, %u32.loc14)
  1123. // CHECK:STDOUT: %.loc14_27.3: type = converted %.loc14_27.2, constants.%tuple.type.80b [concrete = constants.%tuple.type.80b]
  1124. // CHECK:STDOUT: }
  1125. // CHECK:STDOUT: %d: ref %tuple.type.80b = bind_name d, %d.var
  1126. // CHECK:STDOUT: %d.ref: ref %tuple.type.80b = name_ref d, %d
  1127. // CHECK:STDOUT: %tuple.elem0.loc15_10.1: ref %AdaptStruct = tuple_access %d.ref, element0
  1128. // CHECK:STDOUT: %.loc15_10.1: ref %struct_type.e.f = as_compatible %tuple.elem0.loc15_10.1
  1129. // CHECK:STDOUT: %.loc15_10.2: ref %i32 = struct_access %.loc15_10.1, element0
  1130. // CHECK:STDOUT: %.loc15_10.3: %i32 = bind_value %.loc15_10.2
  1131. // CHECK:STDOUT: %impl.elem0.loc15_10.1: %.7fa = impl_witness_access constants.%Copy.impl_witness.a32, element0 [concrete = constants.%Int.as.Copy.impl.Op.f59]
  1132. // CHECK:STDOUT: %bound_method.loc15_10.1: <bound method> = bound_method %.loc15_10.3, %impl.elem0.loc15_10.1
  1133. // CHECK:STDOUT: %specific_fn.loc15_10.1: <specific function> = specific_function %impl.elem0.loc15_10.1, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  1134. // CHECK:STDOUT: %bound_method.loc15_10.2: <bound method> = bound_method %.loc15_10.3, %specific_fn.loc15_10.1
  1135. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc15_10.1: init %i32 = call %bound_method.loc15_10.2(%.loc15_10.3)
  1136. // CHECK:STDOUT: %tuple.elem0.loc15_10.2: ref %AdaptStruct = tuple_access %return, element0
  1137. // CHECK:STDOUT: %.loc15_10.4: ref %struct_type.e.f = as_compatible %tuple.elem0.loc15_10.2
  1138. // CHECK:STDOUT: %.loc15_10.5: ref %i32 = struct_access %.loc15_10.4, element0
  1139. // CHECK:STDOUT: %.loc15_10.6: init %i32 = initialize_from %Int.as.Copy.impl.Op.call.loc15_10.1 to %.loc15_10.5
  1140. // CHECK:STDOUT: %.loc15_10.7: ref %i32 = struct_access %.loc15_10.1, element1
  1141. // CHECK:STDOUT: %.loc15_10.8: %i32 = bind_value %.loc15_10.7
  1142. // CHECK:STDOUT: %impl.elem0.loc15_10.2: %.7fa = impl_witness_access constants.%Copy.impl_witness.a32, element0 [concrete = constants.%Int.as.Copy.impl.Op.f59]
  1143. // CHECK:STDOUT: %bound_method.loc15_10.3: <bound method> = bound_method %.loc15_10.8, %impl.elem0.loc15_10.2
  1144. // CHECK:STDOUT: %specific_fn.loc15_10.2: <specific function> = specific_function %impl.elem0.loc15_10.2, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  1145. // CHECK:STDOUT: %bound_method.loc15_10.4: <bound method> = bound_method %.loc15_10.8, %specific_fn.loc15_10.2
  1146. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc15_10.2: init %i32 = call %bound_method.loc15_10.4(%.loc15_10.8)
  1147. // CHECK:STDOUT: %.loc15_10.9: ref %i32 = struct_access %.loc15_10.4, element1
  1148. // CHECK:STDOUT: %.loc15_10.10: init %i32 = initialize_from %Int.as.Copy.impl.Op.call.loc15_10.2 to %.loc15_10.9
  1149. // CHECK:STDOUT: %.loc15_10.11: init %struct_type.e.f = struct_init (%.loc15_10.6, %.loc15_10.10) to %.loc15_10.4
  1150. // CHECK:STDOUT: %.loc15_10.12: init %AdaptStruct = as_compatible %.loc15_10.11
  1151. // CHECK:STDOUT: %.loc15_10.13: init %AdaptStruct = converted %tuple.elem0.loc15_10.1, %.loc15_10.12
  1152. // CHECK:STDOUT: %tuple.elem1.loc15_10.1: ref %u32 = tuple_access %d.ref, element1
  1153. // CHECK:STDOUT: %.loc15_10.14: %u32 = bind_value %tuple.elem1.loc15_10.1
  1154. // CHECK:STDOUT: %impl.elem0.loc15_10.3: %.fbf = impl_witness_access constants.%Copy.impl_witness.61c, element0 [concrete = constants.%UInt.as.Copy.impl.Op.1bb]
  1155. // CHECK:STDOUT: %bound_method.loc15_10.5: <bound method> = bound_method %.loc15_10.14, %impl.elem0.loc15_10.3
  1156. // CHECK:STDOUT: %specific_fn.loc15_10.3: <specific function> = specific_function %impl.elem0.loc15_10.3, @UInt.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%UInt.as.Copy.impl.Op.specific_fn]
  1157. // CHECK:STDOUT: %bound_method.loc15_10.6: <bound method> = bound_method %.loc15_10.14, %specific_fn.loc15_10.3
  1158. // CHECK:STDOUT: %UInt.as.Copy.impl.Op.call.loc15: init %u32 = call %bound_method.loc15_10.6(%.loc15_10.14)
  1159. // CHECK:STDOUT: %tuple.elem1.loc15_10.2: ref %u32 = tuple_access %return, element1
  1160. // CHECK:STDOUT: %.loc15_10.15: init %u32 = initialize_from %UInt.as.Copy.impl.Op.call.loc15 to %tuple.elem1.loc15_10.2
  1161. // CHECK:STDOUT: %.loc15_10.16: init %tuple.type.80b = tuple_init (%.loc15_10.13, %.loc15_10.15) to %return
  1162. // CHECK:STDOUT: %.loc15_11: init %tuple.type.80b = converted %d.ref, %.loc15_10.16
  1163. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound: <bound method> = bound_method %d.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.41f
  1164. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn: <specific function> = specific_function constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.41f, @DestroyT.binding.as_type.as.Destroy.impl.Op(constants.%facet_value.03e) [concrete = constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.ee0]
  1165. // CHECK:STDOUT: %bound_method.loc14_3: <bound method> = bound_method %d.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn
  1166. // CHECK:STDOUT: %addr: %ptr.b09 = addr_of %d.var
  1167. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method.loc14_3(%addr)
  1168. // CHECK:STDOUT: return %.loc15_11 to %return
  1169. // CHECK:STDOUT: }
  1170. // CHECK:STDOUT: