interface_args.carbon 110 KB

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