import.carbon 105 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // AUTOUPDATE
  6. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/lookup/no_prelude/import.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/lookup/no_prelude/import.carbon
  10. // --- package_a.carbon
  11. package PackageA;
  12. interface HasF {
  13. fn F();
  14. }
  15. class C {}
  16. // Same library as the class and interface.
  17. impl C as HasF {
  18. fn F() {}
  19. }
  20. // --- package_b.carbon
  21. package PackageB;
  22. import PackageA;
  23. interface HasG {
  24. fn G();
  25. }
  26. class D {}
  27. // Same library as the interface.
  28. impl PackageA.C as HasG {
  29. fn G() {}
  30. }
  31. // Same library as the class.
  32. impl D as PackageA.HasF {
  33. fn F() {}
  34. }
  35. // Same library as the class and interface.
  36. impl D as HasG {
  37. fn G() {}
  38. }
  39. // --- use_cf.carbon
  40. library "[[@TEST_NAME]]";
  41. import PackageA;
  42. fn TestCF(c: PackageA.C) {
  43. c.(PackageA.HasF.F)();
  44. }
  45. // --- use_df.carbon
  46. library "[[@TEST_NAME]]";
  47. import PackageA;
  48. import PackageB;
  49. fn TestDF(d: PackageB.D) {
  50. d.(PackageA.HasF.F)();
  51. }
  52. // --- use_cg.carbon
  53. library "[[@TEST_NAME]]";
  54. import PackageA;
  55. import PackageB;
  56. fn TestCG(c: PackageA.C) {
  57. c.(PackageB.HasG.G)();
  58. }
  59. // --- use_dg.carbon
  60. library "[[@TEST_NAME]]";
  61. import PackageB;
  62. fn TestDG(d: PackageB.D) {
  63. d.(PackageB.HasG.G)();
  64. }
  65. // --- associated_interface.carbon
  66. package PackageAssociatedInterface;
  67. interface Z {
  68. fn H();
  69. }
  70. impl () as Z {
  71. fn H() {}
  72. }
  73. // --- import_associated_interface.carbon
  74. package PackageImportAssociatedInterface;
  75. import PackageAssociatedInterface;
  76. fn J() {
  77. ().(PackageAssociatedInterface.Z.H)();
  78. }
  79. // --- has_param.carbon
  80. package PackageHasParam;
  81. class AnyParam[T:! type](X:! T) {}
  82. interface Y {
  83. fn K() {}
  84. }
  85. // --- has_generic_interface.carbon
  86. package PackageGenericInterface;
  87. import PackageHasParam;
  88. interface GenericInterface(U:! type) {}
  89. impl PackageHasParam.AnyParam(GenericInterface) as PackageHasParam.Y {
  90. fn K() {}
  91. }
  92. fn L() {
  93. var obj: PackageHasParam.AnyParam(GenericInterface) = {};
  94. obj.(PackageHasParam.Y.K)();
  95. }
  96. // --- use_generic_interface_as_param.carbon
  97. library "[[@TEST_NAME]]";
  98. import PackageHasParam;
  99. import PackageGenericInterface;
  100. fn M() {
  101. var obj: PackageHasParam.AnyParam(
  102. PackageGenericInterface.GenericInterface) = {};
  103. obj.(PackageHasParam.Y.K)();
  104. }
  105. // --- has_extra_interfaces.carbon
  106. package HasExtraInterfaces;
  107. interface Extra1 {}
  108. interface Extra2 {}
  109. interface Extra3 {}
  110. interface Extra4 {}
  111. interface Extra5 {}
  112. interface Extra6 {}
  113. interface Extra7 {}
  114. interface Extra8 {}
  115. class C(T:! type) {}
  116. interface I { fn F(); }
  117. impl C((Extra1, Extra2, Extra3, Extra4, Extra5, Extra6, Extra7, Extra8)) as I {
  118. fn F() {}
  119. }
  120. // --- fail_use_has_extra_interfaces.carbon
  121. package UseHasExtraInterfaces;
  122. import HasExtraInterfaces;
  123. fn Test(c: HasExtraInterfaces.C(type)) {
  124. // This triggers the import of a bunch more interfaces, which reallocates the
  125. // interface ValueStore. Ensure that doesn't result in a use-after-free crash.
  126. // CHECK:STDERR: fail_use_has_extra_interfaces.carbon:[[@LINE+4]]:3: error: cannot access member of interface `HasExtraInterfaces.I` in type `HasExtraInterfaces.C(type)` that does not implement that interface [MissingImplInMemberAccess]
  127. // CHECK:STDERR: c.(HasExtraInterfaces.I.F)();
  128. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
  129. // CHECK:STDERR:
  130. c.(HasExtraInterfaces.I.F)();
  131. }
  132. // CHECK:STDOUT: --- package_a.carbon
  133. // CHECK:STDOUT:
  134. // CHECK:STDOUT: constants {
  135. // CHECK:STDOUT: %HasF.type: type = facet_type <@HasF> [template]
  136. // CHECK:STDOUT: %Self: %HasF.type = bind_symbolic_name Self, 0 [symbolic]
  137. // CHECK:STDOUT: %F.type.b7b: type = fn_type @F.1 [template]
  138. // CHECK:STDOUT: %F.f50: %F.type.b7b = struct_value () [template]
  139. // CHECK:STDOUT: %HasF.assoc_type: type = assoc_entity_type %HasF.type [template]
  140. // CHECK:STDOUT: %assoc0: %HasF.assoc_type = assoc_entity element0, @HasF.%F.decl [template]
  141. // CHECK:STDOUT: %C: type = class_type @C [template]
  142. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  143. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  144. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (@impl.%F.decl) [template]
  145. // CHECK:STDOUT: %F.type.a02: type = fn_type @F.2 [template]
  146. // CHECK:STDOUT: %F.dc7: %F.type.a02 = struct_value () [template]
  147. // CHECK:STDOUT: %HasF.facet: %HasF.type = facet_value %C, %impl_witness [template]
  148. // CHECK:STDOUT: }
  149. // CHECK:STDOUT:
  150. // CHECK:STDOUT: file {
  151. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  152. // CHECK:STDOUT: .HasF = %HasF.decl
  153. // CHECK:STDOUT: .C = %C.decl
  154. // CHECK:STDOUT: }
  155. // CHECK:STDOUT: %HasF.decl: type = interface_decl @HasF [template = constants.%HasF.type] {} {}
  156. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  157. // CHECK:STDOUT: impl_decl @impl [template] {} {
  158. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  159. // CHECK:STDOUT: %HasF.ref: type = name_ref HasF, file.%HasF.decl [template = constants.%HasF.type]
  160. // CHECK:STDOUT: }
  161. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (@impl.%F.decl) [template = constants.%impl_witness]
  162. // CHECK:STDOUT: }
  163. // CHECK:STDOUT:
  164. // CHECK:STDOUT: interface @HasF {
  165. // CHECK:STDOUT: %Self: %HasF.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  166. // CHECK:STDOUT: %F.decl: %F.type.b7b = fn_decl @F.1 [template = constants.%F.f50] {} {}
  167. // CHECK:STDOUT: %assoc0: %HasF.assoc_type = assoc_entity element0, %F.decl [template = constants.%assoc0]
  168. // CHECK:STDOUT:
  169. // CHECK:STDOUT: !members:
  170. // CHECK:STDOUT: .Self = %Self
  171. // CHECK:STDOUT: .F = %assoc0
  172. // CHECK:STDOUT: witness = (%F.decl)
  173. // CHECK:STDOUT: }
  174. // CHECK:STDOUT:
  175. // CHECK:STDOUT: impl @impl: %C.ref as %HasF.ref {
  176. // CHECK:STDOUT: %F.decl: %F.type.a02 = fn_decl @F.2 [template = constants.%F.dc7] {} {}
  177. // CHECK:STDOUT:
  178. // CHECK:STDOUT: !members:
  179. // CHECK:STDOUT: .F = %F.decl
  180. // CHECK:STDOUT: witness = file.%impl_witness
  181. // CHECK:STDOUT: }
  182. // CHECK:STDOUT:
  183. // CHECK:STDOUT: class @C {
  184. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  185. // CHECK:STDOUT: complete_type_witness = %complete_type
  186. // CHECK:STDOUT:
  187. // CHECK:STDOUT: !members:
  188. // CHECK:STDOUT: .Self = constants.%C
  189. // CHECK:STDOUT: }
  190. // CHECK:STDOUT:
  191. // CHECK:STDOUT: generic fn @F.1(@HasF.%Self: %HasF.type) {
  192. // CHECK:STDOUT: fn();
  193. // CHECK:STDOUT: }
  194. // CHECK:STDOUT:
  195. // CHECK:STDOUT: fn @F.2() {
  196. // CHECK:STDOUT: !entry:
  197. // CHECK:STDOUT: return
  198. // CHECK:STDOUT: }
  199. // CHECK:STDOUT:
  200. // CHECK:STDOUT: specific @F.1(constants.%Self) {}
  201. // CHECK:STDOUT:
  202. // CHECK:STDOUT: specific @F.1(constants.%HasF.facet) {}
  203. // CHECK:STDOUT:
  204. // CHECK:STDOUT: --- package_b.carbon
  205. // CHECK:STDOUT:
  206. // CHECK:STDOUT: constants {
  207. // CHECK:STDOUT: %HasG.type: type = facet_type <@HasG> [template]
  208. // CHECK:STDOUT: %Self.d42: %HasG.type = bind_symbolic_name Self, 0 [symbolic]
  209. // CHECK:STDOUT: %G.type.d27: type = fn_type @G.1 [template]
  210. // CHECK:STDOUT: %G.688: %G.type.d27 = struct_value () [template]
  211. // CHECK:STDOUT: %HasG.assoc_type: type = assoc_entity_type %HasG.type [template]
  212. // CHECK:STDOUT: %assoc0: %HasG.assoc_type = assoc_entity element0, @HasG.%G.decl [template]
  213. // CHECK:STDOUT: %D: type = class_type @D [template]
  214. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  215. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  216. // CHECK:STDOUT: %C: type = class_type @C [template]
  217. // CHECK:STDOUT: %impl_witness.722: <witness> = impl_witness (@impl.1.%G.decl) [template]
  218. // CHECK:STDOUT: %G.type.05c: type = fn_type @G.2 [template]
  219. // CHECK:STDOUT: %G.486: %G.type.05c = struct_value () [template]
  220. // CHECK:STDOUT: %HasG.facet.085: %HasG.type = facet_value %C, %impl_witness.722 [template]
  221. // CHECK:STDOUT: %HasF.type: type = facet_type <@HasF> [template]
  222. // CHECK:STDOUT: %Self.cf3: %HasF.type = bind_symbolic_name Self, 0 [symbolic]
  223. // CHECK:STDOUT: %F.type.dbc: type = fn_type @F.1 [template]
  224. // CHECK:STDOUT: %F.a2b: %F.type.dbc = struct_value () [template]
  225. // CHECK:STDOUT: %impl_witness.a36: <witness> = impl_witness (@impl.2.%F.decl) [template]
  226. // CHECK:STDOUT: %F.type.bab: type = fn_type @F.2 [template]
  227. // CHECK:STDOUT: %F.46f: %F.type.bab = struct_value () [template]
  228. // CHECK:STDOUT: %HasF.facet: %HasF.type = facet_value %D, %impl_witness.a36 [template]
  229. // CHECK:STDOUT: %impl_witness.9ed: <witness> = impl_witness (@impl.3.%G.decl) [template]
  230. // CHECK:STDOUT: %G.type.c1d: type = fn_type @G.3 [template]
  231. // CHECK:STDOUT: %G.294: %G.type.c1d = struct_value () [template]
  232. // CHECK:STDOUT: %HasG.facet.6fc: %HasG.type = facet_value %D, %impl_witness.9ed [template]
  233. // CHECK:STDOUT: }
  234. // CHECK:STDOUT:
  235. // CHECK:STDOUT: imports {
  236. // CHECK:STDOUT: %PackageA: <namespace> = namespace file.%PackageA.import, [template] {
  237. // CHECK:STDOUT: .C = %PackageA.C
  238. // CHECK:STDOUT: .HasF = %PackageA.HasF
  239. // CHECK:STDOUT: import PackageA//default
  240. // CHECK:STDOUT: }
  241. // CHECK:STDOUT: %PackageA.C: type = import_ref PackageA//default, C, loaded [template = constants.%C]
  242. // CHECK:STDOUT: %PackageA.import_ref.8f2: <witness> = import_ref PackageA//default, loc8_10, loaded [template = constants.%complete_type]
  243. // CHECK:STDOUT: %PackageA.import_ref.2c4 = import_ref PackageA//default, inst25 [no loc], unloaded
  244. // CHECK:STDOUT: %PackageA.HasF: type = import_ref PackageA//default, HasF, loaded [template = constants.%HasF.type]
  245. // CHECK:STDOUT: %PackageA.import_ref.28c = import_ref PackageA//default, inst15 [no loc], unloaded
  246. // CHECK:STDOUT: %PackageA.import_ref.a2a = import_ref PackageA//default, loc5_9, unloaded
  247. // CHECK:STDOUT: %PackageA.F: %F.type.dbc = import_ref PackageA//default, F, loaded [template = constants.%F.a2b]
  248. // CHECK:STDOUT: %PackageA.import_ref.e73: %HasF.type = import_ref PackageA//default, inst15 [no loc], loaded [symbolic = constants.%Self.cf3]
  249. // CHECK:STDOUT: }
  250. // CHECK:STDOUT:
  251. // CHECK:STDOUT: file {
  252. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  253. // CHECK:STDOUT: .PackageA = imports.%PackageA
  254. // CHECK:STDOUT: .HasG = %HasG.decl
  255. // CHECK:STDOUT: .D = %D.decl
  256. // CHECK:STDOUT: }
  257. // CHECK:STDOUT: %PackageA.import = import PackageA
  258. // CHECK:STDOUT: %HasG.decl: type = interface_decl @HasG [template = constants.%HasG.type] {} {}
  259. // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} {}
  260. // CHECK:STDOUT: impl_decl @impl.1 [template] {} {
  261. // CHECK:STDOUT: %PackageA.ref: <namespace> = name_ref PackageA, imports.%PackageA [template = imports.%PackageA]
  262. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%PackageA.C [template = constants.%C]
  263. // CHECK:STDOUT: %HasG.ref: type = name_ref HasG, file.%HasG.decl [template = constants.%HasG.type]
  264. // CHECK:STDOUT: }
  265. // CHECK:STDOUT: %impl_witness.loc13: <witness> = impl_witness (@impl.1.%G.decl) [template = constants.%impl_witness.722]
  266. // CHECK:STDOUT: impl_decl @impl.2 [template] {} {
  267. // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D]
  268. // CHECK:STDOUT: %PackageA.ref: <namespace> = name_ref PackageA, imports.%PackageA [template = imports.%PackageA]
  269. // CHECK:STDOUT: %HasF.ref: type = name_ref HasF, imports.%PackageA.HasF [template = constants.%HasF.type]
  270. // CHECK:STDOUT: }
  271. // CHECK:STDOUT: %impl_witness.loc18: <witness> = impl_witness (@impl.2.%F.decl) [template = constants.%impl_witness.a36]
  272. // CHECK:STDOUT: impl_decl @impl.3 [template] {} {
  273. // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D]
  274. // CHECK:STDOUT: %HasG.ref: type = name_ref HasG, file.%HasG.decl [template = constants.%HasG.type]
  275. // CHECK:STDOUT: }
  276. // CHECK:STDOUT: %impl_witness.loc23: <witness> = impl_witness (@impl.3.%G.decl) [template = constants.%impl_witness.9ed]
  277. // CHECK:STDOUT: }
  278. // CHECK:STDOUT:
  279. // CHECK:STDOUT: interface @HasG {
  280. // CHECK:STDOUT: %Self: %HasG.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.d42]
  281. // CHECK:STDOUT: %G.decl: %G.type.d27 = fn_decl @G.1 [template = constants.%G.688] {} {}
  282. // CHECK:STDOUT: %assoc0: %HasG.assoc_type = assoc_entity element0, %G.decl [template = constants.%assoc0]
  283. // CHECK:STDOUT:
  284. // CHECK:STDOUT: !members:
  285. // CHECK:STDOUT: .Self = %Self
  286. // CHECK:STDOUT: .G = %assoc0
  287. // CHECK:STDOUT: witness = (%G.decl)
  288. // CHECK:STDOUT: }
  289. // CHECK:STDOUT:
  290. // CHECK:STDOUT: interface @HasF [from "package_a.carbon"] {
  291. // CHECK:STDOUT: !members:
  292. // CHECK:STDOUT: .Self = imports.%PackageA.import_ref.28c
  293. // CHECK:STDOUT: .F = imports.%PackageA.import_ref.a2a
  294. // CHECK:STDOUT: witness = (imports.%PackageA.F)
  295. // CHECK:STDOUT: }
  296. // CHECK:STDOUT:
  297. // CHECK:STDOUT: impl @impl.1: %C.ref as %HasG.ref {
  298. // CHECK:STDOUT: %G.decl: %G.type.05c = fn_decl @G.2 [template = constants.%G.486] {} {}
  299. // CHECK:STDOUT:
  300. // CHECK:STDOUT: !members:
  301. // CHECK:STDOUT: .G = %G.decl
  302. // CHECK:STDOUT: witness = file.%impl_witness.loc13
  303. // CHECK:STDOUT: }
  304. // CHECK:STDOUT:
  305. // CHECK:STDOUT: impl @impl.2: %D.ref as %HasF.ref {
  306. // CHECK:STDOUT: %F.decl: %F.type.bab = fn_decl @F.2 [template = constants.%F.46f] {} {}
  307. // CHECK:STDOUT:
  308. // CHECK:STDOUT: !members:
  309. // CHECK:STDOUT: .F = %F.decl
  310. // CHECK:STDOUT: witness = file.%impl_witness.loc18
  311. // CHECK:STDOUT: }
  312. // CHECK:STDOUT:
  313. // CHECK:STDOUT: impl @impl.3: %D.ref as %HasG.ref {
  314. // CHECK:STDOUT: %G.decl: %G.type.c1d = fn_decl @G.3 [template = constants.%G.294] {} {}
  315. // CHECK:STDOUT:
  316. // CHECK:STDOUT: !members:
  317. // CHECK:STDOUT: .G = %G.decl
  318. // CHECK:STDOUT: witness = file.%impl_witness.loc23
  319. // CHECK:STDOUT: }
  320. // CHECK:STDOUT:
  321. // CHECK:STDOUT: class @D {
  322. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  323. // CHECK:STDOUT: complete_type_witness = %complete_type
  324. // CHECK:STDOUT:
  325. // CHECK:STDOUT: !members:
  326. // CHECK:STDOUT: .Self = constants.%D
  327. // CHECK:STDOUT: }
  328. // CHECK:STDOUT:
  329. // CHECK:STDOUT: class @C [from "package_a.carbon"] {
  330. // CHECK:STDOUT: complete_type_witness = imports.%PackageA.import_ref.8f2
  331. // CHECK:STDOUT:
  332. // CHECK:STDOUT: !members:
  333. // CHECK:STDOUT: .Self = imports.%PackageA.import_ref.2c4
  334. // CHECK:STDOUT: }
  335. // CHECK:STDOUT:
  336. // CHECK:STDOUT: generic fn @G.1(@HasG.%Self: %HasG.type) {
  337. // CHECK:STDOUT: fn();
  338. // CHECK:STDOUT: }
  339. // CHECK:STDOUT:
  340. // CHECK:STDOUT: fn @G.2() {
  341. // CHECK:STDOUT: !entry:
  342. // CHECK:STDOUT: return
  343. // CHECK:STDOUT: }
  344. // CHECK:STDOUT:
  345. // CHECK:STDOUT: generic fn @F.1(imports.%PackageA.import_ref.e73: %HasF.type) [from "package_a.carbon"] {
  346. // CHECK:STDOUT: fn();
  347. // CHECK:STDOUT: }
  348. // CHECK:STDOUT:
  349. // CHECK:STDOUT: fn @F.2() {
  350. // CHECK:STDOUT: !entry:
  351. // CHECK:STDOUT: return
  352. // CHECK:STDOUT: }
  353. // CHECK:STDOUT:
  354. // CHECK:STDOUT: fn @G.3() {
  355. // CHECK:STDOUT: !entry:
  356. // CHECK:STDOUT: return
  357. // CHECK:STDOUT: }
  358. // CHECK:STDOUT:
  359. // CHECK:STDOUT: specific @G.1(constants.%Self.d42) {}
  360. // CHECK:STDOUT:
  361. // CHECK:STDOUT: specific @G.1(constants.%HasG.facet.085) {}
  362. // CHECK:STDOUT:
  363. // CHECK:STDOUT: specific @F.1(constants.%Self.cf3) {}
  364. // CHECK:STDOUT:
  365. // CHECK:STDOUT: specific @F.1(constants.%HasF.facet) {}
  366. // CHECK:STDOUT:
  367. // CHECK:STDOUT: specific @G.1(constants.%HasG.facet.6fc) {}
  368. // CHECK:STDOUT:
  369. // CHECK:STDOUT: --- use_cf.carbon
  370. // CHECK:STDOUT:
  371. // CHECK:STDOUT: constants {
  372. // CHECK:STDOUT: %C: type = class_type @C [template]
  373. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  374. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  375. // CHECK:STDOUT: %TestCF.type: type = fn_type @TestCF [template]
  376. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  377. // CHECK:STDOUT: %TestCF: %TestCF.type = struct_value () [template]
  378. // CHECK:STDOUT: %HasF.type: type = facet_type <@HasF> [template]
  379. // CHECK:STDOUT: %Self: %HasF.type = bind_symbolic_name Self, 0 [symbolic]
  380. // CHECK:STDOUT: %HasF.assoc_type: type = assoc_entity_type %HasF.type [template]
  381. // CHECK:STDOUT: %assoc0: %HasF.assoc_type = assoc_entity element0, imports.%PackageA.import_ref.ab2 [template]
  382. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (imports.%PackageA.import_ref.148) [template]
  383. // CHECK:STDOUT: %F.type.dbc: type = fn_type @F.1 [template]
  384. // CHECK:STDOUT: %HasF.facet: %HasF.type = facet_value %C, %impl_witness [template]
  385. // CHECK:STDOUT: %.e6d: type = fn_type_with_self_type %F.type.dbc, %HasF.facet [template]
  386. // CHECK:STDOUT: %F.type.4e3: type = fn_type @F.2 [template]
  387. // CHECK:STDOUT: %F.857: %F.type.4e3 = struct_value () [template]
  388. // CHECK:STDOUT: }
  389. // CHECK:STDOUT:
  390. // CHECK:STDOUT: imports {
  391. // CHECK:STDOUT: %PackageA: <namespace> = namespace file.%PackageA.import, [template] {
  392. // CHECK:STDOUT: .C = %PackageA.C
  393. // CHECK:STDOUT: .HasF = %PackageA.HasF
  394. // CHECK:STDOUT: import PackageA//default
  395. // CHECK:STDOUT: }
  396. // CHECK:STDOUT: %PackageA.C: type = import_ref PackageA//default, C, loaded [template = constants.%C]
  397. // CHECK:STDOUT: %PackageA.import_ref.8f2: <witness> = import_ref PackageA//default, loc8_10, loaded [template = constants.%complete_type]
  398. // CHECK:STDOUT: %PackageA.import_ref.2c4 = import_ref PackageA//default, inst25 [no loc], unloaded
  399. // CHECK:STDOUT: %PackageA.HasF: type = import_ref PackageA//default, HasF, loaded [template = constants.%HasF.type]
  400. // CHECK:STDOUT: %PackageA.import_ref.28c = import_ref PackageA//default, inst15 [no loc], unloaded
  401. // CHECK:STDOUT: %PackageA.import_ref.566: %HasF.assoc_type = import_ref PackageA//default, loc5_9, loaded [template = constants.%assoc0]
  402. // CHECK:STDOUT: %PackageA.F = import_ref PackageA//default, F, unloaded
  403. // CHECK:STDOUT: %PackageA.import_ref.a71: <witness> = import_ref PackageA//default, loc11_16, loaded [template = constants.%impl_witness]
  404. // CHECK:STDOUT: %PackageA.import_ref.29a: type = import_ref PackageA//default, loc11_6, loaded [template = constants.%C]
  405. // CHECK:STDOUT: %PackageA.import_ref.e8c: type = import_ref PackageA//default, loc11_11, loaded [template = constants.%HasF.type]
  406. // CHECK:STDOUT: %PackageA.import_ref.e73: %HasF.type = import_ref PackageA//default, inst15 [no loc], loaded [symbolic = constants.%Self]
  407. // CHECK:STDOUT: }
  408. // CHECK:STDOUT:
  409. // CHECK:STDOUT: file {
  410. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  411. // CHECK:STDOUT: .PackageA = imports.%PackageA
  412. // CHECK:STDOUT: .TestCF = %TestCF.decl
  413. // CHECK:STDOUT: }
  414. // CHECK:STDOUT: %PackageA.import = import PackageA
  415. // CHECK:STDOUT: %TestCF.decl: %TestCF.type = fn_decl @TestCF [template = constants.%TestCF] {
  416. // CHECK:STDOUT: %c.patt: %C = binding_pattern c
  417. // CHECK:STDOUT: %c.param_patt: %C = value_param_pattern %c.patt, runtime_param0
  418. // CHECK:STDOUT: } {
  419. // CHECK:STDOUT: %c.param: %C = value_param runtime_param0
  420. // CHECK:STDOUT: %.loc6: type = splice_block %C.ref [template = constants.%C] {
  421. // CHECK:STDOUT: %PackageA.ref.loc6: <namespace> = name_ref PackageA, imports.%PackageA [template = imports.%PackageA]
  422. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%PackageA.C [template = constants.%C]
  423. // CHECK:STDOUT: }
  424. // CHECK:STDOUT: %c: %C = bind_name c, %c.param
  425. // CHECK:STDOUT: }
  426. // CHECK:STDOUT: }
  427. // CHECK:STDOUT:
  428. // CHECK:STDOUT: interface @HasF [from "package_a.carbon"] {
  429. // CHECK:STDOUT: !members:
  430. // CHECK:STDOUT: .Self = imports.%PackageA.import_ref.28c
  431. // CHECK:STDOUT: .F = imports.%PackageA.import_ref.566
  432. // CHECK:STDOUT: witness = (imports.%PackageA.F)
  433. // CHECK:STDOUT: }
  434. // CHECK:STDOUT:
  435. // CHECK:STDOUT: impl @impl: imports.%PackageA.import_ref.29a as imports.%PackageA.import_ref.e8c [from "package_a.carbon"] {
  436. // CHECK:STDOUT: !members:
  437. // CHECK:STDOUT: witness = imports.%PackageA.import_ref.a71
  438. // CHECK:STDOUT: }
  439. // CHECK:STDOUT:
  440. // CHECK:STDOUT: class @C [from "package_a.carbon"] {
  441. // CHECK:STDOUT: complete_type_witness = imports.%PackageA.import_ref.8f2
  442. // CHECK:STDOUT:
  443. // CHECK:STDOUT: !members:
  444. // CHECK:STDOUT: .Self = imports.%PackageA.import_ref.2c4
  445. // CHECK:STDOUT: }
  446. // CHECK:STDOUT:
  447. // CHECK:STDOUT: fn @TestCF(%c.param_patt: %C) {
  448. // CHECK:STDOUT: !entry:
  449. // CHECK:STDOUT: %c.ref: %C = name_ref c, %c
  450. // CHECK:STDOUT: %PackageA.ref.loc7: <namespace> = name_ref PackageA, imports.%PackageA [template = imports.%PackageA]
  451. // CHECK:STDOUT: %HasF.ref: type = name_ref HasF, imports.%PackageA.HasF [template = constants.%HasF.type]
  452. // CHECK:STDOUT: %F.ref: %HasF.assoc_type = name_ref F, imports.%PackageA.import_ref.566 [template = constants.%assoc0]
  453. // CHECK:STDOUT: %impl.elem0: %.e6d = impl_witness_access constants.%impl_witness, element0 [template = constants.%F.857]
  454. // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %impl.elem0()
  455. // CHECK:STDOUT: return
  456. // CHECK:STDOUT: }
  457. // CHECK:STDOUT:
  458. // CHECK:STDOUT: generic fn @F.1(imports.%PackageA.import_ref.e73: %HasF.type) [from "package_a.carbon"] {
  459. // CHECK:STDOUT: fn();
  460. // CHECK:STDOUT: }
  461. // CHECK:STDOUT:
  462. // CHECK:STDOUT: fn @F.2() [from "package_a.carbon"];
  463. // CHECK:STDOUT:
  464. // CHECK:STDOUT: specific @F.1(constants.%Self) {}
  465. // CHECK:STDOUT:
  466. // CHECK:STDOUT: --- use_df.carbon
  467. // CHECK:STDOUT:
  468. // CHECK:STDOUT: constants {
  469. // CHECK:STDOUT: %D: type = class_type @D [template]
  470. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  471. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  472. // CHECK:STDOUT: %TestDF.type: type = fn_type @TestDF [template]
  473. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  474. // CHECK:STDOUT: %TestDF: %TestDF.type = struct_value () [template]
  475. // CHECK:STDOUT: %HasF.type: type = facet_type <@HasF> [template]
  476. // CHECK:STDOUT: %Self.cf3: %HasF.type = bind_symbolic_name Self, 0 [symbolic]
  477. // CHECK:STDOUT: %HasF.assoc_type: type = assoc_entity_type %HasF.type [template]
  478. // CHECK:STDOUT: %assoc0: %HasF.assoc_type = assoc_entity element0, imports.%PackageA.import_ref.ab2 [template]
  479. // CHECK:STDOUT: %C: type = class_type @C [template]
  480. // CHECK:STDOUT: %HasG.type: type = facet_type <@HasG> [template]
  481. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (imports.%PackageB.import_ref.0cd) [template]
  482. // CHECK:STDOUT: %F.type.dbc: type = fn_type @F.1 [template]
  483. // CHECK:STDOUT: %HasF.facet: %HasF.type = facet_value %D, %impl_witness [template]
  484. // CHECK:STDOUT: %.205: type = fn_type_with_self_type %F.type.dbc, %HasF.facet [template]
  485. // CHECK:STDOUT: %F.type.394: type = fn_type @F.2 [template]
  486. // CHECK:STDOUT: %F.1fc: %F.type.394 = struct_value () [template]
  487. // CHECK:STDOUT: }
  488. // CHECK:STDOUT:
  489. // CHECK:STDOUT: imports {
  490. // CHECK:STDOUT: %PackageA: <namespace> = namespace file.%PackageA.import, [template] {
  491. // CHECK:STDOUT: .HasF = %PackageA.HasF
  492. // CHECK:STDOUT: import PackageA//default
  493. // CHECK:STDOUT: }
  494. // CHECK:STDOUT: %PackageB: <namespace> = namespace file.%PackageB.import, [template] {
  495. // CHECK:STDOUT: .D = %PackageB.D
  496. // CHECK:STDOUT: import PackageB//default
  497. // CHECK:STDOUT: }
  498. // CHECK:STDOUT: %PackageB.D: type = import_ref PackageB//default, D, loaded [template = constants.%D]
  499. // CHECK:STDOUT: %PackageB.import_ref.8f2: <witness> = import_ref PackageB//default, loc10_10, loaded [template = constants.%complete_type]
  500. // CHECK:STDOUT: %PackageB.import_ref.cab = import_ref PackageB//default, inst27 [no loc], unloaded
  501. // CHECK:STDOUT: %PackageA.HasF: type = import_ref PackageA//default, HasF, loaded [template = constants.%HasF.type]
  502. // CHECK:STDOUT: %PackageA.import_ref.28c = import_ref PackageA//default, inst15 [no loc], unloaded
  503. // CHECK:STDOUT: %PackageA.import_ref.566: %HasF.assoc_type = import_ref PackageA//default, loc5_9, loaded [template = constants.%assoc0]
  504. // CHECK:STDOUT: %PackageA.F = import_ref PackageA//default, F, unloaded
  505. // CHECK:STDOUT: %PackageA.import_ref.0e8 = import_ref PackageA//default, loc11_16, unloaded
  506. // CHECK:STDOUT: %PackageA.import_ref.8f2: <witness> = import_ref PackageA//default, loc8_10, loaded [template = constants.%complete_type]
  507. // CHECK:STDOUT: %PackageA.import_ref.2c4 = import_ref PackageA//default, inst25 [no loc], unloaded
  508. // CHECK:STDOUT: %PackageA.import_ref.29a: type = import_ref PackageA//default, loc11_6, loaded [template = constants.%C]
  509. // CHECK:STDOUT: %PackageA.import_ref.e8c: type = import_ref PackageA//default, loc11_11, loaded [template = constants.%HasF.type]
  510. // CHECK:STDOUT: %PackageB.import_ref.fa0 = import_ref PackageB//default, loc13_25, unloaded
  511. // CHECK:STDOUT: %PackageB.import_ref.5d8 = import_ref PackageB//default, inst17 [no loc], unloaded
  512. // CHECK:STDOUT: %PackageB.import_ref.ed7 = import_ref PackageB//default, loc7_9, unloaded
  513. // CHECK:STDOUT: %PackageB.G = import_ref PackageB//default, G, unloaded
  514. // CHECK:STDOUT: %PackageB.import_ref.dfb: type = import_ref PackageB//default, loc13_14, loaded [template = constants.%C]
  515. // CHECK:STDOUT: %PackageB.import_ref.cee586.1: type = import_ref PackageB//default, loc13_20, loaded [template = constants.%HasG.type]
  516. // CHECK:STDOUT: %PackageB.import_ref.f2f: <witness> = import_ref PackageB//default, loc18_25, loaded [template = constants.%impl_witness]
  517. // CHECK:STDOUT: %PackageB.import_ref.aa9f8a.1: type = import_ref PackageB//default, loc18_6, loaded [template = constants.%D]
  518. // CHECK:STDOUT: %PackageB.import_ref.831: type = import_ref PackageB//default, loc18_19, loaded [template = constants.%HasF.type]
  519. // CHECK:STDOUT: %PackageB.import_ref.231 = import_ref PackageB//default, loc23_16, unloaded
  520. // CHECK:STDOUT: %PackageB.import_ref.aa9f8a.2: type = import_ref PackageB//default, loc23_6, loaded [template = constants.%D]
  521. // CHECK:STDOUT: %PackageB.import_ref.cee586.2: type = import_ref PackageB//default, loc23_11, loaded [template = constants.%HasG.type]
  522. // CHECK:STDOUT: %PackageA.import_ref.e73: %HasF.type = import_ref PackageA//default, inst15 [no loc], loaded [symbolic = constants.%Self.cf3]
  523. // CHECK:STDOUT: }
  524. // CHECK:STDOUT:
  525. // CHECK:STDOUT: file {
  526. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  527. // CHECK:STDOUT: .PackageA = imports.%PackageA
  528. // CHECK:STDOUT: .PackageB = imports.%PackageB
  529. // CHECK:STDOUT: .TestDF = %TestDF.decl
  530. // CHECK:STDOUT: }
  531. // CHECK:STDOUT: %PackageA.import = import PackageA
  532. // CHECK:STDOUT: %PackageB.import = import PackageB
  533. // CHECK:STDOUT: %TestDF.decl: %TestDF.type = fn_decl @TestDF [template = constants.%TestDF] {
  534. // CHECK:STDOUT: %d.patt: %D = binding_pattern d
  535. // CHECK:STDOUT: %d.param_patt: %D = value_param_pattern %d.patt, runtime_param0
  536. // CHECK:STDOUT: } {
  537. // CHECK:STDOUT: %d.param: %D = value_param runtime_param0
  538. // CHECK:STDOUT: %.loc7: type = splice_block %D.ref [template = constants.%D] {
  539. // CHECK:STDOUT: %PackageB.ref: <namespace> = name_ref PackageB, imports.%PackageB [template = imports.%PackageB]
  540. // CHECK:STDOUT: %D.ref: type = name_ref D, imports.%PackageB.D [template = constants.%D]
  541. // CHECK:STDOUT: }
  542. // CHECK:STDOUT: %d: %D = bind_name d, %d.param
  543. // CHECK:STDOUT: }
  544. // CHECK:STDOUT: }
  545. // CHECK:STDOUT:
  546. // CHECK:STDOUT: interface @HasF [from "package_a.carbon"] {
  547. // CHECK:STDOUT: !members:
  548. // CHECK:STDOUT: .Self = imports.%PackageA.import_ref.28c
  549. // CHECK:STDOUT: .F = imports.%PackageA.import_ref.566
  550. // CHECK:STDOUT: witness = (imports.%PackageA.F)
  551. // CHECK:STDOUT: }
  552. // CHECK:STDOUT:
  553. // CHECK:STDOUT: interface @HasG [from "package_b.carbon"] {
  554. // CHECK:STDOUT: !members:
  555. // CHECK:STDOUT: .Self = imports.%PackageB.import_ref.5d8
  556. // CHECK:STDOUT: .G = imports.%PackageB.import_ref.ed7
  557. // CHECK:STDOUT: witness = (imports.%PackageB.G)
  558. // CHECK:STDOUT: }
  559. // CHECK:STDOUT:
  560. // CHECK:STDOUT: impl @impl.1: imports.%PackageA.import_ref.29a as imports.%PackageA.import_ref.e8c [from "package_a.carbon"] {
  561. // CHECK:STDOUT: !members:
  562. // CHECK:STDOUT: witness = imports.%PackageA.import_ref.0e8
  563. // CHECK:STDOUT: }
  564. // CHECK:STDOUT:
  565. // CHECK:STDOUT: impl @impl.2: imports.%PackageB.import_ref.dfb as imports.%PackageB.import_ref.cee586.1 [from "package_b.carbon"] {
  566. // CHECK:STDOUT: !members:
  567. // CHECK:STDOUT: witness = imports.%PackageB.import_ref.fa0
  568. // CHECK:STDOUT: }
  569. // CHECK:STDOUT:
  570. // CHECK:STDOUT: impl @impl.3: imports.%PackageB.import_ref.aa9f8a.1 as imports.%PackageB.import_ref.831 [from "package_b.carbon"] {
  571. // CHECK:STDOUT: !members:
  572. // CHECK:STDOUT: witness = imports.%PackageB.import_ref.f2f
  573. // CHECK:STDOUT: }
  574. // CHECK:STDOUT:
  575. // CHECK:STDOUT: impl @impl.4: imports.%PackageB.import_ref.aa9f8a.2 as imports.%PackageB.import_ref.cee586.2 [from "package_b.carbon"] {
  576. // CHECK:STDOUT: !members:
  577. // CHECK:STDOUT: witness = imports.%PackageB.import_ref.231
  578. // CHECK:STDOUT: }
  579. // CHECK:STDOUT:
  580. // CHECK:STDOUT: class @D [from "package_b.carbon"] {
  581. // CHECK:STDOUT: complete_type_witness = imports.%PackageB.import_ref.8f2
  582. // CHECK:STDOUT:
  583. // CHECK:STDOUT: !members:
  584. // CHECK:STDOUT: .Self = imports.%PackageB.import_ref.cab
  585. // CHECK:STDOUT: }
  586. // CHECK:STDOUT:
  587. // CHECK:STDOUT: class @C [from "package_a.carbon"] {
  588. // CHECK:STDOUT: complete_type_witness = imports.%PackageA.import_ref.8f2
  589. // CHECK:STDOUT:
  590. // CHECK:STDOUT: !members:
  591. // CHECK:STDOUT: .Self = imports.%PackageA.import_ref.2c4
  592. // CHECK:STDOUT: }
  593. // CHECK:STDOUT:
  594. // CHECK:STDOUT: fn @TestDF(%d.param_patt: %D) {
  595. // CHECK:STDOUT: !entry:
  596. // CHECK:STDOUT: %d.ref: %D = name_ref d, %d
  597. // CHECK:STDOUT: %PackageA.ref: <namespace> = name_ref PackageA, imports.%PackageA [template = imports.%PackageA]
  598. // CHECK:STDOUT: %HasF.ref: type = name_ref HasF, imports.%PackageA.HasF [template = constants.%HasF.type]
  599. // CHECK:STDOUT: %F.ref: %HasF.assoc_type = name_ref F, imports.%PackageA.import_ref.566 [template = constants.%assoc0]
  600. // CHECK:STDOUT: %impl.elem0: %.205 = impl_witness_access constants.%impl_witness, element0 [template = constants.%F.1fc]
  601. // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %impl.elem0()
  602. // CHECK:STDOUT: return
  603. // CHECK:STDOUT: }
  604. // CHECK:STDOUT:
  605. // CHECK:STDOUT: generic fn @F.1(imports.%PackageA.import_ref.e73: %HasF.type) [from "package_a.carbon"] {
  606. // CHECK:STDOUT: fn();
  607. // CHECK:STDOUT: }
  608. // CHECK:STDOUT:
  609. // CHECK:STDOUT: fn @F.2() [from "package_b.carbon"];
  610. // CHECK:STDOUT:
  611. // CHECK:STDOUT: specific @F.1(constants.%Self.cf3) {}
  612. // CHECK:STDOUT:
  613. // CHECK:STDOUT: --- use_cg.carbon
  614. // CHECK:STDOUT:
  615. // CHECK:STDOUT: constants {
  616. // CHECK:STDOUT: %C: type = class_type @C [template]
  617. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  618. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  619. // CHECK:STDOUT: %TestCG.type: type = fn_type @TestCG [template]
  620. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  621. // CHECK:STDOUT: %TestCG: %TestCG.type = struct_value () [template]
  622. // CHECK:STDOUT: %HasG.type: type = facet_type <@HasG> [template]
  623. // CHECK:STDOUT: %Self.fcb: %HasG.type = bind_symbolic_name Self, 0 [symbolic]
  624. // CHECK:STDOUT: %HasG.assoc_type: type = assoc_entity_type %HasG.type [template]
  625. // CHECK:STDOUT: %assoc0: %HasG.assoc_type = assoc_entity element0, imports.%PackageB.import_ref.70a [template]
  626. // CHECK:STDOUT: %HasF.type: type = facet_type <@HasF> [template]
  627. // CHECK:STDOUT: %D: type = class_type @D [template]
  628. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (imports.%PackageB.import_ref.9ec) [template]
  629. // CHECK:STDOUT: %G.type.d9e: type = fn_type @G.1 [template]
  630. // CHECK:STDOUT: %HasG.facet: %HasG.type = facet_value %C, %impl_witness [template]
  631. // CHECK:STDOUT: %.25a: type = fn_type_with_self_type %G.type.d9e, %HasG.facet [template]
  632. // CHECK:STDOUT: %G.type.18e: type = fn_type @G.2 [template]
  633. // CHECK:STDOUT: %G.dbb: %G.type.18e = struct_value () [template]
  634. // CHECK:STDOUT: }
  635. // CHECK:STDOUT:
  636. // CHECK:STDOUT: imports {
  637. // CHECK:STDOUT: %PackageA: <namespace> = namespace file.%PackageA.import, [template] {
  638. // CHECK:STDOUT: .C = %PackageA.C
  639. // CHECK:STDOUT: import PackageA//default
  640. // CHECK:STDOUT: }
  641. // CHECK:STDOUT: %PackageB: <namespace> = namespace file.%PackageB.import, [template] {
  642. // CHECK:STDOUT: .HasG = %PackageB.HasG
  643. // CHECK:STDOUT: import PackageB//default
  644. // CHECK:STDOUT: }
  645. // CHECK:STDOUT: %PackageA.C: type = import_ref PackageA//default, C, loaded [template = constants.%C]
  646. // CHECK:STDOUT: %PackageA.import_ref.8f2: <witness> = import_ref PackageA//default, loc8_10, loaded [template = constants.%complete_type]
  647. // CHECK:STDOUT: %PackageA.import_ref.2c4 = import_ref PackageA//default, inst25 [no loc], unloaded
  648. // CHECK:STDOUT: %PackageB.HasG: type = import_ref PackageB//default, HasG, loaded [template = constants.%HasG.type]
  649. // CHECK:STDOUT: %PackageB.import_ref.5d8 = import_ref PackageB//default, inst17 [no loc], unloaded
  650. // CHECK:STDOUT: %PackageB.import_ref.604: %HasG.assoc_type = import_ref PackageB//default, loc7_9, loaded [template = constants.%assoc0]
  651. // CHECK:STDOUT: %PackageB.G = import_ref PackageB//default, G, unloaded
  652. // CHECK:STDOUT: %PackageA.import_ref.0e8 = import_ref PackageA//default, loc11_16, unloaded
  653. // CHECK:STDOUT: %PackageA.import_ref.28c = import_ref PackageA//default, inst15 [no loc], unloaded
  654. // CHECK:STDOUT: %PackageA.import_ref.a2a = import_ref PackageA//default, loc5_9, unloaded
  655. // CHECK:STDOUT: %PackageA.F = import_ref PackageA//default, F, unloaded
  656. // CHECK:STDOUT: %PackageA.import_ref.29a: type = import_ref PackageA//default, loc11_6, loaded [template = constants.%C]
  657. // CHECK:STDOUT: %PackageA.import_ref.e8c: type = import_ref PackageA//default, loc11_11, loaded [template = constants.%HasF.type]
  658. // CHECK:STDOUT: %PackageB.import_ref.5d9: <witness> = import_ref PackageB//default, loc13_25, loaded [template = constants.%impl_witness]
  659. // CHECK:STDOUT: %PackageB.import_ref.dfb: type = import_ref PackageB//default, loc13_14, loaded [template = constants.%C]
  660. // CHECK:STDOUT: %PackageB.import_ref.cee586.1: type = import_ref PackageB//default, loc13_20, loaded [template = constants.%HasG.type]
  661. // CHECK:STDOUT: %PackageB.import_ref.7db = import_ref PackageB//default, loc18_25, unloaded
  662. // CHECK:STDOUT: %PackageB.import_ref.8f2: <witness> = import_ref PackageB//default, loc10_10, loaded [template = constants.%complete_type]
  663. // CHECK:STDOUT: %PackageB.import_ref.cab = import_ref PackageB//default, inst27 [no loc], unloaded
  664. // CHECK:STDOUT: %PackageB.import_ref.aa9f8a.1: type = import_ref PackageB//default, loc18_6, loaded [template = constants.%D]
  665. // CHECK:STDOUT: %PackageB.import_ref.831: type = import_ref PackageB//default, loc18_19, loaded [template = constants.%HasF.type]
  666. // CHECK:STDOUT: %PackageB.import_ref.231 = import_ref PackageB//default, loc23_16, unloaded
  667. // CHECK:STDOUT: %PackageB.import_ref.aa9f8a.2: type = import_ref PackageB//default, loc23_6, loaded [template = constants.%D]
  668. // CHECK:STDOUT: %PackageB.import_ref.cee586.2: type = import_ref PackageB//default, loc23_11, loaded [template = constants.%HasG.type]
  669. // CHECK:STDOUT: %PackageB.import_ref.ef5: %HasG.type = import_ref PackageB//default, inst17 [no loc], loaded [symbolic = constants.%Self.fcb]
  670. // CHECK:STDOUT: }
  671. // CHECK:STDOUT:
  672. // CHECK:STDOUT: file {
  673. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  674. // CHECK:STDOUT: .PackageA = imports.%PackageA
  675. // CHECK:STDOUT: .PackageB = imports.%PackageB
  676. // CHECK:STDOUT: .TestCG = %TestCG.decl
  677. // CHECK:STDOUT: }
  678. // CHECK:STDOUT: %PackageA.import = import PackageA
  679. // CHECK:STDOUT: %PackageB.import = import PackageB
  680. // CHECK:STDOUT: %TestCG.decl: %TestCG.type = fn_decl @TestCG [template = constants.%TestCG] {
  681. // CHECK:STDOUT: %c.patt: %C = binding_pattern c
  682. // CHECK:STDOUT: %c.param_patt: %C = value_param_pattern %c.patt, runtime_param0
  683. // CHECK:STDOUT: } {
  684. // CHECK:STDOUT: %c.param: %C = value_param runtime_param0
  685. // CHECK:STDOUT: %.loc7: type = splice_block %C.ref [template = constants.%C] {
  686. // CHECK:STDOUT: %PackageA.ref: <namespace> = name_ref PackageA, imports.%PackageA [template = imports.%PackageA]
  687. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%PackageA.C [template = constants.%C]
  688. // CHECK:STDOUT: }
  689. // CHECK:STDOUT: %c: %C = bind_name c, %c.param
  690. // CHECK:STDOUT: }
  691. // CHECK:STDOUT: }
  692. // CHECK:STDOUT:
  693. // CHECK:STDOUT: interface @HasG [from "package_b.carbon"] {
  694. // CHECK:STDOUT: !members:
  695. // CHECK:STDOUT: .Self = imports.%PackageB.import_ref.5d8
  696. // CHECK:STDOUT: .G = imports.%PackageB.import_ref.604
  697. // CHECK:STDOUT: witness = (imports.%PackageB.G)
  698. // CHECK:STDOUT: }
  699. // CHECK:STDOUT:
  700. // CHECK:STDOUT: interface @HasF [from "package_a.carbon"] {
  701. // CHECK:STDOUT: !members:
  702. // CHECK:STDOUT: .Self = imports.%PackageA.import_ref.28c
  703. // CHECK:STDOUT: .F = imports.%PackageA.import_ref.a2a
  704. // CHECK:STDOUT: witness = (imports.%PackageA.F)
  705. // CHECK:STDOUT: }
  706. // CHECK:STDOUT:
  707. // CHECK:STDOUT: impl @impl.1: imports.%PackageA.import_ref.29a as imports.%PackageA.import_ref.e8c [from "package_a.carbon"] {
  708. // CHECK:STDOUT: !members:
  709. // CHECK:STDOUT: witness = imports.%PackageA.import_ref.0e8
  710. // CHECK:STDOUT: }
  711. // CHECK:STDOUT:
  712. // CHECK:STDOUT: impl @impl.2: imports.%PackageB.import_ref.dfb as imports.%PackageB.import_ref.cee586.1 [from "package_b.carbon"] {
  713. // CHECK:STDOUT: !members:
  714. // CHECK:STDOUT: witness = imports.%PackageB.import_ref.5d9
  715. // CHECK:STDOUT: }
  716. // CHECK:STDOUT:
  717. // CHECK:STDOUT: impl @impl.3: imports.%PackageB.import_ref.aa9f8a.1 as imports.%PackageB.import_ref.831 [from "package_b.carbon"] {
  718. // CHECK:STDOUT: !members:
  719. // CHECK:STDOUT: witness = imports.%PackageB.import_ref.7db
  720. // CHECK:STDOUT: }
  721. // CHECK:STDOUT:
  722. // CHECK:STDOUT: impl @impl.4: imports.%PackageB.import_ref.aa9f8a.2 as imports.%PackageB.import_ref.cee586.2 [from "package_b.carbon"] {
  723. // CHECK:STDOUT: !members:
  724. // CHECK:STDOUT: witness = imports.%PackageB.import_ref.231
  725. // CHECK:STDOUT: }
  726. // CHECK:STDOUT:
  727. // CHECK:STDOUT: class @C [from "package_a.carbon"] {
  728. // CHECK:STDOUT: complete_type_witness = imports.%PackageA.import_ref.8f2
  729. // CHECK:STDOUT:
  730. // CHECK:STDOUT: !members:
  731. // CHECK:STDOUT: .Self = imports.%PackageA.import_ref.2c4
  732. // CHECK:STDOUT: }
  733. // CHECK:STDOUT:
  734. // CHECK:STDOUT: class @D [from "package_b.carbon"] {
  735. // CHECK:STDOUT: complete_type_witness = imports.%PackageB.import_ref.8f2
  736. // CHECK:STDOUT:
  737. // CHECK:STDOUT: !members:
  738. // CHECK:STDOUT: .Self = imports.%PackageB.import_ref.cab
  739. // CHECK:STDOUT: }
  740. // CHECK:STDOUT:
  741. // CHECK:STDOUT: fn @TestCG(%c.param_patt: %C) {
  742. // CHECK:STDOUT: !entry:
  743. // CHECK:STDOUT: %c.ref: %C = name_ref c, %c
  744. // CHECK:STDOUT: %PackageB.ref: <namespace> = name_ref PackageB, imports.%PackageB [template = imports.%PackageB]
  745. // CHECK:STDOUT: %HasG.ref: type = name_ref HasG, imports.%PackageB.HasG [template = constants.%HasG.type]
  746. // CHECK:STDOUT: %G.ref: %HasG.assoc_type = name_ref G, imports.%PackageB.import_ref.604 [template = constants.%assoc0]
  747. // CHECK:STDOUT: %impl.elem0: %.25a = impl_witness_access constants.%impl_witness, element0 [template = constants.%G.dbb]
  748. // CHECK:STDOUT: %G.call: init %empty_tuple.type = call %impl.elem0()
  749. // CHECK:STDOUT: return
  750. // CHECK:STDOUT: }
  751. // CHECK:STDOUT:
  752. // CHECK:STDOUT: generic fn @G.1(imports.%PackageB.import_ref.ef5: %HasG.type) [from "package_b.carbon"] {
  753. // CHECK:STDOUT: fn();
  754. // CHECK:STDOUT: }
  755. // CHECK:STDOUT:
  756. // CHECK:STDOUT: fn @G.2() [from "package_b.carbon"];
  757. // CHECK:STDOUT:
  758. // CHECK:STDOUT: specific @G.1(constants.%Self.fcb) {}
  759. // CHECK:STDOUT:
  760. // CHECK:STDOUT: --- use_dg.carbon
  761. // CHECK:STDOUT:
  762. // CHECK:STDOUT: constants {
  763. // CHECK:STDOUT: %D: type = class_type @D [template]
  764. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  765. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  766. // CHECK:STDOUT: %TestDG.type: type = fn_type @TestDG [template]
  767. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  768. // CHECK:STDOUT: %TestDG: %TestDG.type = struct_value () [template]
  769. // CHECK:STDOUT: %HasG.type: type = facet_type <@HasG> [template]
  770. // CHECK:STDOUT: %Self.fcb: %HasG.type = bind_symbolic_name Self, 0 [symbolic]
  771. // CHECK:STDOUT: %HasG.assoc_type: type = assoc_entity_type %HasG.type [template]
  772. // CHECK:STDOUT: %assoc0: %HasG.assoc_type = assoc_entity element0, imports.%PackageB.import_ref.70a [template]
  773. // CHECK:STDOUT: %C: type = class_type @C [template]
  774. // CHECK:STDOUT: %HasF.type: type = facet_type <@HasF> [template]
  775. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (imports.%PackageB.import_ref.b0a) [template]
  776. // CHECK:STDOUT: %G.type.d9e: type = fn_type @G.1 [template]
  777. // CHECK:STDOUT: %HasG.facet: %HasG.type = facet_value %D, %impl_witness [template]
  778. // CHECK:STDOUT: %.b8e: type = fn_type_with_self_type %G.type.d9e, %HasG.facet [template]
  779. // CHECK:STDOUT: %G.type.405: type = fn_type @G.2 [template]
  780. // CHECK:STDOUT: %G.703: %G.type.405 = struct_value () [template]
  781. // CHECK:STDOUT: }
  782. // CHECK:STDOUT:
  783. // CHECK:STDOUT: imports {
  784. // CHECK:STDOUT: %PackageB: <namespace> = namespace file.%PackageB.import, [template] {
  785. // CHECK:STDOUT: .D = %PackageB.D
  786. // CHECK:STDOUT: .HasG = %PackageB.HasG
  787. // CHECK:STDOUT: import PackageB//default
  788. // CHECK:STDOUT: }
  789. // CHECK:STDOUT: %PackageB.D: type = import_ref PackageB//default, D, loaded [template = constants.%D]
  790. // CHECK:STDOUT: %PackageB.import_ref.8f2: <witness> = import_ref PackageB//default, loc10_10, loaded [template = constants.%complete_type]
  791. // CHECK:STDOUT: %PackageB.import_ref.cab = import_ref PackageB//default, inst27 [no loc], unloaded
  792. // CHECK:STDOUT: %PackageB.HasG: type = import_ref PackageB//default, HasG, loaded [template = constants.%HasG.type]
  793. // CHECK:STDOUT: %PackageB.import_ref.5d8 = import_ref PackageB//default, inst17 [no loc], unloaded
  794. // CHECK:STDOUT: %PackageB.import_ref.604: %HasG.assoc_type = import_ref PackageB//default, loc7_9, loaded [template = constants.%assoc0]
  795. // CHECK:STDOUT: %PackageB.G = import_ref PackageB//default, G, unloaded
  796. // CHECK:STDOUT: %PackageB.import_ref.fa0 = import_ref PackageB//default, loc13_25, unloaded
  797. // CHECK:STDOUT: %PackageB.import_ref.8db: <witness> = import_ref PackageB//default, inst35 [indirect], loaded [template = constants.%complete_type]
  798. // CHECK:STDOUT: %PackageB.import_ref.6a9 = import_ref PackageB//default, inst36 [indirect], unloaded
  799. // CHECK:STDOUT: %PackageB.import_ref.dfb: type = import_ref PackageB//default, loc13_14, loaded [template = constants.%C]
  800. // CHECK:STDOUT: %PackageB.import_ref.cee586.1: type = import_ref PackageB//default, loc13_20, loaded [template = constants.%HasG.type]
  801. // CHECK:STDOUT: %PackageB.import_ref.7db = import_ref PackageB//default, loc18_25, unloaded
  802. // CHECK:STDOUT: %PackageB.import_ref.96f = import_ref PackageB//default, inst53 [indirect], unloaded
  803. // CHECK:STDOUT: %PackageB.import_ref.b30 = import_ref PackageB//default, inst54 [indirect], unloaded
  804. // CHECK:STDOUT: %PackageB.F = import_ref PackageB//default, F, unloaded
  805. // CHECK:STDOUT: %PackageB.import_ref.aa9f8a.1: type = import_ref PackageB//default, loc18_6, loaded [template = constants.%D]
  806. // CHECK:STDOUT: %PackageB.import_ref.831: type = import_ref PackageB//default, loc18_19, loaded [template = constants.%HasF.type]
  807. // CHECK:STDOUT: %PackageB.import_ref.240: <witness> = import_ref PackageB//default, loc23_16, loaded [template = constants.%impl_witness]
  808. // CHECK:STDOUT: %PackageB.import_ref.aa9f8a.2: type = import_ref PackageB//default, loc23_6, loaded [template = constants.%D]
  809. // CHECK:STDOUT: %PackageB.import_ref.cee586.2: type = import_ref PackageB//default, loc23_11, loaded [template = constants.%HasG.type]
  810. // CHECK:STDOUT: %PackageB.import_ref.ef5: %HasG.type = import_ref PackageB//default, inst17 [no loc], loaded [symbolic = constants.%Self.fcb]
  811. // CHECK:STDOUT: }
  812. // CHECK:STDOUT:
  813. // CHECK:STDOUT: file {
  814. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  815. // CHECK:STDOUT: .PackageB = imports.%PackageB
  816. // CHECK:STDOUT: .TestDG = %TestDG.decl
  817. // CHECK:STDOUT: }
  818. // CHECK:STDOUT: %PackageB.import = import PackageB
  819. // CHECK:STDOUT: %TestDG.decl: %TestDG.type = fn_decl @TestDG [template = constants.%TestDG] {
  820. // CHECK:STDOUT: %d.patt: %D = binding_pattern d
  821. // CHECK:STDOUT: %d.param_patt: %D = value_param_pattern %d.patt, runtime_param0
  822. // CHECK:STDOUT: } {
  823. // CHECK:STDOUT: %d.param: %D = value_param runtime_param0
  824. // CHECK:STDOUT: %.loc6: type = splice_block %D.ref [template = constants.%D] {
  825. // CHECK:STDOUT: %PackageB.ref.loc6: <namespace> = name_ref PackageB, imports.%PackageB [template = imports.%PackageB]
  826. // CHECK:STDOUT: %D.ref: type = name_ref D, imports.%PackageB.D [template = constants.%D]
  827. // CHECK:STDOUT: }
  828. // CHECK:STDOUT: %d: %D = bind_name d, %d.param
  829. // CHECK:STDOUT: }
  830. // CHECK:STDOUT: }
  831. // CHECK:STDOUT:
  832. // CHECK:STDOUT: interface @HasG [from "package_b.carbon"] {
  833. // CHECK:STDOUT: !members:
  834. // CHECK:STDOUT: .Self = imports.%PackageB.import_ref.5d8
  835. // CHECK:STDOUT: .G = imports.%PackageB.import_ref.604
  836. // CHECK:STDOUT: witness = (imports.%PackageB.G)
  837. // CHECK:STDOUT: }
  838. // CHECK:STDOUT:
  839. // CHECK:STDOUT: interface @HasF [from "package_b.carbon"] {
  840. // CHECK:STDOUT: !members:
  841. // CHECK:STDOUT: .Self = imports.%PackageB.import_ref.96f
  842. // CHECK:STDOUT: .F = imports.%PackageB.import_ref.b30
  843. // CHECK:STDOUT: witness = (imports.%PackageB.F)
  844. // CHECK:STDOUT: }
  845. // CHECK:STDOUT:
  846. // CHECK:STDOUT: impl @impl.1: imports.%PackageB.import_ref.dfb as imports.%PackageB.import_ref.cee586.1 [from "package_b.carbon"] {
  847. // CHECK:STDOUT: !members:
  848. // CHECK:STDOUT: witness = imports.%PackageB.import_ref.fa0
  849. // CHECK:STDOUT: }
  850. // CHECK:STDOUT:
  851. // CHECK:STDOUT: impl @impl.2: imports.%PackageB.import_ref.aa9f8a.1 as imports.%PackageB.import_ref.831 [from "package_b.carbon"] {
  852. // CHECK:STDOUT: !members:
  853. // CHECK:STDOUT: witness = imports.%PackageB.import_ref.7db
  854. // CHECK:STDOUT: }
  855. // CHECK:STDOUT:
  856. // CHECK:STDOUT: impl @impl.3: imports.%PackageB.import_ref.aa9f8a.2 as imports.%PackageB.import_ref.cee586.2 [from "package_b.carbon"] {
  857. // CHECK:STDOUT: !members:
  858. // CHECK:STDOUT: witness = imports.%PackageB.import_ref.240
  859. // CHECK:STDOUT: }
  860. // CHECK:STDOUT:
  861. // CHECK:STDOUT: class @D [from "package_b.carbon"] {
  862. // CHECK:STDOUT: complete_type_witness = imports.%PackageB.import_ref.8f2
  863. // CHECK:STDOUT:
  864. // CHECK:STDOUT: !members:
  865. // CHECK:STDOUT: .Self = imports.%PackageB.import_ref.cab
  866. // CHECK:STDOUT: }
  867. // CHECK:STDOUT:
  868. // CHECK:STDOUT: class @C [from "package_b.carbon"] {
  869. // CHECK:STDOUT: complete_type_witness = imports.%PackageB.import_ref.8db
  870. // CHECK:STDOUT:
  871. // CHECK:STDOUT: !members:
  872. // CHECK:STDOUT: .Self = imports.%PackageB.import_ref.6a9
  873. // CHECK:STDOUT: }
  874. // CHECK:STDOUT:
  875. // CHECK:STDOUT: fn @TestDG(%d.param_patt: %D) {
  876. // CHECK:STDOUT: !entry:
  877. // CHECK:STDOUT: %d.ref: %D = name_ref d, %d
  878. // CHECK:STDOUT: %PackageB.ref.loc7: <namespace> = name_ref PackageB, imports.%PackageB [template = imports.%PackageB]
  879. // CHECK:STDOUT: %HasG.ref: type = name_ref HasG, imports.%PackageB.HasG [template = constants.%HasG.type]
  880. // CHECK:STDOUT: %G.ref: %HasG.assoc_type = name_ref G, imports.%PackageB.import_ref.604 [template = constants.%assoc0]
  881. // CHECK:STDOUT: %impl.elem0: %.b8e = impl_witness_access constants.%impl_witness, element0 [template = constants.%G.703]
  882. // CHECK:STDOUT: %G.call: init %empty_tuple.type = call %impl.elem0()
  883. // CHECK:STDOUT: return
  884. // CHECK:STDOUT: }
  885. // CHECK:STDOUT:
  886. // CHECK:STDOUT: generic fn @G.1(imports.%PackageB.import_ref.ef5: %HasG.type) [from "package_b.carbon"] {
  887. // CHECK:STDOUT: fn();
  888. // CHECK:STDOUT: }
  889. // CHECK:STDOUT:
  890. // CHECK:STDOUT: fn @G.2() [from "package_b.carbon"];
  891. // CHECK:STDOUT:
  892. // CHECK:STDOUT: specific @G.1(constants.%Self.fcb) {}
  893. // CHECK:STDOUT:
  894. // CHECK:STDOUT: --- associated_interface.carbon
  895. // CHECK:STDOUT:
  896. // CHECK:STDOUT: constants {
  897. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [template]
  898. // CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic]
  899. // CHECK:STDOUT: %H.type.474: type = fn_type @H.1 [template]
  900. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  901. // CHECK:STDOUT: %H.c1d: %H.type.474 = struct_value () [template]
  902. // CHECK:STDOUT: %Z.assoc_type: type = assoc_entity_type %Z.type [template]
  903. // CHECK:STDOUT: %assoc0: %Z.assoc_type = assoc_entity element0, @Z.%H.decl [template]
  904. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (@impl.%H.decl) [template]
  905. // CHECK:STDOUT: %H.type.707: type = fn_type @H.2 [template]
  906. // CHECK:STDOUT: %H.8d7: %H.type.707 = struct_value () [template]
  907. // CHECK:STDOUT: %Z.facet: %Z.type = facet_value %empty_tuple.type, %impl_witness [template]
  908. // CHECK:STDOUT: }
  909. // CHECK:STDOUT:
  910. // CHECK:STDOUT: file {
  911. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  912. // CHECK:STDOUT: .Z = %Z.decl
  913. // CHECK:STDOUT: }
  914. // CHECK:STDOUT: %Z.decl: type = interface_decl @Z [template = constants.%Z.type] {} {}
  915. // CHECK:STDOUT: impl_decl @impl [template] {} {
  916. // CHECK:STDOUT: %.loc8_7.1: %empty_tuple.type = tuple_literal ()
  917. // CHECK:STDOUT: %.loc8_7.2: type = converted %.loc8_7.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type]
  918. // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [template = constants.%Z.type]
  919. // CHECK:STDOUT: }
  920. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (@impl.%H.decl) [template = constants.%impl_witness]
  921. // CHECK:STDOUT: }
  922. // CHECK:STDOUT:
  923. // CHECK:STDOUT: interface @Z {
  924. // CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  925. // CHECK:STDOUT: %H.decl: %H.type.474 = fn_decl @H.1 [template = constants.%H.c1d] {} {}
  926. // CHECK:STDOUT: %assoc0: %Z.assoc_type = assoc_entity element0, %H.decl [template = constants.%assoc0]
  927. // CHECK:STDOUT:
  928. // CHECK:STDOUT: !members:
  929. // CHECK:STDOUT: .Self = %Self
  930. // CHECK:STDOUT: .H = %assoc0
  931. // CHECK:STDOUT: witness = (%H.decl)
  932. // CHECK:STDOUT: }
  933. // CHECK:STDOUT:
  934. // CHECK:STDOUT: impl @impl: %.loc8_7.2 as %Z.ref {
  935. // CHECK:STDOUT: %H.decl: %H.type.707 = fn_decl @H.2 [template = constants.%H.8d7] {} {}
  936. // CHECK:STDOUT:
  937. // CHECK:STDOUT: !members:
  938. // CHECK:STDOUT: .H = %H.decl
  939. // CHECK:STDOUT: witness = file.%impl_witness
  940. // CHECK:STDOUT: }
  941. // CHECK:STDOUT:
  942. // CHECK:STDOUT: generic fn @H.1(@Z.%Self: %Z.type) {
  943. // CHECK:STDOUT: fn();
  944. // CHECK:STDOUT: }
  945. // CHECK:STDOUT:
  946. // CHECK:STDOUT: fn @H.2() {
  947. // CHECK:STDOUT: !entry:
  948. // CHECK:STDOUT: return
  949. // CHECK:STDOUT: }
  950. // CHECK:STDOUT:
  951. // CHECK:STDOUT: specific @H.1(constants.%Self) {}
  952. // CHECK:STDOUT:
  953. // CHECK:STDOUT: specific @H.1(constants.%Z.facet) {}
  954. // CHECK:STDOUT:
  955. // CHECK:STDOUT: --- import_associated_interface.carbon
  956. // CHECK:STDOUT:
  957. // CHECK:STDOUT: constants {
  958. // CHECK:STDOUT: %J.type: type = fn_type @J [template]
  959. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  960. // CHECK:STDOUT: %J: %J.type = struct_value () [template]
  961. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [template]
  962. // CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic]
  963. // CHECK:STDOUT: %Z.assoc_type: type = assoc_entity_type %Z.type [template]
  964. // CHECK:STDOUT: %assoc0: %Z.assoc_type = assoc_entity element0, imports.%PackageAssociatedInterface.import_ref.250 [template]
  965. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (imports.%PackageAssociatedInterface.import_ref.6d7) [template]
  966. // CHECK:STDOUT: %H.type.386: type = fn_type @H.1 [template]
  967. // CHECK:STDOUT: %Z.facet: %Z.type = facet_value %empty_tuple.type, %impl_witness [template]
  968. // CHECK:STDOUT: %.a8b: type = fn_type_with_self_type %H.type.386, %Z.facet [template]
  969. // CHECK:STDOUT: %H.type.ab3: type = fn_type @H.2 [template]
  970. // CHECK:STDOUT: %H.c25: %H.type.ab3 = struct_value () [template]
  971. // CHECK:STDOUT: }
  972. // CHECK:STDOUT:
  973. // CHECK:STDOUT: imports {
  974. // CHECK:STDOUT: %PackageAssociatedInterface: <namespace> = namespace file.%PackageAssociatedInterface.import, [template] {
  975. // CHECK:STDOUT: .Z = %PackageAssociatedInterface.Z
  976. // CHECK:STDOUT: import PackageAssociatedInterface//default
  977. // CHECK:STDOUT: }
  978. // CHECK:STDOUT: %PackageAssociatedInterface.Z: type = import_ref PackageAssociatedInterface//default, Z, loaded [template = constants.%Z.type]
  979. // CHECK:STDOUT: %PackageAssociatedInterface.import_ref.f88 = import_ref PackageAssociatedInterface//default, inst15 [no loc], unloaded
  980. // CHECK:STDOUT: %PackageAssociatedInterface.import_ref.ddc: %Z.assoc_type = import_ref PackageAssociatedInterface//default, loc5_9, loaded [template = constants.%assoc0]
  981. // CHECK:STDOUT: %PackageAssociatedInterface.H = import_ref PackageAssociatedInterface//default, H, unloaded
  982. // CHECK:STDOUT: %PackageAssociatedInterface.import_ref.998: <witness> = import_ref PackageAssociatedInterface//default, loc8_14, loaded [template = constants.%impl_witness]
  983. // CHECK:STDOUT: %PackageAssociatedInterface.import_ref.e5c: type = import_ref PackageAssociatedInterface//default, loc8_7, loaded [template = constants.%empty_tuple.type]
  984. // CHECK:STDOUT: %PackageAssociatedInterface.import_ref.df1: type = import_ref PackageAssociatedInterface//default, loc8_12, loaded [template = constants.%Z.type]
  985. // CHECK:STDOUT: %PackageAssociatedInterface.import_ref.d26: %Z.type = import_ref PackageAssociatedInterface//default, inst15 [no loc], loaded [symbolic = constants.%Self]
  986. // CHECK:STDOUT: }
  987. // CHECK:STDOUT:
  988. // CHECK:STDOUT: file {
  989. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  990. // CHECK:STDOUT: .PackageAssociatedInterface = imports.%PackageAssociatedInterface
  991. // CHECK:STDOUT: .J = %J.decl
  992. // CHECK:STDOUT: }
  993. // CHECK:STDOUT: %PackageAssociatedInterface.import = import PackageAssociatedInterface
  994. // CHECK:STDOUT: %J.decl: %J.type = fn_decl @J [template = constants.%J] {} {}
  995. // CHECK:STDOUT: }
  996. // CHECK:STDOUT:
  997. // CHECK:STDOUT: interface @Z [from "associated_interface.carbon"] {
  998. // CHECK:STDOUT: !members:
  999. // CHECK:STDOUT: .Self = imports.%PackageAssociatedInterface.import_ref.f88
  1000. // CHECK:STDOUT: .H = imports.%PackageAssociatedInterface.import_ref.ddc
  1001. // CHECK:STDOUT: witness = (imports.%PackageAssociatedInterface.H)
  1002. // CHECK:STDOUT: }
  1003. // CHECK:STDOUT:
  1004. // CHECK:STDOUT: impl @impl: imports.%PackageAssociatedInterface.import_ref.e5c as imports.%PackageAssociatedInterface.import_ref.df1 [from "associated_interface.carbon"] {
  1005. // CHECK:STDOUT: !members:
  1006. // CHECK:STDOUT: witness = imports.%PackageAssociatedInterface.import_ref.998
  1007. // CHECK:STDOUT: }
  1008. // CHECK:STDOUT:
  1009. // CHECK:STDOUT: fn @J() {
  1010. // CHECK:STDOUT: !entry:
  1011. // CHECK:STDOUT: %.loc7: %empty_tuple.type = tuple_literal ()
  1012. // CHECK:STDOUT: %PackageAssociatedInterface.ref: <namespace> = name_ref PackageAssociatedInterface, imports.%PackageAssociatedInterface [template = imports.%PackageAssociatedInterface]
  1013. // CHECK:STDOUT: %Z.ref: type = name_ref Z, imports.%PackageAssociatedInterface.Z [template = constants.%Z.type]
  1014. // CHECK:STDOUT: %H.ref: %Z.assoc_type = name_ref H, imports.%PackageAssociatedInterface.import_ref.ddc [template = constants.%assoc0]
  1015. // CHECK:STDOUT: %impl.elem0: %.a8b = impl_witness_access constants.%impl_witness, element0 [template = constants.%H.c25]
  1016. // CHECK:STDOUT: %H.call: init %empty_tuple.type = call %impl.elem0()
  1017. // CHECK:STDOUT: return
  1018. // CHECK:STDOUT: }
  1019. // CHECK:STDOUT:
  1020. // CHECK:STDOUT: generic fn @H.1(imports.%PackageAssociatedInterface.import_ref.d26: %Z.type) [from "associated_interface.carbon"] {
  1021. // CHECK:STDOUT: fn();
  1022. // CHECK:STDOUT: }
  1023. // CHECK:STDOUT:
  1024. // CHECK:STDOUT: fn @H.2() [from "associated_interface.carbon"];
  1025. // CHECK:STDOUT:
  1026. // CHECK:STDOUT: specific @H.1(constants.%Self) {}
  1027. // CHECK:STDOUT:
  1028. // CHECK:STDOUT: --- has_param.carbon
  1029. // CHECK:STDOUT:
  1030. // CHECK:STDOUT: constants {
  1031. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  1032. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  1033. // CHECK:STDOUT: %X: %T = bind_symbolic_name X, 1 [symbolic]
  1034. // CHECK:STDOUT: %X.patt: %T = symbolic_binding_pattern X, 1 [symbolic]
  1035. // CHECK:STDOUT: %AnyParam.type: type = generic_class_type @AnyParam [template]
  1036. // CHECK:STDOUT: %AnyParam.generic: %AnyParam.type = struct_value () [template]
  1037. // CHECK:STDOUT: %AnyParam: type = class_type @AnyParam, @AnyParam(%T, %X) [symbolic]
  1038. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  1039. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  1040. // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [template]
  1041. // CHECK:STDOUT: %Self: %Y.type = bind_symbolic_name Self, 0 [symbolic]
  1042. // CHECK:STDOUT: %K.type: type = fn_type @K [template]
  1043. // CHECK:STDOUT: %K: %K.type = struct_value () [template]
  1044. // CHECK:STDOUT: %Y.assoc_type: type = assoc_entity_type %Y.type [template]
  1045. // CHECK:STDOUT: %assoc0: %Y.assoc_type = assoc_entity element0, @Y.%K.decl [template]
  1046. // CHECK:STDOUT: }
  1047. // CHECK:STDOUT:
  1048. // CHECK:STDOUT: file {
  1049. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1050. // CHECK:STDOUT: .AnyParam = %AnyParam.decl
  1051. // CHECK:STDOUT: .Y = %Y.decl
  1052. // CHECK:STDOUT: }
  1053. // CHECK:STDOUT: %AnyParam.decl: %AnyParam.type = class_decl @AnyParam [template = constants.%AnyParam.generic] {
  1054. // CHECK:STDOUT: %T.patt.loc4_16.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_16.2 (constants.%T.patt)]
  1055. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc4_16.1, runtime_param<none> [symbolic = %T.patt.loc4_16.2 (constants.%T.patt)]
  1056. // CHECK:STDOUT: %X.patt.loc4_26.1: @AnyParam.%T.loc4_16.2 (%T) = symbolic_binding_pattern X, 1 [symbolic = %X.patt.loc4_26.2 (constants.%X.patt)]
  1057. // CHECK:STDOUT: %X.param_patt: @AnyParam.%T.loc4_16.2 (%T) = value_param_pattern %X.patt.loc4_26.1, runtime_param<none> [symbolic = %X.patt.loc4_26.2 (constants.%X.patt)]
  1058. // CHECK:STDOUT: } {
  1059. // CHECK:STDOUT: %T.param: type = value_param runtime_param<none>
  1060. // CHECK:STDOUT: %T.loc4_16.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc4_16.2 (constants.%T)]
  1061. // CHECK:STDOUT: %X.param: @AnyParam.%T.loc4_16.2 (%T) = value_param runtime_param<none>
  1062. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc4_16.1 [symbolic = %T.loc4_16.2 (constants.%T)]
  1063. // CHECK:STDOUT: %X.loc4_26.1: @AnyParam.%T.loc4_16.2 (%T) = bind_symbolic_name X, 1, %X.param [symbolic = %X.loc4_26.2 (constants.%X)]
  1064. // CHECK:STDOUT: }
  1065. // CHECK:STDOUT: %Y.decl: type = interface_decl @Y [template = constants.%Y.type] {} {}
  1066. // CHECK:STDOUT: }
  1067. // CHECK:STDOUT:
  1068. // CHECK:STDOUT: interface @Y {
  1069. // CHECK:STDOUT: %Self: %Y.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  1070. // CHECK:STDOUT: %K.decl: %K.type = fn_decl @K [template = constants.%K] {} {}
  1071. // CHECK:STDOUT: %assoc0: %Y.assoc_type = assoc_entity element0, %K.decl [template = constants.%assoc0]
  1072. // CHECK:STDOUT:
  1073. // CHECK:STDOUT: !members:
  1074. // CHECK:STDOUT: .Self = %Self
  1075. // CHECK:STDOUT: .K = %assoc0
  1076. // CHECK:STDOUT: witness = (%K.decl)
  1077. // CHECK:STDOUT: }
  1078. // CHECK:STDOUT:
  1079. // CHECK:STDOUT: generic class @AnyParam(%T.loc4_16.1: type, %X.loc4_26.1: @AnyParam.%T.loc4_16.2 (%T)) {
  1080. // CHECK:STDOUT: %T.loc4_16.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_16.2 (constants.%T)]
  1081. // CHECK:STDOUT: %T.patt.loc4_16.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_16.2 (constants.%T.patt)]
  1082. // CHECK:STDOUT: %X.loc4_26.2: %T = bind_symbolic_name X, 1 [symbolic = %X.loc4_26.2 (constants.%X)]
  1083. // CHECK:STDOUT: %X.patt.loc4_26.2: %T = symbolic_binding_pattern X, 1 [symbolic = %X.patt.loc4_26.2 (constants.%X.patt)]
  1084. // CHECK:STDOUT:
  1085. // CHECK:STDOUT: !definition:
  1086. // CHECK:STDOUT:
  1087. // CHECK:STDOUT: class {
  1088. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  1089. // CHECK:STDOUT: complete_type_witness = %complete_type
  1090. // CHECK:STDOUT:
  1091. // CHECK:STDOUT: !members:
  1092. // CHECK:STDOUT: .Self = constants.%AnyParam
  1093. // CHECK:STDOUT: }
  1094. // CHECK:STDOUT: }
  1095. // CHECK:STDOUT:
  1096. // CHECK:STDOUT: generic fn @K(@Y.%Self: %Y.type) {
  1097. // CHECK:STDOUT: !definition:
  1098. // CHECK:STDOUT:
  1099. // CHECK:STDOUT: fn() {
  1100. // CHECK:STDOUT: !entry:
  1101. // CHECK:STDOUT: return
  1102. // CHECK:STDOUT: }
  1103. // CHECK:STDOUT: }
  1104. // CHECK:STDOUT:
  1105. // CHECK:STDOUT: specific @AnyParam(constants.%T, constants.%X) {
  1106. // CHECK:STDOUT: %T.loc4_16.2 => constants.%T
  1107. // CHECK:STDOUT: %T.patt.loc4_16.2 => constants.%T
  1108. // CHECK:STDOUT: %X.loc4_26.2 => constants.%X
  1109. // CHECK:STDOUT: %X.patt.loc4_26.2 => constants.%X
  1110. // CHECK:STDOUT: }
  1111. // CHECK:STDOUT:
  1112. // CHECK:STDOUT: specific @K(constants.%Self) {}
  1113. // CHECK:STDOUT:
  1114. // CHECK:STDOUT: --- has_generic_interface.carbon
  1115. // CHECK:STDOUT:
  1116. // CHECK:STDOUT: constants {
  1117. // CHECK:STDOUT: %U: type = bind_symbolic_name U, 0 [symbolic]
  1118. // CHECK:STDOUT: %U.patt: type = symbolic_binding_pattern U, 0 [symbolic]
  1119. // CHECK:STDOUT: %GenericInterface.type.c92: type = generic_interface_type @GenericInterface [template]
  1120. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  1121. // CHECK:STDOUT: %GenericInterface.generic: %GenericInterface.type.c92 = struct_value () [template]
  1122. // CHECK:STDOUT: %GenericInterface.type.3fe: type = facet_type <@GenericInterface, @GenericInterface(%U)> [symbolic]
  1123. // CHECK:STDOUT: %Self.a1c: %GenericInterface.type.3fe = bind_symbolic_name Self, 1 [symbolic]
  1124. // CHECK:STDOUT: %AnyParam.type: type = generic_class_type @AnyParam [template]
  1125. // CHECK:STDOUT: %AnyParam.generic: %AnyParam.type = struct_value () [template]
  1126. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  1127. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  1128. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  1129. // CHECK:STDOUT: %X: %T = bind_symbolic_name X, 1 [symbolic]
  1130. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  1131. // CHECK:STDOUT: %X.patt.51ccc0.2: %T = symbolic_binding_pattern X, 1 [symbolic]
  1132. // CHECK:STDOUT: %AnyParam.241: type = class_type @AnyParam, @AnyParam(%GenericInterface.type.c92, %GenericInterface.generic) [template]
  1133. // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [template]
  1134. // CHECK:STDOUT: %Self.f64: %Y.type = bind_symbolic_name Self, 0 [symbolic]
  1135. // CHECK:STDOUT: %K.type.311: type = fn_type @K.1 [template]
  1136. // CHECK:STDOUT: %K.7a1: %K.type.311 = struct_value () [template]
  1137. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (@impl.%K.decl) [template]
  1138. // CHECK:STDOUT: %K.type.dcd: type = fn_type @K.2 [template]
  1139. // CHECK:STDOUT: %K.2e9: %K.type.dcd = struct_value () [template]
  1140. // CHECK:STDOUT: %Y.facet: %Y.type = facet_value %AnyParam.241, %impl_witness [template]
  1141. // CHECK:STDOUT: %L.type: type = fn_type @L [template]
  1142. // CHECK:STDOUT: %L: %L.type = struct_value () [template]
  1143. // CHECK:STDOUT: %AnyParam.val: %AnyParam.241 = struct_value () [template]
  1144. // CHECK:STDOUT: %Y.assoc_type: type = assoc_entity_type %Y.type [template]
  1145. // CHECK:STDOUT: %assoc0: %Y.assoc_type = assoc_entity element0, imports.%PackageHasParam.import_ref.ce2 [template]
  1146. // CHECK:STDOUT: %.572: type = fn_type_with_self_type %K.type.311, %Y.facet [template]
  1147. // CHECK:STDOUT: }
  1148. // CHECK:STDOUT:
  1149. // CHECK:STDOUT: imports {
  1150. // CHECK:STDOUT: %PackageHasParam: <namespace> = namespace file.%PackageHasParam.import, [template] {
  1151. // CHECK:STDOUT: .AnyParam = %PackageHasParam.AnyParam
  1152. // CHECK:STDOUT: .Y = %PackageHasParam.Y
  1153. // CHECK:STDOUT: import PackageHasParam//default
  1154. // CHECK:STDOUT: }
  1155. // CHECK:STDOUT: %PackageHasParam.AnyParam: %AnyParam.type = import_ref PackageHasParam//default, AnyParam, loaded [template = constants.%AnyParam.generic]
  1156. // CHECK:STDOUT: %PackageHasParam.import_ref.f6b: type = import_ref PackageHasParam//default, loc4_16, loaded [symbolic = @AnyParam.%T (constants.%T)]
  1157. // CHECK:STDOUT: %PackageHasParam.import_ref.e96: @AnyParam.%T (%T) = import_ref PackageHasParam//default, loc4_26, loaded [symbolic = @AnyParam.%X (constants.%X)]
  1158. // CHECK:STDOUT: %PackageHasParam.import_ref.8f2: <witness> = import_ref PackageHasParam//default, loc4_34, loaded [template = constants.%complete_type]
  1159. // CHECK:STDOUT: %PackageHasParam.import_ref.601 = import_ref PackageHasParam//default, inst34 [no loc], unloaded
  1160. // CHECK:STDOUT: %PackageHasParam.Y: type = import_ref PackageHasParam//default, Y, loaded [template = constants.%Y.type]
  1161. // CHECK:STDOUT: %PackageHasParam.import_ref.dc1 = import_ref PackageHasParam//default, inst40 [no loc], unloaded
  1162. // CHECK:STDOUT: %PackageHasParam.import_ref.5e7: %Y.assoc_type = import_ref PackageHasParam//default, loc7_10, loaded [template = constants.%assoc0]
  1163. // CHECK:STDOUT: %PackageHasParam.K: %K.type.311 = import_ref PackageHasParam//default, K, loaded [template = constants.%K.7a1]
  1164. // CHECK:STDOUT: %PackageHasParam.import_ref.292: %Y.type = import_ref PackageHasParam//default, inst40 [no loc], loaded [symbolic = constants.%Self.f64]
  1165. // CHECK:STDOUT: }
  1166. // CHECK:STDOUT:
  1167. // CHECK:STDOUT: file {
  1168. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1169. // CHECK:STDOUT: .PackageHasParam = imports.%PackageHasParam
  1170. // CHECK:STDOUT: .GenericInterface = %GenericInterface.decl
  1171. // CHECK:STDOUT: .L = %L.decl
  1172. // CHECK:STDOUT: }
  1173. // CHECK:STDOUT: %PackageHasParam.import = import PackageHasParam
  1174. // CHECK:STDOUT: %GenericInterface.decl: %GenericInterface.type.c92 = interface_decl @GenericInterface [template = constants.%GenericInterface.generic] {
  1175. // CHECK:STDOUT: %U.patt.loc6_28.1: type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc6_28.2 (constants.%U.patt)]
  1176. // CHECK:STDOUT: %U.param_patt: type = value_param_pattern %U.patt.loc6_28.1, runtime_param<none> [symbolic = %U.patt.loc6_28.2 (constants.%U.patt)]
  1177. // CHECK:STDOUT: } {
  1178. // CHECK:STDOUT: %U.param: type = value_param runtime_param<none>
  1179. // CHECK:STDOUT: %U.loc6_28.1: type = bind_symbolic_name U, 0, %U.param [symbolic = %U.loc6_28.2 (constants.%U)]
  1180. // CHECK:STDOUT: }
  1181. // CHECK:STDOUT: impl_decl @impl [template] {} {
  1182. // CHECK:STDOUT: %PackageHasParam.ref.loc8_6: <namespace> = name_ref PackageHasParam, imports.%PackageHasParam [template = imports.%PackageHasParam]
  1183. // CHECK:STDOUT: %AnyParam.ref: %AnyParam.type = name_ref AnyParam, imports.%PackageHasParam.AnyParam [template = constants.%AnyParam.generic]
  1184. // CHECK:STDOUT: %GenericInterface.ref: %GenericInterface.type.c92 = name_ref GenericInterface, file.%GenericInterface.decl [template = constants.%GenericInterface.generic]
  1185. // CHECK:STDOUT: %AnyParam: type = class_type @AnyParam, @AnyParam(constants.%GenericInterface.type.c92, constants.%GenericInterface.generic) [template = constants.%AnyParam.241]
  1186. // CHECK:STDOUT: %PackageHasParam.ref.loc8_52: <namespace> = name_ref PackageHasParam, imports.%PackageHasParam [template = imports.%PackageHasParam]
  1187. // CHECK:STDOUT: %Y.ref: type = name_ref Y, imports.%PackageHasParam.Y [template = constants.%Y.type]
  1188. // CHECK:STDOUT: }
  1189. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (@impl.%K.decl) [template = constants.%impl_witness]
  1190. // CHECK:STDOUT: %L.decl: %L.type = fn_decl @L [template = constants.%L] {} {}
  1191. // CHECK:STDOUT: }
  1192. // CHECK:STDOUT:
  1193. // CHECK:STDOUT: generic interface @GenericInterface(%U.loc6_28.1: type) {
  1194. // CHECK:STDOUT: %U.loc6_28.2: type = bind_symbolic_name U, 0 [symbolic = %U.loc6_28.2 (constants.%U)]
  1195. // CHECK:STDOUT: %U.patt.loc6_28.2: type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc6_28.2 (constants.%U.patt)]
  1196. // CHECK:STDOUT:
  1197. // CHECK:STDOUT: !definition:
  1198. // CHECK:STDOUT: %GenericInterface.type: type = facet_type <@GenericInterface, @GenericInterface(%U.loc6_28.2)> [symbolic = %GenericInterface.type (constants.%GenericInterface.type.3fe)]
  1199. // CHECK:STDOUT: %Self.2: %GenericInterface.type.3fe = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.a1c)]
  1200. // CHECK:STDOUT:
  1201. // CHECK:STDOUT: interface {
  1202. // CHECK:STDOUT: %Self.1: @GenericInterface.%GenericInterface.type (%GenericInterface.type.3fe) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.a1c)]
  1203. // CHECK:STDOUT:
  1204. // CHECK:STDOUT: !members:
  1205. // CHECK:STDOUT: .Self = %Self.1
  1206. // CHECK:STDOUT: witness = ()
  1207. // CHECK:STDOUT: }
  1208. // CHECK:STDOUT: }
  1209. // CHECK:STDOUT:
  1210. // CHECK:STDOUT: interface @Y [from "has_param.carbon"] {
  1211. // CHECK:STDOUT: !members:
  1212. // CHECK:STDOUT: .Self = imports.%PackageHasParam.import_ref.dc1
  1213. // CHECK:STDOUT: .K = imports.%PackageHasParam.import_ref.5e7
  1214. // CHECK:STDOUT: witness = (imports.%PackageHasParam.K)
  1215. // CHECK:STDOUT: }
  1216. // CHECK:STDOUT:
  1217. // CHECK:STDOUT: impl @impl: %AnyParam as %Y.ref {
  1218. // CHECK:STDOUT: %K.decl: %K.type.dcd = fn_decl @K.2 [template = constants.%K.2e9] {} {}
  1219. // CHECK:STDOUT:
  1220. // CHECK:STDOUT: !members:
  1221. // CHECK:STDOUT: .K = %K.decl
  1222. // CHECK:STDOUT: witness = file.%impl_witness
  1223. // CHECK:STDOUT: }
  1224. // CHECK:STDOUT:
  1225. // CHECK:STDOUT: generic class @AnyParam(imports.%PackageHasParam.import_ref.f6b: type, imports.%PackageHasParam.import_ref.e96: @AnyParam.%T (%T)) [from "has_param.carbon"] {
  1226. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  1227. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)]
  1228. // CHECK:STDOUT: %X: %T = bind_symbolic_name X, 1 [symbolic = %X (constants.%X)]
  1229. // CHECK:STDOUT: %X.patt: %T = symbolic_binding_pattern X, 1 [symbolic = %X.patt (constants.%X.patt.51ccc0.2)]
  1230. // CHECK:STDOUT:
  1231. // CHECK:STDOUT: !definition:
  1232. // CHECK:STDOUT:
  1233. // CHECK:STDOUT: class {
  1234. // CHECK:STDOUT: complete_type_witness = imports.%PackageHasParam.import_ref.8f2
  1235. // CHECK:STDOUT:
  1236. // CHECK:STDOUT: !members:
  1237. // CHECK:STDOUT: .Self = imports.%PackageHasParam.import_ref.601
  1238. // CHECK:STDOUT: }
  1239. // CHECK:STDOUT: }
  1240. // CHECK:STDOUT:
  1241. // CHECK:STDOUT: generic fn @K.1(imports.%PackageHasParam.import_ref.292: %Y.type) [from "has_param.carbon"] {
  1242. // CHECK:STDOUT: !definition:
  1243. // CHECK:STDOUT:
  1244. // CHECK:STDOUT: fn();
  1245. // CHECK:STDOUT: }
  1246. // CHECK:STDOUT:
  1247. // CHECK:STDOUT: fn @K.2() {
  1248. // CHECK:STDOUT: !entry:
  1249. // CHECK:STDOUT: return
  1250. // CHECK:STDOUT: }
  1251. // CHECK:STDOUT:
  1252. // CHECK:STDOUT: fn @L() {
  1253. // CHECK:STDOUT: !entry:
  1254. // CHECK:STDOUT: name_binding_decl {
  1255. // CHECK:STDOUT: %obj.patt: %AnyParam.241 = binding_pattern obj
  1256. // CHECK:STDOUT: %.loc13_3.1: %AnyParam.241 = var_pattern %obj.patt
  1257. // CHECK:STDOUT: }
  1258. // CHECK:STDOUT: %obj.var: ref %AnyParam.241 = var obj
  1259. // CHECK:STDOUT: %.loc13_58.1: %empty_struct_type = struct_literal ()
  1260. // CHECK:STDOUT: %.loc13_58.2: init %AnyParam.241 = class_init (), %obj.var [template = constants.%AnyParam.val]
  1261. // CHECK:STDOUT: %.loc13_3.2: init %AnyParam.241 = converted %.loc13_58.1, %.loc13_58.2 [template = constants.%AnyParam.val]
  1262. // CHECK:STDOUT: assign %obj.var, %.loc13_3.2
  1263. // CHECK:STDOUT: %.loc13_53: type = splice_block %AnyParam [template = constants.%AnyParam.241] {
  1264. // CHECK:STDOUT: %PackageHasParam.ref.loc13: <namespace> = name_ref PackageHasParam, imports.%PackageHasParam [template = imports.%PackageHasParam]
  1265. // CHECK:STDOUT: %AnyParam.ref: %AnyParam.type = name_ref AnyParam, imports.%PackageHasParam.AnyParam [template = constants.%AnyParam.generic]
  1266. // CHECK:STDOUT: %GenericInterface.ref: %GenericInterface.type.c92 = name_ref GenericInterface, file.%GenericInterface.decl [template = constants.%GenericInterface.generic]
  1267. // CHECK:STDOUT: %AnyParam: type = class_type @AnyParam, @AnyParam(constants.%GenericInterface.type.c92, constants.%GenericInterface.generic) [template = constants.%AnyParam.241]
  1268. // CHECK:STDOUT: }
  1269. // CHECK:STDOUT: %obj: ref %AnyParam.241 = bind_name obj, %obj.var
  1270. // CHECK:STDOUT: %obj.ref: ref %AnyParam.241 = name_ref obj, %obj
  1271. // CHECK:STDOUT: %PackageHasParam.ref.loc14: <namespace> = name_ref PackageHasParam, imports.%PackageHasParam [template = imports.%PackageHasParam]
  1272. // CHECK:STDOUT: %Y.ref: type = name_ref Y, imports.%PackageHasParam.Y [template = constants.%Y.type]
  1273. // CHECK:STDOUT: %K.ref: %Y.assoc_type = name_ref K, imports.%PackageHasParam.import_ref.5e7 [template = constants.%assoc0]
  1274. // CHECK:STDOUT: %impl.elem0: %.572 = impl_witness_access constants.%impl_witness, element0 [template = constants.%K.2e9]
  1275. // CHECK:STDOUT: %K.call: init %empty_tuple.type = call %impl.elem0()
  1276. // CHECK:STDOUT: return
  1277. // CHECK:STDOUT: }
  1278. // CHECK:STDOUT:
  1279. // CHECK:STDOUT: specific @GenericInterface(constants.%U) {
  1280. // CHECK:STDOUT: %U.loc6_28.2 => constants.%U
  1281. // CHECK:STDOUT: %U.patt.loc6_28.2 => constants.%U
  1282. // CHECK:STDOUT: }
  1283. // CHECK:STDOUT:
  1284. // CHECK:STDOUT: specific @GenericInterface(%U.loc6_28.2) {}
  1285. // CHECK:STDOUT:
  1286. // CHECK:STDOUT: specific @AnyParam(constants.%T, constants.%X) {
  1287. // CHECK:STDOUT: %T => constants.%T
  1288. // CHECK:STDOUT: %T.patt => constants.%T
  1289. // CHECK:STDOUT: %X => constants.%X
  1290. // CHECK:STDOUT: %X.patt => constants.%X
  1291. // CHECK:STDOUT: }
  1292. // CHECK:STDOUT:
  1293. // CHECK:STDOUT: specific @AnyParam(constants.%GenericInterface.type.c92, constants.%GenericInterface.generic) {
  1294. // CHECK:STDOUT: %T => constants.%GenericInterface.type.c92
  1295. // CHECK:STDOUT: %T.patt => constants.%GenericInterface.type.c92
  1296. // CHECK:STDOUT: %X => constants.%GenericInterface.generic
  1297. // CHECK:STDOUT: %X.patt => constants.%GenericInterface.generic
  1298. // CHECK:STDOUT:
  1299. // CHECK:STDOUT: !definition:
  1300. // CHECK:STDOUT: }
  1301. // CHECK:STDOUT:
  1302. // CHECK:STDOUT: specific @K.1(constants.%Self.f64) {}
  1303. // CHECK:STDOUT:
  1304. // CHECK:STDOUT: specific @K.1(constants.%Y.facet) {}
  1305. // CHECK:STDOUT:
  1306. // CHECK:STDOUT: --- use_generic_interface_as_param.carbon
  1307. // CHECK:STDOUT:
  1308. // CHECK:STDOUT: constants {
  1309. // CHECK:STDOUT: %M.type: type = fn_type @M [template]
  1310. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  1311. // CHECK:STDOUT: %M: %M.type = struct_value () [template]
  1312. // CHECK:STDOUT: %AnyParam.type: type = generic_class_type @AnyParam [template]
  1313. // CHECK:STDOUT: %AnyParam.generic: %AnyParam.type = struct_value () [template]
  1314. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  1315. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  1316. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  1317. // CHECK:STDOUT: %X: %T = bind_symbolic_name X, 1 [symbolic]
  1318. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  1319. // CHECK:STDOUT: %X.patt.51ccc0.2: %T = symbolic_binding_pattern X, 1 [symbolic]
  1320. // CHECK:STDOUT: %GenericInterface.type.0da: type = generic_interface_type @GenericInterface [template]
  1321. // CHECK:STDOUT: %GenericInterface.generic: %GenericInterface.type.0da = struct_value () [template]
  1322. // CHECK:STDOUT: %U: type = bind_symbolic_name U, 0 [symbolic]
  1323. // CHECK:STDOUT: %GenericInterface.type.138: type = facet_type <@GenericInterface, @GenericInterface(%U)> [symbolic]
  1324. // CHECK:STDOUT: %Self.13b: %GenericInterface.type.138 = bind_symbolic_name Self, 1 [symbolic]
  1325. // CHECK:STDOUT: %U.patt: type = symbolic_binding_pattern U, 0 [symbolic]
  1326. // CHECK:STDOUT: %AnyParam.861: type = class_type @AnyParam, @AnyParam(%GenericInterface.type.0da, %GenericInterface.generic) [template]
  1327. // CHECK:STDOUT: %AnyParam.val: %AnyParam.861 = struct_value () [template]
  1328. // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [template]
  1329. // CHECK:STDOUT: %Self.f64: %Y.type = bind_symbolic_name Self, 0 [symbolic]
  1330. // CHECK:STDOUT: %Y.assoc_type: type = assoc_entity_type %Y.type [template]
  1331. // CHECK:STDOUT: %assoc0: %Y.assoc_type = assoc_entity element0, imports.%PackageHasParam.import_ref.ce2 [template]
  1332. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (imports.%PackageGenericInterface.import_ref.456) [template]
  1333. // CHECK:STDOUT: %K.type.311: type = fn_type @K.1 [template]
  1334. // CHECK:STDOUT: %Y.facet: %Y.type = facet_value %AnyParam.861, %impl_witness [template]
  1335. // CHECK:STDOUT: %.0fb: type = fn_type_with_self_type %K.type.311, %Y.facet [template]
  1336. // CHECK:STDOUT: %K.type.7f9: type = fn_type @K.2 [template]
  1337. // CHECK:STDOUT: %K.c3c: %K.type.7f9 = struct_value () [template]
  1338. // CHECK:STDOUT: }
  1339. // CHECK:STDOUT:
  1340. // CHECK:STDOUT: imports {
  1341. // CHECK:STDOUT: %PackageHasParam: <namespace> = namespace file.%PackageHasParam.import, [template] {
  1342. // CHECK:STDOUT: .AnyParam = %PackageHasParam.AnyParam
  1343. // CHECK:STDOUT: .Y = %PackageHasParam.Y
  1344. // CHECK:STDOUT: import PackageHasParam//default
  1345. // CHECK:STDOUT: }
  1346. // CHECK:STDOUT: %PackageGenericInterface: <namespace> = namespace file.%PackageGenericInterface.import, [template] {
  1347. // CHECK:STDOUT: .GenericInterface = %PackageGenericInterface.GenericInterface
  1348. // CHECK:STDOUT: import PackageGenericInterface//default
  1349. // CHECK:STDOUT: }
  1350. // CHECK:STDOUT: %PackageHasParam.AnyParam: %AnyParam.type = import_ref PackageHasParam//default, AnyParam, loaded [template = constants.%AnyParam.generic]
  1351. // CHECK:STDOUT: %PackageHasParam.import_ref.f6b: type = import_ref PackageHasParam//default, loc4_16, loaded [symbolic = @AnyParam.%T (constants.%T)]
  1352. // CHECK:STDOUT: %PackageHasParam.import_ref.e96: @AnyParam.%T (%T) = import_ref PackageHasParam//default, loc4_26, loaded [symbolic = @AnyParam.%X (constants.%X)]
  1353. // CHECK:STDOUT: %PackageHasParam.import_ref.8f2: <witness> = import_ref PackageHasParam//default, loc4_34, loaded [template = constants.%complete_type]
  1354. // CHECK:STDOUT: %PackageHasParam.import_ref.601 = import_ref PackageHasParam//default, inst34 [no loc], unloaded
  1355. // CHECK:STDOUT: %PackageGenericInterface.GenericInterface: %GenericInterface.type.0da = import_ref PackageGenericInterface//default, GenericInterface, loaded [template = constants.%GenericInterface.generic]
  1356. // CHECK:STDOUT: %PackageGenericInterface.import_ref.86d: type = import_ref PackageGenericInterface//default, loc6_28, loaded [symbolic = @GenericInterface.%U (constants.%U)]
  1357. // CHECK:STDOUT: %PackageGenericInterface.import_ref.c3b = import_ref PackageGenericInterface//default, inst28 [no loc], unloaded
  1358. // CHECK:STDOUT: %PackageHasParam.Y: type = import_ref PackageHasParam//default, Y, loaded [template = constants.%Y.type]
  1359. // CHECK:STDOUT: %PackageHasParam.import_ref.dc1 = import_ref PackageHasParam//default, inst40 [no loc], unloaded
  1360. // CHECK:STDOUT: %PackageHasParam.import_ref.5e7: %Y.assoc_type = import_ref PackageHasParam//default, loc7_10, loaded [template = constants.%assoc0]
  1361. // CHECK:STDOUT: %PackageHasParam.K = import_ref PackageHasParam//default, K, unloaded
  1362. // CHECK:STDOUT: %PackageGenericInterface.import_ref.ca8: <witness> = import_ref PackageGenericInterface//default, loc8_70, loaded [template = constants.%impl_witness]
  1363. // CHECK:STDOUT: %PackageGenericInterface.import_ref.321: type = import_ref PackageGenericInterface//default, loc8_47, loaded [template = constants.%AnyParam.861]
  1364. // CHECK:STDOUT: %PackageGenericInterface.import_ref.ca6: type = import_ref PackageGenericInterface//default, loc8_67, loaded [template = constants.%Y.type]
  1365. // CHECK:STDOUT: %PackageHasParam.import_ref.292: %Y.type = import_ref PackageHasParam//default, inst40 [no loc], loaded [symbolic = constants.%Self.f64]
  1366. // CHECK:STDOUT: }
  1367. // CHECK:STDOUT:
  1368. // CHECK:STDOUT: file {
  1369. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1370. // CHECK:STDOUT: .PackageHasParam = imports.%PackageHasParam
  1371. // CHECK:STDOUT: .PackageGenericInterface = imports.%PackageGenericInterface
  1372. // CHECK:STDOUT: .M = %M.decl
  1373. // CHECK:STDOUT: }
  1374. // CHECK:STDOUT: %PackageHasParam.import = import PackageHasParam
  1375. // CHECK:STDOUT: %PackageGenericInterface.import = import PackageGenericInterface
  1376. // CHECK:STDOUT: %M.decl: %M.type = fn_decl @M [template = constants.%M] {} {}
  1377. // CHECK:STDOUT: }
  1378. // CHECK:STDOUT:
  1379. // CHECK:STDOUT: generic interface @GenericInterface(imports.%PackageGenericInterface.import_ref.86d: type) [from "has_generic_interface.carbon"] {
  1380. // CHECK:STDOUT: %U: type = bind_symbolic_name U, 0 [symbolic = %U (constants.%U)]
  1381. // CHECK:STDOUT: %U.patt: type = symbolic_binding_pattern U, 0 [symbolic = %U.patt (constants.%U.patt)]
  1382. // CHECK:STDOUT:
  1383. // CHECK:STDOUT: !definition:
  1384. // CHECK:STDOUT: %GenericInterface.type: type = facet_type <@GenericInterface, @GenericInterface(%U)> [symbolic = %GenericInterface.type (constants.%GenericInterface.type.138)]
  1385. // CHECK:STDOUT: %Self: %GenericInterface.type.138 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.13b)]
  1386. // CHECK:STDOUT:
  1387. // CHECK:STDOUT: interface {
  1388. // CHECK:STDOUT: !members:
  1389. // CHECK:STDOUT: .Self = imports.%PackageGenericInterface.import_ref.c3b
  1390. // CHECK:STDOUT: witness = ()
  1391. // CHECK:STDOUT: }
  1392. // CHECK:STDOUT: }
  1393. // CHECK:STDOUT:
  1394. // CHECK:STDOUT: interface @Y [from "has_param.carbon"] {
  1395. // CHECK:STDOUT: !members:
  1396. // CHECK:STDOUT: .Self = imports.%PackageHasParam.import_ref.dc1
  1397. // CHECK:STDOUT: .K = imports.%PackageHasParam.import_ref.5e7
  1398. // CHECK:STDOUT: witness = (imports.%PackageHasParam.K)
  1399. // CHECK:STDOUT: }
  1400. // CHECK:STDOUT:
  1401. // CHECK:STDOUT: impl @impl: imports.%PackageGenericInterface.import_ref.321 as imports.%PackageGenericInterface.import_ref.ca6 [from "has_generic_interface.carbon"] {
  1402. // CHECK:STDOUT: !members:
  1403. // CHECK:STDOUT: witness = imports.%PackageGenericInterface.import_ref.ca8
  1404. // CHECK:STDOUT: }
  1405. // CHECK:STDOUT:
  1406. // CHECK:STDOUT: generic class @AnyParam(imports.%PackageHasParam.import_ref.f6b: type, imports.%PackageHasParam.import_ref.e96: @AnyParam.%T (%T)) [from "has_param.carbon"] {
  1407. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  1408. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)]
  1409. // CHECK:STDOUT: %X: %T = bind_symbolic_name X, 1 [symbolic = %X (constants.%X)]
  1410. // CHECK:STDOUT: %X.patt: %T = symbolic_binding_pattern X, 1 [symbolic = %X.patt (constants.%X.patt.51ccc0.2)]
  1411. // CHECK:STDOUT:
  1412. // CHECK:STDOUT: !definition:
  1413. // CHECK:STDOUT:
  1414. // CHECK:STDOUT: class {
  1415. // CHECK:STDOUT: complete_type_witness = imports.%PackageHasParam.import_ref.8f2
  1416. // CHECK:STDOUT:
  1417. // CHECK:STDOUT: !members:
  1418. // CHECK:STDOUT: .Self = imports.%PackageHasParam.import_ref.601
  1419. // CHECK:STDOUT: }
  1420. // CHECK:STDOUT: }
  1421. // CHECK:STDOUT:
  1422. // CHECK:STDOUT: fn @M() {
  1423. // CHECK:STDOUT: !entry:
  1424. // CHECK:STDOUT: name_binding_decl {
  1425. // CHECK:STDOUT: %obj.patt: %AnyParam.861 = binding_pattern obj
  1426. // CHECK:STDOUT: %.loc8_3.1: %AnyParam.861 = var_pattern %obj.patt
  1427. // CHECK:STDOUT: }
  1428. // CHECK:STDOUT: %obj.var: ref %AnyParam.861 = var obj
  1429. // CHECK:STDOUT: %.loc9_50.1: %empty_struct_type = struct_literal ()
  1430. // CHECK:STDOUT: %.loc9_50.2: init %AnyParam.861 = class_init (), %obj.var [template = constants.%AnyParam.val]
  1431. // CHECK:STDOUT: %.loc8_3.2: init %AnyParam.861 = converted %.loc9_50.1, %.loc9_50.2 [template = constants.%AnyParam.val]
  1432. // CHECK:STDOUT: assign %obj.var, %.loc8_3.2
  1433. // CHECK:STDOUT: %.loc9_45: type = splice_block %AnyParam [template = constants.%AnyParam.861] {
  1434. // CHECK:STDOUT: %PackageHasParam.ref.loc8: <namespace> = name_ref PackageHasParam, imports.%PackageHasParam [template = imports.%PackageHasParam]
  1435. // CHECK:STDOUT: %AnyParam.ref: %AnyParam.type = name_ref AnyParam, imports.%PackageHasParam.AnyParam [template = constants.%AnyParam.generic]
  1436. // CHECK:STDOUT: %PackageGenericInterface.ref: <namespace> = name_ref PackageGenericInterface, imports.%PackageGenericInterface [template = imports.%PackageGenericInterface]
  1437. // CHECK:STDOUT: %GenericInterface.ref: %GenericInterface.type.0da = name_ref GenericInterface, imports.%PackageGenericInterface.GenericInterface [template = constants.%GenericInterface.generic]
  1438. // CHECK:STDOUT: %AnyParam: type = class_type @AnyParam, @AnyParam(constants.%GenericInterface.type.0da, constants.%GenericInterface.generic) [template = constants.%AnyParam.861]
  1439. // CHECK:STDOUT: }
  1440. // CHECK:STDOUT: %obj: ref %AnyParam.861 = bind_name obj, %obj.var
  1441. // CHECK:STDOUT: %obj.ref: ref %AnyParam.861 = name_ref obj, %obj
  1442. // CHECK:STDOUT: %PackageHasParam.ref.loc10: <namespace> = name_ref PackageHasParam, imports.%PackageHasParam [template = imports.%PackageHasParam]
  1443. // CHECK:STDOUT: %Y.ref: type = name_ref Y, imports.%PackageHasParam.Y [template = constants.%Y.type]
  1444. // CHECK:STDOUT: %K.ref: %Y.assoc_type = name_ref K, imports.%PackageHasParam.import_ref.5e7 [template = constants.%assoc0]
  1445. // CHECK:STDOUT: %impl.elem0: %.0fb = impl_witness_access constants.%impl_witness, element0 [template = constants.%K.c3c]
  1446. // CHECK:STDOUT: %K.call: init %empty_tuple.type = call %impl.elem0()
  1447. // CHECK:STDOUT: return
  1448. // CHECK:STDOUT: }
  1449. // CHECK:STDOUT:
  1450. // CHECK:STDOUT: generic fn @K.1(imports.%PackageHasParam.import_ref.292: %Y.type) [from "has_param.carbon"] {
  1451. // CHECK:STDOUT: !definition:
  1452. // CHECK:STDOUT:
  1453. // CHECK:STDOUT: fn();
  1454. // CHECK:STDOUT: }
  1455. // CHECK:STDOUT:
  1456. // CHECK:STDOUT: fn @K.2() [from "has_generic_interface.carbon"];
  1457. // CHECK:STDOUT:
  1458. // CHECK:STDOUT: specific @AnyParam(constants.%T, constants.%X) {
  1459. // CHECK:STDOUT: %T => constants.%T
  1460. // CHECK:STDOUT: %T.patt => constants.%T
  1461. // CHECK:STDOUT: %X => constants.%X
  1462. // CHECK:STDOUT: %X.patt => constants.%X
  1463. // CHECK:STDOUT: }
  1464. // CHECK:STDOUT:
  1465. // CHECK:STDOUT: specific @GenericInterface(constants.%U) {
  1466. // CHECK:STDOUT: %U => constants.%U
  1467. // CHECK:STDOUT: %U.patt => constants.%U
  1468. // CHECK:STDOUT: }
  1469. // CHECK:STDOUT:
  1470. // CHECK:STDOUT: specific @GenericInterface(%U) {}
  1471. // CHECK:STDOUT:
  1472. // CHECK:STDOUT: specific @AnyParam(constants.%GenericInterface.type.0da, constants.%GenericInterface.generic) {
  1473. // CHECK:STDOUT: %T => constants.%GenericInterface.type.0da
  1474. // CHECK:STDOUT: %T.patt => constants.%GenericInterface.type.0da
  1475. // CHECK:STDOUT: %X => constants.%GenericInterface.generic
  1476. // CHECK:STDOUT: %X.patt => constants.%GenericInterface.generic
  1477. // CHECK:STDOUT:
  1478. // CHECK:STDOUT: !definition:
  1479. // CHECK:STDOUT: }
  1480. // CHECK:STDOUT:
  1481. // CHECK:STDOUT: specific @K.1(constants.%Self.f64) {}
  1482. // CHECK:STDOUT:
  1483. // CHECK:STDOUT: --- has_extra_interfaces.carbon
  1484. // CHECK:STDOUT:
  1485. // CHECK:STDOUT: constants {
  1486. // CHECK:STDOUT: %Extra1.type: type = facet_type <@Extra1> [template]
  1487. // CHECK:STDOUT: %Self.66c: %Extra1.type = bind_symbolic_name Self, 0 [symbolic]
  1488. // CHECK:STDOUT: %Extra2.type: type = facet_type <@Extra2> [template]
  1489. // CHECK:STDOUT: %Self.2ed: %Extra2.type = bind_symbolic_name Self, 0 [symbolic]
  1490. // CHECK:STDOUT: %Extra3.type: type = facet_type <@Extra3> [template]
  1491. // CHECK:STDOUT: %Self.622: %Extra3.type = bind_symbolic_name Self, 0 [symbolic]
  1492. // CHECK:STDOUT: %Extra4.type: type = facet_type <@Extra4> [template]
  1493. // CHECK:STDOUT: %Self.234: %Extra4.type = bind_symbolic_name Self, 0 [symbolic]
  1494. // CHECK:STDOUT: %Extra5.type: type = facet_type <@Extra5> [template]
  1495. // CHECK:STDOUT: %Self.d1b: %Extra5.type = bind_symbolic_name Self, 0 [symbolic]
  1496. // CHECK:STDOUT: %Extra6.type: type = facet_type <@Extra6> [template]
  1497. // CHECK:STDOUT: %Self.aeb: %Extra6.type = bind_symbolic_name Self, 0 [symbolic]
  1498. // CHECK:STDOUT: %Extra7.type: type = facet_type <@Extra7> [template]
  1499. // CHECK:STDOUT: %Self.b7e: %Extra7.type = bind_symbolic_name Self, 0 [symbolic]
  1500. // CHECK:STDOUT: %Extra8.type: type = facet_type <@Extra8> [template]
  1501. // CHECK:STDOUT: %Self.f90: %Extra8.type = bind_symbolic_name Self, 0 [symbolic]
  1502. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  1503. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  1504. // CHECK:STDOUT: %C.type: type = generic_class_type @C [template]
  1505. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [template]
  1506. // CHECK:STDOUT: %C.f2e: type = class_type @C, @C(%T) [symbolic]
  1507. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  1508. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  1509. // CHECK:STDOUT: %I.type: type = facet_type <@I> [template]
  1510. // CHECK:STDOUT: %Self.826: %I.type = bind_symbolic_name Self, 0 [symbolic]
  1511. // CHECK:STDOUT: %F.type.cf0: type = fn_type @F.1 [template]
  1512. // CHECK:STDOUT: %F.bc6: %F.type.cf0 = struct_value () [template]
  1513. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type %I.type [template]
  1514. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%F.decl [template]
  1515. // CHECK:STDOUT: %tuple.type.c53: type = tuple_type (type, type, type, type, type, type, type, type) [template]
  1516. // CHECK:STDOUT: %tuple.type.15d: type = tuple_type (%Extra1.type, %Extra2.type, %Extra3.type, %Extra4.type, %Extra5.type, %Extra6.type, %Extra7.type, %Extra8.type) [template]
  1517. // CHECK:STDOUT: %C.69b: type = class_type @C, @C(%tuple.type.15d) [template]
  1518. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (@impl.%F.decl) [template]
  1519. // CHECK:STDOUT: %F.type.06f: type = fn_type @F.2 [template]
  1520. // CHECK:STDOUT: %F.13c: %F.type.06f = struct_value () [template]
  1521. // CHECK:STDOUT: %I.facet: %I.type = facet_value %C.69b, %impl_witness [template]
  1522. // CHECK:STDOUT: }
  1523. // CHECK:STDOUT:
  1524. // CHECK:STDOUT: file {
  1525. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1526. // CHECK:STDOUT: .Extra1 = %Extra1.decl
  1527. // CHECK:STDOUT: .Extra2 = %Extra2.decl
  1528. // CHECK:STDOUT: .Extra3 = %Extra3.decl
  1529. // CHECK:STDOUT: .Extra4 = %Extra4.decl
  1530. // CHECK:STDOUT: .Extra5 = %Extra5.decl
  1531. // CHECK:STDOUT: .Extra6 = %Extra6.decl
  1532. // CHECK:STDOUT: .Extra7 = %Extra7.decl
  1533. // CHECK:STDOUT: .Extra8 = %Extra8.decl
  1534. // CHECK:STDOUT: .C = %C.decl
  1535. // CHECK:STDOUT: .I = %I.decl
  1536. // CHECK:STDOUT: }
  1537. // CHECK:STDOUT: %Extra1.decl: type = interface_decl @Extra1 [template = constants.%Extra1.type] {} {}
  1538. // CHECK:STDOUT: %Extra2.decl: type = interface_decl @Extra2 [template = constants.%Extra2.type] {} {}
  1539. // CHECK:STDOUT: %Extra3.decl: type = interface_decl @Extra3 [template = constants.%Extra3.type] {} {}
  1540. // CHECK:STDOUT: %Extra4.decl: type = interface_decl @Extra4 [template = constants.%Extra4.type] {} {}
  1541. // CHECK:STDOUT: %Extra5.decl: type = interface_decl @Extra5 [template = constants.%Extra5.type] {} {}
  1542. // CHECK:STDOUT: %Extra6.decl: type = interface_decl @Extra6 [template = constants.%Extra6.type] {} {}
  1543. // CHECK:STDOUT: %Extra7.decl: type = interface_decl @Extra7 [template = constants.%Extra7.type] {} {}
  1544. // CHECK:STDOUT: %Extra8.decl: type = interface_decl @Extra8 [template = constants.%Extra8.type] {} {}
  1545. // CHECK:STDOUT: %C.decl: %C.type = class_decl @C [template = constants.%C.generic] {
  1546. // CHECK:STDOUT: %T.patt.loc13_9.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc13_9.2 (constants.%T.patt)]
  1547. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc13_9.1, runtime_param<none> [symbolic = %T.patt.loc13_9.2 (constants.%T.patt)]
  1548. // CHECK:STDOUT: } {
  1549. // CHECK:STDOUT: %T.param: type = value_param runtime_param<none>
  1550. // CHECK:STDOUT: %T.loc13_9.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc13_9.2 (constants.%T)]
  1551. // CHECK:STDOUT: }
  1552. // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%I.type] {} {}
  1553. // CHECK:STDOUT: impl_decl @impl [template] {} {
  1554. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [template = constants.%C.generic]
  1555. // CHECK:STDOUT: %Extra1.ref: type = name_ref Extra1, file.%Extra1.decl [template = constants.%Extra1.type]
  1556. // CHECK:STDOUT: %Extra2.ref: type = name_ref Extra2, file.%Extra2.decl [template = constants.%Extra2.type]
  1557. // CHECK:STDOUT: %Extra3.ref: type = name_ref Extra3, file.%Extra3.decl [template = constants.%Extra3.type]
  1558. // CHECK:STDOUT: %Extra4.ref: type = name_ref Extra4, file.%Extra4.decl [template = constants.%Extra4.type]
  1559. // CHECK:STDOUT: %Extra5.ref: type = name_ref Extra5, file.%Extra5.decl [template = constants.%Extra5.type]
  1560. // CHECK:STDOUT: %Extra6.ref: type = name_ref Extra6, file.%Extra6.decl [template = constants.%Extra6.type]
  1561. // CHECK:STDOUT: %Extra7.ref: type = name_ref Extra7, file.%Extra7.decl [template = constants.%Extra7.type]
  1562. // CHECK:STDOUT: %Extra8.ref: type = name_ref Extra8, file.%Extra8.decl [template = constants.%Extra8.type]
  1563. // CHECK:STDOUT: %.loc16_71: %tuple.type.c53 = tuple_literal (%Extra1.ref, %Extra2.ref, %Extra3.ref, %Extra4.ref, %Extra5.ref, %Extra6.ref, %Extra7.ref, %Extra8.ref)
  1564. // CHECK:STDOUT: %.loc16_72: type = converted %.loc16_71, constants.%tuple.type.15d [template = constants.%tuple.type.15d]
  1565. // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%tuple.type.15d) [template = constants.%C.69b]
  1566. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%I.type]
  1567. // CHECK:STDOUT: }
  1568. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (@impl.%F.decl) [template = constants.%impl_witness]
  1569. // CHECK:STDOUT: }
  1570. // CHECK:STDOUT:
  1571. // CHECK:STDOUT: interface @Extra1 {
  1572. // CHECK:STDOUT: %Self: %Extra1.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.66c]
  1573. // CHECK:STDOUT:
  1574. // CHECK:STDOUT: !members:
  1575. // CHECK:STDOUT: .Self = %Self
  1576. // CHECK:STDOUT: witness = ()
  1577. // CHECK:STDOUT: }
  1578. // CHECK:STDOUT:
  1579. // CHECK:STDOUT: interface @Extra2 {
  1580. // CHECK:STDOUT: %Self: %Extra2.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.2ed]
  1581. // CHECK:STDOUT:
  1582. // CHECK:STDOUT: !members:
  1583. // CHECK:STDOUT: .Self = %Self
  1584. // CHECK:STDOUT: witness = ()
  1585. // CHECK:STDOUT: }
  1586. // CHECK:STDOUT:
  1587. // CHECK:STDOUT: interface @Extra3 {
  1588. // CHECK:STDOUT: %Self: %Extra3.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.622]
  1589. // CHECK:STDOUT:
  1590. // CHECK:STDOUT: !members:
  1591. // CHECK:STDOUT: .Self = %Self
  1592. // CHECK:STDOUT: witness = ()
  1593. // CHECK:STDOUT: }
  1594. // CHECK:STDOUT:
  1595. // CHECK:STDOUT: interface @Extra4 {
  1596. // CHECK:STDOUT: %Self: %Extra4.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.234]
  1597. // CHECK:STDOUT:
  1598. // CHECK:STDOUT: !members:
  1599. // CHECK:STDOUT: .Self = %Self
  1600. // CHECK:STDOUT: witness = ()
  1601. // CHECK:STDOUT: }
  1602. // CHECK:STDOUT:
  1603. // CHECK:STDOUT: interface @Extra5 {
  1604. // CHECK:STDOUT: %Self: %Extra5.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.d1b]
  1605. // CHECK:STDOUT:
  1606. // CHECK:STDOUT: !members:
  1607. // CHECK:STDOUT: .Self = %Self
  1608. // CHECK:STDOUT: witness = ()
  1609. // CHECK:STDOUT: }
  1610. // CHECK:STDOUT:
  1611. // CHECK:STDOUT: interface @Extra6 {
  1612. // CHECK:STDOUT: %Self: %Extra6.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.aeb]
  1613. // CHECK:STDOUT:
  1614. // CHECK:STDOUT: !members:
  1615. // CHECK:STDOUT: .Self = %Self
  1616. // CHECK:STDOUT: witness = ()
  1617. // CHECK:STDOUT: }
  1618. // CHECK:STDOUT:
  1619. // CHECK:STDOUT: interface @Extra7 {
  1620. // CHECK:STDOUT: %Self: %Extra7.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.b7e]
  1621. // CHECK:STDOUT:
  1622. // CHECK:STDOUT: !members:
  1623. // CHECK:STDOUT: .Self = %Self
  1624. // CHECK:STDOUT: witness = ()
  1625. // CHECK:STDOUT: }
  1626. // CHECK:STDOUT:
  1627. // CHECK:STDOUT: interface @Extra8 {
  1628. // CHECK:STDOUT: %Self: %Extra8.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.f90]
  1629. // CHECK:STDOUT:
  1630. // CHECK:STDOUT: !members:
  1631. // CHECK:STDOUT: .Self = %Self
  1632. // CHECK:STDOUT: witness = ()
  1633. // CHECK:STDOUT: }
  1634. // CHECK:STDOUT:
  1635. // CHECK:STDOUT: interface @I {
  1636. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.826]
  1637. // CHECK:STDOUT: %F.decl: %F.type.cf0 = fn_decl @F.1 [template = constants.%F.bc6] {} {}
  1638. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %F.decl [template = constants.%assoc0]
  1639. // CHECK:STDOUT:
  1640. // CHECK:STDOUT: !members:
  1641. // CHECK:STDOUT: .Self = %Self
  1642. // CHECK:STDOUT: .F = %assoc0
  1643. // CHECK:STDOUT: witness = (%F.decl)
  1644. // CHECK:STDOUT: }
  1645. // CHECK:STDOUT:
  1646. // CHECK:STDOUT: impl @impl: %C as %I.ref {
  1647. // CHECK:STDOUT: %F.decl: %F.type.06f = fn_decl @F.2 [template = constants.%F.13c] {} {}
  1648. // CHECK:STDOUT:
  1649. // CHECK:STDOUT: !members:
  1650. // CHECK:STDOUT: .F = %F.decl
  1651. // CHECK:STDOUT: witness = file.%impl_witness
  1652. // CHECK:STDOUT: }
  1653. // CHECK:STDOUT:
  1654. // CHECK:STDOUT: generic class @C(%T.loc13_9.1: type) {
  1655. // CHECK:STDOUT: %T.loc13_9.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc13_9.2 (constants.%T)]
  1656. // CHECK:STDOUT: %T.patt.loc13_9.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc13_9.2 (constants.%T.patt)]
  1657. // CHECK:STDOUT:
  1658. // CHECK:STDOUT: !definition:
  1659. // CHECK:STDOUT:
  1660. // CHECK:STDOUT: class {
  1661. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  1662. // CHECK:STDOUT: complete_type_witness = %complete_type
  1663. // CHECK:STDOUT:
  1664. // CHECK:STDOUT: !members:
  1665. // CHECK:STDOUT: .Self = constants.%C.f2e
  1666. // CHECK:STDOUT: }
  1667. // CHECK:STDOUT: }
  1668. // CHECK:STDOUT:
  1669. // CHECK:STDOUT: generic fn @F.1(@I.%Self: %I.type) {
  1670. // CHECK:STDOUT: fn();
  1671. // CHECK:STDOUT: }
  1672. // CHECK:STDOUT:
  1673. // CHECK:STDOUT: fn @F.2() {
  1674. // CHECK:STDOUT: !entry:
  1675. // CHECK:STDOUT: return
  1676. // CHECK:STDOUT: }
  1677. // CHECK:STDOUT:
  1678. // CHECK:STDOUT: specific @C(constants.%T) {
  1679. // CHECK:STDOUT: %T.loc13_9.2 => constants.%T
  1680. // CHECK:STDOUT: %T.patt.loc13_9.2 => constants.%T
  1681. // CHECK:STDOUT: }
  1682. // CHECK:STDOUT:
  1683. // CHECK:STDOUT: specific @F.1(constants.%Self.826) {}
  1684. // CHECK:STDOUT:
  1685. // CHECK:STDOUT: specific @C(constants.%tuple.type.15d) {
  1686. // CHECK:STDOUT: %T.loc13_9.2 => constants.%tuple.type.15d
  1687. // CHECK:STDOUT: %T.patt.loc13_9.2 => constants.%tuple.type.15d
  1688. // CHECK:STDOUT: }
  1689. // CHECK:STDOUT:
  1690. // CHECK:STDOUT: specific @F.1(constants.%I.facet) {}
  1691. // CHECK:STDOUT:
  1692. // CHECK:STDOUT: --- fail_use_has_extra_interfaces.carbon
  1693. // CHECK:STDOUT:
  1694. // CHECK:STDOUT: constants {
  1695. // CHECK:STDOUT: %C.type: type = generic_class_type @C [template]
  1696. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [template]
  1697. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  1698. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  1699. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  1700. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  1701. // CHECK:STDOUT: %C.42e: type = class_type @C, @C(type) [template]
  1702. // CHECK:STDOUT: %Test.type: type = fn_type @Test [template]
  1703. // CHECK:STDOUT: %Test: %Test.type = struct_value () [template]
  1704. // CHECK:STDOUT: %I.type: type = facet_type <@I> [template]
  1705. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type %I.type [template]
  1706. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, imports.%HasExtraInterfaces.import_ref.777 [template]
  1707. // CHECK:STDOUT: %Extra8.type: type = facet_type <@Extra8> [template]
  1708. // CHECK:STDOUT: %Extra7.type: type = facet_type <@Extra7> [template]
  1709. // CHECK:STDOUT: %Extra6.type: type = facet_type <@Extra6> [template]
  1710. // CHECK:STDOUT: %Extra5.type: type = facet_type <@Extra5> [template]
  1711. // CHECK:STDOUT: %Extra4.type: type = facet_type <@Extra4> [template]
  1712. // CHECK:STDOUT: %Extra3.type: type = facet_type <@Extra3> [template]
  1713. // CHECK:STDOUT: %Extra2.type: type = facet_type <@Extra2> [template]
  1714. // CHECK:STDOUT: %Extra1.type: type = facet_type <@Extra1> [template]
  1715. // CHECK:STDOUT: %tuple.type: type = tuple_type (%Extra1.type, %Extra2.type, %Extra3.type, %Extra4.type, %Extra5.type, %Extra6.type, %Extra7.type, %Extra8.type) [template]
  1716. // CHECK:STDOUT: %C.074: type = class_type @C, @C(%tuple.type) [template]
  1717. // CHECK:STDOUT: }
  1718. // CHECK:STDOUT:
  1719. // CHECK:STDOUT: imports {
  1720. // CHECK:STDOUT: %HasExtraInterfaces: <namespace> = namespace file.%HasExtraInterfaces.import, [template] {
  1721. // CHECK:STDOUT: .C = %HasExtraInterfaces.C
  1722. // CHECK:STDOUT: .I = %HasExtraInterfaces.I
  1723. // CHECK:STDOUT: import HasExtraInterfaces//default
  1724. // CHECK:STDOUT: }
  1725. // CHECK:STDOUT: %HasExtraInterfaces.C: %C.type = import_ref HasExtraInterfaces//default, C, loaded [template = constants.%C.generic]
  1726. // CHECK:STDOUT: %HasExtraInterfaces.import_ref.f6b: type = import_ref HasExtraInterfaces//default, loc13_9, loaded [symbolic = @C.%T (constants.%T)]
  1727. // CHECK:STDOUT: %HasExtraInterfaces.import_ref.8f2: <witness> = import_ref HasExtraInterfaces//default, loc13_20, loaded [template = constants.%complete_type]
  1728. // CHECK:STDOUT: %HasExtraInterfaces.import_ref.4c0 = import_ref HasExtraInterfaces//default, inst57 [no loc], unloaded
  1729. // CHECK:STDOUT: %HasExtraInterfaces.I: type = import_ref HasExtraInterfaces//default, I, loaded [template = constants.%I.type]
  1730. // CHECK:STDOUT: %HasExtraInterfaces.import_ref.e5d = import_ref HasExtraInterfaces//default, inst63 [no loc], unloaded
  1731. // CHECK:STDOUT: %HasExtraInterfaces.import_ref.9cd: %I.assoc_type = import_ref HasExtraInterfaces//default, loc14_21, loaded [template = constants.%assoc0]
  1732. // CHECK:STDOUT: %HasExtraInterfaces.F = import_ref HasExtraInterfaces//default, F, unloaded
  1733. // CHECK:STDOUT: %HasExtraInterfaces.import_ref.1c8 = import_ref HasExtraInterfaces//default, loc16_79, unloaded
  1734. // CHECK:STDOUT: %HasExtraInterfaces.import_ref.9c8 = import_ref HasExtraInterfaces//default, inst43 [no loc], unloaded
  1735. // CHECK:STDOUT: %HasExtraInterfaces.import_ref.dfe = import_ref HasExtraInterfaces//default, inst39 [no loc], unloaded
  1736. // CHECK:STDOUT: %HasExtraInterfaces.import_ref.6b6 = import_ref HasExtraInterfaces//default, inst35 [no loc], unloaded
  1737. // CHECK:STDOUT: %HasExtraInterfaces.import_ref.576 = import_ref HasExtraInterfaces//default, inst31 [no loc], unloaded
  1738. // CHECK:STDOUT: %HasExtraInterfaces.import_ref.0dd = import_ref HasExtraInterfaces//default, inst27 [no loc], unloaded
  1739. // CHECK:STDOUT: %HasExtraInterfaces.import_ref.f83 = import_ref HasExtraInterfaces//default, inst23 [no loc], unloaded
  1740. // CHECK:STDOUT: %HasExtraInterfaces.import_ref.975 = import_ref HasExtraInterfaces//default, inst19 [no loc], unloaded
  1741. // CHECK:STDOUT: %HasExtraInterfaces.import_ref.a3c = import_ref HasExtraInterfaces//default, inst15 [no loc], unloaded
  1742. // CHECK:STDOUT: %HasExtraInterfaces.import_ref.aa8: type = import_ref HasExtraInterfaces//default, loc16_72, loaded [template = constants.%C.074]
  1743. // CHECK:STDOUT: %HasExtraInterfaces.import_ref.301: type = import_ref HasExtraInterfaces//default, loc16_77, loaded [template = constants.%I.type]
  1744. // CHECK:STDOUT: }
  1745. // CHECK:STDOUT:
  1746. // CHECK:STDOUT: file {
  1747. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1748. // CHECK:STDOUT: .HasExtraInterfaces = imports.%HasExtraInterfaces
  1749. // CHECK:STDOUT: .Test = %Test.decl
  1750. // CHECK:STDOUT: }
  1751. // CHECK:STDOUT: %HasExtraInterfaces.import = import HasExtraInterfaces
  1752. // CHECK:STDOUT: %Test.decl: %Test.type = fn_decl @Test [template = constants.%Test] {
  1753. // CHECK:STDOUT: %c.patt: %C.42e = binding_pattern c
  1754. // CHECK:STDOUT: %c.param_patt: %C.42e = value_param_pattern %c.patt, runtime_param0
  1755. // CHECK:STDOUT: } {
  1756. // CHECK:STDOUT: %c.param: %C.42e = value_param runtime_param0
  1757. // CHECK:STDOUT: %.loc5: type = splice_block %C [template = constants.%C.42e] {
  1758. // CHECK:STDOUT: %HasExtraInterfaces.ref.loc5: <namespace> = name_ref HasExtraInterfaces, imports.%HasExtraInterfaces [template = imports.%HasExtraInterfaces]
  1759. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%HasExtraInterfaces.C [template = constants.%C.generic]
  1760. // CHECK:STDOUT: %C: type = class_type @C, @C(type) [template = constants.%C.42e]
  1761. // CHECK:STDOUT: }
  1762. // CHECK:STDOUT: %c: %C.42e = bind_name c, %c.param
  1763. // CHECK:STDOUT: }
  1764. // CHECK:STDOUT: }
  1765. // CHECK:STDOUT:
  1766. // CHECK:STDOUT: interface @I [from "has_extra_interfaces.carbon"] {
  1767. // CHECK:STDOUT: !members:
  1768. // CHECK:STDOUT: .Self = imports.%HasExtraInterfaces.import_ref.e5d
  1769. // CHECK:STDOUT: .F = imports.%HasExtraInterfaces.import_ref.9cd
  1770. // CHECK:STDOUT: witness = (imports.%HasExtraInterfaces.F)
  1771. // CHECK:STDOUT: }
  1772. // CHECK:STDOUT:
  1773. // CHECK:STDOUT: interface @Extra8 [from "has_extra_interfaces.carbon"] {
  1774. // CHECK:STDOUT: !members:
  1775. // CHECK:STDOUT: .Self = imports.%HasExtraInterfaces.import_ref.9c8
  1776. // CHECK:STDOUT: witness = ()
  1777. // CHECK:STDOUT: }
  1778. // CHECK:STDOUT:
  1779. // CHECK:STDOUT: interface @Extra7 [from "has_extra_interfaces.carbon"] {
  1780. // CHECK:STDOUT: !members:
  1781. // CHECK:STDOUT: .Self = imports.%HasExtraInterfaces.import_ref.dfe
  1782. // CHECK:STDOUT: witness = ()
  1783. // CHECK:STDOUT: }
  1784. // CHECK:STDOUT:
  1785. // CHECK:STDOUT: interface @Extra6 [from "has_extra_interfaces.carbon"] {
  1786. // CHECK:STDOUT: !members:
  1787. // CHECK:STDOUT: .Self = imports.%HasExtraInterfaces.import_ref.6b6
  1788. // CHECK:STDOUT: witness = ()
  1789. // CHECK:STDOUT: }
  1790. // CHECK:STDOUT:
  1791. // CHECK:STDOUT: interface @Extra5 [from "has_extra_interfaces.carbon"] {
  1792. // CHECK:STDOUT: !members:
  1793. // CHECK:STDOUT: .Self = imports.%HasExtraInterfaces.import_ref.576
  1794. // CHECK:STDOUT: witness = ()
  1795. // CHECK:STDOUT: }
  1796. // CHECK:STDOUT:
  1797. // CHECK:STDOUT: interface @Extra4 [from "has_extra_interfaces.carbon"] {
  1798. // CHECK:STDOUT: !members:
  1799. // CHECK:STDOUT: .Self = imports.%HasExtraInterfaces.import_ref.0dd
  1800. // CHECK:STDOUT: witness = ()
  1801. // CHECK:STDOUT: }
  1802. // CHECK:STDOUT:
  1803. // CHECK:STDOUT: interface @Extra3 [from "has_extra_interfaces.carbon"] {
  1804. // CHECK:STDOUT: !members:
  1805. // CHECK:STDOUT: .Self = imports.%HasExtraInterfaces.import_ref.f83
  1806. // CHECK:STDOUT: witness = ()
  1807. // CHECK:STDOUT: }
  1808. // CHECK:STDOUT:
  1809. // CHECK:STDOUT: interface @Extra2 [from "has_extra_interfaces.carbon"] {
  1810. // CHECK:STDOUT: !members:
  1811. // CHECK:STDOUT: .Self = imports.%HasExtraInterfaces.import_ref.975
  1812. // CHECK:STDOUT: witness = ()
  1813. // CHECK:STDOUT: }
  1814. // CHECK:STDOUT:
  1815. // CHECK:STDOUT: interface @Extra1 [from "has_extra_interfaces.carbon"] {
  1816. // CHECK:STDOUT: !members:
  1817. // CHECK:STDOUT: .Self = imports.%HasExtraInterfaces.import_ref.a3c
  1818. // CHECK:STDOUT: witness = ()
  1819. // CHECK:STDOUT: }
  1820. // CHECK:STDOUT:
  1821. // CHECK:STDOUT: impl @impl: imports.%HasExtraInterfaces.import_ref.aa8 as imports.%HasExtraInterfaces.import_ref.301 [from "has_extra_interfaces.carbon"] {
  1822. // CHECK:STDOUT: !members:
  1823. // CHECK:STDOUT: witness = imports.%HasExtraInterfaces.import_ref.1c8
  1824. // CHECK:STDOUT: }
  1825. // CHECK:STDOUT:
  1826. // CHECK:STDOUT: generic class @C(imports.%HasExtraInterfaces.import_ref.f6b: type) [from "has_extra_interfaces.carbon"] {
  1827. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  1828. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)]
  1829. // CHECK:STDOUT:
  1830. // CHECK:STDOUT: !definition:
  1831. // CHECK:STDOUT:
  1832. // CHECK:STDOUT: class {
  1833. // CHECK:STDOUT: complete_type_witness = imports.%HasExtraInterfaces.import_ref.8f2
  1834. // CHECK:STDOUT:
  1835. // CHECK:STDOUT: !members:
  1836. // CHECK:STDOUT: .Self = imports.%HasExtraInterfaces.import_ref.4c0
  1837. // CHECK:STDOUT: }
  1838. // CHECK:STDOUT: }
  1839. // CHECK:STDOUT:
  1840. // CHECK:STDOUT: fn @Test(%c.param_patt: %C.42e) {
  1841. // CHECK:STDOUT: !entry:
  1842. // CHECK:STDOUT: %c.ref: %C.42e = name_ref c, %c
  1843. // CHECK:STDOUT: %HasExtraInterfaces.ref.loc12: <namespace> = name_ref HasExtraInterfaces, imports.%HasExtraInterfaces [template = imports.%HasExtraInterfaces]
  1844. // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%HasExtraInterfaces.I [template = constants.%I.type]
  1845. // CHECK:STDOUT: %F.ref: %I.assoc_type = name_ref F, imports.%HasExtraInterfaces.import_ref.9cd [template = constants.%assoc0]
  1846. // CHECK:STDOUT: return
  1847. // CHECK:STDOUT: }
  1848. // CHECK:STDOUT:
  1849. // CHECK:STDOUT: specific @C(constants.%T) {
  1850. // CHECK:STDOUT: %T => constants.%T
  1851. // CHECK:STDOUT: %T.patt => constants.%T
  1852. // CHECK:STDOUT: }
  1853. // CHECK:STDOUT:
  1854. // CHECK:STDOUT: specific @C(type) {
  1855. // CHECK:STDOUT: %T => type
  1856. // CHECK:STDOUT: %T.patt => type
  1857. // CHECK:STDOUT:
  1858. // CHECK:STDOUT: !definition:
  1859. // CHECK:STDOUT: }
  1860. // CHECK:STDOUT:
  1861. // CHECK:STDOUT: specific @C(constants.%tuple.type) {
  1862. // CHECK:STDOUT: %T => constants.%tuple.type
  1863. // CHECK:STDOUT: %T.patt => constants.%tuple.type
  1864. // CHECK:STDOUT: }
  1865. // CHECK:STDOUT: