import.carbon 89 KB

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