import_builtin_call.carbon 93 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264
  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/none.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/impl/import_builtin_call.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/import_builtin_call.carbon
  14. // --- generic_impl.carbon
  15. library "[[@TEST_NAME]]";
  16. interface Add {
  17. fn Op[self: Self](other: Self) -> Self;
  18. }
  19. fn IntLiteral() -> type = "int_literal.make_type";
  20. fn Int(n: IntLiteral()) -> type = "int.make_type_signed";
  21. class MyInt(N:! IntLiteral()) {
  22. adapt Int(N);
  23. }
  24. impl forall [N:! IntLiteral()] MyInt(N) as Add {
  25. fn Op[self: Self](other: Self) -> Self = "int.sadd";
  26. }
  27. fn Double[N:! IntLiteral()](x: MyInt(N)) -> MyInt(N) {
  28. return x.(Add.Op)(x);
  29. }
  30. // --- use_generic_impl.carbon
  31. library "[[@TEST_NAME]]";
  32. import library "generic_impl";
  33. fn CallImportedDouble(n: MyInt(64)) -> MyInt(64) {
  34. return Double(n);
  35. }
  36. // --- convert_symbolic.carbon
  37. library "[[@TEST_NAME]]";
  38. fn IntLiteral() -> type = "int_literal.make_type";
  39. fn Int(n: IntLiteral()) -> type = "int.make_type_signed";
  40. fn ToLiteral(n: Int(32)) -> IntLiteral() = "int.convert_checked";
  41. fn FromLiteral(n: IntLiteral()) -> Int(32) = "int.convert_checked";
  42. fn Make(N:! Int(32)) -> Int(ToLiteral(N)) { return Make(N); }
  43. class OtherInt {
  44. adapt Int(32);
  45. fn ToLiteral[self: Self]() -> IntLiteral();
  46. };
  47. fn OtherInt.ToLiteral[self: Self]() -> IntLiteral() = "int.convert_checked";
  48. fn MakeFromClass(N:! OtherInt) -> Int(N.ToLiteral()) { return MakeFromClass(N); }
  49. // --- use_convert_symbolic.carbon
  50. library "[[@TEST_NAME]]";
  51. import library "convert_symbolic";
  52. var m: Int(64) = Make(FromLiteral(64));
  53. var n: Int(64) = MakeFromClass(FromLiteral(64) as OtherInt);
  54. // CHECK:STDOUT: --- generic_impl.carbon
  55. // CHECK:STDOUT:
  56. // CHECK:STDOUT: constants {
  57. // CHECK:STDOUT: %Add.type: type = facet_type <@Add> [concrete]
  58. // CHECK:STDOUT: %Self: %Add.type = symbolic_binding Self, 0 [symbolic]
  59. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic]
  60. // CHECK:STDOUT: %pattern_type.f75: type = pattern_type %Self.binding.as_type [symbolic]
  61. // CHECK:STDOUT: %.b66: form = init_form %Self.binding.as_type, call_param2 [symbolic]
  62. // CHECK:STDOUT: %Add.Op.type: type = fn_type @Add.Op [concrete]
  63. // CHECK:STDOUT: %Add.Op: %Add.Op.type = struct_value () [concrete]
  64. // CHECK:STDOUT: %Add.assoc_type: type = assoc_entity_type @Add [concrete]
  65. // CHECK:STDOUT: %assoc0: %Add.assoc_type = assoc_entity element0, @Add.%Add.Op.decl [concrete]
  66. // CHECK:STDOUT: %.d96: form = init_form type, call_param0 [concrete]
  67. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  68. // CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [concrete]
  69. // CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [concrete]
  70. // CHECK:STDOUT: %pattern_type.dc0: type = pattern_type Core.IntLiteral [concrete]
  71. // CHECK:STDOUT: %.39d: form = init_form type, call_param1 [concrete]
  72. // CHECK:STDOUT: %Int.type: type = fn_type @Int [concrete]
  73. // CHECK:STDOUT: %Int: %Int.type = struct_value () [concrete]
  74. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  75. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self]
  76. // CHECK:STDOUT: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic]
  77. // CHECK:STDOUT: %MyInt.type: type = generic_class_type @MyInt [concrete]
  78. // CHECK:STDOUT: %MyInt.generic: %MyInt.type = struct_value () [concrete]
  79. // CHECK:STDOUT: %MyInt: type = class_type @MyInt, @MyInt(%N) [symbolic]
  80. // CHECK:STDOUT: %iN.builtin: type = int_type signed, %N [symbolic]
  81. // CHECK:STDOUT: %require_complete.269: <witness> = require_complete_type %iN.builtin [symbolic]
  82. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %iN.builtin [symbolic]
  83. // CHECK:STDOUT: %Add.impl_witness: <witness> = impl_witness @MyInt.as.Add.impl.%Add.impl_witness_table, @MyInt.as.Add.impl(%N) [symbolic]
  84. // CHECK:STDOUT: %pattern_type.1a3: type = pattern_type %MyInt [symbolic]
  85. // CHECK:STDOUT: %.d91: form = init_form %MyInt, call_param2 [symbolic]
  86. // CHECK:STDOUT: %MyInt.as.Add.impl.Op.type: type = fn_type @MyInt.as.Add.impl.Op, @MyInt.as.Add.impl(%N) [symbolic]
  87. // CHECK:STDOUT: %MyInt.as.Add.impl.Op: %MyInt.as.Add.impl.Op.type = struct_value () [symbolic]
  88. // CHECK:STDOUT: %require_complete.9fa: <witness> = require_complete_type %MyInt [symbolic]
  89. // CHECK:STDOUT: %Add.facet.fbb: %Add.type = facet_value %MyInt, (%Add.impl_witness) [symbolic]
  90. // CHECK:STDOUT: %.b3a: form = init_form %MyInt, call_param1 [symbolic]
  91. // CHECK:STDOUT: %Double.type: type = fn_type @Double [concrete]
  92. // CHECK:STDOUT: %Double: %Double.type = struct_value () [concrete]
  93. // CHECK:STDOUT: %.c60: require_specific_def_type = require_specific_def @MyInt.as.Add.impl(%N) [symbolic]
  94. // CHECK:STDOUT: %Add.lookup_impl_witness: <witness> = lookup_impl_witness %MyInt, @Add [symbolic]
  95. // CHECK:STDOUT: %Add.facet.9ab: %Add.type = facet_value %MyInt, (%Add.lookup_impl_witness) [symbolic]
  96. // CHECK:STDOUT: %.932: type = fn_type_with_self_type %Add.Op.type, %Add.facet.9ab [symbolic]
  97. // CHECK:STDOUT: %impl.elem0: %.932 = impl_witness_access %Add.lookup_impl_witness, element0 [symbolic]
  98. // CHECK:STDOUT: %specific_impl_fn: <specific function> = specific_impl_function %impl.elem0, @Add.Op(%Add.facet.9ab) [symbolic]
  99. // CHECK:STDOUT: }
  100. // CHECK:STDOUT:
  101. // CHECK:STDOUT: file {
  102. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  103. // CHECK:STDOUT: .Add = %Add.decl
  104. // CHECK:STDOUT: .IntLiteral = %IntLiteral.decl
  105. // CHECK:STDOUT: .Int = %Int.decl
  106. // CHECK:STDOUT: .MyInt = %MyInt.decl
  107. // CHECK:STDOUT: .Double = %Double.decl
  108. // CHECK:STDOUT: }
  109. // CHECK:STDOUT: %Add.decl: type = interface_decl @Add [concrete = constants.%Add.type] {} {}
  110. // CHECK:STDOUT: %IntLiteral.decl: %IntLiteral.type = fn_decl @IntLiteral [concrete = constants.%IntLiteral] {
  111. // CHECK:STDOUT: %return.patt: %pattern_type.98f = return_slot_pattern [concrete]
  112. // CHECK:STDOUT: %return.param_patt: %pattern_type.98f = out_param_pattern %return.patt, call_param0 [concrete]
  113. // CHECK:STDOUT: } {
  114. // CHECK:STDOUT: %.loc8: form = init_form type, call_param0 [concrete = constants.%.d96]
  115. // CHECK:STDOUT: %return.param: ref type = out_param call_param0
  116. // CHECK:STDOUT: %return: ref type = return_slot %return.param
  117. // CHECK:STDOUT: }
  118. // CHECK:STDOUT: %Int.decl: %Int.type = fn_decl @Int [concrete = constants.%Int] {
  119. // CHECK:STDOUT: %n.patt: %pattern_type.dc0 = value_binding_pattern n [concrete]
  120. // CHECK:STDOUT: %n.param_patt: %pattern_type.dc0 = value_param_pattern %n.patt, call_param0 [concrete]
  121. // CHECK:STDOUT: %return.patt: %pattern_type.98f = return_slot_pattern [concrete]
  122. // CHECK:STDOUT: %return.param_patt: %pattern_type.98f = out_param_pattern %return.patt, call_param1 [concrete]
  123. // CHECK:STDOUT: } {
  124. // CHECK:STDOUT: %.loc9_28: form = init_form type, call_param1 [concrete = constants.%.39d]
  125. // CHECK:STDOUT: %n.param: Core.IntLiteral = value_param call_param0
  126. // CHECK:STDOUT: %.loc9_22.1: type = splice_block %.loc9_22.3 [concrete = Core.IntLiteral] {
  127. // CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, file.%IntLiteral.decl [concrete = constants.%IntLiteral]
  128. // CHECK:STDOUT: %IntLiteral.call: init type = call %IntLiteral.ref() [concrete = Core.IntLiteral]
  129. // CHECK:STDOUT: %.loc9_22.2: type = value_of_initializer %IntLiteral.call [concrete = Core.IntLiteral]
  130. // CHECK:STDOUT: %.loc9_22.3: type = converted %IntLiteral.call, %.loc9_22.2 [concrete = Core.IntLiteral]
  131. // CHECK:STDOUT: }
  132. // CHECK:STDOUT: %n: Core.IntLiteral = value_binding n, %n.param
  133. // CHECK:STDOUT: %return.param: ref type = out_param call_param1
  134. // CHECK:STDOUT: %return: ref type = return_slot %return.param
  135. // CHECK:STDOUT: }
  136. // CHECK:STDOUT: %MyInt.decl: %MyInt.type = class_decl @MyInt [concrete = constants.%MyInt.generic] {
  137. // CHECK:STDOUT: %N.patt: %pattern_type.dc0 = symbolic_binding_pattern N, 0 [concrete]
  138. // CHECK:STDOUT: } {
  139. // CHECK:STDOUT: %.loc11_28.1: type = splice_block %.loc11_28.3 [concrete = Core.IntLiteral] {
  140. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  141. // CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, file.%IntLiteral.decl [concrete = constants.%IntLiteral]
  142. // CHECK:STDOUT: %IntLiteral.call: init type = call %IntLiteral.ref() [concrete = Core.IntLiteral]
  143. // CHECK:STDOUT: %.loc11_28.2: type = value_of_initializer %IntLiteral.call [concrete = Core.IntLiteral]
  144. // CHECK:STDOUT: %.loc11_28.3: type = converted %IntLiteral.call, %.loc11_28.2 [concrete = Core.IntLiteral]
  145. // CHECK:STDOUT: }
  146. // CHECK:STDOUT: %N.loc11_13.2: Core.IntLiteral = symbolic_binding N, 0 [symbolic = %N.loc11_13.1 (constants.%N)]
  147. // CHECK:STDOUT: }
  148. // CHECK:STDOUT: impl_decl @MyInt.as.Add.impl [concrete] {
  149. // CHECK:STDOUT: %N.patt: %pattern_type.dc0 = symbolic_binding_pattern N, 0 [concrete]
  150. // CHECK:STDOUT: } {
  151. // CHECK:STDOUT: %MyInt.ref: %MyInt.type = name_ref MyInt, file.%MyInt.decl [concrete = constants.%MyInt.generic]
  152. // CHECK:STDOUT: %N.ref: Core.IntLiteral = name_ref N, %N.loc15_14.2 [symbolic = %N.loc15_14.1 (constants.%N)]
  153. // CHECK:STDOUT: %MyInt.loc15_39.2: type = class_type @MyInt, @MyInt(constants.%N) [symbolic = %MyInt.loc15_39.1 (constants.%MyInt)]
  154. // CHECK:STDOUT: %Add.ref: type = name_ref Add, file.%Add.decl [concrete = constants.%Add.type]
  155. // CHECK:STDOUT: %.loc15_29.1: type = splice_block %.loc15_29.3 [concrete = Core.IntLiteral] {
  156. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  157. // CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, file.%IntLiteral.decl [concrete = constants.%IntLiteral]
  158. // CHECK:STDOUT: %IntLiteral.call: init type = call %IntLiteral.ref() [concrete = Core.IntLiteral]
  159. // CHECK:STDOUT: %.loc15_29.2: type = value_of_initializer %IntLiteral.call [concrete = Core.IntLiteral]
  160. // CHECK:STDOUT: %.loc15_29.3: type = converted %IntLiteral.call, %.loc15_29.2 [concrete = Core.IntLiteral]
  161. // CHECK:STDOUT: }
  162. // CHECK:STDOUT: %N.loc15_14.2: Core.IntLiteral = symbolic_binding N, 0 [symbolic = %N.loc15_14.1 (constants.%N)]
  163. // CHECK:STDOUT: }
  164. // CHECK:STDOUT: %Double.decl: %Double.type = fn_decl @Double [concrete = constants.%Double] {
  165. // CHECK:STDOUT: %N.patt: %pattern_type.dc0 = symbolic_binding_pattern N, 0 [concrete]
  166. // CHECK:STDOUT: %x.patt: @Double.%pattern_type (%pattern_type.1a3) = value_binding_pattern x [concrete]
  167. // CHECK:STDOUT: %x.param_patt: @Double.%pattern_type (%pattern_type.1a3) = value_param_pattern %x.patt, call_param0 [concrete]
  168. // CHECK:STDOUT: %return.patt: @Double.%pattern_type (%pattern_type.1a3) = return_slot_pattern [concrete]
  169. // CHECK:STDOUT: %return.param_patt: @Double.%pattern_type (%pattern_type.1a3) = out_param_pattern %return.patt, call_param1 [concrete]
  170. // CHECK:STDOUT: } {
  171. // CHECK:STDOUT: %MyInt.ref.loc19_45: %MyInt.type = name_ref MyInt, file.%MyInt.decl [concrete = constants.%MyInt.generic]
  172. // CHECK:STDOUT: %N.ref.loc19_51: Core.IntLiteral = name_ref N, %N.loc19_11.2 [symbolic = %N.loc19_11.1 (constants.%N)]
  173. // CHECK:STDOUT: %MyInt.loc19_52: type = class_type @MyInt, @MyInt(constants.%N) [symbolic = %MyInt.loc19_39.1 (constants.%MyInt)]
  174. // CHECK:STDOUT: %.loc19_52.2: form = init_form %MyInt.loc19_52, call_param1 [symbolic = %.loc19_52.1 (constants.%.b3a)]
  175. // CHECK:STDOUT: %.loc19_26.1: type = splice_block %.loc19_26.3 [concrete = Core.IntLiteral] {
  176. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  177. // CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, file.%IntLiteral.decl [concrete = constants.%IntLiteral]
  178. // CHECK:STDOUT: %IntLiteral.call: init type = call %IntLiteral.ref() [concrete = Core.IntLiteral]
  179. // CHECK:STDOUT: %.loc19_26.2: type = value_of_initializer %IntLiteral.call [concrete = Core.IntLiteral]
  180. // CHECK:STDOUT: %.loc19_26.3: type = converted %IntLiteral.call, %.loc19_26.2 [concrete = Core.IntLiteral]
  181. // CHECK:STDOUT: }
  182. // CHECK:STDOUT: %N.loc19_11.2: Core.IntLiteral = symbolic_binding N, 0 [symbolic = %N.loc19_11.1 (constants.%N)]
  183. // CHECK:STDOUT: %x.param: @Double.%MyInt.loc19_39.1 (%MyInt) = value_param call_param0
  184. // CHECK:STDOUT: %.loc19_39: type = splice_block %MyInt.loc19_39.2 [symbolic = %MyInt.loc19_39.1 (constants.%MyInt)] {
  185. // CHECK:STDOUT: %MyInt.ref.loc19_32: %MyInt.type = name_ref MyInt, file.%MyInt.decl [concrete = constants.%MyInt.generic]
  186. // CHECK:STDOUT: %N.ref.loc19_38: Core.IntLiteral = name_ref N, %N.loc19_11.2 [symbolic = %N.loc19_11.1 (constants.%N)]
  187. // CHECK:STDOUT: %MyInt.loc19_39.2: type = class_type @MyInt, @MyInt(constants.%N) [symbolic = %MyInt.loc19_39.1 (constants.%MyInt)]
  188. // CHECK:STDOUT: }
  189. // CHECK:STDOUT: %x: @Double.%MyInt.loc19_39.1 (%MyInt) = value_binding x, %x.param
  190. // CHECK:STDOUT: %return.param: ref @Double.%MyInt.loc19_39.1 (%MyInt) = out_param call_param1
  191. // CHECK:STDOUT: %return: ref @Double.%MyInt.loc19_39.1 (%MyInt) = return_slot %return.param
  192. // CHECK:STDOUT: }
  193. // CHECK:STDOUT: }
  194. // CHECK:STDOUT:
  195. // CHECK:STDOUT: interface @Add {
  196. // CHECK:STDOUT: %Self: %Add.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  197. // CHECK:STDOUT: %Add.Op.decl: %Add.Op.type = fn_decl @Add.Op [concrete = constants.%Add.Op] {
  198. // CHECK:STDOUT: %self.patt: @Add.Op.%pattern_type (%pattern_type.f75) = value_binding_pattern self [concrete]
  199. // CHECK:STDOUT: %self.param_patt: @Add.Op.%pattern_type (%pattern_type.f75) = value_param_pattern %self.patt, call_param0 [concrete]
  200. // CHECK:STDOUT: %other.patt: @Add.Op.%pattern_type (%pattern_type.f75) = value_binding_pattern other [concrete]
  201. // CHECK:STDOUT: %other.param_patt: @Add.Op.%pattern_type (%pattern_type.f75) = value_param_pattern %other.patt, call_param1 [concrete]
  202. // CHECK:STDOUT: %return.patt: @Add.Op.%pattern_type (%pattern_type.f75) = return_slot_pattern [concrete]
  203. // CHECK:STDOUT: %return.param_patt: @Add.Op.%pattern_type (%pattern_type.f75) = out_param_pattern %return.patt, call_param2 [concrete]
  204. // CHECK:STDOUT: } {
  205. // CHECK:STDOUT: %Self.ref.loc5_37: %Add.type = name_ref Self, @Add.%Self [symbolic = %Self (constants.%Self)]
  206. // CHECK:STDOUT: %Self.as_type.loc5_37: type = facet_access_type %Self.ref.loc5_37 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  207. // CHECK:STDOUT: %.loc5_37.2: type = converted %Self.ref.loc5_37, %Self.as_type.loc5_37 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  208. // CHECK:STDOUT: %.loc5_37.3: form = init_form %.loc5_37.2, call_param2 [symbolic = %.loc5_37.1 (constants.%.b66)]
  209. // CHECK:STDOUT: %self.param: @Add.Op.%Self.binding.as_type (%Self.binding.as_type) = value_param call_param0
  210. // CHECK:STDOUT: %.loc5_15.1: type = splice_block %.loc5_15.2 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] {
  211. // CHECK:STDOUT: %Self.ref.loc5_15: %Add.type = name_ref Self, @Add.%Self [symbolic = %Self (constants.%Self)]
  212. // CHECK:STDOUT: %Self.as_type.loc5_15: type = facet_access_type %Self.ref.loc5_15 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  213. // CHECK:STDOUT: %.loc5_15.2: type = converted %Self.ref.loc5_15, %Self.as_type.loc5_15 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  214. // CHECK:STDOUT: }
  215. // CHECK:STDOUT: %self: @Add.Op.%Self.binding.as_type (%Self.binding.as_type) = value_binding self, %self.param
  216. // CHECK:STDOUT: %other.param: @Add.Op.%Self.binding.as_type (%Self.binding.as_type) = value_param call_param1
  217. // CHECK:STDOUT: %.loc5_28.1: type = splice_block %.loc5_28.2 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] {
  218. // CHECK:STDOUT: %Self.ref.loc5_28: %Add.type = name_ref Self, @Add.%Self [symbolic = %Self (constants.%Self)]
  219. // CHECK:STDOUT: %Self.as_type.loc5_28: type = facet_access_type %Self.ref.loc5_28 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  220. // CHECK:STDOUT: %.loc5_28.2: type = converted %Self.ref.loc5_28, %Self.as_type.loc5_28 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  221. // CHECK:STDOUT: }
  222. // CHECK:STDOUT: %other: @Add.Op.%Self.binding.as_type (%Self.binding.as_type) = value_binding other, %other.param
  223. // CHECK:STDOUT: %return.param: ref @Add.Op.%Self.binding.as_type (%Self.binding.as_type) = out_param call_param2
  224. // CHECK:STDOUT: %return: ref @Add.Op.%Self.binding.as_type (%Self.binding.as_type) = return_slot %return.param
  225. // CHECK:STDOUT: }
  226. // CHECK:STDOUT: %assoc0: %Add.assoc_type = assoc_entity element0, %Add.Op.decl [concrete = constants.%assoc0]
  227. // CHECK:STDOUT:
  228. // CHECK:STDOUT: !members:
  229. // CHECK:STDOUT: .Self = %Self
  230. // CHECK:STDOUT: .Op = %assoc0
  231. // CHECK:STDOUT: witness = (%Add.Op.decl)
  232. // CHECK:STDOUT:
  233. // CHECK:STDOUT: !requires:
  234. // CHECK:STDOUT: }
  235. // CHECK:STDOUT:
  236. // CHECK:STDOUT: generic impl @MyInt.as.Add.impl(%N.loc15_14.2: Core.IntLiteral) {
  237. // CHECK:STDOUT: %N.loc15_14.1: Core.IntLiteral = symbolic_binding N, 0 [symbolic = %N.loc15_14.1 (constants.%N)]
  238. // CHECK:STDOUT: %MyInt.loc15_39.1: type = class_type @MyInt, @MyInt(%N.loc15_14.1) [symbolic = %MyInt.loc15_39.1 (constants.%MyInt)]
  239. // CHECK:STDOUT: %Add.impl_witness.loc15_48.2: <witness> = impl_witness %Add.impl_witness_table, @MyInt.as.Add.impl(%N.loc15_14.1) [symbolic = %Add.impl_witness.loc15_48.2 (constants.%Add.impl_witness)]
  240. // CHECK:STDOUT:
  241. // CHECK:STDOUT: !definition:
  242. // CHECK:STDOUT: %MyInt.as.Add.impl.Op.type: type = fn_type @MyInt.as.Add.impl.Op, @MyInt.as.Add.impl(%N.loc15_14.1) [symbolic = %MyInt.as.Add.impl.Op.type (constants.%MyInt.as.Add.impl.Op.type)]
  243. // CHECK:STDOUT: %MyInt.as.Add.impl.Op: @MyInt.as.Add.impl.%MyInt.as.Add.impl.Op.type (%MyInt.as.Add.impl.Op.type) = struct_value () [symbolic = %MyInt.as.Add.impl.Op (constants.%MyInt.as.Add.impl.Op)]
  244. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %MyInt.loc15_39.1 [symbolic = %require_complete (constants.%require_complete.9fa)]
  245. // CHECK:STDOUT:
  246. // CHECK:STDOUT: impl: %MyInt.loc15_39.2 as %Add.ref {
  247. // CHECK:STDOUT: %MyInt.as.Add.impl.Op.decl: @MyInt.as.Add.impl.%MyInt.as.Add.impl.Op.type (%MyInt.as.Add.impl.Op.type) = fn_decl @MyInt.as.Add.impl.Op [symbolic = @MyInt.as.Add.impl.%MyInt.as.Add.impl.Op (constants.%MyInt.as.Add.impl.Op)] {
  248. // CHECK:STDOUT: %self.patt: @MyInt.as.Add.impl.Op.%pattern_type (%pattern_type.1a3) = value_binding_pattern self [concrete]
  249. // CHECK:STDOUT: %self.param_patt: @MyInt.as.Add.impl.Op.%pattern_type (%pattern_type.1a3) = value_param_pattern %self.patt, call_param0 [concrete]
  250. // CHECK:STDOUT: %other.patt: @MyInt.as.Add.impl.Op.%pattern_type (%pattern_type.1a3) = value_binding_pattern other [concrete]
  251. // CHECK:STDOUT: %other.param_patt: @MyInt.as.Add.impl.Op.%pattern_type (%pattern_type.1a3) = value_param_pattern %other.patt, call_param1 [concrete]
  252. // CHECK:STDOUT: %return.patt: @MyInt.as.Add.impl.Op.%pattern_type (%pattern_type.1a3) = return_slot_pattern [concrete]
  253. // CHECK:STDOUT: %return.param_patt: @MyInt.as.Add.impl.Op.%pattern_type (%pattern_type.1a3) = out_param_pattern %return.patt, call_param2 [concrete]
  254. // CHECK:STDOUT: } {
  255. // CHECK:STDOUT: %Self.ref.loc16_37: type = name_ref Self, @MyInt.as.Add.impl.%MyInt.loc15_39.2 [symbolic = %MyInt (constants.%MyInt)]
  256. // CHECK:STDOUT: %.loc16_37.2: form = init_form %Self.ref.loc16_37, call_param2 [symbolic = %.loc16_37.1 (constants.%.d91)]
  257. // CHECK:STDOUT: %self.param: @MyInt.as.Add.impl.Op.%MyInt (%MyInt) = value_param call_param0
  258. // CHECK:STDOUT: %Self.ref.loc16_15: type = name_ref Self, @MyInt.as.Add.impl.%MyInt.loc15_39.2 [symbolic = %MyInt (constants.%MyInt)]
  259. // CHECK:STDOUT: %self: @MyInt.as.Add.impl.Op.%MyInt (%MyInt) = value_binding self, %self.param
  260. // CHECK:STDOUT: %other.param: @MyInt.as.Add.impl.Op.%MyInt (%MyInt) = value_param call_param1
  261. // CHECK:STDOUT: %Self.ref.loc16_28: type = name_ref Self, @MyInt.as.Add.impl.%MyInt.loc15_39.2 [symbolic = %MyInt (constants.%MyInt)]
  262. // CHECK:STDOUT: %other: @MyInt.as.Add.impl.Op.%MyInt (%MyInt) = value_binding other, %other.param
  263. // CHECK:STDOUT: %return.param: ref @MyInt.as.Add.impl.Op.%MyInt (%MyInt) = out_param call_param2
  264. // CHECK:STDOUT: %return: ref @MyInt.as.Add.impl.Op.%MyInt (%MyInt) = return_slot %return.param
  265. // CHECK:STDOUT: }
  266. // CHECK:STDOUT: %Add.impl_witness_table = impl_witness_table (%MyInt.as.Add.impl.Op.decl), @MyInt.as.Add.impl [concrete]
  267. // CHECK:STDOUT: %Add.impl_witness.loc15_48.1: <witness> = impl_witness %Add.impl_witness_table, @MyInt.as.Add.impl(constants.%N) [symbolic = %Add.impl_witness.loc15_48.2 (constants.%Add.impl_witness)]
  268. // CHECK:STDOUT:
  269. // CHECK:STDOUT: !members:
  270. // CHECK:STDOUT: .Op = %MyInt.as.Add.impl.Op.decl
  271. // CHECK:STDOUT: witness = %Add.impl_witness.loc15_48.1
  272. // CHECK:STDOUT: }
  273. // CHECK:STDOUT: }
  274. // CHECK:STDOUT:
  275. // CHECK:STDOUT: generic class @MyInt(%N.loc11_13.2: Core.IntLiteral) {
  276. // CHECK:STDOUT: %N.loc11_13.1: Core.IntLiteral = symbolic_binding N, 0 [symbolic = %N.loc11_13.1 (constants.%N)]
  277. // CHECK:STDOUT:
  278. // CHECK:STDOUT: !definition:
  279. // CHECK:STDOUT: %iN.builtin: type = int_type signed, %N.loc11_13.1 [symbolic = %iN.builtin (constants.%iN.builtin)]
  280. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %iN.builtin [symbolic = %require_complete (constants.%require_complete.269)]
  281. // CHECK:STDOUT: %complete_type.loc13_1.2: <witness> = complete_type_witness %iN.builtin [symbolic = %complete_type.loc13_1.2 (constants.%complete_type)]
  282. // CHECK:STDOUT:
  283. // CHECK:STDOUT: class {
  284. // CHECK:STDOUT: %Int.ref: %Int.type = name_ref Int, file.%Int.decl [concrete = constants.%Int]
  285. // CHECK:STDOUT: %N.ref: Core.IntLiteral = name_ref N, %N.loc11_13.2 [symbolic = %N.loc11_13.1 (constants.%N)]
  286. // CHECK:STDOUT: %Int.call: init type = call %Int.ref(%N.ref) [symbolic = %iN.builtin (constants.%iN.builtin)]
  287. // CHECK:STDOUT: %.loc12_15.1: type = value_of_initializer %Int.call [symbolic = %iN.builtin (constants.%iN.builtin)]
  288. // CHECK:STDOUT: %.loc12_15.2: type = converted %Int.call, %.loc12_15.1 [symbolic = %iN.builtin (constants.%iN.builtin)]
  289. // CHECK:STDOUT: adapt_decl %.loc12_15.2 [concrete]
  290. // CHECK:STDOUT: %complete_type.loc13_1.1: <witness> = complete_type_witness constants.%iN.builtin [symbolic = %complete_type.loc13_1.2 (constants.%complete_type)]
  291. // CHECK:STDOUT: complete_type_witness = %complete_type.loc13_1.1
  292. // CHECK:STDOUT:
  293. // CHECK:STDOUT: !members:
  294. // CHECK:STDOUT: .Self = constants.%MyInt
  295. // CHECK:STDOUT: .Int = <poisoned>
  296. // CHECK:STDOUT: .N = <poisoned>
  297. // CHECK:STDOUT: }
  298. // CHECK:STDOUT: }
  299. // CHECK:STDOUT:
  300. // CHECK:STDOUT: generic fn @Add.Op(@Add.%Self: %Add.type) {
  301. // CHECK:STDOUT: %Self: %Add.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self)]
  302. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  303. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type (constants.%pattern_type.f75)]
  304. // CHECK:STDOUT: %.loc5_37.1: form = init_form %Self.binding.as_type, call_param2 [symbolic = %.loc5_37.1 (constants.%.b66)]
  305. // CHECK:STDOUT:
  306. // CHECK:STDOUT: fn(%self.param: @Add.Op.%Self.binding.as_type (%Self.binding.as_type), %other.param: @Add.Op.%Self.binding.as_type (%Self.binding.as_type)) -> @Add.Op.%Self.binding.as_type (%Self.binding.as_type);
  307. // CHECK:STDOUT: }
  308. // CHECK:STDOUT:
  309. // CHECK:STDOUT: fn @IntLiteral() -> type = "int_literal.make_type";
  310. // CHECK:STDOUT:
  311. // CHECK:STDOUT: fn @Int(%n.param: Core.IntLiteral) -> type = "int.make_type_signed";
  312. // CHECK:STDOUT:
  313. // CHECK:STDOUT: generic fn @MyInt.as.Add.impl.Op(@MyInt.as.Add.impl.%N.loc15_14.2: Core.IntLiteral) {
  314. // CHECK:STDOUT: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic = %N (constants.%N)]
  315. // CHECK:STDOUT: %MyInt: type = class_type @MyInt, @MyInt(%N) [symbolic = %MyInt (constants.%MyInt)]
  316. // CHECK:STDOUT: %pattern_type: type = pattern_type %MyInt [symbolic = %pattern_type (constants.%pattern_type.1a3)]
  317. // CHECK:STDOUT: %.loc16_37.1: form = init_form %MyInt, call_param2 [symbolic = %.loc16_37.1 (constants.%.d91)]
  318. // CHECK:STDOUT:
  319. // CHECK:STDOUT: !definition:
  320. // CHECK:STDOUT:
  321. // CHECK:STDOUT: fn(%self.param: @MyInt.as.Add.impl.Op.%MyInt (%MyInt), %other.param: @MyInt.as.Add.impl.Op.%MyInt (%MyInt)) -> @MyInt.as.Add.impl.Op.%MyInt (%MyInt) = "int.sadd";
  322. // CHECK:STDOUT: }
  323. // CHECK:STDOUT:
  324. // CHECK:STDOUT: generic fn @Double(%N.loc19_11.2: Core.IntLiteral) {
  325. // CHECK:STDOUT: %N.loc19_11.1: Core.IntLiteral = symbolic_binding N, 0 [symbolic = %N.loc19_11.1 (constants.%N)]
  326. // CHECK:STDOUT: %MyInt.loc19_39.1: type = class_type @MyInt, @MyInt(%N.loc19_11.1) [symbolic = %MyInt.loc19_39.1 (constants.%MyInt)]
  327. // CHECK:STDOUT: %pattern_type: type = pattern_type %MyInt.loc19_39.1 [symbolic = %pattern_type (constants.%pattern_type.1a3)]
  328. // CHECK:STDOUT: %.loc19_52.1: form = init_form %MyInt.loc19_39.1, call_param1 [symbolic = %.loc19_52.1 (constants.%.b3a)]
  329. // CHECK:STDOUT:
  330. // CHECK:STDOUT: !definition:
  331. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %MyInt.loc19_39.1 [symbolic = %require_complete (constants.%require_complete.9fa)]
  332. // CHECK:STDOUT: %.loc20_11.1: require_specific_def_type = require_specific_def @MyInt.as.Add.impl(%N.loc19_11.1) [symbolic = %.loc20_11.1 (constants.%.c60)]
  333. // CHECK:STDOUT: %Add.lookup_impl_witness: <witness> = lookup_impl_witness %MyInt.loc19_39.1, @Add [symbolic = %Add.lookup_impl_witness (constants.%Add.lookup_impl_witness)]
  334. // CHECK:STDOUT: %Add.facet.loc20_11: %Add.type = facet_value %MyInt.loc19_39.1, (%Add.lookup_impl_witness) [symbolic = %Add.facet.loc20_11 (constants.%Add.facet.9ab)]
  335. // CHECK:STDOUT: %.loc20_11.2: type = fn_type_with_self_type constants.%Add.Op.type, %Add.facet.loc20_11 [symbolic = %.loc20_11.2 (constants.%.932)]
  336. // CHECK:STDOUT: %impl.elem0.loc20_11.2: @Double.%.loc20_11.2 (%.932) = impl_witness_access %Add.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc20_11.2 (constants.%impl.elem0)]
  337. // CHECK:STDOUT: %specific_impl_fn.loc20_11.2: <specific function> = specific_impl_function %impl.elem0.loc20_11.2, @Add.Op(%Add.facet.loc20_11) [symbolic = %specific_impl_fn.loc20_11.2 (constants.%specific_impl_fn)]
  338. // CHECK:STDOUT:
  339. // CHECK:STDOUT: fn(%x.param: @Double.%MyInt.loc19_39.1 (%MyInt)) -> @Double.%MyInt.loc19_39.1 (%MyInt) {
  340. // CHECK:STDOUT: !entry:
  341. // CHECK:STDOUT: %x.ref.loc20_10: @Double.%MyInt.loc19_39.1 (%MyInt) = name_ref x, %x
  342. // CHECK:STDOUT: %Add.ref: type = name_ref Add, file.%Add.decl [concrete = constants.%Add.type]
  343. // CHECK:STDOUT: %Op.ref: %Add.assoc_type = name_ref Op, @Add.%assoc0 [concrete = constants.%assoc0]
  344. // CHECK:STDOUT: %impl.elem0.loc20_11.1: @Double.%.loc20_11.2 (%.932) = impl_witness_access constants.%Add.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc20_11.2 (constants.%impl.elem0)]
  345. // CHECK:STDOUT: %bound_method.loc20_11: <bound method> = bound_method %x.ref.loc20_10, %impl.elem0.loc20_11.1
  346. // CHECK:STDOUT: %x.ref.loc20_21: @Double.%MyInt.loc19_39.1 (%MyInt) = name_ref x, %x
  347. // CHECK:STDOUT: %Add.facet.loc20_22.1: %Add.type = facet_value constants.%MyInt, (constants.%Add.lookup_impl_witness) [symbolic = %Add.facet.loc20_11 (constants.%Add.facet.9ab)]
  348. // CHECK:STDOUT: %.loc20_22.1: %Add.type = converted constants.%MyInt, %Add.facet.loc20_22.1 [symbolic = %Add.facet.loc20_11 (constants.%Add.facet.9ab)]
  349. // CHECK:STDOUT: %Add.facet.loc20_22.2: %Add.type = facet_value constants.%MyInt, (constants.%Add.lookup_impl_witness) [symbolic = %Add.facet.loc20_11 (constants.%Add.facet.9ab)]
  350. // CHECK:STDOUT: %.loc20_22.2: %Add.type = converted constants.%MyInt, %Add.facet.loc20_22.2 [symbolic = %Add.facet.loc20_11 (constants.%Add.facet.9ab)]
  351. // CHECK:STDOUT: %specific_impl_fn.loc20_11.1: <specific function> = specific_impl_function %impl.elem0.loc20_11.1, @Add.Op(constants.%Add.facet.9ab) [symbolic = %specific_impl_fn.loc20_11.2 (constants.%specific_impl_fn)]
  352. // CHECK:STDOUT: %bound_method.loc20_22: <bound method> = bound_method %x.ref.loc20_10, %specific_impl_fn.loc20_11.1
  353. // CHECK:STDOUT: %Add.Op.call: init @Double.%MyInt.loc19_39.1 (%MyInt) = call %bound_method.loc20_22(%x.ref.loc20_10, %x.ref.loc20_21)
  354. // CHECK:STDOUT: return %Add.Op.call to %return.param
  355. // CHECK:STDOUT: }
  356. // CHECK:STDOUT: }
  357. // CHECK:STDOUT:
  358. // CHECK:STDOUT: specific @Add.Op(constants.%Self) {
  359. // CHECK:STDOUT: %Self => constants.%Self
  360. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  361. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.f75
  362. // CHECK:STDOUT: %.loc5_37.1 => constants.%.b66
  363. // CHECK:STDOUT: }
  364. // CHECK:STDOUT:
  365. // CHECK:STDOUT: specific @MyInt(constants.%N) {
  366. // CHECK:STDOUT: %N.loc11_13.1 => constants.%N
  367. // CHECK:STDOUT:
  368. // CHECK:STDOUT: !definition:
  369. // CHECK:STDOUT: %iN.builtin => constants.%iN.builtin
  370. // CHECK:STDOUT: %require_complete => constants.%require_complete.269
  371. // CHECK:STDOUT: %complete_type.loc13_1.2 => constants.%complete_type
  372. // CHECK:STDOUT: }
  373. // CHECK:STDOUT:
  374. // CHECK:STDOUT: specific @MyInt.as.Add.impl(constants.%N) {
  375. // CHECK:STDOUT: %N.loc15_14.1 => constants.%N
  376. // CHECK:STDOUT: %MyInt.loc15_39.1 => constants.%MyInt
  377. // CHECK:STDOUT: %Add.impl_witness.loc15_48.2 => constants.%Add.impl_witness
  378. // CHECK:STDOUT:
  379. // CHECK:STDOUT: !definition:
  380. // CHECK:STDOUT: %MyInt.as.Add.impl.Op.type => constants.%MyInt.as.Add.impl.Op.type
  381. // CHECK:STDOUT: %MyInt.as.Add.impl.Op => constants.%MyInt.as.Add.impl.Op
  382. // CHECK:STDOUT: %require_complete => constants.%require_complete.9fa
  383. // CHECK:STDOUT: }
  384. // CHECK:STDOUT:
  385. // CHECK:STDOUT: specific @MyInt.as.Add.impl.Op(constants.%N) {
  386. // CHECK:STDOUT: %N => constants.%N
  387. // CHECK:STDOUT: %MyInt => constants.%MyInt
  388. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.1a3
  389. // CHECK:STDOUT: %.loc16_37.1 => constants.%.d91
  390. // CHECK:STDOUT: }
  391. // CHECK:STDOUT:
  392. // CHECK:STDOUT: specific @Add.Op(constants.%Add.facet.fbb) {
  393. // CHECK:STDOUT: %Self => constants.%Add.facet.fbb
  394. // CHECK:STDOUT: %Self.binding.as_type => constants.%MyInt
  395. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.1a3
  396. // CHECK:STDOUT: %.loc5_37.1 => constants.%.d91
  397. // CHECK:STDOUT: }
  398. // CHECK:STDOUT:
  399. // CHECK:STDOUT: specific @Double(constants.%N) {
  400. // CHECK:STDOUT: %N.loc19_11.1 => constants.%N
  401. // CHECK:STDOUT: %MyInt.loc19_39.1 => constants.%MyInt
  402. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.1a3
  403. // CHECK:STDOUT: %.loc19_52.1 => constants.%.b3a
  404. // CHECK:STDOUT: }
  405. // CHECK:STDOUT:
  406. // CHECK:STDOUT: specific @Add.Op(constants.%Add.facet.9ab) {
  407. // CHECK:STDOUT: %Self => constants.%Add.facet.9ab
  408. // CHECK:STDOUT: %Self.binding.as_type => constants.%MyInt
  409. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.1a3
  410. // CHECK:STDOUT: %.loc5_37.1 => constants.%.d91
  411. // CHECK:STDOUT: }
  412. // CHECK:STDOUT:
  413. // CHECK:STDOUT: --- use_generic_impl.carbon
  414. // CHECK:STDOUT:
  415. // CHECK:STDOUT: constants {
  416. // CHECK:STDOUT: %MyInt.type: type = generic_class_type @MyInt [concrete]
  417. // CHECK:STDOUT: %MyInt.generic: %MyInt.type = struct_value () [concrete]
  418. // CHECK:STDOUT: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic]
  419. // CHECK:STDOUT: %iN.builtin: type = int_type signed, %N [symbolic]
  420. // CHECK:STDOUT: %complete_type.d26: <witness> = complete_type_witness %iN.builtin [symbolic]
  421. // CHECK:STDOUT: %MyInt.396: type = class_type @MyInt, @MyInt(%N) [symbolic]
  422. // CHECK:STDOUT: %require_complete.269: <witness> = require_complete_type %iN.builtin [symbolic]
  423. // CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [concrete]
  424. // CHECK:STDOUT: %MyInt.f9e: type = class_type @MyInt, @MyInt(%int_64) [concrete]
  425. // CHECK:STDOUT: %pattern_type.48d: type = pattern_type %MyInt.f9e [concrete]
  426. // CHECK:STDOUT: %.fe8: form = init_form %MyInt.f9e, call_param1 [concrete]
  427. // CHECK:STDOUT: %CallImportedDouble.type: type = fn_type @CallImportedDouble [concrete]
  428. // CHECK:STDOUT: %CallImportedDouble: %CallImportedDouble.type = struct_value () [concrete]
  429. // CHECK:STDOUT: %i64.builtin: type = int_type signed, %int_64 [concrete]
  430. // CHECK:STDOUT: %complete_type.4a1: <witness> = complete_type_witness %i64.builtin [concrete]
  431. // CHECK:STDOUT: %Double.type: type = fn_type @Double [concrete]
  432. // CHECK:STDOUT: %Double: %Double.type = struct_value () [concrete]
  433. // CHECK:STDOUT: %pattern_type.1a3: type = pattern_type %MyInt.396 [symbolic]
  434. // CHECK:STDOUT: %.b3a: form = init_form %MyInt.396, call_param1 [symbolic]
  435. // CHECK:STDOUT: %Add.type: type = facet_type <@Add> [concrete]
  436. // CHECK:STDOUT: %Self: %Add.type = symbolic_binding Self, 0 [symbolic]
  437. // CHECK:STDOUT: %Add.lookup_impl_witness: <witness> = lookup_impl_witness %MyInt.396, @Add [symbolic]
  438. // CHECK:STDOUT: %Add.facet.9ab: %Add.type = facet_value %MyInt.396, (%Add.lookup_impl_witness) [symbolic]
  439. // CHECK:STDOUT: %Add.Op.type: type = fn_type @Add.Op [concrete]
  440. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic]
  441. // CHECK:STDOUT: %pattern_type.5af: type = pattern_type %Self.binding.as_type [symbolic]
  442. // CHECK:STDOUT: %.789: form = init_form %Self.binding.as_type, call_param2 [symbolic]
  443. // CHECK:STDOUT: %.932: type = fn_type_with_self_type %Add.Op.type, %Add.facet.9ab [symbolic]
  444. // CHECK:STDOUT: %impl.elem0: %.932 = impl_witness_access %Add.lookup_impl_witness, element0 [symbolic]
  445. // CHECK:STDOUT: %specific_impl_fn: <specific function> = specific_impl_function %impl.elem0, @Add.Op(%Add.facet.9ab) [symbolic]
  446. // CHECK:STDOUT: %.d91: form = init_form %MyInt.396, call_param2 [symbolic]
  447. // CHECK:STDOUT: %Add.impl_witness.a35: <witness> = impl_witness imports.%Add.impl_witness_table, @MyInt.as.Add.impl(%N) [symbolic]
  448. // CHECK:STDOUT: %require_complete.9fa: <witness> = require_complete_type %MyInt.396 [symbolic]
  449. // CHECK:STDOUT: %MyInt.as.Add.impl.Op.type.ca5: type = fn_type @MyInt.as.Add.impl.Op, @MyInt.as.Add.impl(%N) [symbolic]
  450. // CHECK:STDOUT: %MyInt.as.Add.impl.Op.d3e: %MyInt.as.Add.impl.Op.type.ca5 = struct_value () [symbolic]
  451. // CHECK:STDOUT: %.c60: require_specific_def_type = require_specific_def @MyInt.as.Add.impl(%N) [symbolic]
  452. // CHECK:STDOUT: %Double.specific_fn: <specific function> = specific_function %Double, @Double(%int_64) [concrete]
  453. // CHECK:STDOUT: %Add.impl_witness.868: <witness> = impl_witness imports.%Add.impl_witness_table, @MyInt.as.Add.impl(%int_64) [concrete]
  454. // CHECK:STDOUT: %MyInt.as.Add.impl.Op.type.1d4: type = fn_type @MyInt.as.Add.impl.Op, @MyInt.as.Add.impl(%int_64) [concrete]
  455. // CHECK:STDOUT: %MyInt.as.Add.impl.Op.ab3: %MyInt.as.Add.impl.Op.type.1d4 = struct_value () [concrete]
  456. // CHECK:STDOUT: %.3de: require_specific_def_type = require_specific_def @MyInt.as.Add.impl(%int_64) [concrete]
  457. // CHECK:STDOUT: %Add.facet.1f9: %Add.type = facet_value %MyInt.f9e, (%Add.impl_witness.868) [concrete]
  458. // CHECK:STDOUT: %.368: type = fn_type_with_self_type %Add.Op.type, %Add.facet.1f9 [concrete]
  459. // CHECK:STDOUT: %.3a0: form = init_form %MyInt.f9e, call_param2 [concrete]
  460. // CHECK:STDOUT: %MyInt.as.Add.impl.Op.specific_fn: <specific function> = specific_function %MyInt.as.Add.impl.Op.ab3, @MyInt.as.Add.impl.Op(%int_64) [concrete]
  461. // CHECK:STDOUT: }
  462. // CHECK:STDOUT:
  463. // CHECK:STDOUT: imports {
  464. // CHECK:STDOUT: %Main.Add = import_ref Main//generic_impl, Add, unloaded
  465. // CHECK:STDOUT: %Main.IntLiteral = import_ref Main//generic_impl, IntLiteral, unloaded
  466. // CHECK:STDOUT: %Main.Int = import_ref Main//generic_impl, Int, unloaded
  467. // CHECK:STDOUT: %Main.MyInt: %MyInt.type = import_ref Main//generic_impl, MyInt, loaded [concrete = constants.%MyInt.generic]
  468. // CHECK:STDOUT: %Main.Double: %Double.type = import_ref Main//generic_impl, Double, loaded [concrete = constants.%Double]
  469. // CHECK:STDOUT: %Main.import_ref.f9e: <witness> = import_ref Main//generic_impl, loc13_1, loaded [symbolic = @MyInt.%complete_type (constants.%complete_type.d26)]
  470. // CHECK:STDOUT: %Main.import_ref.1ae = import_ref Main//generic_impl, inst{{[0-9A-F]+}} [no loc], unloaded
  471. // CHECK:STDOUT: %Main.import_ref.6b552a.1: Core.IntLiteral = import_ref Main//generic_impl, loc11_13, loaded [symbolic = @MyInt.%N (constants.%N)]
  472. // CHECK:STDOUT: %Main.import_ref.6b552a.2: Core.IntLiteral = import_ref Main//generic_impl, loc19_11, loaded [symbolic = @Double.%N (constants.%N)]
  473. // CHECK:STDOUT: %Main.import_ref.17c = import_ref Main//generic_impl, loc4_15, unloaded
  474. // CHECK:STDOUT: %Main.import_ref.40e = import_ref Main//generic_impl, loc5_41, unloaded
  475. // CHECK:STDOUT: %Main.Op = import_ref Main//generic_impl, Op, unloaded
  476. // CHECK:STDOUT: %Main.import_ref.bb0: %Add.type = import_ref Main//generic_impl, loc4_15, loaded [symbolic = constants.%Self]
  477. // CHECK:STDOUT: %Main.import_ref.9c7: <witness> = import_ref Main//generic_impl, loc15_48, loaded [symbolic = @MyInt.as.Add.impl.%Add.impl_witness (constants.%Add.impl_witness.a35)]
  478. // CHECK:STDOUT: %Main.import_ref.078: @MyInt.as.Add.impl.%MyInt.as.Add.impl.Op.type (%MyInt.as.Add.impl.Op.type.ca5) = import_ref Main//generic_impl, loc16_42, loaded [symbolic = @MyInt.as.Add.impl.%MyInt.as.Add.impl.Op (constants.%MyInt.as.Add.impl.Op.d3e)]
  479. // CHECK:STDOUT: %Add.impl_witness_table = impl_witness_table (%Main.import_ref.078), @MyInt.as.Add.impl [concrete]
  480. // CHECK:STDOUT: %Main.import_ref.6b552a.3: Core.IntLiteral = import_ref Main//generic_impl, loc15_14, loaded [symbolic = @MyInt.as.Add.impl.%N (constants.%N)]
  481. // CHECK:STDOUT: %Main.import_ref.bbe59c.2: type = import_ref Main//generic_impl, loc15_39, loaded [symbolic = @MyInt.as.Add.impl.%MyInt (constants.%MyInt.396)]
  482. // CHECK:STDOUT: %Main.import_ref.1d5: type = import_ref Main//generic_impl, loc15_44, loaded [concrete = constants.%Add.type]
  483. // CHECK:STDOUT: %Main.import_ref.6b552a.4: Core.IntLiteral = import_ref Main//generic_impl, loc15_14, loaded [symbolic = @MyInt.as.Add.impl.%N (constants.%N)]
  484. // CHECK:STDOUT: }
  485. // CHECK:STDOUT:
  486. // CHECK:STDOUT: file {
  487. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  488. // CHECK:STDOUT: .Add = imports.%Main.Add
  489. // CHECK:STDOUT: .IntLiteral = imports.%Main.IntLiteral
  490. // CHECK:STDOUT: .Int = imports.%Main.Int
  491. // CHECK:STDOUT: .MyInt = imports.%Main.MyInt
  492. // CHECK:STDOUT: .Double = imports.%Main.Double
  493. // CHECK:STDOUT: .CallImportedDouble = %CallImportedDouble.decl
  494. // CHECK:STDOUT: }
  495. // CHECK:STDOUT: %default.import = import <none>
  496. // CHECK:STDOUT: %CallImportedDouble.decl: %CallImportedDouble.type = fn_decl @CallImportedDouble [concrete = constants.%CallImportedDouble] {
  497. // CHECK:STDOUT: %n.patt: %pattern_type.48d = value_binding_pattern n [concrete]
  498. // CHECK:STDOUT: %n.param_patt: %pattern_type.48d = value_param_pattern %n.patt, call_param0 [concrete]
  499. // CHECK:STDOUT: %return.patt: %pattern_type.48d = return_slot_pattern [concrete]
  500. // CHECK:STDOUT: %return.param_patt: %pattern_type.48d = out_param_pattern %return.patt, call_param1 [concrete]
  501. // CHECK:STDOUT: } {
  502. // CHECK:STDOUT: %MyInt.ref.loc6_40: %MyInt.type = name_ref MyInt, imports.%Main.MyInt [concrete = constants.%MyInt.generic]
  503. // CHECK:STDOUT: %int_64.loc6_46: Core.IntLiteral = int_value 64 [concrete = constants.%int_64]
  504. // CHECK:STDOUT: %MyInt.loc6_48: type = class_type @MyInt, @MyInt(constants.%int_64) [concrete = constants.%MyInt.f9e]
  505. // CHECK:STDOUT: %.loc6_48: form = init_form %MyInt.loc6_48, call_param1 [concrete = constants.%.fe8]
  506. // CHECK:STDOUT: %n.param: %MyInt.f9e = value_param call_param0
  507. // CHECK:STDOUT: %.loc6_34: type = splice_block %MyInt.loc6_34 [concrete = constants.%MyInt.f9e] {
  508. // CHECK:STDOUT: %MyInt.ref.loc6_26: %MyInt.type = name_ref MyInt, imports.%Main.MyInt [concrete = constants.%MyInt.generic]
  509. // CHECK:STDOUT: %int_64.loc6_32: Core.IntLiteral = int_value 64 [concrete = constants.%int_64]
  510. // CHECK:STDOUT: %MyInt.loc6_34: type = class_type @MyInt, @MyInt(constants.%int_64) [concrete = constants.%MyInt.f9e]
  511. // CHECK:STDOUT: }
  512. // CHECK:STDOUT: %n: %MyInt.f9e = value_binding n, %n.param
  513. // CHECK:STDOUT: %return.param: ref %MyInt.f9e = out_param call_param1
  514. // CHECK:STDOUT: %return: ref %MyInt.f9e = return_slot %return.param
  515. // CHECK:STDOUT: }
  516. // CHECK:STDOUT: }
  517. // CHECK:STDOUT:
  518. // CHECK:STDOUT: interface @Add [from "generic_impl.carbon"] {
  519. // CHECK:STDOUT: !members:
  520. // CHECK:STDOUT: .Self = imports.%Main.import_ref.17c
  521. // CHECK:STDOUT: .Op = imports.%Main.import_ref.40e
  522. // CHECK:STDOUT: witness = (imports.%Main.Op)
  523. // CHECK:STDOUT:
  524. // CHECK:STDOUT: !requires:
  525. // CHECK:STDOUT: }
  526. // CHECK:STDOUT:
  527. // CHECK:STDOUT: generic impl @MyInt.as.Add.impl(imports.%Main.import_ref.6b552a.4: Core.IntLiteral) [from "generic_impl.carbon"] {
  528. // CHECK:STDOUT: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic = %N (constants.%N)]
  529. // CHECK:STDOUT: %MyInt: type = class_type @MyInt, @MyInt(%N) [symbolic = %MyInt (constants.%MyInt.396)]
  530. // CHECK:STDOUT: %Add.impl_witness: <witness> = impl_witness imports.%Add.impl_witness_table, @MyInt.as.Add.impl(%N) [symbolic = %Add.impl_witness (constants.%Add.impl_witness.a35)]
  531. // CHECK:STDOUT:
  532. // CHECK:STDOUT: !definition:
  533. // CHECK:STDOUT: %MyInt.as.Add.impl.Op.type: type = fn_type @MyInt.as.Add.impl.Op, @MyInt.as.Add.impl(%N) [symbolic = %MyInt.as.Add.impl.Op.type (constants.%MyInt.as.Add.impl.Op.type.ca5)]
  534. // CHECK:STDOUT: %MyInt.as.Add.impl.Op: @MyInt.as.Add.impl.%MyInt.as.Add.impl.Op.type (%MyInt.as.Add.impl.Op.type.ca5) = struct_value () [symbolic = %MyInt.as.Add.impl.Op (constants.%MyInt.as.Add.impl.Op.d3e)]
  535. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %MyInt [symbolic = %require_complete (constants.%require_complete.9fa)]
  536. // CHECK:STDOUT:
  537. // CHECK:STDOUT: impl: imports.%Main.import_ref.bbe59c.2 as imports.%Main.import_ref.1d5 {
  538. // CHECK:STDOUT: !members:
  539. // CHECK:STDOUT: witness = imports.%Main.import_ref.9c7
  540. // CHECK:STDOUT: }
  541. // CHECK:STDOUT: }
  542. // CHECK:STDOUT:
  543. // CHECK:STDOUT: generic class @MyInt(imports.%Main.import_ref.6b552a.1: Core.IntLiteral) [from "generic_impl.carbon"] {
  544. // CHECK:STDOUT: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic = %N (constants.%N)]
  545. // CHECK:STDOUT:
  546. // CHECK:STDOUT: !definition:
  547. // CHECK:STDOUT: %iN.builtin: type = int_type signed, %N [symbolic = %iN.builtin (constants.%iN.builtin)]
  548. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %iN.builtin [symbolic = %require_complete (constants.%require_complete.269)]
  549. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %iN.builtin [symbolic = %complete_type (constants.%complete_type.d26)]
  550. // CHECK:STDOUT:
  551. // CHECK:STDOUT: class {
  552. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.f9e
  553. // CHECK:STDOUT:
  554. // CHECK:STDOUT: !members:
  555. // CHECK:STDOUT: .Self = imports.%Main.import_ref.1ae
  556. // CHECK:STDOUT: }
  557. // CHECK:STDOUT: }
  558. // CHECK:STDOUT:
  559. // CHECK:STDOUT: fn @CallImportedDouble(%n.param: %MyInt.f9e) -> %MyInt.f9e {
  560. // CHECK:STDOUT: !entry:
  561. // CHECK:STDOUT: %Double.ref: %Double.type = name_ref Double, imports.%Main.Double [concrete = constants.%Double]
  562. // CHECK:STDOUT: %n.ref: %MyInt.f9e = name_ref n, %n
  563. // CHECK:STDOUT: %Double.specific_fn: <specific function> = specific_function %Double.ref, @Double(constants.%int_64) [concrete = constants.%Double.specific_fn]
  564. // CHECK:STDOUT: %Double.call: init %MyInt.f9e = call %Double.specific_fn(%n.ref)
  565. // CHECK:STDOUT: return %Double.call to %return.param
  566. // CHECK:STDOUT: }
  567. // CHECK:STDOUT:
  568. // CHECK:STDOUT: generic fn @Double(imports.%Main.import_ref.6b552a.2: Core.IntLiteral) [from "generic_impl.carbon"] {
  569. // CHECK:STDOUT: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic = %N (constants.%N)]
  570. // CHECK:STDOUT: %MyInt: type = class_type @MyInt, @MyInt(%N) [symbolic = %MyInt (constants.%MyInt.396)]
  571. // CHECK:STDOUT: %pattern_type: type = pattern_type %MyInt [symbolic = %pattern_type (constants.%pattern_type.1a3)]
  572. // CHECK:STDOUT: %.1: form = init_form %MyInt, call_param1 [symbolic = %.1 (constants.%.b3a)]
  573. // CHECK:STDOUT:
  574. // CHECK:STDOUT: !definition:
  575. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %MyInt [symbolic = %require_complete (constants.%require_complete.9fa)]
  576. // CHECK:STDOUT: %.2: require_specific_def_type = require_specific_def @MyInt.as.Add.impl(%N) [symbolic = %.2 (constants.%.c60)]
  577. // CHECK:STDOUT: %Add.lookup_impl_witness: <witness> = lookup_impl_witness %MyInt, @Add [symbolic = %Add.lookup_impl_witness (constants.%Add.lookup_impl_witness)]
  578. // CHECK:STDOUT: %Add.facet: %Add.type = facet_value %MyInt, (%Add.lookup_impl_witness) [symbolic = %Add.facet (constants.%Add.facet.9ab)]
  579. // CHECK:STDOUT: %.3: type = fn_type_with_self_type constants.%Add.Op.type, %Add.facet [symbolic = %.3 (constants.%.932)]
  580. // CHECK:STDOUT: %impl.elem0: @Double.%.3 (%.932) = impl_witness_access %Add.lookup_impl_witness, element0 [symbolic = %impl.elem0 (constants.%impl.elem0)]
  581. // CHECK:STDOUT: %specific_impl_fn: <specific function> = specific_impl_function %impl.elem0, @Add.Op(%Add.facet) [symbolic = %specific_impl_fn (constants.%specific_impl_fn)]
  582. // CHECK:STDOUT:
  583. // CHECK:STDOUT: fn;
  584. // CHECK:STDOUT: }
  585. // CHECK:STDOUT:
  586. // CHECK:STDOUT: generic fn @Add.Op(imports.%Main.import_ref.bb0: %Add.type) [from "generic_impl.carbon"] {
  587. // CHECK:STDOUT: %Self: %Add.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self)]
  588. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  589. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type (constants.%pattern_type.5af)]
  590. // CHECK:STDOUT: %.1: form = init_form %Self.binding.as_type, call_param2 [symbolic = %.1 (constants.%.789)]
  591. // CHECK:STDOUT:
  592. // CHECK:STDOUT: fn;
  593. // CHECK:STDOUT: }
  594. // CHECK:STDOUT:
  595. // CHECK:STDOUT: generic fn @MyInt.as.Add.impl.Op(imports.%Main.import_ref.6b552a.3: Core.IntLiteral) [from "generic_impl.carbon"] {
  596. // CHECK:STDOUT: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic = %N (constants.%N)]
  597. // CHECK:STDOUT: %MyInt: type = class_type @MyInt, @MyInt(%N) [symbolic = %MyInt (constants.%MyInt.396)]
  598. // CHECK:STDOUT: %pattern_type: type = pattern_type %MyInt [symbolic = %pattern_type (constants.%pattern_type.1a3)]
  599. // CHECK:STDOUT: %.1: form = init_form %MyInt, call_param2 [symbolic = %.1 (constants.%.d91)]
  600. // CHECK:STDOUT:
  601. // CHECK:STDOUT: !definition:
  602. // CHECK:STDOUT:
  603. // CHECK:STDOUT: fn = "int.sadd";
  604. // CHECK:STDOUT: }
  605. // CHECK:STDOUT:
  606. // CHECK:STDOUT: specific @MyInt(constants.%N) {
  607. // CHECK:STDOUT: %N => constants.%N
  608. // CHECK:STDOUT:
  609. // CHECK:STDOUT: !definition:
  610. // CHECK:STDOUT: %iN.builtin => constants.%iN.builtin
  611. // CHECK:STDOUT: %require_complete => constants.%require_complete.269
  612. // CHECK:STDOUT: %complete_type => constants.%complete_type.d26
  613. // CHECK:STDOUT: }
  614. // CHECK:STDOUT:
  615. // CHECK:STDOUT: specific @MyInt(constants.%int_64) {
  616. // CHECK:STDOUT: %N => constants.%int_64
  617. // CHECK:STDOUT:
  618. // CHECK:STDOUT: !definition:
  619. // CHECK:STDOUT: %iN.builtin => constants.%i64.builtin
  620. // CHECK:STDOUT: %require_complete => constants.%complete_type.4a1
  621. // CHECK:STDOUT: %complete_type => constants.%complete_type.4a1
  622. // CHECK:STDOUT: }
  623. // CHECK:STDOUT:
  624. // CHECK:STDOUT: specific @Add.Op(constants.%Self) {
  625. // CHECK:STDOUT: %Self => constants.%Self
  626. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  627. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.5af
  628. // CHECK:STDOUT: %.1 => constants.%.789
  629. // CHECK:STDOUT: }
  630. // CHECK:STDOUT:
  631. // CHECK:STDOUT: specific @Add.Op(constants.%Add.facet.9ab) {
  632. // CHECK:STDOUT: %Self => constants.%Add.facet.9ab
  633. // CHECK:STDOUT: %Self.binding.as_type => constants.%MyInt.396
  634. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.1a3
  635. // CHECK:STDOUT: %.1 => constants.%.d91
  636. // CHECK:STDOUT: }
  637. // CHECK:STDOUT:
  638. // CHECK:STDOUT: specific @MyInt.as.Add.impl(constants.%N) {
  639. // CHECK:STDOUT: %N => constants.%N
  640. // CHECK:STDOUT: %MyInt => constants.%MyInt.396
  641. // CHECK:STDOUT: %Add.impl_witness => constants.%Add.impl_witness.a35
  642. // CHECK:STDOUT:
  643. // CHECK:STDOUT: !definition:
  644. // CHECK:STDOUT: %MyInt.as.Add.impl.Op.type => constants.%MyInt.as.Add.impl.Op.type.ca5
  645. // CHECK:STDOUT: %MyInt.as.Add.impl.Op => constants.%MyInt.as.Add.impl.Op.d3e
  646. // CHECK:STDOUT: %require_complete => constants.%require_complete.9fa
  647. // CHECK:STDOUT: }
  648. // CHECK:STDOUT:
  649. // CHECK:STDOUT: specific @MyInt.as.Add.impl.Op(constants.%N) {
  650. // CHECK:STDOUT: %N => constants.%N
  651. // CHECK:STDOUT: %MyInt => constants.%MyInt.396
  652. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.1a3
  653. // CHECK:STDOUT: %.1 => constants.%.d91
  654. // CHECK:STDOUT: }
  655. // CHECK:STDOUT:
  656. // CHECK:STDOUT: specific @Double(constants.%N) {
  657. // CHECK:STDOUT: %N => constants.%N
  658. // CHECK:STDOUT: %MyInt => constants.%MyInt.396
  659. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.1a3
  660. // CHECK:STDOUT: %.1 => constants.%.b3a
  661. // CHECK:STDOUT: }
  662. // CHECK:STDOUT:
  663. // CHECK:STDOUT: specific @Double(constants.%int_64) {
  664. // CHECK:STDOUT: %N => constants.%int_64
  665. // CHECK:STDOUT: %MyInt => constants.%MyInt.f9e
  666. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.48d
  667. // CHECK:STDOUT: %.1 => constants.%.fe8
  668. // CHECK:STDOUT:
  669. // CHECK:STDOUT: !definition:
  670. // CHECK:STDOUT: %require_complete => constants.%complete_type.4a1
  671. // CHECK:STDOUT: %.2 => constants.%.3de
  672. // CHECK:STDOUT: %Add.lookup_impl_witness => constants.%Add.impl_witness.868
  673. // CHECK:STDOUT: %Add.facet => constants.%Add.facet.1f9
  674. // CHECK:STDOUT: %.3 => constants.%.368
  675. // CHECK:STDOUT: %impl.elem0 => constants.%MyInt.as.Add.impl.Op.ab3
  676. // CHECK:STDOUT: %specific_impl_fn => constants.%MyInt.as.Add.impl.Op.specific_fn
  677. // CHECK:STDOUT: }
  678. // CHECK:STDOUT:
  679. // CHECK:STDOUT: specific @MyInt.as.Add.impl(constants.%int_64) {
  680. // CHECK:STDOUT: %N => constants.%int_64
  681. // CHECK:STDOUT: %MyInt => constants.%MyInt.f9e
  682. // CHECK:STDOUT: %Add.impl_witness => constants.%Add.impl_witness.868
  683. // CHECK:STDOUT:
  684. // CHECK:STDOUT: !definition:
  685. // CHECK:STDOUT: %MyInt.as.Add.impl.Op.type => constants.%MyInt.as.Add.impl.Op.type.1d4
  686. // CHECK:STDOUT: %MyInt.as.Add.impl.Op => constants.%MyInt.as.Add.impl.Op.ab3
  687. // CHECK:STDOUT: %require_complete => constants.%complete_type.4a1
  688. // CHECK:STDOUT: }
  689. // CHECK:STDOUT:
  690. // CHECK:STDOUT: specific @Add.Op(constants.%Add.facet.1f9) {
  691. // CHECK:STDOUT: %Self => constants.%Add.facet.1f9
  692. // CHECK:STDOUT: %Self.binding.as_type => constants.%MyInt.f9e
  693. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.48d
  694. // CHECK:STDOUT: %.1 => constants.%.3a0
  695. // CHECK:STDOUT: }
  696. // CHECK:STDOUT:
  697. // CHECK:STDOUT: specific @MyInt.as.Add.impl.Op(constants.%int_64) {
  698. // CHECK:STDOUT: %N => constants.%int_64
  699. // CHECK:STDOUT: %MyInt => constants.%MyInt.f9e
  700. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.48d
  701. // CHECK:STDOUT: %.1 => constants.%.3a0
  702. // CHECK:STDOUT:
  703. // CHECK:STDOUT: !definition:
  704. // CHECK:STDOUT: }
  705. // CHECK:STDOUT:
  706. // CHECK:STDOUT: --- convert_symbolic.carbon
  707. // CHECK:STDOUT:
  708. // CHECK:STDOUT: constants {
  709. // CHECK:STDOUT: %.d96: form = init_form type, call_param0 [concrete]
  710. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  711. // CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [concrete]
  712. // CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [concrete]
  713. // CHECK:STDOUT: %pattern_type.dc0: type = pattern_type Core.IntLiteral [concrete]
  714. // CHECK:STDOUT: %.39d: form = init_form type, call_param1 [concrete]
  715. // CHECK:STDOUT: %Int.type: type = fn_type @Int [concrete]
  716. // CHECK:STDOUT: %Int: %Int.type = struct_value () [concrete]
  717. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  718. // CHECK:STDOUT: %i32.builtin: type = int_type signed, %int_32 [concrete]
  719. // CHECK:STDOUT: %pattern_type.956: type = pattern_type %i32.builtin [concrete]
  720. // CHECK:STDOUT: %.026: form = init_form Core.IntLiteral, call_param1 [concrete]
  721. // CHECK:STDOUT: %ToLiteral.type: type = fn_type @ToLiteral [concrete]
  722. // CHECK:STDOUT: %ToLiteral: %ToLiteral.type = struct_value () [concrete]
  723. // CHECK:STDOUT: %.8b6: form = init_form %i32.builtin, call_param1 [concrete]
  724. // CHECK:STDOUT: %FromLiteral.type: type = fn_type @FromLiteral [concrete]
  725. // CHECK:STDOUT: %FromLiteral: %FromLiteral.type = struct_value () [concrete]
  726. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  727. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self]
  728. // CHECK:STDOUT: %N.7e8: %i32.builtin = symbolic_binding N, 0 [symbolic]
  729. // CHECK:STDOUT: %ToLiteral.call: init Core.IntLiteral = call %ToLiteral(%N.7e8) [symbolic]
  730. // CHECK:STDOUT: %iN.builtin.b5d: type = int_type signed, %ToLiteral.call [symbolic]
  731. // CHECK:STDOUT: %.684: form = init_form %iN.builtin.b5d, call_param0 [symbolic]
  732. // CHECK:STDOUT: %pattern_type.073: type = pattern_type %iN.builtin.b5d [symbolic]
  733. // CHECK:STDOUT: %Make.type: type = fn_type @Make [concrete]
  734. // CHECK:STDOUT: %Make: %Make.type = struct_value () [concrete]
  735. // CHECK:STDOUT: %require_complete.8ad: <witness> = require_complete_type %iN.builtin.b5d [symbolic]
  736. // CHECK:STDOUT: %Make.specific_fn: <specific function> = specific_function %Make, @Make(%N.7e8) [symbolic]
  737. // CHECK:STDOUT: %OtherInt: type = class_type @OtherInt [concrete]
  738. // CHECK:STDOUT: %pattern_type.08d: type = pattern_type %OtherInt [concrete]
  739. // CHECK:STDOUT: %OtherInt.ToLiteral.type: type = fn_type @OtherInt.ToLiteral [concrete]
  740. // CHECK:STDOUT: %OtherInt.ToLiteral: %OtherInt.ToLiteral.type = struct_value () [concrete]
  741. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %i32.builtin [concrete]
  742. // CHECK:STDOUT: %N.0f7: %OtherInt = symbolic_binding N, 0 [symbolic]
  743. // CHECK:STDOUT: %OtherInt.ToLiteral.bound: <bound method> = bound_method %N.0f7, %OtherInt.ToLiteral [symbolic]
  744. // CHECK:STDOUT: %OtherInt.ToLiteral.call: init Core.IntLiteral = call %OtherInt.ToLiteral.bound(%N.0f7) [symbolic]
  745. // CHECK:STDOUT: %iN.builtin.63a: type = int_type signed, %OtherInt.ToLiteral.call [symbolic]
  746. // CHECK:STDOUT: %.ea7: form = init_form %iN.builtin.63a, call_param0 [symbolic]
  747. // CHECK:STDOUT: %pattern_type.bd7: type = pattern_type %iN.builtin.63a [symbolic]
  748. // CHECK:STDOUT: %MakeFromClass.type: type = fn_type @MakeFromClass [concrete]
  749. // CHECK:STDOUT: %MakeFromClass: %MakeFromClass.type = struct_value () [concrete]
  750. // CHECK:STDOUT: %require_complete.a44: <witness> = require_complete_type %iN.builtin.63a [symbolic]
  751. // CHECK:STDOUT: %MakeFromClass.specific_fn: <specific function> = specific_function %MakeFromClass, @MakeFromClass(%N.0f7) [symbolic]
  752. // CHECK:STDOUT: }
  753. // CHECK:STDOUT:
  754. // CHECK:STDOUT: file {
  755. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  756. // CHECK:STDOUT: .IntLiteral = %IntLiteral.decl
  757. // CHECK:STDOUT: .Int = %Int.decl
  758. // CHECK:STDOUT: .ToLiteral = %ToLiteral.decl
  759. // CHECK:STDOUT: .FromLiteral = %FromLiteral.decl
  760. // CHECK:STDOUT: .Make = %Make.decl
  761. // CHECK:STDOUT: .OtherInt = %OtherInt.decl
  762. // CHECK:STDOUT: .MakeFromClass = %MakeFromClass.decl
  763. // CHECK:STDOUT: }
  764. // CHECK:STDOUT: %IntLiteral.decl: %IntLiteral.type = fn_decl @IntLiteral [concrete = constants.%IntLiteral] {
  765. // CHECK:STDOUT: %return.patt: %pattern_type.98f = return_slot_pattern [concrete]
  766. // CHECK:STDOUT: %return.param_patt: %pattern_type.98f = out_param_pattern %return.patt, call_param0 [concrete]
  767. // CHECK:STDOUT: } {
  768. // CHECK:STDOUT: %.loc4: form = init_form type, call_param0 [concrete = constants.%.d96]
  769. // CHECK:STDOUT: %return.param: ref type = out_param call_param0
  770. // CHECK:STDOUT: %return: ref type = return_slot %return.param
  771. // CHECK:STDOUT: }
  772. // CHECK:STDOUT: %Int.decl: %Int.type = fn_decl @Int [concrete = constants.%Int] {
  773. // CHECK:STDOUT: %n.patt: %pattern_type.dc0 = value_binding_pattern n [concrete]
  774. // CHECK:STDOUT: %n.param_patt: %pattern_type.dc0 = value_param_pattern %n.patt, call_param0 [concrete]
  775. // CHECK:STDOUT: %return.patt: %pattern_type.98f = return_slot_pattern [concrete]
  776. // CHECK:STDOUT: %return.param_patt: %pattern_type.98f = out_param_pattern %return.patt, call_param1 [concrete]
  777. // CHECK:STDOUT: } {
  778. // CHECK:STDOUT: %.loc5_28: form = init_form type, call_param1 [concrete = constants.%.39d]
  779. // CHECK:STDOUT: %n.param: Core.IntLiteral = value_param call_param0
  780. // CHECK:STDOUT: %.loc5_22.1: type = splice_block %.loc5_22.3 [concrete = Core.IntLiteral] {
  781. // CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, file.%IntLiteral.decl [concrete = constants.%IntLiteral]
  782. // CHECK:STDOUT: %IntLiteral.call: init type = call %IntLiteral.ref() [concrete = Core.IntLiteral]
  783. // CHECK:STDOUT: %.loc5_22.2: type = value_of_initializer %IntLiteral.call [concrete = Core.IntLiteral]
  784. // CHECK:STDOUT: %.loc5_22.3: type = converted %IntLiteral.call, %.loc5_22.2 [concrete = Core.IntLiteral]
  785. // CHECK:STDOUT: }
  786. // CHECK:STDOUT: %n: Core.IntLiteral = value_binding n, %n.param
  787. // CHECK:STDOUT: %return.param: ref type = out_param call_param1
  788. // CHECK:STDOUT: %return: ref type = return_slot %return.param
  789. // CHECK:STDOUT: }
  790. // CHECK:STDOUT: %ToLiteral.decl: %ToLiteral.type = fn_decl @ToLiteral [concrete = constants.%ToLiteral] {
  791. // CHECK:STDOUT: %n.patt: %pattern_type.956 = value_binding_pattern n [concrete]
  792. // CHECK:STDOUT: %n.param_patt: %pattern_type.956 = value_param_pattern %n.patt, call_param0 [concrete]
  793. // CHECK:STDOUT: %return.patt: %pattern_type.dc0 = return_slot_pattern [concrete]
  794. // CHECK:STDOUT: %return.param_patt: %pattern_type.dc0 = out_param_pattern %return.patt, call_param1 [concrete]
  795. // CHECK:STDOUT: } {
  796. // CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, file.%IntLiteral.decl [concrete = constants.%IntLiteral]
  797. // CHECK:STDOUT: %IntLiteral.call: init type = call %IntLiteral.ref() [concrete = Core.IntLiteral]
  798. // CHECK:STDOUT: %.loc6_40.1: type = value_of_initializer %IntLiteral.call [concrete = Core.IntLiteral]
  799. // CHECK:STDOUT: %.loc6_40.2: type = converted %IntLiteral.call, %.loc6_40.1 [concrete = Core.IntLiteral]
  800. // CHECK:STDOUT: %.loc6_40.3: form = init_form %.loc6_40.2, call_param1 [concrete = constants.%.026]
  801. // CHECK:STDOUT: %n.param: %i32.builtin = value_param call_param0
  802. // CHECK:STDOUT: %.loc6_23.1: type = splice_block %.loc6_23.3 [concrete = constants.%i32.builtin] {
  803. // CHECK:STDOUT: %Int.ref: %Int.type = name_ref Int, file.%Int.decl [concrete = constants.%Int]
  804. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  805. // CHECK:STDOUT: %Int.call: init type = call %Int.ref(%int_32) [concrete = constants.%i32.builtin]
  806. // CHECK:STDOUT: %.loc6_23.2: type = value_of_initializer %Int.call [concrete = constants.%i32.builtin]
  807. // CHECK:STDOUT: %.loc6_23.3: type = converted %Int.call, %.loc6_23.2 [concrete = constants.%i32.builtin]
  808. // CHECK:STDOUT: }
  809. // CHECK:STDOUT: %n: %i32.builtin = value_binding n, %n.param
  810. // CHECK:STDOUT: %return.param: ref Core.IntLiteral = out_param call_param1
  811. // CHECK:STDOUT: %return: ref Core.IntLiteral = return_slot %return.param
  812. // CHECK:STDOUT: }
  813. // CHECK:STDOUT: %FromLiteral.decl: %FromLiteral.type = fn_decl @FromLiteral [concrete = constants.%FromLiteral] {
  814. // CHECK:STDOUT: %n.patt: %pattern_type.dc0 = value_binding_pattern n [concrete]
  815. // CHECK:STDOUT: %n.param_patt: %pattern_type.dc0 = value_param_pattern %n.patt, call_param0 [concrete]
  816. // CHECK:STDOUT: %return.patt: %pattern_type.956 = return_slot_pattern [concrete]
  817. // CHECK:STDOUT: %return.param_patt: %pattern_type.956 = out_param_pattern %return.patt, call_param1 [concrete]
  818. // CHECK:STDOUT: } {
  819. // CHECK:STDOUT: %Int.ref: %Int.type = name_ref Int, file.%Int.decl [concrete = constants.%Int]
  820. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  821. // CHECK:STDOUT: %Int.call: init type = call %Int.ref(%int_32) [concrete = constants.%i32.builtin]
  822. // CHECK:STDOUT: %.loc7_42.1: type = value_of_initializer %Int.call [concrete = constants.%i32.builtin]
  823. // CHECK:STDOUT: %.loc7_42.2: type = converted %Int.call, %.loc7_42.1 [concrete = constants.%i32.builtin]
  824. // CHECK:STDOUT: %.loc7_42.3: form = init_form %.loc7_42.2, call_param1 [concrete = constants.%.8b6]
  825. // CHECK:STDOUT: %n.param: Core.IntLiteral = value_param call_param0
  826. // CHECK:STDOUT: %.loc7_30.1: type = splice_block %.loc7_30.3 [concrete = Core.IntLiteral] {
  827. // CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, file.%IntLiteral.decl [concrete = constants.%IntLiteral]
  828. // CHECK:STDOUT: %IntLiteral.call: init type = call %IntLiteral.ref() [concrete = Core.IntLiteral]
  829. // CHECK:STDOUT: %.loc7_30.2: type = value_of_initializer %IntLiteral.call [concrete = Core.IntLiteral]
  830. // CHECK:STDOUT: %.loc7_30.3: type = converted %IntLiteral.call, %.loc7_30.2 [concrete = Core.IntLiteral]
  831. // CHECK:STDOUT: }
  832. // CHECK:STDOUT: %n: Core.IntLiteral = value_binding n, %n.param
  833. // CHECK:STDOUT: %return.param: ref %i32.builtin = out_param call_param1
  834. // CHECK:STDOUT: %return: ref %i32.builtin = return_slot %return.param
  835. // CHECK:STDOUT: }
  836. // CHECK:STDOUT: %Make.decl: %Make.type = fn_decl @Make [concrete = constants.%Make] {
  837. // CHECK:STDOUT: %N.patt: %pattern_type.956 = symbolic_binding_pattern N, 0 [concrete]
  838. // CHECK:STDOUT: %return.patt: @Make.%pattern_type (%pattern_type.073) = return_slot_pattern [concrete]
  839. // CHECK:STDOUT: %return.param_patt: @Make.%pattern_type (%pattern_type.073) = out_param_pattern %return.patt, call_param0 [concrete]
  840. // CHECK:STDOUT: } {
  841. // CHECK:STDOUT: %Int.ref.loc9_25: %Int.type = name_ref Int, file.%Int.decl [concrete = constants.%Int]
  842. // CHECK:STDOUT: %ToLiteral.ref: %ToLiteral.type = name_ref ToLiteral, file.%ToLiteral.decl [concrete = constants.%ToLiteral]
  843. // CHECK:STDOUT: %N.ref.loc9_39: %i32.builtin = name_ref N, %N.loc9_9.2 [symbolic = %N.loc9_9.1 (constants.%N.7e8)]
  844. // CHECK:STDOUT: %ToLiteral.call.loc9_40.2: init Core.IntLiteral = call %ToLiteral.ref(%N.ref.loc9_39) [symbolic = %ToLiteral.call.loc9_40.1 (constants.%ToLiteral.call)]
  845. // CHECK:STDOUT: %.loc9_40.1: Core.IntLiteral = value_of_initializer %ToLiteral.call.loc9_40.2 [symbolic = %ToLiteral.call.loc9_40.1 (constants.%ToLiteral.call)]
  846. // CHECK:STDOUT: %.loc9_40.2: Core.IntLiteral = converted %ToLiteral.call.loc9_40.2, %.loc9_40.1 [symbolic = %ToLiteral.call.loc9_40.1 (constants.%ToLiteral.call)]
  847. // CHECK:STDOUT: %Int.call.loc9_41: init type = call %Int.ref.loc9_25(%.loc9_40.2) [symbolic = %iN.builtin (constants.%iN.builtin.b5d)]
  848. // CHECK:STDOUT: %.loc9_41.2: type = value_of_initializer %Int.call.loc9_41 [symbolic = %iN.builtin (constants.%iN.builtin.b5d)]
  849. // CHECK:STDOUT: %.loc9_41.3: type = converted %Int.call.loc9_41, %.loc9_41.2 [symbolic = %iN.builtin (constants.%iN.builtin.b5d)]
  850. // CHECK:STDOUT: %.loc9_41.4: form = init_form %.loc9_41.3, call_param0 [symbolic = %.loc9_41.1 (constants.%.684)]
  851. // CHECK:STDOUT: %.loc9_19.1: type = splice_block %.loc9_19.3 [concrete = constants.%i32.builtin] {
  852. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  853. // CHECK:STDOUT: %Int.ref.loc9_13: %Int.type = name_ref Int, file.%Int.decl [concrete = constants.%Int]
  854. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  855. // CHECK:STDOUT: %Int.call.loc9_19: init type = call %Int.ref.loc9_13(%int_32) [concrete = constants.%i32.builtin]
  856. // CHECK:STDOUT: %.loc9_19.2: type = value_of_initializer %Int.call.loc9_19 [concrete = constants.%i32.builtin]
  857. // CHECK:STDOUT: %.loc9_19.3: type = converted %Int.call.loc9_19, %.loc9_19.2 [concrete = constants.%i32.builtin]
  858. // CHECK:STDOUT: }
  859. // CHECK:STDOUT: %N.loc9_9.2: %i32.builtin = symbolic_binding N, 0 [symbolic = %N.loc9_9.1 (constants.%N.7e8)]
  860. // CHECK:STDOUT: %return.param: ref @Make.%iN.builtin (%iN.builtin.b5d) = out_param call_param0
  861. // CHECK:STDOUT: %return: ref @Make.%iN.builtin (%iN.builtin.b5d) = return_slot %return.param
  862. // CHECK:STDOUT: }
  863. // CHECK:STDOUT: %OtherInt.decl: type = class_decl @OtherInt [concrete = constants.%OtherInt] {} {}
  864. // CHECK:STDOUT: %OtherInt.ToLiteral.decl: %OtherInt.ToLiteral.type = fn_decl @OtherInt.ToLiteral [concrete = constants.%OtherInt.ToLiteral] {
  865. // CHECK:STDOUT: %self.patt: %pattern_type.08d = value_binding_pattern self [concrete]
  866. // CHECK:STDOUT: %self.param_patt: %pattern_type.08d = value_param_pattern %self.patt, call_param0 [concrete]
  867. // CHECK:STDOUT: %return.patt: %pattern_type.dc0 = return_slot_pattern [concrete]
  868. // CHECK:STDOUT: %return.param_patt: %pattern_type.dc0 = out_param_pattern %return.patt, call_param1 [concrete]
  869. // CHECK:STDOUT: } {
  870. // CHECK:STDOUT: %IntLiteral.ref.loc16: %IntLiteral.type = name_ref IntLiteral, file.%IntLiteral.decl [concrete = constants.%IntLiteral]
  871. // CHECK:STDOUT: %IntLiteral.call.loc16: init type = call %IntLiteral.ref.loc16() [concrete = Core.IntLiteral]
  872. // CHECK:STDOUT: %.loc16_51.1: type = value_of_initializer %IntLiteral.call.loc16 [concrete = Core.IntLiteral]
  873. // CHECK:STDOUT: %.loc16_51.2: type = converted %IntLiteral.call.loc16, %.loc16_51.1 [concrete = Core.IntLiteral]
  874. // CHECK:STDOUT: %.loc16_51.3: form = init_form %.loc16_51.2, call_param1 [concrete = constants.%.026]
  875. // CHECK:STDOUT: %self.param.loc16: %OtherInt = value_param call_param0
  876. // CHECK:STDOUT: %Self.ref.loc16: type = name_ref Self, constants.%OtherInt [concrete = constants.%OtherInt]
  877. // CHECK:STDOUT: %self.loc16: %OtherInt = value_binding self, %self.param.loc16
  878. // CHECK:STDOUT: %return.param.loc16: ref Core.IntLiteral = out_param call_param1
  879. // CHECK:STDOUT: %return.loc16: ref Core.IntLiteral = return_slot %return.param.loc16
  880. // CHECK:STDOUT: }
  881. // CHECK:STDOUT: %MakeFromClass.decl: %MakeFromClass.type = fn_decl @MakeFromClass [concrete = constants.%MakeFromClass] {
  882. // CHECK:STDOUT: %N.patt: %pattern_type.08d = symbolic_binding_pattern N, 0 [concrete]
  883. // CHECK:STDOUT: %return.patt: @MakeFromClass.%pattern_type (%pattern_type.bd7) = return_slot_pattern [concrete]
  884. // CHECK:STDOUT: %return.param_patt: @MakeFromClass.%pattern_type (%pattern_type.bd7) = out_param_pattern %return.patt, call_param0 [concrete]
  885. // CHECK:STDOUT: } {
  886. // CHECK:STDOUT: %Int.ref: %Int.type = name_ref Int, file.%Int.decl [concrete = constants.%Int]
  887. // CHECK:STDOUT: %N.ref.loc18_39: %OtherInt = name_ref N, %N.loc18_18.2 [symbolic = %N.loc18_18.1 (constants.%N.0f7)]
  888. // CHECK:STDOUT: %ToLiteral.ref: %OtherInt.ToLiteral.type = name_ref ToLiteral, @OtherInt.%OtherInt.ToLiteral.decl [concrete = constants.%OtherInt.ToLiteral]
  889. // CHECK:STDOUT: %OtherInt.ToLiteral.bound.loc18_40.2: <bound method> = bound_method %N.ref.loc18_39, %ToLiteral.ref [symbolic = %OtherInt.ToLiteral.bound.loc18_40.1 (constants.%OtherInt.ToLiteral.bound)]
  890. // CHECK:STDOUT: %OtherInt.ToLiteral.call.loc18_51.2: init Core.IntLiteral = call %OtherInt.ToLiteral.bound.loc18_40.2(%N.ref.loc18_39) [symbolic = %OtherInt.ToLiteral.call.loc18_51.1 (constants.%OtherInt.ToLiteral.call)]
  891. // CHECK:STDOUT: %.loc18_51.1: Core.IntLiteral = value_of_initializer %OtherInt.ToLiteral.call.loc18_51.2 [symbolic = %OtherInt.ToLiteral.call.loc18_51.1 (constants.%OtherInt.ToLiteral.call)]
  892. // CHECK:STDOUT: %.loc18_51.2: Core.IntLiteral = converted %OtherInt.ToLiteral.call.loc18_51.2, %.loc18_51.1 [symbolic = %OtherInt.ToLiteral.call.loc18_51.1 (constants.%OtherInt.ToLiteral.call)]
  893. // CHECK:STDOUT: %Int.call: init type = call %Int.ref(%.loc18_51.2) [symbolic = %iN.builtin (constants.%iN.builtin.63a)]
  894. // CHECK:STDOUT: %.loc18_52.2: type = value_of_initializer %Int.call [symbolic = %iN.builtin (constants.%iN.builtin.63a)]
  895. // CHECK:STDOUT: %.loc18_52.3: type = converted %Int.call, %.loc18_52.2 [symbolic = %iN.builtin (constants.%iN.builtin.63a)]
  896. // CHECK:STDOUT: %.loc18_52.4: form = init_form %.loc18_52.3, call_param0 [symbolic = %.loc18_52.1 (constants.%.ea7)]
  897. // CHECK:STDOUT: %.loc18_22: type = splice_block %OtherInt.ref [concrete = constants.%OtherInt] {
  898. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  899. // CHECK:STDOUT: %OtherInt.ref: type = name_ref OtherInt, file.%OtherInt.decl [concrete = constants.%OtherInt]
  900. // CHECK:STDOUT: }
  901. // CHECK:STDOUT: %N.loc18_18.2: %OtherInt = symbolic_binding N, 0 [symbolic = %N.loc18_18.1 (constants.%N.0f7)]
  902. // CHECK:STDOUT: %return.param: ref @MakeFromClass.%iN.builtin (%iN.builtin.63a) = out_param call_param0
  903. // CHECK:STDOUT: %return: ref @MakeFromClass.%iN.builtin (%iN.builtin.63a) = return_slot %return.param
  904. // CHECK:STDOUT: }
  905. // CHECK:STDOUT: }
  906. // CHECK:STDOUT:
  907. // CHECK:STDOUT: class @OtherInt {
  908. // CHECK:STDOUT: %Int.ref: %Int.type = name_ref Int, file.%Int.decl [concrete = constants.%Int]
  909. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  910. // CHECK:STDOUT: %Int.call: init type = call %Int.ref(%int_32) [concrete = constants.%i32.builtin]
  911. // CHECK:STDOUT: %.loc12_16.1: type = value_of_initializer %Int.call [concrete = constants.%i32.builtin]
  912. // CHECK:STDOUT: %.loc12_16.2: type = converted %Int.call, %.loc12_16.1 [concrete = constants.%i32.builtin]
  913. // CHECK:STDOUT: adapt_decl %.loc12_16.2 [concrete]
  914. // CHECK:STDOUT: %OtherInt.ToLiteral.decl: %OtherInt.ToLiteral.type = fn_decl @OtherInt.ToLiteral [concrete = constants.%OtherInt.ToLiteral] {
  915. // CHECK:STDOUT: %self.patt: %pattern_type.08d = value_binding_pattern self [concrete]
  916. // CHECK:STDOUT: %self.param_patt: %pattern_type.08d = value_param_pattern %self.patt, call_param0 [concrete]
  917. // CHECK:STDOUT: %return.patt: %pattern_type.dc0 = return_slot_pattern [concrete]
  918. // CHECK:STDOUT: %return.param_patt: %pattern_type.dc0 = out_param_pattern %return.patt, call_param1 [concrete]
  919. // CHECK:STDOUT: } {
  920. // CHECK:STDOUT: %IntLiteral.ref.loc13: %IntLiteral.type = name_ref IntLiteral, file.%IntLiteral.decl [concrete = constants.%IntLiteral]
  921. // CHECK:STDOUT: %IntLiteral.call.loc13: init type = call %IntLiteral.ref.loc13() [concrete = Core.IntLiteral]
  922. // CHECK:STDOUT: %.loc13_44.1: type = value_of_initializer %IntLiteral.call.loc13 [concrete = Core.IntLiteral]
  923. // CHECK:STDOUT: %.loc13_44.2: type = converted %IntLiteral.call.loc13, %.loc13_44.1 [concrete = Core.IntLiteral]
  924. // CHECK:STDOUT: %.loc13_44.3: form = init_form %.loc13_44.2, call_param1 [concrete = constants.%.026]
  925. // CHECK:STDOUT: %self.param.loc13: %OtherInt = value_param call_param0
  926. // CHECK:STDOUT: %Self.ref.loc13: type = name_ref Self, constants.%OtherInt [concrete = constants.%OtherInt]
  927. // CHECK:STDOUT: %self.loc13: %OtherInt = value_binding self, %self.param.loc13
  928. // CHECK:STDOUT: %return.param.loc13: ref Core.IntLiteral = out_param call_param1
  929. // CHECK:STDOUT: %return.loc13: ref Core.IntLiteral = return_slot %return.param.loc13
  930. // CHECK:STDOUT: }
  931. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%i32.builtin [concrete = constants.%complete_type]
  932. // CHECK:STDOUT: complete_type_witness = %complete_type
  933. // CHECK:STDOUT:
  934. // CHECK:STDOUT: !members:
  935. // CHECK:STDOUT: .Self = constants.%OtherInt
  936. // CHECK:STDOUT: .Int = <poisoned>
  937. // CHECK:STDOUT: .IntLiteral = <poisoned>
  938. // CHECK:STDOUT: .ToLiteral = %OtherInt.ToLiteral.decl
  939. // CHECK:STDOUT: }
  940. // CHECK:STDOUT:
  941. // CHECK:STDOUT: fn @IntLiteral() -> type = "int_literal.make_type";
  942. // CHECK:STDOUT:
  943. // CHECK:STDOUT: fn @Int(%n.param: Core.IntLiteral) -> type = "int.make_type_signed";
  944. // CHECK:STDOUT:
  945. // CHECK:STDOUT: fn @ToLiteral(%n.param: %i32.builtin) -> Core.IntLiteral = "int.convert_checked";
  946. // CHECK:STDOUT:
  947. // CHECK:STDOUT: fn @FromLiteral(%n.param: Core.IntLiteral) -> %i32.builtin = "int.convert_checked";
  948. // CHECK:STDOUT:
  949. // CHECK:STDOUT: generic fn @Make(%N.loc9_9.2: %i32.builtin) {
  950. // CHECK:STDOUT: %N.loc9_9.1: %i32.builtin = symbolic_binding N, 0 [symbolic = %N.loc9_9.1 (constants.%N.7e8)]
  951. // CHECK:STDOUT: %ToLiteral.call.loc9_40.1: init Core.IntLiteral = call constants.%ToLiteral(%N.loc9_9.1) [symbolic = %ToLiteral.call.loc9_40.1 (constants.%ToLiteral.call)]
  952. // CHECK:STDOUT: %iN.builtin: type = int_type signed, %ToLiteral.call.loc9_40.1 [symbolic = %iN.builtin (constants.%iN.builtin.b5d)]
  953. // CHECK:STDOUT: %.loc9_41.1: form = init_form %iN.builtin, call_param0 [symbolic = %.loc9_41.1 (constants.%.684)]
  954. // CHECK:STDOUT: %pattern_type: type = pattern_type %iN.builtin [symbolic = %pattern_type (constants.%pattern_type.073)]
  955. // CHECK:STDOUT:
  956. // CHECK:STDOUT: !definition:
  957. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %iN.builtin [symbolic = %require_complete (constants.%require_complete.8ad)]
  958. // CHECK:STDOUT: %Make.specific_fn.loc9_52.2: <specific function> = specific_function constants.%Make, @Make(%N.loc9_9.1) [symbolic = %Make.specific_fn.loc9_52.2 (constants.%Make.specific_fn)]
  959. // CHECK:STDOUT:
  960. // CHECK:STDOUT: fn() -> @Make.%iN.builtin (%iN.builtin.b5d) {
  961. // CHECK:STDOUT: !entry:
  962. // CHECK:STDOUT: %Make.ref: %Make.type = name_ref Make, file.%Make.decl [concrete = constants.%Make]
  963. // CHECK:STDOUT: %N.ref.loc9_57: %i32.builtin = name_ref N, %N.loc9_9.2 [symbolic = %N.loc9_9.1 (constants.%N.7e8)]
  964. // CHECK:STDOUT: %Make.specific_fn.loc9_52.1: <specific function> = specific_function %Make.ref, @Make(constants.%N.7e8) [symbolic = %Make.specific_fn.loc9_52.2 (constants.%Make.specific_fn)]
  965. // CHECK:STDOUT: %Make.call: init @Make.%iN.builtin (%iN.builtin.b5d) = call %Make.specific_fn.loc9_52.1()
  966. // CHECK:STDOUT: return %Make.call to %return.param
  967. // CHECK:STDOUT: }
  968. // CHECK:STDOUT: }
  969. // CHECK:STDOUT:
  970. // CHECK:STDOUT: fn @OtherInt.ToLiteral(%self.param.loc16: %OtherInt) -> Core.IntLiteral = "int.convert_checked";
  971. // CHECK:STDOUT:
  972. // CHECK:STDOUT: generic fn @MakeFromClass(%N.loc18_18.2: %OtherInt) {
  973. // CHECK:STDOUT: %N.loc18_18.1: %OtherInt = symbolic_binding N, 0 [symbolic = %N.loc18_18.1 (constants.%N.0f7)]
  974. // CHECK:STDOUT: %OtherInt.ToLiteral.bound.loc18_40.1: <bound method> = bound_method %N.loc18_18.1, constants.%OtherInt.ToLiteral [symbolic = %OtherInt.ToLiteral.bound.loc18_40.1 (constants.%OtherInt.ToLiteral.bound)]
  975. // CHECK:STDOUT: %OtherInt.ToLiteral.call.loc18_51.1: init Core.IntLiteral = call %OtherInt.ToLiteral.bound.loc18_40.1(%N.loc18_18.1) [symbolic = %OtherInt.ToLiteral.call.loc18_51.1 (constants.%OtherInt.ToLiteral.call)]
  976. // CHECK:STDOUT: %iN.builtin: type = int_type signed, %OtherInt.ToLiteral.call.loc18_51.1 [symbolic = %iN.builtin (constants.%iN.builtin.63a)]
  977. // CHECK:STDOUT: %.loc18_52.1: form = init_form %iN.builtin, call_param0 [symbolic = %.loc18_52.1 (constants.%.ea7)]
  978. // CHECK:STDOUT: %pattern_type: type = pattern_type %iN.builtin [symbolic = %pattern_type (constants.%pattern_type.bd7)]
  979. // CHECK:STDOUT:
  980. // CHECK:STDOUT: !definition:
  981. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %iN.builtin [symbolic = %require_complete (constants.%require_complete.a44)]
  982. // CHECK:STDOUT: %MakeFromClass.specific_fn.loc18_63.2: <specific function> = specific_function constants.%MakeFromClass, @MakeFromClass(%N.loc18_18.1) [symbolic = %MakeFromClass.specific_fn.loc18_63.2 (constants.%MakeFromClass.specific_fn)]
  983. // CHECK:STDOUT:
  984. // CHECK:STDOUT: fn() -> @MakeFromClass.%iN.builtin (%iN.builtin.63a) {
  985. // CHECK:STDOUT: !entry:
  986. // CHECK:STDOUT: %MakeFromClass.ref: %MakeFromClass.type = name_ref MakeFromClass, file.%MakeFromClass.decl [concrete = constants.%MakeFromClass]
  987. // CHECK:STDOUT: %N.ref.loc18_77: %OtherInt = name_ref N, %N.loc18_18.2 [symbolic = %N.loc18_18.1 (constants.%N.0f7)]
  988. // CHECK:STDOUT: %MakeFromClass.specific_fn.loc18_63.1: <specific function> = specific_function %MakeFromClass.ref, @MakeFromClass(constants.%N.0f7) [symbolic = %MakeFromClass.specific_fn.loc18_63.2 (constants.%MakeFromClass.specific_fn)]
  989. // CHECK:STDOUT: %MakeFromClass.call: init @MakeFromClass.%iN.builtin (%iN.builtin.63a) = call %MakeFromClass.specific_fn.loc18_63.1()
  990. // CHECK:STDOUT: return %MakeFromClass.call to %return.param
  991. // CHECK:STDOUT: }
  992. // CHECK:STDOUT: }
  993. // CHECK:STDOUT:
  994. // CHECK:STDOUT: specific @Make(constants.%N.7e8) {
  995. // CHECK:STDOUT: %N.loc9_9.1 => constants.%N.7e8
  996. // CHECK:STDOUT: %ToLiteral.call.loc9_40.1 => constants.%ToLiteral.call
  997. // CHECK:STDOUT: %iN.builtin => constants.%iN.builtin.b5d
  998. // CHECK:STDOUT: %.loc9_41.1 => constants.%.684
  999. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.073
  1000. // CHECK:STDOUT:
  1001. // CHECK:STDOUT: !definition:
  1002. // CHECK:STDOUT: %require_complete => constants.%require_complete.8ad
  1003. // CHECK:STDOUT: %Make.specific_fn.loc9_52.2 => constants.%Make.specific_fn
  1004. // CHECK:STDOUT: }
  1005. // CHECK:STDOUT:
  1006. // CHECK:STDOUT: specific @MakeFromClass(constants.%N.0f7) {
  1007. // CHECK:STDOUT: %N.loc18_18.1 => constants.%N.0f7
  1008. // CHECK:STDOUT: %OtherInt.ToLiteral.bound.loc18_40.1 => constants.%OtherInt.ToLiteral.bound
  1009. // CHECK:STDOUT: %OtherInt.ToLiteral.call.loc18_51.1 => constants.%OtherInt.ToLiteral.call
  1010. // CHECK:STDOUT: %iN.builtin => constants.%iN.builtin.63a
  1011. // CHECK:STDOUT: %.loc18_52.1 => constants.%.ea7
  1012. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.bd7
  1013. // CHECK:STDOUT:
  1014. // CHECK:STDOUT: !definition:
  1015. // CHECK:STDOUT: %require_complete => constants.%require_complete.a44
  1016. // CHECK:STDOUT: %MakeFromClass.specific_fn.loc18_63.2 => constants.%MakeFromClass.specific_fn
  1017. // CHECK:STDOUT: }
  1018. // CHECK:STDOUT:
  1019. // CHECK:STDOUT: --- use_convert_symbolic.carbon
  1020. // CHECK:STDOUT:
  1021. // CHECK:STDOUT: constants {
  1022. // CHECK:STDOUT: %Int.type: type = fn_type @Int [concrete]
  1023. // CHECK:STDOUT: %Int: %Int.type = struct_value () [concrete]
  1024. // CHECK:STDOUT: %int_64.fab: Core.IntLiteral = int_value 64 [concrete]
  1025. // CHECK:STDOUT: %i64.builtin: type = int_type signed, %int_64.fab [concrete]
  1026. // CHECK:STDOUT: %pattern_type.e13: type = pattern_type %i64.builtin [concrete]
  1027. // CHECK:STDOUT: %Make.type: type = fn_type @Make [concrete]
  1028. // CHECK:STDOUT: %Make: %Make.type = struct_value () [concrete]
  1029. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  1030. // CHECK:STDOUT: %i32.builtin: type = int_type signed, %int_32 [concrete]
  1031. // CHECK:STDOUT: %N.7e8: %i32.builtin = symbolic_binding N, 0 [symbolic]
  1032. // CHECK:STDOUT: %ToLiteral.type: type = fn_type @ToLiteral [concrete]
  1033. // CHECK:STDOUT: %ToLiteral: %ToLiteral.type = struct_value () [concrete]
  1034. // CHECK:STDOUT: %ToLiteral.call: init Core.IntLiteral = call %ToLiteral(%N.7e8) [symbolic]
  1035. // CHECK:STDOUT: %iN.builtin.b5d: type = int_type signed, %ToLiteral.call [symbolic]
  1036. // CHECK:STDOUT: %pattern_type.073: type = pattern_type %iN.builtin.b5d [symbolic]
  1037. // CHECK:STDOUT: %.684: form = init_form %iN.builtin.b5d, call_param0 [symbolic]
  1038. // CHECK:STDOUT: %Make.specific_fn.9b6: <specific function> = specific_function %Make, @Make(%N.7e8) [symbolic]
  1039. // CHECK:STDOUT: %require_complete.8ad: <witness> = require_complete_type %iN.builtin.b5d [symbolic]
  1040. // CHECK:STDOUT: %FromLiteral.type: type = fn_type @FromLiteral [concrete]
  1041. // CHECK:STDOUT: %FromLiteral: %FromLiteral.type = struct_value () [concrete]
  1042. // CHECK:STDOUT: %int_64.f82: %i32.builtin = int_value 64 [concrete]
  1043. // CHECK:STDOUT: %.bf3: form = init_form %i64.builtin, call_param0 [concrete]
  1044. // CHECK:STDOUT: %Make.specific_fn.ff0: <specific function> = specific_function %Make, @Make(%int_64.f82) [concrete]
  1045. // CHECK:STDOUT: %MakeFromClass.type: type = fn_type @MakeFromClass [concrete]
  1046. // CHECK:STDOUT: %MakeFromClass: %MakeFromClass.type = struct_value () [concrete]
  1047. // CHECK:STDOUT: %OtherInt: type = class_type @OtherInt [concrete]
  1048. // CHECK:STDOUT: %complete_type.f8a: <witness> = complete_type_witness %i32.builtin [concrete]
  1049. // CHECK:STDOUT: %N.0f7: %OtherInt = symbolic_binding N, 0 [symbolic]
  1050. // CHECK:STDOUT: %OtherInt.ToLiteral.type: type = fn_type @OtherInt.ToLiteral [concrete]
  1051. // CHECK:STDOUT: %OtherInt.ToLiteral: %OtherInt.ToLiteral.type = struct_value () [concrete]
  1052. // CHECK:STDOUT: %OtherInt.ToLiteral.bound.58f: <bound method> = bound_method %N.0f7, %OtherInt.ToLiteral [symbolic]
  1053. // CHECK:STDOUT: %OtherInt.ToLiteral.call: init Core.IntLiteral = call %OtherInt.ToLiteral.bound.58f(%N.0f7) [symbolic]
  1054. // CHECK:STDOUT: %iN.builtin.63a: type = int_type signed, %OtherInt.ToLiteral.call [symbolic]
  1055. // CHECK:STDOUT: %pattern_type.bd7: type = pattern_type %iN.builtin.63a [symbolic]
  1056. // CHECK:STDOUT: %.ea7: form = init_form %iN.builtin.63a, call_param0 [symbolic]
  1057. // CHECK:STDOUT: %MakeFromClass.specific_fn.ce0: <specific function> = specific_function %MakeFromClass, @MakeFromClass(%N.0f7) [symbolic]
  1058. // CHECK:STDOUT: %require_complete.a44: <witness> = require_complete_type %iN.builtin.63a [symbolic]
  1059. // CHECK:STDOUT: %int_64.424: %OtherInt = int_value 64 [concrete]
  1060. // CHECK:STDOUT: %OtherInt.ToLiteral.bound.67b: <bound method> = bound_method %int_64.424, %OtherInt.ToLiteral [concrete]
  1061. // CHECK:STDOUT: %MakeFromClass.specific_fn.02a: <specific function> = specific_function %MakeFromClass, @MakeFromClass(%int_64.424) [concrete]
  1062. // CHECK:STDOUT: %complete_type.4a1: <witness> = complete_type_witness %i64.builtin [concrete]
  1063. // CHECK:STDOUT: }
  1064. // CHECK:STDOUT:
  1065. // CHECK:STDOUT: imports {
  1066. // CHECK:STDOUT: %Main.IntLiteral = import_ref Main//convert_symbolic, IntLiteral, unloaded
  1067. // CHECK:STDOUT: %Main.Int: %Int.type = import_ref Main//convert_symbolic, Int, loaded [concrete = constants.%Int]
  1068. // CHECK:STDOUT: %Main.ToLiteral = import_ref Main//convert_symbolic, ToLiteral, unloaded
  1069. // CHECK:STDOUT: %Main.FromLiteral: %FromLiteral.type = import_ref Main//convert_symbolic, FromLiteral, loaded [concrete = constants.%FromLiteral]
  1070. // CHECK:STDOUT: %Main.Make: %Make.type = import_ref Main//convert_symbolic, Make, loaded [concrete = constants.%Make]
  1071. // CHECK:STDOUT: %Main.OtherInt: type = import_ref Main//convert_symbolic, OtherInt, loaded [concrete = constants.%OtherInt]
  1072. // CHECK:STDOUT: %Main.MakeFromClass: %MakeFromClass.type = import_ref Main//convert_symbolic, MakeFromClass, loaded [concrete = constants.%MakeFromClass]
  1073. // CHECK:STDOUT: %Main.import_ref.87d: %i32.builtin = import_ref Main//convert_symbolic, loc9_9, loaded [symbolic = @Make.%N (constants.%N.7e8)]
  1074. // CHECK:STDOUT: %Main.import_ref.b03: <witness> = import_ref Main//convert_symbolic, loc14_1, loaded [concrete = constants.%complete_type.f8a]
  1075. // CHECK:STDOUT: %Main.import_ref.451 = import_ref Main//convert_symbolic, inst{{[0-9A-F]+}} [no loc], unloaded
  1076. // CHECK:STDOUT: %Main.import_ref.d55 = import_ref Main//convert_symbolic, loc13_45, unloaded
  1077. // CHECK:STDOUT: %Main.import_ref.f59: %OtherInt = import_ref Main//convert_symbolic, loc18_18, loaded [symbolic = @MakeFromClass.%N (constants.%N.0f7)]
  1078. // CHECK:STDOUT: }
  1079. // CHECK:STDOUT:
  1080. // CHECK:STDOUT: file {
  1081. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1082. // CHECK:STDOUT: .IntLiteral = imports.%Main.IntLiteral
  1083. // CHECK:STDOUT: .Int = imports.%Main.Int
  1084. // CHECK:STDOUT: .ToLiteral = imports.%Main.ToLiteral
  1085. // CHECK:STDOUT: .FromLiteral = imports.%Main.FromLiteral
  1086. // CHECK:STDOUT: .Make = imports.%Main.Make
  1087. // CHECK:STDOUT: .OtherInt = imports.%Main.OtherInt
  1088. // CHECK:STDOUT: .MakeFromClass = imports.%Main.MakeFromClass
  1089. // CHECK:STDOUT: .m = %m
  1090. // CHECK:STDOUT: .n = %n
  1091. // CHECK:STDOUT: }
  1092. // CHECK:STDOUT: %default.import = import <none>
  1093. // CHECK:STDOUT: name_binding_decl {
  1094. // CHECK:STDOUT: %m.patt: %pattern_type.e13 = ref_binding_pattern m [concrete]
  1095. // CHECK:STDOUT: %m.var_patt: %pattern_type.e13 = var_pattern %m.patt [concrete]
  1096. // CHECK:STDOUT: }
  1097. // CHECK:STDOUT: %m.var: ref %i64.builtin = var %m.var_patt [concrete]
  1098. // CHECK:STDOUT: %.loc6_14.1: type = splice_block %.loc6_14.3 [concrete = constants.%i64.builtin] {
  1099. // CHECK:STDOUT: %Int.ref.loc6: %Int.type = name_ref Int, imports.%Main.Int [concrete = constants.%Int]
  1100. // CHECK:STDOUT: %int_64.loc6: Core.IntLiteral = int_value 64 [concrete = constants.%int_64.fab]
  1101. // CHECK:STDOUT: %Int.call.loc6: init type = call %Int.ref.loc6(%int_64.loc6) [concrete = constants.%i64.builtin]
  1102. // CHECK:STDOUT: %.loc6_14.2: type = value_of_initializer %Int.call.loc6 [concrete = constants.%i64.builtin]
  1103. // CHECK:STDOUT: %.loc6_14.3: type = converted %Int.call.loc6, %.loc6_14.2 [concrete = constants.%i64.builtin]
  1104. // CHECK:STDOUT: }
  1105. // CHECK:STDOUT: %m: ref %i64.builtin = ref_binding m, %m.var [concrete = %m.var]
  1106. // CHECK:STDOUT: name_binding_decl {
  1107. // CHECK:STDOUT: %n.patt: %pattern_type.e13 = ref_binding_pattern n [concrete]
  1108. // CHECK:STDOUT: %n.var_patt: %pattern_type.e13 = var_pattern %n.patt [concrete]
  1109. // CHECK:STDOUT: }
  1110. // CHECK:STDOUT: %n.var: ref %i64.builtin = var %n.var_patt [concrete]
  1111. // CHECK:STDOUT: %.loc7_14.1: type = splice_block %.loc7_14.3 [concrete = constants.%i64.builtin] {
  1112. // CHECK:STDOUT: %Int.ref.loc7: %Int.type = name_ref Int, imports.%Main.Int [concrete = constants.%Int]
  1113. // CHECK:STDOUT: %int_64.loc7: Core.IntLiteral = int_value 64 [concrete = constants.%int_64.fab]
  1114. // CHECK:STDOUT: %Int.call.loc7: init type = call %Int.ref.loc7(%int_64.loc7) [concrete = constants.%i64.builtin]
  1115. // CHECK:STDOUT: %.loc7_14.2: type = value_of_initializer %Int.call.loc7 [concrete = constants.%i64.builtin]
  1116. // CHECK:STDOUT: %.loc7_14.3: type = converted %Int.call.loc7, %.loc7_14.2 [concrete = constants.%i64.builtin]
  1117. // CHECK:STDOUT: }
  1118. // CHECK:STDOUT: %n: ref %i64.builtin = ref_binding n, %n.var [concrete = %n.var]
  1119. // CHECK:STDOUT: }
  1120. // CHECK:STDOUT:
  1121. // CHECK:STDOUT: class @OtherInt [from "convert_symbolic.carbon"] {
  1122. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.b03
  1123. // CHECK:STDOUT:
  1124. // CHECK:STDOUT: !members:
  1125. // CHECK:STDOUT: .Self = imports.%Main.import_ref.451
  1126. // CHECK:STDOUT: .ToLiteral = imports.%Main.import_ref.d55
  1127. // CHECK:STDOUT: }
  1128. // CHECK:STDOUT:
  1129. // CHECK:STDOUT: fn @Int = "int.make_type_signed" [from "convert_symbolic.carbon"];
  1130. // CHECK:STDOUT:
  1131. // CHECK:STDOUT: generic fn @Make(imports.%Main.import_ref.87d: %i32.builtin) [from "convert_symbolic.carbon"] {
  1132. // CHECK:STDOUT: %N: %i32.builtin = symbolic_binding N, 0 [symbolic = %N (constants.%N.7e8)]
  1133. // CHECK:STDOUT: %ToLiteral.call: init Core.IntLiteral = call constants.%ToLiteral(%N) [symbolic = %ToLiteral.call (constants.%ToLiteral.call)]
  1134. // CHECK:STDOUT: %iN.builtin: type = int_type signed, %ToLiteral.call [symbolic = %iN.builtin (constants.%iN.builtin.b5d)]
  1135. // CHECK:STDOUT: %.1: form = init_form %iN.builtin, call_param0 [symbolic = %.1 (constants.%.684)]
  1136. // CHECK:STDOUT: %pattern_type: type = pattern_type %iN.builtin [symbolic = %pattern_type (constants.%pattern_type.073)]
  1137. // CHECK:STDOUT:
  1138. // CHECK:STDOUT: !definition:
  1139. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %iN.builtin [symbolic = %require_complete (constants.%require_complete.8ad)]
  1140. // CHECK:STDOUT: %Make.specific_fn: <specific function> = specific_function constants.%Make, @Make(%N) [symbolic = %Make.specific_fn (constants.%Make.specific_fn.9b6)]
  1141. // CHECK:STDOUT:
  1142. // CHECK:STDOUT: fn;
  1143. // CHECK:STDOUT: }
  1144. // CHECK:STDOUT:
  1145. // CHECK:STDOUT: fn @ToLiteral = "int.convert_checked" [from "convert_symbolic.carbon"];
  1146. // CHECK:STDOUT:
  1147. // CHECK:STDOUT: fn @FromLiteral = "int.convert_checked" [from "convert_symbolic.carbon"];
  1148. // CHECK:STDOUT:
  1149. // CHECK:STDOUT: generic fn @MakeFromClass(imports.%Main.import_ref.f59: %OtherInt) [from "convert_symbolic.carbon"] {
  1150. // CHECK:STDOUT: %N: %OtherInt = symbolic_binding N, 0 [symbolic = %N (constants.%N.0f7)]
  1151. // CHECK:STDOUT: %OtherInt.ToLiteral.bound: <bound method> = bound_method %N, constants.%OtherInt.ToLiteral [symbolic = %OtherInt.ToLiteral.bound (constants.%OtherInt.ToLiteral.bound.58f)]
  1152. // CHECK:STDOUT: %OtherInt.ToLiteral.call: init Core.IntLiteral = call %OtherInt.ToLiteral.bound(%N) [symbolic = %OtherInt.ToLiteral.call (constants.%OtherInt.ToLiteral.call)]
  1153. // CHECK:STDOUT: %iN.builtin: type = int_type signed, %OtherInt.ToLiteral.call [symbolic = %iN.builtin (constants.%iN.builtin.63a)]
  1154. // CHECK:STDOUT: %.1: form = init_form %iN.builtin, call_param0 [symbolic = %.1 (constants.%.ea7)]
  1155. // CHECK:STDOUT: %pattern_type: type = pattern_type %iN.builtin [symbolic = %pattern_type (constants.%pattern_type.bd7)]
  1156. // CHECK:STDOUT:
  1157. // CHECK:STDOUT: !definition:
  1158. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %iN.builtin [symbolic = %require_complete (constants.%require_complete.a44)]
  1159. // CHECK:STDOUT: %MakeFromClass.specific_fn: <specific function> = specific_function constants.%MakeFromClass, @MakeFromClass(%N) [symbolic = %MakeFromClass.specific_fn (constants.%MakeFromClass.specific_fn.ce0)]
  1160. // CHECK:STDOUT:
  1161. // CHECK:STDOUT: fn;
  1162. // CHECK:STDOUT: }
  1163. // CHECK:STDOUT:
  1164. // CHECK:STDOUT: fn @OtherInt.ToLiteral = "int.convert_checked" [from "convert_symbolic.carbon"];
  1165. // CHECK:STDOUT:
  1166. // CHECK:STDOUT: fn @__global_init() {
  1167. // CHECK:STDOUT: !entry:
  1168. // CHECK:STDOUT: %Make.ref: %Make.type = name_ref Make, imports.%Main.Make [concrete = constants.%Make]
  1169. // CHECK:STDOUT: %FromLiteral.ref.loc6: %FromLiteral.type = name_ref FromLiteral, imports.%Main.FromLiteral [concrete = constants.%FromLiteral]
  1170. // CHECK:STDOUT: %int_64.loc6: Core.IntLiteral = int_value 64 [concrete = constants.%int_64.fab]
  1171. // CHECK:STDOUT: %FromLiteral.call.loc6: init %i32.builtin = call %FromLiteral.ref.loc6(%int_64.loc6) [concrete = constants.%int_64.f82]
  1172. // CHECK:STDOUT: %.loc6_38.1: %i32.builtin = value_of_initializer %FromLiteral.call.loc6 [concrete = constants.%int_64.f82]
  1173. // CHECK:STDOUT: %.loc6_38.2: %i32.builtin = converted %FromLiteral.call.loc6, %.loc6_38.1 [concrete = constants.%int_64.f82]
  1174. // CHECK:STDOUT: %Make.specific_fn: <specific function> = specific_function %Make.ref, @Make(constants.%int_64.f82) [concrete = constants.%Make.specific_fn.ff0]
  1175. // CHECK:STDOUT: %Make.call: init %i64.builtin = call %Make.specific_fn()
  1176. // CHECK:STDOUT: assign file.%m.var, %Make.call
  1177. // CHECK:STDOUT: %MakeFromClass.ref: %MakeFromClass.type = name_ref MakeFromClass, imports.%Main.MakeFromClass [concrete = constants.%MakeFromClass]
  1178. // CHECK:STDOUT: %FromLiteral.ref.loc7: %FromLiteral.type = name_ref FromLiteral, imports.%Main.FromLiteral [concrete = constants.%FromLiteral]
  1179. // CHECK:STDOUT: %int_64.loc7: Core.IntLiteral = int_value 64 [concrete = constants.%int_64.fab]
  1180. // CHECK:STDOUT: %FromLiteral.call.loc7: init %i32.builtin = call %FromLiteral.ref.loc7(%int_64.loc7) [concrete = constants.%int_64.f82]
  1181. // CHECK:STDOUT: %OtherInt.ref: type = name_ref OtherInt, imports.%Main.OtherInt [concrete = constants.%OtherInt]
  1182. // CHECK:STDOUT: %.loc7_48.1: init %OtherInt = as_compatible %FromLiteral.call.loc7 [concrete = constants.%int_64.424]
  1183. // CHECK:STDOUT: %.loc7_48.2: init %OtherInt = converted %FromLiteral.call.loc7, %.loc7_48.1 [concrete = constants.%int_64.424]
  1184. // CHECK:STDOUT: %.loc7_59.1: %OtherInt = value_of_initializer %.loc7_48.2 [concrete = constants.%int_64.424]
  1185. // CHECK:STDOUT: %.loc7_59.2: %OtherInt = converted %.loc7_48.2, %.loc7_59.1 [concrete = constants.%int_64.424]
  1186. // CHECK:STDOUT: %MakeFromClass.specific_fn: <specific function> = specific_function %MakeFromClass.ref, @MakeFromClass(constants.%int_64.424) [concrete = constants.%MakeFromClass.specific_fn.02a]
  1187. // CHECK:STDOUT: %MakeFromClass.call: init %i64.builtin = call %MakeFromClass.specific_fn()
  1188. // CHECK:STDOUT: assign file.%n.var, %MakeFromClass.call
  1189. // CHECK:STDOUT: return
  1190. // CHECK:STDOUT: }
  1191. // CHECK:STDOUT:
  1192. // CHECK:STDOUT: specific @Make(constants.%N.7e8) {
  1193. // CHECK:STDOUT: %N => constants.%N.7e8
  1194. // CHECK:STDOUT: %ToLiteral.call => constants.%ToLiteral.call
  1195. // CHECK:STDOUT: %iN.builtin => constants.%iN.builtin.b5d
  1196. // CHECK:STDOUT: %.1 => constants.%.684
  1197. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.073
  1198. // CHECK:STDOUT:
  1199. // CHECK:STDOUT: !definition:
  1200. // CHECK:STDOUT: %require_complete => constants.%require_complete.8ad
  1201. // CHECK:STDOUT: %Make.specific_fn => constants.%Make.specific_fn.9b6
  1202. // CHECK:STDOUT: }
  1203. // CHECK:STDOUT:
  1204. // CHECK:STDOUT: specific @Make(constants.%int_64.f82) {
  1205. // CHECK:STDOUT: %N => constants.%int_64.f82
  1206. // CHECK:STDOUT: %ToLiteral.call => constants.%int_64.fab
  1207. // CHECK:STDOUT: %iN.builtin => constants.%i64.builtin
  1208. // CHECK:STDOUT: %.1 => constants.%.bf3
  1209. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.e13
  1210. // CHECK:STDOUT:
  1211. // CHECK:STDOUT: !definition:
  1212. // CHECK:STDOUT: %require_complete => constants.%complete_type.4a1
  1213. // CHECK:STDOUT: %Make.specific_fn => constants.%Make.specific_fn.ff0
  1214. // CHECK:STDOUT: }
  1215. // CHECK:STDOUT:
  1216. // CHECK:STDOUT: specific @MakeFromClass(constants.%N.0f7) {
  1217. // CHECK:STDOUT: %N => constants.%N.0f7
  1218. // CHECK:STDOUT: %OtherInt.ToLiteral.bound => constants.%OtherInt.ToLiteral.bound.58f
  1219. // CHECK:STDOUT: %OtherInt.ToLiteral.call => constants.%OtherInt.ToLiteral.call
  1220. // CHECK:STDOUT: %iN.builtin => constants.%iN.builtin.63a
  1221. // CHECK:STDOUT: %.1 => constants.%.ea7
  1222. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.bd7
  1223. // CHECK:STDOUT:
  1224. // CHECK:STDOUT: !definition:
  1225. // CHECK:STDOUT: %require_complete => constants.%require_complete.a44
  1226. // CHECK:STDOUT: %MakeFromClass.specific_fn => constants.%MakeFromClass.specific_fn.ce0
  1227. // CHECK:STDOUT: }
  1228. // CHECK:STDOUT:
  1229. // CHECK:STDOUT: specific @MakeFromClass(constants.%int_64.424) {
  1230. // CHECK:STDOUT: %N => constants.%int_64.424
  1231. // CHECK:STDOUT: %OtherInt.ToLiteral.bound => constants.%OtherInt.ToLiteral.bound.67b
  1232. // CHECK:STDOUT: %OtherInt.ToLiteral.call => constants.%int_64.fab
  1233. // CHECK:STDOUT: %iN.builtin => constants.%i64.builtin
  1234. // CHECK:STDOUT: %.1 => constants.%.bf3
  1235. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.e13
  1236. // CHECK:STDOUT:
  1237. // CHECK:STDOUT: !definition:
  1238. // CHECK:STDOUT: %require_complete => constants.%complete_type.4a1
  1239. // CHECK:STDOUT: %MakeFromClass.specific_fn => constants.%MakeFromClass.specific_fn.02a
  1240. // CHECK:STDOUT: }
  1241. // CHECK:STDOUT: