interface_args.carbon 106 KB

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