interface_args.carbon 99 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // AUTOUPDATE
  6. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/no_prelude/interface_args.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/no_prelude/interface_args.carbon
  10. // --- core.carbon
  11. package Core;
  12. interface ImplicitAs(Dest:! type) {
  13. fn Convert[self: Self]() -> Dest;
  14. }
  15. // --- action.carbon
  16. library "[[@TEST_NAME]]";
  17. interface Action(T:! type) {
  18. fn Op[self: Self]();
  19. }
  20. class A {}
  21. class B {}
  22. class C {}
  23. impl A as Action(B) {
  24. fn Op[self: Self]() {}
  25. }
  26. fn F(a: A) { a.(Action(B).Op)(); }
  27. // --- action.impl.carbon
  28. impl library "[[@TEST_NAME]]";
  29. fn G(a: A) { a.(Action(B).Op)(); }
  30. // --- fail_action.impl.carbon
  31. impl library "[[@TEST_NAME]]";
  32. // CHECK:STDERR: fail_action.impl.carbon:[[@LINE+4]]:14: error: cannot access member of interface `Action(C)` in type `A` that does not implement that interface [MissingImplInMemberAccess]
  33. // CHECK:STDERR: fn G(a: A) { a.(Action(C).Op)(); }
  34. // CHECK:STDERR: ^~~~~~~~~~~~~~~~
  35. // CHECK:STDERR:
  36. fn G(a: A) { a.(Action(C).Op)(); }
  37. // --- factory.carbon
  38. library "[[@TEST_NAME]]";
  39. interface Factory(T:! type) {
  40. // Non-instance class function
  41. fn Make() -> T;
  42. // Instance method
  43. fn Method[self: Self]() -> T;
  44. }
  45. class A {}
  46. class B {}
  47. impl A as Factory(B) {
  48. fn Make() -> B;
  49. fn Method[self: Self]() -> B;
  50. }
  51. // --- factory.impl.carbon
  52. impl library "[[@TEST_NAME]]";
  53. fn MakeB() -> B {
  54. return A.(Factory(B).Make)();
  55. }
  56. fn InstanceB(a: A) -> B {
  57. return a.(Factory(B).Method)();
  58. }
  59. // --- fail_factory.impl.carbon
  60. impl library "[[@TEST_NAME]]";
  61. import Core;
  62. class C {}
  63. fn MakeC() -> C {
  64. // CHECK:STDERR: fail_factory.impl.carbon:[[@LINE+7]]:10: error: cannot implicitly convert type `A` into type implementing `Factory(C)` [ConversionFailureTypeToFacet]
  65. // CHECK:STDERR: return A.(Factory(C).Make)();
  66. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
  67. // CHECK:STDERR: fail_factory.impl.carbon:[[@LINE+4]]:10: note: type `type` does not implement interface `Core.ImplicitAs(Factory(C))` [MissingImplInMemberAccessNote]
  68. // CHECK:STDERR: return A.(Factory(C).Make)();
  69. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
  70. // CHECK:STDERR:
  71. return A.(Factory(C).Make)();
  72. }
  73. fn InstanceC(a: A) -> C {
  74. // CHECK:STDERR: fail_factory.impl.carbon:[[@LINE+4]]:10: error: cannot access member of interface `Factory(C)` in type `A` that does not implement that interface [MissingImplInMemberAccess]
  75. // CHECK:STDERR: return a.(Factory(C).Method)();
  76. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
  77. // CHECK:STDERR:
  78. return a.(Factory(C).Method)();
  79. }
  80. // CHECK:STDOUT: --- core.carbon
  81. // CHECK:STDOUT:
  82. // CHECK:STDOUT: constants {
  83. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic]
  84. // CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic]
  85. // CHECK:STDOUT: %ImplicitAs.type.96f: type = generic_interface_type @ImplicitAs [concrete]
  86. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.96f = struct_value () [concrete]
  87. // CHECK:STDOUT: %ImplicitAs.type.07f: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic]
  88. // CHECK:STDOUT: %Self: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic]
  89. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic]
  90. // CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic]
  91. // CHECK:STDOUT: %Convert: %Convert.type = struct_value () [symbolic]
  92. // CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type %ImplicitAs.type.07f [symbolic]
  93. // CHECK:STDOUT: %assoc0: %ImplicitAs.assoc_type = assoc_entity element0, @ImplicitAs.%Convert.decl [symbolic]
  94. // CHECK:STDOUT: }
  95. // CHECK:STDOUT:
  96. // CHECK:STDOUT: file {
  97. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  98. // CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl
  99. // CHECK:STDOUT: }
  100. // CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] {
  101. // CHECK:STDOUT: %Dest.patt.loc3_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc3_22.2 (constants.%Dest.patt)]
  102. // CHECK:STDOUT: } {
  103. // CHECK:STDOUT: %Dest.loc3_22.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc3_22.2 (constants.%Dest)]
  104. // CHECK:STDOUT: }
  105. // CHECK:STDOUT: }
  106. // CHECK:STDOUT:
  107. // CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc3_22.1: type) {
  108. // CHECK:STDOUT: %Dest.loc3_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc3_22.2 (constants.%Dest)]
  109. // CHECK:STDOUT: %Dest.patt.loc3_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc3_22.2 (constants.%Dest.patt)]
  110. // CHECK:STDOUT:
  111. // CHECK:STDOUT: !definition:
  112. // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc3_22.2)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.07f)]
  113. // CHECK:STDOUT: %Self.2: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)]
  114. // CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest.loc3_22.2) [symbolic = %Convert.type (constants.%Convert.type)]
  115. // CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type) = struct_value () [symbolic = %Convert (constants.%Convert)]
  116. // CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f) [symbolic = %ImplicitAs.assoc_type (constants.%ImplicitAs.assoc_type)]
  117. // CHECK:STDOUT: %assoc0.loc4_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc4_35.2 (constants.%assoc0)]
  118. // CHECK:STDOUT:
  119. // CHECK:STDOUT: interface {
  120. // CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)]
  121. // CHECK:STDOUT: %Convert.decl: @ImplicitAs.%Convert.type (%Convert.type) = fn_decl @Convert [symbolic = @ImplicitAs.%Convert (constants.%Convert)] {
  122. // CHECK:STDOUT: %self.patt: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type) = binding_pattern self
  123. // CHECK:STDOUT: %self.param_patt: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type) = value_param_pattern %self.patt, call_param0
  124. // CHECK:STDOUT: %return.patt: @Convert.%Dest (%Dest) = return_slot_pattern
  125. // CHECK:STDOUT: %return.param_patt: @Convert.%Dest (%Dest) = out_param_pattern %return.patt, call_param1
  126. // CHECK:STDOUT: } {
  127. // CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc3_22.1 [symbolic = %Dest (constants.%Dest)]
  128. // CHECK:STDOUT: %self.param: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type) = value_param call_param0
  129. // CHECK:STDOUT: %.loc4_20.1: type = splice_block %.loc4_20.3 [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)] {
  130. // CHECK:STDOUT: %.loc4_20.2: @Convert.%ImplicitAs.type (%ImplicitAs.type.07f) = specific_constant @ImplicitAs.%Self.1, @ImplicitAs(constants.%Dest) [symbolic = %Self (constants.%Self)]
  131. // CHECK:STDOUT: %Self.ref: @Convert.%ImplicitAs.type (%ImplicitAs.type.07f) = name_ref Self, %.loc4_20.2 [symbolic = %Self (constants.%Self)]
  132. // CHECK:STDOUT: %Self.as_type.loc4_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)]
  133. // CHECK:STDOUT: %.loc4_20.3: type = converted %Self.ref, %Self.as_type.loc4_20.2 [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)]
  134. // CHECK:STDOUT: }
  135. // CHECK:STDOUT: %self: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type) = bind_name self, %self.param
  136. // CHECK:STDOUT: %return.param: ref @Convert.%Dest (%Dest) = out_param call_param1
  137. // CHECK:STDOUT: %return: ref @Convert.%Dest (%Dest) = return_slot %return.param
  138. // CHECK:STDOUT: }
  139. // CHECK:STDOUT: %assoc0.loc4_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc4_35.2 (constants.%assoc0)]
  140. // CHECK:STDOUT:
  141. // CHECK:STDOUT: !members:
  142. // CHECK:STDOUT: .Self = %Self.1
  143. // CHECK:STDOUT: .Dest = <poisoned>
  144. // CHECK:STDOUT: .Convert = %assoc0.loc4_35.1
  145. // CHECK:STDOUT: witness = (%Convert.decl)
  146. // CHECK:STDOUT: }
  147. // CHECK:STDOUT: }
  148. // CHECK:STDOUT:
  149. // CHECK:STDOUT: generic fn @Convert(@ImplicitAs.%Dest.loc3_22.1: type, @ImplicitAs.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f)) {
  150. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
  151. // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.07f)]
  152. // CHECK:STDOUT: %Self: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)]
  153. // CHECK:STDOUT: %Self.as_type.loc4_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc4_20.1 (constants.%Self.as_type)]
  154. // CHECK:STDOUT:
  155. // CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type.loc4_20.1 (%Self.as_type)]() -> @Convert.%Dest (%Dest);
  156. // CHECK:STDOUT: }
  157. // CHECK:STDOUT:
  158. // CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) {
  159. // CHECK:STDOUT: %Dest.loc3_22.2 => constants.%Dest
  160. // CHECK:STDOUT: %Dest.patt.loc3_22.2 => constants.%Dest
  161. // CHECK:STDOUT: }
  162. // CHECK:STDOUT:
  163. // CHECK:STDOUT: specific @Convert(constants.%Dest, constants.%Self) {
  164. // CHECK:STDOUT: %Dest => constants.%Dest
  165. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.07f
  166. // CHECK:STDOUT: %Self => constants.%Self
  167. // CHECK:STDOUT: %Self.as_type.loc4_20.1 => constants.%Self.as_type
  168. // CHECK:STDOUT: }
  169. // CHECK:STDOUT:
  170. // CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {}
  171. // CHECK:STDOUT:
  172. // CHECK:STDOUT: specific @ImplicitAs(%Dest.loc3_22.2) {}
  173. // CHECK:STDOUT:
  174. // CHECK:STDOUT: --- action.carbon
  175. // CHECK:STDOUT:
  176. // CHECK:STDOUT: constants {
  177. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  178. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  179. // CHECK:STDOUT: %Action.type.29c: type = generic_interface_type @Action [concrete]
  180. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  181. // CHECK:STDOUT: %Action.generic: %Action.type.29c = struct_value () [concrete]
  182. // CHECK:STDOUT: %Action.type.cca: type = facet_type <@Action, @Action(%T)> [symbolic]
  183. // CHECK:STDOUT: %Self: %Action.type.cca = bind_symbolic_name Self, 1 [symbolic]
  184. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic]
  185. // CHECK:STDOUT: %Op.type.036: type = fn_type @Op.1, @Action(%T) [symbolic]
  186. // CHECK:STDOUT: %Op.6ed: %Op.type.036 = struct_value () [symbolic]
  187. // CHECK:STDOUT: %Action.assoc_type.8f9: type = assoc_entity_type %Action.type.cca [symbolic]
  188. // CHECK:STDOUT: %assoc0.69b: %Action.assoc_type.8f9 = assoc_entity element0, @Action.%Op.decl [symbolic]
  189. // CHECK:STDOUT: %A: type = class_type @A [concrete]
  190. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  191. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  192. // CHECK:STDOUT: %B: type = class_type @B [concrete]
  193. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  194. // CHECK:STDOUT: %Action.type.cb0: type = facet_type <@Action, @Action(%B)> [concrete]
  195. // CHECK:STDOUT: %Op.type.54d: type = fn_type @Op.1, @Action(%B) [concrete]
  196. // CHECK:STDOUT: %Op.dba: %Op.type.54d = struct_value () [concrete]
  197. // CHECK:STDOUT: %Action.assoc_type.827: type = assoc_entity_type %Action.type.cb0 [concrete]
  198. // CHECK:STDOUT: %assoc0.035: %Action.assoc_type.827 = assoc_entity element0, @Action.%Op.decl [concrete]
  199. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (@impl.%Op.decl) [concrete]
  200. // CHECK:STDOUT: %Op.type.4b4: type = fn_type @Op.2 [concrete]
  201. // CHECK:STDOUT: %Op.40d: %Op.type.4b4 = struct_value () [concrete]
  202. // CHECK:STDOUT: %Action.facet: %Action.type.cb0 = facet_value %A, (%impl_witness) [concrete]
  203. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  204. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  205. // CHECK:STDOUT: %.dde: type = fn_type_with_self_type %Op.type.54d, %Action.facet [concrete]
  206. // CHECK:STDOUT: }
  207. // CHECK:STDOUT:
  208. // CHECK:STDOUT: file {
  209. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  210. // CHECK:STDOUT: .Action = %Action.decl
  211. // CHECK:STDOUT: .A = %A.decl
  212. // CHECK:STDOUT: .B = %B.decl
  213. // CHECK:STDOUT: .C = %C.decl
  214. // CHECK:STDOUT: .F = %F.decl
  215. // CHECK:STDOUT: }
  216. // CHECK:STDOUT: %Action.decl: %Action.type.29c = interface_decl @Action [concrete = constants.%Action.generic] {
  217. // CHECK:STDOUT: %T.patt.loc4_18.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_18.2 (constants.%T.patt)]
  218. // CHECK:STDOUT: } {
  219. // CHECK:STDOUT: %T.loc4_18.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_18.2 (constants.%T)]
  220. // CHECK:STDOUT: }
  221. // CHECK:STDOUT: %A.decl: type = class_decl @A [concrete = constants.%A] {} {}
  222. // CHECK:STDOUT: %B.decl: type = class_decl @B [concrete = constants.%B] {} {}
  223. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  224. // CHECK:STDOUT: impl_decl @impl [concrete] {} {
  225. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A]
  226. // CHECK:STDOUT: %Action.ref: %Action.type.29c = name_ref Action, file.%Action.decl [concrete = constants.%Action.generic]
  227. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B]
  228. // CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(constants.%B)> [concrete = constants.%Action.type.cb0]
  229. // CHECK:STDOUT: }
  230. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (@impl.%Op.decl) [concrete = constants.%impl_witness]
  231. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  232. // CHECK:STDOUT: %a.patt: %A = binding_pattern a
  233. // CHECK:STDOUT: %a.param_patt: %A = value_param_pattern %a.patt, call_param0
  234. // CHECK:STDOUT: } {
  235. // CHECK:STDOUT: %a.param: %A = value_param call_param0
  236. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A]
  237. // CHECK:STDOUT: %a: %A = bind_name a, %a.param
  238. // CHECK:STDOUT: }
  239. // CHECK:STDOUT: }
  240. // CHECK:STDOUT:
  241. // CHECK:STDOUT: generic interface @Action(%T.loc4_18.1: type) {
  242. // CHECK:STDOUT: %T.loc4_18.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_18.2 (constants.%T)]
  243. // CHECK:STDOUT: %T.patt.loc4_18.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_18.2 (constants.%T.patt)]
  244. // CHECK:STDOUT:
  245. // CHECK:STDOUT: !definition:
  246. // CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(%T.loc4_18.2)> [symbolic = %Action.type (constants.%Action.type.cca)]
  247. // CHECK:STDOUT: %Self.2: %Action.type.cca = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)]
  248. // CHECK:STDOUT: %Op.type: type = fn_type @Op.1, @Action(%T.loc4_18.2) [symbolic = %Op.type (constants.%Op.type.036)]
  249. // CHECK:STDOUT: %Op: @Action.%Op.type (%Op.type.036) = struct_value () [symbolic = %Op (constants.%Op.6ed)]
  250. // CHECK:STDOUT: %Action.assoc_type: type = assoc_entity_type @Action.%Action.type (%Action.type.cca) [symbolic = %Action.assoc_type (constants.%Action.assoc_type.8f9)]
  251. // CHECK:STDOUT: %assoc0.loc5_22.2: @Action.%Action.assoc_type (%Action.assoc_type.8f9) = assoc_entity element0, %Op.decl [symbolic = %assoc0.loc5_22.2 (constants.%assoc0.69b)]
  252. // CHECK:STDOUT:
  253. // CHECK:STDOUT: interface {
  254. // CHECK:STDOUT: %Self.1: @Action.%Action.type (%Action.type.cca) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)]
  255. // CHECK:STDOUT: %Op.decl: @Action.%Op.type (%Op.type.036) = fn_decl @Op.1 [symbolic = @Action.%Op (constants.%Op.6ed)] {
  256. // CHECK:STDOUT: %self.patt: @Op.1.%Self.as_type.loc5_15.1 (%Self.as_type) = binding_pattern self
  257. // CHECK:STDOUT: %self.param_patt: @Op.1.%Self.as_type.loc5_15.1 (%Self.as_type) = value_param_pattern %self.patt, call_param0
  258. // CHECK:STDOUT: } {
  259. // CHECK:STDOUT: %self.param: @Op.1.%Self.as_type.loc5_15.1 (%Self.as_type) = value_param call_param0
  260. // CHECK:STDOUT: %.loc5_15.1: type = splice_block %.loc5_15.3 [symbolic = %Self.as_type.loc5_15.1 (constants.%Self.as_type)] {
  261. // CHECK:STDOUT: %.loc5_15.2: @Op.1.%Action.type (%Action.type.cca) = specific_constant @Action.%Self.1, @Action(constants.%T) [symbolic = %Self (constants.%Self)]
  262. // CHECK:STDOUT: %Self.ref: @Op.1.%Action.type (%Action.type.cca) = name_ref Self, %.loc5_15.2 [symbolic = %Self (constants.%Self)]
  263. // CHECK:STDOUT: %Self.as_type.loc5_15.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc5_15.1 (constants.%Self.as_type)]
  264. // CHECK:STDOUT: %.loc5_15.3: type = converted %Self.ref, %Self.as_type.loc5_15.2 [symbolic = %Self.as_type.loc5_15.1 (constants.%Self.as_type)]
  265. // CHECK:STDOUT: }
  266. // CHECK:STDOUT: %self: @Op.1.%Self.as_type.loc5_15.1 (%Self.as_type) = bind_name self, %self.param
  267. // CHECK:STDOUT: }
  268. // CHECK:STDOUT: %assoc0.loc5_22.1: @Action.%Action.assoc_type (%Action.assoc_type.8f9) = assoc_entity element0, %Op.decl [symbolic = %assoc0.loc5_22.2 (constants.%assoc0.69b)]
  269. // CHECK:STDOUT:
  270. // CHECK:STDOUT: !members:
  271. // CHECK:STDOUT: .Self = %Self.1
  272. // CHECK:STDOUT: .Op = %assoc0.loc5_22.1
  273. // CHECK:STDOUT: witness = (%Op.decl)
  274. // CHECK:STDOUT: }
  275. // CHECK:STDOUT: }
  276. // CHECK:STDOUT:
  277. // CHECK:STDOUT: impl @impl: %A.ref as %Action.type {
  278. // CHECK:STDOUT: %Op.decl: %Op.type.4b4 = fn_decl @Op.2 [concrete = constants.%Op.40d] {
  279. // CHECK:STDOUT: %self.patt: %A = binding_pattern self
  280. // CHECK:STDOUT: %self.param_patt: %A = value_param_pattern %self.patt, call_param0
  281. // CHECK:STDOUT: } {
  282. // CHECK:STDOUT: %self.param: %A = value_param call_param0
  283. // CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.%A.ref [concrete = constants.%A]
  284. // CHECK:STDOUT: %self: %A = bind_name self, %self.param
  285. // CHECK:STDOUT: }
  286. // CHECK:STDOUT:
  287. // CHECK:STDOUT: !members:
  288. // CHECK:STDOUT: .Op = %Op.decl
  289. // CHECK:STDOUT: witness = file.%impl_witness
  290. // CHECK:STDOUT: }
  291. // CHECK:STDOUT:
  292. // CHECK:STDOUT: class @A {
  293. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  294. // CHECK:STDOUT: complete_type_witness = %complete_type
  295. // CHECK:STDOUT:
  296. // CHECK:STDOUT: !members:
  297. // CHECK:STDOUT: .Self = constants.%A
  298. // CHECK:STDOUT: }
  299. // CHECK:STDOUT:
  300. // CHECK:STDOUT: class @B {
  301. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  302. // CHECK:STDOUT: complete_type_witness = %complete_type
  303. // CHECK:STDOUT:
  304. // CHECK:STDOUT: !members:
  305. // CHECK:STDOUT: .Self = constants.%B
  306. // CHECK:STDOUT: }
  307. // CHECK:STDOUT:
  308. // CHECK:STDOUT: class @C {
  309. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  310. // CHECK:STDOUT: complete_type_witness = %complete_type
  311. // CHECK:STDOUT:
  312. // CHECK:STDOUT: !members:
  313. // CHECK:STDOUT: .Self = constants.%C
  314. // CHECK:STDOUT: }
  315. // CHECK:STDOUT:
  316. // CHECK:STDOUT: generic fn @Op.1(@Action.%T.loc4_18.1: type, @Action.%Self.1: @Action.%Action.type (%Action.type.cca)) {
  317. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  318. // CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(%T)> [symbolic = %Action.type (constants.%Action.type.cca)]
  319. // CHECK:STDOUT: %Self: %Action.type.cca = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)]
  320. // CHECK:STDOUT: %Self.as_type.loc5_15.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_15.1 (constants.%Self.as_type)]
  321. // CHECK:STDOUT:
  322. // CHECK:STDOUT: fn[%self.param_patt: @Op.1.%Self.as_type.loc5_15.1 (%Self.as_type)]();
  323. // CHECK:STDOUT: }
  324. // CHECK:STDOUT:
  325. // CHECK:STDOUT: fn @Op.2[%self.param_patt: %A]() {
  326. // CHECK:STDOUT: !entry:
  327. // CHECK:STDOUT: return
  328. // CHECK:STDOUT: }
  329. // CHECK:STDOUT:
  330. // CHECK:STDOUT: fn @F(%a.param_patt: %A) {
  331. // CHECK:STDOUT: !entry:
  332. // CHECK:STDOUT: %a.ref: %A = name_ref a, %a
  333. // CHECK:STDOUT: %Action.ref: %Action.type.29c = name_ref Action, file.%Action.decl [concrete = constants.%Action.generic]
  334. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B]
  335. // CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(constants.%B)> [concrete = constants.%Action.type.cb0]
  336. // CHECK:STDOUT: %.loc16: %Action.assoc_type.827 = specific_constant @Action.%assoc0.loc5_22.1, @Action(constants.%B) [concrete = constants.%assoc0.035]
  337. // CHECK:STDOUT: %Op.ref: %Action.assoc_type.827 = name_ref Op, %.loc16 [concrete = constants.%assoc0.035]
  338. // CHECK:STDOUT: %impl.elem0: %.dde = impl_witness_access constants.%impl_witness, element0 [concrete = constants.%Op.40d]
  339. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %a.ref, %impl.elem0
  340. // CHECK:STDOUT: %Op.call: init %empty_tuple.type = call %bound_method(%a.ref)
  341. // CHECK:STDOUT: return
  342. // CHECK:STDOUT: }
  343. // CHECK:STDOUT:
  344. // CHECK:STDOUT: specific @Action(constants.%T) {
  345. // CHECK:STDOUT: %T.loc4_18.2 => constants.%T
  346. // CHECK:STDOUT: %T.patt.loc4_18.2 => constants.%T
  347. // CHECK:STDOUT: }
  348. // CHECK:STDOUT:
  349. // CHECK:STDOUT: specific @Op.1(constants.%T, constants.%Self) {
  350. // CHECK:STDOUT: %T => constants.%T
  351. // CHECK:STDOUT: %Action.type => constants.%Action.type.cca
  352. // CHECK:STDOUT: %Self => constants.%Self
  353. // CHECK:STDOUT: %Self.as_type.loc5_15.1 => constants.%Self.as_type
  354. // CHECK:STDOUT: }
  355. // CHECK:STDOUT:
  356. // CHECK:STDOUT: specific @Action(@Op.1.%T) {}
  357. // CHECK:STDOUT:
  358. // CHECK:STDOUT: specific @Action(%T.loc4_18.2) {}
  359. // CHECK:STDOUT:
  360. // CHECK:STDOUT: specific @Action(constants.%B) {
  361. // CHECK:STDOUT: %T.loc4_18.2 => constants.%B
  362. // CHECK:STDOUT: %T.patt.loc4_18.2 => constants.%B
  363. // CHECK:STDOUT:
  364. // CHECK:STDOUT: !definition:
  365. // CHECK:STDOUT: %Action.type => constants.%Action.type.cb0
  366. // CHECK:STDOUT: %Self.2 => constants.%Self
  367. // CHECK:STDOUT: %Op.type => constants.%Op.type.54d
  368. // CHECK:STDOUT: %Op => constants.%Op.dba
  369. // CHECK:STDOUT: %Action.assoc_type => constants.%Action.assoc_type.827
  370. // CHECK:STDOUT: %assoc0.loc5_22.2 => constants.%assoc0.035
  371. // CHECK:STDOUT: }
  372. // CHECK:STDOUT:
  373. // CHECK:STDOUT: specific @Op.1(constants.%B, constants.%Action.facet) {
  374. // CHECK:STDOUT: %T => constants.%B
  375. // CHECK:STDOUT: %Action.type => constants.%Action.type.cb0
  376. // CHECK:STDOUT: %Self => constants.%Action.facet
  377. // CHECK:STDOUT: %Self.as_type.loc5_15.1 => constants.%A
  378. // CHECK:STDOUT: }
  379. // CHECK:STDOUT:
  380. // CHECK:STDOUT: --- action.impl.carbon
  381. // CHECK:STDOUT:
  382. // CHECK:STDOUT: constants {
  383. // CHECK:STDOUT: %B: type = class_type @B [concrete]
  384. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  385. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  386. // CHECK:STDOUT: %Action.type.29c: type = generic_interface_type @Action [concrete]
  387. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  388. // CHECK:STDOUT: %Action.generic: %Action.type.29c = struct_value () [concrete]
  389. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  390. // CHECK:STDOUT: %Action.type.cca: type = facet_type <@Action, @Action(%T)> [symbolic]
  391. // CHECK:STDOUT: %Self: %Action.type.cca = bind_symbolic_name Self, 1 [symbolic]
  392. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  393. // CHECK:STDOUT: %Action.type.cb0: type = facet_type <@Action, @Action(%B)> [concrete]
  394. // CHECK:STDOUT: %A: type = class_type @A [concrete]
  395. // CHECK:STDOUT: %Op.type.036: type = fn_type @Op.1, @Action(%T) [symbolic]
  396. // CHECK:STDOUT: %Op.6ed: %Op.type.036 = struct_value () [symbolic]
  397. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic]
  398. // CHECK:STDOUT: %Action.assoc_type.8f9: type = assoc_entity_type %Action.type.cca [symbolic]
  399. // CHECK:STDOUT: %assoc0.905ab9.1: %Action.assoc_type.8f9 = assoc_entity element0, imports.%Main.import_ref.0e3753.1 [symbolic]
  400. // CHECK:STDOUT: %Op.type.54d: type = fn_type @Op.1, @Action(%B) [concrete]
  401. // CHECK:STDOUT: %Op.dba: %Op.type.54d = struct_value () [concrete]
  402. // CHECK:STDOUT: %Action.assoc_type.827: type = assoc_entity_type %Action.type.cb0 [concrete]
  403. // CHECK:STDOUT: %assoc0.4cc: %Action.assoc_type.827 = assoc_entity element0, imports.%Main.import_ref.1f6 [concrete]
  404. // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
  405. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  406. // CHECK:STDOUT: %assoc0.905ab9.2: %Action.assoc_type.8f9 = assoc_entity element0, imports.%Main.import_ref.0e3753.2 [symbolic]
  407. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (imports.%Main.import_ref.d0b) [concrete]
  408. // CHECK:STDOUT: %Action.facet: %Action.type.cb0 = facet_value %A, (%impl_witness) [concrete]
  409. // CHECK:STDOUT: %.584: type = fn_type_with_self_type %Op.type.54d, %Action.facet [concrete]
  410. // CHECK:STDOUT: %Op.type.4b4: type = fn_type @Op.2 [concrete]
  411. // CHECK:STDOUT: %Op.40d: %Op.type.4b4 = struct_value () [concrete]
  412. // CHECK:STDOUT: }
  413. // CHECK:STDOUT:
  414. // CHECK:STDOUT: imports {
  415. // CHECK:STDOUT: %Main.Action: %Action.type.29c = import_ref Main//action, Action, loaded [concrete = constants.%Action.generic]
  416. // CHECK:STDOUT: %Main.A: type = import_ref Main//action, A, loaded [concrete = constants.%A]
  417. // CHECK:STDOUT: %Main.B: type = import_ref Main//action, B, loaded [concrete = constants.%B]
  418. // CHECK:STDOUT: %Main.C = import_ref Main//action, C, unloaded
  419. // CHECK:STDOUT: %Main.F = import_ref Main//action, F, unloaded
  420. // CHECK:STDOUT: %Main.import_ref.8f24d3.1: <witness> = import_ref Main//action, loc9_10, loaded [concrete = constants.%complete_type]
  421. // CHECK:STDOUT: %Main.import_ref.54a = import_ref Main//action, inst58 [no loc], unloaded
  422. // CHECK:STDOUT: %Main.import_ref.5ab3ec.1: type = import_ref Main//action, loc4_18, loaded [symbolic = @Action.%T (constants.%T)]
  423. // CHECK:STDOUT: %Main.import_ref.ddc = import_ref Main//action, inst24 [no loc], unloaded
  424. // CHECK:STDOUT: %Main.import_ref.318: @Action.%Action.assoc_type (%Action.assoc_type.8f9) = import_ref Main//action, loc5_22, loaded [symbolic = @Action.%assoc0 (constants.%assoc0.905ab9.2)]
  425. // CHECK:STDOUT: %Main.Op = import_ref Main//action, Op, unloaded
  426. // CHECK:STDOUT: %Main.import_ref.71c: <witness> = import_ref Main//action, loc12_21, loaded [concrete = constants.%impl_witness]
  427. // CHECK:STDOUT: %Main.import_ref.8f24d3.2: <witness> = import_ref Main//action, loc8_10, loaded [concrete = constants.%complete_type]
  428. // CHECK:STDOUT: %Main.import_ref.da3 = import_ref Main//action, inst53 [no loc], unloaded
  429. // CHECK:STDOUT: %Main.import_ref.984: type = import_ref Main//action, loc12_6, loaded [concrete = constants.%A]
  430. // CHECK:STDOUT: %Main.import_ref.bb2: type = import_ref Main//action, loc12_19, loaded [concrete = constants.%Action.type.cb0]
  431. // CHECK:STDOUT: %Main.import_ref.7b5 = import_ref Main//action, loc13_23, unloaded
  432. // CHECK:STDOUT: %Main.import_ref.5ab3ec.2: type = import_ref Main//action, loc4_18, loaded [symbolic = @Action.%T (constants.%T)]
  433. // CHECK:STDOUT: %Main.import_ref.835: @Action.%Action.type (%Action.type.cca) = import_ref Main//action, inst24 [no loc], loaded [symbolic = @Action.%Self (constants.%Self)]
  434. // CHECK:STDOUT: %Main.import_ref.0e3753.1 = import_ref Main//action, loc5_22, unloaded
  435. // CHECK:STDOUT: }
  436. // CHECK:STDOUT:
  437. // CHECK:STDOUT: file {
  438. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  439. // CHECK:STDOUT: .Action = imports.%Main.Action
  440. // CHECK:STDOUT: .A = imports.%Main.A
  441. // CHECK:STDOUT: .B = imports.%Main.B
  442. // CHECK:STDOUT: .C = imports.%Main.C
  443. // CHECK:STDOUT: .F = imports.%Main.F
  444. // CHECK:STDOUT: .G = %G.decl
  445. // CHECK:STDOUT: }
  446. // CHECK:STDOUT: %default.import.loc2_6.1 = import <none>
  447. // CHECK:STDOUT: %default.import.loc2_6.2 = import <none>
  448. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {
  449. // CHECK:STDOUT: %a.patt: %A = binding_pattern a
  450. // CHECK:STDOUT: %a.param_patt: %A = value_param_pattern %a.patt, call_param0
  451. // CHECK:STDOUT: } {
  452. // CHECK:STDOUT: %a.param: %A = value_param call_param0
  453. // CHECK:STDOUT: %A.ref: type = name_ref A, imports.%Main.A [concrete = constants.%A]
  454. // CHECK:STDOUT: %a: %A = bind_name a, %a.param
  455. // CHECK:STDOUT: }
  456. // CHECK:STDOUT: }
  457. // CHECK:STDOUT:
  458. // CHECK:STDOUT: generic interface @Action(imports.%Main.import_ref.5ab3ec.1: type) [from "action.carbon"] {
  459. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  460. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)]
  461. // CHECK:STDOUT:
  462. // CHECK:STDOUT: !definition:
  463. // CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(%T)> [symbolic = %Action.type (constants.%Action.type.cca)]
  464. // CHECK:STDOUT: %Self: %Action.type.cca = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)]
  465. // CHECK:STDOUT: %Op.type: type = fn_type @Op.1, @Action(%T) [symbolic = %Op.type (constants.%Op.type.036)]
  466. // CHECK:STDOUT: %Op: @Action.%Op.type (%Op.type.036) = struct_value () [symbolic = %Op (constants.%Op.6ed)]
  467. // CHECK:STDOUT: %Action.assoc_type: type = assoc_entity_type @Action.%Action.type (%Action.type.cca) [symbolic = %Action.assoc_type (constants.%Action.assoc_type.8f9)]
  468. // CHECK:STDOUT: %assoc0: @Action.%Action.assoc_type (%Action.assoc_type.8f9) = assoc_entity element0, imports.%Main.import_ref.0e3753.1 [symbolic = %assoc0 (constants.%assoc0.905ab9.1)]
  469. // CHECK:STDOUT:
  470. // CHECK:STDOUT: interface {
  471. // CHECK:STDOUT: !members:
  472. // CHECK:STDOUT: .Self = imports.%Main.import_ref.ddc
  473. // CHECK:STDOUT: .Op = imports.%Main.import_ref.318
  474. // CHECK:STDOUT: witness = (imports.%Main.Op)
  475. // CHECK:STDOUT: }
  476. // CHECK:STDOUT: }
  477. // CHECK:STDOUT:
  478. // CHECK:STDOUT: impl @impl: imports.%Main.import_ref.984 as imports.%Main.import_ref.bb2 [from "action.carbon"] {
  479. // CHECK:STDOUT: !members:
  480. // CHECK:STDOUT: .Op = imports.%Main.import_ref.7b5
  481. // CHECK:STDOUT: witness = imports.%Main.import_ref.71c
  482. // CHECK:STDOUT: }
  483. // CHECK:STDOUT:
  484. // CHECK:STDOUT: class @B [from "action.carbon"] {
  485. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f24d3.1
  486. // CHECK:STDOUT:
  487. // CHECK:STDOUT: !members:
  488. // CHECK:STDOUT: .Self = imports.%Main.import_ref.54a
  489. // CHECK:STDOUT: }
  490. // CHECK:STDOUT:
  491. // CHECK:STDOUT: class @A [from "action.carbon"] {
  492. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f24d3.2
  493. // CHECK:STDOUT:
  494. // CHECK:STDOUT: !members:
  495. // CHECK:STDOUT: .Self = imports.%Main.import_ref.da3
  496. // CHECK:STDOUT: }
  497. // CHECK:STDOUT:
  498. // CHECK:STDOUT: generic fn @Op.1(imports.%Main.import_ref.5ab3ec.2: type, imports.%Main.import_ref.835: @Action.%Action.type (%Action.type.cca)) [from "action.carbon"] {
  499. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  500. // CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(%T)> [symbolic = %Action.type (constants.%Action.type.cca)]
  501. // CHECK:STDOUT: %Self: %Action.type.cca = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)]
  502. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type)]
  503. // CHECK:STDOUT:
  504. // CHECK:STDOUT: fn[%self.param_patt: @Op.1.%Self.as_type (%Self.as_type)]();
  505. // CHECK:STDOUT: }
  506. // CHECK:STDOUT:
  507. // CHECK:STDOUT: fn @G(%a.param_patt: %A) {
  508. // CHECK:STDOUT: !entry:
  509. // CHECK:STDOUT: %a.ref: %A = name_ref a, %a
  510. // CHECK:STDOUT: %Action.ref: %Action.type.29c = name_ref Action, imports.%Main.Action [concrete = constants.%Action.generic]
  511. // CHECK:STDOUT: %B.ref: type = name_ref B, imports.%Main.B [concrete = constants.%B]
  512. // CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(constants.%B)> [concrete = constants.%Action.type.cb0]
  513. // CHECK:STDOUT: %.loc4: %Action.assoc_type.827 = specific_constant imports.%Main.import_ref.318, @Action(constants.%B) [concrete = constants.%assoc0.4cc]
  514. // CHECK:STDOUT: %Op.ref: %Action.assoc_type.827 = name_ref Op, %.loc4 [concrete = constants.%assoc0.4cc]
  515. // CHECK:STDOUT: %impl.elem0: %.584 = impl_witness_access constants.%impl_witness, element0 [concrete = constants.%Op.40d]
  516. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %a.ref, %impl.elem0
  517. // CHECK:STDOUT: %Op.call: init %empty_tuple.type = call %bound_method(%a.ref)
  518. // CHECK:STDOUT: return
  519. // CHECK:STDOUT: }
  520. // CHECK:STDOUT:
  521. // CHECK:STDOUT: fn @Op.2[%self.param_patt: %A]() [from "action.carbon"];
  522. // CHECK:STDOUT:
  523. // CHECK:STDOUT: specific @Action(constants.%T) {
  524. // CHECK:STDOUT: %T => constants.%T
  525. // CHECK:STDOUT: %T.patt => constants.%T
  526. // CHECK:STDOUT: }
  527. // CHECK:STDOUT:
  528. // CHECK:STDOUT: specific @Action(constants.%B) {
  529. // CHECK:STDOUT: %T => constants.%B
  530. // CHECK:STDOUT: %T.patt => constants.%B
  531. // CHECK:STDOUT:
  532. // CHECK:STDOUT: !definition:
  533. // CHECK:STDOUT: %Action.type => constants.%Action.type.cb0
  534. // CHECK:STDOUT: %Self => constants.%Self
  535. // CHECK:STDOUT: %Op.type => constants.%Op.type.54d
  536. // CHECK:STDOUT: %Op => constants.%Op.dba
  537. // CHECK:STDOUT: %Action.assoc_type => constants.%Action.assoc_type.827
  538. // CHECK:STDOUT: %assoc0 => constants.%assoc0.4cc
  539. // CHECK:STDOUT: }
  540. // CHECK:STDOUT:
  541. // CHECK:STDOUT: specific @Action(%T) {}
  542. // CHECK:STDOUT:
  543. // CHECK:STDOUT: specific @Action(@Op.1.%T) {}
  544. // CHECK:STDOUT:
  545. // CHECK:STDOUT: specific @Op.1(constants.%T, constants.%Self) {
  546. // CHECK:STDOUT: %T => constants.%T
  547. // CHECK:STDOUT: %Action.type => constants.%Action.type.cca
  548. // CHECK:STDOUT: %Self => constants.%Self
  549. // CHECK:STDOUT: %Self.as_type => constants.%Self.as_type
  550. // CHECK:STDOUT: }
  551. // CHECK:STDOUT:
  552. // CHECK:STDOUT: --- fail_action.impl.carbon
  553. // CHECK:STDOUT:
  554. // CHECK:STDOUT: constants {
  555. // CHECK:STDOUT: %B: type = class_type @B [concrete]
  556. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  557. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  558. // CHECK:STDOUT: %Action.type.29c: type = generic_interface_type @Action [concrete]
  559. // CHECK:STDOUT: %Action.generic: %Action.type.29c = struct_value () [concrete]
  560. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  561. // CHECK:STDOUT: %Action.type.cca: type = facet_type <@Action, @Action(%T)> [symbolic]
  562. // CHECK:STDOUT: %Self: %Action.type.cca = bind_symbolic_name Self, 1 [symbolic]
  563. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  564. // CHECK:STDOUT: %Action.type.cb0: type = facet_type <@Action, @Action(%B)> [concrete]
  565. // CHECK:STDOUT: %A: type = class_type @A [concrete]
  566. // CHECK:STDOUT: %Op.type.036: type = fn_type @Op, @Action(%T) [symbolic]
  567. // CHECK:STDOUT: %Op.6ed: %Op.type.036 = struct_value () [symbolic]
  568. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic]
  569. // CHECK:STDOUT: %Action.assoc_type.8f9: type = assoc_entity_type %Action.type.cca [symbolic]
  570. // CHECK:STDOUT: %assoc0.83d: %Action.assoc_type.8f9 = assoc_entity element0, imports.%Main.import_ref.1f6 [symbolic]
  571. // CHECK:STDOUT: %Op.type.54d: type = fn_type @Op, @Action(%B) [concrete]
  572. // CHECK:STDOUT: %Op.dba: %Op.type.54d = struct_value () [concrete]
  573. // CHECK:STDOUT: %Action.assoc_type.827: type = assoc_entity_type %Action.type.cb0 [concrete]
  574. // CHECK:STDOUT: %assoc0.8f8: %Action.assoc_type.827 = assoc_entity element0, imports.%Main.import_ref.0e3753.1 [concrete]
  575. // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
  576. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  577. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  578. // CHECK:STDOUT: %Action.type.e2b: type = facet_type <@Action, @Action(%C)> [concrete]
  579. // CHECK:STDOUT: %Op.type.5ad: type = fn_type @Op, @Action(%C) [concrete]
  580. // CHECK:STDOUT: %Op.b10: %Op.type.5ad = struct_value () [concrete]
  581. // CHECK:STDOUT: %Action.assoc_type.0a7: type = assoc_entity_type %Action.type.e2b [concrete]
  582. // CHECK:STDOUT: %assoc0.55b: %Action.assoc_type.0a7 = assoc_entity element0, imports.%Main.import_ref.1f6 [concrete]
  583. // CHECK:STDOUT: %assoc0.905: %Action.assoc_type.8f9 = assoc_entity element0, imports.%Main.import_ref.0e3753.2 [symbolic]
  584. // CHECK:STDOUT: }
  585. // CHECK:STDOUT:
  586. // CHECK:STDOUT: imports {
  587. // CHECK:STDOUT: %Main.Action: %Action.type.29c = import_ref Main//action, Action, loaded [concrete = constants.%Action.generic]
  588. // CHECK:STDOUT: %Main.A: type = import_ref Main//action, A, loaded [concrete = constants.%A]
  589. // CHECK:STDOUT: %Main.B = import_ref Main//action, B, unloaded
  590. // CHECK:STDOUT: %Main.C: type = import_ref Main//action, C, loaded [concrete = constants.%C]
  591. // CHECK:STDOUT: %Main.F = import_ref Main//action, F, unloaded
  592. // CHECK:STDOUT: %Main.import_ref.8f24d3.1: <witness> = import_ref Main//action, loc9_10, loaded [concrete = constants.%complete_type]
  593. // CHECK:STDOUT: %Main.import_ref.54a = import_ref Main//action, inst58 [no loc], unloaded
  594. // CHECK:STDOUT: %Main.import_ref.5ab3ec.1: type = import_ref Main//action, loc4_18, loaded [symbolic = @Action.%T (constants.%T)]
  595. // CHECK:STDOUT: %Main.import_ref.ddc = import_ref Main//action, inst24 [no loc], unloaded
  596. // CHECK:STDOUT: %Main.import_ref.318: @Action.%Action.assoc_type (%Action.assoc_type.8f9) = import_ref Main//action, loc5_22, loaded [symbolic = @Action.%assoc0 (constants.%assoc0.905)]
  597. // CHECK:STDOUT: %Main.Op = import_ref Main//action, Op, unloaded
  598. // CHECK:STDOUT: %Main.import_ref.7a1 = import_ref Main//action, loc12_21, unloaded
  599. // CHECK:STDOUT: %Main.import_ref.8f24d3.2: <witness> = import_ref Main//action, loc8_10, loaded [concrete = constants.%complete_type]
  600. // CHECK:STDOUT: %Main.import_ref.da3 = import_ref Main//action, inst53 [no loc], unloaded
  601. // CHECK:STDOUT: %Main.import_ref.984: type = import_ref Main//action, loc12_6, loaded [concrete = constants.%A]
  602. // CHECK:STDOUT: %Main.import_ref.bb2: type = import_ref Main//action, loc12_19, loaded [concrete = constants.%Action.type.cb0]
  603. // CHECK:STDOUT: %Main.import_ref.7b5 = import_ref Main//action, loc13_23, unloaded
  604. // CHECK:STDOUT: %Main.import_ref.5ab3ec.2: type = import_ref Main//action, loc4_18, loaded [symbolic = @Action.%T (constants.%T)]
  605. // CHECK:STDOUT: %Main.import_ref.835: @Action.%Action.type (%Action.type.cca) = import_ref Main//action, inst24 [no loc], loaded [symbolic = @Action.%Self (constants.%Self)]
  606. // CHECK:STDOUT: %Main.import_ref.1f6: @Action.%Op.type (%Op.type.036) = import_ref Main//action, loc5_22, loaded [symbolic = @Action.%Op (constants.%Op.6ed)]
  607. // CHECK:STDOUT: %Main.import_ref.8f24d3.3: <witness> = import_ref Main//action, loc10_10, loaded [concrete = constants.%complete_type]
  608. // CHECK:STDOUT: %Main.import_ref.2c4 = import_ref Main//action, inst61 [no loc], unloaded
  609. // CHECK:STDOUT: }
  610. // CHECK:STDOUT:
  611. // CHECK:STDOUT: file {
  612. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  613. // CHECK:STDOUT: .Action = imports.%Main.Action
  614. // CHECK:STDOUT: .A = imports.%Main.A
  615. // CHECK:STDOUT: .B = imports.%Main.B
  616. // CHECK:STDOUT: .C = imports.%Main.C
  617. // CHECK:STDOUT: .F = imports.%Main.F
  618. // CHECK:STDOUT: .G = %G.decl
  619. // CHECK:STDOUT: }
  620. // CHECK:STDOUT: %default.import.loc2_6.1 = import <none>
  621. // CHECK:STDOUT: %default.import.loc2_6.2 = import <none>
  622. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {
  623. // CHECK:STDOUT: %a.patt: %A = binding_pattern a
  624. // CHECK:STDOUT: %a.param_patt: %A = value_param_pattern %a.patt, call_param0
  625. // CHECK:STDOUT: } {
  626. // CHECK:STDOUT: %a.param: %A = value_param call_param0
  627. // CHECK:STDOUT: %A.ref: type = name_ref A, imports.%Main.A [concrete = constants.%A]
  628. // CHECK:STDOUT: %a: %A = bind_name a, %a.param
  629. // CHECK:STDOUT: }
  630. // CHECK:STDOUT: }
  631. // CHECK:STDOUT:
  632. // CHECK:STDOUT: generic interface @Action(imports.%Main.import_ref.5ab3ec.1: type) [from "action.carbon"] {
  633. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  634. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)]
  635. // CHECK:STDOUT:
  636. // CHECK:STDOUT: !definition:
  637. // CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(%T)> [symbolic = %Action.type (constants.%Action.type.cca)]
  638. // CHECK:STDOUT: %Self: %Action.type.cca = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)]
  639. // CHECK:STDOUT: %Op.type: type = fn_type @Op, @Action(%T) [symbolic = %Op.type (constants.%Op.type.036)]
  640. // CHECK:STDOUT: %Op: @Action.%Op.type (%Op.type.036) = struct_value () [symbolic = %Op (constants.%Op.6ed)]
  641. // CHECK:STDOUT: %Action.assoc_type: type = assoc_entity_type @Action.%Action.type (%Action.type.cca) [symbolic = %Action.assoc_type (constants.%Action.assoc_type.8f9)]
  642. // CHECK:STDOUT: %assoc0: @Action.%Action.assoc_type (%Action.assoc_type.8f9) = assoc_entity element0, imports.%Main.import_ref.1f6 [symbolic = %assoc0 (constants.%assoc0.83d)]
  643. // CHECK:STDOUT:
  644. // CHECK:STDOUT: interface {
  645. // CHECK:STDOUT: !members:
  646. // CHECK:STDOUT: .Self = imports.%Main.import_ref.ddc
  647. // CHECK:STDOUT: .Op = imports.%Main.import_ref.318
  648. // CHECK:STDOUT: witness = (imports.%Main.Op)
  649. // CHECK:STDOUT: }
  650. // CHECK:STDOUT: }
  651. // CHECK:STDOUT:
  652. // CHECK:STDOUT: impl @impl: imports.%Main.import_ref.984 as imports.%Main.import_ref.bb2 [from "action.carbon"] {
  653. // CHECK:STDOUT: !members:
  654. // CHECK:STDOUT: .Op = imports.%Main.import_ref.7b5
  655. // CHECK:STDOUT: witness = imports.%Main.import_ref.7a1
  656. // CHECK:STDOUT: }
  657. // CHECK:STDOUT:
  658. // CHECK:STDOUT: class @B [from "action.carbon"] {
  659. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f24d3.1
  660. // CHECK:STDOUT:
  661. // CHECK:STDOUT: !members:
  662. // CHECK:STDOUT: .Self = imports.%Main.import_ref.54a
  663. // CHECK:STDOUT: }
  664. // CHECK:STDOUT:
  665. // CHECK:STDOUT: class @A [from "action.carbon"] {
  666. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f24d3.2
  667. // CHECK:STDOUT:
  668. // CHECK:STDOUT: !members:
  669. // CHECK:STDOUT: .Self = imports.%Main.import_ref.da3
  670. // CHECK:STDOUT: }
  671. // CHECK:STDOUT:
  672. // CHECK:STDOUT: class @C [from "action.carbon"] {
  673. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f24d3.3
  674. // CHECK:STDOUT:
  675. // CHECK:STDOUT: !members:
  676. // CHECK:STDOUT: .Self = imports.%Main.import_ref.2c4
  677. // CHECK:STDOUT: }
  678. // CHECK:STDOUT:
  679. // CHECK:STDOUT: generic fn @Op(imports.%Main.import_ref.5ab3ec.2: type, imports.%Main.import_ref.835: @Action.%Action.type (%Action.type.cca)) [from "action.carbon"] {
  680. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  681. // CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(%T)> [symbolic = %Action.type (constants.%Action.type.cca)]
  682. // CHECK:STDOUT: %Self: %Action.type.cca = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)]
  683. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type)]
  684. // CHECK:STDOUT:
  685. // CHECK:STDOUT: fn[%self.param_patt: @Op.%Self.as_type (%Self.as_type)]();
  686. // CHECK:STDOUT: }
  687. // CHECK:STDOUT:
  688. // CHECK:STDOUT: fn @G(%a.param_patt: %A) {
  689. // CHECK:STDOUT: !entry:
  690. // CHECK:STDOUT: %a.ref: %A = name_ref a, %a
  691. // CHECK:STDOUT: %Action.ref: %Action.type.29c = name_ref Action, imports.%Main.Action [concrete = constants.%Action.generic]
  692. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C]
  693. // CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(constants.%C)> [concrete = constants.%Action.type.e2b]
  694. // CHECK:STDOUT: %.loc8: %Action.assoc_type.0a7 = specific_constant imports.%Main.import_ref.318, @Action(constants.%C) [concrete = constants.%assoc0.55b]
  695. // CHECK:STDOUT: %Op.ref: %Action.assoc_type.0a7 = name_ref Op, %.loc8 [concrete = constants.%assoc0.55b]
  696. // CHECK:STDOUT: return
  697. // CHECK:STDOUT: }
  698. // CHECK:STDOUT:
  699. // CHECK:STDOUT: specific @Action(constants.%T) {
  700. // CHECK:STDOUT: %T => constants.%T
  701. // CHECK:STDOUT: %T.patt => constants.%T
  702. // CHECK:STDOUT: }
  703. // CHECK:STDOUT:
  704. // CHECK:STDOUT: specific @Action(constants.%B) {
  705. // CHECK:STDOUT: %T => constants.%B
  706. // CHECK:STDOUT: %T.patt => constants.%B
  707. // CHECK:STDOUT:
  708. // CHECK:STDOUT: !definition:
  709. // CHECK:STDOUT: %Action.type => constants.%Action.type.cb0
  710. // CHECK:STDOUT: %Self => constants.%Self
  711. // CHECK:STDOUT: %Op.type => constants.%Op.type.54d
  712. // CHECK:STDOUT: %Op => constants.%Op.dba
  713. // CHECK:STDOUT: %Action.assoc_type => constants.%Action.assoc_type.827
  714. // CHECK:STDOUT: %assoc0 => constants.%assoc0.8f8
  715. // CHECK:STDOUT: }
  716. // CHECK:STDOUT:
  717. // CHECK:STDOUT: specific @Action(%T) {}
  718. // CHECK:STDOUT:
  719. // CHECK:STDOUT: specific @Action(@Op.%T) {}
  720. // CHECK:STDOUT:
  721. // CHECK:STDOUT: specific @Op(constants.%T, constants.%Self) {
  722. // CHECK:STDOUT: %T => constants.%T
  723. // CHECK:STDOUT: %Action.type => constants.%Action.type.cca
  724. // CHECK:STDOUT: %Self => constants.%Self
  725. // CHECK:STDOUT: %Self.as_type => constants.%Self.as_type
  726. // CHECK:STDOUT: }
  727. // CHECK:STDOUT:
  728. // CHECK:STDOUT: specific @Action(constants.%C) {
  729. // CHECK:STDOUT: %T => constants.%C
  730. // CHECK:STDOUT: %T.patt => constants.%C
  731. // CHECK:STDOUT:
  732. // CHECK:STDOUT: !definition:
  733. // CHECK:STDOUT: %Action.type => constants.%Action.type.e2b
  734. // CHECK:STDOUT: %Self => constants.%Self
  735. // CHECK:STDOUT: %Op.type => constants.%Op.type.5ad
  736. // CHECK:STDOUT: %Op => constants.%Op.b10
  737. // CHECK:STDOUT: %Action.assoc_type => constants.%Action.assoc_type.0a7
  738. // CHECK:STDOUT: %assoc0 => constants.%assoc0.55b
  739. // CHECK:STDOUT: }
  740. // CHECK:STDOUT:
  741. // CHECK:STDOUT: --- factory.carbon
  742. // CHECK:STDOUT:
  743. // CHECK:STDOUT: constants {
  744. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  745. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  746. // CHECK:STDOUT: %Factory.type.1a8: type = generic_interface_type @Factory [concrete]
  747. // CHECK:STDOUT: %Factory.generic: %Factory.type.1a8 = struct_value () [concrete]
  748. // CHECK:STDOUT: %Factory.type.c96: type = facet_type <@Factory, @Factory(%T)> [symbolic]
  749. // CHECK:STDOUT: %Self: %Factory.type.c96 = bind_symbolic_name Self, 1 [symbolic]
  750. // CHECK:STDOUT: %Make.type.598: type = fn_type @Make.1, @Factory(%T) [symbolic]
  751. // CHECK:STDOUT: %Make.737: %Make.type.598 = struct_value () [symbolic]
  752. // CHECK:STDOUT: %Factory.assoc_type.ca7: type = assoc_entity_type %Factory.type.c96 [symbolic]
  753. // CHECK:STDOUT: %assoc0.d7a: %Factory.assoc_type.ca7 = assoc_entity element0, @Factory.%Make.decl [symbolic]
  754. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic]
  755. // CHECK:STDOUT: %Method.type.7ee: type = fn_type @Method.1, @Factory(%T) [symbolic]
  756. // CHECK:STDOUT: %Method.a71: %Method.type.7ee = struct_value () [symbolic]
  757. // CHECK:STDOUT: %assoc1.157: %Factory.assoc_type.ca7 = assoc_entity element1, @Factory.%Method.decl [symbolic]
  758. // CHECK:STDOUT: %A: type = class_type @A [concrete]
  759. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  760. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  761. // CHECK:STDOUT: %B: type = class_type @B [concrete]
  762. // CHECK:STDOUT: %Factory.type.a5d: type = facet_type <@Factory, @Factory(%B)> [concrete]
  763. // CHECK:STDOUT: %Make.type.c59: type = fn_type @Make.1, @Factory(%B) [concrete]
  764. // CHECK:STDOUT: %Make.efe: %Make.type.c59 = struct_value () [concrete]
  765. // CHECK:STDOUT: %Factory.assoc_type.668: type = assoc_entity_type %Factory.type.a5d [concrete]
  766. // CHECK:STDOUT: %assoc0.40c: %Factory.assoc_type.668 = assoc_entity element0, @Factory.%Make.decl [concrete]
  767. // CHECK:STDOUT: %Method.type.117: type = fn_type @Method.1, @Factory(%B) [concrete]
  768. // CHECK:STDOUT: %Method.ea9: %Method.type.117 = struct_value () [concrete]
  769. // CHECK:STDOUT: %assoc1.523: %Factory.assoc_type.668 = assoc_entity element1, @Factory.%Method.decl [concrete]
  770. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (@impl.%Make.decl, @impl.%Method.decl) [concrete]
  771. // CHECK:STDOUT: %Make.type.ec4: type = fn_type @Make.2 [concrete]
  772. // CHECK:STDOUT: %Make.377: %Make.type.ec4 = struct_value () [concrete]
  773. // CHECK:STDOUT: %Method.type.af5: type = fn_type @Method.2 [concrete]
  774. // CHECK:STDOUT: %Method.3d4: %Method.type.af5 = struct_value () [concrete]
  775. // CHECK:STDOUT: %Factory.facet: %Factory.type.a5d = facet_value %A, (%impl_witness) [concrete]
  776. // CHECK:STDOUT: }
  777. // CHECK:STDOUT:
  778. // CHECK:STDOUT: file {
  779. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  780. // CHECK:STDOUT: .Factory = %Factory.decl
  781. // CHECK:STDOUT: .A = %A.decl
  782. // CHECK:STDOUT: .B = %B.decl
  783. // CHECK:STDOUT: }
  784. // CHECK:STDOUT: %Factory.decl: %Factory.type.1a8 = interface_decl @Factory [concrete = constants.%Factory.generic] {
  785. // CHECK:STDOUT: %T.patt.loc4_19.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_19.2 (constants.%T.patt)]
  786. // CHECK:STDOUT: } {
  787. // CHECK:STDOUT: %T.loc4_19.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_19.2 (constants.%T)]
  788. // CHECK:STDOUT: }
  789. // CHECK:STDOUT: %A.decl: type = class_decl @A [concrete = constants.%A] {} {}
  790. // CHECK:STDOUT: %B.decl: type = class_decl @B [concrete = constants.%B] {} {}
  791. // CHECK:STDOUT: impl_decl @impl [concrete] {} {
  792. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A]
  793. // CHECK:STDOUT: %Factory.ref: %Factory.type.1a8 = name_ref Factory, file.%Factory.decl [concrete = constants.%Factory.generic]
  794. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B]
  795. // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(constants.%B)> [concrete = constants.%Factory.type.a5d]
  796. // CHECK:STDOUT: }
  797. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (@impl.%Make.decl, @impl.%Method.decl) [concrete = constants.%impl_witness]
  798. // CHECK:STDOUT: }
  799. // CHECK:STDOUT:
  800. // CHECK:STDOUT: generic interface @Factory(%T.loc4_19.1: type) {
  801. // CHECK:STDOUT: %T.loc4_19.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_19.2 (constants.%T)]
  802. // CHECK:STDOUT: %T.patt.loc4_19.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_19.2 (constants.%T.patt)]
  803. // CHECK:STDOUT:
  804. // CHECK:STDOUT: !definition:
  805. // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(%T.loc4_19.2)> [symbolic = %Factory.type (constants.%Factory.type.c96)]
  806. // CHECK:STDOUT: %Self.2: %Factory.type.c96 = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)]
  807. // CHECK:STDOUT: %Make.type: type = fn_type @Make.1, @Factory(%T.loc4_19.2) [symbolic = %Make.type (constants.%Make.type.598)]
  808. // CHECK:STDOUT: %Make: @Factory.%Make.type (%Make.type.598) = struct_value () [symbolic = %Make (constants.%Make.737)]
  809. // CHECK:STDOUT: %Factory.assoc_type: type = assoc_entity_type @Factory.%Factory.type (%Factory.type.c96) [symbolic = %Factory.assoc_type (constants.%Factory.assoc_type.ca7)]
  810. // CHECK:STDOUT: %assoc0.loc6_17.2: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = assoc_entity element0, %Make.decl [symbolic = %assoc0.loc6_17.2 (constants.%assoc0.d7a)]
  811. // CHECK:STDOUT: %Method.type: type = fn_type @Method.1, @Factory(%T.loc4_19.2) [symbolic = %Method.type (constants.%Method.type.7ee)]
  812. // CHECK:STDOUT: %Method: @Factory.%Method.type (%Method.type.7ee) = struct_value () [symbolic = %Method (constants.%Method.a71)]
  813. // CHECK:STDOUT: %assoc1.loc8_31.2: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = assoc_entity element1, %Method.decl [symbolic = %assoc1.loc8_31.2 (constants.%assoc1.157)]
  814. // CHECK:STDOUT:
  815. // CHECK:STDOUT: interface {
  816. // CHECK:STDOUT: %Self.1: @Factory.%Factory.type (%Factory.type.c96) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)]
  817. // CHECK:STDOUT: %Make.decl: @Factory.%Make.type (%Make.type.598) = fn_decl @Make.1 [symbolic = @Factory.%Make (constants.%Make.737)] {
  818. // CHECK:STDOUT: %return.patt: @Make.1.%T (%T) = return_slot_pattern
  819. // CHECK:STDOUT: %return.param_patt: @Make.1.%T (%T) = out_param_pattern %return.patt, call_param0
  820. // CHECK:STDOUT: } {
  821. // CHECK:STDOUT: %T.ref: type = name_ref T, @Factory.%T.loc4_19.1 [symbolic = %T (constants.%T)]
  822. // CHECK:STDOUT: %return.param: ref @Make.1.%T (%T) = out_param call_param0
  823. // CHECK:STDOUT: %return: ref @Make.1.%T (%T) = return_slot %return.param
  824. // CHECK:STDOUT: }
  825. // CHECK:STDOUT: %assoc0.loc6_17.1: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = assoc_entity element0, %Make.decl [symbolic = %assoc0.loc6_17.2 (constants.%assoc0.d7a)]
  826. // CHECK:STDOUT: %Method.decl: @Factory.%Method.type (%Method.type.7ee) = fn_decl @Method.1 [symbolic = @Factory.%Method (constants.%Method.a71)] {
  827. // CHECK:STDOUT: %self.patt: @Method.1.%Self.as_type.loc8_19.1 (%Self.as_type) = binding_pattern self
  828. // CHECK:STDOUT: %self.param_patt: @Method.1.%Self.as_type.loc8_19.1 (%Self.as_type) = value_param_pattern %self.patt, call_param0
  829. // CHECK:STDOUT: %return.patt: @Method.1.%T (%T) = return_slot_pattern
  830. // CHECK:STDOUT: %return.param_patt: @Method.1.%T (%T) = out_param_pattern %return.patt, call_param1
  831. // CHECK:STDOUT: } {
  832. // CHECK:STDOUT: %T.ref: type = name_ref T, @Factory.%T.loc4_19.1 [symbolic = %T (constants.%T)]
  833. // CHECK:STDOUT: %self.param: @Method.1.%Self.as_type.loc8_19.1 (%Self.as_type) = value_param call_param0
  834. // CHECK:STDOUT: %.loc8_19.1: type = splice_block %.loc8_19.3 [symbolic = %Self.as_type.loc8_19.1 (constants.%Self.as_type)] {
  835. // CHECK:STDOUT: %.loc8_19.2: @Method.1.%Factory.type (%Factory.type.c96) = specific_constant @Factory.%Self.1, @Factory(constants.%T) [symbolic = %Self (constants.%Self)]
  836. // CHECK:STDOUT: %Self.ref: @Method.1.%Factory.type (%Factory.type.c96) = name_ref Self, %.loc8_19.2 [symbolic = %Self (constants.%Self)]
  837. // CHECK:STDOUT: %Self.as_type.loc8_19.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc8_19.1 (constants.%Self.as_type)]
  838. // CHECK:STDOUT: %.loc8_19.3: type = converted %Self.ref, %Self.as_type.loc8_19.2 [symbolic = %Self.as_type.loc8_19.1 (constants.%Self.as_type)]
  839. // CHECK:STDOUT: }
  840. // CHECK:STDOUT: %self: @Method.1.%Self.as_type.loc8_19.1 (%Self.as_type) = bind_name self, %self.param
  841. // CHECK:STDOUT: %return.param: ref @Method.1.%T (%T) = out_param call_param1
  842. // CHECK:STDOUT: %return: ref @Method.1.%T (%T) = return_slot %return.param
  843. // CHECK:STDOUT: }
  844. // CHECK:STDOUT: %assoc1.loc8_31.1: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = assoc_entity element1, %Method.decl [symbolic = %assoc1.loc8_31.2 (constants.%assoc1.157)]
  845. // CHECK:STDOUT:
  846. // CHECK:STDOUT: !members:
  847. // CHECK:STDOUT: .Self = %Self.1
  848. // CHECK:STDOUT: .T = <poisoned>
  849. // CHECK:STDOUT: .Make = %assoc0.loc6_17.1
  850. // CHECK:STDOUT: .Method = %assoc1.loc8_31.1
  851. // CHECK:STDOUT: witness = (%Make.decl, %Method.decl)
  852. // CHECK:STDOUT: }
  853. // CHECK:STDOUT: }
  854. // CHECK:STDOUT:
  855. // CHECK:STDOUT: impl @impl: %A.ref as %Factory.type {
  856. // CHECK:STDOUT: %Make.decl: %Make.type.ec4 = fn_decl @Make.2 [concrete = constants.%Make.377] {
  857. // CHECK:STDOUT: %return.patt: %B = return_slot_pattern
  858. // CHECK:STDOUT: %return.param_patt: %B = out_param_pattern %return.patt, call_param0
  859. // CHECK:STDOUT: } {
  860. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B]
  861. // CHECK:STDOUT: %return.param: ref %B = out_param call_param0
  862. // CHECK:STDOUT: %return: ref %B = return_slot %return.param
  863. // CHECK:STDOUT: }
  864. // CHECK:STDOUT: %Method.decl: %Method.type.af5 = fn_decl @Method.2 [concrete = constants.%Method.3d4] {
  865. // CHECK:STDOUT: %self.patt: %A = binding_pattern self
  866. // CHECK:STDOUT: %self.param_patt: %A = value_param_pattern %self.patt, call_param0
  867. // CHECK:STDOUT: %return.patt: %B = return_slot_pattern
  868. // CHECK:STDOUT: %return.param_patt: %B = out_param_pattern %return.patt, call_param1
  869. // CHECK:STDOUT: } {
  870. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B]
  871. // CHECK:STDOUT: %self.param: %A = value_param call_param0
  872. // CHECK:STDOUT: %Self.ref: type = name_ref Self, @impl.%A.ref [concrete = constants.%A]
  873. // CHECK:STDOUT: %self: %A = bind_name self, %self.param
  874. // CHECK:STDOUT: %return.param: ref %B = out_param call_param1
  875. // CHECK:STDOUT: %return: ref %B = return_slot %return.param
  876. // CHECK:STDOUT: }
  877. // CHECK:STDOUT:
  878. // CHECK:STDOUT: !members:
  879. // CHECK:STDOUT: .B = <poisoned>
  880. // CHECK:STDOUT: .Make = %Make.decl
  881. // CHECK:STDOUT: .Method = %Method.decl
  882. // CHECK:STDOUT: witness = file.%impl_witness
  883. // CHECK:STDOUT: }
  884. // CHECK:STDOUT:
  885. // CHECK:STDOUT: class @A {
  886. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  887. // CHECK:STDOUT: complete_type_witness = %complete_type
  888. // CHECK:STDOUT:
  889. // CHECK:STDOUT: !members:
  890. // CHECK:STDOUT: .Self = constants.%A
  891. // CHECK:STDOUT: }
  892. // CHECK:STDOUT:
  893. // CHECK:STDOUT: class @B {
  894. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  895. // CHECK:STDOUT: complete_type_witness = %complete_type
  896. // CHECK:STDOUT:
  897. // CHECK:STDOUT: !members:
  898. // CHECK:STDOUT: .Self = constants.%B
  899. // CHECK:STDOUT: }
  900. // CHECK:STDOUT:
  901. // CHECK:STDOUT: generic fn @Make.1(@Factory.%T.loc4_19.1: type, @Factory.%Self.1: @Factory.%Factory.type (%Factory.type.c96)) {
  902. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  903. // CHECK:STDOUT:
  904. // CHECK:STDOUT: fn() -> @Make.1.%T (%T);
  905. // CHECK:STDOUT: }
  906. // CHECK:STDOUT:
  907. // CHECK:STDOUT: generic fn @Method.1(@Factory.%T.loc4_19.1: type, @Factory.%Self.1: @Factory.%Factory.type (%Factory.type.c96)) {
  908. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  909. // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(%T)> [symbolic = %Factory.type (constants.%Factory.type.c96)]
  910. // CHECK:STDOUT: %Self: %Factory.type.c96 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)]
  911. // CHECK:STDOUT: %Self.as_type.loc8_19.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc8_19.1 (constants.%Self.as_type)]
  912. // CHECK:STDOUT:
  913. // CHECK:STDOUT: fn[%self.param_patt: @Method.1.%Self.as_type.loc8_19.1 (%Self.as_type)]() -> @Method.1.%T (%T);
  914. // CHECK:STDOUT: }
  915. // CHECK:STDOUT:
  916. // CHECK:STDOUT: fn @Make.2() -> %B;
  917. // CHECK:STDOUT:
  918. // CHECK:STDOUT: fn @Method.2[%self.param_patt: %A]() -> %B;
  919. // CHECK:STDOUT:
  920. // CHECK:STDOUT: specific @Factory(constants.%T) {
  921. // CHECK:STDOUT: %T.loc4_19.2 => constants.%T
  922. // CHECK:STDOUT: %T.patt.loc4_19.2 => constants.%T
  923. // CHECK:STDOUT: }
  924. // CHECK:STDOUT:
  925. // CHECK:STDOUT: specific @Make.1(constants.%T, constants.%Self) {
  926. // CHECK:STDOUT: %T => constants.%T
  927. // CHECK:STDOUT: }
  928. // CHECK:STDOUT:
  929. // CHECK:STDOUT: specific @Method.1(constants.%T, constants.%Self) {
  930. // CHECK:STDOUT: %T => constants.%T
  931. // CHECK:STDOUT: %Factory.type => constants.%Factory.type.c96
  932. // CHECK:STDOUT: %Self => constants.%Self
  933. // CHECK:STDOUT: %Self.as_type.loc8_19.1 => constants.%Self.as_type
  934. // CHECK:STDOUT: }
  935. // CHECK:STDOUT:
  936. // CHECK:STDOUT: specific @Factory(@Method.1.%T) {}
  937. // CHECK:STDOUT:
  938. // CHECK:STDOUT: specific @Factory(%T.loc4_19.2) {}
  939. // CHECK:STDOUT:
  940. // CHECK:STDOUT: specific @Factory(constants.%B) {
  941. // CHECK:STDOUT: %T.loc4_19.2 => constants.%B
  942. // CHECK:STDOUT: %T.patt.loc4_19.2 => constants.%B
  943. // CHECK:STDOUT:
  944. // CHECK:STDOUT: !definition:
  945. // CHECK:STDOUT: %Factory.type => constants.%Factory.type.a5d
  946. // CHECK:STDOUT: %Self.2 => constants.%Self
  947. // CHECK:STDOUT: %Make.type => constants.%Make.type.c59
  948. // CHECK:STDOUT: %Make => constants.%Make.efe
  949. // CHECK:STDOUT: %Factory.assoc_type => constants.%Factory.assoc_type.668
  950. // CHECK:STDOUT: %assoc0.loc6_17.2 => constants.%assoc0.40c
  951. // CHECK:STDOUT: %Method.type => constants.%Method.type.117
  952. // CHECK:STDOUT: %Method => constants.%Method.ea9
  953. // CHECK:STDOUT: %assoc1.loc8_31.2 => constants.%assoc1.523
  954. // CHECK:STDOUT: }
  955. // CHECK:STDOUT:
  956. // CHECK:STDOUT: specific @Make.1(constants.%B, constants.%Factory.facet) {
  957. // CHECK:STDOUT: %T => constants.%B
  958. // CHECK:STDOUT: }
  959. // CHECK:STDOUT:
  960. // CHECK:STDOUT: specific @Method.1(constants.%B, constants.%Factory.facet) {
  961. // CHECK:STDOUT: %T => constants.%B
  962. // CHECK:STDOUT: %Factory.type => constants.%Factory.type.a5d
  963. // CHECK:STDOUT: %Self => constants.%Factory.facet
  964. // CHECK:STDOUT: %Self.as_type.loc8_19.1 => constants.%A
  965. // CHECK:STDOUT: }
  966. // CHECK:STDOUT:
  967. // CHECK:STDOUT: --- factory.impl.carbon
  968. // CHECK:STDOUT:
  969. // CHECK:STDOUT: constants {
  970. // CHECK:STDOUT: %B: type = class_type @B [concrete]
  971. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  972. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  973. // CHECK:STDOUT: %Factory.type.1a8: type = generic_interface_type @Factory [concrete]
  974. // CHECK:STDOUT: %Factory.generic: %Factory.type.1a8 = struct_value () [concrete]
  975. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  976. // CHECK:STDOUT: %Factory.type.c96: type = facet_type <@Factory, @Factory(%T)> [symbolic]
  977. // CHECK:STDOUT: %Self: %Factory.type.c96 = bind_symbolic_name Self, 1 [symbolic]
  978. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  979. // CHECK:STDOUT: %Factory.type.a5d: type = facet_type <@Factory, @Factory(%B)> [concrete]
  980. // CHECK:STDOUT: %A: type = class_type @A [concrete]
  981. // CHECK:STDOUT: %Make.type.598: type = fn_type @Make.1, @Factory(%T) [symbolic]
  982. // CHECK:STDOUT: %Make.737: %Make.type.598 = struct_value () [symbolic]
  983. // CHECK:STDOUT: %Factory.assoc_type.ca7: type = assoc_entity_type %Factory.type.c96 [symbolic]
  984. // CHECK:STDOUT: %assoc0.35472f.1: %Factory.assoc_type.ca7 = assoc_entity element0, imports.%Main.import_ref.21018a.1 [symbolic]
  985. // CHECK:STDOUT: %Method.type.7ee: type = fn_type @Method.1, @Factory(%T) [symbolic]
  986. // CHECK:STDOUT: %Method.a71: %Method.type.7ee = struct_value () [symbolic]
  987. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic]
  988. // CHECK:STDOUT: %assoc1.1fdf32.1: %Factory.assoc_type.ca7 = assoc_entity element1, imports.%Main.import_ref.46fc3c.1 [symbolic]
  989. // CHECK:STDOUT: %Make.type.c59: type = fn_type @Make.1, @Factory(%B) [concrete]
  990. // CHECK:STDOUT: %Make.efe: %Make.type.c59 = struct_value () [concrete]
  991. // CHECK:STDOUT: %Factory.assoc_type.668: type = assoc_entity_type %Factory.type.a5d [concrete]
  992. // CHECK:STDOUT: %assoc0.503: %Factory.assoc_type.668 = assoc_entity element0, imports.%Main.import_ref.1aa [concrete]
  993. // CHECK:STDOUT: %Method.type.117: type = fn_type @Method.1, @Factory(%B) [concrete]
  994. // CHECK:STDOUT: %Method.ea9: %Method.type.117 = struct_value () [concrete]
  995. // CHECK:STDOUT: %assoc1.51f: %Factory.assoc_type.668 = assoc_entity element1, imports.%Main.import_ref.5be [concrete]
  996. // CHECK:STDOUT: %MakeB.type: type = fn_type @MakeB [concrete]
  997. // CHECK:STDOUT: %MakeB: %MakeB.type = struct_value () [concrete]
  998. // CHECK:STDOUT: %assoc0.35472f.2: %Factory.assoc_type.ca7 = assoc_entity element0, imports.%Main.import_ref.21018a.2 [symbolic]
  999. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (imports.%Main.import_ref.9ec, imports.%Main.import_ref.7dd) [concrete]
  1000. // CHECK:STDOUT: %Factory.facet: %Factory.type.a5d = facet_value %A, (%impl_witness) [concrete]
  1001. // CHECK:STDOUT: %.b98: type = fn_type_with_self_type %Make.type.c59, %Factory.facet [concrete]
  1002. // CHECK:STDOUT: %Make.type.ec4: type = fn_type @Make.2 [concrete]
  1003. // CHECK:STDOUT: %Make.377: %Make.type.ec4 = struct_value () [concrete]
  1004. // CHECK:STDOUT: %InstanceB.type: type = fn_type @InstanceB [concrete]
  1005. // CHECK:STDOUT: %InstanceB: %InstanceB.type = struct_value () [concrete]
  1006. // CHECK:STDOUT: %assoc1.1fdf32.2: %Factory.assoc_type.ca7 = assoc_entity element1, imports.%Main.import_ref.46fc3c.2 [symbolic]
  1007. // CHECK:STDOUT: %.ac0: type = fn_type_with_self_type %Method.type.117, %Factory.facet [concrete]
  1008. // CHECK:STDOUT: %Method.type.af5: type = fn_type @Method.2 [concrete]
  1009. // CHECK:STDOUT: %Method.3d4: %Method.type.af5 = struct_value () [concrete]
  1010. // CHECK:STDOUT: }
  1011. // CHECK:STDOUT:
  1012. // CHECK:STDOUT: imports {
  1013. // CHECK:STDOUT: %Main.Factory: %Factory.type.1a8 = import_ref Main//factory, Factory, loaded [concrete = constants.%Factory.generic]
  1014. // CHECK:STDOUT: %Main.A: type = import_ref Main//factory, A, loaded [concrete = constants.%A]
  1015. // CHECK:STDOUT: %Main.B: type = import_ref Main//factory, B, loaded [concrete = constants.%B]
  1016. // CHECK:STDOUT: %Main.import_ref.8f24d3.1: <witness> = import_ref Main//factory, loc12_10, loaded [concrete = constants.%complete_type]
  1017. // CHECK:STDOUT: %Main.import_ref.54a = import_ref Main//factory, inst77 [no loc], unloaded
  1018. // CHECK:STDOUT: %Main.import_ref.5ab3ec.1: type = import_ref Main//factory, loc4_19, loaded [symbolic = @Factory.%T (constants.%T)]
  1019. // CHECK:STDOUT: %Main.import_ref.fbb = import_ref Main//factory, inst24 [no loc], unloaded
  1020. // CHECK:STDOUT: %Main.import_ref.8d5: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = import_ref Main//factory, loc6_17, loaded [symbolic = @Factory.%assoc0 (constants.%assoc0.35472f.2)]
  1021. // CHECK:STDOUT: %Main.import_ref.ff7: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = import_ref Main//factory, loc8_31, loaded [symbolic = @Factory.%assoc1 (constants.%assoc1.1fdf32.2)]
  1022. // CHECK:STDOUT: %Main.Make = import_ref Main//factory, Make, unloaded
  1023. // CHECK:STDOUT: %Main.Method = import_ref Main//factory, Method, unloaded
  1024. // CHECK:STDOUT: %Main.import_ref.f8d: <witness> = import_ref Main//factory, loc14_22, loaded [concrete = constants.%impl_witness]
  1025. // CHECK:STDOUT: %Main.import_ref.8f24d3.2: <witness> = import_ref Main//factory, loc11_10, loaded [concrete = constants.%complete_type]
  1026. // CHECK:STDOUT: %Main.import_ref.da3 = import_ref Main//factory, inst72 [no loc], unloaded
  1027. // CHECK:STDOUT: %Main.import_ref.984: type = import_ref Main//factory, loc14_6, loaded [concrete = constants.%A]
  1028. // CHECK:STDOUT: %Main.import_ref.bd2: type = import_ref Main//factory, loc14_20, loaded [concrete = constants.%Factory.type.a5d]
  1029. // CHECK:STDOUT: %Main.import_ref.a27 = import_ref Main//factory, loc15_17, unloaded
  1030. // CHECK:STDOUT: %Main.import_ref.163 = import_ref Main//factory, loc16_31, unloaded
  1031. // CHECK:STDOUT: %Main.import_ref.5ab3ec.2: type = import_ref Main//factory, loc4_19, loaded [symbolic = @Factory.%T (constants.%T)]
  1032. // CHECK:STDOUT: %Main.import_ref.91b53a.1: @Factory.%Factory.type (%Factory.type.c96) = import_ref Main//factory, inst24 [no loc], loaded [symbolic = @Factory.%Self (constants.%Self)]
  1033. // CHECK:STDOUT: %Main.import_ref.21018a.1 = import_ref Main//factory, loc6_17, unloaded
  1034. // CHECK:STDOUT: %Main.import_ref.5ab3ec.3: type = import_ref Main//factory, loc4_19, loaded [symbolic = @Factory.%T (constants.%T)]
  1035. // CHECK:STDOUT: %Main.import_ref.91b53a.2: @Factory.%Factory.type (%Factory.type.c96) = import_ref Main//factory, inst24 [no loc], loaded [symbolic = @Factory.%Self (constants.%Self)]
  1036. // CHECK:STDOUT: %Main.import_ref.46fc3c.1 = import_ref Main//factory, loc8_31, unloaded
  1037. // CHECK:STDOUT: }
  1038. // CHECK:STDOUT:
  1039. // CHECK:STDOUT: file {
  1040. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1041. // CHECK:STDOUT: .Factory = imports.%Main.Factory
  1042. // CHECK:STDOUT: .A = imports.%Main.A
  1043. // CHECK:STDOUT: .B = imports.%Main.B
  1044. // CHECK:STDOUT: .MakeB = %MakeB.decl
  1045. // CHECK:STDOUT: .InstanceB = %InstanceB.decl
  1046. // CHECK:STDOUT: }
  1047. // CHECK:STDOUT: %default.import.loc2_6.1 = import <none>
  1048. // CHECK:STDOUT: %default.import.loc2_6.2 = import <none>
  1049. // CHECK:STDOUT: %MakeB.decl: %MakeB.type = fn_decl @MakeB [concrete = constants.%MakeB] {
  1050. // CHECK:STDOUT: %return.patt: %B = return_slot_pattern
  1051. // CHECK:STDOUT: %return.param_patt: %B = out_param_pattern %return.patt, call_param0
  1052. // CHECK:STDOUT: } {
  1053. // CHECK:STDOUT: %B.ref.loc4: type = name_ref B, imports.%Main.B [concrete = constants.%B]
  1054. // CHECK:STDOUT: %return.param: ref %B = out_param call_param0
  1055. // CHECK:STDOUT: %return: ref %B = return_slot %return.param
  1056. // CHECK:STDOUT: }
  1057. // CHECK:STDOUT: %InstanceB.decl: %InstanceB.type = fn_decl @InstanceB [concrete = constants.%InstanceB] {
  1058. // CHECK:STDOUT: %a.patt: %A = binding_pattern a
  1059. // CHECK:STDOUT: %a.param_patt: %A = value_param_pattern %a.patt, call_param0
  1060. // CHECK:STDOUT: %return.patt: %B = return_slot_pattern
  1061. // CHECK:STDOUT: %return.param_patt: %B = out_param_pattern %return.patt, call_param1
  1062. // CHECK:STDOUT: } {
  1063. // CHECK:STDOUT: %B.ref.loc7: type = name_ref B, imports.%Main.B [concrete = constants.%B]
  1064. // CHECK:STDOUT: %a.param: %A = value_param call_param0
  1065. // CHECK:STDOUT: %A.ref: type = name_ref A, imports.%Main.A [concrete = constants.%A]
  1066. // CHECK:STDOUT: %a: %A = bind_name a, %a.param
  1067. // CHECK:STDOUT: %return.param: ref %B = out_param call_param1
  1068. // CHECK:STDOUT: %return: ref %B = return_slot %return.param
  1069. // CHECK:STDOUT: }
  1070. // CHECK:STDOUT: }
  1071. // CHECK:STDOUT:
  1072. // CHECK:STDOUT: generic interface @Factory(imports.%Main.import_ref.5ab3ec.1: type) [from "factory.carbon"] {
  1073. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  1074. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)]
  1075. // CHECK:STDOUT:
  1076. // CHECK:STDOUT: !definition:
  1077. // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(%T)> [symbolic = %Factory.type (constants.%Factory.type.c96)]
  1078. // CHECK:STDOUT: %Self: %Factory.type.c96 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)]
  1079. // CHECK:STDOUT: %Make.type: type = fn_type @Make.1, @Factory(%T) [symbolic = %Make.type (constants.%Make.type.598)]
  1080. // CHECK:STDOUT: %Make: @Factory.%Make.type (%Make.type.598) = struct_value () [symbolic = %Make (constants.%Make.737)]
  1081. // CHECK:STDOUT: %Factory.assoc_type: type = assoc_entity_type @Factory.%Factory.type (%Factory.type.c96) [symbolic = %Factory.assoc_type (constants.%Factory.assoc_type.ca7)]
  1082. // CHECK:STDOUT: %assoc0: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = assoc_entity element0, imports.%Main.import_ref.21018a.1 [symbolic = %assoc0 (constants.%assoc0.35472f.1)]
  1083. // CHECK:STDOUT: %Method.type: type = fn_type @Method.1, @Factory(%T) [symbolic = %Method.type (constants.%Method.type.7ee)]
  1084. // CHECK:STDOUT: %Method: @Factory.%Method.type (%Method.type.7ee) = struct_value () [symbolic = %Method (constants.%Method.a71)]
  1085. // CHECK:STDOUT: %assoc1: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = assoc_entity element1, imports.%Main.import_ref.46fc3c.1 [symbolic = %assoc1 (constants.%assoc1.1fdf32.1)]
  1086. // CHECK:STDOUT:
  1087. // CHECK:STDOUT: interface {
  1088. // CHECK:STDOUT: !members:
  1089. // CHECK:STDOUT: .Self = imports.%Main.import_ref.fbb
  1090. // CHECK:STDOUT: .Make = imports.%Main.import_ref.8d5
  1091. // CHECK:STDOUT: .Method = imports.%Main.import_ref.ff7
  1092. // CHECK:STDOUT: witness = (imports.%Main.Make, imports.%Main.Method)
  1093. // CHECK:STDOUT: }
  1094. // CHECK:STDOUT: }
  1095. // CHECK:STDOUT:
  1096. // CHECK:STDOUT: impl @impl: imports.%Main.import_ref.984 as imports.%Main.import_ref.bd2 [from "factory.carbon"] {
  1097. // CHECK:STDOUT: !members:
  1098. // CHECK:STDOUT: .Make = imports.%Main.import_ref.a27
  1099. // CHECK:STDOUT: .Method = imports.%Main.import_ref.163
  1100. // CHECK:STDOUT: witness = imports.%Main.import_ref.f8d
  1101. // CHECK:STDOUT: }
  1102. // CHECK:STDOUT:
  1103. // CHECK:STDOUT: class @B [from "factory.carbon"] {
  1104. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f24d3.1
  1105. // CHECK:STDOUT:
  1106. // CHECK:STDOUT: !members:
  1107. // CHECK:STDOUT: .Self = imports.%Main.import_ref.54a
  1108. // CHECK:STDOUT: }
  1109. // CHECK:STDOUT:
  1110. // CHECK:STDOUT: class @A [from "factory.carbon"] {
  1111. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f24d3.2
  1112. // CHECK:STDOUT:
  1113. // CHECK:STDOUT: !members:
  1114. // CHECK:STDOUT: .Self = imports.%Main.import_ref.da3
  1115. // CHECK:STDOUT: }
  1116. // CHECK:STDOUT:
  1117. // CHECK:STDOUT: generic fn @Make.1(imports.%Main.import_ref.5ab3ec.2: type, imports.%Main.import_ref.91b53a.1: @Factory.%Factory.type (%Factory.type.c96)) [from "factory.carbon"] {
  1118. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  1119. // CHECK:STDOUT:
  1120. // CHECK:STDOUT: fn() -> @Make.1.%T (%T);
  1121. // CHECK:STDOUT: }
  1122. // CHECK:STDOUT:
  1123. // CHECK:STDOUT: generic fn @Method.1(imports.%Main.import_ref.5ab3ec.3: type, imports.%Main.import_ref.91b53a.2: @Factory.%Factory.type (%Factory.type.c96)) [from "factory.carbon"] {
  1124. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  1125. // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(%T)> [symbolic = %Factory.type (constants.%Factory.type.c96)]
  1126. // CHECK:STDOUT: %Self: %Factory.type.c96 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)]
  1127. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type)]
  1128. // CHECK:STDOUT:
  1129. // CHECK:STDOUT: fn[%self.param_patt: @Method.1.%Self.as_type (%Self.as_type)]() -> @Method.1.%T (%T);
  1130. // CHECK:STDOUT: }
  1131. // CHECK:STDOUT:
  1132. // CHECK:STDOUT: fn @MakeB() -> %return.param_patt: %B {
  1133. // CHECK:STDOUT: !entry:
  1134. // CHECK:STDOUT: %A.ref: type = name_ref A, imports.%Main.A [concrete = constants.%A]
  1135. // CHECK:STDOUT: %Factory.ref: %Factory.type.1a8 = name_ref Factory, imports.%Main.Factory [concrete = constants.%Factory.generic]
  1136. // CHECK:STDOUT: %B.ref.loc5: type = name_ref B, imports.%Main.B [concrete = constants.%B]
  1137. // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(constants.%B)> [concrete = constants.%Factory.type.a5d]
  1138. // CHECK:STDOUT: %.loc5_23: %Factory.assoc_type.668 = specific_constant imports.%Main.import_ref.8d5, @Factory(constants.%B) [concrete = constants.%assoc0.503]
  1139. // CHECK:STDOUT: %Make.ref: %Factory.assoc_type.668 = name_ref Make, %.loc5_23 [concrete = constants.%assoc0.503]
  1140. // CHECK:STDOUT: %Factory.facet: %Factory.type.a5d = facet_value constants.%A, (constants.%impl_witness) [concrete = constants.%Factory.facet]
  1141. // CHECK:STDOUT: %.loc5_11: %Factory.type.a5d = converted %A.ref, %Factory.facet [concrete = constants.%Factory.facet]
  1142. // CHECK:STDOUT: %as_wit.iface0: <witness> = facet_access_witness %.loc5_11, element0 [concrete = constants.%impl_witness]
  1143. // CHECK:STDOUT: %impl.elem0: %.b98 = impl_witness_access %as_wit.iface0, element0 [concrete = constants.%Make.377]
  1144. // CHECK:STDOUT: %.loc4: ref %B = splice_block %return {}
  1145. // CHECK:STDOUT: %Make.call: init %B = call %impl.elem0() to %.loc4
  1146. // CHECK:STDOUT: return %Make.call to %return
  1147. // CHECK:STDOUT: }
  1148. // CHECK:STDOUT:
  1149. // CHECK:STDOUT: fn @Make.2() -> %B [from "factory.carbon"];
  1150. // CHECK:STDOUT:
  1151. // CHECK:STDOUT: fn @InstanceB(%a.param_patt: %A) -> %return.param_patt: %B {
  1152. // CHECK:STDOUT: !entry:
  1153. // CHECK:STDOUT: %a.ref: %A = name_ref a, %a
  1154. // CHECK:STDOUT: %Factory.ref: %Factory.type.1a8 = name_ref Factory, imports.%Main.Factory [concrete = constants.%Factory.generic]
  1155. // CHECK:STDOUT: %B.ref.loc8: type = name_ref B, imports.%Main.B [concrete = constants.%B]
  1156. // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(constants.%B)> [concrete = constants.%Factory.type.a5d]
  1157. // CHECK:STDOUT: %.loc8: %Factory.assoc_type.668 = specific_constant imports.%Main.import_ref.ff7, @Factory(constants.%B) [concrete = constants.%assoc1.51f]
  1158. // CHECK:STDOUT: %Method.ref: %Factory.assoc_type.668 = name_ref Method, %.loc8 [concrete = constants.%assoc1.51f]
  1159. // CHECK:STDOUT: %impl.elem1: %.ac0 = impl_witness_access constants.%impl_witness, element1 [concrete = constants.%Method.3d4]
  1160. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %a.ref, %impl.elem1
  1161. // CHECK:STDOUT: %.loc7: ref %B = splice_block %return {}
  1162. // CHECK:STDOUT: %Method.call: init %B = call %bound_method(%a.ref) to %.loc7
  1163. // CHECK:STDOUT: return %Method.call to %return
  1164. // CHECK:STDOUT: }
  1165. // CHECK:STDOUT:
  1166. // CHECK:STDOUT: fn @Method.2[%self.param_patt: %A]() -> %B [from "factory.carbon"];
  1167. // CHECK:STDOUT:
  1168. // CHECK:STDOUT: specific @Factory(constants.%T) {
  1169. // CHECK:STDOUT: %T => constants.%T
  1170. // CHECK:STDOUT: %T.patt => constants.%T
  1171. // CHECK:STDOUT: }
  1172. // CHECK:STDOUT:
  1173. // CHECK:STDOUT: specific @Factory(constants.%B) {
  1174. // CHECK:STDOUT: %T => constants.%B
  1175. // CHECK:STDOUT: %T.patt => constants.%B
  1176. // CHECK:STDOUT:
  1177. // CHECK:STDOUT: !definition:
  1178. // CHECK:STDOUT: %Factory.type => constants.%Factory.type.a5d
  1179. // CHECK:STDOUT: %Self => constants.%Self
  1180. // CHECK:STDOUT: %Make.type => constants.%Make.type.c59
  1181. // CHECK:STDOUT: %Make => constants.%Make.efe
  1182. // CHECK:STDOUT: %Factory.assoc_type => constants.%Factory.assoc_type.668
  1183. // CHECK:STDOUT: %assoc0 => constants.%assoc0.503
  1184. // CHECK:STDOUT: %Method.type => constants.%Method.type.117
  1185. // CHECK:STDOUT: %Method => constants.%Method.ea9
  1186. // CHECK:STDOUT: %assoc1 => constants.%assoc1.51f
  1187. // CHECK:STDOUT: }
  1188. // CHECK:STDOUT:
  1189. // CHECK:STDOUT: specific @Factory(%T) {}
  1190. // CHECK:STDOUT:
  1191. // CHECK:STDOUT: specific @Make.1(constants.%T, constants.%Self) {
  1192. // CHECK:STDOUT: %T => constants.%T
  1193. // CHECK:STDOUT: }
  1194. // CHECK:STDOUT:
  1195. // CHECK:STDOUT: specific @Factory(@Method.1.%T) {}
  1196. // CHECK:STDOUT:
  1197. // CHECK:STDOUT: specific @Method.1(constants.%T, constants.%Self) {
  1198. // CHECK:STDOUT: %T => constants.%T
  1199. // CHECK:STDOUT: %Factory.type => constants.%Factory.type.c96
  1200. // CHECK:STDOUT: %Self => constants.%Self
  1201. // CHECK:STDOUT: %Self.as_type => constants.%Self.as_type
  1202. // CHECK:STDOUT: }
  1203. // CHECK:STDOUT:
  1204. // CHECK:STDOUT: --- fail_factory.impl.carbon
  1205. // CHECK:STDOUT:
  1206. // CHECK:STDOUT: constants {
  1207. // CHECK:STDOUT: %B: type = class_type @B [concrete]
  1208. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  1209. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  1210. // CHECK:STDOUT: %Factory.type.1a8: type = generic_interface_type @Factory [concrete]
  1211. // CHECK:STDOUT: %Factory.generic: %Factory.type.1a8 = struct_value () [concrete]
  1212. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  1213. // CHECK:STDOUT: %Factory.type.c96: type = facet_type <@Factory, @Factory(%T)> [symbolic]
  1214. // CHECK:STDOUT: %Self.9ba: %Factory.type.c96 = bind_symbolic_name Self, 1 [symbolic]
  1215. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  1216. // CHECK:STDOUT: %Factory.type.a5d: type = facet_type <@Factory, @Factory(%B)> [concrete]
  1217. // CHECK:STDOUT: %A: type = class_type @A [concrete]
  1218. // CHECK:STDOUT: %Make.type.598: type = fn_type @Make, @Factory(%T) [symbolic]
  1219. // CHECK:STDOUT: %Make.737: %Make.type.598 = struct_value () [symbolic]
  1220. // CHECK:STDOUT: %Factory.assoc_type.ca7: type = assoc_entity_type %Factory.type.c96 [symbolic]
  1221. // CHECK:STDOUT: %assoc0.4f7: %Factory.assoc_type.ca7 = assoc_entity element0, imports.%Main.import_ref.1aa [symbolic]
  1222. // CHECK:STDOUT: %Method.type.7ee: type = fn_type @Method, @Factory(%T) [symbolic]
  1223. // CHECK:STDOUT: %Method.a71: %Method.type.7ee = struct_value () [symbolic]
  1224. // CHECK:STDOUT: %Self.as_type.56c: type = facet_access_type %Self.9ba [symbolic]
  1225. // CHECK:STDOUT: %assoc1.7f7: %Factory.assoc_type.ca7 = assoc_entity element1, imports.%Main.import_ref.5be [symbolic]
  1226. // CHECK:STDOUT: %Make.type.c59: type = fn_type @Make, @Factory(%B) [concrete]
  1227. // CHECK:STDOUT: %Make.efe: %Make.type.c59 = struct_value () [concrete]
  1228. // CHECK:STDOUT: %Factory.assoc_type.668: type = assoc_entity_type %Factory.type.a5d [concrete]
  1229. // CHECK:STDOUT: %assoc0.228: %Factory.assoc_type.668 = assoc_entity element0, imports.%Main.import_ref.21018a.1 [concrete]
  1230. // CHECK:STDOUT: %Method.type.117: type = fn_type @Method, @Factory(%B) [concrete]
  1231. // CHECK:STDOUT: %Method.ea9: %Method.type.117 = struct_value () [concrete]
  1232. // CHECK:STDOUT: %assoc1.7a1: %Factory.assoc_type.668 = assoc_entity element1, imports.%Main.import_ref.46fc3c.1 [concrete]
  1233. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  1234. // CHECK:STDOUT: %MakeC.type: type = fn_type @MakeC [concrete]
  1235. // CHECK:STDOUT: %MakeC: %MakeC.type = struct_value () [concrete]
  1236. // CHECK:STDOUT: %Factory.type.5c5: type = facet_type <@Factory, @Factory(%C)> [concrete]
  1237. // CHECK:STDOUT: %Make.type.0de: type = fn_type @Make, @Factory(%C) [concrete]
  1238. // CHECK:STDOUT: %Make.8ba: %Make.type.0de = struct_value () [concrete]
  1239. // CHECK:STDOUT: %Factory.assoc_type.709: type = assoc_entity_type %Factory.type.5c5 [concrete]
  1240. // CHECK:STDOUT: %assoc0.b47: %Factory.assoc_type.709 = assoc_entity element0, imports.%Main.import_ref.1aa [concrete]
  1241. // CHECK:STDOUT: %Method.type.d46: type = fn_type @Method, @Factory(%C) [concrete]
  1242. // CHECK:STDOUT: %Method.f9e: %Method.type.d46 = struct_value () [concrete]
  1243. // CHECK:STDOUT: %assoc1.90c: %Factory.assoc_type.709 = assoc_entity element1, imports.%Main.import_ref.5be [concrete]
  1244. // CHECK:STDOUT: %assoc0.354: %Factory.assoc_type.ca7 = assoc_entity element0, imports.%Main.import_ref.21018a.2 [symbolic]
  1245. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic]
  1246. // CHECK:STDOUT: %ImplicitAs.type.d62: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic]
  1247. // CHECK:STDOUT: %Self.519: %ImplicitAs.type.d62 = bind_symbolic_name Self, 1 [symbolic]
  1248. // CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic]
  1249. // CHECK:STDOUT: %Convert.type.275: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic]
  1250. // CHECK:STDOUT: %Convert.42e: %Convert.type.275 = struct_value () [symbolic]
  1251. // CHECK:STDOUT: %Self.as_type.40a: type = facet_access_type %Self.519 [symbolic]
  1252. // CHECK:STDOUT: %ImplicitAs.assoc_type.837: type = assoc_entity_type %ImplicitAs.type.d62 [symbolic]
  1253. // CHECK:STDOUT: %assoc0.02f: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.1c7 [symbolic]
  1254. // CHECK:STDOUT: %ImplicitAs.type.d43: type = facet_type <@ImplicitAs, @ImplicitAs(%Factory.type.5c5)> [concrete]
  1255. // CHECK:STDOUT: %Convert.type.9b5: type = fn_type @Convert, @ImplicitAs(%Factory.type.5c5) [concrete]
  1256. // CHECK:STDOUT: %Convert.8cc: %Convert.type.9b5 = struct_value () [concrete]
  1257. // CHECK:STDOUT: %ImplicitAs.assoc_type.0f8: type = assoc_entity_type %ImplicitAs.type.d43 [concrete]
  1258. // CHECK:STDOUT: %assoc0.a8c: %ImplicitAs.assoc_type.0f8 = assoc_entity element0, imports.%Core.import_ref.1c7 [concrete]
  1259. // CHECK:STDOUT: %assoc0.43d: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207 [symbolic]
  1260. // CHECK:STDOUT: %InstanceC.type: type = fn_type @InstanceC [concrete]
  1261. // CHECK:STDOUT: %InstanceC: %InstanceC.type = struct_value () [concrete]
  1262. // CHECK:STDOUT: %assoc1.1fd: %Factory.assoc_type.ca7 = assoc_entity element1, imports.%Main.import_ref.46fc3c.2 [symbolic]
  1263. // CHECK:STDOUT: }
  1264. // CHECK:STDOUT:
  1265. // CHECK:STDOUT: imports {
  1266. // CHECK:STDOUT: %Main.Factory: %Factory.type.1a8 = import_ref Main//factory, Factory, loaded [concrete = constants.%Factory.generic]
  1267. // CHECK:STDOUT: %Main.A: type = import_ref Main//factory, A, loaded [concrete = constants.%A]
  1268. // CHECK:STDOUT: %Main.B = import_ref Main//factory, B, unloaded
  1269. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  1270. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  1271. // CHECK:STDOUT: import Core//default
  1272. // CHECK:STDOUT: }
  1273. // CHECK:STDOUT: %Main.import_ref.8f24d3.1: <witness> = import_ref Main//factory, loc12_10, loaded [concrete = constants.%complete_type]
  1274. // CHECK:STDOUT: %Main.import_ref.54a = import_ref Main//factory, inst77 [no loc], unloaded
  1275. // CHECK:STDOUT: %Main.import_ref.5ab3ec.1: type = import_ref Main//factory, loc4_19, loaded [symbolic = @Factory.%T (constants.%T)]
  1276. // CHECK:STDOUT: %Main.import_ref.fbb = import_ref Main//factory, inst24 [no loc], unloaded
  1277. // CHECK:STDOUT: %Main.import_ref.8d5: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = import_ref Main//factory, loc6_17, loaded [symbolic = @Factory.%assoc0 (constants.%assoc0.354)]
  1278. // CHECK:STDOUT: %Main.import_ref.ff7: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = import_ref Main//factory, loc8_31, loaded [symbolic = @Factory.%assoc1 (constants.%assoc1.1fd)]
  1279. // CHECK:STDOUT: %Main.Make = import_ref Main//factory, Make, unloaded
  1280. // CHECK:STDOUT: %Main.Method = import_ref Main//factory, Method, unloaded
  1281. // CHECK:STDOUT: %Main.import_ref.e41 = import_ref Main//factory, loc14_22, unloaded
  1282. // CHECK:STDOUT: %Main.import_ref.8f24d3.2: <witness> = import_ref Main//factory, loc11_10, loaded [concrete = constants.%complete_type]
  1283. // CHECK:STDOUT: %Main.import_ref.da3 = import_ref Main//factory, inst72 [no loc], unloaded
  1284. // CHECK:STDOUT: %Main.import_ref.984: type = import_ref Main//factory, loc14_6, loaded [concrete = constants.%A]
  1285. // CHECK:STDOUT: %Main.import_ref.bd2: type = import_ref Main//factory, loc14_20, loaded [concrete = constants.%Factory.type.a5d]
  1286. // CHECK:STDOUT: %Main.import_ref.a27 = import_ref Main//factory, loc15_17, unloaded
  1287. // CHECK:STDOUT: %Main.import_ref.163 = import_ref Main//factory, loc16_31, unloaded
  1288. // CHECK:STDOUT: %Main.import_ref.5ab3ec.2: type = import_ref Main//factory, loc4_19, loaded [symbolic = @Factory.%T (constants.%T)]
  1289. // CHECK:STDOUT: %Main.import_ref.91b53a.1: @Factory.%Factory.type (%Factory.type.c96) = import_ref Main//factory, inst24 [no loc], loaded [symbolic = @Factory.%Self (constants.%Self.9ba)]
  1290. // CHECK:STDOUT: %Main.import_ref.1aa: @Factory.%Make.type (%Make.type.598) = import_ref Main//factory, loc6_17, loaded [symbolic = @Factory.%Make (constants.%Make.737)]
  1291. // CHECK:STDOUT: %Main.import_ref.5ab3ec.3: type = import_ref Main//factory, loc4_19, loaded [symbolic = @Factory.%T (constants.%T)]
  1292. // CHECK:STDOUT: %Main.import_ref.91b53a.2: @Factory.%Factory.type (%Factory.type.c96) = import_ref Main//factory, inst24 [no loc], loaded [symbolic = @Factory.%Self (constants.%Self.9ba)]
  1293. // CHECK:STDOUT: %Main.import_ref.5be: @Factory.%Method.type (%Method.type.7ee) = import_ref Main//factory, loc8_31, loaded [symbolic = @Factory.%Method (constants.%Method.a71)]
  1294. // CHECK:STDOUT: %Core.import_ref.5ab3ec.1: type = import_ref Core//default, loc3_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)]
  1295. // CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//default, inst24 [no loc], unloaded
  1296. // CHECK:STDOUT: %Core.import_ref.630: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = import_ref Core//default, loc4_35, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.43d)]
  1297. // CHECK:STDOUT: %Core.Convert = import_ref Core//default, Convert, unloaded
  1298. // CHECK:STDOUT: %Core.import_ref.5ab3ec.2: type = import_ref Core//default, loc3_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)]
  1299. // CHECK:STDOUT: %Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) = import_ref Core//default, inst24 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)]
  1300. // CHECK:STDOUT: %Core.import_ref.1c7: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//default, loc4_35, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)]
  1301. // CHECK:STDOUT: }
  1302. // CHECK:STDOUT:
  1303. // CHECK:STDOUT: file {
  1304. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1305. // CHECK:STDOUT: .Factory = imports.%Main.Factory
  1306. // CHECK:STDOUT: .A = imports.%Main.A
  1307. // CHECK:STDOUT: .B = imports.%Main.B
  1308. // CHECK:STDOUT: .Core = imports.%Core
  1309. // CHECK:STDOUT: .C = %C.decl
  1310. // CHECK:STDOUT: .MakeC = %MakeC.decl
  1311. // CHECK:STDOUT: .InstanceC = %InstanceC.decl
  1312. // CHECK:STDOUT: }
  1313. // CHECK:STDOUT: %default.import.loc2_6.1 = import <none>
  1314. // CHECK:STDOUT: %default.import.loc2_6.2 = import <none>
  1315. // CHECK:STDOUT: %Core.import = import Core
  1316. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  1317. // CHECK:STDOUT: %MakeC.decl: %MakeC.type = fn_decl @MakeC [concrete = constants.%MakeC] {
  1318. // CHECK:STDOUT: %return.patt: %C = return_slot_pattern
  1319. // CHECK:STDOUT: %return.param_patt: %C = out_param_pattern %return.patt, call_param0
  1320. // CHECK:STDOUT: } {
  1321. // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, file.%C.decl [concrete = constants.%C]
  1322. // CHECK:STDOUT: %return.param: ref %C = out_param call_param0
  1323. // CHECK:STDOUT: %return: ref %C = return_slot %return.param
  1324. // CHECK:STDOUT: }
  1325. // CHECK:STDOUT: %InstanceC.decl: %InstanceC.type = fn_decl @InstanceC [concrete = constants.%InstanceC] {
  1326. // CHECK:STDOUT: %a.patt: %A = binding_pattern a
  1327. // CHECK:STDOUT: %a.param_patt: %A = value_param_pattern %a.patt, call_param0
  1328. // CHECK:STDOUT: %return.patt: %C = return_slot_pattern
  1329. // CHECK:STDOUT: %return.param_patt: %C = out_param_pattern %return.patt, call_param1
  1330. // CHECK:STDOUT: } {
  1331. // CHECK:STDOUT: %C.ref.loc19: type = name_ref C, file.%C.decl [concrete = constants.%C]
  1332. // CHECK:STDOUT: %a.param: %A = value_param call_param0
  1333. // CHECK:STDOUT: %A.ref: type = name_ref A, imports.%Main.A [concrete = constants.%A]
  1334. // CHECK:STDOUT: %a: %A = bind_name a, %a.param
  1335. // CHECK:STDOUT: %return.param: ref %C = out_param call_param1
  1336. // CHECK:STDOUT: %return: ref %C = return_slot %return.param
  1337. // CHECK:STDOUT: }
  1338. // CHECK:STDOUT: }
  1339. // CHECK:STDOUT:
  1340. // CHECK:STDOUT: generic interface @Factory(imports.%Main.import_ref.5ab3ec.1: type) [from "factory.carbon"] {
  1341. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  1342. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)]
  1343. // CHECK:STDOUT:
  1344. // CHECK:STDOUT: !definition:
  1345. // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(%T)> [symbolic = %Factory.type (constants.%Factory.type.c96)]
  1346. // CHECK:STDOUT: %Self: %Factory.type.c96 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.9ba)]
  1347. // CHECK:STDOUT: %Make.type: type = fn_type @Make, @Factory(%T) [symbolic = %Make.type (constants.%Make.type.598)]
  1348. // CHECK:STDOUT: %Make: @Factory.%Make.type (%Make.type.598) = struct_value () [symbolic = %Make (constants.%Make.737)]
  1349. // CHECK:STDOUT: %Factory.assoc_type: type = assoc_entity_type @Factory.%Factory.type (%Factory.type.c96) [symbolic = %Factory.assoc_type (constants.%Factory.assoc_type.ca7)]
  1350. // CHECK:STDOUT: %assoc0: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = assoc_entity element0, imports.%Main.import_ref.1aa [symbolic = %assoc0 (constants.%assoc0.4f7)]
  1351. // CHECK:STDOUT: %Method.type: type = fn_type @Method, @Factory(%T) [symbolic = %Method.type (constants.%Method.type.7ee)]
  1352. // CHECK:STDOUT: %Method: @Factory.%Method.type (%Method.type.7ee) = struct_value () [symbolic = %Method (constants.%Method.a71)]
  1353. // CHECK:STDOUT: %assoc1: @Factory.%Factory.assoc_type (%Factory.assoc_type.ca7) = assoc_entity element1, imports.%Main.import_ref.5be [symbolic = %assoc1 (constants.%assoc1.7f7)]
  1354. // CHECK:STDOUT:
  1355. // CHECK:STDOUT: interface {
  1356. // CHECK:STDOUT: !members:
  1357. // CHECK:STDOUT: .Self = imports.%Main.import_ref.fbb
  1358. // CHECK:STDOUT: .Make = imports.%Main.import_ref.8d5
  1359. // CHECK:STDOUT: .Method = imports.%Main.import_ref.ff7
  1360. // CHECK:STDOUT: witness = (imports.%Main.Make, imports.%Main.Method)
  1361. // CHECK:STDOUT: }
  1362. // CHECK:STDOUT: }
  1363. // CHECK:STDOUT:
  1364. // CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.5ab3ec.1: type) [from "core.carbon"] {
  1365. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
  1366. // CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)]
  1367. // CHECK:STDOUT:
  1368. // CHECK:STDOUT: !definition:
  1369. // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.d62)]
  1370. // CHECK:STDOUT: %Self: %ImplicitAs.type.d62 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.519)]
  1371. // CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.275)]
  1372. // CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.275) = struct_value () [symbolic = %Convert (constants.%Convert.42e)]
  1373. // CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) [symbolic = %ImplicitAs.assoc_type (constants.%ImplicitAs.assoc_type.837)]
  1374. // CHECK:STDOUT: %assoc0: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = assoc_entity element0, imports.%Core.import_ref.1c7 [symbolic = %assoc0 (constants.%assoc0.02f)]
  1375. // CHECK:STDOUT:
  1376. // CHECK:STDOUT: interface {
  1377. // CHECK:STDOUT: !members:
  1378. // CHECK:STDOUT: .Self = imports.%Core.import_ref.ff5
  1379. // CHECK:STDOUT: .Convert = imports.%Core.import_ref.630
  1380. // CHECK:STDOUT: witness = (imports.%Core.Convert)
  1381. // CHECK:STDOUT: }
  1382. // CHECK:STDOUT: }
  1383. // CHECK:STDOUT:
  1384. // CHECK:STDOUT: impl @impl: imports.%Main.import_ref.984 as imports.%Main.import_ref.bd2 [from "factory.carbon"] {
  1385. // CHECK:STDOUT: !members:
  1386. // CHECK:STDOUT: .Make = imports.%Main.import_ref.a27
  1387. // CHECK:STDOUT: .Method = imports.%Main.import_ref.163
  1388. // CHECK:STDOUT: witness = imports.%Main.import_ref.e41
  1389. // CHECK:STDOUT: }
  1390. // CHECK:STDOUT:
  1391. // CHECK:STDOUT: class @B [from "factory.carbon"] {
  1392. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f24d3.1
  1393. // CHECK:STDOUT:
  1394. // CHECK:STDOUT: !members:
  1395. // CHECK:STDOUT: .Self = imports.%Main.import_ref.54a
  1396. // CHECK:STDOUT: }
  1397. // CHECK:STDOUT:
  1398. // CHECK:STDOUT: class @A [from "factory.carbon"] {
  1399. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f24d3.2
  1400. // CHECK:STDOUT:
  1401. // CHECK:STDOUT: !members:
  1402. // CHECK:STDOUT: .Self = imports.%Main.import_ref.da3
  1403. // CHECK:STDOUT: }
  1404. // CHECK:STDOUT:
  1405. // CHECK:STDOUT: class @C {
  1406. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  1407. // CHECK:STDOUT: complete_type_witness = %complete_type
  1408. // CHECK:STDOUT:
  1409. // CHECK:STDOUT: !members:
  1410. // CHECK:STDOUT: .Self = constants.%C
  1411. // CHECK:STDOUT: }
  1412. // CHECK:STDOUT:
  1413. // CHECK:STDOUT: generic fn @Make(imports.%Main.import_ref.5ab3ec.2: type, imports.%Main.import_ref.91b53a.1: @Factory.%Factory.type (%Factory.type.c96)) [from "factory.carbon"] {
  1414. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  1415. // CHECK:STDOUT:
  1416. // CHECK:STDOUT: fn() -> @Make.%T (%T);
  1417. // CHECK:STDOUT: }
  1418. // CHECK:STDOUT:
  1419. // CHECK:STDOUT: generic fn @Method(imports.%Main.import_ref.5ab3ec.3: type, imports.%Main.import_ref.91b53a.2: @Factory.%Factory.type (%Factory.type.c96)) [from "factory.carbon"] {
  1420. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  1421. // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(%T)> [symbolic = %Factory.type (constants.%Factory.type.c96)]
  1422. // CHECK:STDOUT: %Self: %Factory.type.c96 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.9ba)]
  1423. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type.56c)]
  1424. // CHECK:STDOUT:
  1425. // CHECK:STDOUT: fn[%self.param_patt: @Method.%Self.as_type (%Self.as_type.56c)]() -> @Method.%T (%T);
  1426. // CHECK:STDOUT: }
  1427. // CHECK:STDOUT:
  1428. // CHECK:STDOUT: fn @MakeC() -> %return.param_patt: %C {
  1429. // CHECK:STDOUT: !entry:
  1430. // CHECK:STDOUT: %A.ref: type = name_ref A, imports.%Main.A [concrete = constants.%A]
  1431. // CHECK:STDOUT: %Factory.ref: %Factory.type.1a8 = name_ref Factory, imports.%Main.Factory [concrete = constants.%Factory.generic]
  1432. // CHECK:STDOUT: %C.ref.loc16: type = name_ref C, file.%C.decl [concrete = constants.%C]
  1433. // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(constants.%C)> [concrete = constants.%Factory.type.5c5]
  1434. // CHECK:STDOUT: %.loc16_23: %Factory.assoc_type.709 = specific_constant imports.%Main.import_ref.8d5, @Factory(constants.%C) [concrete = constants.%assoc0.b47]
  1435. // CHECK:STDOUT: %Make.ref: %Factory.assoc_type.709 = name_ref Make, %.loc16_23 [concrete = constants.%assoc0.b47]
  1436. // CHECK:STDOUT: %.loc16_11: %Factory.type.5c5 = converted %A.ref, <error> [concrete = <error>]
  1437. // CHECK:STDOUT: return <error> to %return
  1438. // CHECK:STDOUT: }
  1439. // CHECK:STDOUT:
  1440. // CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.5ab3ec.2: type, imports.%Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62)) [from "core.carbon"] {
  1441. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
  1442. // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.d62)]
  1443. // CHECK:STDOUT: %Self: %ImplicitAs.type.d62 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.519)]
  1444. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type.40a)]
  1445. // CHECK:STDOUT:
  1446. // CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type (%Self.as_type.40a)]() -> @Convert.%Dest (%Dest);
  1447. // CHECK:STDOUT: }
  1448. // CHECK:STDOUT:
  1449. // CHECK:STDOUT: fn @InstanceC(%a.param_patt: %A) -> %return.param_patt: %C {
  1450. // CHECK:STDOUT: !entry:
  1451. // CHECK:STDOUT: %a.ref: %A = name_ref a, %a
  1452. // CHECK:STDOUT: %Factory.ref: %Factory.type.1a8 = name_ref Factory, imports.%Main.Factory [concrete = constants.%Factory.generic]
  1453. // CHECK:STDOUT: %C.ref.loc24: type = name_ref C, file.%C.decl [concrete = constants.%C]
  1454. // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(constants.%C)> [concrete = constants.%Factory.type.5c5]
  1455. // CHECK:STDOUT: %.loc24: %Factory.assoc_type.709 = specific_constant imports.%Main.import_ref.ff7, @Factory(constants.%C) [concrete = constants.%assoc1.90c]
  1456. // CHECK:STDOUT: %Method.ref: %Factory.assoc_type.709 = name_ref Method, %.loc24 [concrete = constants.%assoc1.90c]
  1457. // CHECK:STDOUT: return <error> to %return
  1458. // CHECK:STDOUT: }
  1459. // CHECK:STDOUT:
  1460. // CHECK:STDOUT: specific @Factory(constants.%T) {
  1461. // CHECK:STDOUT: %T => constants.%T
  1462. // CHECK:STDOUT: %T.patt => constants.%T
  1463. // CHECK:STDOUT: }
  1464. // CHECK:STDOUT:
  1465. // CHECK:STDOUT: specific @Factory(constants.%B) {
  1466. // CHECK:STDOUT: %T => constants.%B
  1467. // CHECK:STDOUT: %T.patt => constants.%B
  1468. // CHECK:STDOUT:
  1469. // CHECK:STDOUT: !definition:
  1470. // CHECK:STDOUT: %Factory.type => constants.%Factory.type.a5d
  1471. // CHECK:STDOUT: %Self => constants.%Self.9ba
  1472. // CHECK:STDOUT: %Make.type => constants.%Make.type.c59
  1473. // CHECK:STDOUT: %Make => constants.%Make.efe
  1474. // CHECK:STDOUT: %Factory.assoc_type => constants.%Factory.assoc_type.668
  1475. // CHECK:STDOUT: %assoc0 => constants.%assoc0.228
  1476. // CHECK:STDOUT: %Method.type => constants.%Method.type.117
  1477. // CHECK:STDOUT: %Method => constants.%Method.ea9
  1478. // CHECK:STDOUT: %assoc1 => constants.%assoc1.7a1
  1479. // CHECK:STDOUT: }
  1480. // CHECK:STDOUT:
  1481. // CHECK:STDOUT: specific @Factory(%T) {}
  1482. // CHECK:STDOUT:
  1483. // CHECK:STDOUT: specific @Make(constants.%T, constants.%Self.9ba) {
  1484. // CHECK:STDOUT: %T => constants.%T
  1485. // CHECK:STDOUT: }
  1486. // CHECK:STDOUT:
  1487. // CHECK:STDOUT: specific @Factory(@Method.%T) {}
  1488. // CHECK:STDOUT:
  1489. // CHECK:STDOUT: specific @Method(constants.%T, constants.%Self.9ba) {
  1490. // CHECK:STDOUT: %T => constants.%T
  1491. // CHECK:STDOUT: %Factory.type => constants.%Factory.type.c96
  1492. // CHECK:STDOUT: %Self => constants.%Self.9ba
  1493. // CHECK:STDOUT: %Self.as_type => constants.%Self.as_type.56c
  1494. // CHECK:STDOUT: }
  1495. // CHECK:STDOUT:
  1496. // CHECK:STDOUT: specific @Factory(constants.%C) {
  1497. // CHECK:STDOUT: %T => constants.%C
  1498. // CHECK:STDOUT: %T.patt => constants.%C
  1499. // CHECK:STDOUT:
  1500. // CHECK:STDOUT: !definition:
  1501. // CHECK:STDOUT: %Factory.type => constants.%Factory.type.5c5
  1502. // CHECK:STDOUT: %Self => constants.%Self.9ba
  1503. // CHECK:STDOUT: %Make.type => constants.%Make.type.0de
  1504. // CHECK:STDOUT: %Make => constants.%Make.8ba
  1505. // CHECK:STDOUT: %Factory.assoc_type => constants.%Factory.assoc_type.709
  1506. // CHECK:STDOUT: %assoc0 => constants.%assoc0.b47
  1507. // CHECK:STDOUT: %Method.type => constants.%Method.type.d46
  1508. // CHECK:STDOUT: %Method => constants.%Method.f9e
  1509. // CHECK:STDOUT: %assoc1 => constants.%assoc1.90c
  1510. // CHECK:STDOUT: }
  1511. // CHECK:STDOUT:
  1512. // CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) {
  1513. // CHECK:STDOUT: %Dest => constants.%Dest
  1514. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  1515. // CHECK:STDOUT: }
  1516. // CHECK:STDOUT:
  1517. // CHECK:STDOUT: specific @ImplicitAs(%Dest) {}
  1518. // CHECK:STDOUT:
  1519. // CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {}
  1520. // CHECK:STDOUT:
  1521. // CHECK:STDOUT: specific @Convert(constants.%Dest, constants.%Self.519) {
  1522. // CHECK:STDOUT: %Dest => constants.%Dest
  1523. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.d62
  1524. // CHECK:STDOUT: %Self => constants.%Self.519
  1525. // CHECK:STDOUT: %Self.as_type => constants.%Self.as_type.40a
  1526. // CHECK:STDOUT: }
  1527. // CHECK:STDOUT:
  1528. // CHECK:STDOUT: specific @ImplicitAs(constants.%Factory.type.5c5) {
  1529. // CHECK:STDOUT: %Dest => constants.%Factory.type.5c5
  1530. // CHECK:STDOUT: %Dest.patt => constants.%Factory.type.5c5
  1531. // CHECK:STDOUT:
  1532. // CHECK:STDOUT: !definition:
  1533. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.d43
  1534. // CHECK:STDOUT: %Self => constants.%Self.519
  1535. // CHECK:STDOUT: %Convert.type => constants.%Convert.type.9b5
  1536. // CHECK:STDOUT: %Convert => constants.%Convert.8cc
  1537. // CHECK:STDOUT: %ImplicitAs.assoc_type => constants.%ImplicitAs.assoc_type.0f8
  1538. // CHECK:STDOUT: %assoc0 => constants.%assoc0.a8c
  1539. // CHECK:STDOUT: }
  1540. // CHECK:STDOUT: