interface_args.carbon 109 KB

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