import_builtin_call.carbon 91 KB

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