import.carbon 90 KB

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