interface_args.carbon 94 KB

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