impl_assoc_const.carbon 77 KB

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