import_interface_assoc_const.carbon 102 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon
  6. // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
  7. // EXTRA-ARGS: --dump-sem-ir-ranges=if-present
  8. //
  9. // AUTOUPDATE
  10. // TIP: To test this file alone, run:
  11. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/import_interface_assoc_const.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/import_interface_assoc_const.carbon
  14. // --- interface.carbon
  15. library "[[@TEST_NAME]]";
  16. interface I { let T:! type; }
  17. interface I3 {
  18. let T1:! type;
  19. let T2:! type;
  20. let T3:! type;
  21. }
  22. interface NonType {
  23. let Y:! {.a: {}};
  24. }
  25. // --- basic.carbon
  26. library "[[@TEST_NAME]]";
  27. import library "interface";
  28. class C1 { }
  29. impl C1 as I where .T = {} { }
  30. // --- redecl.carbon
  31. library "[[@TEST_NAME]]";
  32. import library "interface";
  33. class C2 { }
  34. impl C2 as I where .T = {};
  35. impl C2 as I where .T = {} { }
  36. // --- fail_redecl_adds_rewrites.carbon
  37. library "[[@TEST_NAME]]";
  38. import library "interface";
  39. class C3 { }
  40. // CHECK:STDERR: fail_redecl_adds_rewrites.carbon:[[@LINE+4]]:1: error: impl declared but not defined [ImplMissingDefinition]
  41. // CHECK:STDERR: impl C3 as I;
  42. // CHECK:STDERR: ^~~~~~~~~~~~~
  43. // CHECK:STDERR:
  44. impl C3 as I;
  45. impl C3 as I where .T = {} { }
  46. // --- fail_mismatch.carbon
  47. library "[[@TEST_NAME]]";
  48. import library "interface";
  49. class C4 { }
  50. // CHECK:STDERR: fail_mismatch.carbon:[[@LINE+4]]:1: error: impl declared but not defined [ImplMissingDefinition]
  51. // CHECK:STDERR: impl C4 as I where .T = {};
  52. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  53. // CHECK:STDERR:
  54. impl C4 as I where .T = {};
  55. impl C4 as I where .T = () { }
  56. // --- fail_mismatch_bad_value.carbon
  57. library "[[@TEST_NAME]]";
  58. import library "interface";
  59. class C5 { }
  60. // This is testing that it won't complain about mismatching values if they
  61. // have errors.
  62. // CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+8]]:27: error: name `BAD1` not found [NameNotFound]
  63. // CHECK:STDERR: impl C5 as I3 where .T1 = BAD1 and .T2 = {.a: {}} and .T3 = BAD2;
  64. // CHECK:STDERR: ^~~~
  65. // CHECK:STDERR:
  66. // CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+4]]:61: error: name `BAD2` not found [NameNotFound]
  67. // CHECK:STDERR: impl C5 as I3 where .T1 = BAD1 and .T2 = {.a: {}} and .T3 = BAD2;
  68. // CHECK:STDERR: ^~~~
  69. // CHECK:STDERR:
  70. impl C5 as I3 where .T1 = BAD1 and .T2 = {.a: {}} and .T3 = BAD2;
  71. // CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+8]]:46: error: name `BAD3` not found [NameNotFound]
  72. // CHECK:STDERR: impl C5 as I3 where .T1 = {.b: {}} and .T2 = BAD3 and .T3 = BAD4 { }
  73. // CHECK:STDERR: ^~~~
  74. // CHECK:STDERR:
  75. // CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+4]]:61: error: name `BAD4` not found [NameNotFound]
  76. // CHECK:STDERR: impl C5 as I3 where .T1 = {.b: {}} and .T2 = BAD3 and .T3 = BAD4 { }
  77. // CHECK:STDERR: ^~~~
  78. // CHECK:STDERR:
  79. impl C5 as I3 where .T1 = {.b: {}} and .T2 = BAD3 and .T3 = BAD4 { }
  80. // --- fail_missing_on_definition.carbon
  81. library "[[@TEST_NAME]]";
  82. import library "interface";
  83. class C6 { }
  84. impl C6 as I where .T = {};
  85. // CHECK:STDERR: fail_missing_on_definition.carbon:[[@LINE+12]]:1: error: associated constant T not given a value in impl of interface I [ImplAssociatedConstantNeedsValue]
  86. // CHECK:STDERR: impl C6 as I { }
  87. // CHECK:STDERR: ^~~~~~~~~~~~~~
  88. // CHECK:STDERR: fail_missing_on_definition.carbon:[[@LINE-7]]:1: in import [InImport]
  89. // CHECK:STDERR: interface.carbon:3:19: note: associated constant declared here [AssociatedConstantHere]
  90. // CHECK:STDERR: interface I { let T:! type; }
  91. // CHECK:STDERR: ^~~~~~~~
  92. // CHECK:STDERR:
  93. // CHECK:STDERR: fail_missing_on_definition.carbon:[[@LINE-9]]:1: error: impl declared but not defined [ImplMissingDefinition]
  94. // CHECK:STDERR: impl C6 as I where .T = {};
  95. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  96. // CHECK:STDERR:
  97. impl C6 as I { }
  98. // --- fail_two_different.carbon
  99. library "[[@TEST_NAME]]";
  100. import library "interface";
  101. class C7 { }
  102. // CHECK:STDERR: fail_two_different.carbon:[[@LINE+4]]:12: error: associated constant `.(I.T)` given two different values `{}` and `()` [AssociatedConstantWithDifferentValues]
  103. // CHECK:STDERR: impl C7 as I where .T = {} and .T = () { }
  104. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  105. // CHECK:STDERR:
  106. impl C7 as I where .T = {} and .T = () { }
  107. // --- fail_two_different_first_bad.carbon
  108. library "[[@TEST_NAME]]";
  109. import library "interface";
  110. class C8 { }
  111. // CHECK:STDERR: fail_two_different_first_bad.carbon:[[@LINE+4]]:25: error: name `BAD5` not found [NameNotFound]
  112. // CHECK:STDERR: impl C8 as I where .T = BAD5 and .T = () { }
  113. // CHECK:STDERR: ^~~~
  114. // CHECK:STDERR:
  115. impl C8 as I where .T = BAD5 and .T = () { }
  116. // --- fail_two_different_second_bad.carbon
  117. library "[[@TEST_NAME]]";
  118. import library "interface";
  119. class C9 { }
  120. // CHECK:STDERR: fail_two_different_second_bad.carbon:[[@LINE+4]]:37: error: name `BAD6` not found [NameNotFound]
  121. // CHECK:STDERR: impl C9 as I where .T = {} and .T = BAD6 { }
  122. // CHECK:STDERR: ^~~~
  123. // CHECK:STDERR:
  124. impl C9 as I where .T = {} and .T = BAD6 { }
  125. // --- fail_two_different_both_bad.carbon
  126. library "[[@TEST_NAME]]";
  127. import library "interface";
  128. class CA { }
  129. // CHECK:STDERR: fail_two_different_both_bad.carbon:[[@LINE+8]]:25: error: name `BAD7` not found [NameNotFound]
  130. // CHECK:STDERR: impl CA as I where .T = BAD7 and .T = BAD8 { }
  131. // CHECK:STDERR: ^~~~
  132. // CHECK:STDERR:
  133. // CHECK:STDERR: fail_two_different_both_bad.carbon:[[@LINE+4]]:39: error: name `BAD8` not found [NameNotFound]
  134. // CHECK:STDERR: impl CA as I where .T = BAD7 and .T = BAD8 { }
  135. // CHECK:STDERR: ^~~~
  136. // CHECK:STDERR:
  137. impl CA as I where .T = BAD7 and .T = BAD8 { }
  138. // --- repeated.carbon
  139. library "[[@TEST_NAME]]";
  140. import library "interface";
  141. class CB { }
  142. impl CB as I where .T = {} and .T = {} { }
  143. // --- non-type.carbon
  144. library "[[@TEST_NAME]]";
  145. import library "interface";
  146. class CC { }
  147. impl CC as NonType where .Y = {.a = {}} { }
  148. // --- interface_with_function.carbon
  149. library "[[@TEST_NAME]]";
  150. interface IF { fn F(); }
  151. // --- fail_where_rewrite_function.carbon
  152. library "[[@TEST_NAME]]";
  153. import library "interface_with_function";
  154. class CD { }
  155. // CHECK:STDERR: fail_where_rewrite_function.carbon:[[@LINE+4]]:12: error: rewrite specified for associated function F [RewriteForAssociatedFunction]
  156. // CHECK:STDERR: impl CD as IF where .F = 0 {
  157. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  158. // CHECK:STDERR:
  159. impl CD as IF where .F = 0 {
  160. fn F() {}
  161. }
  162. // CHECK:STDOUT: --- interface.carbon
  163. // CHECK:STDOUT:
  164. // CHECK:STDOUT: constants {
  165. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  166. // CHECK:STDOUT: %Self.7ee: %I.type = bind_symbolic_name Self, 0 [symbolic]
  167. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  168. // CHECK:STDOUT: %assoc0.cd1: %I.assoc_type = assoc_entity element0, @I.%T [concrete]
  169. // CHECK:STDOUT: %I3.type: type = facet_type <@I3> [concrete]
  170. // CHECK:STDOUT: %Self.1a5: %I3.type = bind_symbolic_name Self, 0 [symbolic]
  171. // CHECK:STDOUT: %I3.assoc_type: type = assoc_entity_type @I3 [concrete]
  172. // CHECK:STDOUT: %assoc0.150: %I3.assoc_type = assoc_entity element0, @I3.%T1 [concrete]
  173. // CHECK:STDOUT: %assoc1: %I3.assoc_type = assoc_entity element1, @I3.%T2 [concrete]
  174. // CHECK:STDOUT: %assoc2: %I3.assoc_type = assoc_entity element2, @I3.%T3 [concrete]
  175. // CHECK:STDOUT: %NonType.type: type = facet_type <@NonType> [concrete]
  176. // CHECK:STDOUT: %Self.dd6: %NonType.type = bind_symbolic_name Self, 0 [symbolic]
  177. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  178. // CHECK:STDOUT: %struct_type.a.225: type = struct_type {.a: %empty_struct_type} [concrete]
  179. // CHECK:STDOUT: %NonType.assoc_type: type = assoc_entity_type @NonType [concrete]
  180. // CHECK:STDOUT: %assoc0.290: %NonType.assoc_type = assoc_entity element0, @NonType.%Y [concrete]
  181. // CHECK:STDOUT: }
  182. // CHECK:STDOUT:
  183. // CHECK:STDOUT: file {
  184. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  185. // CHECK:STDOUT: .I = %I.decl
  186. // CHECK:STDOUT: .I3 = %I3.decl
  187. // CHECK:STDOUT: .NonType = %NonType.decl
  188. // CHECK:STDOUT: }
  189. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  190. // CHECK:STDOUT: %I3.decl: type = interface_decl @I3 [concrete = constants.%I3.type] {} {}
  191. // CHECK:STDOUT: %NonType.decl: type = interface_decl @NonType [concrete = constants.%NonType.type] {} {}
  192. // CHECK:STDOUT: }
  193. // CHECK:STDOUT:
  194. // CHECK:STDOUT: interface @I {
  195. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.7ee]
  196. // CHECK:STDOUT: %T: type = assoc_const_decl @T [concrete] {
  197. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%T [concrete = constants.%assoc0.cd1]
  198. // CHECK:STDOUT: }
  199. // CHECK:STDOUT:
  200. // CHECK:STDOUT: !members:
  201. // CHECK:STDOUT: .Self = %Self
  202. // CHECK:STDOUT: .T = @T.%assoc0
  203. // CHECK:STDOUT: witness = (%T)
  204. // CHECK:STDOUT: }
  205. // CHECK:STDOUT:
  206. // CHECK:STDOUT: interface @I3 {
  207. // CHECK:STDOUT: %Self: %I3.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1a5]
  208. // CHECK:STDOUT: %T1: type = assoc_const_decl @T1 [concrete] {
  209. // CHECK:STDOUT: %assoc0: %I3.assoc_type = assoc_entity element0, @I3.%T1 [concrete = constants.%assoc0.150]
  210. // CHECK:STDOUT: }
  211. // CHECK:STDOUT: %T2: type = assoc_const_decl @T2 [concrete] {
  212. // CHECK:STDOUT: %assoc1: %I3.assoc_type = assoc_entity element1, @I3.%T2 [concrete = constants.%assoc1]
  213. // CHECK:STDOUT: }
  214. // CHECK:STDOUT: %T3: type = assoc_const_decl @T3 [concrete] {
  215. // CHECK:STDOUT: %assoc2: %I3.assoc_type = assoc_entity element2, @I3.%T3 [concrete = constants.%assoc2]
  216. // CHECK:STDOUT: }
  217. // CHECK:STDOUT:
  218. // CHECK:STDOUT: !members:
  219. // CHECK:STDOUT: .Self = %Self
  220. // CHECK:STDOUT: .T1 = @T1.%assoc0
  221. // CHECK:STDOUT: .T2 = @T2.%assoc1
  222. // CHECK:STDOUT: .T3 = @T3.%assoc2
  223. // CHECK:STDOUT: witness = (%T1, %T2, %T3)
  224. // CHECK:STDOUT: }
  225. // CHECK:STDOUT:
  226. // CHECK:STDOUT: interface @NonType {
  227. // CHECK:STDOUT: %Self: %NonType.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.dd6]
  228. // CHECK:STDOUT: %Y: %struct_type.a.225 = assoc_const_decl @Y [concrete] {
  229. // CHECK:STDOUT: %assoc0: %NonType.assoc_type = assoc_entity element0, @NonType.%Y [concrete = constants.%assoc0.290]
  230. // CHECK:STDOUT: }
  231. // CHECK:STDOUT:
  232. // CHECK:STDOUT: !members:
  233. // CHECK:STDOUT: .Self = %Self
  234. // CHECK:STDOUT: .Y = @Y.%assoc0
  235. // CHECK:STDOUT: witness = (%Y)
  236. // CHECK:STDOUT: }
  237. // CHECK:STDOUT:
  238. // CHECK:STDOUT: generic assoc_const @T(@I.%Self: %I.type) {
  239. // CHECK:STDOUT: assoc_const T:! type;
  240. // CHECK:STDOUT: }
  241. // CHECK:STDOUT:
  242. // CHECK:STDOUT: generic assoc_const @T1(@I3.%Self: %I3.type) {
  243. // CHECK:STDOUT: assoc_const T1:! type;
  244. // CHECK:STDOUT: }
  245. // CHECK:STDOUT:
  246. // CHECK:STDOUT: generic assoc_const @T2(@I3.%Self: %I3.type) {
  247. // CHECK:STDOUT: assoc_const T2:! type;
  248. // CHECK:STDOUT: }
  249. // CHECK:STDOUT:
  250. // CHECK:STDOUT: generic assoc_const @T3(@I3.%Self: %I3.type) {
  251. // CHECK:STDOUT: assoc_const T3:! type;
  252. // CHECK:STDOUT: }
  253. // CHECK:STDOUT:
  254. // CHECK:STDOUT: generic assoc_const @Y(@NonType.%Self: %NonType.type) {
  255. // CHECK:STDOUT: assoc_const Y:! %struct_type.a.225;
  256. // CHECK:STDOUT: }
  257. // CHECK:STDOUT:
  258. // CHECK:STDOUT: specific @T(constants.%Self.7ee) {}
  259. // CHECK:STDOUT:
  260. // CHECK:STDOUT: specific @T1(constants.%Self.1a5) {}
  261. // CHECK:STDOUT:
  262. // CHECK:STDOUT: specific @T2(constants.%Self.1a5) {}
  263. // CHECK:STDOUT:
  264. // CHECK:STDOUT: specific @T3(constants.%Self.1a5) {}
  265. // CHECK:STDOUT:
  266. // CHECK:STDOUT: specific @Y(constants.%Self.dd6) {}
  267. // CHECK:STDOUT:
  268. // CHECK:STDOUT: --- basic.carbon
  269. // CHECK:STDOUT:
  270. // CHECK:STDOUT: constants {
  271. // CHECK:STDOUT: %C1: type = class_type @C1 [concrete]
  272. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  273. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  274. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  275. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  276. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic_self]
  277. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  278. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, imports.%Main.import_ref.652 [concrete]
  279. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  280. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %.Self, @I [symbolic_self]
  281. // CHECK:STDOUT: %I.facet: %I.type = facet_value %.Self.as_type, (%I.lookup_impl_witness) [symbolic_self]
  282. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %I.lookup_impl_witness, element0 [symbolic_self]
  283. // CHECK:STDOUT: %I_where.type: type = facet_type <@I where %impl.elem0 = %empty_struct_type> [concrete]
  284. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness file.%I.impl_witness_table [concrete]
  285. // CHECK:STDOUT: }
  286. // CHECK:STDOUT:
  287. // CHECK:STDOUT: imports {
  288. // CHECK:STDOUT: %Main.I: type = import_ref Main//interface, I, loaded [concrete = constants.%I.type]
  289. // CHECK:STDOUT: %Main.I3 = import_ref Main//interface, I3, unloaded
  290. // CHECK:STDOUT: %Main.NonType = import_ref Main//interface, NonType, unloaded
  291. // CHECK:STDOUT: %Main.import_ref.8e7 = import_ref Main//interface, inst17 [no loc], unloaded
  292. // CHECK:STDOUT: %Main.import_ref.4fb: %I.assoc_type = import_ref Main//interface, loc3_20, loaded [concrete = constants.%assoc0]
  293. // CHECK:STDOUT: %Main.T: type = import_ref Main//interface, T, loaded [concrete = %T]
  294. // CHECK:STDOUT: %Main.import_ref.652: type = import_ref Main//interface, loc3_20, loaded [concrete = %T]
  295. // CHECK:STDOUT: %T: type = assoc_const_decl @T [concrete] {}
  296. // CHECK:STDOUT: %Main.import_ref.de2: %I.type = import_ref Main//interface, inst17 [no loc], loaded [symbolic = constants.%Self]
  297. // CHECK:STDOUT: }
  298. // CHECK:STDOUT:
  299. // CHECK:STDOUT: file {
  300. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  301. // CHECK:STDOUT: .I = imports.%Main.I
  302. // CHECK:STDOUT: .I3 = imports.%Main.I3
  303. // CHECK:STDOUT: .NonType = imports.%Main.NonType
  304. // CHECK:STDOUT: .C1 = %C1.decl
  305. // CHECK:STDOUT: }
  306. // CHECK:STDOUT: %default.import = import <none>
  307. // CHECK:STDOUT: %C1.decl: type = class_decl @C1 [concrete = constants.%C1] {} {}
  308. // CHECK:STDOUT: impl_decl @C1.as.I.impl [concrete] {} {
  309. // CHECK:STDOUT: %C1.ref: type = name_ref C1, file.%C1.decl [concrete = constants.%C1]
  310. // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type]
  311. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  312. // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  313. // CHECK:STDOUT: %T.ref: %I.assoc_type = name_ref T, imports.%Main.import_ref.4fb [concrete = constants.%assoc0]
  314. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type]
  315. // CHECK:STDOUT: %.loc5_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type]
  316. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  317. // CHECK:STDOUT: %.loc5_26.1: %empty_struct_type = struct_literal ()
  318. // CHECK:STDOUT: %.loc5_26.2: type = converted %.loc5_26.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  319. // CHECK:STDOUT: %.loc5_14: type = where_expr %.Self [concrete = constants.%I_where.type] {
  320. // CHECK:STDOUT: requirement_base_facet_type constants.%I.type
  321. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc5_26.2
  322. // CHECK:STDOUT: }
  323. // CHECK:STDOUT: }
  324. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%impl_witness_assoc_constant), @C1.as.I.impl [concrete]
  325. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness]
  326. // CHECK:STDOUT: %impl_witness_assoc_constant: type = impl_witness_assoc_constant constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  327. // CHECK:STDOUT: }
  328. // CHECK:STDOUT:
  329. // CHECK:STDOUT: interface @I [from "interface.carbon"] {
  330. // CHECK:STDOUT: !members:
  331. // CHECK:STDOUT: .Self = imports.%Main.import_ref.8e7
  332. // CHECK:STDOUT: .T = imports.%Main.import_ref.4fb
  333. // CHECK:STDOUT: witness = (imports.%Main.T)
  334. // CHECK:STDOUT: }
  335. // CHECK:STDOUT:
  336. // CHECK:STDOUT: generic assoc_const @T(imports.%Main.import_ref.de2: %I.type) [from "interface.carbon"] {
  337. // CHECK:STDOUT: assoc_const T:! type;
  338. // CHECK:STDOUT: }
  339. // CHECK:STDOUT:
  340. // CHECK:STDOUT: impl @C1.as.I.impl: %C1.ref as %.loc5_14 {
  341. // CHECK:STDOUT: !members:
  342. // CHECK:STDOUT: witness = file.%I.impl_witness
  343. // CHECK:STDOUT: }
  344. // CHECK:STDOUT:
  345. // CHECK:STDOUT: class @C1 {
  346. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  347. // CHECK:STDOUT: complete_type_witness = %complete_type
  348. // CHECK:STDOUT:
  349. // CHECK:STDOUT: !members:
  350. // CHECK:STDOUT: .Self = constants.%C1
  351. // CHECK:STDOUT: }
  352. // CHECK:STDOUT:
  353. // CHECK:STDOUT: specific @T(constants.%Self) {}
  354. // CHECK:STDOUT:
  355. // CHECK:STDOUT: specific @T(constants.%I.facet) {}
  356. // CHECK:STDOUT:
  357. // CHECK:STDOUT: --- redecl.carbon
  358. // CHECK:STDOUT:
  359. // CHECK:STDOUT: constants {
  360. // CHECK:STDOUT: %C2: type = class_type @C2 [concrete]
  361. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  362. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  363. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  364. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  365. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic_self]
  366. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  367. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, imports.%Main.import_ref.652 [concrete]
  368. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  369. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %.Self, @I [symbolic_self]
  370. // CHECK:STDOUT: %I.facet: %I.type = facet_value %.Self.as_type, (%I.lookup_impl_witness) [symbolic_self]
  371. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %I.lookup_impl_witness, element0 [symbolic_self]
  372. // CHECK:STDOUT: %I_where.type: type = facet_type <@I where %impl.elem0 = %empty_struct_type> [concrete]
  373. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness file.%I.impl_witness_table [concrete]
  374. // CHECK:STDOUT: }
  375. // CHECK:STDOUT:
  376. // CHECK:STDOUT: imports {
  377. // CHECK:STDOUT: %Main.I: type = import_ref Main//interface, I, loaded [concrete = constants.%I.type]
  378. // CHECK:STDOUT: %Main.I3 = import_ref Main//interface, I3, unloaded
  379. // CHECK:STDOUT: %Main.NonType = import_ref Main//interface, NonType, unloaded
  380. // CHECK:STDOUT: %Main.import_ref.8e7 = import_ref Main//interface, inst17 [no loc], unloaded
  381. // CHECK:STDOUT: %Main.import_ref.4fb: %I.assoc_type = import_ref Main//interface, loc3_20, loaded [concrete = constants.%assoc0]
  382. // CHECK:STDOUT: %Main.T: type = import_ref Main//interface, T, loaded [concrete = %T]
  383. // CHECK:STDOUT: %Main.import_ref.652: type = import_ref Main//interface, loc3_20, loaded [concrete = %T]
  384. // CHECK:STDOUT: %T: type = assoc_const_decl @T [concrete] {}
  385. // CHECK:STDOUT: %Main.import_ref.de2: %I.type = import_ref Main//interface, inst17 [no loc], loaded [symbolic = constants.%Self]
  386. // CHECK:STDOUT: }
  387. // CHECK:STDOUT:
  388. // CHECK:STDOUT: file {
  389. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  390. // CHECK:STDOUT: .I = imports.%Main.I
  391. // CHECK:STDOUT: .I3 = imports.%Main.I3
  392. // CHECK:STDOUT: .NonType = imports.%Main.NonType
  393. // CHECK:STDOUT: .C2 = %C2.decl
  394. // CHECK:STDOUT: }
  395. // CHECK:STDOUT: %default.import = import <none>
  396. // CHECK:STDOUT: %C2.decl: type = class_decl @C2 [concrete = constants.%C2] {} {}
  397. // CHECK:STDOUT: impl_decl @C2.as.I.impl [concrete] {} {
  398. // CHECK:STDOUT: %C2.ref.loc5: type = name_ref C2, file.%C2.decl [concrete = constants.%C2]
  399. // CHECK:STDOUT: %I.ref.loc5: type = name_ref I, imports.%Main.I [concrete = constants.%I.type]
  400. // CHECK:STDOUT: %.Self.2: %I.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  401. // CHECK:STDOUT: %.Self.ref.loc5: %I.type = name_ref .Self, %.Self.2 [symbolic_self = constants.%.Self]
  402. // CHECK:STDOUT: %T.ref.loc5: %I.assoc_type = name_ref T, imports.%Main.import_ref.4fb [concrete = constants.%assoc0]
  403. // CHECK:STDOUT: %.Self.as_type.loc5: type = facet_access_type %.Self.ref.loc5 [symbolic_self = constants.%.Self.as_type]
  404. // CHECK:STDOUT: %.loc5_20: type = converted %.Self.ref.loc5, %.Self.as_type.loc5 [symbolic_self = constants.%.Self.as_type]
  405. // CHECK:STDOUT: %impl.elem0.loc5: type = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  406. // CHECK:STDOUT: %.loc5_26.1: %empty_struct_type = struct_literal ()
  407. // CHECK:STDOUT: %.loc5_26.2: type = converted %.loc5_26.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  408. // CHECK:STDOUT: %.loc5_14: type = where_expr %.Self.2 [concrete = constants.%I_where.type] {
  409. // CHECK:STDOUT: requirement_base_facet_type constants.%I.type
  410. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc5, %.loc5_26.2
  411. // CHECK:STDOUT: }
  412. // CHECK:STDOUT: }
  413. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%impl_witness_assoc_constant), @C2.as.I.impl [concrete]
  414. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness]
  415. // CHECK:STDOUT: %impl_witness_assoc_constant: type = impl_witness_assoc_constant constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  416. // CHECK:STDOUT: impl_decl @C2.as.I.impl [concrete] {} {
  417. // CHECK:STDOUT: %C2.ref.loc6: type = name_ref C2, file.%C2.decl [concrete = constants.%C2]
  418. // CHECK:STDOUT: %I.ref.loc6: type = name_ref I, imports.%Main.I [concrete = constants.%I.type]
  419. // CHECK:STDOUT: %.Self.1: %I.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  420. // CHECK:STDOUT: %.Self.ref.loc6: %I.type = name_ref .Self, %.Self.1 [symbolic_self = constants.%.Self]
  421. // CHECK:STDOUT: %T.ref.loc6: %I.assoc_type = name_ref T, imports.%Main.import_ref.4fb [concrete = constants.%assoc0]
  422. // CHECK:STDOUT: %.Self.as_type.loc6: type = facet_access_type %.Self.ref.loc6 [symbolic_self = constants.%.Self.as_type]
  423. // CHECK:STDOUT: %.loc6_20: type = converted %.Self.ref.loc6, %.Self.as_type.loc6 [symbolic_self = constants.%.Self.as_type]
  424. // CHECK:STDOUT: %impl.elem0.loc6: type = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  425. // CHECK:STDOUT: %.loc6_26.1: %empty_struct_type = struct_literal ()
  426. // CHECK:STDOUT: %.loc6_26.2: type = converted %.loc6_26.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  427. // CHECK:STDOUT: %.loc6_14: type = where_expr %.Self.1 [concrete = constants.%I_where.type] {
  428. // CHECK:STDOUT: requirement_base_facet_type constants.%I.type
  429. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc6, %.loc6_26.2
  430. // CHECK:STDOUT: }
  431. // CHECK:STDOUT: }
  432. // CHECK:STDOUT: }
  433. // CHECK:STDOUT:
  434. // CHECK:STDOUT: interface @I [from "interface.carbon"] {
  435. // CHECK:STDOUT: !members:
  436. // CHECK:STDOUT: .Self = imports.%Main.import_ref.8e7
  437. // CHECK:STDOUT: .T = imports.%Main.import_ref.4fb
  438. // CHECK:STDOUT: witness = (imports.%Main.T)
  439. // CHECK:STDOUT: }
  440. // CHECK:STDOUT:
  441. // CHECK:STDOUT: generic assoc_const @T(imports.%Main.import_ref.de2: %I.type) [from "interface.carbon"] {
  442. // CHECK:STDOUT: assoc_const T:! type;
  443. // CHECK:STDOUT: }
  444. // CHECK:STDOUT:
  445. // CHECK:STDOUT: impl @C2.as.I.impl: %C2.ref.loc5 as %.loc5_14 {
  446. // CHECK:STDOUT: !members:
  447. // CHECK:STDOUT: witness = file.%I.impl_witness
  448. // CHECK:STDOUT: }
  449. // CHECK:STDOUT:
  450. // CHECK:STDOUT: class @C2 {
  451. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  452. // CHECK:STDOUT: complete_type_witness = %complete_type
  453. // CHECK:STDOUT:
  454. // CHECK:STDOUT: !members:
  455. // CHECK:STDOUT: .Self = constants.%C2
  456. // CHECK:STDOUT: }
  457. // CHECK:STDOUT:
  458. // CHECK:STDOUT: specific @T(constants.%Self) {}
  459. // CHECK:STDOUT:
  460. // CHECK:STDOUT: specific @T(constants.%I.facet) {}
  461. // CHECK:STDOUT:
  462. // CHECK:STDOUT: --- fail_redecl_adds_rewrites.carbon
  463. // CHECK:STDOUT:
  464. // CHECK:STDOUT: constants {
  465. // CHECK:STDOUT: %C3: type = class_type @C3 [concrete]
  466. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  467. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  468. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  469. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  470. // CHECK:STDOUT: %I.impl_witness.176: <witness> = impl_witness file.%I.impl_witness_table.loc9 [concrete]
  471. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic_self]
  472. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  473. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, imports.%Main.import_ref.652 [concrete]
  474. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  475. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %.Self, @I [symbolic_self]
  476. // CHECK:STDOUT: %I.facet: %I.type = facet_value %.Self.as_type, (%I.lookup_impl_witness) [symbolic_self]
  477. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %I.lookup_impl_witness, element0 [symbolic_self]
  478. // CHECK:STDOUT: %I_where.type: type = facet_type <@I where %impl.elem0 = %empty_struct_type> [concrete]
  479. // CHECK:STDOUT: %I.impl_witness.877: <witness> = impl_witness file.%I.impl_witness_table.loc10 [concrete]
  480. // CHECK:STDOUT: }
  481. // CHECK:STDOUT:
  482. // CHECK:STDOUT: imports {
  483. // CHECK:STDOUT: %Main.I: type = import_ref Main//interface, I, loaded [concrete = constants.%I.type]
  484. // CHECK:STDOUT: %Main.I3 = import_ref Main//interface, I3, unloaded
  485. // CHECK:STDOUT: %Main.NonType = import_ref Main//interface, NonType, unloaded
  486. // CHECK:STDOUT: %Main.import_ref.8e7 = import_ref Main//interface, inst17 [no loc], unloaded
  487. // CHECK:STDOUT: %Main.import_ref.4fb: %I.assoc_type = import_ref Main//interface, loc3_20, loaded [concrete = constants.%assoc0]
  488. // CHECK:STDOUT: %Main.T: type = import_ref Main//interface, T, loaded [concrete = %T]
  489. // CHECK:STDOUT: %Main.import_ref.652: type = import_ref Main//interface, loc3_20, loaded [concrete = %T]
  490. // CHECK:STDOUT: %T: type = assoc_const_decl @T [concrete] {}
  491. // CHECK:STDOUT: %Main.import_ref.de2: %I.type = import_ref Main//interface, inst17 [no loc], loaded [symbolic = constants.%Self]
  492. // CHECK:STDOUT: }
  493. // CHECK:STDOUT:
  494. // CHECK:STDOUT: file {
  495. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  496. // CHECK:STDOUT: .I = imports.%Main.I
  497. // CHECK:STDOUT: .I3 = imports.%Main.I3
  498. // CHECK:STDOUT: .NonType = imports.%Main.NonType
  499. // CHECK:STDOUT: .C3 = %C3.decl
  500. // CHECK:STDOUT: }
  501. // CHECK:STDOUT: %default.import = import <none>
  502. // CHECK:STDOUT: %C3.decl: type = class_decl @C3 [concrete = constants.%C3] {} {}
  503. // CHECK:STDOUT: impl_decl @C3.as.I.impl.bf3 [concrete] {} {
  504. // CHECK:STDOUT: %C3.ref: type = name_ref C3, file.%C3.decl [concrete = constants.%C3]
  505. // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type]
  506. // CHECK:STDOUT: }
  507. // CHECK:STDOUT: %I.impl_witness_table.loc9 = impl_witness_table (), @C3.as.I.impl.bf3 [concrete]
  508. // CHECK:STDOUT: %I.impl_witness.loc9: <witness> = impl_witness %I.impl_witness_table.loc9 [concrete = constants.%I.impl_witness.176]
  509. // CHECK:STDOUT: impl_decl @C3.as.I.impl.c29 [concrete] {} {
  510. // CHECK:STDOUT: %C3.ref: type = name_ref C3, file.%C3.decl [concrete = constants.%C3]
  511. // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type]
  512. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  513. // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  514. // CHECK:STDOUT: %T.ref: %I.assoc_type = name_ref T, imports.%Main.import_ref.4fb [concrete = constants.%assoc0]
  515. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type]
  516. // CHECK:STDOUT: %.loc10_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type]
  517. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  518. // CHECK:STDOUT: %.loc10_26.1: %empty_struct_type = struct_literal ()
  519. // CHECK:STDOUT: %.loc10_26.2: type = converted %.loc10_26.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  520. // CHECK:STDOUT: %.loc10_14: type = where_expr %.Self [concrete = constants.%I_where.type] {
  521. // CHECK:STDOUT: requirement_base_facet_type constants.%I.type
  522. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc10_26.2
  523. // CHECK:STDOUT: }
  524. // CHECK:STDOUT: }
  525. // CHECK:STDOUT: %I.impl_witness_table.loc10 = impl_witness_table (%impl_witness_assoc_constant), @C3.as.I.impl.c29 [concrete]
  526. // CHECK:STDOUT: %I.impl_witness.loc10: <witness> = impl_witness %I.impl_witness_table.loc10 [concrete = constants.%I.impl_witness.877]
  527. // CHECK:STDOUT: %impl_witness_assoc_constant: type = impl_witness_assoc_constant constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  528. // CHECK:STDOUT: }
  529. // CHECK:STDOUT:
  530. // CHECK:STDOUT: interface @I [from "interface.carbon"] {
  531. // CHECK:STDOUT: !members:
  532. // CHECK:STDOUT: .Self = imports.%Main.import_ref.8e7
  533. // CHECK:STDOUT: .T = imports.%Main.import_ref.4fb
  534. // CHECK:STDOUT: witness = (imports.%Main.T)
  535. // CHECK:STDOUT: }
  536. // CHECK:STDOUT:
  537. // CHECK:STDOUT: generic assoc_const @T(imports.%Main.import_ref.de2: %I.type) [from "interface.carbon"] {
  538. // CHECK:STDOUT: assoc_const T:! type;
  539. // CHECK:STDOUT: }
  540. // CHECK:STDOUT:
  541. // CHECK:STDOUT: impl @C3.as.I.impl.bf3: %C3.ref as %I.ref;
  542. // CHECK:STDOUT:
  543. // CHECK:STDOUT: impl @C3.as.I.impl.c29: %C3.ref as %.loc10_14 {
  544. // CHECK:STDOUT: !members:
  545. // CHECK:STDOUT: witness = file.%I.impl_witness.loc10
  546. // CHECK:STDOUT: }
  547. // CHECK:STDOUT:
  548. // CHECK:STDOUT: class @C3 {
  549. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  550. // CHECK:STDOUT: complete_type_witness = %complete_type
  551. // CHECK:STDOUT:
  552. // CHECK:STDOUT: !members:
  553. // CHECK:STDOUT: .Self = constants.%C3
  554. // CHECK:STDOUT: }
  555. // CHECK:STDOUT:
  556. // CHECK:STDOUT: specific @T(constants.%Self) {}
  557. // CHECK:STDOUT:
  558. // CHECK:STDOUT: specific @T(constants.%I.facet) {}
  559. // CHECK:STDOUT:
  560. // CHECK:STDOUT: --- fail_mismatch.carbon
  561. // CHECK:STDOUT:
  562. // CHECK:STDOUT: constants {
  563. // CHECK:STDOUT: %C4: type = class_type @C4 [concrete]
  564. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  565. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  566. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  567. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  568. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic_self]
  569. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  570. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, imports.%Main.import_ref.652 [concrete]
  571. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  572. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %.Self, @I [symbolic_self]
  573. // CHECK:STDOUT: %I.facet: %I.type = facet_value %.Self.as_type, (%I.lookup_impl_witness) [symbolic_self]
  574. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %I.lookup_impl_witness, element0 [symbolic_self]
  575. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  576. // CHECK:STDOUT: %I_where.type.aa0: type = facet_type <@I where %impl.elem0 = %empty_struct_type> [concrete]
  577. // CHECK:STDOUT: %I.impl_witness.e84: <witness> = impl_witness file.%I.impl_witness_table.loc9 [concrete]
  578. // CHECK:STDOUT: %I_where.type.53c: type = facet_type <@I where %impl.elem0 = %empty_tuple.type> [concrete]
  579. // CHECK:STDOUT: %I.impl_witness.1d7: <witness> = impl_witness file.%I.impl_witness_table.loc10 [concrete]
  580. // CHECK:STDOUT: }
  581. // CHECK:STDOUT:
  582. // CHECK:STDOUT: imports {
  583. // CHECK:STDOUT: %Main.I: type = import_ref Main//interface, I, loaded [concrete = constants.%I.type]
  584. // CHECK:STDOUT: %Main.I3 = import_ref Main//interface, I3, unloaded
  585. // CHECK:STDOUT: %Main.NonType = import_ref Main//interface, NonType, unloaded
  586. // CHECK:STDOUT: %Main.import_ref.8e7 = import_ref Main//interface, inst17 [no loc], unloaded
  587. // CHECK:STDOUT: %Main.import_ref.4fb: %I.assoc_type = import_ref Main//interface, loc3_20, loaded [concrete = constants.%assoc0]
  588. // CHECK:STDOUT: %Main.T: type = import_ref Main//interface, T, loaded [concrete = %T]
  589. // CHECK:STDOUT: %Main.import_ref.652: type = import_ref Main//interface, loc3_20, loaded [concrete = %T]
  590. // CHECK:STDOUT: %T: type = assoc_const_decl @T [concrete] {}
  591. // CHECK:STDOUT: %Main.import_ref.de2: %I.type = import_ref Main//interface, inst17 [no loc], loaded [symbolic = constants.%Self]
  592. // CHECK:STDOUT: }
  593. // CHECK:STDOUT:
  594. // CHECK:STDOUT: file {
  595. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  596. // CHECK:STDOUT: .I = imports.%Main.I
  597. // CHECK:STDOUT: .I3 = imports.%Main.I3
  598. // CHECK:STDOUT: .NonType = imports.%Main.NonType
  599. // CHECK:STDOUT: .C4 = %C4.decl
  600. // CHECK:STDOUT: }
  601. // CHECK:STDOUT: %default.import = import <none>
  602. // CHECK:STDOUT: %C4.decl: type = class_decl @C4 [concrete = constants.%C4] {} {}
  603. // CHECK:STDOUT: impl_decl @C4.as.I.impl.094 [concrete] {} {
  604. // CHECK:STDOUT: %C4.ref: type = name_ref C4, file.%C4.decl [concrete = constants.%C4]
  605. // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type]
  606. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  607. // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  608. // CHECK:STDOUT: %T.ref: %I.assoc_type = name_ref T, imports.%Main.import_ref.4fb [concrete = constants.%assoc0]
  609. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type]
  610. // CHECK:STDOUT: %.loc9_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type]
  611. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  612. // CHECK:STDOUT: %.loc9_26.1: %empty_struct_type = struct_literal ()
  613. // CHECK:STDOUT: %.loc9_26.2: type = converted %.loc9_26.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  614. // CHECK:STDOUT: %.loc9_14: type = where_expr %.Self [concrete = constants.%I_where.type.aa0] {
  615. // CHECK:STDOUT: requirement_base_facet_type constants.%I.type
  616. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc9_26.2
  617. // CHECK:STDOUT: }
  618. // CHECK:STDOUT: }
  619. // CHECK:STDOUT: %I.impl_witness_table.loc9 = impl_witness_table (%impl_witness_assoc_constant.loc9), @C4.as.I.impl.094 [concrete]
  620. // CHECK:STDOUT: %I.impl_witness.loc9: <witness> = impl_witness %I.impl_witness_table.loc9 [concrete = constants.%I.impl_witness.e84]
  621. // CHECK:STDOUT: %impl_witness_assoc_constant.loc9: type = impl_witness_assoc_constant constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  622. // CHECK:STDOUT: impl_decl @C4.as.I.impl.ba9 [concrete] {} {
  623. // CHECK:STDOUT: %C4.ref: type = name_ref C4, file.%C4.decl [concrete = constants.%C4]
  624. // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type]
  625. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  626. // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  627. // CHECK:STDOUT: %T.ref: %I.assoc_type = name_ref T, imports.%Main.import_ref.4fb [concrete = constants.%assoc0]
  628. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type]
  629. // CHECK:STDOUT: %.loc10_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type]
  630. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  631. // CHECK:STDOUT: %.loc10_26.1: %empty_tuple.type = tuple_literal ()
  632. // CHECK:STDOUT: %.loc10_26.2: type = converted %.loc10_26.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  633. // CHECK:STDOUT: %.loc10_14: type = where_expr %.Self [concrete = constants.%I_where.type.53c] {
  634. // CHECK:STDOUT: requirement_base_facet_type constants.%I.type
  635. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc10_26.2
  636. // CHECK:STDOUT: }
  637. // CHECK:STDOUT: }
  638. // CHECK:STDOUT: %I.impl_witness_table.loc10 = impl_witness_table (%impl_witness_assoc_constant.loc10), @C4.as.I.impl.ba9 [concrete]
  639. // CHECK:STDOUT: %I.impl_witness.loc10: <witness> = impl_witness %I.impl_witness_table.loc10 [concrete = constants.%I.impl_witness.1d7]
  640. // CHECK:STDOUT: %impl_witness_assoc_constant.loc10: type = impl_witness_assoc_constant constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  641. // CHECK:STDOUT: }
  642. // CHECK:STDOUT:
  643. // CHECK:STDOUT: interface @I [from "interface.carbon"] {
  644. // CHECK:STDOUT: !members:
  645. // CHECK:STDOUT: .Self = imports.%Main.import_ref.8e7
  646. // CHECK:STDOUT: .T = imports.%Main.import_ref.4fb
  647. // CHECK:STDOUT: witness = (imports.%Main.T)
  648. // CHECK:STDOUT: }
  649. // CHECK:STDOUT:
  650. // CHECK:STDOUT: generic assoc_const @T(imports.%Main.import_ref.de2: %I.type) [from "interface.carbon"] {
  651. // CHECK:STDOUT: assoc_const T:! type;
  652. // CHECK:STDOUT: }
  653. // CHECK:STDOUT:
  654. // CHECK:STDOUT: impl @C4.as.I.impl.094: %C4.ref as %.loc9_14;
  655. // CHECK:STDOUT:
  656. // CHECK:STDOUT: impl @C4.as.I.impl.ba9: %C4.ref as %.loc10_14 {
  657. // CHECK:STDOUT: !members:
  658. // CHECK:STDOUT: witness = file.%I.impl_witness.loc10
  659. // CHECK:STDOUT: }
  660. // CHECK:STDOUT:
  661. // CHECK:STDOUT: class @C4 {
  662. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  663. // CHECK:STDOUT: complete_type_witness = %complete_type
  664. // CHECK:STDOUT:
  665. // CHECK:STDOUT: !members:
  666. // CHECK:STDOUT: .Self = constants.%C4
  667. // CHECK:STDOUT: }
  668. // CHECK:STDOUT:
  669. // CHECK:STDOUT: specific @T(constants.%Self) {}
  670. // CHECK:STDOUT:
  671. // CHECK:STDOUT: specific @T(constants.%I.facet) {}
  672. // CHECK:STDOUT:
  673. // CHECK:STDOUT: --- fail_mismatch_bad_value.carbon
  674. // CHECK:STDOUT:
  675. // CHECK:STDOUT: constants {
  676. // CHECK:STDOUT: %C5: type = class_type @C5 [concrete]
  677. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  678. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  679. // CHECK:STDOUT: %I3.type: type = facet_type <@I3> [concrete]
  680. // CHECK:STDOUT: %Self: %I3.type = bind_symbolic_name Self, 0 [symbolic]
  681. // CHECK:STDOUT: %.Self: %I3.type = bind_symbolic_name .Self [symbolic_self]
  682. // CHECK:STDOUT: %I3.assoc_type: type = assoc_entity_type @I3 [concrete]
  683. // CHECK:STDOUT: %assoc0: %I3.assoc_type = assoc_entity element0, imports.%Main.import_ref.5fb [concrete]
  684. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  685. // CHECK:STDOUT: %I3.lookup_impl_witness: <witness> = lookup_impl_witness %.Self, @I3 [symbolic_self]
  686. // CHECK:STDOUT: %I3.facet: %I3.type = facet_value %.Self.as_type, (%I3.lookup_impl_witness) [symbolic_self]
  687. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %I3.lookup_impl_witness, element0 [symbolic_self]
  688. // CHECK:STDOUT: %assoc1: %I3.assoc_type = assoc_entity element1, imports.%Main.import_ref.e26 [concrete]
  689. // CHECK:STDOUT: %impl.elem1: type = impl_witness_access %I3.lookup_impl_witness, element1 [symbolic_self]
  690. // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %empty_struct_type} [concrete]
  691. // CHECK:STDOUT: %assoc2: %I3.assoc_type = assoc_entity element2, imports.%Main.import_ref.e32 [concrete]
  692. // CHECK:STDOUT: %impl.elem2: type = impl_witness_access %I3.lookup_impl_witness, element2 [symbolic_self]
  693. // CHECK:STDOUT: %struct_type.b: type = struct_type {.b: %empty_struct_type} [concrete]
  694. // CHECK:STDOUT: }
  695. // CHECK:STDOUT:
  696. // CHECK:STDOUT: imports {
  697. // CHECK:STDOUT: %Main.I = import_ref Main//interface, I, unloaded
  698. // CHECK:STDOUT: %Main.I3: type = import_ref Main//interface, I3, loaded [concrete = constants.%I3.type]
  699. // CHECK:STDOUT: %Main.NonType = import_ref Main//interface, NonType, unloaded
  700. // CHECK:STDOUT: %Main.import_ref.5be = import_ref Main//interface, inst26 [no loc], unloaded
  701. // CHECK:STDOUT: %Main.import_ref.f5f: %I3.assoc_type = import_ref Main//interface, loc6_9, loaded [concrete = constants.%assoc0]
  702. // CHECK:STDOUT: %Main.import_ref.680: %I3.assoc_type = import_ref Main//interface, loc7_9, loaded [concrete = constants.%assoc1]
  703. // CHECK:STDOUT: %Main.import_ref.181: %I3.assoc_type = import_ref Main//interface, loc8_9, loaded [concrete = constants.%assoc2]
  704. // CHECK:STDOUT: %Main.T1 = import_ref Main//interface, T1, unloaded
  705. // CHECK:STDOUT: %Main.T2 = import_ref Main//interface, T2, unloaded
  706. // CHECK:STDOUT: %Main.T3 = import_ref Main//interface, T3, unloaded
  707. // CHECK:STDOUT: %Main.import_ref.5fb: type = import_ref Main//interface, loc6_9, loaded [concrete = %T1]
  708. // CHECK:STDOUT: %T1: type = assoc_const_decl @T1 [concrete] {}
  709. // CHECK:STDOUT: %Main.import_ref.903fbc.1: %I3.type = import_ref Main//interface, inst26 [no loc], loaded [symbolic = constants.%Self]
  710. // CHECK:STDOUT: %Main.import_ref.e26: type = import_ref Main//interface, loc7_9, loaded [concrete = %T2]
  711. // CHECK:STDOUT: %T2: type = assoc_const_decl @T2 [concrete] {}
  712. // CHECK:STDOUT: %Main.import_ref.903fbc.2: %I3.type = import_ref Main//interface, inst26 [no loc], loaded [symbolic = constants.%Self]
  713. // CHECK:STDOUT: %Main.import_ref.e32: type = import_ref Main//interface, loc8_9, loaded [concrete = %T3]
  714. // CHECK:STDOUT: %T3: type = assoc_const_decl @T3 [concrete] {}
  715. // CHECK:STDOUT: %Main.import_ref.903fbc.3: %I3.type = import_ref Main//interface, inst26 [no loc], loaded [symbolic = constants.%Self]
  716. // CHECK:STDOUT: }
  717. // CHECK:STDOUT:
  718. // CHECK:STDOUT: file {
  719. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  720. // CHECK:STDOUT: .I = imports.%Main.I
  721. // CHECK:STDOUT: .I3 = imports.%Main.I3
  722. // CHECK:STDOUT: .NonType = imports.%Main.NonType
  723. // CHECK:STDOUT: .C5 = %C5.decl
  724. // CHECK:STDOUT: .BAD1 = <poisoned>
  725. // CHECK:STDOUT: .BAD2 = <poisoned>
  726. // CHECK:STDOUT: .BAD3 = <poisoned>
  727. // CHECK:STDOUT: .BAD4 = <poisoned>
  728. // CHECK:STDOUT: }
  729. // CHECK:STDOUT: %default.import = import <none>
  730. // CHECK:STDOUT: %C5.decl: type = class_decl @C5 [concrete = constants.%C5] {} {}
  731. // CHECK:STDOUT: impl_decl @C5.as.<error>.impl.eaa268.1 [concrete] {} {
  732. // CHECK:STDOUT: %C5.ref: type = name_ref C5, file.%C5.decl [concrete = constants.%C5]
  733. // CHECK:STDOUT: %I3.ref: type = name_ref I3, imports.%Main.I3 [concrete = constants.%I3.type]
  734. // CHECK:STDOUT: %.Self: %I3.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  735. // CHECK:STDOUT: %.Self.ref.loc17_21: %I3.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  736. // CHECK:STDOUT: %T1.ref: %I3.assoc_type = name_ref T1, imports.%Main.import_ref.f5f [concrete = constants.%assoc0]
  737. // CHECK:STDOUT: %.Self.as_type.loc17_21: type = facet_access_type %.Self.ref.loc17_21 [symbolic_self = constants.%.Self.as_type]
  738. // CHECK:STDOUT: %.loc17_21: type = converted %.Self.ref.loc17_21, %.Self.as_type.loc17_21 [symbolic_self = constants.%.Self.as_type]
  739. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access constants.%I3.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  740. // CHECK:STDOUT: %BAD1.ref: <error> = name_ref BAD1, <error> [concrete = <error>]
  741. // CHECK:STDOUT: %.Self.ref.loc17_36: %I3.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  742. // CHECK:STDOUT: %T2.ref: %I3.assoc_type = name_ref T2, imports.%Main.import_ref.680 [concrete = constants.%assoc1]
  743. // CHECK:STDOUT: %.Self.as_type.loc17_36: type = facet_access_type %.Self.ref.loc17_36 [symbolic_self = constants.%.Self.as_type]
  744. // CHECK:STDOUT: %.loc17_36: type = converted %.Self.ref.loc17_36, %.Self.as_type.loc17_36 [symbolic_self = constants.%.Self.as_type]
  745. // CHECK:STDOUT: %impl.elem1: type = impl_witness_access constants.%I3.lookup_impl_witness, element1 [symbolic_self = constants.%impl.elem1]
  746. // CHECK:STDOUT: %.loc17_48.1: %empty_struct_type = struct_literal ()
  747. // CHECK:STDOUT: %.loc17_48.2: type = converted %.loc17_48.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  748. // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %empty_struct_type} [concrete = constants.%struct_type.a]
  749. // CHECK:STDOUT: %.Self.ref.loc17_55: %I3.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  750. // CHECK:STDOUT: %T3.ref: %I3.assoc_type = name_ref T3, imports.%Main.import_ref.181 [concrete = constants.%assoc2]
  751. // CHECK:STDOUT: %.Self.as_type.loc17_55: type = facet_access_type %.Self.ref.loc17_55 [symbolic_self = constants.%.Self.as_type]
  752. // CHECK:STDOUT: %.loc17_55: type = converted %.Self.ref.loc17_55, %.Self.as_type.loc17_55 [symbolic_self = constants.%.Self.as_type]
  753. // CHECK:STDOUT: %impl.elem2: type = impl_witness_access constants.%I3.lookup_impl_witness, element2 [symbolic_self = constants.%impl.elem2]
  754. // CHECK:STDOUT: %BAD2.ref: <error> = name_ref BAD2, <error> [concrete = <error>]
  755. // CHECK:STDOUT: %.loc17_15: type = where_expr %.Self [concrete = <error>] {
  756. // CHECK:STDOUT: requirement_base_facet_type constants.%I3.type
  757. // CHECK:STDOUT: requirement_rewrite %impl.elem0, <error>
  758. // CHECK:STDOUT: requirement_rewrite %impl.elem1, %struct_type.a
  759. // CHECK:STDOUT: requirement_rewrite %impl.elem2, <error>
  760. // CHECK:STDOUT: }
  761. // CHECK:STDOUT: }
  762. // CHECK:STDOUT: impl_decl @C5.as.<error>.impl.eaa268.2 [concrete] {} {
  763. // CHECK:STDOUT: %C5.ref: type = name_ref C5, file.%C5.decl [concrete = constants.%C5]
  764. // CHECK:STDOUT: %I3.ref: type = name_ref I3, imports.%Main.I3 [concrete = constants.%I3.type]
  765. // CHECK:STDOUT: %.Self: %I3.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  766. // CHECK:STDOUT: %.Self.ref.loc27_21: %I3.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  767. // CHECK:STDOUT: %T1.ref: %I3.assoc_type = name_ref T1, imports.%Main.import_ref.f5f [concrete = constants.%assoc0]
  768. // CHECK:STDOUT: %.Self.as_type.loc27_21: type = facet_access_type %.Self.ref.loc27_21 [symbolic_self = constants.%.Self.as_type]
  769. // CHECK:STDOUT: %.loc27_21: type = converted %.Self.ref.loc27_21, %.Self.as_type.loc27_21 [symbolic_self = constants.%.Self.as_type]
  770. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access constants.%I3.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  771. // CHECK:STDOUT: %.loc27_33.1: %empty_struct_type = struct_literal ()
  772. // CHECK:STDOUT: %.loc27_33.2: type = converted %.loc27_33.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  773. // CHECK:STDOUT: %struct_type.b: type = struct_type {.b: %empty_struct_type} [concrete = constants.%struct_type.b]
  774. // CHECK:STDOUT: %.Self.ref.loc27_40: %I3.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  775. // CHECK:STDOUT: %T2.ref: %I3.assoc_type = name_ref T2, imports.%Main.import_ref.680 [concrete = constants.%assoc1]
  776. // CHECK:STDOUT: %.Self.as_type.loc27_40: type = facet_access_type %.Self.ref.loc27_40 [symbolic_self = constants.%.Self.as_type]
  777. // CHECK:STDOUT: %.loc27_40: type = converted %.Self.ref.loc27_40, %.Self.as_type.loc27_40 [symbolic_self = constants.%.Self.as_type]
  778. // CHECK:STDOUT: %impl.elem1: type = impl_witness_access constants.%I3.lookup_impl_witness, element1 [symbolic_self = constants.%impl.elem1]
  779. // CHECK:STDOUT: %BAD3.ref: <error> = name_ref BAD3, <error> [concrete = <error>]
  780. // CHECK:STDOUT: %.Self.ref.loc27_55: %I3.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  781. // CHECK:STDOUT: %T3.ref: %I3.assoc_type = name_ref T3, imports.%Main.import_ref.181 [concrete = constants.%assoc2]
  782. // CHECK:STDOUT: %.Self.as_type.loc27_55: type = facet_access_type %.Self.ref.loc27_55 [symbolic_self = constants.%.Self.as_type]
  783. // CHECK:STDOUT: %.loc27_55: type = converted %.Self.ref.loc27_55, %.Self.as_type.loc27_55 [symbolic_self = constants.%.Self.as_type]
  784. // CHECK:STDOUT: %impl.elem2: type = impl_witness_access constants.%I3.lookup_impl_witness, element2 [symbolic_self = constants.%impl.elem2]
  785. // CHECK:STDOUT: %BAD4.ref: <error> = name_ref BAD4, <error> [concrete = <error>]
  786. // CHECK:STDOUT: %.loc27_15: type = where_expr %.Self [concrete = <error>] {
  787. // CHECK:STDOUT: requirement_base_facet_type constants.%I3.type
  788. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %struct_type.b
  789. // CHECK:STDOUT: requirement_rewrite %impl.elem1, <error>
  790. // CHECK:STDOUT: requirement_rewrite %impl.elem2, <error>
  791. // CHECK:STDOUT: }
  792. // CHECK:STDOUT: }
  793. // CHECK:STDOUT: }
  794. // CHECK:STDOUT:
  795. // CHECK:STDOUT: interface @I3 [from "interface.carbon"] {
  796. // CHECK:STDOUT: !members:
  797. // CHECK:STDOUT: .Self = imports.%Main.import_ref.5be
  798. // CHECK:STDOUT: .T1 = imports.%Main.import_ref.f5f
  799. // CHECK:STDOUT: .T2 = imports.%Main.import_ref.680
  800. // CHECK:STDOUT: .T3 = imports.%Main.import_ref.181
  801. // CHECK:STDOUT: witness = (imports.%Main.T1, imports.%Main.T2, imports.%Main.T3)
  802. // CHECK:STDOUT: }
  803. // CHECK:STDOUT:
  804. // CHECK:STDOUT: generic assoc_const @T1(imports.%Main.import_ref.903fbc.1: %I3.type) [from "interface.carbon"] {
  805. // CHECK:STDOUT: assoc_const T1:! type;
  806. // CHECK:STDOUT: }
  807. // CHECK:STDOUT:
  808. // CHECK:STDOUT: generic assoc_const @T2(imports.%Main.import_ref.903fbc.2: %I3.type) [from "interface.carbon"] {
  809. // CHECK:STDOUT: assoc_const T2:! type;
  810. // CHECK:STDOUT: }
  811. // CHECK:STDOUT:
  812. // CHECK:STDOUT: generic assoc_const @T3(imports.%Main.import_ref.903fbc.3: %I3.type) [from "interface.carbon"] {
  813. // CHECK:STDOUT: assoc_const T3:! type;
  814. // CHECK:STDOUT: }
  815. // CHECK:STDOUT:
  816. // CHECK:STDOUT: impl @C5.as.<error>.impl.eaa268.1: %C5.ref as %.loc17_15;
  817. // CHECK:STDOUT:
  818. // CHECK:STDOUT: impl @C5.as.<error>.impl.eaa268.2: %C5.ref as %.loc27_15 {
  819. // CHECK:STDOUT: !members:
  820. // CHECK:STDOUT: witness = <error>
  821. // CHECK:STDOUT: }
  822. // CHECK:STDOUT:
  823. // CHECK:STDOUT: class @C5 {
  824. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  825. // CHECK:STDOUT: complete_type_witness = %complete_type
  826. // CHECK:STDOUT:
  827. // CHECK:STDOUT: !members:
  828. // CHECK:STDOUT: .Self = constants.%C5
  829. // CHECK:STDOUT: }
  830. // CHECK:STDOUT:
  831. // CHECK:STDOUT: specific @T1(constants.%Self) {}
  832. // CHECK:STDOUT:
  833. // CHECK:STDOUT: specific @T1(constants.%I3.facet) {}
  834. // CHECK:STDOUT:
  835. // CHECK:STDOUT: specific @T2(constants.%Self) {}
  836. // CHECK:STDOUT:
  837. // CHECK:STDOUT: specific @T2(constants.%I3.facet) {}
  838. // CHECK:STDOUT:
  839. // CHECK:STDOUT: specific @T3(constants.%Self) {}
  840. // CHECK:STDOUT:
  841. // CHECK:STDOUT: specific @T3(constants.%I3.facet) {}
  842. // CHECK:STDOUT:
  843. // CHECK:STDOUT: --- fail_missing_on_definition.carbon
  844. // CHECK:STDOUT:
  845. // CHECK:STDOUT: constants {
  846. // CHECK:STDOUT: %C6: type = class_type @C6 [concrete]
  847. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  848. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  849. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  850. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  851. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic_self]
  852. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  853. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, imports.%Main.import_ref.652 [concrete]
  854. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  855. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %.Self, @I [symbolic_self]
  856. // CHECK:STDOUT: %I.facet: %I.type = facet_value %.Self.as_type, (%I.lookup_impl_witness) [symbolic_self]
  857. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %I.lookup_impl_witness, element0 [symbolic_self]
  858. // CHECK:STDOUT: %I_where.type: type = facet_type <@I where %impl.elem0 = %empty_struct_type> [concrete]
  859. // CHECK:STDOUT: %I.impl_witness.255: <witness> = impl_witness file.%I.impl_witness_table.loc5 [concrete]
  860. // CHECK:STDOUT: %I.impl_witness.0fe: <witness> = impl_witness file.%I.impl_witness_table.loc18 [concrete]
  861. // CHECK:STDOUT: }
  862. // CHECK:STDOUT:
  863. // CHECK:STDOUT: imports {
  864. // CHECK:STDOUT: %Main.I: type = import_ref Main//interface, I, loaded [concrete = constants.%I.type]
  865. // CHECK:STDOUT: %Main.I3 = import_ref Main//interface, I3, unloaded
  866. // CHECK:STDOUT: %Main.NonType = import_ref Main//interface, NonType, unloaded
  867. // CHECK:STDOUT: %Main.import_ref.8e7 = import_ref Main//interface, inst17 [no loc], unloaded
  868. // CHECK:STDOUT: %Main.import_ref.4fb: %I.assoc_type = import_ref Main//interface, loc3_20, loaded [concrete = constants.%assoc0]
  869. // CHECK:STDOUT: %Main.T: type = import_ref Main//interface, T, loaded [concrete = %T]
  870. // CHECK:STDOUT: %Main.import_ref.652: type = import_ref Main//interface, loc3_20, loaded [concrete = %T]
  871. // CHECK:STDOUT: %T: type = assoc_const_decl @T [concrete] {}
  872. // CHECK:STDOUT: %Main.import_ref.de2: %I.type = import_ref Main//interface, inst17 [no loc], loaded [symbolic = constants.%Self]
  873. // CHECK:STDOUT: }
  874. // CHECK:STDOUT:
  875. // CHECK:STDOUT: file {
  876. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  877. // CHECK:STDOUT: .I = imports.%Main.I
  878. // CHECK:STDOUT: .I3 = imports.%Main.I3
  879. // CHECK:STDOUT: .NonType = imports.%Main.NonType
  880. // CHECK:STDOUT: .C6 = %C6.decl
  881. // CHECK:STDOUT: }
  882. // CHECK:STDOUT: %default.import = import <none>
  883. // CHECK:STDOUT: %C6.decl: type = class_decl @C6 [concrete = constants.%C6] {} {}
  884. // CHECK:STDOUT: impl_decl @C6.as.I.impl.338 [concrete] {} {
  885. // CHECK:STDOUT: %C6.ref: type = name_ref C6, file.%C6.decl [concrete = constants.%C6]
  886. // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type]
  887. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  888. // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  889. // CHECK:STDOUT: %T.ref: %I.assoc_type = name_ref T, imports.%Main.import_ref.4fb [concrete = constants.%assoc0]
  890. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type]
  891. // CHECK:STDOUT: %.loc5_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type]
  892. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  893. // CHECK:STDOUT: %.loc5_26.1: %empty_struct_type = struct_literal ()
  894. // CHECK:STDOUT: %.loc5_26.2: type = converted %.loc5_26.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  895. // CHECK:STDOUT: %.loc5_14: type = where_expr %.Self [concrete = constants.%I_where.type] {
  896. // CHECK:STDOUT: requirement_base_facet_type constants.%I.type
  897. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc5_26.2
  898. // CHECK:STDOUT: }
  899. // CHECK:STDOUT: }
  900. // CHECK:STDOUT: %I.impl_witness_table.loc5 = impl_witness_table (%impl_witness_assoc_constant), @C6.as.I.impl.338 [concrete]
  901. // CHECK:STDOUT: %I.impl_witness.loc5: <witness> = impl_witness %I.impl_witness_table.loc5 [concrete = constants.%I.impl_witness.255]
  902. // CHECK:STDOUT: %impl_witness_assoc_constant: type = impl_witness_assoc_constant constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  903. // CHECK:STDOUT: impl_decl @C6.as.I.impl.5eb [concrete] {} {
  904. // CHECK:STDOUT: %C6.ref: type = name_ref C6, file.%C6.decl [concrete = constants.%C6]
  905. // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type]
  906. // CHECK:STDOUT: }
  907. // CHECK:STDOUT: %I.impl_witness_table.loc18 = impl_witness_table (<error>), @C6.as.I.impl.5eb [concrete]
  908. // CHECK:STDOUT: %I.impl_witness.loc18: <witness> = impl_witness %I.impl_witness_table.loc18 [concrete = constants.%I.impl_witness.0fe]
  909. // CHECK:STDOUT: }
  910. // CHECK:STDOUT:
  911. // CHECK:STDOUT: interface @I [from "interface.carbon"] {
  912. // CHECK:STDOUT: !members:
  913. // CHECK:STDOUT: .Self = imports.%Main.import_ref.8e7
  914. // CHECK:STDOUT: .T = imports.%Main.import_ref.4fb
  915. // CHECK:STDOUT: witness = (imports.%Main.T)
  916. // CHECK:STDOUT: }
  917. // CHECK:STDOUT:
  918. // CHECK:STDOUT: generic assoc_const @T(imports.%Main.import_ref.de2: %I.type) [from "interface.carbon"] {
  919. // CHECK:STDOUT: assoc_const T:! type;
  920. // CHECK:STDOUT: }
  921. // CHECK:STDOUT:
  922. // CHECK:STDOUT: impl @C6.as.I.impl.338: %C6.ref as %.loc5_14;
  923. // CHECK:STDOUT:
  924. // CHECK:STDOUT: impl @C6.as.I.impl.5eb: %C6.ref as %I.ref {
  925. // CHECK:STDOUT: !members:
  926. // CHECK:STDOUT: witness = file.%I.impl_witness.loc18
  927. // CHECK:STDOUT: }
  928. // CHECK:STDOUT:
  929. // CHECK:STDOUT: class @C6 {
  930. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  931. // CHECK:STDOUT: complete_type_witness = %complete_type
  932. // CHECK:STDOUT:
  933. // CHECK:STDOUT: !members:
  934. // CHECK:STDOUT: .Self = constants.%C6
  935. // CHECK:STDOUT: }
  936. // CHECK:STDOUT:
  937. // CHECK:STDOUT: specific @T(constants.%Self) {}
  938. // CHECK:STDOUT:
  939. // CHECK:STDOUT: specific @T(constants.%I.facet) {}
  940. // CHECK:STDOUT:
  941. // CHECK:STDOUT: --- fail_two_different.carbon
  942. // CHECK:STDOUT:
  943. // CHECK:STDOUT: constants {
  944. // CHECK:STDOUT: %C7: type = class_type @C7 [concrete]
  945. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  946. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  947. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  948. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  949. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic_self]
  950. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  951. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, imports.%Main.import_ref.652 [concrete]
  952. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  953. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %.Self, @I [symbolic_self]
  954. // CHECK:STDOUT: %I.facet: %I.type = facet_value %.Self.as_type, (%I.lookup_impl_witness) [symbolic_self]
  955. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %I.lookup_impl_witness, element0 [symbolic_self]
  956. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  957. // CHECK:STDOUT: }
  958. // CHECK:STDOUT:
  959. // CHECK:STDOUT: imports {
  960. // CHECK:STDOUT: %Main.I: type = import_ref Main//interface, I, loaded [concrete = constants.%I.type]
  961. // CHECK:STDOUT: %Main.I3 = import_ref Main//interface, I3, unloaded
  962. // CHECK:STDOUT: %Main.NonType = import_ref Main//interface, NonType, unloaded
  963. // CHECK:STDOUT: %Main.import_ref.8e7 = import_ref Main//interface, inst17 [no loc], unloaded
  964. // CHECK:STDOUT: %Main.import_ref.4fb: %I.assoc_type = import_ref Main//interface, loc3_20, loaded [concrete = constants.%assoc0]
  965. // CHECK:STDOUT: %Main.T = import_ref Main//interface, T, unloaded
  966. // CHECK:STDOUT: %Main.import_ref.652: type = import_ref Main//interface, loc3_20, loaded [concrete = %T]
  967. // CHECK:STDOUT: %T: type = assoc_const_decl @T [concrete] {}
  968. // CHECK:STDOUT: %Main.import_ref.de2: %I.type = import_ref Main//interface, inst17 [no loc], loaded [symbolic = constants.%Self]
  969. // CHECK:STDOUT: }
  970. // CHECK:STDOUT:
  971. // CHECK:STDOUT: file {
  972. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  973. // CHECK:STDOUT: .I = imports.%Main.I
  974. // CHECK:STDOUT: .I3 = imports.%Main.I3
  975. // CHECK:STDOUT: .NonType = imports.%Main.NonType
  976. // CHECK:STDOUT: .C7 = %C7.decl
  977. // CHECK:STDOUT: }
  978. // CHECK:STDOUT: %default.import = import <none>
  979. // CHECK:STDOUT: %C7.decl: type = class_decl @C7 [concrete = constants.%C7] {} {}
  980. // CHECK:STDOUT: impl_decl @C7.as.<error>.impl [concrete] {} {
  981. // CHECK:STDOUT: %C7.ref: type = name_ref C7, file.%C7.decl [concrete = constants.%C7]
  982. // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type]
  983. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  984. // CHECK:STDOUT: %.Self.ref.loc10_20: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  985. // CHECK:STDOUT: %T.ref.loc10_20: %I.assoc_type = name_ref T, imports.%Main.import_ref.4fb [concrete = constants.%assoc0]
  986. // CHECK:STDOUT: %.Self.as_type.loc10_20: type = facet_access_type %.Self.ref.loc10_20 [symbolic_self = constants.%.Self.as_type]
  987. // CHECK:STDOUT: %.loc10_20: type = converted %.Self.ref.loc10_20, %.Self.as_type.loc10_20 [symbolic_self = constants.%.Self.as_type]
  988. // CHECK:STDOUT: %impl.elem0.loc10_20: type = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  989. // CHECK:STDOUT: %.loc10_26.1: %empty_struct_type = struct_literal ()
  990. // CHECK:STDOUT: %.loc10_26.2: type = converted %.loc10_26.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  991. // CHECK:STDOUT: %.Self.ref.loc10_32: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  992. // CHECK:STDOUT: %T.ref.loc10_32: %I.assoc_type = name_ref T, imports.%Main.import_ref.4fb [concrete = constants.%assoc0]
  993. // CHECK:STDOUT: %.Self.as_type.loc10_32: type = facet_access_type %.Self.ref.loc10_32 [symbolic_self = constants.%.Self.as_type]
  994. // CHECK:STDOUT: %.loc10_32: type = converted %.Self.ref.loc10_32, %.Self.as_type.loc10_32 [symbolic_self = constants.%.Self.as_type]
  995. // CHECK:STDOUT: %impl.elem0.loc10_32: type = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  996. // CHECK:STDOUT: %impl.elem0.subst: type = impl_witness_access_substituted %impl.elem0.loc10_32, %.loc10_26.2 [concrete = constants.%empty_struct_type]
  997. // CHECK:STDOUT: %.loc10_38.1: %empty_tuple.type = tuple_literal ()
  998. // CHECK:STDOUT: %.loc10_38.2: type = converted %.loc10_38.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  999. // CHECK:STDOUT: %.loc10_14: type = where_expr %.Self [concrete = <error>] {
  1000. // CHECK:STDOUT: requirement_base_facet_type constants.%I.type
  1001. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc10_20, %.loc10_26.2
  1002. // CHECK:STDOUT: requirement_rewrite %impl.elem0.subst, %.loc10_38.2
  1003. // CHECK:STDOUT: }
  1004. // CHECK:STDOUT: }
  1005. // CHECK:STDOUT: }
  1006. // CHECK:STDOUT:
  1007. // CHECK:STDOUT: interface @I [from "interface.carbon"] {
  1008. // CHECK:STDOUT: !members:
  1009. // CHECK:STDOUT: .Self = imports.%Main.import_ref.8e7
  1010. // CHECK:STDOUT: .T = imports.%Main.import_ref.4fb
  1011. // CHECK:STDOUT: witness = (imports.%Main.T)
  1012. // CHECK:STDOUT: }
  1013. // CHECK:STDOUT:
  1014. // CHECK:STDOUT: generic assoc_const @T(imports.%Main.import_ref.de2: %I.type) [from "interface.carbon"] {
  1015. // CHECK:STDOUT: assoc_const T:! type;
  1016. // CHECK:STDOUT: }
  1017. // CHECK:STDOUT:
  1018. // CHECK:STDOUT: impl @C7.as.<error>.impl: %C7.ref as %.loc10_14 {
  1019. // CHECK:STDOUT: !members:
  1020. // CHECK:STDOUT: witness = <error>
  1021. // CHECK:STDOUT: }
  1022. // CHECK:STDOUT:
  1023. // CHECK:STDOUT: class @C7 {
  1024. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  1025. // CHECK:STDOUT: complete_type_witness = %complete_type
  1026. // CHECK:STDOUT:
  1027. // CHECK:STDOUT: !members:
  1028. // CHECK:STDOUT: .Self = constants.%C7
  1029. // CHECK:STDOUT: }
  1030. // CHECK:STDOUT:
  1031. // CHECK:STDOUT: specific @T(constants.%Self) {}
  1032. // CHECK:STDOUT:
  1033. // CHECK:STDOUT: specific @T(constants.%I.facet) {}
  1034. // CHECK:STDOUT:
  1035. // CHECK:STDOUT: --- fail_two_different_first_bad.carbon
  1036. // CHECK:STDOUT:
  1037. // CHECK:STDOUT: constants {
  1038. // CHECK:STDOUT: %C8: type = class_type @C8 [concrete]
  1039. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  1040. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  1041. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  1042. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  1043. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic_self]
  1044. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  1045. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, imports.%Main.import_ref.652 [concrete]
  1046. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  1047. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %.Self, @I [symbolic_self]
  1048. // CHECK:STDOUT: %I.facet: %I.type = facet_value %.Self.as_type, (%I.lookup_impl_witness) [symbolic_self]
  1049. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %I.lookup_impl_witness, element0 [symbolic_self]
  1050. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  1051. // CHECK:STDOUT: }
  1052. // CHECK:STDOUT:
  1053. // CHECK:STDOUT: imports {
  1054. // CHECK:STDOUT: %Main.I: type = import_ref Main//interface, I, loaded [concrete = constants.%I.type]
  1055. // CHECK:STDOUT: %Main.I3 = import_ref Main//interface, I3, unloaded
  1056. // CHECK:STDOUT: %Main.NonType = import_ref Main//interface, NonType, unloaded
  1057. // CHECK:STDOUT: %Main.import_ref.8e7 = import_ref Main//interface, inst17 [no loc], unloaded
  1058. // CHECK:STDOUT: %Main.import_ref.4fb: %I.assoc_type = import_ref Main//interface, loc3_20, loaded [concrete = constants.%assoc0]
  1059. // CHECK:STDOUT: %Main.T = import_ref Main//interface, T, unloaded
  1060. // CHECK:STDOUT: %Main.import_ref.652: type = import_ref Main//interface, loc3_20, loaded [concrete = %T]
  1061. // CHECK:STDOUT: %T: type = assoc_const_decl @T [concrete] {}
  1062. // CHECK:STDOUT: %Main.import_ref.de2: %I.type = import_ref Main//interface, inst17 [no loc], loaded [symbolic = constants.%Self]
  1063. // CHECK:STDOUT: }
  1064. // CHECK:STDOUT:
  1065. // CHECK:STDOUT: file {
  1066. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1067. // CHECK:STDOUT: .I = imports.%Main.I
  1068. // CHECK:STDOUT: .I3 = imports.%Main.I3
  1069. // CHECK:STDOUT: .NonType = imports.%Main.NonType
  1070. // CHECK:STDOUT: .C8 = %C8.decl
  1071. // CHECK:STDOUT: .BAD5 = <poisoned>
  1072. // CHECK:STDOUT: }
  1073. // CHECK:STDOUT: %default.import = import <none>
  1074. // CHECK:STDOUT: %C8.decl: type = class_decl @C8 [concrete = constants.%C8] {} {}
  1075. // CHECK:STDOUT: impl_decl @C8.as.<error>.impl [concrete] {} {
  1076. // CHECK:STDOUT: %C8.ref: type = name_ref C8, file.%C8.decl [concrete = constants.%C8]
  1077. // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type]
  1078. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  1079. // CHECK:STDOUT: %.Self.ref.loc10_20: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  1080. // CHECK:STDOUT: %T.ref.loc10_20: %I.assoc_type = name_ref T, imports.%Main.import_ref.4fb [concrete = constants.%assoc0]
  1081. // CHECK:STDOUT: %.Self.as_type.loc10_20: type = facet_access_type %.Self.ref.loc10_20 [symbolic_self = constants.%.Self.as_type]
  1082. // CHECK:STDOUT: %.loc10_20: type = converted %.Self.ref.loc10_20, %.Self.as_type.loc10_20 [symbolic_self = constants.%.Self.as_type]
  1083. // CHECK:STDOUT: %impl.elem0.loc10_20: type = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  1084. // CHECK:STDOUT: %BAD5.ref: <error> = name_ref BAD5, <error> [concrete = <error>]
  1085. // CHECK:STDOUT: %.Self.ref.loc10_34: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  1086. // CHECK:STDOUT: %T.ref.loc10_34: %I.assoc_type = name_ref T, imports.%Main.import_ref.4fb [concrete = constants.%assoc0]
  1087. // CHECK:STDOUT: %.Self.as_type.loc10_34: type = facet_access_type %.Self.ref.loc10_34 [symbolic_self = constants.%.Self.as_type]
  1088. // CHECK:STDOUT: %.loc10_34: type = converted %.Self.ref.loc10_34, %.Self.as_type.loc10_34 [symbolic_self = constants.%.Self.as_type]
  1089. // CHECK:STDOUT: %impl.elem0.loc10_34: type = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  1090. // CHECK:STDOUT: %impl.elem0.subst: type = impl_witness_access_substituted %impl.elem0.loc10_34, <error> [concrete = <error>]
  1091. // CHECK:STDOUT: %.loc10_40.1: %empty_tuple.type = tuple_literal ()
  1092. // CHECK:STDOUT: %.loc10_40.2: type = converted %.loc10_40.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  1093. // CHECK:STDOUT: %.loc10_14: type = where_expr %.Self [concrete = <error>] {
  1094. // CHECK:STDOUT: requirement_base_facet_type constants.%I.type
  1095. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc10_20, <error>
  1096. // CHECK:STDOUT: requirement_rewrite %impl.elem0.subst, %.loc10_40.2
  1097. // CHECK:STDOUT: }
  1098. // CHECK:STDOUT: }
  1099. // CHECK:STDOUT: }
  1100. // CHECK:STDOUT:
  1101. // CHECK:STDOUT: interface @I [from "interface.carbon"] {
  1102. // CHECK:STDOUT: !members:
  1103. // CHECK:STDOUT: .Self = imports.%Main.import_ref.8e7
  1104. // CHECK:STDOUT: .T = imports.%Main.import_ref.4fb
  1105. // CHECK:STDOUT: witness = (imports.%Main.T)
  1106. // CHECK:STDOUT: }
  1107. // CHECK:STDOUT:
  1108. // CHECK:STDOUT: generic assoc_const @T(imports.%Main.import_ref.de2: %I.type) [from "interface.carbon"] {
  1109. // CHECK:STDOUT: assoc_const T:! type;
  1110. // CHECK:STDOUT: }
  1111. // CHECK:STDOUT:
  1112. // CHECK:STDOUT: impl @C8.as.<error>.impl: %C8.ref as %.loc10_14 {
  1113. // CHECK:STDOUT: !members:
  1114. // CHECK:STDOUT: witness = <error>
  1115. // CHECK:STDOUT: }
  1116. // CHECK:STDOUT:
  1117. // CHECK:STDOUT: class @C8 {
  1118. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  1119. // CHECK:STDOUT: complete_type_witness = %complete_type
  1120. // CHECK:STDOUT:
  1121. // CHECK:STDOUT: !members:
  1122. // CHECK:STDOUT: .Self = constants.%C8
  1123. // CHECK:STDOUT: }
  1124. // CHECK:STDOUT:
  1125. // CHECK:STDOUT: specific @T(constants.%Self) {}
  1126. // CHECK:STDOUT:
  1127. // CHECK:STDOUT: specific @T(constants.%I.facet) {}
  1128. // CHECK:STDOUT:
  1129. // CHECK:STDOUT: --- fail_two_different_second_bad.carbon
  1130. // CHECK:STDOUT:
  1131. // CHECK:STDOUT: constants {
  1132. // CHECK:STDOUT: %C9: type = class_type @C9 [concrete]
  1133. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  1134. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  1135. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  1136. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  1137. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic_self]
  1138. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  1139. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, imports.%Main.import_ref.652 [concrete]
  1140. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  1141. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %.Self, @I [symbolic_self]
  1142. // CHECK:STDOUT: %I.facet: %I.type = facet_value %.Self.as_type, (%I.lookup_impl_witness) [symbolic_self]
  1143. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %I.lookup_impl_witness, element0 [symbolic_self]
  1144. // CHECK:STDOUT: }
  1145. // CHECK:STDOUT:
  1146. // CHECK:STDOUT: imports {
  1147. // CHECK:STDOUT: %Main.I: type = import_ref Main//interface, I, loaded [concrete = constants.%I.type]
  1148. // CHECK:STDOUT: %Main.I3 = import_ref Main//interface, I3, unloaded
  1149. // CHECK:STDOUT: %Main.NonType = import_ref Main//interface, NonType, unloaded
  1150. // CHECK:STDOUT: %Main.import_ref.8e7 = import_ref Main//interface, inst17 [no loc], unloaded
  1151. // CHECK:STDOUT: %Main.import_ref.4fb: %I.assoc_type = import_ref Main//interface, loc3_20, loaded [concrete = constants.%assoc0]
  1152. // CHECK:STDOUT: %Main.T = import_ref Main//interface, T, unloaded
  1153. // CHECK:STDOUT: %Main.import_ref.652: type = import_ref Main//interface, loc3_20, loaded [concrete = %T]
  1154. // CHECK:STDOUT: %T: type = assoc_const_decl @T [concrete] {}
  1155. // CHECK:STDOUT: %Main.import_ref.de2: %I.type = import_ref Main//interface, inst17 [no loc], loaded [symbolic = constants.%Self]
  1156. // CHECK:STDOUT: }
  1157. // CHECK:STDOUT:
  1158. // CHECK:STDOUT: file {
  1159. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1160. // CHECK:STDOUT: .I = imports.%Main.I
  1161. // CHECK:STDOUT: .I3 = imports.%Main.I3
  1162. // CHECK:STDOUT: .NonType = imports.%Main.NonType
  1163. // CHECK:STDOUT: .C9 = %C9.decl
  1164. // CHECK:STDOUT: .BAD6 = <poisoned>
  1165. // CHECK:STDOUT: }
  1166. // CHECK:STDOUT: %default.import = import <none>
  1167. // CHECK:STDOUT: %C9.decl: type = class_decl @C9 [concrete = constants.%C9] {} {}
  1168. // CHECK:STDOUT: impl_decl @C9.as.<error>.impl [concrete] {} {
  1169. // CHECK:STDOUT: %C9.ref: type = name_ref C9, file.%C9.decl [concrete = constants.%C9]
  1170. // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type]
  1171. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  1172. // CHECK:STDOUT: %.Self.ref.loc10_20: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  1173. // CHECK:STDOUT: %T.ref.loc10_20: %I.assoc_type = name_ref T, imports.%Main.import_ref.4fb [concrete = constants.%assoc0]
  1174. // CHECK:STDOUT: %.Self.as_type.loc10_20: type = facet_access_type %.Self.ref.loc10_20 [symbolic_self = constants.%.Self.as_type]
  1175. // CHECK:STDOUT: %.loc10_20: type = converted %.Self.ref.loc10_20, %.Self.as_type.loc10_20 [symbolic_self = constants.%.Self.as_type]
  1176. // CHECK:STDOUT: %impl.elem0.loc10_20: type = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  1177. // CHECK:STDOUT: %.loc10_26.1: %empty_struct_type = struct_literal ()
  1178. // CHECK:STDOUT: %.loc10_26.2: type = converted %.loc10_26.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  1179. // CHECK:STDOUT: %.Self.ref.loc10_32: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  1180. // CHECK:STDOUT: %T.ref.loc10_32: %I.assoc_type = name_ref T, imports.%Main.import_ref.4fb [concrete = constants.%assoc0]
  1181. // CHECK:STDOUT: %.Self.as_type.loc10_32: type = facet_access_type %.Self.ref.loc10_32 [symbolic_self = constants.%.Self.as_type]
  1182. // CHECK:STDOUT: %.loc10_32: type = converted %.Self.ref.loc10_32, %.Self.as_type.loc10_32 [symbolic_self = constants.%.Self.as_type]
  1183. // CHECK:STDOUT: %impl.elem0.loc10_32: type = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  1184. // CHECK:STDOUT: %impl.elem0.subst: type = impl_witness_access_substituted %impl.elem0.loc10_32, %.loc10_26.2 [concrete = constants.%empty_struct_type]
  1185. // CHECK:STDOUT: %BAD6.ref: <error> = name_ref BAD6, <error> [concrete = <error>]
  1186. // CHECK:STDOUT: %.loc10_14: type = where_expr %.Self [concrete = <error>] {
  1187. // CHECK:STDOUT: requirement_base_facet_type constants.%I.type
  1188. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc10_20, %.loc10_26.2
  1189. // CHECK:STDOUT: requirement_rewrite %impl.elem0.subst, <error>
  1190. // CHECK:STDOUT: }
  1191. // CHECK:STDOUT: }
  1192. // CHECK:STDOUT: }
  1193. // CHECK:STDOUT:
  1194. // CHECK:STDOUT: interface @I [from "interface.carbon"] {
  1195. // CHECK:STDOUT: !members:
  1196. // CHECK:STDOUT: .Self = imports.%Main.import_ref.8e7
  1197. // CHECK:STDOUT: .T = imports.%Main.import_ref.4fb
  1198. // CHECK:STDOUT: witness = (imports.%Main.T)
  1199. // CHECK:STDOUT: }
  1200. // CHECK:STDOUT:
  1201. // CHECK:STDOUT: generic assoc_const @T(imports.%Main.import_ref.de2: %I.type) [from "interface.carbon"] {
  1202. // CHECK:STDOUT: assoc_const T:! type;
  1203. // CHECK:STDOUT: }
  1204. // CHECK:STDOUT:
  1205. // CHECK:STDOUT: impl @C9.as.<error>.impl: %C9.ref as %.loc10_14 {
  1206. // CHECK:STDOUT: !members:
  1207. // CHECK:STDOUT: witness = <error>
  1208. // CHECK:STDOUT: }
  1209. // CHECK:STDOUT:
  1210. // CHECK:STDOUT: class @C9 {
  1211. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  1212. // CHECK:STDOUT: complete_type_witness = %complete_type
  1213. // CHECK:STDOUT:
  1214. // CHECK:STDOUT: !members:
  1215. // CHECK:STDOUT: .Self = constants.%C9
  1216. // CHECK:STDOUT: }
  1217. // CHECK:STDOUT:
  1218. // CHECK:STDOUT: specific @T(constants.%Self) {}
  1219. // CHECK:STDOUT:
  1220. // CHECK:STDOUT: specific @T(constants.%I.facet) {}
  1221. // CHECK:STDOUT:
  1222. // CHECK:STDOUT: --- fail_two_different_both_bad.carbon
  1223. // CHECK:STDOUT:
  1224. // CHECK:STDOUT: constants {
  1225. // CHECK:STDOUT: %CA: type = class_type @CA [concrete]
  1226. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  1227. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  1228. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  1229. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  1230. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic_self]
  1231. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  1232. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, imports.%Main.import_ref.652 [concrete]
  1233. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  1234. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %.Self, @I [symbolic_self]
  1235. // CHECK:STDOUT: %I.facet: %I.type = facet_value %.Self.as_type, (%I.lookup_impl_witness) [symbolic_self]
  1236. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %I.lookup_impl_witness, element0 [symbolic_self]
  1237. // CHECK:STDOUT: }
  1238. // CHECK:STDOUT:
  1239. // CHECK:STDOUT: imports {
  1240. // CHECK:STDOUT: %Main.I: type = import_ref Main//interface, I, loaded [concrete = constants.%I.type]
  1241. // CHECK:STDOUT: %Main.I3 = import_ref Main//interface, I3, unloaded
  1242. // CHECK:STDOUT: %Main.NonType = import_ref Main//interface, NonType, unloaded
  1243. // CHECK:STDOUT: %Main.import_ref.8e7 = import_ref Main//interface, inst17 [no loc], unloaded
  1244. // CHECK:STDOUT: %Main.import_ref.4fb: %I.assoc_type = import_ref Main//interface, loc3_20, loaded [concrete = constants.%assoc0]
  1245. // CHECK:STDOUT: %Main.T = import_ref Main//interface, T, unloaded
  1246. // CHECK:STDOUT: %Main.import_ref.652: type = import_ref Main//interface, loc3_20, loaded [concrete = %T]
  1247. // CHECK:STDOUT: %T: type = assoc_const_decl @T [concrete] {}
  1248. // CHECK:STDOUT: %Main.import_ref.de2: %I.type = import_ref Main//interface, inst17 [no loc], loaded [symbolic = constants.%Self]
  1249. // CHECK:STDOUT: }
  1250. // CHECK:STDOUT:
  1251. // CHECK:STDOUT: file {
  1252. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1253. // CHECK:STDOUT: .I = imports.%Main.I
  1254. // CHECK:STDOUT: .I3 = imports.%Main.I3
  1255. // CHECK:STDOUT: .NonType = imports.%Main.NonType
  1256. // CHECK:STDOUT: .CA = %CA.decl
  1257. // CHECK:STDOUT: .BAD7 = <poisoned>
  1258. // CHECK:STDOUT: .BAD8 = <poisoned>
  1259. // CHECK:STDOUT: }
  1260. // CHECK:STDOUT: %default.import = import <none>
  1261. // CHECK:STDOUT: %CA.decl: type = class_decl @CA [concrete = constants.%CA] {} {}
  1262. // CHECK:STDOUT: impl_decl @CA.as.<error>.impl [concrete] {} {
  1263. // CHECK:STDOUT: %CA.ref: type = name_ref CA, file.%CA.decl [concrete = constants.%CA]
  1264. // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type]
  1265. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  1266. // CHECK:STDOUT: %.Self.ref.loc14_20: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  1267. // CHECK:STDOUT: %T.ref.loc14_20: %I.assoc_type = name_ref T, imports.%Main.import_ref.4fb [concrete = constants.%assoc0]
  1268. // CHECK:STDOUT: %.Self.as_type.loc14_20: type = facet_access_type %.Self.ref.loc14_20 [symbolic_self = constants.%.Self.as_type]
  1269. // CHECK:STDOUT: %.loc14_20: type = converted %.Self.ref.loc14_20, %.Self.as_type.loc14_20 [symbolic_self = constants.%.Self.as_type]
  1270. // CHECK:STDOUT: %impl.elem0.loc14_20: type = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  1271. // CHECK:STDOUT: %BAD7.ref: <error> = name_ref BAD7, <error> [concrete = <error>]
  1272. // CHECK:STDOUT: %.Self.ref.loc14_34: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  1273. // CHECK:STDOUT: %T.ref.loc14_34: %I.assoc_type = name_ref T, imports.%Main.import_ref.4fb [concrete = constants.%assoc0]
  1274. // CHECK:STDOUT: %.Self.as_type.loc14_34: type = facet_access_type %.Self.ref.loc14_34 [symbolic_self = constants.%.Self.as_type]
  1275. // CHECK:STDOUT: %.loc14_34: type = converted %.Self.ref.loc14_34, %.Self.as_type.loc14_34 [symbolic_self = constants.%.Self.as_type]
  1276. // CHECK:STDOUT: %impl.elem0.loc14_34: type = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  1277. // CHECK:STDOUT: %impl.elem0.subst: type = impl_witness_access_substituted %impl.elem0.loc14_34, <error> [concrete = <error>]
  1278. // CHECK:STDOUT: %BAD8.ref: <error> = name_ref BAD8, <error> [concrete = <error>]
  1279. // CHECK:STDOUT: %.loc14_14: type = where_expr %.Self [concrete = <error>] {
  1280. // CHECK:STDOUT: requirement_base_facet_type constants.%I.type
  1281. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc14_20, <error>
  1282. // CHECK:STDOUT: requirement_rewrite %impl.elem0.subst, <error>
  1283. // CHECK:STDOUT: }
  1284. // CHECK:STDOUT: }
  1285. // CHECK:STDOUT: }
  1286. // CHECK:STDOUT:
  1287. // CHECK:STDOUT: interface @I [from "interface.carbon"] {
  1288. // CHECK:STDOUT: !members:
  1289. // CHECK:STDOUT: .Self = imports.%Main.import_ref.8e7
  1290. // CHECK:STDOUT: .T = imports.%Main.import_ref.4fb
  1291. // CHECK:STDOUT: witness = (imports.%Main.T)
  1292. // CHECK:STDOUT: }
  1293. // CHECK:STDOUT:
  1294. // CHECK:STDOUT: generic assoc_const @T(imports.%Main.import_ref.de2: %I.type) [from "interface.carbon"] {
  1295. // CHECK:STDOUT: assoc_const T:! type;
  1296. // CHECK:STDOUT: }
  1297. // CHECK:STDOUT:
  1298. // CHECK:STDOUT: impl @CA.as.<error>.impl: %CA.ref as %.loc14_14 {
  1299. // CHECK:STDOUT: !members:
  1300. // CHECK:STDOUT: witness = <error>
  1301. // CHECK:STDOUT: }
  1302. // CHECK:STDOUT:
  1303. // CHECK:STDOUT: class @CA {
  1304. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  1305. // CHECK:STDOUT: complete_type_witness = %complete_type
  1306. // CHECK:STDOUT:
  1307. // CHECK:STDOUT: !members:
  1308. // CHECK:STDOUT: .Self = constants.%CA
  1309. // CHECK:STDOUT: }
  1310. // CHECK:STDOUT:
  1311. // CHECK:STDOUT: specific @T(constants.%Self) {}
  1312. // CHECK:STDOUT:
  1313. // CHECK:STDOUT: specific @T(constants.%I.facet) {}
  1314. // CHECK:STDOUT:
  1315. // CHECK:STDOUT: --- repeated.carbon
  1316. // CHECK:STDOUT:
  1317. // CHECK:STDOUT: constants {
  1318. // CHECK:STDOUT: %CB: type = class_type @CB [concrete]
  1319. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  1320. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  1321. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  1322. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  1323. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic_self]
  1324. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  1325. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, imports.%Main.import_ref.652 [concrete]
  1326. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  1327. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %.Self, @I [symbolic_self]
  1328. // CHECK:STDOUT: %I.facet: %I.type = facet_value %.Self.as_type, (%I.lookup_impl_witness) [symbolic_self]
  1329. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %I.lookup_impl_witness, element0 [symbolic_self]
  1330. // CHECK:STDOUT: %I_where.type: type = facet_type <@I where %impl.elem0 = %empty_struct_type> [concrete]
  1331. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness file.%I.impl_witness_table [concrete]
  1332. // CHECK:STDOUT: }
  1333. // CHECK:STDOUT:
  1334. // CHECK:STDOUT: imports {
  1335. // CHECK:STDOUT: %Main.I: type = import_ref Main//interface, I, loaded [concrete = constants.%I.type]
  1336. // CHECK:STDOUT: %Main.I3 = import_ref Main//interface, I3, unloaded
  1337. // CHECK:STDOUT: %Main.NonType = import_ref Main//interface, NonType, unloaded
  1338. // CHECK:STDOUT: %Main.import_ref.8e7 = import_ref Main//interface, inst17 [no loc], unloaded
  1339. // CHECK:STDOUT: %Main.import_ref.4fb: %I.assoc_type = import_ref Main//interface, loc3_20, loaded [concrete = constants.%assoc0]
  1340. // CHECK:STDOUT: %Main.T: type = import_ref Main//interface, T, loaded [concrete = %T]
  1341. // CHECK:STDOUT: %Main.import_ref.652: type = import_ref Main//interface, loc3_20, loaded [concrete = %T]
  1342. // CHECK:STDOUT: %T: type = assoc_const_decl @T [concrete] {}
  1343. // CHECK:STDOUT: %Main.import_ref.de2: %I.type = import_ref Main//interface, inst17 [no loc], loaded [symbolic = constants.%Self]
  1344. // CHECK:STDOUT: }
  1345. // CHECK:STDOUT:
  1346. // CHECK:STDOUT: file {
  1347. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1348. // CHECK:STDOUT: .I = imports.%Main.I
  1349. // CHECK:STDOUT: .I3 = imports.%Main.I3
  1350. // CHECK:STDOUT: .NonType = imports.%Main.NonType
  1351. // CHECK:STDOUT: .CB = %CB.decl
  1352. // CHECK:STDOUT: }
  1353. // CHECK:STDOUT: %default.import = import <none>
  1354. // CHECK:STDOUT: %CB.decl: type = class_decl @CB [concrete = constants.%CB] {} {}
  1355. // CHECK:STDOUT: impl_decl @CB.as.I.impl [concrete] {} {
  1356. // CHECK:STDOUT: %CB.ref: type = name_ref CB, file.%CB.decl [concrete = constants.%CB]
  1357. // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type]
  1358. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  1359. // CHECK:STDOUT: %.Self.ref.loc6_20: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  1360. // CHECK:STDOUT: %T.ref.loc6_20: %I.assoc_type = name_ref T, imports.%Main.import_ref.4fb [concrete = constants.%assoc0]
  1361. // CHECK:STDOUT: %.Self.as_type.loc6_20: type = facet_access_type %.Self.ref.loc6_20 [symbolic_self = constants.%.Self.as_type]
  1362. // CHECK:STDOUT: %.loc6_20: type = converted %.Self.ref.loc6_20, %.Self.as_type.loc6_20 [symbolic_self = constants.%.Self.as_type]
  1363. // CHECK:STDOUT: %impl.elem0.loc6_20: type = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  1364. // CHECK:STDOUT: %.loc6_26.1: %empty_struct_type = struct_literal ()
  1365. // CHECK:STDOUT: %.loc6_26.2: type = converted %.loc6_26.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  1366. // CHECK:STDOUT: %.Self.ref.loc6_32: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  1367. // CHECK:STDOUT: %T.ref.loc6_32: %I.assoc_type = name_ref T, imports.%Main.import_ref.4fb [concrete = constants.%assoc0]
  1368. // CHECK:STDOUT: %.Self.as_type.loc6_32: type = facet_access_type %.Self.ref.loc6_32 [symbolic_self = constants.%.Self.as_type]
  1369. // CHECK:STDOUT: %.loc6_32: type = converted %.Self.ref.loc6_32, %.Self.as_type.loc6_32 [symbolic_self = constants.%.Self.as_type]
  1370. // CHECK:STDOUT: %impl.elem0.loc6_32: type = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  1371. // CHECK:STDOUT: %impl.elem0.subst: type = impl_witness_access_substituted %impl.elem0.loc6_32, %.loc6_26.2 [concrete = constants.%empty_struct_type]
  1372. // CHECK:STDOUT: %.loc6_38.1: %empty_struct_type = struct_literal ()
  1373. // CHECK:STDOUT: %.loc6_38.2: type = converted %.loc6_38.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  1374. // CHECK:STDOUT: %.loc6_14: type = where_expr %.Self [concrete = constants.%I_where.type] {
  1375. // CHECK:STDOUT: requirement_base_facet_type constants.%I.type
  1376. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc6_20, %.loc6_26.2
  1377. // CHECK:STDOUT: requirement_rewrite %impl.elem0.subst, %.loc6_38.2
  1378. // CHECK:STDOUT: }
  1379. // CHECK:STDOUT: }
  1380. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%impl_witness_assoc_constant), @CB.as.I.impl [concrete]
  1381. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness]
  1382. // CHECK:STDOUT: %impl_witness_assoc_constant: type = impl_witness_assoc_constant constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  1383. // CHECK:STDOUT: }
  1384. // CHECK:STDOUT:
  1385. // CHECK:STDOUT: interface @I [from "interface.carbon"] {
  1386. // CHECK:STDOUT: !members:
  1387. // CHECK:STDOUT: .Self = imports.%Main.import_ref.8e7
  1388. // CHECK:STDOUT: .T = imports.%Main.import_ref.4fb
  1389. // CHECK:STDOUT: witness = (imports.%Main.T)
  1390. // CHECK:STDOUT: }
  1391. // CHECK:STDOUT:
  1392. // CHECK:STDOUT: generic assoc_const @T(imports.%Main.import_ref.de2: %I.type) [from "interface.carbon"] {
  1393. // CHECK:STDOUT: assoc_const T:! type;
  1394. // CHECK:STDOUT: }
  1395. // CHECK:STDOUT:
  1396. // CHECK:STDOUT: impl @CB.as.I.impl: %CB.ref as %.loc6_14 {
  1397. // CHECK:STDOUT: !members:
  1398. // CHECK:STDOUT: witness = file.%I.impl_witness
  1399. // CHECK:STDOUT: }
  1400. // CHECK:STDOUT:
  1401. // CHECK:STDOUT: class @CB {
  1402. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  1403. // CHECK:STDOUT: complete_type_witness = %complete_type
  1404. // CHECK:STDOUT:
  1405. // CHECK:STDOUT: !members:
  1406. // CHECK:STDOUT: .Self = constants.%CB
  1407. // CHECK:STDOUT: }
  1408. // CHECK:STDOUT:
  1409. // CHECK:STDOUT: specific @T(constants.%Self) {}
  1410. // CHECK:STDOUT:
  1411. // CHECK:STDOUT: specific @T(constants.%I.facet) {}
  1412. // CHECK:STDOUT:
  1413. // CHECK:STDOUT: --- non-type.carbon
  1414. // CHECK:STDOUT:
  1415. // CHECK:STDOUT: constants {
  1416. // CHECK:STDOUT: %CC: type = class_type @CC [concrete]
  1417. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  1418. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  1419. // CHECK:STDOUT: %NonType.type: type = facet_type <@NonType> [concrete]
  1420. // CHECK:STDOUT: %Self: %NonType.type = bind_symbolic_name Self, 0 [symbolic]
  1421. // CHECK:STDOUT: %.Self: %NonType.type = bind_symbolic_name .Self [symbolic_self]
  1422. // CHECK:STDOUT: %NonType.assoc_type: type = assoc_entity_type @NonType [concrete]
  1423. // CHECK:STDOUT: %assoc0: %NonType.assoc_type = assoc_entity element0, imports.%Main.import_ref.f3d [concrete]
  1424. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  1425. // CHECK:STDOUT: %NonType.lookup_impl_witness: <witness> = lookup_impl_witness %.Self, @NonType [symbolic_self]
  1426. // CHECK:STDOUT: %struct_type.a.225: type = struct_type {.a: %empty_struct_type} [concrete]
  1427. // CHECK:STDOUT: %NonType.facet: %NonType.type = facet_value %.Self.as_type, (%NonType.lookup_impl_witness) [symbolic_self]
  1428. // CHECK:STDOUT: %impl.elem0: %struct_type.a.225 = impl_witness_access %NonType.lookup_impl_witness, element0 [symbolic_self]
  1429. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  1430. // CHECK:STDOUT: %struct: %struct_type.a.225 = struct_value (%empty_struct) [concrete]
  1431. // CHECK:STDOUT: %NonType_where.type: type = facet_type <@NonType where %impl.elem0 = %struct> [concrete]
  1432. // CHECK:STDOUT: %NonType.impl_witness: <witness> = impl_witness file.%NonType.impl_witness_table [concrete]
  1433. // CHECK:STDOUT: }
  1434. // CHECK:STDOUT:
  1435. // CHECK:STDOUT: imports {
  1436. // CHECK:STDOUT: %Main.I = import_ref Main//interface, I, unloaded
  1437. // CHECK:STDOUT: %Main.I3 = import_ref Main//interface, I3, unloaded
  1438. // CHECK:STDOUT: %Main.NonType: type = import_ref Main//interface, NonType, loaded [concrete = constants.%NonType.type]
  1439. // CHECK:STDOUT: %Main.import_ref.275 = import_ref Main//interface, inst41 [no loc], unloaded
  1440. // CHECK:STDOUT: %Main.import_ref.9fa: %NonType.assoc_type = import_ref Main//interface, loc12_8, loaded [concrete = constants.%assoc0]
  1441. // CHECK:STDOUT: %Main.Y: %struct_type.a.225 = import_ref Main//interface, Y, loaded [concrete = %Y]
  1442. // CHECK:STDOUT: %Main.import_ref.f3d: %struct_type.a.225 = import_ref Main//interface, loc12_8, loaded [concrete = %Y]
  1443. // CHECK:STDOUT: %Y: %struct_type.a.225 = assoc_const_decl @Y [concrete] {}
  1444. // CHECK:STDOUT: %Main.import_ref.d48: %NonType.type = import_ref Main//interface, inst41 [no loc], loaded [symbolic = constants.%Self]
  1445. // CHECK:STDOUT: }
  1446. // CHECK:STDOUT:
  1447. // CHECK:STDOUT: file {
  1448. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1449. // CHECK:STDOUT: .I = imports.%Main.I
  1450. // CHECK:STDOUT: .I3 = imports.%Main.I3
  1451. // CHECK:STDOUT: .NonType = imports.%Main.NonType
  1452. // CHECK:STDOUT: .CC = %CC.decl
  1453. // CHECK:STDOUT: }
  1454. // CHECK:STDOUT: %default.import = import <none>
  1455. // CHECK:STDOUT: %CC.decl: type = class_decl @CC [concrete = constants.%CC] {} {}
  1456. // CHECK:STDOUT: impl_decl @CC.as.NonType.impl [concrete] {} {
  1457. // CHECK:STDOUT: %CC.ref: type = name_ref CC, file.%CC.decl [concrete = constants.%CC]
  1458. // CHECK:STDOUT: %NonType.ref: type = name_ref NonType, imports.%Main.NonType [concrete = constants.%NonType.type]
  1459. // CHECK:STDOUT: %.Self: %NonType.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  1460. // CHECK:STDOUT: %.Self.ref: %NonType.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  1461. // CHECK:STDOUT: %Y.ref: %NonType.assoc_type = name_ref Y, imports.%Main.import_ref.9fa [concrete = constants.%assoc0]
  1462. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type]
  1463. // CHECK:STDOUT: %.loc6_26: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type]
  1464. // CHECK:STDOUT: %impl.elem0: %struct_type.a.225 = impl_witness_access constants.%NonType.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  1465. // CHECK:STDOUT: %.loc6_38: %empty_struct_type = struct_literal ()
  1466. // CHECK:STDOUT: %.loc6_39.1: %struct_type.a.225 = struct_literal (%.loc6_38)
  1467. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete = constants.%empty_struct]
  1468. // CHECK:STDOUT: %.loc6_39.2: %empty_struct_type = converted %.loc6_38, %empty_struct [concrete = constants.%empty_struct]
  1469. // CHECK:STDOUT: %struct: %struct_type.a.225 = struct_value (%.loc6_39.2) [concrete = constants.%struct]
  1470. // CHECK:STDOUT: %.loc6_39.3: %struct_type.a.225 = converted %.loc6_39.1, %struct [concrete = constants.%struct]
  1471. // CHECK:STDOUT: %.loc6_20: type = where_expr %.Self [concrete = constants.%NonType_where.type] {
  1472. // CHECK:STDOUT: requirement_base_facet_type constants.%NonType.type
  1473. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc6_39.3
  1474. // CHECK:STDOUT: }
  1475. // CHECK:STDOUT: }
  1476. // CHECK:STDOUT: %NonType.impl_witness_table = impl_witness_table (%impl_witness_assoc_constant), @CC.as.NonType.impl [concrete]
  1477. // CHECK:STDOUT: %NonType.impl_witness: <witness> = impl_witness %NonType.impl_witness_table [concrete = constants.%NonType.impl_witness]
  1478. // CHECK:STDOUT: %impl_witness_assoc_constant: %struct_type.a.225 = impl_witness_assoc_constant constants.%struct [concrete = constants.%struct]
  1479. // CHECK:STDOUT: }
  1480. // CHECK:STDOUT:
  1481. // CHECK:STDOUT: interface @NonType [from "interface.carbon"] {
  1482. // CHECK:STDOUT: !members:
  1483. // CHECK:STDOUT: .Self = imports.%Main.import_ref.275
  1484. // CHECK:STDOUT: .Y = imports.%Main.import_ref.9fa
  1485. // CHECK:STDOUT: witness = (imports.%Main.Y)
  1486. // CHECK:STDOUT: }
  1487. // CHECK:STDOUT:
  1488. // CHECK:STDOUT: generic assoc_const @Y(imports.%Main.import_ref.d48: %NonType.type) [from "interface.carbon"] {
  1489. // CHECK:STDOUT: assoc_const Y:! %struct_type.a.225;
  1490. // CHECK:STDOUT: }
  1491. // CHECK:STDOUT:
  1492. // CHECK:STDOUT: impl @CC.as.NonType.impl: %CC.ref as %.loc6_20 {
  1493. // CHECK:STDOUT: !members:
  1494. // CHECK:STDOUT: witness = file.%NonType.impl_witness
  1495. // CHECK:STDOUT: }
  1496. // CHECK:STDOUT:
  1497. // CHECK:STDOUT: class @CC {
  1498. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  1499. // CHECK:STDOUT: complete_type_witness = %complete_type
  1500. // CHECK:STDOUT:
  1501. // CHECK:STDOUT: !members:
  1502. // CHECK:STDOUT: .Self = constants.%CC
  1503. // CHECK:STDOUT: }
  1504. // CHECK:STDOUT:
  1505. // CHECK:STDOUT: specific @Y(constants.%Self) {}
  1506. // CHECK:STDOUT:
  1507. // CHECK:STDOUT: specific @Y(constants.%NonType.facet) {}
  1508. // CHECK:STDOUT:
  1509. // CHECK:STDOUT: --- interface_with_function.carbon
  1510. // CHECK:STDOUT:
  1511. // CHECK:STDOUT: constants {
  1512. // CHECK:STDOUT: %IF.type: type = facet_type <@IF> [concrete]
  1513. // CHECK:STDOUT: %Self: %IF.type = bind_symbolic_name Self, 0 [symbolic]
  1514. // CHECK:STDOUT: %IF.F.type: type = fn_type @IF.F [concrete]
  1515. // CHECK:STDOUT: %IF.F: %IF.F.type = struct_value () [concrete]
  1516. // CHECK:STDOUT: %IF.assoc_type: type = assoc_entity_type @IF [concrete]
  1517. // CHECK:STDOUT: %assoc0: %IF.assoc_type = assoc_entity element0, @IF.%IF.F.decl [concrete]
  1518. // CHECK:STDOUT: }
  1519. // CHECK:STDOUT:
  1520. // CHECK:STDOUT: file {
  1521. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1522. // CHECK:STDOUT: .IF = %IF.decl
  1523. // CHECK:STDOUT: }
  1524. // CHECK:STDOUT: %IF.decl: type = interface_decl @IF [concrete = constants.%IF.type] {} {}
  1525. // CHECK:STDOUT: }
  1526. // CHECK:STDOUT:
  1527. // CHECK:STDOUT: interface @IF {
  1528. // CHECK:STDOUT: %Self: %IF.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  1529. // CHECK:STDOUT: %IF.F.decl: %IF.F.type = fn_decl @IF.F [concrete = constants.%IF.F] {} {}
  1530. // CHECK:STDOUT: %assoc0: %IF.assoc_type = assoc_entity element0, %IF.F.decl [concrete = constants.%assoc0]
  1531. // CHECK:STDOUT:
  1532. // CHECK:STDOUT: !members:
  1533. // CHECK:STDOUT: .Self = %Self
  1534. // CHECK:STDOUT: .F = %assoc0
  1535. // CHECK:STDOUT: witness = (%IF.F.decl)
  1536. // CHECK:STDOUT: }
  1537. // CHECK:STDOUT:
  1538. // CHECK:STDOUT: generic fn @IF.F(@IF.%Self: %IF.type) {
  1539. // CHECK:STDOUT: fn();
  1540. // CHECK:STDOUT: }
  1541. // CHECK:STDOUT:
  1542. // CHECK:STDOUT: specific @IF.F(constants.%Self) {}
  1543. // CHECK:STDOUT:
  1544. // CHECK:STDOUT: --- fail_where_rewrite_function.carbon
  1545. // CHECK:STDOUT:
  1546. // CHECK:STDOUT: constants {
  1547. // CHECK:STDOUT: %CD: type = class_type @CD [concrete]
  1548. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  1549. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  1550. // CHECK:STDOUT: %IF.type: type = facet_type <@IF> [concrete]
  1551. // CHECK:STDOUT: %Self: %IF.type = bind_symbolic_name Self, 0 [symbolic]
  1552. // CHECK:STDOUT: %.Self: %IF.type = bind_symbolic_name .Self [symbolic_self]
  1553. // CHECK:STDOUT: %IF.assoc_type: type = assoc_entity_type @IF [concrete]
  1554. // CHECK:STDOUT: %assoc0: %IF.assoc_type = assoc_entity element0, imports.%Main.import_ref.4b7 [concrete]
  1555. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  1556. // CHECK:STDOUT: %IF.lookup_impl_witness: <witness> = lookup_impl_witness %.Self, @IF [symbolic_self]
  1557. // CHECK:STDOUT: %IF.F.type: type = fn_type @IF.F [concrete]
  1558. // CHECK:STDOUT: %IF.F: %IF.F.type = struct_value () [concrete]
  1559. // CHECK:STDOUT: %IF.facet.e57: %IF.type = facet_value %.Self.as_type, (%IF.lookup_impl_witness) [symbolic_self]
  1560. // CHECK:STDOUT: %.641: type = fn_type_with_self_type %IF.F.type, %IF.facet.e57 [symbolic_self]
  1561. // CHECK:STDOUT: %impl.elem0: %.641 = impl_witness_access %IF.lookup_impl_witness, element0 [symbolic_self]
  1562. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete]
  1563. // CHECK:STDOUT: %IF_where.type: type = facet_type <@IF where %impl.elem0 = %int_0> [concrete]
  1564. // CHECK:STDOUT: %IF.impl_witness: <witness> = impl_witness file.%IF.impl_witness_table [concrete]
  1565. // CHECK:STDOUT: %CD.as.IF.impl.F.type: type = fn_type @CD.as.IF.impl.F [concrete]
  1566. // CHECK:STDOUT: %CD.as.IF.impl.F: %CD.as.IF.impl.F.type = struct_value () [concrete]
  1567. // CHECK:STDOUT: %IF.facet.864: %IF.type = facet_value %CD, (%IF.impl_witness) [concrete]
  1568. // CHECK:STDOUT: }
  1569. // CHECK:STDOUT:
  1570. // CHECK:STDOUT: imports {
  1571. // CHECK:STDOUT: %Main.IF: type = import_ref Main//interface_with_function, IF, loaded [concrete = constants.%IF.type]
  1572. // CHECK:STDOUT: %Main.import_ref.b93 = import_ref Main//interface_with_function, inst17 [no loc], unloaded
  1573. // CHECK:STDOUT: %Main.import_ref.f22: %IF.assoc_type = import_ref Main//interface_with_function, loc3_22, loaded [concrete = constants.%assoc0]
  1574. // CHECK:STDOUT: %Main.F: %IF.F.type = import_ref Main//interface_with_function, F, loaded [concrete = constants.%IF.F]
  1575. // CHECK:STDOUT: %Main.import_ref.4b7: %IF.F.type = import_ref Main//interface_with_function, loc3_22, loaded [concrete = constants.%IF.F]
  1576. // CHECK:STDOUT: %Main.import_ref.96e: %IF.type = import_ref Main//interface_with_function, inst17 [no loc], loaded [symbolic = constants.%Self]
  1577. // CHECK:STDOUT: }
  1578. // CHECK:STDOUT:
  1579. // CHECK:STDOUT: file {
  1580. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1581. // CHECK:STDOUT: .IF = imports.%Main.IF
  1582. // CHECK:STDOUT: .CD = %CD.decl
  1583. // CHECK:STDOUT: }
  1584. // CHECK:STDOUT: %default.import = import <none>
  1585. // CHECK:STDOUT: %CD.decl: type = class_decl @CD [concrete = constants.%CD] {} {}
  1586. // CHECK:STDOUT: impl_decl @CD.as.IF.impl [concrete] {} {
  1587. // CHECK:STDOUT: %CD.ref: type = name_ref CD, file.%CD.decl [concrete = constants.%CD]
  1588. // CHECK:STDOUT: %IF.ref: type = name_ref IF, imports.%Main.IF [concrete = constants.%IF.type]
  1589. // CHECK:STDOUT: %.Self: %IF.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  1590. // CHECK:STDOUT: %.Self.ref: %IF.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  1591. // CHECK:STDOUT: %F.ref: %IF.assoc_type = name_ref F, imports.%Main.import_ref.f22 [concrete = constants.%assoc0]
  1592. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type]
  1593. // CHECK:STDOUT: %.loc10_21: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type]
  1594. // CHECK:STDOUT: %impl.elem0: %.641 = impl_witness_access constants.%IF.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  1595. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0]
  1596. // CHECK:STDOUT: %.loc10_15: type = where_expr %.Self [concrete = constants.%IF_where.type] {
  1597. // CHECK:STDOUT: requirement_base_facet_type constants.%IF.type
  1598. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %int_0
  1599. // CHECK:STDOUT: }
  1600. // CHECK:STDOUT: }
  1601. // CHECK:STDOUT: %IF.impl_witness_table = impl_witness_table (@CD.as.IF.impl.%CD.as.IF.impl.F.decl), @CD.as.IF.impl [concrete]
  1602. // CHECK:STDOUT: %IF.impl_witness: <witness> = impl_witness %IF.impl_witness_table [concrete = constants.%IF.impl_witness]
  1603. // CHECK:STDOUT: }
  1604. // CHECK:STDOUT:
  1605. // CHECK:STDOUT: interface @IF [from "interface_with_function.carbon"] {
  1606. // CHECK:STDOUT: !members:
  1607. // CHECK:STDOUT: .Self = imports.%Main.import_ref.b93
  1608. // CHECK:STDOUT: .F = imports.%Main.import_ref.f22
  1609. // CHECK:STDOUT: witness = (imports.%Main.F)
  1610. // CHECK:STDOUT: }
  1611. // CHECK:STDOUT:
  1612. // CHECK:STDOUT: impl @CD.as.IF.impl: %CD.ref as %.loc10_15 {
  1613. // CHECK:STDOUT: %CD.as.IF.impl.F.decl: %CD.as.IF.impl.F.type = fn_decl @CD.as.IF.impl.F [concrete = constants.%CD.as.IF.impl.F] {} {}
  1614. // CHECK:STDOUT:
  1615. // CHECK:STDOUT: !members:
  1616. // CHECK:STDOUT: .F = %CD.as.IF.impl.F.decl
  1617. // CHECK:STDOUT: witness = file.%IF.impl_witness
  1618. // CHECK:STDOUT: }
  1619. // CHECK:STDOUT:
  1620. // CHECK:STDOUT: class @CD {
  1621. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  1622. // CHECK:STDOUT: complete_type_witness = %complete_type
  1623. // CHECK:STDOUT:
  1624. // CHECK:STDOUT: !members:
  1625. // CHECK:STDOUT: .Self = constants.%CD
  1626. // CHECK:STDOUT: }
  1627. // CHECK:STDOUT:
  1628. // CHECK:STDOUT: generic fn @IF.F(imports.%Main.import_ref.96e: %IF.type) [from "interface_with_function.carbon"] {
  1629. // CHECK:STDOUT: fn;
  1630. // CHECK:STDOUT: }
  1631. // CHECK:STDOUT:
  1632. // CHECK:STDOUT: fn @CD.as.IF.impl.F() {
  1633. // CHECK:STDOUT: !entry:
  1634. // CHECK:STDOUT: return
  1635. // CHECK:STDOUT: }
  1636. // CHECK:STDOUT:
  1637. // CHECK:STDOUT: specific @IF.F(constants.%Self) {}
  1638. // CHECK:STDOUT:
  1639. // CHECK:STDOUT: specific @IF.F(constants.%IF.facet.864) {}
  1640. // CHECK:STDOUT: