interface_args.carbon 126 KB

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