interface_args.carbon 92 KB

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