impl_assoc_const.carbon 76 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // AUTOUPDATE
  6. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/no_prelude/impl_assoc_const.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/no_prelude/impl_assoc_const.carbon
  10. // --- success.carbon
  11. library "[[@TEST_NAME]]";
  12. interface I { let T:! type; }
  13. impl () as I where .T = {} {}
  14. // --- redecl.carbon
  15. library "[[@TEST_NAME]]";
  16. interface I2 { let T2:! type; }
  17. impl () as I2 where .T2 = {};
  18. impl () as I2 where .T2 = {} {}
  19. // --- fail_redecl_adds_rewrites.carbon
  20. library "[[@TEST_NAME]]";
  21. interface I3 { let T3:! type; }
  22. // CHECK:STDERR: fail_redecl_adds_rewrites.carbon:[[@LINE+4]]:1: error: impl declared but not defined [ImplMissingDefinition]
  23. // CHECK:STDERR: impl () as I3;
  24. // CHECK:STDERR: ^~~~~~~~~~~~~~
  25. // CHECK:STDERR:
  26. impl () as I3;
  27. impl () as I3 where .T3 = {} {}
  28. // --- fail_mismatch.carbon
  29. library "[[@TEST_NAME]]";
  30. interface J { let U:! type; }
  31. // CHECK:STDERR: fail_mismatch.carbon:[[@LINE+4]]:1: error: impl declared but not defined [ImplMissingDefinition]
  32. // CHECK:STDERR: impl () as J where .U = {};
  33. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  34. // CHECK:STDERR:
  35. impl () as J where .U = {};
  36. impl () as J where .U = () {}
  37. // --- fail_mismatch_bad_value.carbon
  38. library "[[@TEST_NAME]]";
  39. interface I4 {
  40. let T4:! type;
  41. let T5:! type;
  42. let T6:! type;
  43. }
  44. // CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+8]]:27: error: name `BAD1` not found [NameNotFound]
  45. // CHECK:STDERR: impl () as I4 where .T4 = BAD1 and .T5 = {.a: {}} and .T6 = BAD2;
  46. // CHECK:STDERR: ^~~~
  47. // CHECK:STDERR:
  48. // CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+4]]:61: error: name `BAD2` not found [NameNotFound]
  49. // CHECK:STDERR: impl () as I4 where .T4 = BAD1 and .T5 = {.a: {}} and .T6 = BAD2;
  50. // CHECK:STDERR: ^~~~
  51. // CHECK:STDERR:
  52. impl () as I4 where .T4 = BAD1 and .T5 = {.a: {}} and .T6 = BAD2;
  53. // CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+12]]:46: error: name `BAD3` not found [NameNotFound]
  54. // CHECK:STDERR: impl () as I4 where .T4 = {.b: {}} and .T5 = BAD3 and .T6 = BAD4 {}
  55. // CHECK:STDERR: ^~~~
  56. // CHECK:STDERR:
  57. // CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+8]]:61: error: name `BAD4` not found [NameNotFound]
  58. // CHECK:STDERR: impl () as I4 where .T4 = {.b: {}} and .T5 = BAD3 and .T6 = BAD4 {}
  59. // CHECK:STDERR: ^~~~
  60. // CHECK:STDERR:
  61. // CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE-10]]:1: error: impl declared but not defined [ImplMissingDefinition]
  62. // CHECK:STDERR: impl () as I4 where .T4 = BAD1 and .T5 = {.a: {}} and .T6 = BAD2;
  63. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  64. // CHECK:STDERR:
  65. impl () as I4 where .T4 = {.b: {}} and .T5 = BAD3 and .T6 = BAD4 {}
  66. // --- fail_missing_on_definition.carbon
  67. library "[[@TEST_NAME]]";
  68. interface K { let V:! type; }
  69. impl () as K where .V = {};
  70. // CHECK:STDERR: fail_missing_on_definition.carbon:[[@LINE+11]]:12: error: associated constant V not given a value in impl of interface K [ImplAssociatedConstantNeedsValue]
  71. // CHECK:STDERR: impl () as K {}
  72. // CHECK:STDERR: ^
  73. // CHECK:STDERR: fail_missing_on_definition.carbon:[[@LINE-6]]:19: note: associated constant declared here [AssociatedConstantHere]
  74. // CHECK:STDERR: interface K { let V:! type; }
  75. // CHECK:STDERR: ^~~~~~~~
  76. // CHECK:STDERR:
  77. // CHECK:STDERR: fail_missing_on_definition.carbon:[[@LINE-8]]:1: error: impl declared but not defined [ImplMissingDefinition]
  78. // CHECK:STDERR: impl () as K where .V = {};
  79. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  80. // CHECK:STDERR:
  81. impl () as K {}
  82. // --- fail_two_different.carbon
  83. library "[[@TEST_NAME]]";
  84. interface L { let W:! type; }
  85. // CHECK:STDERR: fail_two_different.carbon:[[@LINE+4]]:12: error: associated constant W given two different values [AssociatedConstantWithDifferentValues]
  86. // CHECK:STDERR: impl () as L where .W = {} and .W = () {}
  87. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  88. // CHECK:STDERR:
  89. impl () as L where .W = {} and .W = () {}
  90. // --- fail_two_different_first_bad.carbon
  91. library "[[@TEST_NAME]]";
  92. interface L2 { let W2:! type; }
  93. // CHECK:STDERR: fail_two_different_first_bad.carbon:[[@LINE+4]]:27: error: name `BAD5` not found [NameNotFound]
  94. // CHECK:STDERR: impl () as L2 where .W2 = BAD5 and .W2 = () {}
  95. // CHECK:STDERR: ^~~~
  96. // CHECK:STDERR:
  97. impl () as L2 where .W2 = BAD5 and .W2 = () {}
  98. // --- fail_two_different_second_bad.carbon
  99. library "[[@TEST_NAME]]";
  100. interface L3 { let W3:! type; }
  101. // CHECK:STDERR: fail_two_different_second_bad.carbon:[[@LINE+4]]:40: error: name `BAD6` not found [NameNotFound]
  102. // CHECK:STDERR: impl () as L3 where .W3 = {} and .W3 = BAD6 {}
  103. // CHECK:STDERR: ^~~~
  104. // CHECK:STDERR:
  105. impl () as L3 where .W3 = {} and .W3 = BAD6 {}
  106. // --- fail_two_different_both_bad.carbon
  107. library "[[@TEST_NAME]]";
  108. interface L4 { let W4:! type; }
  109. // CHECK:STDERR: fail_two_different_both_bad.carbon:[[@LINE+8]]:27: error: name `BAD7` not found [NameNotFound]
  110. // CHECK:STDERR: impl () as L4 where .W4 = BAD7 and .W4 = BAD8 {}
  111. // CHECK:STDERR: ^~~~
  112. // CHECK:STDERR:
  113. // CHECK:STDERR: fail_two_different_both_bad.carbon:[[@LINE+4]]:42: error: name `BAD8` not found [NameNotFound]
  114. // CHECK:STDERR: impl () as L4 where .W4 = BAD7 and .W4 = BAD8 {}
  115. // CHECK:STDERR: ^~~~
  116. // CHECK:STDERR:
  117. impl () as L4 where .W4 = BAD7 and .W4 = BAD8 {}
  118. // --- repeated.carbon
  119. library "[[@TEST_NAME]]";
  120. interface M { let X:! type; }
  121. impl () as M where .X = {} and .X = {} {}
  122. // --- non-type.carbon
  123. library "[[@TEST_NAME]]";
  124. interface N {
  125. let Y:! {.a: {}};
  126. }
  127. impl () as N where .Y = {.a = {}} { }
  128. // --- fail_where_rewrite_function.carbon
  129. library "[[@TEST_NAME]]";
  130. interface IF { fn F(); }
  131. class CD { }
  132. // CHECK:STDERR: fail_where_rewrite_function.carbon:[[@LINE+4]]:12: error: rewrite specified for associated function F [RewriteForAssociatedFunction]
  133. // CHECK:STDERR: impl CD as IF where .F = 0 {
  134. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  135. // CHECK:STDERR:
  136. impl CD as IF where .F = 0 {
  137. fn F() {}
  138. }
  139. // CHECK:STDOUT: --- success.carbon
  140. // CHECK:STDOUT:
  141. // CHECK:STDOUT: constants {
  142. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  143. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  144. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type %I.type [concrete]
  145. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%T [concrete]
  146. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  147. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic_self]
  148. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  149. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self [symbolic_self]
  150. // CHECK:STDOUT: %I.facet: %I.type = facet_value %.Self.as_type, %.Self.as_wit [symbolic_self]
  151. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic_self]
  152. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  153. // CHECK:STDOUT: %I_where.type: type = facet_type <@I where %impl.elem0 = %empty_struct_type> [concrete]
  154. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (%empty_struct_type) [concrete]
  155. // CHECK:STDOUT: }
  156. // CHECK:STDOUT:
  157. // CHECK:STDOUT: file {
  158. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  159. // CHECK:STDOUT: .I = %I.decl
  160. // CHECK:STDOUT: }
  161. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  162. // CHECK:STDOUT: impl_decl @impl [concrete] {} {
  163. // CHECK:STDOUT: %.loc5_7.1: %empty_tuple.type = tuple_literal ()
  164. // CHECK:STDOUT: %.loc5_7.2: type = converted %.loc5_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  165. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  166. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  167. // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  168. // CHECK:STDOUT: %T.ref: %I.assoc_type = name_ref T, @T.%assoc0 [concrete = constants.%assoc0]
  169. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type]
  170. // CHECK:STDOUT: %.loc5_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type]
  171. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.ref [symbolic_self = constants.%.Self.as_wit]
  172. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic_self = constants.%impl.elem0]
  173. // CHECK:STDOUT: %.loc5_26.1: %empty_struct_type = struct_literal ()
  174. // CHECK:STDOUT: %.loc5_26.2: type = converted %.loc5_26.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  175. // CHECK:STDOUT: %.loc5_14: type = where_expr %.Self [concrete = constants.%I_where.type] {
  176. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc5_26.2
  177. // CHECK:STDOUT: }
  178. // CHECK:STDOUT: }
  179. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (constants.%empty_struct_type) [concrete = constants.%impl_witness]
  180. // CHECK:STDOUT: }
  181. // CHECK:STDOUT:
  182. // CHECK:STDOUT: interface @I {
  183. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  184. // CHECK:STDOUT: %T: type = assoc_const_decl @T [concrete] {
  185. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%T [concrete = constants.%assoc0]
  186. // CHECK:STDOUT: }
  187. // CHECK:STDOUT:
  188. // CHECK:STDOUT: !members:
  189. // CHECK:STDOUT: .Self = %Self
  190. // CHECK:STDOUT: .T = @T.%assoc0
  191. // CHECK:STDOUT: witness = (%T)
  192. // CHECK:STDOUT: }
  193. // CHECK:STDOUT:
  194. // CHECK:STDOUT: generic assoc_const @T(@I.%Self: %I.type) {
  195. // CHECK:STDOUT: assoc_const T:! type;
  196. // CHECK:STDOUT: }
  197. // CHECK:STDOUT:
  198. // CHECK:STDOUT: impl @impl: %.loc5_7.2 as %.loc5_14 {
  199. // CHECK:STDOUT: !members:
  200. // CHECK:STDOUT: witness = file.%impl_witness
  201. // CHECK:STDOUT: }
  202. // CHECK:STDOUT:
  203. // CHECK:STDOUT: specific @T(constants.%Self) {}
  204. // CHECK:STDOUT:
  205. // CHECK:STDOUT: specific @T(constants.%I.facet) {}
  206. // CHECK:STDOUT:
  207. // CHECK:STDOUT: --- redecl.carbon
  208. // CHECK:STDOUT:
  209. // CHECK:STDOUT: constants {
  210. // CHECK:STDOUT: %I2.type: type = facet_type <@I2> [concrete]
  211. // CHECK:STDOUT: %Self: %I2.type = bind_symbolic_name Self, 0 [symbolic]
  212. // CHECK:STDOUT: %I2.assoc_type: type = assoc_entity_type %I2.type [concrete]
  213. // CHECK:STDOUT: %assoc0: %I2.assoc_type = assoc_entity element0, @I2.%T2 [concrete]
  214. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  215. // CHECK:STDOUT: %.Self: %I2.type = bind_symbolic_name .Self [symbolic_self]
  216. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  217. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self [symbolic_self]
  218. // CHECK:STDOUT: %I2.facet: %I2.type = facet_value %.Self.as_type, %.Self.as_wit [symbolic_self]
  219. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic_self]
  220. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  221. // CHECK:STDOUT: %I2_where.type: type = facet_type <@I2 where %impl.elem0 = %empty_struct_type> [concrete]
  222. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (%empty_struct_type) [concrete]
  223. // CHECK:STDOUT: }
  224. // CHECK:STDOUT:
  225. // CHECK:STDOUT: file {
  226. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  227. // CHECK:STDOUT: .I2 = %I2.decl
  228. // CHECK:STDOUT: }
  229. // CHECK:STDOUT: %I2.decl: type = interface_decl @I2 [concrete = constants.%I2.type] {} {}
  230. // CHECK:STDOUT: impl_decl @impl [concrete] {} {
  231. // CHECK:STDOUT: %.loc5_7.1: %empty_tuple.type = tuple_literal ()
  232. // CHECK:STDOUT: %.loc5_7.2: type = converted %.loc5_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  233. // CHECK:STDOUT: %I2.ref.loc5: type = name_ref I2, file.%I2.decl [concrete = constants.%I2.type]
  234. // CHECK:STDOUT: %.Self.1: %I2.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  235. // CHECK:STDOUT: %.Self.ref.loc5: %I2.type = name_ref .Self, %.Self.1 [symbolic_self = constants.%.Self]
  236. // CHECK:STDOUT: %T2.ref.loc5: %I2.assoc_type = name_ref T2, @T2.%assoc0 [concrete = constants.%assoc0]
  237. // CHECK:STDOUT: %.Self.as_type.loc5: type = facet_access_type %.Self.ref.loc5 [symbolic_self = constants.%.Self.as_type]
  238. // CHECK:STDOUT: %.loc5_21: type = converted %.Self.ref.loc5, %.Self.as_type.loc5 [symbolic_self = constants.%.Self.as_type]
  239. // CHECK:STDOUT: %.Self.as_wit.loc5: <witness> = facet_access_witness %.Self.ref.loc5 [symbolic_self = constants.%.Self.as_wit]
  240. // CHECK:STDOUT: %impl.elem0.loc5: type = impl_witness_access %.Self.as_wit.loc5, element0 [symbolic_self = constants.%impl.elem0]
  241. // CHECK:STDOUT: %.loc5_28.1: %empty_struct_type = struct_literal ()
  242. // CHECK:STDOUT: %.loc5_28.2: type = converted %.loc5_28.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  243. // CHECK:STDOUT: %.loc5_15: type = where_expr %.Self.1 [concrete = constants.%I2_where.type] {
  244. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc5, %.loc5_28.2
  245. // CHECK:STDOUT: }
  246. // CHECK:STDOUT: }
  247. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (constants.%empty_struct_type) [concrete = constants.%impl_witness]
  248. // CHECK:STDOUT: impl_decl @impl [concrete] {} {
  249. // CHECK:STDOUT: %.loc6_7.1: %empty_tuple.type = tuple_literal ()
  250. // CHECK:STDOUT: %.loc6_7.2: type = converted %.loc6_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  251. // CHECK:STDOUT: %I2.ref.loc6: type = name_ref I2, file.%I2.decl [concrete = constants.%I2.type]
  252. // CHECK:STDOUT: %.Self.2: %I2.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  253. // CHECK:STDOUT: %.Self.ref.loc6: %I2.type = name_ref .Self, %.Self.2 [symbolic_self = constants.%.Self]
  254. // CHECK:STDOUT: %T2.ref.loc6: %I2.assoc_type = name_ref T2, @T2.%assoc0 [concrete = constants.%assoc0]
  255. // CHECK:STDOUT: %.Self.as_type.loc6: type = facet_access_type %.Self.ref.loc6 [symbolic_self = constants.%.Self.as_type]
  256. // CHECK:STDOUT: %.loc6_21: type = converted %.Self.ref.loc6, %.Self.as_type.loc6 [symbolic_self = constants.%.Self.as_type]
  257. // CHECK:STDOUT: %.Self.as_wit.loc6: <witness> = facet_access_witness %.Self.ref.loc6 [symbolic_self = constants.%.Self.as_wit]
  258. // CHECK:STDOUT: %impl.elem0.loc6: type = impl_witness_access %.Self.as_wit.loc6, element0 [symbolic_self = constants.%impl.elem0]
  259. // CHECK:STDOUT: %.loc6_28.1: %empty_struct_type = struct_literal ()
  260. // CHECK:STDOUT: %.loc6_28.2: type = converted %.loc6_28.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  261. // CHECK:STDOUT: %.loc6_15: type = where_expr %.Self.2 [concrete = constants.%I2_where.type] {
  262. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc6, %.loc6_28.2
  263. // CHECK:STDOUT: }
  264. // CHECK:STDOUT: }
  265. // CHECK:STDOUT: }
  266. // CHECK:STDOUT:
  267. // CHECK:STDOUT: interface @I2 {
  268. // CHECK:STDOUT: %Self: %I2.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  269. // CHECK:STDOUT: %T2: type = assoc_const_decl @T2 [concrete] {
  270. // CHECK:STDOUT: %assoc0: %I2.assoc_type = assoc_entity element0, @I2.%T2 [concrete = constants.%assoc0]
  271. // CHECK:STDOUT: }
  272. // CHECK:STDOUT:
  273. // CHECK:STDOUT: !members:
  274. // CHECK:STDOUT: .Self = %Self
  275. // CHECK:STDOUT: .T2 = @T2.%assoc0
  276. // CHECK:STDOUT: witness = (%T2)
  277. // CHECK:STDOUT: }
  278. // CHECK:STDOUT:
  279. // CHECK:STDOUT: generic assoc_const @T2(@I2.%Self: %I2.type) {
  280. // CHECK:STDOUT: assoc_const T2:! type;
  281. // CHECK:STDOUT: }
  282. // CHECK:STDOUT:
  283. // CHECK:STDOUT: impl @impl: %.loc5_7.2 as %.loc5_15 {
  284. // CHECK:STDOUT: !members:
  285. // CHECK:STDOUT: witness = file.%impl_witness
  286. // CHECK:STDOUT: }
  287. // CHECK:STDOUT:
  288. // CHECK:STDOUT: specific @T2(constants.%Self) {}
  289. // CHECK:STDOUT:
  290. // CHECK:STDOUT: specific @T2(constants.%I2.facet) {}
  291. // CHECK:STDOUT:
  292. // CHECK:STDOUT: --- fail_redecl_adds_rewrites.carbon
  293. // CHECK:STDOUT:
  294. // CHECK:STDOUT: constants {
  295. // CHECK:STDOUT: %I3.type: type = facet_type <@I3> [concrete]
  296. // CHECK:STDOUT: %Self: %I3.type = bind_symbolic_name Self, 0 [symbolic]
  297. // CHECK:STDOUT: %I3.assoc_type: type = assoc_entity_type %I3.type [concrete]
  298. // CHECK:STDOUT: %assoc0: %I3.assoc_type = assoc_entity element0, @I3.%T3 [concrete]
  299. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  300. // CHECK:STDOUT: %impl_witness.85b: <witness> = impl_witness (<error>) [concrete]
  301. // CHECK:STDOUT: %.Self: %I3.type = bind_symbolic_name .Self [symbolic_self]
  302. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  303. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self [symbolic_self]
  304. // CHECK:STDOUT: %I3.facet: %I3.type = facet_value %.Self.as_type, %.Self.as_wit [symbolic_self]
  305. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic_self]
  306. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  307. // CHECK:STDOUT: %I3_where.type: type = facet_type <@I3 where %impl.elem0 = %empty_struct_type> [concrete]
  308. // CHECK:STDOUT: %impl_witness.6de: <witness> = impl_witness (%empty_struct_type) [concrete]
  309. // CHECK:STDOUT: }
  310. // CHECK:STDOUT:
  311. // CHECK:STDOUT: file {
  312. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  313. // CHECK:STDOUT: .I3 = %I3.decl
  314. // CHECK:STDOUT: }
  315. // CHECK:STDOUT: %I3.decl: type = interface_decl @I3 [concrete = constants.%I3.type] {} {}
  316. // CHECK:STDOUT: impl_decl @impl.1 [concrete] {} {
  317. // CHECK:STDOUT: %.loc9_7.1: %empty_tuple.type = tuple_literal ()
  318. // CHECK:STDOUT: %.loc9_7.2: type = converted %.loc9_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  319. // CHECK:STDOUT: %I3.ref: type = name_ref I3, file.%I3.decl [concrete = constants.%I3.type]
  320. // CHECK:STDOUT: }
  321. // CHECK:STDOUT: %impl_witness.loc9: <witness> = impl_witness (<error>) [concrete = constants.%impl_witness.85b]
  322. // CHECK:STDOUT: impl_decl @impl.2 [concrete] {} {
  323. // CHECK:STDOUT: %.loc10_7.1: %empty_tuple.type = tuple_literal ()
  324. // CHECK:STDOUT: %.loc10_7.2: type = converted %.loc10_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  325. // CHECK:STDOUT: %I3.ref: type = name_ref I3, file.%I3.decl [concrete = constants.%I3.type]
  326. // CHECK:STDOUT: %.Self: %I3.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  327. // CHECK:STDOUT: %.Self.ref: %I3.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  328. // CHECK:STDOUT: %T3.ref: %I3.assoc_type = name_ref T3, @T3.%assoc0 [concrete = constants.%assoc0]
  329. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type]
  330. // CHECK:STDOUT: %.loc10_21: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type]
  331. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.ref [symbolic_self = constants.%.Self.as_wit]
  332. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic_self = constants.%impl.elem0]
  333. // CHECK:STDOUT: %.loc10_28.1: %empty_struct_type = struct_literal ()
  334. // CHECK:STDOUT: %.loc10_28.2: type = converted %.loc10_28.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  335. // CHECK:STDOUT: %.loc10_15: type = where_expr %.Self [concrete = constants.%I3_where.type] {
  336. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc10_28.2
  337. // CHECK:STDOUT: }
  338. // CHECK:STDOUT: }
  339. // CHECK:STDOUT: %impl_witness.loc10: <witness> = impl_witness (constants.%empty_struct_type) [concrete = constants.%impl_witness.6de]
  340. // CHECK:STDOUT: }
  341. // CHECK:STDOUT:
  342. // CHECK:STDOUT: interface @I3 {
  343. // CHECK:STDOUT: %Self: %I3.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  344. // CHECK:STDOUT: %T3: type = assoc_const_decl @T3 [concrete] {
  345. // CHECK:STDOUT: %assoc0: %I3.assoc_type = assoc_entity element0, @I3.%T3 [concrete = constants.%assoc0]
  346. // CHECK:STDOUT: }
  347. // CHECK:STDOUT:
  348. // CHECK:STDOUT: !members:
  349. // CHECK:STDOUT: .Self = %Self
  350. // CHECK:STDOUT: .T3 = @T3.%assoc0
  351. // CHECK:STDOUT: witness = (%T3)
  352. // CHECK:STDOUT: }
  353. // CHECK:STDOUT:
  354. // CHECK:STDOUT: generic assoc_const @T3(@I3.%Self: %I3.type) {
  355. // CHECK:STDOUT: assoc_const T3:! type;
  356. // CHECK:STDOUT: }
  357. // CHECK:STDOUT:
  358. // CHECK:STDOUT: impl @impl.1: %.loc9_7.2 as %I3.ref;
  359. // CHECK:STDOUT:
  360. // CHECK:STDOUT: impl @impl.2: %.loc10_7.2 as %.loc10_15 {
  361. // CHECK:STDOUT: !members:
  362. // CHECK:STDOUT: witness = file.%impl_witness.loc10
  363. // CHECK:STDOUT: }
  364. // CHECK:STDOUT:
  365. // CHECK:STDOUT: specific @T3(constants.%Self) {}
  366. // CHECK:STDOUT:
  367. // CHECK:STDOUT: specific @T3(constants.%I3.facet) {}
  368. // CHECK:STDOUT:
  369. // CHECK:STDOUT: --- fail_mismatch.carbon
  370. // CHECK:STDOUT:
  371. // CHECK:STDOUT: constants {
  372. // CHECK:STDOUT: %J.type: type = facet_type <@J> [concrete]
  373. // CHECK:STDOUT: %Self: %J.type = bind_symbolic_name Self, 0 [symbolic]
  374. // CHECK:STDOUT: %J.assoc_type: type = assoc_entity_type %J.type [concrete]
  375. // CHECK:STDOUT: %assoc0: %J.assoc_type = assoc_entity element0, @J.%U [concrete]
  376. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  377. // CHECK:STDOUT: %.Self: %J.type = bind_symbolic_name .Self [symbolic_self]
  378. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  379. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self [symbolic_self]
  380. // CHECK:STDOUT: %J.facet: %J.type = facet_value %.Self.as_type, %.Self.as_wit [symbolic_self]
  381. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic_self]
  382. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  383. // CHECK:STDOUT: %J_where.type.800: type = facet_type <@J where %impl.elem0 = %empty_struct_type> [concrete]
  384. // CHECK:STDOUT: %impl_witness.6de: <witness> = impl_witness (%empty_struct_type) [concrete]
  385. // CHECK:STDOUT: %J_where.type.25a: type = facet_type <@J where %impl.elem0 = %empty_tuple.type> [concrete]
  386. // CHECK:STDOUT: %impl_witness.2a6: <witness> = impl_witness (%empty_tuple.type) [concrete]
  387. // CHECK:STDOUT: }
  388. // CHECK:STDOUT:
  389. // CHECK:STDOUT: file {
  390. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  391. // CHECK:STDOUT: .J = %J.decl
  392. // CHECK:STDOUT: }
  393. // CHECK:STDOUT: %J.decl: type = interface_decl @J [concrete = constants.%J.type] {} {}
  394. // CHECK:STDOUT: impl_decl @impl.1 [concrete] {} {
  395. // CHECK:STDOUT: %.loc9_7.1: %empty_tuple.type = tuple_literal ()
  396. // CHECK:STDOUT: %.loc9_7.2: type = converted %.loc9_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  397. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type]
  398. // CHECK:STDOUT: %.Self: %J.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  399. // CHECK:STDOUT: %.Self.ref: %J.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  400. // CHECK:STDOUT: %U.ref: %J.assoc_type = name_ref U, @U.%assoc0 [concrete = constants.%assoc0]
  401. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type]
  402. // CHECK:STDOUT: %.loc9_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type]
  403. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.ref [symbolic_self = constants.%.Self.as_wit]
  404. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic_self = constants.%impl.elem0]
  405. // CHECK:STDOUT: %.loc9_26.1: %empty_struct_type = struct_literal ()
  406. // CHECK:STDOUT: %.loc9_26.2: type = converted %.loc9_26.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  407. // CHECK:STDOUT: %.loc9_14: type = where_expr %.Self [concrete = constants.%J_where.type.800] {
  408. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc9_26.2
  409. // CHECK:STDOUT: }
  410. // CHECK:STDOUT: }
  411. // CHECK:STDOUT: %impl_witness.loc9: <witness> = impl_witness (constants.%empty_struct_type) [concrete = constants.%impl_witness.6de]
  412. // CHECK:STDOUT: impl_decl @impl.2 [concrete] {} {
  413. // CHECK:STDOUT: %.loc10_7.1: %empty_tuple.type = tuple_literal ()
  414. // CHECK:STDOUT: %.loc10_7.2: type = converted %.loc10_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  415. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type]
  416. // CHECK:STDOUT: %.Self: %J.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  417. // CHECK:STDOUT: %.Self.ref: %J.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  418. // CHECK:STDOUT: %U.ref: %J.assoc_type = name_ref U, @U.%assoc0 [concrete = constants.%assoc0]
  419. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type]
  420. // CHECK:STDOUT: %.loc10_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type]
  421. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.ref [symbolic_self = constants.%.Self.as_wit]
  422. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic_self = constants.%impl.elem0]
  423. // CHECK:STDOUT: %.loc10_26.1: %empty_tuple.type = tuple_literal ()
  424. // CHECK:STDOUT: %.loc10_26.2: type = converted %.loc10_26.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  425. // CHECK:STDOUT: %.loc10_14: type = where_expr %.Self [concrete = constants.%J_where.type.25a] {
  426. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc10_26.2
  427. // CHECK:STDOUT: }
  428. // CHECK:STDOUT: }
  429. // CHECK:STDOUT: %impl_witness.loc10: <witness> = impl_witness (constants.%empty_tuple.type) [concrete = constants.%impl_witness.2a6]
  430. // CHECK:STDOUT: }
  431. // CHECK:STDOUT:
  432. // CHECK:STDOUT: interface @J {
  433. // CHECK:STDOUT: %Self: %J.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  434. // CHECK:STDOUT: %U: type = assoc_const_decl @U [concrete] {
  435. // CHECK:STDOUT: %assoc0: %J.assoc_type = assoc_entity element0, @J.%U [concrete = constants.%assoc0]
  436. // CHECK:STDOUT: }
  437. // CHECK:STDOUT:
  438. // CHECK:STDOUT: !members:
  439. // CHECK:STDOUT: .Self = %Self
  440. // CHECK:STDOUT: .U = @U.%assoc0
  441. // CHECK:STDOUT: witness = (%U)
  442. // CHECK:STDOUT: }
  443. // CHECK:STDOUT:
  444. // CHECK:STDOUT: generic assoc_const @U(@J.%Self: %J.type) {
  445. // CHECK:STDOUT: assoc_const U:! type;
  446. // CHECK:STDOUT: }
  447. // CHECK:STDOUT:
  448. // CHECK:STDOUT: impl @impl.1: %.loc9_7.2 as %.loc9_14;
  449. // CHECK:STDOUT:
  450. // CHECK:STDOUT: impl @impl.2: %.loc10_7.2 as %.loc10_14 {
  451. // CHECK:STDOUT: !members:
  452. // CHECK:STDOUT: witness = file.%impl_witness.loc10
  453. // CHECK:STDOUT: }
  454. // CHECK:STDOUT:
  455. // CHECK:STDOUT: specific @U(constants.%Self) {}
  456. // CHECK:STDOUT:
  457. // CHECK:STDOUT: specific @U(constants.%J.facet) {}
  458. // CHECK:STDOUT:
  459. // CHECK:STDOUT: --- fail_mismatch_bad_value.carbon
  460. // CHECK:STDOUT:
  461. // CHECK:STDOUT: constants {
  462. // CHECK:STDOUT: %I4.type: type = facet_type <@I4> [concrete]
  463. // CHECK:STDOUT: %Self: %I4.type = bind_symbolic_name Self, 0 [symbolic]
  464. // CHECK:STDOUT: %I4.assoc_type: type = assoc_entity_type %I4.type [concrete]
  465. // CHECK:STDOUT: %assoc0: %I4.assoc_type = assoc_entity element0, @I4.%T4 [concrete]
  466. // CHECK:STDOUT: %assoc1: %I4.assoc_type = assoc_entity element1, @I4.%T5 [concrete]
  467. // CHECK:STDOUT: %assoc2: %I4.assoc_type = assoc_entity element2, @I4.%T6 [concrete]
  468. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  469. // CHECK:STDOUT: %.Self: %I4.type = bind_symbolic_name .Self [symbolic_self]
  470. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  471. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self [symbolic_self]
  472. // CHECK:STDOUT: %I4.facet: %I4.type = facet_value %.Self.as_type, %.Self.as_wit [symbolic_self]
  473. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic_self]
  474. // CHECK:STDOUT: %impl.elem1: type = impl_witness_access %.Self.as_wit, element1 [symbolic_self]
  475. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  476. // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %empty_struct_type} [concrete]
  477. // CHECK:STDOUT: %impl.elem2: type = impl_witness_access %.Self.as_wit, element2 [symbolic_self]
  478. // CHECK:STDOUT: %struct_type.b: type = struct_type {.b: %empty_struct_type} [concrete]
  479. // CHECK:STDOUT: }
  480. // CHECK:STDOUT:
  481. // CHECK:STDOUT: file {
  482. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  483. // CHECK:STDOUT: .I4 = %I4.decl
  484. // CHECK:STDOUT: .BAD1 = <poisoned>
  485. // CHECK:STDOUT: .BAD2 = <poisoned>
  486. // CHECK:STDOUT: .BAD3 = <poisoned>
  487. // CHECK:STDOUT: .BAD4 = <poisoned>
  488. // CHECK:STDOUT: }
  489. // CHECK:STDOUT: %I4.decl: type = interface_decl @I4 [concrete = constants.%I4.type] {} {}
  490. // CHECK:STDOUT: impl_decl @impl.1 [concrete] {} {
  491. // CHECK:STDOUT: %.loc17_7.1: %empty_tuple.type = tuple_literal ()
  492. // CHECK:STDOUT: %.loc17_7.2: type = converted %.loc17_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  493. // CHECK:STDOUT: %I4.ref: type = name_ref I4, file.%I4.decl [concrete = constants.%I4.type]
  494. // CHECK:STDOUT: %.Self: %I4.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  495. // CHECK:STDOUT: %.Self.ref.loc17_21: %I4.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  496. // CHECK:STDOUT: %T4.ref: %I4.assoc_type = name_ref T4, @T4.%assoc0 [concrete = constants.%assoc0]
  497. // CHECK:STDOUT: %.Self.as_type.loc17_21: type = facet_access_type %.Self.ref.loc17_21 [symbolic_self = constants.%.Self.as_type]
  498. // CHECK:STDOUT: %.loc17_21: type = converted %.Self.ref.loc17_21, %.Self.as_type.loc17_21 [symbolic_self = constants.%.Self.as_type]
  499. // CHECK:STDOUT: %.Self.as_wit.loc17_21: <witness> = facet_access_witness %.Self.ref.loc17_21 [symbolic_self = constants.%.Self.as_wit]
  500. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit.loc17_21, element0 [symbolic_self = constants.%impl.elem0]
  501. // CHECK:STDOUT: %BAD1.ref: <error> = name_ref BAD1, <error> [concrete = <error>]
  502. // CHECK:STDOUT: %.Self.ref.loc17_36: %I4.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  503. // CHECK:STDOUT: %T5.ref: %I4.assoc_type = name_ref T5, @T5.%assoc1 [concrete = constants.%assoc1]
  504. // CHECK:STDOUT: %.Self.as_type.loc17_36: type = facet_access_type %.Self.ref.loc17_36 [symbolic_self = constants.%.Self.as_type]
  505. // CHECK:STDOUT: %.loc17_36: type = converted %.Self.ref.loc17_36, %.Self.as_type.loc17_36 [symbolic_self = constants.%.Self.as_type]
  506. // CHECK:STDOUT: %.Self.as_wit.loc17_36: <witness> = facet_access_witness %.Self.ref.loc17_36 [symbolic_self = constants.%.Self.as_wit]
  507. // CHECK:STDOUT: %impl.elem1: type = impl_witness_access %.Self.as_wit.loc17_36, element1 [symbolic_self = constants.%impl.elem1]
  508. // CHECK:STDOUT: %.loc17_48.1: %empty_struct_type = struct_literal ()
  509. // CHECK:STDOUT: %.loc17_48.2: type = converted %.loc17_48.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  510. // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %empty_struct_type} [concrete = constants.%struct_type.a]
  511. // CHECK:STDOUT: %.Self.ref.loc17_55: %I4.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  512. // CHECK:STDOUT: %T6.ref: %I4.assoc_type = name_ref T6, @T6.%assoc2 [concrete = constants.%assoc2]
  513. // CHECK:STDOUT: %.Self.as_type.loc17_55: type = facet_access_type %.Self.ref.loc17_55 [symbolic_self = constants.%.Self.as_type]
  514. // CHECK:STDOUT: %.loc17_55: type = converted %.Self.ref.loc17_55, %.Self.as_type.loc17_55 [symbolic_self = constants.%.Self.as_type]
  515. // CHECK:STDOUT: %.Self.as_wit.loc17_55: <witness> = facet_access_witness %.Self.ref.loc17_55 [symbolic_self = constants.%.Self.as_wit]
  516. // CHECK:STDOUT: %impl.elem2: type = impl_witness_access %.Self.as_wit.loc17_55, element2 [symbolic_self = constants.%impl.elem2]
  517. // CHECK:STDOUT: %BAD2.ref: <error> = name_ref BAD2, <error> [concrete = <error>]
  518. // CHECK:STDOUT: %.loc17_15: type = where_expr %.Self [concrete = <error>] {
  519. // CHECK:STDOUT: requirement_rewrite %impl.elem0, <error>
  520. // CHECK:STDOUT: requirement_rewrite %impl.elem1, %struct_type.a
  521. // CHECK:STDOUT: requirement_rewrite %impl.elem2, <error>
  522. // CHECK:STDOUT: }
  523. // CHECK:STDOUT: }
  524. // CHECK:STDOUT: impl_decl @impl.2 [concrete] {} {
  525. // CHECK:STDOUT: %.loc31_7.1: %empty_tuple.type = tuple_literal ()
  526. // CHECK:STDOUT: %.loc31_7.2: type = converted %.loc31_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  527. // CHECK:STDOUT: %I4.ref: type = name_ref I4, file.%I4.decl [concrete = constants.%I4.type]
  528. // CHECK:STDOUT: %.Self: %I4.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  529. // CHECK:STDOUT: %.Self.ref.loc31_21: %I4.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  530. // CHECK:STDOUT: %T4.ref: %I4.assoc_type = name_ref T4, @T4.%assoc0 [concrete = constants.%assoc0]
  531. // CHECK:STDOUT: %.Self.as_type.loc31_21: type = facet_access_type %.Self.ref.loc31_21 [symbolic_self = constants.%.Self.as_type]
  532. // CHECK:STDOUT: %.loc31_21: type = converted %.Self.ref.loc31_21, %.Self.as_type.loc31_21 [symbolic_self = constants.%.Self.as_type]
  533. // CHECK:STDOUT: %.Self.as_wit.loc31_21: <witness> = facet_access_witness %.Self.ref.loc31_21 [symbolic_self = constants.%.Self.as_wit]
  534. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit.loc31_21, element0 [symbolic_self = constants.%impl.elem0]
  535. // CHECK:STDOUT: %.loc31_33.1: %empty_struct_type = struct_literal ()
  536. // CHECK:STDOUT: %.loc31_33.2: type = converted %.loc31_33.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  537. // CHECK:STDOUT: %struct_type.b: type = struct_type {.b: %empty_struct_type} [concrete = constants.%struct_type.b]
  538. // CHECK:STDOUT: %.Self.ref.loc31_40: %I4.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  539. // CHECK:STDOUT: %T5.ref: %I4.assoc_type = name_ref T5, @T5.%assoc1 [concrete = constants.%assoc1]
  540. // CHECK:STDOUT: %.Self.as_type.loc31_40: type = facet_access_type %.Self.ref.loc31_40 [symbolic_self = constants.%.Self.as_type]
  541. // CHECK:STDOUT: %.loc31_40: type = converted %.Self.ref.loc31_40, %.Self.as_type.loc31_40 [symbolic_self = constants.%.Self.as_type]
  542. // CHECK:STDOUT: %.Self.as_wit.loc31_40: <witness> = facet_access_witness %.Self.ref.loc31_40 [symbolic_self = constants.%.Self.as_wit]
  543. // CHECK:STDOUT: %impl.elem1: type = impl_witness_access %.Self.as_wit.loc31_40, element1 [symbolic_self = constants.%impl.elem1]
  544. // CHECK:STDOUT: %BAD3.ref: <error> = name_ref BAD3, <error> [concrete = <error>]
  545. // CHECK:STDOUT: %.Self.ref.loc31_55: %I4.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  546. // CHECK:STDOUT: %T6.ref: %I4.assoc_type = name_ref T6, @T6.%assoc2 [concrete = constants.%assoc2]
  547. // CHECK:STDOUT: %.Self.as_type.loc31_55: type = facet_access_type %.Self.ref.loc31_55 [symbolic_self = constants.%.Self.as_type]
  548. // CHECK:STDOUT: %.loc31_55: type = converted %.Self.ref.loc31_55, %.Self.as_type.loc31_55 [symbolic_self = constants.%.Self.as_type]
  549. // CHECK:STDOUT: %.Self.as_wit.loc31_55: <witness> = facet_access_witness %.Self.ref.loc31_55 [symbolic_self = constants.%.Self.as_wit]
  550. // CHECK:STDOUT: %impl.elem2: type = impl_witness_access %.Self.as_wit.loc31_55, element2 [symbolic_self = constants.%impl.elem2]
  551. // CHECK:STDOUT: %BAD4.ref: <error> = name_ref BAD4, <error> [concrete = <error>]
  552. // CHECK:STDOUT: %.loc31_15: type = where_expr %.Self [concrete = <error>] {
  553. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %struct_type.b
  554. // CHECK:STDOUT: requirement_rewrite %impl.elem1, <error>
  555. // CHECK:STDOUT: requirement_rewrite %impl.elem2, <error>
  556. // CHECK:STDOUT: }
  557. // CHECK:STDOUT: }
  558. // CHECK:STDOUT: }
  559. // CHECK:STDOUT:
  560. // CHECK:STDOUT: interface @I4 {
  561. // CHECK:STDOUT: %Self: %I4.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  562. // CHECK:STDOUT: %T4: type = assoc_const_decl @T4 [concrete] {
  563. // CHECK:STDOUT: %assoc0: %I4.assoc_type = assoc_entity element0, @I4.%T4 [concrete = constants.%assoc0]
  564. // CHECK:STDOUT: }
  565. // CHECK:STDOUT: %T5: type = assoc_const_decl @T5 [concrete] {
  566. // CHECK:STDOUT: %assoc1: %I4.assoc_type = assoc_entity element1, @I4.%T5 [concrete = constants.%assoc1]
  567. // CHECK:STDOUT: }
  568. // CHECK:STDOUT: %T6: type = assoc_const_decl @T6 [concrete] {
  569. // CHECK:STDOUT: %assoc2: %I4.assoc_type = assoc_entity element2, @I4.%T6 [concrete = constants.%assoc2]
  570. // CHECK:STDOUT: }
  571. // CHECK:STDOUT:
  572. // CHECK:STDOUT: !members:
  573. // CHECK:STDOUT: .Self = %Self
  574. // CHECK:STDOUT: .T4 = @T4.%assoc0
  575. // CHECK:STDOUT: .T5 = @T5.%assoc1
  576. // CHECK:STDOUT: .T6 = @T6.%assoc2
  577. // CHECK:STDOUT: witness = (%T4, %T5, %T6)
  578. // CHECK:STDOUT: }
  579. // CHECK:STDOUT:
  580. // CHECK:STDOUT: generic assoc_const @T4(@I4.%Self: %I4.type) {
  581. // CHECK:STDOUT: assoc_const T4:! type;
  582. // CHECK:STDOUT: }
  583. // CHECK:STDOUT:
  584. // CHECK:STDOUT: generic assoc_const @T5(@I4.%Self: %I4.type) {
  585. // CHECK:STDOUT: assoc_const T5:! type;
  586. // CHECK:STDOUT: }
  587. // CHECK:STDOUT:
  588. // CHECK:STDOUT: generic assoc_const @T6(@I4.%Self: %I4.type) {
  589. // CHECK:STDOUT: assoc_const T6:! type;
  590. // CHECK:STDOUT: }
  591. // CHECK:STDOUT:
  592. // CHECK:STDOUT: impl @impl.1: %.loc17_7.2 as %.loc17_15;
  593. // CHECK:STDOUT:
  594. // CHECK:STDOUT: impl @impl.2: %.loc31_7.2 as %.loc31_15 {
  595. // CHECK:STDOUT: !members:
  596. // CHECK:STDOUT: witness = <error>
  597. // CHECK:STDOUT: }
  598. // CHECK:STDOUT:
  599. // CHECK:STDOUT: specific @T4(constants.%Self) {}
  600. // CHECK:STDOUT:
  601. // CHECK:STDOUT: specific @T5(constants.%Self) {}
  602. // CHECK:STDOUT:
  603. // CHECK:STDOUT: specific @T6(constants.%Self) {}
  604. // CHECK:STDOUT:
  605. // CHECK:STDOUT: specific @T4(constants.%I4.facet) {}
  606. // CHECK:STDOUT:
  607. // CHECK:STDOUT: specific @T5(constants.%I4.facet) {}
  608. // CHECK:STDOUT:
  609. // CHECK:STDOUT: specific @T6(constants.%I4.facet) {}
  610. // CHECK:STDOUT:
  611. // CHECK:STDOUT: --- fail_missing_on_definition.carbon
  612. // CHECK:STDOUT:
  613. // CHECK:STDOUT: constants {
  614. // CHECK:STDOUT: %K.type: type = facet_type <@K> [concrete]
  615. // CHECK:STDOUT: %Self: %K.type = bind_symbolic_name Self, 0 [symbolic]
  616. // CHECK:STDOUT: %K.assoc_type: type = assoc_entity_type %K.type [concrete]
  617. // CHECK:STDOUT: %assoc0: %K.assoc_type = assoc_entity element0, @K.%V [concrete]
  618. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  619. // CHECK:STDOUT: %.Self: %K.type = bind_symbolic_name .Self [symbolic_self]
  620. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  621. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self [symbolic_self]
  622. // CHECK:STDOUT: %K.facet: %K.type = facet_value %.Self.as_type, %.Self.as_wit [symbolic_self]
  623. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic_self]
  624. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  625. // CHECK:STDOUT: %K_where.type: type = facet_type <@K where %impl.elem0 = %empty_struct_type> [concrete]
  626. // CHECK:STDOUT: %impl_witness.6de: <witness> = impl_witness (%empty_struct_type) [concrete]
  627. // CHECK:STDOUT: %impl_witness.85b: <witness> = impl_witness (<error>) [concrete]
  628. // CHECK:STDOUT: }
  629. // CHECK:STDOUT:
  630. // CHECK:STDOUT: file {
  631. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  632. // CHECK:STDOUT: .K = %K.decl
  633. // CHECK:STDOUT: }
  634. // CHECK:STDOUT: %K.decl: type = interface_decl @K [concrete = constants.%K.type] {} {}
  635. // CHECK:STDOUT: impl_decl @impl.1 [concrete] {} {
  636. // CHECK:STDOUT: %.loc5_7.1: %empty_tuple.type = tuple_literal ()
  637. // CHECK:STDOUT: %.loc5_7.2: type = converted %.loc5_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  638. // CHECK:STDOUT: %K.ref: type = name_ref K, file.%K.decl [concrete = constants.%K.type]
  639. // CHECK:STDOUT: %.Self: %K.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  640. // CHECK:STDOUT: %.Self.ref: %K.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  641. // CHECK:STDOUT: %V.ref: %K.assoc_type = name_ref V, @V.%assoc0 [concrete = constants.%assoc0]
  642. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type]
  643. // CHECK:STDOUT: %.loc5_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type]
  644. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.ref [symbolic_self = constants.%.Self.as_wit]
  645. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic_self = constants.%impl.elem0]
  646. // CHECK:STDOUT: %.loc5_26.1: %empty_struct_type = struct_literal ()
  647. // CHECK:STDOUT: %.loc5_26.2: type = converted %.loc5_26.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  648. // CHECK:STDOUT: %.loc5_14: type = where_expr %.Self [concrete = constants.%K_where.type] {
  649. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc5_26.2
  650. // CHECK:STDOUT: }
  651. // CHECK:STDOUT: }
  652. // CHECK:STDOUT: %impl_witness.loc5: <witness> = impl_witness (constants.%empty_struct_type) [concrete = constants.%impl_witness.6de]
  653. // CHECK:STDOUT: impl_decl @impl.2 [concrete] {} {
  654. // CHECK:STDOUT: %.loc17_7.1: %empty_tuple.type = tuple_literal ()
  655. // CHECK:STDOUT: %.loc17_7.2: type = converted %.loc17_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  656. // CHECK:STDOUT: %K.ref: type = name_ref K, file.%K.decl [concrete = constants.%K.type]
  657. // CHECK:STDOUT: }
  658. // CHECK:STDOUT: %impl_witness.loc17: <witness> = impl_witness (<error>) [concrete = constants.%impl_witness.85b]
  659. // CHECK:STDOUT: }
  660. // CHECK:STDOUT:
  661. // CHECK:STDOUT: interface @K {
  662. // CHECK:STDOUT: %Self: %K.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  663. // CHECK:STDOUT: %V: type = assoc_const_decl @V [concrete] {
  664. // CHECK:STDOUT: %assoc0: %K.assoc_type = assoc_entity element0, @K.%V [concrete = constants.%assoc0]
  665. // CHECK:STDOUT: }
  666. // CHECK:STDOUT:
  667. // CHECK:STDOUT: !members:
  668. // CHECK:STDOUT: .Self = %Self
  669. // CHECK:STDOUT: .V = @V.%assoc0
  670. // CHECK:STDOUT: witness = (%V)
  671. // CHECK:STDOUT: }
  672. // CHECK:STDOUT:
  673. // CHECK:STDOUT: generic assoc_const @V(@K.%Self: %K.type) {
  674. // CHECK:STDOUT: assoc_const V:! type;
  675. // CHECK:STDOUT: }
  676. // CHECK:STDOUT:
  677. // CHECK:STDOUT: impl @impl.1: %.loc5_7.2 as %.loc5_14;
  678. // CHECK:STDOUT:
  679. // CHECK:STDOUT: impl @impl.2: %.loc17_7.2 as %K.ref {
  680. // CHECK:STDOUT: !members:
  681. // CHECK:STDOUT: witness = file.%impl_witness.loc17
  682. // CHECK:STDOUT: }
  683. // CHECK:STDOUT:
  684. // CHECK:STDOUT: specific @V(constants.%Self) {}
  685. // CHECK:STDOUT:
  686. // CHECK:STDOUT: specific @V(constants.%K.facet) {}
  687. // CHECK:STDOUT:
  688. // CHECK:STDOUT: --- fail_two_different.carbon
  689. // CHECK:STDOUT:
  690. // CHECK:STDOUT: constants {
  691. // CHECK:STDOUT: %L.type: type = facet_type <@L> [concrete]
  692. // CHECK:STDOUT: %Self: %L.type = bind_symbolic_name Self, 0 [symbolic]
  693. // CHECK:STDOUT: %L.assoc_type: type = assoc_entity_type %L.type [concrete]
  694. // CHECK:STDOUT: %assoc0: %L.assoc_type = assoc_entity element0, @L.%W [concrete]
  695. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  696. // CHECK:STDOUT: %.Self: %L.type = bind_symbolic_name .Self [symbolic_self]
  697. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  698. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self [symbolic_self]
  699. // CHECK:STDOUT: %L.facet: %L.type = facet_value %.Self.as_type, %.Self.as_wit [symbolic_self]
  700. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic_self]
  701. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  702. // CHECK:STDOUT: %L_where.type: type = facet_type <@L where %impl.elem0 = %empty_tuple.type and %impl.elem0 = %empty_struct_type> [concrete]
  703. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (<error>) [concrete]
  704. // CHECK:STDOUT: }
  705. // CHECK:STDOUT:
  706. // CHECK:STDOUT: file {
  707. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  708. // CHECK:STDOUT: .L = %L.decl
  709. // CHECK:STDOUT: }
  710. // CHECK:STDOUT: %L.decl: type = interface_decl @L [concrete = constants.%L.type] {} {}
  711. // CHECK:STDOUT: impl_decl @impl [concrete] {} {
  712. // CHECK:STDOUT: %.loc9_7.1: %empty_tuple.type = tuple_literal ()
  713. // CHECK:STDOUT: %.loc9_7.2: type = converted %.loc9_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  714. // CHECK:STDOUT: %L.ref: type = name_ref L, file.%L.decl [concrete = constants.%L.type]
  715. // CHECK:STDOUT: %.Self: %L.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  716. // CHECK:STDOUT: %.Self.ref.loc9_20: %L.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  717. // CHECK:STDOUT: %W.ref.loc9_20: %L.assoc_type = name_ref W, @W.%assoc0 [concrete = constants.%assoc0]
  718. // CHECK:STDOUT: %.Self.as_type.loc9_20: type = facet_access_type %.Self.ref.loc9_20 [symbolic_self = constants.%.Self.as_type]
  719. // CHECK:STDOUT: %.loc9_20: type = converted %.Self.ref.loc9_20, %.Self.as_type.loc9_20 [symbolic_self = constants.%.Self.as_type]
  720. // CHECK:STDOUT: %.Self.as_wit.loc9_20: <witness> = facet_access_witness %.Self.ref.loc9_20 [symbolic_self = constants.%.Self.as_wit]
  721. // CHECK:STDOUT: %impl.elem0.loc9_20: type = impl_witness_access %.Self.as_wit.loc9_20, element0 [symbolic_self = constants.%impl.elem0]
  722. // CHECK:STDOUT: %.loc9_26.1: %empty_struct_type = struct_literal ()
  723. // CHECK:STDOUT: %.loc9_26.2: type = converted %.loc9_26.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  724. // CHECK:STDOUT: %.Self.ref.loc9_32: %L.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  725. // CHECK:STDOUT: %W.ref.loc9_32: %L.assoc_type = name_ref W, @W.%assoc0 [concrete = constants.%assoc0]
  726. // CHECK:STDOUT: %.Self.as_type.loc9_32: type = facet_access_type %.Self.ref.loc9_32 [symbolic_self = constants.%.Self.as_type]
  727. // CHECK:STDOUT: %.loc9_32: type = converted %.Self.ref.loc9_32, %.Self.as_type.loc9_32 [symbolic_self = constants.%.Self.as_type]
  728. // CHECK:STDOUT: %.Self.as_wit.loc9_32: <witness> = facet_access_witness %.Self.ref.loc9_32 [symbolic_self = constants.%.Self.as_wit]
  729. // CHECK:STDOUT: %impl.elem0.loc9_32: type = impl_witness_access %.Self.as_wit.loc9_32, element0 [symbolic_self = constants.%impl.elem0]
  730. // CHECK:STDOUT: %.loc9_38.1: %empty_tuple.type = tuple_literal ()
  731. // CHECK:STDOUT: %.loc9_38.2: type = converted %.loc9_38.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  732. // CHECK:STDOUT: %.loc9_14: type = where_expr %.Self [concrete = constants.%L_where.type] {
  733. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc9_20, %.loc9_26.2
  734. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc9_32, %.loc9_38.2
  735. // CHECK:STDOUT: }
  736. // CHECK:STDOUT: }
  737. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (<error>) [concrete = constants.%impl_witness]
  738. // CHECK:STDOUT: }
  739. // CHECK:STDOUT:
  740. // CHECK:STDOUT: interface @L {
  741. // CHECK:STDOUT: %Self: %L.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  742. // CHECK:STDOUT: %W: type = assoc_const_decl @W [concrete] {
  743. // CHECK:STDOUT: %assoc0: %L.assoc_type = assoc_entity element0, @L.%W [concrete = constants.%assoc0]
  744. // CHECK:STDOUT: }
  745. // CHECK:STDOUT:
  746. // CHECK:STDOUT: !members:
  747. // CHECK:STDOUT: .Self = %Self
  748. // CHECK:STDOUT: .W = @W.%assoc0
  749. // CHECK:STDOUT: witness = (%W)
  750. // CHECK:STDOUT: }
  751. // CHECK:STDOUT:
  752. // CHECK:STDOUT: generic assoc_const @W(@L.%Self: %L.type) {
  753. // CHECK:STDOUT: assoc_const W:! type;
  754. // CHECK:STDOUT: }
  755. // CHECK:STDOUT:
  756. // CHECK:STDOUT: impl @impl: %.loc9_7.2 as %.loc9_14 {
  757. // CHECK:STDOUT: !members:
  758. // CHECK:STDOUT: witness = file.%impl_witness
  759. // CHECK:STDOUT: }
  760. // CHECK:STDOUT:
  761. // CHECK:STDOUT: specific @W(constants.%Self) {}
  762. // CHECK:STDOUT:
  763. // CHECK:STDOUT: specific @W(constants.%L.facet) {}
  764. // CHECK:STDOUT:
  765. // CHECK:STDOUT: --- fail_two_different_first_bad.carbon
  766. // CHECK:STDOUT:
  767. // CHECK:STDOUT: constants {
  768. // CHECK:STDOUT: %L2.type: type = facet_type <@L2> [concrete]
  769. // CHECK:STDOUT: %Self: %L2.type = bind_symbolic_name Self, 0 [symbolic]
  770. // CHECK:STDOUT: %L2.assoc_type: type = assoc_entity_type %L2.type [concrete]
  771. // CHECK:STDOUT: %assoc0: %L2.assoc_type = assoc_entity element0, @L2.%W2 [concrete]
  772. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  773. // CHECK:STDOUT: %.Self: %L2.type = bind_symbolic_name .Self [symbolic_self]
  774. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  775. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self [symbolic_self]
  776. // CHECK:STDOUT: %L2.facet: %L2.type = facet_value %.Self.as_type, %.Self.as_wit [symbolic_self]
  777. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic_self]
  778. // CHECK:STDOUT: }
  779. // CHECK:STDOUT:
  780. // CHECK:STDOUT: file {
  781. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  782. // CHECK:STDOUT: .L2 = %L2.decl
  783. // CHECK:STDOUT: .BAD5 = <poisoned>
  784. // CHECK:STDOUT: }
  785. // CHECK:STDOUT: %L2.decl: type = interface_decl @L2 [concrete = constants.%L2.type] {} {}
  786. // CHECK:STDOUT: impl_decl @impl [concrete] {} {
  787. // CHECK:STDOUT: %.loc9_7.1: %empty_tuple.type = tuple_literal ()
  788. // CHECK:STDOUT: %.loc9_7.2: type = converted %.loc9_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  789. // CHECK:STDOUT: %L2.ref: type = name_ref L2, file.%L2.decl [concrete = constants.%L2.type]
  790. // CHECK:STDOUT: %.Self: %L2.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  791. // CHECK:STDOUT: %.Self.ref.loc9_21: %L2.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  792. // CHECK:STDOUT: %W2.ref.loc9_21: %L2.assoc_type = name_ref W2, @W2.%assoc0 [concrete = constants.%assoc0]
  793. // CHECK:STDOUT: %.Self.as_type.loc9_21: type = facet_access_type %.Self.ref.loc9_21 [symbolic_self = constants.%.Self.as_type]
  794. // CHECK:STDOUT: %.loc9_21: type = converted %.Self.ref.loc9_21, %.Self.as_type.loc9_21 [symbolic_self = constants.%.Self.as_type]
  795. // CHECK:STDOUT: %.Self.as_wit.loc9_21: <witness> = facet_access_witness %.Self.ref.loc9_21 [symbolic_self = constants.%.Self.as_wit]
  796. // CHECK:STDOUT: %impl.elem0.loc9_21: type = impl_witness_access %.Self.as_wit.loc9_21, element0 [symbolic_self = constants.%impl.elem0]
  797. // CHECK:STDOUT: %BAD5.ref: <error> = name_ref BAD5, <error> [concrete = <error>]
  798. // CHECK:STDOUT: %.Self.ref.loc9_36: %L2.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  799. // CHECK:STDOUT: %W2.ref.loc9_36: %L2.assoc_type = name_ref W2, @W2.%assoc0 [concrete = constants.%assoc0]
  800. // CHECK:STDOUT: %.Self.as_type.loc9_36: type = facet_access_type %.Self.ref.loc9_36 [symbolic_self = constants.%.Self.as_type]
  801. // CHECK:STDOUT: %.loc9_36: type = converted %.Self.ref.loc9_36, %.Self.as_type.loc9_36 [symbolic_self = constants.%.Self.as_type]
  802. // CHECK:STDOUT: %.Self.as_wit.loc9_36: <witness> = facet_access_witness %.Self.ref.loc9_36 [symbolic_self = constants.%.Self.as_wit]
  803. // CHECK:STDOUT: %impl.elem0.loc9_36: type = impl_witness_access %.Self.as_wit.loc9_36, element0 [symbolic_self = constants.%impl.elem0]
  804. // CHECK:STDOUT: %.loc9_43.1: %empty_tuple.type = tuple_literal ()
  805. // CHECK:STDOUT: %.loc9_43.2: type = converted %.loc9_43.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  806. // CHECK:STDOUT: %.loc9_15: type = where_expr %.Self [concrete = <error>] {
  807. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc9_21, <error>
  808. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc9_36, %.loc9_43.2
  809. // CHECK:STDOUT: }
  810. // CHECK:STDOUT: }
  811. // CHECK:STDOUT: }
  812. // CHECK:STDOUT:
  813. // CHECK:STDOUT: interface @L2 {
  814. // CHECK:STDOUT: %Self: %L2.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  815. // CHECK:STDOUT: %W2: type = assoc_const_decl @W2 [concrete] {
  816. // CHECK:STDOUT: %assoc0: %L2.assoc_type = assoc_entity element0, @L2.%W2 [concrete = constants.%assoc0]
  817. // CHECK:STDOUT: }
  818. // CHECK:STDOUT:
  819. // CHECK:STDOUT: !members:
  820. // CHECK:STDOUT: .Self = %Self
  821. // CHECK:STDOUT: .W2 = @W2.%assoc0
  822. // CHECK:STDOUT: witness = (%W2)
  823. // CHECK:STDOUT: }
  824. // CHECK:STDOUT:
  825. // CHECK:STDOUT: generic assoc_const @W2(@L2.%Self: %L2.type) {
  826. // CHECK:STDOUT: assoc_const W2:! type;
  827. // CHECK:STDOUT: }
  828. // CHECK:STDOUT:
  829. // CHECK:STDOUT: impl @impl: %.loc9_7.2 as %.loc9_15 {
  830. // CHECK:STDOUT: !members:
  831. // CHECK:STDOUT: witness = <error>
  832. // CHECK:STDOUT: }
  833. // CHECK:STDOUT:
  834. // CHECK:STDOUT: specific @W2(constants.%Self) {}
  835. // CHECK:STDOUT:
  836. // CHECK:STDOUT: specific @W2(constants.%L2.facet) {}
  837. // CHECK:STDOUT:
  838. // CHECK:STDOUT: --- fail_two_different_second_bad.carbon
  839. // CHECK:STDOUT:
  840. // CHECK:STDOUT: constants {
  841. // CHECK:STDOUT: %L3.type: type = facet_type <@L3> [concrete]
  842. // CHECK:STDOUT: %Self: %L3.type = bind_symbolic_name Self, 0 [symbolic]
  843. // CHECK:STDOUT: %L3.assoc_type: type = assoc_entity_type %L3.type [concrete]
  844. // CHECK:STDOUT: %assoc0: %L3.assoc_type = assoc_entity element0, @L3.%W3 [concrete]
  845. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  846. // CHECK:STDOUT: %.Self: %L3.type = bind_symbolic_name .Self [symbolic_self]
  847. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  848. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self [symbolic_self]
  849. // CHECK:STDOUT: %L3.facet: %L3.type = facet_value %.Self.as_type, %.Self.as_wit [symbolic_self]
  850. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic_self]
  851. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  852. // CHECK:STDOUT: }
  853. // CHECK:STDOUT:
  854. // CHECK:STDOUT: file {
  855. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  856. // CHECK:STDOUT: .L3 = %L3.decl
  857. // CHECK:STDOUT: .BAD6 = <poisoned>
  858. // CHECK:STDOUT: }
  859. // CHECK:STDOUT: %L3.decl: type = interface_decl @L3 [concrete = constants.%L3.type] {} {}
  860. // CHECK:STDOUT: impl_decl @impl [concrete] {} {
  861. // CHECK:STDOUT: %.loc9_7.1: %empty_tuple.type = tuple_literal ()
  862. // CHECK:STDOUT: %.loc9_7.2: type = converted %.loc9_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  863. // CHECK:STDOUT: %L3.ref: type = name_ref L3, file.%L3.decl [concrete = constants.%L3.type]
  864. // CHECK:STDOUT: %.Self: %L3.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  865. // CHECK:STDOUT: %.Self.ref.loc9_21: %L3.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  866. // CHECK:STDOUT: %W3.ref.loc9_21: %L3.assoc_type = name_ref W3, @W3.%assoc0 [concrete = constants.%assoc0]
  867. // CHECK:STDOUT: %.Self.as_type.loc9_21: type = facet_access_type %.Self.ref.loc9_21 [symbolic_self = constants.%.Self.as_type]
  868. // CHECK:STDOUT: %.loc9_21: type = converted %.Self.ref.loc9_21, %.Self.as_type.loc9_21 [symbolic_self = constants.%.Self.as_type]
  869. // CHECK:STDOUT: %.Self.as_wit.loc9_21: <witness> = facet_access_witness %.Self.ref.loc9_21 [symbolic_self = constants.%.Self.as_wit]
  870. // CHECK:STDOUT: %impl.elem0.loc9_21: type = impl_witness_access %.Self.as_wit.loc9_21, element0 [symbolic_self = constants.%impl.elem0]
  871. // CHECK:STDOUT: %.loc9_28.1: %empty_struct_type = struct_literal ()
  872. // CHECK:STDOUT: %.loc9_28.2: type = converted %.loc9_28.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  873. // CHECK:STDOUT: %.Self.ref.loc9_34: %L3.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  874. // CHECK:STDOUT: %W3.ref.loc9_34: %L3.assoc_type = name_ref W3, @W3.%assoc0 [concrete = constants.%assoc0]
  875. // CHECK:STDOUT: %.Self.as_type.loc9_34: type = facet_access_type %.Self.ref.loc9_34 [symbolic_self = constants.%.Self.as_type]
  876. // CHECK:STDOUT: %.loc9_34: type = converted %.Self.ref.loc9_34, %.Self.as_type.loc9_34 [symbolic_self = constants.%.Self.as_type]
  877. // CHECK:STDOUT: %.Self.as_wit.loc9_34: <witness> = facet_access_witness %.Self.ref.loc9_34 [symbolic_self = constants.%.Self.as_wit]
  878. // CHECK:STDOUT: %impl.elem0.loc9_34: type = impl_witness_access %.Self.as_wit.loc9_34, element0 [symbolic_self = constants.%impl.elem0]
  879. // CHECK:STDOUT: %BAD6.ref: <error> = name_ref BAD6, <error> [concrete = <error>]
  880. // CHECK:STDOUT: %.loc9_15: type = where_expr %.Self [concrete = <error>] {
  881. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc9_21, %.loc9_28.2
  882. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc9_34, <error>
  883. // CHECK:STDOUT: }
  884. // CHECK:STDOUT: }
  885. // CHECK:STDOUT: }
  886. // CHECK:STDOUT:
  887. // CHECK:STDOUT: interface @L3 {
  888. // CHECK:STDOUT: %Self: %L3.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  889. // CHECK:STDOUT: %W3: type = assoc_const_decl @W3 [concrete] {
  890. // CHECK:STDOUT: %assoc0: %L3.assoc_type = assoc_entity element0, @L3.%W3 [concrete = constants.%assoc0]
  891. // CHECK:STDOUT: }
  892. // CHECK:STDOUT:
  893. // CHECK:STDOUT: !members:
  894. // CHECK:STDOUT: .Self = %Self
  895. // CHECK:STDOUT: .W3 = @W3.%assoc0
  896. // CHECK:STDOUT: witness = (%W3)
  897. // CHECK:STDOUT: }
  898. // CHECK:STDOUT:
  899. // CHECK:STDOUT: generic assoc_const @W3(@L3.%Self: %L3.type) {
  900. // CHECK:STDOUT: assoc_const W3:! type;
  901. // CHECK:STDOUT: }
  902. // CHECK:STDOUT:
  903. // CHECK:STDOUT: impl @impl: %.loc9_7.2 as %.loc9_15 {
  904. // CHECK:STDOUT: !members:
  905. // CHECK:STDOUT: witness = <error>
  906. // CHECK:STDOUT: }
  907. // CHECK:STDOUT:
  908. // CHECK:STDOUT: specific @W3(constants.%Self) {}
  909. // CHECK:STDOUT:
  910. // CHECK:STDOUT: specific @W3(constants.%L3.facet) {}
  911. // CHECK:STDOUT:
  912. // CHECK:STDOUT: --- fail_two_different_both_bad.carbon
  913. // CHECK:STDOUT:
  914. // CHECK:STDOUT: constants {
  915. // CHECK:STDOUT: %L4.type: type = facet_type <@L4> [concrete]
  916. // CHECK:STDOUT: %Self: %L4.type = bind_symbolic_name Self, 0 [symbolic]
  917. // CHECK:STDOUT: %L4.assoc_type: type = assoc_entity_type %L4.type [concrete]
  918. // CHECK:STDOUT: %assoc0: %L4.assoc_type = assoc_entity element0, @L4.%W4 [concrete]
  919. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  920. // CHECK:STDOUT: %.Self: %L4.type = bind_symbolic_name .Self [symbolic_self]
  921. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  922. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self [symbolic_self]
  923. // CHECK:STDOUT: %L4.facet: %L4.type = facet_value %.Self.as_type, %.Self.as_wit [symbolic_self]
  924. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic_self]
  925. // CHECK:STDOUT: }
  926. // CHECK:STDOUT:
  927. // CHECK:STDOUT: file {
  928. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  929. // CHECK:STDOUT: .L4 = %L4.decl
  930. // CHECK:STDOUT: .BAD7 = <poisoned>
  931. // CHECK:STDOUT: .BAD8 = <poisoned>
  932. // CHECK:STDOUT: }
  933. // CHECK:STDOUT: %L4.decl: type = interface_decl @L4 [concrete = constants.%L4.type] {} {}
  934. // CHECK:STDOUT: impl_decl @impl [concrete] {} {
  935. // CHECK:STDOUT: %.loc13_7.1: %empty_tuple.type = tuple_literal ()
  936. // CHECK:STDOUT: %.loc13_7.2: type = converted %.loc13_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  937. // CHECK:STDOUT: %L4.ref: type = name_ref L4, file.%L4.decl [concrete = constants.%L4.type]
  938. // CHECK:STDOUT: %.Self: %L4.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  939. // CHECK:STDOUT: %.Self.ref.loc13_21: %L4.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  940. // CHECK:STDOUT: %W4.ref.loc13_21: %L4.assoc_type = name_ref W4, @W4.%assoc0 [concrete = constants.%assoc0]
  941. // CHECK:STDOUT: %.Self.as_type.loc13_21: type = facet_access_type %.Self.ref.loc13_21 [symbolic_self = constants.%.Self.as_type]
  942. // CHECK:STDOUT: %.loc13_21: type = converted %.Self.ref.loc13_21, %.Self.as_type.loc13_21 [symbolic_self = constants.%.Self.as_type]
  943. // CHECK:STDOUT: %.Self.as_wit.loc13_21: <witness> = facet_access_witness %.Self.ref.loc13_21 [symbolic_self = constants.%.Self.as_wit]
  944. // CHECK:STDOUT: %impl.elem0.loc13_21: type = impl_witness_access %.Self.as_wit.loc13_21, element0 [symbolic_self = constants.%impl.elem0]
  945. // CHECK:STDOUT: %BAD7.ref: <error> = name_ref BAD7, <error> [concrete = <error>]
  946. // CHECK:STDOUT: %.Self.ref.loc13_36: %L4.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  947. // CHECK:STDOUT: %W4.ref.loc13_36: %L4.assoc_type = name_ref W4, @W4.%assoc0 [concrete = constants.%assoc0]
  948. // CHECK:STDOUT: %.Self.as_type.loc13_36: type = facet_access_type %.Self.ref.loc13_36 [symbolic_self = constants.%.Self.as_type]
  949. // CHECK:STDOUT: %.loc13_36: type = converted %.Self.ref.loc13_36, %.Self.as_type.loc13_36 [symbolic_self = constants.%.Self.as_type]
  950. // CHECK:STDOUT: %.Self.as_wit.loc13_36: <witness> = facet_access_witness %.Self.ref.loc13_36 [symbolic_self = constants.%.Self.as_wit]
  951. // CHECK:STDOUT: %impl.elem0.loc13_36: type = impl_witness_access %.Self.as_wit.loc13_36, element0 [symbolic_self = constants.%impl.elem0]
  952. // CHECK:STDOUT: %BAD8.ref: <error> = name_ref BAD8, <error> [concrete = <error>]
  953. // CHECK:STDOUT: %.loc13_15: type = where_expr %.Self [concrete = <error>] {
  954. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc13_21, <error>
  955. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc13_36, <error>
  956. // CHECK:STDOUT: }
  957. // CHECK:STDOUT: }
  958. // CHECK:STDOUT: }
  959. // CHECK:STDOUT:
  960. // CHECK:STDOUT: interface @L4 {
  961. // CHECK:STDOUT: %Self: %L4.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  962. // CHECK:STDOUT: %W4: type = assoc_const_decl @W4 [concrete] {
  963. // CHECK:STDOUT: %assoc0: %L4.assoc_type = assoc_entity element0, @L4.%W4 [concrete = constants.%assoc0]
  964. // CHECK:STDOUT: }
  965. // CHECK:STDOUT:
  966. // CHECK:STDOUT: !members:
  967. // CHECK:STDOUT: .Self = %Self
  968. // CHECK:STDOUT: .W4 = @W4.%assoc0
  969. // CHECK:STDOUT: witness = (%W4)
  970. // CHECK:STDOUT: }
  971. // CHECK:STDOUT:
  972. // CHECK:STDOUT: generic assoc_const @W4(@L4.%Self: %L4.type) {
  973. // CHECK:STDOUT: assoc_const W4:! type;
  974. // CHECK:STDOUT: }
  975. // CHECK:STDOUT:
  976. // CHECK:STDOUT: impl @impl: %.loc13_7.2 as %.loc13_15 {
  977. // CHECK:STDOUT: !members:
  978. // CHECK:STDOUT: witness = <error>
  979. // CHECK:STDOUT: }
  980. // CHECK:STDOUT:
  981. // CHECK:STDOUT: specific @W4(constants.%Self) {}
  982. // CHECK:STDOUT:
  983. // CHECK:STDOUT: specific @W4(constants.%L4.facet) {}
  984. // CHECK:STDOUT:
  985. // CHECK:STDOUT: --- repeated.carbon
  986. // CHECK:STDOUT:
  987. // CHECK:STDOUT: constants {
  988. // CHECK:STDOUT: %M.type: type = facet_type <@M> [concrete]
  989. // CHECK:STDOUT: %Self: %M.type = bind_symbolic_name Self, 0 [symbolic]
  990. // CHECK:STDOUT: %M.assoc_type: type = assoc_entity_type %M.type [concrete]
  991. // CHECK:STDOUT: %assoc0: %M.assoc_type = assoc_entity element0, @M.%X [concrete]
  992. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  993. // CHECK:STDOUT: %.Self: %M.type = bind_symbolic_name .Self [symbolic_self]
  994. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  995. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self [symbolic_self]
  996. // CHECK:STDOUT: %M.facet: %M.type = facet_value %.Self.as_type, %.Self.as_wit [symbolic_self]
  997. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic_self]
  998. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  999. // CHECK:STDOUT: %M_where.type: type = facet_type <@M where %impl.elem0 = %empty_struct_type> [concrete]
  1000. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (%empty_struct_type) [concrete]
  1001. // CHECK:STDOUT: }
  1002. // CHECK:STDOUT:
  1003. // CHECK:STDOUT: file {
  1004. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1005. // CHECK:STDOUT: .M = %M.decl
  1006. // CHECK:STDOUT: }
  1007. // CHECK:STDOUT: %M.decl: type = interface_decl @M [concrete = constants.%M.type] {} {}
  1008. // CHECK:STDOUT: impl_decl @impl [concrete] {} {
  1009. // CHECK:STDOUT: %.loc5_7.1: %empty_tuple.type = tuple_literal ()
  1010. // CHECK:STDOUT: %.loc5_7.2: type = converted %.loc5_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  1011. // CHECK:STDOUT: %M.ref: type = name_ref M, file.%M.decl [concrete = constants.%M.type]
  1012. // CHECK:STDOUT: %.Self: %M.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  1013. // CHECK:STDOUT: %.Self.ref.loc5_20: %M.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  1014. // CHECK:STDOUT: %X.ref.loc5_20: %M.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0]
  1015. // CHECK:STDOUT: %.Self.as_type.loc5_20: type = facet_access_type %.Self.ref.loc5_20 [symbolic_self = constants.%.Self.as_type]
  1016. // CHECK:STDOUT: %.loc5_20: type = converted %.Self.ref.loc5_20, %.Self.as_type.loc5_20 [symbolic_self = constants.%.Self.as_type]
  1017. // CHECK:STDOUT: %.Self.as_wit.loc5_20: <witness> = facet_access_witness %.Self.ref.loc5_20 [symbolic_self = constants.%.Self.as_wit]
  1018. // CHECK:STDOUT: %impl.elem0.loc5_20: type = impl_witness_access %.Self.as_wit.loc5_20, element0 [symbolic_self = constants.%impl.elem0]
  1019. // CHECK:STDOUT: %.loc5_26.1: %empty_struct_type = struct_literal ()
  1020. // CHECK:STDOUT: %.loc5_26.2: type = converted %.loc5_26.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  1021. // CHECK:STDOUT: %.Self.ref.loc5_32: %M.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  1022. // CHECK:STDOUT: %X.ref.loc5_32: %M.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0]
  1023. // CHECK:STDOUT: %.Self.as_type.loc5_32: type = facet_access_type %.Self.ref.loc5_32 [symbolic_self = constants.%.Self.as_type]
  1024. // CHECK:STDOUT: %.loc5_32: type = converted %.Self.ref.loc5_32, %.Self.as_type.loc5_32 [symbolic_self = constants.%.Self.as_type]
  1025. // CHECK:STDOUT: %.Self.as_wit.loc5_32: <witness> = facet_access_witness %.Self.ref.loc5_32 [symbolic_self = constants.%.Self.as_wit]
  1026. // CHECK:STDOUT: %impl.elem0.loc5_32: type = impl_witness_access %.Self.as_wit.loc5_32, element0 [symbolic_self = constants.%impl.elem0]
  1027. // CHECK:STDOUT: %.loc5_38.1: %empty_struct_type = struct_literal ()
  1028. // CHECK:STDOUT: %.loc5_38.2: type = converted %.loc5_38.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  1029. // CHECK:STDOUT: %.loc5_14: type = where_expr %.Self [concrete = constants.%M_where.type] {
  1030. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc5_20, %.loc5_26.2
  1031. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc5_32, %.loc5_38.2
  1032. // CHECK:STDOUT: }
  1033. // CHECK:STDOUT: }
  1034. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (constants.%empty_struct_type) [concrete = constants.%impl_witness]
  1035. // CHECK:STDOUT: }
  1036. // CHECK:STDOUT:
  1037. // CHECK:STDOUT: interface @M {
  1038. // CHECK:STDOUT: %Self: %M.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  1039. // CHECK:STDOUT: %X: type = assoc_const_decl @X [concrete] {
  1040. // CHECK:STDOUT: %assoc0: %M.assoc_type = assoc_entity element0, @M.%X [concrete = constants.%assoc0]
  1041. // CHECK:STDOUT: }
  1042. // CHECK:STDOUT:
  1043. // CHECK:STDOUT: !members:
  1044. // CHECK:STDOUT: .Self = %Self
  1045. // CHECK:STDOUT: .X = @X.%assoc0
  1046. // CHECK:STDOUT: witness = (%X)
  1047. // CHECK:STDOUT: }
  1048. // CHECK:STDOUT:
  1049. // CHECK:STDOUT: generic assoc_const @X(@M.%Self: %M.type) {
  1050. // CHECK:STDOUT: assoc_const X:! type;
  1051. // CHECK:STDOUT: }
  1052. // CHECK:STDOUT:
  1053. // CHECK:STDOUT: impl @impl: %.loc5_7.2 as %.loc5_14 {
  1054. // CHECK:STDOUT: !members:
  1055. // CHECK:STDOUT: witness = file.%impl_witness
  1056. // CHECK:STDOUT: }
  1057. // CHECK:STDOUT:
  1058. // CHECK:STDOUT: specific @X(constants.%Self) {}
  1059. // CHECK:STDOUT:
  1060. // CHECK:STDOUT: specific @X(constants.%M.facet) {}
  1061. // CHECK:STDOUT:
  1062. // CHECK:STDOUT: --- non-type.carbon
  1063. // CHECK:STDOUT:
  1064. // CHECK:STDOUT: constants {
  1065. // CHECK:STDOUT: %N.type: type = facet_type <@N> [concrete]
  1066. // CHECK:STDOUT: %Self: %N.type = bind_symbolic_name Self, 0 [symbolic]
  1067. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  1068. // CHECK:STDOUT: %struct_type.a.225: type = struct_type {.a: %empty_struct_type} [concrete]
  1069. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  1070. // CHECK:STDOUT: %N.assoc_type: type = assoc_entity_type %N.type [concrete]
  1071. // CHECK:STDOUT: %assoc0: %N.assoc_type = assoc_entity element0, @N.%Y [concrete]
  1072. // CHECK:STDOUT: %.Self: %N.type = bind_symbolic_name .Self [symbolic_self]
  1073. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  1074. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self [symbolic_self]
  1075. // CHECK:STDOUT: %N.facet: %N.type = facet_value %.Self.as_type, %.Self.as_wit [symbolic_self]
  1076. // CHECK:STDOUT: %impl.elem0: %struct_type.a.225 = impl_witness_access %.Self.as_wit, element0 [symbolic_self]
  1077. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  1078. // CHECK:STDOUT: %struct: %struct_type.a.225 = struct_value (%empty_struct) [concrete]
  1079. // CHECK:STDOUT: %N_where.type: type = facet_type <@N where %impl.elem0 = %struct> [concrete]
  1080. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (%struct) [concrete]
  1081. // CHECK:STDOUT: }
  1082. // CHECK:STDOUT:
  1083. // CHECK:STDOUT: file {
  1084. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1085. // CHECK:STDOUT: .N = %N.decl
  1086. // CHECK:STDOUT: }
  1087. // CHECK:STDOUT: %N.decl: type = interface_decl @N [concrete = constants.%N.type] {} {}
  1088. // CHECK:STDOUT: impl_decl @impl [concrete] {} {
  1089. // CHECK:STDOUT: %.loc7_7.1: %empty_tuple.type = tuple_literal ()
  1090. // CHECK:STDOUT: %.loc7_7.2: type = converted %.loc7_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  1091. // CHECK:STDOUT: %N.ref: type = name_ref N, file.%N.decl [concrete = constants.%N.type]
  1092. // CHECK:STDOUT: %.Self: %N.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  1093. // CHECK:STDOUT: %.Self.ref: %N.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  1094. // CHECK:STDOUT: %Y.ref: %N.assoc_type = name_ref Y, @Y.%assoc0 [concrete = constants.%assoc0]
  1095. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type]
  1096. // CHECK:STDOUT: %.loc7_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type]
  1097. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.ref [symbolic_self = constants.%.Self.as_wit]
  1098. // CHECK:STDOUT: %impl.elem0: %struct_type.a.225 = impl_witness_access %.Self.as_wit, element0 [symbolic_self = constants.%impl.elem0]
  1099. // CHECK:STDOUT: %.loc7_32: %empty_struct_type = struct_literal ()
  1100. // CHECK:STDOUT: %.loc7_33.1: %struct_type.a.225 = struct_literal (%.loc7_32)
  1101. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete = constants.%empty_struct]
  1102. // CHECK:STDOUT: %.loc7_33.2: %empty_struct_type = converted %.loc7_32, %empty_struct [concrete = constants.%empty_struct]
  1103. // CHECK:STDOUT: %struct: %struct_type.a.225 = struct_value (%.loc7_33.2) [concrete = constants.%struct]
  1104. // CHECK:STDOUT: %.loc7_33.3: %struct_type.a.225 = converted %.loc7_33.1, %struct [concrete = constants.%struct]
  1105. // CHECK:STDOUT: %.loc7_14: type = where_expr %.Self [concrete = constants.%N_where.type] {
  1106. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc7_33.3
  1107. // CHECK:STDOUT: }
  1108. // CHECK:STDOUT: }
  1109. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (constants.%struct) [concrete = constants.%impl_witness]
  1110. // CHECK:STDOUT: }
  1111. // CHECK:STDOUT:
  1112. // CHECK:STDOUT: interface @N {
  1113. // CHECK:STDOUT: %Self: %N.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  1114. // CHECK:STDOUT: %Y: %struct_type.a.225 = assoc_const_decl @Y [concrete] {
  1115. // CHECK:STDOUT: %assoc0: %N.assoc_type = assoc_entity element0, @N.%Y [concrete = constants.%assoc0]
  1116. // CHECK:STDOUT: }
  1117. // CHECK:STDOUT:
  1118. // CHECK:STDOUT: !members:
  1119. // CHECK:STDOUT: .Self = %Self
  1120. // CHECK:STDOUT: .Y = @Y.%assoc0
  1121. // CHECK:STDOUT: witness = (%Y)
  1122. // CHECK:STDOUT: }
  1123. // CHECK:STDOUT:
  1124. // CHECK:STDOUT: generic assoc_const @Y(@N.%Self: %N.type) {
  1125. // CHECK:STDOUT: assoc_const Y:! %struct_type.a.225;
  1126. // CHECK:STDOUT: }
  1127. // CHECK:STDOUT:
  1128. // CHECK:STDOUT: impl @impl: %.loc7_7.2 as %.loc7_14 {
  1129. // CHECK:STDOUT: !members:
  1130. // CHECK:STDOUT: witness = file.%impl_witness
  1131. // CHECK:STDOUT: }
  1132. // CHECK:STDOUT:
  1133. // CHECK:STDOUT: specific @Y(constants.%Self) {}
  1134. // CHECK:STDOUT:
  1135. // CHECK:STDOUT: specific @Y(constants.%N.facet) {}
  1136. // CHECK:STDOUT:
  1137. // CHECK:STDOUT: --- fail_where_rewrite_function.carbon
  1138. // CHECK:STDOUT:
  1139. // CHECK:STDOUT: constants {
  1140. // CHECK:STDOUT: %IF.type: type = facet_type <@IF> [concrete]
  1141. // CHECK:STDOUT: %Self: %IF.type = bind_symbolic_name Self, 0 [symbolic]
  1142. // CHECK:STDOUT: %F.type.496: type = fn_type @F.1 [concrete]
  1143. // CHECK:STDOUT: %F.1de: %F.type.496 = struct_value () [concrete]
  1144. // CHECK:STDOUT: %IF.assoc_type: type = assoc_entity_type %IF.type [concrete]
  1145. // CHECK:STDOUT: %assoc0: %IF.assoc_type = assoc_entity element0, @IF.%F.decl [concrete]
  1146. // CHECK:STDOUT: %CD: type = class_type @CD [concrete]
  1147. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  1148. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  1149. // CHECK:STDOUT: %.Self: %IF.type = bind_symbolic_name .Self [symbolic_self]
  1150. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  1151. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self [symbolic_self]
  1152. // CHECK:STDOUT: %IF.facet.3a2: %IF.type = facet_value %.Self.as_type, %.Self.as_wit [symbolic_self]
  1153. // CHECK:STDOUT: %.99d: type = fn_type_with_self_type %F.type.496, %IF.facet.3a2 [symbolic_self]
  1154. // CHECK:STDOUT: %impl.elem0: %.99d = impl_witness_access %.Self.as_wit, element0 [symbolic_self]
  1155. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete]
  1156. // CHECK:STDOUT: %IF_where.type: type = facet_type <@IF where %impl.elem0 = %int_0> [concrete]
  1157. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (@impl.%F.decl) [concrete]
  1158. // CHECK:STDOUT: %F.type.064: type = fn_type @F.2 [concrete]
  1159. // CHECK:STDOUT: %F.822: %F.type.064 = struct_value () [concrete]
  1160. // CHECK:STDOUT: %IF.facet.b37: %IF.type = facet_value %CD, %impl_witness [concrete]
  1161. // CHECK:STDOUT: }
  1162. // CHECK:STDOUT:
  1163. // CHECK:STDOUT: file {
  1164. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1165. // CHECK:STDOUT: .IF = %IF.decl
  1166. // CHECK:STDOUT: .CD = %CD.decl
  1167. // CHECK:STDOUT: }
  1168. // CHECK:STDOUT: %IF.decl: type = interface_decl @IF [concrete = constants.%IF.type] {} {}
  1169. // CHECK:STDOUT: %CD.decl: type = class_decl @CD [concrete = constants.%CD] {} {}
  1170. // CHECK:STDOUT: impl_decl @impl [concrete] {} {
  1171. // CHECK:STDOUT: %CD.ref: type = name_ref CD, file.%CD.decl [concrete = constants.%CD]
  1172. // CHECK:STDOUT: %IF.ref: type = name_ref IF, file.%IF.decl [concrete = constants.%IF.type]
  1173. // CHECK:STDOUT: %.Self: %IF.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  1174. // CHECK:STDOUT: %.Self.ref: %IF.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  1175. // CHECK:STDOUT: %F.ref: %IF.assoc_type = name_ref F, @IF.%assoc0 [concrete = constants.%assoc0]
  1176. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type]
  1177. // CHECK:STDOUT: %.loc11_21: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type]
  1178. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.ref [symbolic_self = constants.%.Self.as_wit]
  1179. // CHECK:STDOUT: %impl.elem0: %.99d = impl_witness_access %.Self.as_wit, element0 [symbolic_self = constants.%impl.elem0]
  1180. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0]
  1181. // CHECK:STDOUT: %.loc11_15: type = where_expr %.Self [concrete = constants.%IF_where.type] {
  1182. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %int_0
  1183. // CHECK:STDOUT: }
  1184. // CHECK:STDOUT: }
  1185. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (@impl.%F.decl) [concrete = constants.%impl_witness]
  1186. // CHECK:STDOUT: }
  1187. // CHECK:STDOUT:
  1188. // CHECK:STDOUT: interface @IF {
  1189. // CHECK:STDOUT: %Self: %IF.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  1190. // CHECK:STDOUT: %F.decl: %F.type.496 = fn_decl @F.1 [concrete = constants.%F.1de] {} {}
  1191. // CHECK:STDOUT: %assoc0: %IF.assoc_type = assoc_entity element0, %F.decl [concrete = constants.%assoc0]
  1192. // CHECK:STDOUT:
  1193. // CHECK:STDOUT: !members:
  1194. // CHECK:STDOUT: .Self = %Self
  1195. // CHECK:STDOUT: .F = %assoc0
  1196. // CHECK:STDOUT: witness = (%F.decl)
  1197. // CHECK:STDOUT: }
  1198. // CHECK:STDOUT:
  1199. // CHECK:STDOUT: impl @impl: %CD.ref as %.loc11_15 {
  1200. // CHECK:STDOUT: %F.decl: %F.type.064 = fn_decl @F.2 [concrete = constants.%F.822] {} {}
  1201. // CHECK:STDOUT:
  1202. // CHECK:STDOUT: !members:
  1203. // CHECK:STDOUT: .F = %F.decl
  1204. // CHECK:STDOUT: witness = file.%impl_witness
  1205. // CHECK:STDOUT: }
  1206. // CHECK:STDOUT:
  1207. // CHECK:STDOUT: class @CD {
  1208. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  1209. // CHECK:STDOUT: complete_type_witness = %complete_type
  1210. // CHECK:STDOUT:
  1211. // CHECK:STDOUT: !members:
  1212. // CHECK:STDOUT: .Self = constants.%CD
  1213. // CHECK:STDOUT: }
  1214. // CHECK:STDOUT:
  1215. // CHECK:STDOUT: generic fn @F.1(@IF.%Self: %IF.type) {
  1216. // CHECK:STDOUT: fn();
  1217. // CHECK:STDOUT: }
  1218. // CHECK:STDOUT:
  1219. // CHECK:STDOUT: fn @F.2() {
  1220. // CHECK:STDOUT: !entry:
  1221. // CHECK:STDOUT: return
  1222. // CHECK:STDOUT: }
  1223. // CHECK:STDOUT:
  1224. // CHECK:STDOUT: specific @F.1(constants.%Self) {}
  1225. // CHECK:STDOUT:
  1226. // CHECK:STDOUT: specific @F.1(constants.%IF.facet.b37) {}
  1227. // CHECK:STDOUT: