equal_rewrite.carbon 100 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649
  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/where_expr/equal_rewrite.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/where_expr/equal_rewrite.carbon
  10. // --- equal_constraint.carbon
  11. library "[[@TEST_NAME]]";
  12. interface N {
  13. let P:! type;
  14. }
  15. fn Equal(T:! N where .P = {});
  16. // --- nested_rewrites.carbon
  17. library "[[@TEST_NAME]]";
  18. interface A {
  19. let B:! type;
  20. let C:! type;
  21. }
  22. fn NestedRewrite(D:! (A where .B = bool) where .C = ());
  23. // --- repeated_rewrite.carbon
  24. library "[[@TEST_NAME]]";
  25. interface E {
  26. let F:! type;
  27. }
  28. fn OneRewrite(G:! E where .F = i32) {}
  29. fn RepeatedRewrite(H:! E where .F = i32 and .F = i32) {
  30. OneRewrite(H);
  31. }
  32. fn OneRewriteAgain(I:! E where .F = i32) {
  33. RepeatedRewrite(I);
  34. }
  35. // --- rewrites_reordered.carbon
  36. library "[[@TEST_NAME]]";
  37. interface J {
  38. let K:! type;
  39. let L:! type;
  40. }
  41. fn Alphabetical(M:! J where .K = () and .L = bool) {}
  42. fn Reversed(N:! J where .L = bool and .K = ()) {
  43. Alphabetical(N);
  44. }
  45. // --- fail_rewrites_mismatch_right.carbon
  46. library "[[@TEST_NAME]]";
  47. interface O {
  48. let P:! type;
  49. }
  50. fn WithInteger(Q:! O where .P = i32) {}
  51. fn WithBool(R:! O where .P = bool) {
  52. // CHECK:STDERR: fail_rewrites_mismatch_right.carbon:[[@LINE+10]]:3: error: cannot implicitly convert from `O where .(O.P) = bool` to `O where .(O.P) = i32` [ImplicitAsConversionFailure]
  53. // CHECK:STDERR: WithInteger(R);
  54. // CHECK:STDERR: ^~~~~~~~~~~~~~
  55. // CHECK:STDERR: fail_rewrites_mismatch_right.carbon:[[@LINE+7]]:3: note: type `O where .(O.P) = bool` does not implement interface `Core.ImplicitAs(O where .(O.P) = i32)` [MissingImplInMemberAccessNote]
  56. // CHECK:STDERR: WithInteger(R);
  57. // CHECK:STDERR: ^~~~~~~~~~~~~~
  58. // CHECK:STDERR: fail_rewrites_mismatch_right.carbon:[[@LINE-9]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
  59. // CHECK:STDERR: fn WithInteger(Q:! O where .P = i32) {}
  60. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  61. // CHECK:STDERR:
  62. WithInteger(R);
  63. }
  64. // --- fail_rewrites_mismatch_left.carbon
  65. library "[[@TEST_NAME]]";
  66. interface S {
  67. let T:! type;
  68. let U:! type;
  69. }
  70. fn WithT(V:! S where .T = ()) {}
  71. fn WithU(W:! S where .U = ()) {
  72. // CHECK:STDERR: fail_rewrites_mismatch_left.carbon:[[@LINE+10]]:3: error: cannot implicitly convert from `S where .(S.U) = ()` to `S where .(S.T) = ()` [ImplicitAsConversionFailure]
  73. // CHECK:STDERR: WithT(W);
  74. // CHECK:STDERR: ^~~~~~~~
  75. // CHECK:STDERR: fail_rewrites_mismatch_left.carbon:[[@LINE+7]]:3: note: type `S where .(S.U) = ()` does not implement interface `Core.ImplicitAs(S where .(S.T) = ())` [MissingImplInMemberAccessNote]
  76. // CHECK:STDERR: WithT(W);
  77. // CHECK:STDERR: ^~~~~~~~
  78. // CHECK:STDERR: fail_rewrites_mismatch_left.carbon:[[@LINE-9]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
  79. // CHECK:STDERR: fn WithT(V:! S where .T = ()) {}
  80. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  81. // CHECK:STDERR:
  82. WithT(W);
  83. }
  84. // --- fail_import_rewrites.carbon
  85. library "[[@TEST_NAME]]";
  86. import library "equal_constraint";
  87. import library "nested_rewrites";
  88. fn Calls() {
  89. // CHECK:STDERR: fail_import_rewrites.carbon:[[@LINE+11]]:3: error: cannot implicitly convert from `type` to `N where .(N.P) = {}` [ImplicitAsConversionFailure]
  90. // CHECK:STDERR: Equal(bool);
  91. // CHECK:STDERR: ^~~~~~~~~~~
  92. // CHECK:STDERR: fail_import_rewrites.carbon:[[@LINE+8]]:3: note: type `type` does not implement interface `Core.ImplicitAs(N where .(N.P) = {})` [MissingImplInMemberAccessNote]
  93. // CHECK:STDERR: Equal(bool);
  94. // CHECK:STDERR: ^~~~~~~~~~~
  95. // CHECK:STDERR: fail_import_rewrites.carbon:[[@LINE-10]]:1: in import [InImport]
  96. // CHECK:STDERR: equal_constraint.carbon:8:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
  97. // CHECK:STDERR: fn Equal(T:! N where .P = {});
  98. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  99. // CHECK:STDERR:
  100. Equal(bool);
  101. // CHECK:STDERR: fail_import_rewrites.carbon:[[@LINE+11]]:3: error: cannot implicitly convert from `type` to `A where .(A.C) = () and .(A.B) = bool` [ImplicitAsConversionFailure]
  102. // CHECK:STDERR: NestedRewrite(i32);
  103. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
  104. // CHECK:STDERR: fail_import_rewrites.carbon:[[@LINE+8]]:3: note: type `type` does not implement interface `Core.ImplicitAs(A where .(A.C) = () and .(A.B) = bool)` [MissingImplInMemberAccessNote]
  105. // CHECK:STDERR: NestedRewrite(i32);
  106. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
  107. // CHECK:STDERR: fail_import_rewrites.carbon:[[@LINE-23]]:1: in import [InImport]
  108. // CHECK:STDERR: nested_rewrites.carbon:9:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
  109. // CHECK:STDERR: fn NestedRewrite(D:! (A where .B = bool) where .C = ());
  110. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  111. // CHECK:STDERR:
  112. NestedRewrite(i32);
  113. }
  114. // --- fail_check_rewrite_constraints.carbon
  115. library "[[@TEST_NAME]]";
  116. interface I {
  117. let Member:! type;
  118. }
  119. // `2` can't be converted to the type of `I.Member`
  120. // CHECK:STDERR: fail_check_rewrite_constraints.carbon:[[@LINE+7]]:46: error: cannot implicitly convert from `Core.IntLiteral` to `type` [ImplicitAsConversionFailure]
  121. // CHECK:STDERR: fn RewriteTypeMismatch(X:! I where .Member = 2);
  122. // CHECK:STDERR: ^
  123. // CHECK:STDERR: fail_check_rewrite_constraints.carbon:[[@LINE+4]]:46: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote]
  124. // CHECK:STDERR: fn RewriteTypeMismatch(X:! I where .Member = 2);
  125. // CHECK:STDERR: ^
  126. // CHECK:STDERR:
  127. fn RewriteTypeMismatch(X:! I where .Member = 2);
  128. // --- fail_todo_let.carbon
  129. library "[[@TEST_NAME]]";
  130. interface A {}
  131. class D {}
  132. impl D as A {}
  133. // TODO: This should be a compile-time binding, once that is supported.
  134. // CHECK:STDERR: fail_todo_let.carbon:[[@LINE+7]]:35: error: cannot implicitly convert from `type` to `type where...` [ImplicitAsConversionFailure]
  135. // CHECK:STDERR: let B: type where .Self impls A = D;
  136. // CHECK:STDERR: ^
  137. // CHECK:STDERR: fail_todo_let.carbon:[[@LINE+4]]:35: note: type `type` does not implement interface `Core.ImplicitAs(type where...)` [MissingImplInMemberAccessNote]
  138. // CHECK:STDERR: let B: type where .Self impls A = D;
  139. // CHECK:STDERR: ^
  140. // CHECK:STDERR:
  141. let B: type where .Self impls A = D;
  142. // --- fail_type_does_not_implement_where.carbon
  143. library "[[@TEST_NAME]]";
  144. interface E {
  145. let F:! type;
  146. let G:! type;
  147. }
  148. // Testing how these types get stringified in error messages.
  149. // TODO: This should be a compile-time binding, once that is supported.
  150. // CHECK:STDERR: fail_type_does_not_implement_where.carbon:[[@LINE+7]]:42: error: cannot implicitly convert from `type` to `E where .(E.G) = () and .(E.F) = bool` [ImplicitAsConversionFailure]
  151. // CHECK:STDERR: let H: (E where .F = bool and .G = ()) = f64;
  152. // CHECK:STDERR: ^~~
  153. // CHECK:STDERR: fail_type_does_not_implement_where.carbon:[[@LINE+4]]:42: note: type `type` does not implement interface `Core.ImplicitAs(E where .(E.G) = () and .(E.F) = bool)` [MissingImplInMemberAccessNote]
  154. // CHECK:STDERR: let H: (E where .F = bool and .G = ()) = f64;
  155. // CHECK:STDERR: ^~~
  156. // CHECK:STDERR:
  157. let H: (E where .F = bool and .G = ()) = f64;
  158. // CHECK:STDERR: fail_type_does_not_implement_where.carbon:[[@LINE+7]]:45: error: cannot implicitly convert from `type` to `E where .(E.G) = i32 and .(E.F) = {}` [ImplicitAsConversionFailure]
  159. // CHECK:STDERR: let J: ((E where .F = {}) where .G = i32) = bool;
  160. // CHECK:STDERR: ^~~~
  161. // CHECK:STDERR: fail_type_does_not_implement_where.carbon:[[@LINE+4]]:45: note: type `type` does not implement interface `Core.ImplicitAs(E where .(E.G) = i32 and .(E.F) = {})` [MissingImplInMemberAccessNote]
  162. // CHECK:STDERR: let J: ((E where .F = {}) where .G = i32) = bool;
  163. // CHECK:STDERR: ^~~~
  164. // CHECK:STDERR:
  165. let J: ((E where .F = {}) where .G = i32) = bool;
  166. // CHECK:STDERR: fail_type_does_not_implement_where.carbon:[[@LINE+7]]:33: error: cannot implicitly convert from `type` to `E where .(E.F) = .(E.G)` [ImplicitAsConversionFailure]
  167. // CHECK:STDERR: let K: (E where .F = .Self.G) = bool;
  168. // CHECK:STDERR: ^~~~
  169. // CHECK:STDERR: fail_type_does_not_implement_where.carbon:[[@LINE+4]]:33: note: type `type` does not implement interface `Core.ImplicitAs(E where .(E.F) = .(E.G))` [MissingImplInMemberAccessNote]
  170. // CHECK:STDERR: let K: (E where .F = .Self.G) = bool;
  171. // CHECK:STDERR: ^~~~
  172. // CHECK:STDERR:
  173. let K: (E where .F = .Self.G) = bool;
  174. // CHECK:STDOUT: --- equal_constraint.carbon
  175. // CHECK:STDOUT:
  176. // CHECK:STDOUT: constants {
  177. // CHECK:STDOUT: %N.type: type = facet_type <@N> [template]
  178. // CHECK:STDOUT: %Self: %N.type = bind_symbolic_name Self, 0 [symbolic]
  179. // CHECK:STDOUT: %N.assoc_type: type = assoc_entity_type %N.type [template]
  180. // CHECK:STDOUT: %assoc0: %N.assoc_type = assoc_entity element0, @N.%P [template]
  181. // CHECK:STDOUT: %.Self: %N.type = bind_symbolic_name .Self [symbolic]
  182. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic]
  183. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self [symbolic]
  184. // CHECK:STDOUT: %N.facet: %N.type = facet_value %.Self.as_type, %.Self.as_wit [symbolic]
  185. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic]
  186. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  187. // CHECK:STDOUT: %N_where.type: type = facet_type <@N where %impl.elem0 = %empty_struct_type> [template]
  188. // CHECK:STDOUT: %T: %N_where.type = bind_symbolic_name T, 0 [symbolic]
  189. // CHECK:STDOUT: %T.patt: %N_where.type = symbolic_binding_pattern T, 0 [symbolic]
  190. // CHECK:STDOUT: %Equal.type: type = fn_type @Equal [template]
  191. // CHECK:STDOUT: %Equal: %Equal.type = struct_value () [template]
  192. // CHECK:STDOUT: }
  193. // CHECK:STDOUT:
  194. // CHECK:STDOUT: imports {
  195. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  196. // CHECK:STDOUT: import Core//prelude
  197. // CHECK:STDOUT: import Core//prelude/...
  198. // CHECK:STDOUT: }
  199. // CHECK:STDOUT: }
  200. // CHECK:STDOUT:
  201. // CHECK:STDOUT: file {
  202. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  203. // CHECK:STDOUT: .Core = imports.%Core
  204. // CHECK:STDOUT: .N = %N.decl
  205. // CHECK:STDOUT: .Equal = %Equal.decl
  206. // CHECK:STDOUT: }
  207. // CHECK:STDOUT: %Core.import = import Core
  208. // CHECK:STDOUT: %N.decl: type = interface_decl @N [template = constants.%N.type] {} {}
  209. // CHECK:STDOUT: %Equal.decl: %Equal.type = fn_decl @Equal [template = constants.%Equal] {
  210. // CHECK:STDOUT: %T.patt.loc8_10.1: %N_where.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_10.2 (constants.%T.patt)]
  211. // CHECK:STDOUT: %T.param_patt: %N_where.type = value_param_pattern %T.patt.loc8_10.1, runtime_param<none> [symbolic = %T.patt.loc8_10.2 (constants.%T.patt)]
  212. // CHECK:STDOUT: } {
  213. // CHECK:STDOUT: %T.param: %N_where.type = value_param runtime_param<none>
  214. // CHECK:STDOUT: %.loc8_16.1: type = splice_block %.loc8_16.2 [template = constants.%N_where.type] {
  215. // CHECK:STDOUT: %N.ref: type = name_ref N, file.%N.decl [template = constants.%N.type]
  216. // CHECK:STDOUT: %.Self: %N.type = bind_symbolic_name .Self [symbolic = constants.%.Self]
  217. // CHECK:STDOUT: %.Self.ref: %N.type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  218. // CHECK:STDOUT: %P.ref: %N.assoc_type = name_ref P, @P.%assoc0 [template = constants.%assoc0]
  219. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic = constants.%.Self.as_type]
  220. // CHECK:STDOUT: %.loc8_22: type = converted %.Self.ref, %.Self.as_type [symbolic = constants.%.Self.as_type]
  221. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.ref [symbolic = constants.%.Self.as_wit]
  222. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic = constants.%impl.elem0]
  223. // CHECK:STDOUT: %.loc8_28.1: %empty_struct_type = struct_literal ()
  224. // CHECK:STDOUT: %.loc8_28.2: type = converted %.loc8_28.1, constants.%empty_struct_type [template = constants.%empty_struct_type]
  225. // CHECK:STDOUT: %.loc8_16.2: type = where_expr %.Self [template = constants.%N_where.type] {
  226. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc8_28.2
  227. // CHECK:STDOUT: }
  228. // CHECK:STDOUT: }
  229. // CHECK:STDOUT: %T.loc8_10.1: %N_where.type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc8_10.2 (constants.%T)]
  230. // CHECK:STDOUT: }
  231. // CHECK:STDOUT: }
  232. // CHECK:STDOUT:
  233. // CHECK:STDOUT: interface @N {
  234. // CHECK:STDOUT: %Self: %N.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  235. // CHECK:STDOUT: %P: type = assoc_const_decl @P [template] {
  236. // CHECK:STDOUT: %assoc0: %N.assoc_type = assoc_entity element0, @N.%P [template = constants.%assoc0]
  237. // CHECK:STDOUT: }
  238. // CHECK:STDOUT:
  239. // CHECK:STDOUT: !members:
  240. // CHECK:STDOUT: .Self = %Self
  241. // CHECK:STDOUT: .P = @P.%assoc0
  242. // CHECK:STDOUT: witness = (%P)
  243. // CHECK:STDOUT: }
  244. // CHECK:STDOUT:
  245. // CHECK:STDOUT: generic assoc_const @P(@N.%Self: %N.type) {
  246. // CHECK:STDOUT: assoc_const P:! type;
  247. // CHECK:STDOUT: }
  248. // CHECK:STDOUT:
  249. // CHECK:STDOUT: generic fn @Equal(%T.loc8_10.1: %N_where.type) {
  250. // CHECK:STDOUT: %T.loc8_10.2: %N_where.type = bind_symbolic_name T, 0 [symbolic = %T.loc8_10.2 (constants.%T)]
  251. // CHECK:STDOUT: %T.patt.loc8_10.2: %N_where.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_10.2 (constants.%T.patt)]
  252. // CHECK:STDOUT:
  253. // CHECK:STDOUT: fn(%T.param_patt: %N_where.type);
  254. // CHECK:STDOUT: }
  255. // CHECK:STDOUT:
  256. // CHECK:STDOUT: specific @P(constants.%Self) {}
  257. // CHECK:STDOUT:
  258. // CHECK:STDOUT: specific @P(constants.%N.facet) {}
  259. // CHECK:STDOUT:
  260. // CHECK:STDOUT: specific @Equal(constants.%T) {
  261. // CHECK:STDOUT: %T.loc8_10.2 => constants.%T
  262. // CHECK:STDOUT: %T.patt.loc8_10.2 => constants.%T
  263. // CHECK:STDOUT: }
  264. // CHECK:STDOUT:
  265. // CHECK:STDOUT: --- nested_rewrites.carbon
  266. // CHECK:STDOUT:
  267. // CHECK:STDOUT: constants {
  268. // CHECK:STDOUT: %A.type: type = facet_type <@A> [template]
  269. // CHECK:STDOUT: %Self: %A.type = bind_symbolic_name Self, 0 [symbolic]
  270. // CHECK:STDOUT: %A.assoc_type: type = assoc_entity_type %A.type [template]
  271. // CHECK:STDOUT: %assoc0: %A.assoc_type = assoc_entity element0, @A.%B [template]
  272. // CHECK:STDOUT: %assoc1: %A.assoc_type = assoc_entity element1, @A.%C [template]
  273. // CHECK:STDOUT: %.Self.3ca: %A.type = bind_symbolic_name .Self [symbolic]
  274. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  275. // CHECK:STDOUT: %.Self.as_type.adb: type = facet_access_type %.Self.3ca [symbolic]
  276. // CHECK:STDOUT: %.Self.as_wit.794: <witness> = facet_access_witness %.Self.3ca [symbolic]
  277. // CHECK:STDOUT: %A.facet.213: %A.type = facet_value %.Self.as_type.adb, %.Self.as_wit.794 [symbolic]
  278. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit.794, element0 [symbolic]
  279. // CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template]
  280. // CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template]
  281. // CHECK:STDOUT: %A_where.type.ef9: type = facet_type <@A where %impl.elem0 = bool> [template]
  282. // CHECK:STDOUT: %.Self.e46: %A_where.type.ef9 = bind_symbolic_name .Self [symbolic]
  283. // CHECK:STDOUT: %.Self.as_type.6f3: type = facet_access_type %.Self.e46 [symbolic]
  284. // CHECK:STDOUT: %.Self.as_wit.a35: <witness> = facet_access_witness %.Self.e46 [symbolic]
  285. // CHECK:STDOUT: %A.facet.e67: %A.type = facet_value %.Self.as_type.6f3, %.Self.as_wit.a35 [symbolic]
  286. // CHECK:STDOUT: %impl.elem1: type = impl_witness_access %.Self.as_wit.a35, element1 [symbolic]
  287. // CHECK:STDOUT: %A_where.type.791: type = facet_type <@A where %impl.elem1 = %empty_tuple.type and %impl.elem0 = bool> [template]
  288. // CHECK:STDOUT: %D: %A_where.type.791 = bind_symbolic_name D, 0 [symbolic]
  289. // CHECK:STDOUT: %D.patt: %A_where.type.791 = symbolic_binding_pattern D, 0 [symbolic]
  290. // CHECK:STDOUT: %NestedRewrite.type: type = fn_type @NestedRewrite [template]
  291. // CHECK:STDOUT: %NestedRewrite: %NestedRewrite.type = struct_value () [template]
  292. // CHECK:STDOUT: }
  293. // CHECK:STDOUT:
  294. // CHECK:STDOUT: imports {
  295. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  296. // CHECK:STDOUT: .Bool = %Core.Bool
  297. // CHECK:STDOUT: import Core//prelude
  298. // CHECK:STDOUT: import Core//prelude/...
  299. // CHECK:STDOUT: }
  300. // CHECK:STDOUT: }
  301. // CHECK:STDOUT:
  302. // CHECK:STDOUT: file {
  303. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  304. // CHECK:STDOUT: .Core = imports.%Core
  305. // CHECK:STDOUT: .A = %A.decl
  306. // CHECK:STDOUT: .NestedRewrite = %NestedRewrite.decl
  307. // CHECK:STDOUT: }
  308. // CHECK:STDOUT: %Core.import = import Core
  309. // CHECK:STDOUT: %A.decl: type = interface_decl @A [template = constants.%A.type] {} {}
  310. // CHECK:STDOUT: %NestedRewrite.decl: %NestedRewrite.type = fn_decl @NestedRewrite [template = constants.%NestedRewrite] {
  311. // CHECK:STDOUT: %D.patt.loc9_18.1: %A_where.type.791 = symbolic_binding_pattern D, 0 [symbolic = %D.patt.loc9_18.2 (constants.%D.patt)]
  312. // CHECK:STDOUT: %D.param_patt: %A_where.type.791 = value_param_pattern %D.patt.loc9_18.1, runtime_param<none> [symbolic = %D.patt.loc9_18.2 (constants.%D.patt)]
  313. // CHECK:STDOUT: } {
  314. // CHECK:STDOUT: %D.param: %A_where.type.791 = value_param runtime_param<none>
  315. // CHECK:STDOUT: %.loc9_42.1: type = splice_block %.loc9_42.2 [template = constants.%A_where.type.791] {
  316. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A.type]
  317. // CHECK:STDOUT: %.Self.1: %A.type = bind_symbolic_name .Self [symbolic = constants.%.Self.3ca]
  318. // CHECK:STDOUT: %.Self.ref.loc9_31: %A.type = name_ref .Self, %.Self.1 [symbolic = constants.%.Self.3ca]
  319. // CHECK:STDOUT: %B.ref: %A.assoc_type = name_ref B, @B.%assoc0 [template = constants.%assoc0]
  320. // CHECK:STDOUT: %.Self.as_type.loc9_31: type = facet_access_type %.Self.ref.loc9_31 [symbolic = constants.%.Self.as_type.adb]
  321. // CHECK:STDOUT: %.loc9_31: type = converted %.Self.ref.loc9_31, %.Self.as_type.loc9_31 [symbolic = constants.%.Self.as_type.adb]
  322. // CHECK:STDOUT: %.Self.as_wit.loc9_31: <witness> = facet_access_witness %.Self.ref.loc9_31 [symbolic = constants.%.Self.as_wit.794]
  323. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit.loc9_31, element0 [symbolic = constants.%impl.elem0]
  324. // CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool]
  325. // CHECK:STDOUT: %.loc9_36.1: type = value_of_initializer %bool.make_type [template = bool]
  326. // CHECK:STDOUT: %.loc9_36.2: type = converted %bool.make_type, %.loc9_36.1 [template = bool]
  327. // CHECK:STDOUT: %.loc9_25: type = where_expr %.Self.1 [template = constants.%A_where.type.ef9] {
  328. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc9_36.2
  329. // CHECK:STDOUT: }
  330. // CHECK:STDOUT: %.Self.2: %A_where.type.ef9 = bind_symbolic_name .Self [symbolic = constants.%.Self.e46]
  331. // CHECK:STDOUT: %.Self.ref.loc9_48: %A_where.type.ef9 = name_ref .Self, %.Self.2 [symbolic = constants.%.Self.e46]
  332. // CHECK:STDOUT: %C.ref: %A.assoc_type = name_ref C, @C.%assoc1 [template = constants.%assoc1]
  333. // CHECK:STDOUT: %.Self.as_type.loc9_48: type = facet_access_type %.Self.ref.loc9_48 [symbolic = constants.%.Self.as_type.6f3]
  334. // CHECK:STDOUT: %.loc9_48: type = converted %.Self.ref.loc9_48, %.Self.as_type.loc9_48 [symbolic = constants.%.Self.as_type.6f3]
  335. // CHECK:STDOUT: %.Self.as_wit.loc9_48: <witness> = facet_access_witness %.Self.ref.loc9_48 [symbolic = constants.%.Self.as_wit.a35]
  336. // CHECK:STDOUT: %impl.elem1: type = impl_witness_access %.Self.as_wit.loc9_48, element1 [symbolic = constants.%impl.elem1]
  337. // CHECK:STDOUT: %.loc9_54.1: %empty_tuple.type = tuple_literal ()
  338. // CHECK:STDOUT: %.loc9_54.2: type = converted %.loc9_54.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type]
  339. // CHECK:STDOUT: %.loc9_42.2: type = where_expr %.Self.2 [template = constants.%A_where.type.791] {
  340. // CHECK:STDOUT: requirement_rewrite %impl.elem1, %.loc9_54.2
  341. // CHECK:STDOUT: }
  342. // CHECK:STDOUT: }
  343. // CHECK:STDOUT: %D.loc9_18.1: %A_where.type.791 = bind_symbolic_name D, 0, %D.param [symbolic = %D.loc9_18.2 (constants.%D)]
  344. // CHECK:STDOUT: }
  345. // CHECK:STDOUT: }
  346. // CHECK:STDOUT:
  347. // CHECK:STDOUT: interface @A {
  348. // CHECK:STDOUT: %Self: %A.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  349. // CHECK:STDOUT: %B: type = assoc_const_decl @B [template] {
  350. // CHECK:STDOUT: %assoc0: %A.assoc_type = assoc_entity element0, @A.%B [template = constants.%assoc0]
  351. // CHECK:STDOUT: }
  352. // CHECK:STDOUT: %C: type = assoc_const_decl @C [template] {
  353. // CHECK:STDOUT: %assoc1: %A.assoc_type = assoc_entity element1, @A.%C [template = constants.%assoc1]
  354. // CHECK:STDOUT: }
  355. // CHECK:STDOUT:
  356. // CHECK:STDOUT: !members:
  357. // CHECK:STDOUT: .Self = %Self
  358. // CHECK:STDOUT: .B = @B.%assoc0
  359. // CHECK:STDOUT: .C = @C.%assoc1
  360. // CHECK:STDOUT: witness = (%B, %C)
  361. // CHECK:STDOUT: }
  362. // CHECK:STDOUT:
  363. // CHECK:STDOUT: generic assoc_const @B(@A.%Self: %A.type) {
  364. // CHECK:STDOUT: assoc_const B:! type;
  365. // CHECK:STDOUT: }
  366. // CHECK:STDOUT:
  367. // CHECK:STDOUT: generic assoc_const @C(@A.%Self: %A.type) {
  368. // CHECK:STDOUT: assoc_const C:! type;
  369. // CHECK:STDOUT: }
  370. // CHECK:STDOUT:
  371. // CHECK:STDOUT: generic fn @NestedRewrite(%D.loc9_18.1: %A_where.type.791) {
  372. // CHECK:STDOUT: %D.loc9_18.2: %A_where.type.791 = bind_symbolic_name D, 0 [symbolic = %D.loc9_18.2 (constants.%D)]
  373. // CHECK:STDOUT: %D.patt.loc9_18.2: %A_where.type.791 = symbolic_binding_pattern D, 0 [symbolic = %D.patt.loc9_18.2 (constants.%D.patt)]
  374. // CHECK:STDOUT:
  375. // CHECK:STDOUT: fn(%D.param_patt: %A_where.type.791);
  376. // CHECK:STDOUT: }
  377. // CHECK:STDOUT:
  378. // CHECK:STDOUT: specific @B(constants.%Self) {}
  379. // CHECK:STDOUT:
  380. // CHECK:STDOUT: specific @C(constants.%Self) {}
  381. // CHECK:STDOUT:
  382. // CHECK:STDOUT: specific @B(constants.%A.facet.213) {}
  383. // CHECK:STDOUT:
  384. // CHECK:STDOUT: specific @C(constants.%A.facet.e67) {}
  385. // CHECK:STDOUT:
  386. // CHECK:STDOUT: specific @NestedRewrite(constants.%D) {
  387. // CHECK:STDOUT: %D.loc9_18.2 => constants.%D
  388. // CHECK:STDOUT: %D.patt.loc9_18.2 => constants.%D
  389. // CHECK:STDOUT: }
  390. // CHECK:STDOUT:
  391. // CHECK:STDOUT: --- repeated_rewrite.carbon
  392. // CHECK:STDOUT:
  393. // CHECK:STDOUT: constants {
  394. // CHECK:STDOUT: %E.type: type = facet_type <@E> [template]
  395. // CHECK:STDOUT: %Self: %E.type = bind_symbolic_name Self, 0 [symbolic]
  396. // CHECK:STDOUT: %E.assoc_type: type = assoc_entity_type %E.type [template]
  397. // CHECK:STDOUT: %assoc0: %E.assoc_type = assoc_entity element0, @E.%F [template]
  398. // CHECK:STDOUT: %.Self: %E.type = bind_symbolic_name .Self [symbolic]
  399. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  400. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic]
  401. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self [symbolic]
  402. // CHECK:STDOUT: %E.facet: %E.type = facet_value %.Self.as_type, %.Self.as_wit [symbolic]
  403. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic]
  404. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
  405. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
  406. // CHECK:STDOUT: %E_where.type: type = facet_type <@E where %impl.elem0 = %i32> [template]
  407. // CHECK:STDOUT: %G: %E_where.type = bind_symbolic_name G, 0 [symbolic]
  408. // CHECK:STDOUT: %G.patt: %E_where.type = symbolic_binding_pattern G, 0 [symbolic]
  409. // CHECK:STDOUT: %OneRewrite.type: type = fn_type @OneRewrite [template]
  410. // CHECK:STDOUT: %OneRewrite: %OneRewrite.type = struct_value () [template]
  411. // CHECK:STDOUT: %H: %E_where.type = bind_symbolic_name H, 0 [symbolic]
  412. // CHECK:STDOUT: %H.patt: %E_where.type = symbolic_binding_pattern H, 0 [symbolic]
  413. // CHECK:STDOUT: %RepeatedRewrite.type: type = fn_type @RepeatedRewrite [template]
  414. // CHECK:STDOUT: %RepeatedRewrite: %RepeatedRewrite.type = struct_value () [template]
  415. // CHECK:STDOUT: %OneRewrite.specific_fn.381461.1: <specific function> = specific_function %OneRewrite, @OneRewrite(%H) [symbolic]
  416. // CHECK:STDOUT: %I: %E_where.type = bind_symbolic_name I, 0 [symbolic]
  417. // CHECK:STDOUT: %I.patt: %E_where.type = symbolic_binding_pattern I, 0 [symbolic]
  418. // CHECK:STDOUT: %OneRewriteAgain.type: type = fn_type @OneRewriteAgain [template]
  419. // CHECK:STDOUT: %OneRewriteAgain: %OneRewriteAgain.type = struct_value () [template]
  420. // CHECK:STDOUT: %RepeatedRewrite.specific_fn: <specific function> = specific_function %RepeatedRewrite, @RepeatedRewrite(%I) [symbolic]
  421. // CHECK:STDOUT: %OneRewrite.specific_fn.381461.2: <specific function> = specific_function %OneRewrite, @OneRewrite(%I) [symbolic]
  422. // CHECK:STDOUT: }
  423. // CHECK:STDOUT:
  424. // CHECK:STDOUT: imports {
  425. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  426. // CHECK:STDOUT: .Int = %Core.Int
  427. // CHECK:STDOUT: import Core//prelude
  428. // CHECK:STDOUT: import Core//prelude/...
  429. // CHECK:STDOUT: }
  430. // CHECK:STDOUT: }
  431. // CHECK:STDOUT:
  432. // CHECK:STDOUT: file {
  433. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  434. // CHECK:STDOUT: .Core = imports.%Core
  435. // CHECK:STDOUT: .E = %E.decl
  436. // CHECK:STDOUT: .OneRewrite = %OneRewrite.decl
  437. // CHECK:STDOUT: .RepeatedRewrite = %RepeatedRewrite.decl
  438. // CHECK:STDOUT: .OneRewriteAgain = %OneRewriteAgain.decl
  439. // CHECK:STDOUT: }
  440. // CHECK:STDOUT: %Core.import = import Core
  441. // CHECK:STDOUT: %E.decl: type = interface_decl @E [template = constants.%E.type] {} {}
  442. // CHECK:STDOUT: %OneRewrite.decl: %OneRewrite.type = fn_decl @OneRewrite [template = constants.%OneRewrite] {
  443. // CHECK:STDOUT: %G.patt.loc8_15.1: %E_where.type = symbolic_binding_pattern G, 0 [symbolic = %G.patt.loc8_15.2 (constants.%G.patt)]
  444. // CHECK:STDOUT: %G.param_patt: %E_where.type = value_param_pattern %G.patt.loc8_15.1, runtime_param<none> [symbolic = %G.patt.loc8_15.2 (constants.%G.patt)]
  445. // CHECK:STDOUT: } {
  446. // CHECK:STDOUT: %G.param: %E_where.type = value_param runtime_param<none>
  447. // CHECK:STDOUT: %.loc8_21.1: type = splice_block %.loc8_21.2 [template = constants.%E_where.type] {
  448. // CHECK:STDOUT: %E.ref: type = name_ref E, file.%E.decl [template = constants.%E.type]
  449. // CHECK:STDOUT: %.Self: %E.type = bind_symbolic_name .Self [symbolic = constants.%.Self]
  450. // CHECK:STDOUT: %.Self.ref: %E.type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  451. // CHECK:STDOUT: %F.ref: %E.assoc_type = name_ref F, @F.%assoc0 [template = constants.%assoc0]
  452. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic = constants.%.Self.as_type]
  453. // CHECK:STDOUT: %.loc8_27: type = converted %.Self.ref, %.Self.as_type [symbolic = constants.%.Self.as_type]
  454. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.ref [symbolic = constants.%.Self.as_wit]
  455. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic = constants.%impl.elem0]
  456. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  457. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  458. // CHECK:STDOUT: %.loc8_21.2: type = where_expr %.Self [template = constants.%E_where.type] {
  459. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %i32
  460. // CHECK:STDOUT: }
  461. // CHECK:STDOUT: }
  462. // CHECK:STDOUT: %G.loc8_15.1: %E_where.type = bind_symbolic_name G, 0, %G.param [symbolic = %G.loc8_15.2 (constants.%G)]
  463. // CHECK:STDOUT: }
  464. // CHECK:STDOUT: %RepeatedRewrite.decl: %RepeatedRewrite.type = fn_decl @RepeatedRewrite [template = constants.%RepeatedRewrite] {
  465. // CHECK:STDOUT: %H.patt.loc10_20.1: %E_where.type = symbolic_binding_pattern H, 0 [symbolic = %H.patt.loc10_20.2 (constants.%H.patt)]
  466. // CHECK:STDOUT: %H.param_patt: %E_where.type = value_param_pattern %H.patt.loc10_20.1, runtime_param<none> [symbolic = %H.patt.loc10_20.2 (constants.%H.patt)]
  467. // CHECK:STDOUT: } {
  468. // CHECK:STDOUT: %H.param: %E_where.type = value_param runtime_param<none>
  469. // CHECK:STDOUT: %.loc10_26.1: type = splice_block %.loc10_26.2 [template = constants.%E_where.type] {
  470. // CHECK:STDOUT: %E.ref: type = name_ref E, file.%E.decl [template = constants.%E.type]
  471. // CHECK:STDOUT: %.Self: %E.type = bind_symbolic_name .Self [symbolic = constants.%.Self]
  472. // CHECK:STDOUT: %.Self.ref.loc10_32: %E.type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  473. // CHECK:STDOUT: %F.ref.loc10_32: %E.assoc_type = name_ref F, @F.%assoc0 [template = constants.%assoc0]
  474. // CHECK:STDOUT: %.Self.as_type.loc10_32: type = facet_access_type %.Self.ref.loc10_32 [symbolic = constants.%.Self.as_type]
  475. // CHECK:STDOUT: %.loc10_32: type = converted %.Self.ref.loc10_32, %.Self.as_type.loc10_32 [symbolic = constants.%.Self.as_type]
  476. // CHECK:STDOUT: %.Self.as_wit.loc10_32: <witness> = facet_access_witness %.Self.ref.loc10_32 [symbolic = constants.%.Self.as_wit]
  477. // CHECK:STDOUT: %impl.elem0.loc10_32: type = impl_witness_access %.Self.as_wit.loc10_32, element0 [symbolic = constants.%impl.elem0]
  478. // CHECK:STDOUT: %int_32.loc10_37: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  479. // CHECK:STDOUT: %i32.loc10_37: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  480. // CHECK:STDOUT: %.Self.ref.loc10_45: %E.type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  481. // CHECK:STDOUT: %F.ref.loc10_45: %E.assoc_type = name_ref F, @F.%assoc0 [template = constants.%assoc0]
  482. // CHECK:STDOUT: %.Self.as_type.loc10_45: type = facet_access_type %.Self.ref.loc10_45 [symbolic = constants.%.Self.as_type]
  483. // CHECK:STDOUT: %.loc10_45: type = converted %.Self.ref.loc10_45, %.Self.as_type.loc10_45 [symbolic = constants.%.Self.as_type]
  484. // CHECK:STDOUT: %.Self.as_wit.loc10_45: <witness> = facet_access_witness %.Self.ref.loc10_45 [symbolic = constants.%.Self.as_wit]
  485. // CHECK:STDOUT: %impl.elem0.loc10_45: type = impl_witness_access %.Self.as_wit.loc10_45, element0 [symbolic = constants.%impl.elem0]
  486. // CHECK:STDOUT: %int_32.loc10_50: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  487. // CHECK:STDOUT: %i32.loc10_50: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  488. // CHECK:STDOUT: %.loc10_26.2: type = where_expr %.Self [template = constants.%E_where.type] {
  489. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc10_32, %i32.loc10_37
  490. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc10_45, %i32.loc10_50
  491. // CHECK:STDOUT: }
  492. // CHECK:STDOUT: }
  493. // CHECK:STDOUT: %H.loc10_20.1: %E_where.type = bind_symbolic_name H, 0, %H.param [symbolic = %H.loc10_20.2 (constants.%H)]
  494. // CHECK:STDOUT: }
  495. // CHECK:STDOUT: %OneRewriteAgain.decl: %OneRewriteAgain.type = fn_decl @OneRewriteAgain [template = constants.%OneRewriteAgain] {
  496. // CHECK:STDOUT: %I.patt.loc14_20.1: %E_where.type = symbolic_binding_pattern I, 0 [symbolic = %I.patt.loc14_20.2 (constants.%I.patt)]
  497. // CHECK:STDOUT: %I.param_patt: %E_where.type = value_param_pattern %I.patt.loc14_20.1, runtime_param<none> [symbolic = %I.patt.loc14_20.2 (constants.%I.patt)]
  498. // CHECK:STDOUT: } {
  499. // CHECK:STDOUT: %I.param: %E_where.type = value_param runtime_param<none>
  500. // CHECK:STDOUT: %.loc14_26.1: type = splice_block %.loc14_26.2 [template = constants.%E_where.type] {
  501. // CHECK:STDOUT: %E.ref: type = name_ref E, file.%E.decl [template = constants.%E.type]
  502. // CHECK:STDOUT: %.Self: %E.type = bind_symbolic_name .Self [symbolic = constants.%.Self]
  503. // CHECK:STDOUT: %.Self.ref: %E.type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  504. // CHECK:STDOUT: %F.ref: %E.assoc_type = name_ref F, @F.%assoc0 [template = constants.%assoc0]
  505. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic = constants.%.Self.as_type]
  506. // CHECK:STDOUT: %.loc14_32: type = converted %.Self.ref, %.Self.as_type [symbolic = constants.%.Self.as_type]
  507. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.ref [symbolic = constants.%.Self.as_wit]
  508. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic = constants.%impl.elem0]
  509. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  510. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  511. // CHECK:STDOUT: %.loc14_26.2: type = where_expr %.Self [template = constants.%E_where.type] {
  512. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %i32
  513. // CHECK:STDOUT: }
  514. // CHECK:STDOUT: }
  515. // CHECK:STDOUT: %I.loc14_20.1: %E_where.type = bind_symbolic_name I, 0, %I.param [symbolic = %I.loc14_20.2 (constants.%I)]
  516. // CHECK:STDOUT: }
  517. // CHECK:STDOUT: }
  518. // CHECK:STDOUT:
  519. // CHECK:STDOUT: interface @E {
  520. // CHECK:STDOUT: %Self: %E.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  521. // CHECK:STDOUT: %F: type = assoc_const_decl @F [template] {
  522. // CHECK:STDOUT: %assoc0: %E.assoc_type = assoc_entity element0, @E.%F [template = constants.%assoc0]
  523. // CHECK:STDOUT: }
  524. // CHECK:STDOUT:
  525. // CHECK:STDOUT: !members:
  526. // CHECK:STDOUT: .Self = %Self
  527. // CHECK:STDOUT: .F = @F.%assoc0
  528. // CHECK:STDOUT: witness = (%F)
  529. // CHECK:STDOUT: }
  530. // CHECK:STDOUT:
  531. // CHECK:STDOUT: generic assoc_const @F(@E.%Self: %E.type) {
  532. // CHECK:STDOUT: assoc_const F:! type;
  533. // CHECK:STDOUT: }
  534. // CHECK:STDOUT:
  535. // CHECK:STDOUT: generic fn @OneRewrite(%G.loc8_15.1: %E_where.type) {
  536. // CHECK:STDOUT: %G.loc8_15.2: %E_where.type = bind_symbolic_name G, 0 [symbolic = %G.loc8_15.2 (constants.%G)]
  537. // CHECK:STDOUT: %G.patt.loc8_15.2: %E_where.type = symbolic_binding_pattern G, 0 [symbolic = %G.patt.loc8_15.2 (constants.%G.patt)]
  538. // CHECK:STDOUT:
  539. // CHECK:STDOUT: !definition:
  540. // CHECK:STDOUT:
  541. // CHECK:STDOUT: fn(%G.param_patt: %E_where.type) {
  542. // CHECK:STDOUT: !entry:
  543. // CHECK:STDOUT: return
  544. // CHECK:STDOUT: }
  545. // CHECK:STDOUT: }
  546. // CHECK:STDOUT:
  547. // CHECK:STDOUT: generic fn @RepeatedRewrite(%H.loc10_20.1: %E_where.type) {
  548. // CHECK:STDOUT: %H.loc10_20.2: %E_where.type = bind_symbolic_name H, 0 [symbolic = %H.loc10_20.2 (constants.%H)]
  549. // CHECK:STDOUT: %H.patt.loc10_20.2: %E_where.type = symbolic_binding_pattern H, 0 [symbolic = %H.patt.loc10_20.2 (constants.%H.patt)]
  550. // CHECK:STDOUT:
  551. // CHECK:STDOUT: !definition:
  552. // CHECK:STDOUT: %OneRewrite.specific_fn.loc11_3.2: <specific function> = specific_function constants.%OneRewrite, @OneRewrite(%H.loc10_20.2) [symbolic = %OneRewrite.specific_fn.loc11_3.2 (constants.%OneRewrite.specific_fn.381461.1)]
  553. // CHECK:STDOUT:
  554. // CHECK:STDOUT: fn(%H.param_patt: %E_where.type) {
  555. // CHECK:STDOUT: !entry:
  556. // CHECK:STDOUT: %OneRewrite.ref: %OneRewrite.type = name_ref OneRewrite, file.%OneRewrite.decl [template = constants.%OneRewrite]
  557. // CHECK:STDOUT: %H.ref: %E_where.type = name_ref H, %H.loc10_20.1 [symbolic = %H.loc10_20.2 (constants.%H)]
  558. // CHECK:STDOUT: %OneRewrite.specific_fn.loc11_3.1: <specific function> = specific_function %OneRewrite.ref, @OneRewrite(constants.%H) [symbolic = %OneRewrite.specific_fn.loc11_3.2 (constants.%OneRewrite.specific_fn.381461.1)]
  559. // CHECK:STDOUT: %OneRewrite.call: init %empty_tuple.type = call %OneRewrite.specific_fn.loc11_3.1()
  560. // CHECK:STDOUT: return
  561. // CHECK:STDOUT: }
  562. // CHECK:STDOUT: }
  563. // CHECK:STDOUT:
  564. // CHECK:STDOUT: generic fn @OneRewriteAgain(%I.loc14_20.1: %E_where.type) {
  565. // CHECK:STDOUT: %I.loc14_20.2: %E_where.type = bind_symbolic_name I, 0 [symbolic = %I.loc14_20.2 (constants.%I)]
  566. // CHECK:STDOUT: %I.patt.loc14_20.2: %E_where.type = symbolic_binding_pattern I, 0 [symbolic = %I.patt.loc14_20.2 (constants.%I.patt)]
  567. // CHECK:STDOUT:
  568. // CHECK:STDOUT: !definition:
  569. // CHECK:STDOUT: %RepeatedRewrite.specific_fn.loc15_3.2: <specific function> = specific_function constants.%RepeatedRewrite, @RepeatedRewrite(%I.loc14_20.2) [symbolic = %RepeatedRewrite.specific_fn.loc15_3.2 (constants.%RepeatedRewrite.specific_fn)]
  570. // CHECK:STDOUT:
  571. // CHECK:STDOUT: fn(%I.param_patt: %E_where.type) {
  572. // CHECK:STDOUT: !entry:
  573. // CHECK:STDOUT: %RepeatedRewrite.ref: %RepeatedRewrite.type = name_ref RepeatedRewrite, file.%RepeatedRewrite.decl [template = constants.%RepeatedRewrite]
  574. // CHECK:STDOUT: %I.ref: %E_where.type = name_ref I, %I.loc14_20.1 [symbolic = %I.loc14_20.2 (constants.%I)]
  575. // CHECK:STDOUT: %RepeatedRewrite.specific_fn.loc15_3.1: <specific function> = specific_function %RepeatedRewrite.ref, @RepeatedRewrite(constants.%I) [symbolic = %RepeatedRewrite.specific_fn.loc15_3.2 (constants.%RepeatedRewrite.specific_fn)]
  576. // CHECK:STDOUT: %RepeatedRewrite.call: init %empty_tuple.type = call %RepeatedRewrite.specific_fn.loc15_3.1()
  577. // CHECK:STDOUT: return
  578. // CHECK:STDOUT: }
  579. // CHECK:STDOUT: }
  580. // CHECK:STDOUT:
  581. // CHECK:STDOUT: specific @F(constants.%Self) {}
  582. // CHECK:STDOUT:
  583. // CHECK:STDOUT: specific @F(constants.%E.facet) {}
  584. // CHECK:STDOUT:
  585. // CHECK:STDOUT: specific @OneRewrite(constants.%G) {
  586. // CHECK:STDOUT: %G.loc8_15.2 => constants.%G
  587. // CHECK:STDOUT: %G.patt.loc8_15.2 => constants.%G
  588. // CHECK:STDOUT: }
  589. // CHECK:STDOUT:
  590. // CHECK:STDOUT: specific @RepeatedRewrite(constants.%H) {
  591. // CHECK:STDOUT: %H.loc10_20.2 => constants.%H
  592. // CHECK:STDOUT: %H.patt.loc10_20.2 => constants.%H
  593. // CHECK:STDOUT: }
  594. // CHECK:STDOUT:
  595. // CHECK:STDOUT: specific @OneRewrite(constants.%H) {
  596. // CHECK:STDOUT: %G.loc8_15.2 => constants.%H
  597. // CHECK:STDOUT: %G.patt.loc8_15.2 => constants.%H
  598. // CHECK:STDOUT:
  599. // CHECK:STDOUT: !definition:
  600. // CHECK:STDOUT: }
  601. // CHECK:STDOUT:
  602. // CHECK:STDOUT: specific @OneRewrite(@RepeatedRewrite.%H.loc10_20.2) {}
  603. // CHECK:STDOUT:
  604. // CHECK:STDOUT: specific @OneRewriteAgain(constants.%I) {
  605. // CHECK:STDOUT: %I.loc14_20.2 => constants.%I
  606. // CHECK:STDOUT: %I.patt.loc14_20.2 => constants.%I
  607. // CHECK:STDOUT: }
  608. // CHECK:STDOUT:
  609. // CHECK:STDOUT: specific @RepeatedRewrite(constants.%I) {
  610. // CHECK:STDOUT: %H.loc10_20.2 => constants.%I
  611. // CHECK:STDOUT: %H.patt.loc10_20.2 => constants.%I
  612. // CHECK:STDOUT:
  613. // CHECK:STDOUT: !definition:
  614. // CHECK:STDOUT: %OneRewrite.specific_fn.loc11_3.2 => constants.%OneRewrite.specific_fn.381461.2
  615. // CHECK:STDOUT: }
  616. // CHECK:STDOUT:
  617. // CHECK:STDOUT: specific @RepeatedRewrite(@OneRewriteAgain.%I.loc14_20.2) {}
  618. // CHECK:STDOUT:
  619. // CHECK:STDOUT: specific @OneRewrite(constants.%I) {
  620. // CHECK:STDOUT: %G.loc8_15.2 => constants.%I
  621. // CHECK:STDOUT: %G.patt.loc8_15.2 => constants.%I
  622. // CHECK:STDOUT: }
  623. // CHECK:STDOUT:
  624. // CHECK:STDOUT: --- rewrites_reordered.carbon
  625. // CHECK:STDOUT:
  626. // CHECK:STDOUT: constants {
  627. // CHECK:STDOUT: %J.type: type = facet_type <@J> [template]
  628. // CHECK:STDOUT: %Self: %J.type = bind_symbolic_name Self, 0 [symbolic]
  629. // CHECK:STDOUT: %J.assoc_type: type = assoc_entity_type %J.type [template]
  630. // CHECK:STDOUT: %assoc0: %J.assoc_type = assoc_entity element0, @J.%K [template]
  631. // CHECK:STDOUT: %assoc1: %J.assoc_type = assoc_entity element1, @J.%L [template]
  632. // CHECK:STDOUT: %.Self: %J.type = bind_symbolic_name .Self [symbolic]
  633. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  634. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic]
  635. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self [symbolic]
  636. // CHECK:STDOUT: %J.facet: %J.type = facet_value %.Self.as_type, %.Self.as_wit [symbolic]
  637. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic]
  638. // CHECK:STDOUT: %impl.elem1: type = impl_witness_access %.Self.as_wit, element1 [symbolic]
  639. // CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template]
  640. // CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template]
  641. // CHECK:STDOUT: %J_where.type: type = facet_type <@J where %impl.elem1 = bool and %impl.elem0 = %empty_tuple.type> [template]
  642. // CHECK:STDOUT: %M: %J_where.type = bind_symbolic_name M, 0 [symbolic]
  643. // CHECK:STDOUT: %M.patt: %J_where.type = symbolic_binding_pattern M, 0 [symbolic]
  644. // CHECK:STDOUT: %Alphabetical.type: type = fn_type @Alphabetical [template]
  645. // CHECK:STDOUT: %Alphabetical: %Alphabetical.type = struct_value () [template]
  646. // CHECK:STDOUT: %N: %J_where.type = bind_symbolic_name N, 0 [symbolic]
  647. // CHECK:STDOUT: %N.patt: %J_where.type = symbolic_binding_pattern N, 0 [symbolic]
  648. // CHECK:STDOUT: %Reversed.type: type = fn_type @Reversed [template]
  649. // CHECK:STDOUT: %Reversed: %Reversed.type = struct_value () [template]
  650. // CHECK:STDOUT: %Alphabetical.specific_fn: <specific function> = specific_function %Alphabetical, @Alphabetical(%N) [symbolic]
  651. // CHECK:STDOUT: }
  652. // CHECK:STDOUT:
  653. // CHECK:STDOUT: imports {
  654. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  655. // CHECK:STDOUT: .Bool = %Core.Bool
  656. // CHECK:STDOUT: import Core//prelude
  657. // CHECK:STDOUT: import Core//prelude/...
  658. // CHECK:STDOUT: }
  659. // CHECK:STDOUT: }
  660. // CHECK:STDOUT:
  661. // CHECK:STDOUT: file {
  662. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  663. // CHECK:STDOUT: .Core = imports.%Core
  664. // CHECK:STDOUT: .J = %J.decl
  665. // CHECK:STDOUT: .Alphabetical = %Alphabetical.decl
  666. // CHECK:STDOUT: .Reversed = %Reversed.decl
  667. // CHECK:STDOUT: }
  668. // CHECK:STDOUT: %Core.import = import Core
  669. // CHECK:STDOUT: %J.decl: type = interface_decl @J [template = constants.%J.type] {} {}
  670. // CHECK:STDOUT: %Alphabetical.decl: %Alphabetical.type = fn_decl @Alphabetical [template = constants.%Alphabetical] {
  671. // CHECK:STDOUT: %M.patt.loc9_17.1: %J_where.type = symbolic_binding_pattern M, 0 [symbolic = %M.patt.loc9_17.2 (constants.%M.patt)]
  672. // CHECK:STDOUT: %M.param_patt: %J_where.type = value_param_pattern %M.patt.loc9_17.1, runtime_param<none> [symbolic = %M.patt.loc9_17.2 (constants.%M.patt)]
  673. // CHECK:STDOUT: } {
  674. // CHECK:STDOUT: %M.param: %J_where.type = value_param runtime_param<none>
  675. // CHECK:STDOUT: %.loc9_23.1: type = splice_block %.loc9_23.2 [template = constants.%J_where.type] {
  676. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%J.type]
  677. // CHECK:STDOUT: %.Self: %J.type = bind_symbolic_name .Self [symbolic = constants.%.Self]
  678. // CHECK:STDOUT: %.Self.ref.loc9_29: %J.type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  679. // CHECK:STDOUT: %K.ref: %J.assoc_type = name_ref K, @K.%assoc0 [template = constants.%assoc0]
  680. // CHECK:STDOUT: %.Self.as_type.loc9_29: type = facet_access_type %.Self.ref.loc9_29 [symbolic = constants.%.Self.as_type]
  681. // CHECK:STDOUT: %.loc9_29: type = converted %.Self.ref.loc9_29, %.Self.as_type.loc9_29 [symbolic = constants.%.Self.as_type]
  682. // CHECK:STDOUT: %.Self.as_wit.loc9_29: <witness> = facet_access_witness %.Self.ref.loc9_29 [symbolic = constants.%.Self.as_wit]
  683. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit.loc9_29, element0 [symbolic = constants.%impl.elem0]
  684. // CHECK:STDOUT: %.loc9_35.1: %empty_tuple.type = tuple_literal ()
  685. // CHECK:STDOUT: %.loc9_35.2: type = converted %.loc9_35.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type]
  686. // CHECK:STDOUT: %.Self.ref.loc9_41: %J.type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  687. // CHECK:STDOUT: %L.ref: %J.assoc_type = name_ref L, @L.%assoc1 [template = constants.%assoc1]
  688. // CHECK:STDOUT: %.Self.as_type.loc9_41: type = facet_access_type %.Self.ref.loc9_41 [symbolic = constants.%.Self.as_type]
  689. // CHECK:STDOUT: %.loc9_41: type = converted %.Self.ref.loc9_41, %.Self.as_type.loc9_41 [symbolic = constants.%.Self.as_type]
  690. // CHECK:STDOUT: %.Self.as_wit.loc9_41: <witness> = facet_access_witness %.Self.ref.loc9_41 [symbolic = constants.%.Self.as_wit]
  691. // CHECK:STDOUT: %impl.elem1: type = impl_witness_access %.Self.as_wit.loc9_41, element1 [symbolic = constants.%impl.elem1]
  692. // CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool]
  693. // CHECK:STDOUT: %.loc9_46.1: type = value_of_initializer %bool.make_type [template = bool]
  694. // CHECK:STDOUT: %.loc9_46.2: type = converted %bool.make_type, %.loc9_46.1 [template = bool]
  695. // CHECK:STDOUT: %.loc9_23.2: type = where_expr %.Self [template = constants.%J_where.type] {
  696. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc9_35.2
  697. // CHECK:STDOUT: requirement_rewrite %impl.elem1, %.loc9_46.2
  698. // CHECK:STDOUT: }
  699. // CHECK:STDOUT: }
  700. // CHECK:STDOUT: %M.loc9_17.1: %J_where.type = bind_symbolic_name M, 0, %M.param [symbolic = %M.loc9_17.2 (constants.%M)]
  701. // CHECK:STDOUT: }
  702. // CHECK:STDOUT: %Reversed.decl: %Reversed.type = fn_decl @Reversed [template = constants.%Reversed] {
  703. // CHECK:STDOUT: %N.patt.loc11_13.1: %J_where.type = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc11_13.2 (constants.%N.patt)]
  704. // CHECK:STDOUT: %N.param_patt: %J_where.type = value_param_pattern %N.patt.loc11_13.1, runtime_param<none> [symbolic = %N.patt.loc11_13.2 (constants.%N.patt)]
  705. // CHECK:STDOUT: } {
  706. // CHECK:STDOUT: %N.param: %J_where.type = value_param runtime_param<none>
  707. // CHECK:STDOUT: %.loc11_19.1: type = splice_block %.loc11_19.2 [template = constants.%J_where.type] {
  708. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%J.type]
  709. // CHECK:STDOUT: %.Self: %J.type = bind_symbolic_name .Self [symbolic = constants.%.Self]
  710. // CHECK:STDOUT: %.Self.ref.loc11_25: %J.type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  711. // CHECK:STDOUT: %L.ref: %J.assoc_type = name_ref L, @L.%assoc1 [template = constants.%assoc1]
  712. // CHECK:STDOUT: %.Self.as_type.loc11_25: type = facet_access_type %.Self.ref.loc11_25 [symbolic = constants.%.Self.as_type]
  713. // CHECK:STDOUT: %.loc11_25: type = converted %.Self.ref.loc11_25, %.Self.as_type.loc11_25 [symbolic = constants.%.Self.as_type]
  714. // CHECK:STDOUT: %.Self.as_wit.loc11_25: <witness> = facet_access_witness %.Self.ref.loc11_25 [symbolic = constants.%.Self.as_wit]
  715. // CHECK:STDOUT: %impl.elem1: type = impl_witness_access %.Self.as_wit.loc11_25, element1 [symbolic = constants.%impl.elem1]
  716. // CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool]
  717. // CHECK:STDOUT: %.loc11_30.1: type = value_of_initializer %bool.make_type [template = bool]
  718. // CHECK:STDOUT: %.loc11_30.2: type = converted %bool.make_type, %.loc11_30.1 [template = bool]
  719. // CHECK:STDOUT: %.Self.ref.loc11_39: %J.type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  720. // CHECK:STDOUT: %K.ref: %J.assoc_type = name_ref K, @K.%assoc0 [template = constants.%assoc0]
  721. // CHECK:STDOUT: %.Self.as_type.loc11_39: type = facet_access_type %.Self.ref.loc11_39 [symbolic = constants.%.Self.as_type]
  722. // CHECK:STDOUT: %.loc11_39: type = converted %.Self.ref.loc11_39, %.Self.as_type.loc11_39 [symbolic = constants.%.Self.as_type]
  723. // CHECK:STDOUT: %.Self.as_wit.loc11_39: <witness> = facet_access_witness %.Self.ref.loc11_39 [symbolic = constants.%.Self.as_wit]
  724. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit.loc11_39, element0 [symbolic = constants.%impl.elem0]
  725. // CHECK:STDOUT: %.loc11_45.1: %empty_tuple.type = tuple_literal ()
  726. // CHECK:STDOUT: %.loc11_45.2: type = converted %.loc11_45.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type]
  727. // CHECK:STDOUT: %.loc11_19.2: type = where_expr %.Self [template = constants.%J_where.type] {
  728. // CHECK:STDOUT: requirement_rewrite %impl.elem1, %.loc11_30.2
  729. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc11_45.2
  730. // CHECK:STDOUT: }
  731. // CHECK:STDOUT: }
  732. // CHECK:STDOUT: %N.loc11_13.1: %J_where.type = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc11_13.2 (constants.%N)]
  733. // CHECK:STDOUT: }
  734. // CHECK:STDOUT: }
  735. // CHECK:STDOUT:
  736. // CHECK:STDOUT: interface @J {
  737. // CHECK:STDOUT: %Self: %J.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  738. // CHECK:STDOUT: %K: type = assoc_const_decl @K [template] {
  739. // CHECK:STDOUT: %assoc0: %J.assoc_type = assoc_entity element0, @J.%K [template = constants.%assoc0]
  740. // CHECK:STDOUT: }
  741. // CHECK:STDOUT: %L: type = assoc_const_decl @L [template] {
  742. // CHECK:STDOUT: %assoc1: %J.assoc_type = assoc_entity element1, @J.%L [template = constants.%assoc1]
  743. // CHECK:STDOUT: }
  744. // CHECK:STDOUT:
  745. // CHECK:STDOUT: !members:
  746. // CHECK:STDOUT: .Self = %Self
  747. // CHECK:STDOUT: .K = @K.%assoc0
  748. // CHECK:STDOUT: .L = @L.%assoc1
  749. // CHECK:STDOUT: witness = (%K, %L)
  750. // CHECK:STDOUT: }
  751. // CHECK:STDOUT:
  752. // CHECK:STDOUT: generic assoc_const @K(@J.%Self: %J.type) {
  753. // CHECK:STDOUT: assoc_const K:! type;
  754. // CHECK:STDOUT: }
  755. // CHECK:STDOUT:
  756. // CHECK:STDOUT: generic assoc_const @L(@J.%Self: %J.type) {
  757. // CHECK:STDOUT: assoc_const L:! type;
  758. // CHECK:STDOUT: }
  759. // CHECK:STDOUT:
  760. // CHECK:STDOUT: generic fn @Alphabetical(%M.loc9_17.1: %J_where.type) {
  761. // CHECK:STDOUT: %M.loc9_17.2: %J_where.type = bind_symbolic_name M, 0 [symbolic = %M.loc9_17.2 (constants.%M)]
  762. // CHECK:STDOUT: %M.patt.loc9_17.2: %J_where.type = symbolic_binding_pattern M, 0 [symbolic = %M.patt.loc9_17.2 (constants.%M.patt)]
  763. // CHECK:STDOUT:
  764. // CHECK:STDOUT: !definition:
  765. // CHECK:STDOUT:
  766. // CHECK:STDOUT: fn(%M.param_patt: %J_where.type) {
  767. // CHECK:STDOUT: !entry:
  768. // CHECK:STDOUT: return
  769. // CHECK:STDOUT: }
  770. // CHECK:STDOUT: }
  771. // CHECK:STDOUT:
  772. // CHECK:STDOUT: generic fn @Reversed(%N.loc11_13.1: %J_where.type) {
  773. // CHECK:STDOUT: %N.loc11_13.2: %J_where.type = bind_symbolic_name N, 0 [symbolic = %N.loc11_13.2 (constants.%N)]
  774. // CHECK:STDOUT: %N.patt.loc11_13.2: %J_where.type = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc11_13.2 (constants.%N.patt)]
  775. // CHECK:STDOUT:
  776. // CHECK:STDOUT: !definition:
  777. // CHECK:STDOUT: %Alphabetical.specific_fn.loc12_3.2: <specific function> = specific_function constants.%Alphabetical, @Alphabetical(%N.loc11_13.2) [symbolic = %Alphabetical.specific_fn.loc12_3.2 (constants.%Alphabetical.specific_fn)]
  778. // CHECK:STDOUT:
  779. // CHECK:STDOUT: fn(%N.param_patt: %J_where.type) {
  780. // CHECK:STDOUT: !entry:
  781. // CHECK:STDOUT: %Alphabetical.ref: %Alphabetical.type = name_ref Alphabetical, file.%Alphabetical.decl [template = constants.%Alphabetical]
  782. // CHECK:STDOUT: %N.ref: %J_where.type = name_ref N, %N.loc11_13.1 [symbolic = %N.loc11_13.2 (constants.%N)]
  783. // CHECK:STDOUT: %Alphabetical.specific_fn.loc12_3.1: <specific function> = specific_function %Alphabetical.ref, @Alphabetical(constants.%N) [symbolic = %Alphabetical.specific_fn.loc12_3.2 (constants.%Alphabetical.specific_fn)]
  784. // CHECK:STDOUT: %Alphabetical.call: init %empty_tuple.type = call %Alphabetical.specific_fn.loc12_3.1()
  785. // CHECK:STDOUT: return
  786. // CHECK:STDOUT: }
  787. // CHECK:STDOUT: }
  788. // CHECK:STDOUT:
  789. // CHECK:STDOUT: specific @K(constants.%Self) {}
  790. // CHECK:STDOUT:
  791. // CHECK:STDOUT: specific @L(constants.%Self) {}
  792. // CHECK:STDOUT:
  793. // CHECK:STDOUT: specific @K(constants.%J.facet) {}
  794. // CHECK:STDOUT:
  795. // CHECK:STDOUT: specific @L(constants.%J.facet) {}
  796. // CHECK:STDOUT:
  797. // CHECK:STDOUT: specific @Alphabetical(constants.%M) {
  798. // CHECK:STDOUT: %M.loc9_17.2 => constants.%M
  799. // CHECK:STDOUT: %M.patt.loc9_17.2 => constants.%M
  800. // CHECK:STDOUT: }
  801. // CHECK:STDOUT:
  802. // CHECK:STDOUT: specific @Reversed(constants.%N) {
  803. // CHECK:STDOUT: %N.loc11_13.2 => constants.%N
  804. // CHECK:STDOUT: %N.patt.loc11_13.2 => constants.%N
  805. // CHECK:STDOUT: }
  806. // CHECK:STDOUT:
  807. // CHECK:STDOUT: specific @Alphabetical(constants.%N) {
  808. // CHECK:STDOUT: %M.loc9_17.2 => constants.%N
  809. // CHECK:STDOUT: %M.patt.loc9_17.2 => constants.%N
  810. // CHECK:STDOUT:
  811. // CHECK:STDOUT: !definition:
  812. // CHECK:STDOUT: }
  813. // CHECK:STDOUT:
  814. // CHECK:STDOUT: specific @Alphabetical(@Reversed.%N.loc11_13.2) {}
  815. // CHECK:STDOUT:
  816. // CHECK:STDOUT: --- fail_rewrites_mismatch_right.carbon
  817. // CHECK:STDOUT:
  818. // CHECK:STDOUT: constants {
  819. // CHECK:STDOUT: %O.type: type = facet_type <@O> [template]
  820. // CHECK:STDOUT: %Self.040: %O.type = bind_symbolic_name Self, 0 [symbolic]
  821. // CHECK:STDOUT: %O.assoc_type: type = assoc_entity_type %O.type [template]
  822. // CHECK:STDOUT: %assoc0.0e4: %O.assoc_type = assoc_entity element0, @O.%P [template]
  823. // CHECK:STDOUT: %.Self: %O.type = bind_symbolic_name .Self [symbolic]
  824. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic]
  825. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self [symbolic]
  826. // CHECK:STDOUT: %O.facet: %O.type = facet_value %.Self.as_type, %.Self.as_wit [symbolic]
  827. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic]
  828. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
  829. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
  830. // CHECK:STDOUT: %O_where.type.9eb: type = facet_type <@O where %impl.elem0 = %i32> [template]
  831. // CHECK:STDOUT: %Q: %O_where.type.9eb = bind_symbolic_name Q, 0 [symbolic]
  832. // CHECK:STDOUT: %Q.patt: %O_where.type.9eb = symbolic_binding_pattern Q, 0 [symbolic]
  833. // CHECK:STDOUT: %WithInteger.type: type = fn_type @WithInteger [template]
  834. // CHECK:STDOUT: %WithInteger: %WithInteger.type = struct_value () [template]
  835. // CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template]
  836. // CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template]
  837. // CHECK:STDOUT: %O_where.type.0f2: type = facet_type <@O where %impl.elem0 = bool> [template]
  838. // CHECK:STDOUT: %R: %O_where.type.0f2 = bind_symbolic_name R, 0 [symbolic]
  839. // CHECK:STDOUT: %R.patt: %O_where.type.0f2 = symbolic_binding_pattern R, 0 [symbolic]
  840. // CHECK:STDOUT: %WithBool.type: type = fn_type @WithBool [template]
  841. // CHECK:STDOUT: %WithBool: %WithBool.type = struct_value () [template]
  842. // CHECK:STDOUT: }
  843. // CHECK:STDOUT:
  844. // CHECK:STDOUT: imports {
  845. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  846. // CHECK:STDOUT: .Int = %Core.Int
  847. // CHECK:STDOUT: .Bool = %Core.Bool
  848. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  849. // CHECK:STDOUT: import Core//prelude
  850. // CHECK:STDOUT: import Core//prelude/...
  851. // CHECK:STDOUT: }
  852. // CHECK:STDOUT: }
  853. // CHECK:STDOUT:
  854. // CHECK:STDOUT: file {
  855. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  856. // CHECK:STDOUT: .Core = imports.%Core
  857. // CHECK:STDOUT: .O = %O.decl
  858. // CHECK:STDOUT: .WithInteger = %WithInteger.decl
  859. // CHECK:STDOUT: .WithBool = %WithBool.decl
  860. // CHECK:STDOUT: }
  861. // CHECK:STDOUT: %Core.import = import Core
  862. // CHECK:STDOUT: %O.decl: type = interface_decl @O [template = constants.%O.type] {} {}
  863. // CHECK:STDOUT: %WithInteger.decl: %WithInteger.type = fn_decl @WithInteger [template = constants.%WithInteger] {
  864. // CHECK:STDOUT: %Q.patt.loc8_16.1: %O_where.type.9eb = symbolic_binding_pattern Q, 0 [symbolic = %Q.patt.loc8_16.2 (constants.%Q.patt)]
  865. // CHECK:STDOUT: %Q.param_patt: %O_where.type.9eb = value_param_pattern %Q.patt.loc8_16.1, runtime_param<none> [symbolic = %Q.patt.loc8_16.2 (constants.%Q.patt)]
  866. // CHECK:STDOUT: } {
  867. // CHECK:STDOUT: %Q.param: %O_where.type.9eb = value_param runtime_param<none>
  868. // CHECK:STDOUT: %.loc8_22.1: type = splice_block %.loc8_22.2 [template = constants.%O_where.type.9eb] {
  869. // CHECK:STDOUT: %O.ref: type = name_ref O, file.%O.decl [template = constants.%O.type]
  870. // CHECK:STDOUT: %.Self: %O.type = bind_symbolic_name .Self [symbolic = constants.%.Self]
  871. // CHECK:STDOUT: %.Self.ref: %O.type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  872. // CHECK:STDOUT: %P.ref: %O.assoc_type = name_ref P, @P.%assoc0 [template = constants.%assoc0.0e4]
  873. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic = constants.%.Self.as_type]
  874. // CHECK:STDOUT: %.loc8_28: type = converted %.Self.ref, %.Self.as_type [symbolic = constants.%.Self.as_type]
  875. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.ref [symbolic = constants.%.Self.as_wit]
  876. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic = constants.%impl.elem0]
  877. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  878. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  879. // CHECK:STDOUT: %.loc8_22.2: type = where_expr %.Self [template = constants.%O_where.type.9eb] {
  880. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %i32
  881. // CHECK:STDOUT: }
  882. // CHECK:STDOUT: }
  883. // CHECK:STDOUT: %Q.loc8_16.1: %O_where.type.9eb = bind_symbolic_name Q, 0, %Q.param [symbolic = %Q.loc8_16.2 (constants.%Q)]
  884. // CHECK:STDOUT: }
  885. // CHECK:STDOUT: %WithBool.decl: %WithBool.type = fn_decl @WithBool [template = constants.%WithBool] {
  886. // CHECK:STDOUT: %R.patt.loc10_13.1: %O_where.type.0f2 = symbolic_binding_pattern R, 0 [symbolic = %R.patt.loc10_13.2 (constants.%R.patt)]
  887. // CHECK:STDOUT: %R.param_patt: %O_where.type.0f2 = value_param_pattern %R.patt.loc10_13.1, runtime_param<none> [symbolic = %R.patt.loc10_13.2 (constants.%R.patt)]
  888. // CHECK:STDOUT: } {
  889. // CHECK:STDOUT: %R.param: %O_where.type.0f2 = value_param runtime_param<none>
  890. // CHECK:STDOUT: %.loc10_19.1: type = splice_block %.loc10_19.2 [template = constants.%O_where.type.0f2] {
  891. // CHECK:STDOUT: %O.ref: type = name_ref O, file.%O.decl [template = constants.%O.type]
  892. // CHECK:STDOUT: %.Self: %O.type = bind_symbolic_name .Self [symbolic = constants.%.Self]
  893. // CHECK:STDOUT: %.Self.ref: %O.type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  894. // CHECK:STDOUT: %P.ref: %O.assoc_type = name_ref P, @P.%assoc0 [template = constants.%assoc0.0e4]
  895. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic = constants.%.Self.as_type]
  896. // CHECK:STDOUT: %.loc10_25: type = converted %.Self.ref, %.Self.as_type [symbolic = constants.%.Self.as_type]
  897. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.ref [symbolic = constants.%.Self.as_wit]
  898. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic = constants.%impl.elem0]
  899. // CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool]
  900. // CHECK:STDOUT: %.loc10_30.1: type = value_of_initializer %bool.make_type [template = bool]
  901. // CHECK:STDOUT: %.loc10_30.2: type = converted %bool.make_type, %.loc10_30.1 [template = bool]
  902. // CHECK:STDOUT: %.loc10_19.2: type = where_expr %.Self [template = constants.%O_where.type.0f2] {
  903. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc10_30.2
  904. // CHECK:STDOUT: }
  905. // CHECK:STDOUT: }
  906. // CHECK:STDOUT: %R.loc10_13.1: %O_where.type.0f2 = bind_symbolic_name R, 0, %R.param [symbolic = %R.loc10_13.2 (constants.%R)]
  907. // CHECK:STDOUT: }
  908. // CHECK:STDOUT: }
  909. // CHECK:STDOUT:
  910. // CHECK:STDOUT: interface @O {
  911. // CHECK:STDOUT: %Self: %O.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.040]
  912. // CHECK:STDOUT: %P: type = assoc_const_decl @P [template] {
  913. // CHECK:STDOUT: %assoc0: %O.assoc_type = assoc_entity element0, @O.%P [template = constants.%assoc0.0e4]
  914. // CHECK:STDOUT: }
  915. // CHECK:STDOUT:
  916. // CHECK:STDOUT: !members:
  917. // CHECK:STDOUT: .Self = %Self
  918. // CHECK:STDOUT: .P = @P.%assoc0
  919. // CHECK:STDOUT: witness = (%P)
  920. // CHECK:STDOUT: }
  921. // CHECK:STDOUT:
  922. // CHECK:STDOUT: generic assoc_const @P(@O.%Self: %O.type) {
  923. // CHECK:STDOUT: assoc_const P:! type;
  924. // CHECK:STDOUT: }
  925. // CHECK:STDOUT:
  926. // CHECK:STDOUT: generic fn @WithInteger(%Q.loc8_16.1: %O_where.type.9eb) {
  927. // CHECK:STDOUT: %Q.loc8_16.2: %O_where.type.9eb = bind_symbolic_name Q, 0 [symbolic = %Q.loc8_16.2 (constants.%Q)]
  928. // CHECK:STDOUT: %Q.patt.loc8_16.2: %O_where.type.9eb = symbolic_binding_pattern Q, 0 [symbolic = %Q.patt.loc8_16.2 (constants.%Q.patt)]
  929. // CHECK:STDOUT:
  930. // CHECK:STDOUT: !definition:
  931. // CHECK:STDOUT:
  932. // CHECK:STDOUT: fn(%Q.param_patt: %O_where.type.9eb) {
  933. // CHECK:STDOUT: !entry:
  934. // CHECK:STDOUT: return
  935. // CHECK:STDOUT: }
  936. // CHECK:STDOUT: }
  937. // CHECK:STDOUT:
  938. // CHECK:STDOUT: generic fn @WithBool(%R.loc10_13.1: %O_where.type.0f2) {
  939. // CHECK:STDOUT: %R.loc10_13.2: %O_where.type.0f2 = bind_symbolic_name R, 0 [symbolic = %R.loc10_13.2 (constants.%R)]
  940. // CHECK:STDOUT: %R.patt.loc10_13.2: %O_where.type.0f2 = symbolic_binding_pattern R, 0 [symbolic = %R.patt.loc10_13.2 (constants.%R.patt)]
  941. // CHECK:STDOUT:
  942. // CHECK:STDOUT: !definition:
  943. // CHECK:STDOUT:
  944. // CHECK:STDOUT: fn(%R.param_patt: %O_where.type.0f2) {
  945. // CHECK:STDOUT: !entry:
  946. // CHECK:STDOUT: %WithInteger.ref: %WithInteger.type = name_ref WithInteger, file.%WithInteger.decl [template = constants.%WithInteger]
  947. // CHECK:STDOUT: %R.ref: %O_where.type.0f2 = name_ref R, %R.loc10_13.1 [symbolic = %R.loc10_13.2 (constants.%R)]
  948. // CHECK:STDOUT: %.loc21: %O_where.type.9eb = converted %R.ref, <error> [template = <error>]
  949. // CHECK:STDOUT: return
  950. // CHECK:STDOUT: }
  951. // CHECK:STDOUT: }
  952. // CHECK:STDOUT:
  953. // CHECK:STDOUT: specific @P(constants.%Self.040) {}
  954. // CHECK:STDOUT:
  955. // CHECK:STDOUT: specific @P(constants.%O.facet) {}
  956. // CHECK:STDOUT:
  957. // CHECK:STDOUT: specific @WithInteger(constants.%Q) {
  958. // CHECK:STDOUT: %Q.loc8_16.2 => constants.%Q
  959. // CHECK:STDOUT: %Q.patt.loc8_16.2 => constants.%Q
  960. // CHECK:STDOUT: }
  961. // CHECK:STDOUT:
  962. // CHECK:STDOUT: specific @WithBool(constants.%R) {
  963. // CHECK:STDOUT: %R.loc10_13.2 => constants.%R
  964. // CHECK:STDOUT: %R.patt.loc10_13.2 => constants.%R
  965. // CHECK:STDOUT: }
  966. // CHECK:STDOUT:
  967. // CHECK:STDOUT: --- fail_rewrites_mismatch_left.carbon
  968. // CHECK:STDOUT:
  969. // CHECK:STDOUT: constants {
  970. // CHECK:STDOUT: %S.type: type = facet_type <@S> [template]
  971. // CHECK:STDOUT: %Self.b33: %S.type = bind_symbolic_name Self, 0 [symbolic]
  972. // CHECK:STDOUT: %S.assoc_type: type = assoc_entity_type %S.type [template]
  973. // CHECK:STDOUT: %assoc0.720: %S.assoc_type = assoc_entity element0, @S.%T [template]
  974. // CHECK:STDOUT: %assoc1: %S.assoc_type = assoc_entity element1, @S.%U [template]
  975. // CHECK:STDOUT: %.Self: %S.type = bind_symbolic_name .Self [symbolic]
  976. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  977. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic]
  978. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self [symbolic]
  979. // CHECK:STDOUT: %S.facet: %S.type = facet_value %.Self.as_type, %.Self.as_wit [symbolic]
  980. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic]
  981. // CHECK:STDOUT: %S_where.type.e40: type = facet_type <@S where %impl.elem0 = %empty_tuple.type> [template]
  982. // CHECK:STDOUT: %V: %S_where.type.e40 = bind_symbolic_name V, 0 [symbolic]
  983. // CHECK:STDOUT: %V.patt: %S_where.type.e40 = symbolic_binding_pattern V, 0 [symbolic]
  984. // CHECK:STDOUT: %WithT.type: type = fn_type @WithT [template]
  985. // CHECK:STDOUT: %WithT: %WithT.type = struct_value () [template]
  986. // CHECK:STDOUT: %impl.elem1: type = impl_witness_access %.Self.as_wit, element1 [symbolic]
  987. // CHECK:STDOUT: %S_where.type.357: type = facet_type <@S where %impl.elem1 = %empty_tuple.type> [template]
  988. // CHECK:STDOUT: %W: %S_where.type.357 = bind_symbolic_name W, 0 [symbolic]
  989. // CHECK:STDOUT: %W.patt: %S_where.type.357 = symbolic_binding_pattern W, 0 [symbolic]
  990. // CHECK:STDOUT: %WithU.type: type = fn_type @WithU [template]
  991. // CHECK:STDOUT: %WithU: %WithU.type = struct_value () [template]
  992. // CHECK:STDOUT: }
  993. // CHECK:STDOUT:
  994. // CHECK:STDOUT: imports {
  995. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  996. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  997. // CHECK:STDOUT: import Core//prelude
  998. // CHECK:STDOUT: import Core//prelude/...
  999. // CHECK:STDOUT: }
  1000. // CHECK:STDOUT: }
  1001. // CHECK:STDOUT:
  1002. // CHECK:STDOUT: file {
  1003. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1004. // CHECK:STDOUT: .Core = imports.%Core
  1005. // CHECK:STDOUT: .S = %S.decl
  1006. // CHECK:STDOUT: .WithT = %WithT.decl
  1007. // CHECK:STDOUT: .WithU = %WithU.decl
  1008. // CHECK:STDOUT: }
  1009. // CHECK:STDOUT: %Core.import = import Core
  1010. // CHECK:STDOUT: %S.decl: type = interface_decl @S [template = constants.%S.type] {} {}
  1011. // CHECK:STDOUT: %WithT.decl: %WithT.type = fn_decl @WithT [template = constants.%WithT] {
  1012. // CHECK:STDOUT: %V.patt.loc9_10.1: %S_where.type.e40 = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc9_10.2 (constants.%V.patt)]
  1013. // CHECK:STDOUT: %V.param_patt: %S_where.type.e40 = value_param_pattern %V.patt.loc9_10.1, runtime_param<none> [symbolic = %V.patt.loc9_10.2 (constants.%V.patt)]
  1014. // CHECK:STDOUT: } {
  1015. // CHECK:STDOUT: %V.param: %S_where.type.e40 = value_param runtime_param<none>
  1016. // CHECK:STDOUT: %.loc9_16.1: type = splice_block %.loc9_16.2 [template = constants.%S_where.type.e40] {
  1017. // CHECK:STDOUT: %S.ref: type = name_ref S, file.%S.decl [template = constants.%S.type]
  1018. // CHECK:STDOUT: %.Self: %S.type = bind_symbolic_name .Self [symbolic = constants.%.Self]
  1019. // CHECK:STDOUT: %.Self.ref: %S.type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  1020. // CHECK:STDOUT: %T.ref: %S.assoc_type = name_ref T, @T.%assoc0 [template = constants.%assoc0.720]
  1021. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic = constants.%.Self.as_type]
  1022. // CHECK:STDOUT: %.loc9_22: type = converted %.Self.ref, %.Self.as_type [symbolic = constants.%.Self.as_type]
  1023. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.ref [symbolic = constants.%.Self.as_wit]
  1024. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic = constants.%impl.elem0]
  1025. // CHECK:STDOUT: %.loc9_28.1: %empty_tuple.type = tuple_literal ()
  1026. // CHECK:STDOUT: %.loc9_28.2: type = converted %.loc9_28.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type]
  1027. // CHECK:STDOUT: %.loc9_16.2: type = where_expr %.Self [template = constants.%S_where.type.e40] {
  1028. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc9_28.2
  1029. // CHECK:STDOUT: }
  1030. // CHECK:STDOUT: }
  1031. // CHECK:STDOUT: %V.loc9_10.1: %S_where.type.e40 = bind_symbolic_name V, 0, %V.param [symbolic = %V.loc9_10.2 (constants.%V)]
  1032. // CHECK:STDOUT: }
  1033. // CHECK:STDOUT: %WithU.decl: %WithU.type = fn_decl @WithU [template = constants.%WithU] {
  1034. // CHECK:STDOUT: %W.patt.loc11_10.1: %S_where.type.357 = symbolic_binding_pattern W, 0 [symbolic = %W.patt.loc11_10.2 (constants.%W.patt)]
  1035. // CHECK:STDOUT: %W.param_patt: %S_where.type.357 = value_param_pattern %W.patt.loc11_10.1, runtime_param<none> [symbolic = %W.patt.loc11_10.2 (constants.%W.patt)]
  1036. // CHECK:STDOUT: } {
  1037. // CHECK:STDOUT: %W.param: %S_where.type.357 = value_param runtime_param<none>
  1038. // CHECK:STDOUT: %.loc11_16.1: type = splice_block %.loc11_16.2 [template = constants.%S_where.type.357] {
  1039. // CHECK:STDOUT: %S.ref: type = name_ref S, file.%S.decl [template = constants.%S.type]
  1040. // CHECK:STDOUT: %.Self: %S.type = bind_symbolic_name .Self [symbolic = constants.%.Self]
  1041. // CHECK:STDOUT: %.Self.ref: %S.type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  1042. // CHECK:STDOUT: %U.ref: %S.assoc_type = name_ref U, @U.%assoc1 [template = constants.%assoc1]
  1043. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic = constants.%.Self.as_type]
  1044. // CHECK:STDOUT: %.loc11_22: type = converted %.Self.ref, %.Self.as_type [symbolic = constants.%.Self.as_type]
  1045. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.ref [symbolic = constants.%.Self.as_wit]
  1046. // CHECK:STDOUT: %impl.elem1: type = impl_witness_access %.Self.as_wit, element1 [symbolic = constants.%impl.elem1]
  1047. // CHECK:STDOUT: %.loc11_28.1: %empty_tuple.type = tuple_literal ()
  1048. // CHECK:STDOUT: %.loc11_28.2: type = converted %.loc11_28.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type]
  1049. // CHECK:STDOUT: %.loc11_16.2: type = where_expr %.Self [template = constants.%S_where.type.357] {
  1050. // CHECK:STDOUT: requirement_rewrite %impl.elem1, %.loc11_28.2
  1051. // CHECK:STDOUT: }
  1052. // CHECK:STDOUT: }
  1053. // CHECK:STDOUT: %W.loc11_10.1: %S_where.type.357 = bind_symbolic_name W, 0, %W.param [symbolic = %W.loc11_10.2 (constants.%W)]
  1054. // CHECK:STDOUT: }
  1055. // CHECK:STDOUT: }
  1056. // CHECK:STDOUT:
  1057. // CHECK:STDOUT: interface @S {
  1058. // CHECK:STDOUT: %Self: %S.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.b33]
  1059. // CHECK:STDOUT: %T: type = assoc_const_decl @T [template] {
  1060. // CHECK:STDOUT: %assoc0: %S.assoc_type = assoc_entity element0, @S.%T [template = constants.%assoc0.720]
  1061. // CHECK:STDOUT: }
  1062. // CHECK:STDOUT: %U: type = assoc_const_decl @U [template] {
  1063. // CHECK:STDOUT: %assoc1: %S.assoc_type = assoc_entity element1, @S.%U [template = constants.%assoc1]
  1064. // CHECK:STDOUT: }
  1065. // CHECK:STDOUT:
  1066. // CHECK:STDOUT: !members:
  1067. // CHECK:STDOUT: .Self = %Self
  1068. // CHECK:STDOUT: .T = @T.%assoc0
  1069. // CHECK:STDOUT: .U = @U.%assoc1
  1070. // CHECK:STDOUT: witness = (%T, %U)
  1071. // CHECK:STDOUT: }
  1072. // CHECK:STDOUT:
  1073. // CHECK:STDOUT: generic assoc_const @T(@S.%Self: %S.type) {
  1074. // CHECK:STDOUT: assoc_const T:! type;
  1075. // CHECK:STDOUT: }
  1076. // CHECK:STDOUT:
  1077. // CHECK:STDOUT: generic assoc_const @U(@S.%Self: %S.type) {
  1078. // CHECK:STDOUT: assoc_const U:! type;
  1079. // CHECK:STDOUT: }
  1080. // CHECK:STDOUT:
  1081. // CHECK:STDOUT: generic fn @WithT(%V.loc9_10.1: %S_where.type.e40) {
  1082. // CHECK:STDOUT: %V.loc9_10.2: %S_where.type.e40 = bind_symbolic_name V, 0 [symbolic = %V.loc9_10.2 (constants.%V)]
  1083. // CHECK:STDOUT: %V.patt.loc9_10.2: %S_where.type.e40 = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc9_10.2 (constants.%V.patt)]
  1084. // CHECK:STDOUT:
  1085. // CHECK:STDOUT: !definition:
  1086. // CHECK:STDOUT:
  1087. // CHECK:STDOUT: fn(%V.param_patt: %S_where.type.e40) {
  1088. // CHECK:STDOUT: !entry:
  1089. // CHECK:STDOUT: return
  1090. // CHECK:STDOUT: }
  1091. // CHECK:STDOUT: }
  1092. // CHECK:STDOUT:
  1093. // CHECK:STDOUT: generic fn @WithU(%W.loc11_10.1: %S_where.type.357) {
  1094. // CHECK:STDOUT: %W.loc11_10.2: %S_where.type.357 = bind_symbolic_name W, 0 [symbolic = %W.loc11_10.2 (constants.%W)]
  1095. // CHECK:STDOUT: %W.patt.loc11_10.2: %S_where.type.357 = symbolic_binding_pattern W, 0 [symbolic = %W.patt.loc11_10.2 (constants.%W.patt)]
  1096. // CHECK:STDOUT:
  1097. // CHECK:STDOUT: !definition:
  1098. // CHECK:STDOUT:
  1099. // CHECK:STDOUT: fn(%W.param_patt: %S_where.type.357) {
  1100. // CHECK:STDOUT: !entry:
  1101. // CHECK:STDOUT: %WithT.ref: %WithT.type = name_ref WithT, file.%WithT.decl [template = constants.%WithT]
  1102. // CHECK:STDOUT: %W.ref: %S_where.type.357 = name_ref W, %W.loc11_10.1 [symbolic = %W.loc11_10.2 (constants.%W)]
  1103. // CHECK:STDOUT: %.loc22: %S_where.type.e40 = converted %W.ref, <error> [template = <error>]
  1104. // CHECK:STDOUT: return
  1105. // CHECK:STDOUT: }
  1106. // CHECK:STDOUT: }
  1107. // CHECK:STDOUT:
  1108. // CHECK:STDOUT: specific @T(constants.%Self.b33) {}
  1109. // CHECK:STDOUT:
  1110. // CHECK:STDOUT: specific @U(constants.%Self.b33) {}
  1111. // CHECK:STDOUT:
  1112. // CHECK:STDOUT: specific @T(constants.%S.facet) {}
  1113. // CHECK:STDOUT:
  1114. // CHECK:STDOUT: specific @WithT(constants.%V) {
  1115. // CHECK:STDOUT: %V.loc9_10.2 => constants.%V
  1116. // CHECK:STDOUT: %V.patt.loc9_10.2 => constants.%V
  1117. // CHECK:STDOUT: }
  1118. // CHECK:STDOUT:
  1119. // CHECK:STDOUT: specific @U(constants.%S.facet) {}
  1120. // CHECK:STDOUT:
  1121. // CHECK:STDOUT: specific @WithU(constants.%W) {
  1122. // CHECK:STDOUT: %W.loc11_10.2 => constants.%W
  1123. // CHECK:STDOUT: %W.patt.loc11_10.2 => constants.%W
  1124. // CHECK:STDOUT: }
  1125. // CHECK:STDOUT:
  1126. // CHECK:STDOUT: --- fail_import_rewrites.carbon
  1127. // CHECK:STDOUT:
  1128. // CHECK:STDOUT: constants {
  1129. // CHECK:STDOUT: %Calls.type: type = fn_type @Calls [template]
  1130. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  1131. // CHECK:STDOUT: %Calls: %Calls.type = struct_value () [template]
  1132. // CHECK:STDOUT: %Equal.type: type = fn_type @Equal [template]
  1133. // CHECK:STDOUT: %Equal: %Equal.type = struct_value () [template]
  1134. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  1135. // CHECK:STDOUT: %N.type: type = facet_type <@N> [template]
  1136. // CHECK:STDOUT: %.Self.9aa: %N.type = bind_symbolic_name .Self [symbolic]
  1137. // CHECK:STDOUT: %.Self.as_wit.cef: <witness> = facet_access_witness %.Self.9aa [symbolic]
  1138. // CHECK:STDOUT: %impl.elem0.51b: type = impl_witness_access %.Self.as_wit.cef, element0 [symbolic]
  1139. // CHECK:STDOUT: %N_where.type: type = facet_type <@N where %impl.elem0.51b = %empty_struct_type> [template]
  1140. // CHECK:STDOUT: %T.patt: %N_where.type = symbolic_binding_pattern T, 0 [symbolic]
  1141. // CHECK:STDOUT: %T: %N_where.type = bind_symbolic_name T, 0 [symbolic]
  1142. // CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template]
  1143. // CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template]
  1144. // CHECK:STDOUT: %NestedRewrite.type: type = fn_type @NestedRewrite [template]
  1145. // CHECK:STDOUT: %NestedRewrite: %NestedRewrite.type = struct_value () [template]
  1146. // CHECK:STDOUT: %A.type: type = facet_type <@A> [template]
  1147. // CHECK:STDOUT: %.Self.3ca: %A.type = bind_symbolic_name .Self [symbolic]
  1148. // CHECK:STDOUT: %.Self.as_wit.794: <witness> = facet_access_witness %.Self.3ca [symbolic]
  1149. // CHECK:STDOUT: %impl.elem0.1d3: type = impl_witness_access %.Self.as_wit.794, element0 [symbolic]
  1150. // CHECK:STDOUT: %A_where.type.ef9: type = facet_type <@A where %impl.elem0.1d3 = bool> [template]
  1151. // CHECK:STDOUT: %.Self.e46: %A_where.type.ef9 = bind_symbolic_name .Self [symbolic]
  1152. // CHECK:STDOUT: %.Self.as_wit.a35: <witness> = facet_access_witness %.Self.e46 [symbolic]
  1153. // CHECK:STDOUT: %impl.elem1: type = impl_witness_access %.Self.as_wit.a35, element1 [symbolic]
  1154. // CHECK:STDOUT: %A_where.type.791: type = facet_type <@A where %impl.elem1 = %empty_tuple.type and %impl.elem0.1d3 = bool> [template]
  1155. // CHECK:STDOUT: %D.patt: %A_where.type.791 = symbolic_binding_pattern D, 0 [symbolic]
  1156. // CHECK:STDOUT: %D: %A_where.type.791 = bind_symbolic_name D, 0 [symbolic]
  1157. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
  1158. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
  1159. // CHECK:STDOUT: }
  1160. // CHECK:STDOUT:
  1161. // CHECK:STDOUT: imports {
  1162. // CHECK:STDOUT: %Main.N = import_ref Main//equal_constraint, N, unloaded
  1163. // CHECK:STDOUT: %Main.Equal: %Equal.type = import_ref Main//equal_constraint, Equal, loaded [template = constants.%Equal]
  1164. // CHECK:STDOUT: %Main.A = import_ref Main//nested_rewrites, A, unloaded
  1165. // CHECK:STDOUT: %Main.NestedRewrite: %NestedRewrite.type = import_ref Main//nested_rewrites, NestedRewrite, loaded [template = constants.%NestedRewrite]
  1166. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  1167. // CHECK:STDOUT: .Bool = %Core.Bool
  1168. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  1169. // CHECK:STDOUT: .Int = %Core.Int
  1170. // CHECK:STDOUT: import Core//prelude
  1171. // CHECK:STDOUT: import Core//prelude/...
  1172. // CHECK:STDOUT: }
  1173. // CHECK:STDOUT: %Main.import_ref.169 = import_ref Main//equal_constraint, inst17 [no loc], unloaded
  1174. // CHECK:STDOUT: %Main.import_ref.020 = import_ref Main//equal_constraint, loc5_8, unloaded
  1175. // CHECK:STDOUT: %Main.P = import_ref Main//equal_constraint, P, unloaded
  1176. // CHECK:STDOUT: %Main.import_ref.bdf: %N_where.type = import_ref Main//equal_constraint, loc8_10, loaded [symbolic = @Equal.%T (constants.%T)]
  1177. // CHECK:STDOUT: %Main.import_ref.b61 = import_ref Main//nested_rewrites, inst17 [no loc], unloaded
  1178. // CHECK:STDOUT: %Main.import_ref.91a = import_ref Main//nested_rewrites, loc5_8, unloaded
  1179. // CHECK:STDOUT: %Main.import_ref.55d = import_ref Main//nested_rewrites, loc6_8, unloaded
  1180. // CHECK:STDOUT: %Main.B = import_ref Main//nested_rewrites, B, unloaded
  1181. // CHECK:STDOUT: %Main.C = import_ref Main//nested_rewrites, C, unloaded
  1182. // CHECK:STDOUT: %Main.import_ref.e0c: %A_where.type.791 = import_ref Main//nested_rewrites, loc9_18, loaded [symbolic = @NestedRewrite.%D (constants.%D)]
  1183. // CHECK:STDOUT: }
  1184. // CHECK:STDOUT:
  1185. // CHECK:STDOUT: file {
  1186. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1187. // CHECK:STDOUT: .N = imports.%Main.N
  1188. // CHECK:STDOUT: .Equal = imports.%Main.Equal
  1189. // CHECK:STDOUT: .A = imports.%Main.A
  1190. // CHECK:STDOUT: .NestedRewrite = imports.%Main.NestedRewrite
  1191. // CHECK:STDOUT: .Core = imports.%Core
  1192. // CHECK:STDOUT: .Calls = %Calls.decl
  1193. // CHECK:STDOUT: }
  1194. // CHECK:STDOUT: %Core.import = import Core
  1195. // CHECK:STDOUT: %default.import = import <none>
  1196. // CHECK:STDOUT: %Calls.decl: %Calls.type = fn_decl @Calls [template = constants.%Calls] {} {}
  1197. // CHECK:STDOUT: }
  1198. // CHECK:STDOUT:
  1199. // CHECK:STDOUT: interface @N [from "equal_constraint.carbon"] {
  1200. // CHECK:STDOUT: !members:
  1201. // CHECK:STDOUT: .Self = imports.%Main.import_ref.169
  1202. // CHECK:STDOUT: .P = imports.%Main.import_ref.020
  1203. // CHECK:STDOUT: witness = (imports.%Main.P)
  1204. // CHECK:STDOUT: }
  1205. // CHECK:STDOUT:
  1206. // CHECK:STDOUT: interface @A [from "nested_rewrites.carbon"] {
  1207. // CHECK:STDOUT: !members:
  1208. // CHECK:STDOUT: .Self = imports.%Main.import_ref.b61
  1209. // CHECK:STDOUT: .B = imports.%Main.import_ref.91a
  1210. // CHECK:STDOUT: .C = imports.%Main.import_ref.55d
  1211. // CHECK:STDOUT: witness = (imports.%Main.B, imports.%Main.C)
  1212. // CHECK:STDOUT: }
  1213. // CHECK:STDOUT:
  1214. // CHECK:STDOUT: fn @Calls() {
  1215. // CHECK:STDOUT: !entry:
  1216. // CHECK:STDOUT: %Equal.ref: %Equal.type = name_ref Equal, imports.%Main.Equal [template = constants.%Equal]
  1217. // CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool]
  1218. // CHECK:STDOUT: %.loc19: %N_where.type = converted %bool.make_type, <error> [template = <error>]
  1219. // CHECK:STDOUT: %NestedRewrite.ref: %NestedRewrite.type = name_ref NestedRewrite, imports.%Main.NestedRewrite [template = constants.%NestedRewrite]
  1220. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  1221. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  1222. // CHECK:STDOUT: %.loc32: %A_where.type.791 = converted %i32, <error> [template = <error>]
  1223. // CHECK:STDOUT: return
  1224. // CHECK:STDOUT: }
  1225. // CHECK:STDOUT:
  1226. // CHECK:STDOUT: generic fn @Equal(imports.%Main.import_ref.bdf: %N_where.type) [from "equal_constraint.carbon"] {
  1227. // CHECK:STDOUT: %T: %N_where.type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  1228. // CHECK:STDOUT: %T.patt: %N_where.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)]
  1229. // CHECK:STDOUT:
  1230. // CHECK:STDOUT: fn(%T.param_patt: %N_where.type);
  1231. // CHECK:STDOUT: }
  1232. // CHECK:STDOUT:
  1233. // CHECK:STDOUT: generic fn @NestedRewrite(imports.%Main.import_ref.e0c: %A_where.type.791) [from "nested_rewrites.carbon"] {
  1234. // CHECK:STDOUT: %D: %A_where.type.791 = bind_symbolic_name D, 0 [symbolic = %D (constants.%D)]
  1235. // CHECK:STDOUT: %D.patt: %A_where.type.791 = symbolic_binding_pattern D, 0 [symbolic = %D.patt (constants.%D.patt)]
  1236. // CHECK:STDOUT:
  1237. // CHECK:STDOUT: fn(%D.param_patt: %A_where.type.791);
  1238. // CHECK:STDOUT: }
  1239. // CHECK:STDOUT:
  1240. // CHECK:STDOUT: specific @Equal(constants.%T) {
  1241. // CHECK:STDOUT: %T => constants.%T
  1242. // CHECK:STDOUT: %T.patt => constants.%T
  1243. // CHECK:STDOUT: }
  1244. // CHECK:STDOUT:
  1245. // CHECK:STDOUT: specific @NestedRewrite(constants.%D) {
  1246. // CHECK:STDOUT: %D => constants.%D
  1247. // CHECK:STDOUT: %D.patt => constants.%D
  1248. // CHECK:STDOUT: }
  1249. // CHECK:STDOUT:
  1250. // CHECK:STDOUT: --- fail_check_rewrite_constraints.carbon
  1251. // CHECK:STDOUT:
  1252. // CHECK:STDOUT: constants {
  1253. // CHECK:STDOUT: %I.type: type = facet_type <@I> [template]
  1254. // CHECK:STDOUT: %Self.826: %I.type = bind_symbolic_name Self, 0 [symbolic]
  1255. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type %I.type [template]
  1256. // CHECK:STDOUT: %assoc0.05b: %I.assoc_type = assoc_entity element0, @I.%Member [template]
  1257. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic]
  1258. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic]
  1259. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self [symbolic]
  1260. // CHECK:STDOUT: %I.facet: %I.type = facet_value %.Self.as_type, %.Self.as_wit [symbolic]
  1261. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic]
  1262. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template]
  1263. // CHECK:STDOUT: %X.patt: <error> = symbolic_binding_pattern X, 0 [symbolic]
  1264. // CHECK:STDOUT: %RewriteTypeMismatch.type: type = fn_type @RewriteTypeMismatch [template]
  1265. // CHECK:STDOUT: %RewriteTypeMismatch: %RewriteTypeMismatch.type = struct_value () [template]
  1266. // CHECK:STDOUT: }
  1267. // CHECK:STDOUT:
  1268. // CHECK:STDOUT: imports {
  1269. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  1270. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  1271. // CHECK:STDOUT: import Core//prelude
  1272. // CHECK:STDOUT: import Core//prelude/...
  1273. // CHECK:STDOUT: }
  1274. // CHECK:STDOUT: }
  1275. // CHECK:STDOUT:
  1276. // CHECK:STDOUT: file {
  1277. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1278. // CHECK:STDOUT: .Core = imports.%Core
  1279. // CHECK:STDOUT: .I = %I.decl
  1280. // CHECK:STDOUT: .RewriteTypeMismatch = %RewriteTypeMismatch.decl
  1281. // CHECK:STDOUT: }
  1282. // CHECK:STDOUT: %Core.import = import Core
  1283. // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%I.type] {} {}
  1284. // CHECK:STDOUT: %RewriteTypeMismatch.decl: %RewriteTypeMismatch.type = fn_decl @RewriteTypeMismatch [template = constants.%RewriteTypeMismatch] {
  1285. // CHECK:STDOUT: %X.patt.loc16_24.1: <error> = symbolic_binding_pattern X, 0 [symbolic = %X.patt.loc16_24.2 (constants.%X.patt)]
  1286. // CHECK:STDOUT: %X.param_patt: <error> = value_param_pattern %X.patt.loc16_24.1, runtime_param<none> [symbolic = %X.patt.loc16_24.2 (constants.%X.patt)]
  1287. // CHECK:STDOUT: } {
  1288. // CHECK:STDOUT: %X.param: <error> = value_param runtime_param<none>
  1289. // CHECK:STDOUT: %.loc16_30.1: type = splice_block %.loc16_30.2 [template = <error>] {
  1290. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%I.type]
  1291. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic = constants.%.Self]
  1292. // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  1293. // CHECK:STDOUT: %Member.ref: %I.assoc_type = name_ref Member, @Member.%assoc0 [template = constants.%assoc0.05b]
  1294. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic = constants.%.Self.as_type]
  1295. // CHECK:STDOUT: %.loc16_36: type = converted %.Self.ref, %.Self.as_type [symbolic = constants.%.Self.as_type]
  1296. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.ref [symbolic = constants.%.Self.as_wit]
  1297. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic = constants.%impl.elem0]
  1298. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2]
  1299. // CHECK:STDOUT: %.loc16_46: type = converted %int_2, <error> [template = <error>]
  1300. // CHECK:STDOUT: %.loc16_30.2: type = where_expr %.Self [template = <error>] {
  1301. // CHECK:STDOUT: requirement_rewrite %impl.elem0, <error>
  1302. // CHECK:STDOUT: }
  1303. // CHECK:STDOUT: }
  1304. // CHECK:STDOUT: %X: <error> = bind_symbolic_name X, 0, %X.param [template = <error>]
  1305. // CHECK:STDOUT: }
  1306. // CHECK:STDOUT: }
  1307. // CHECK:STDOUT:
  1308. // CHECK:STDOUT: interface @I {
  1309. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.826]
  1310. // CHECK:STDOUT: %Member: type = assoc_const_decl @Member [template] {
  1311. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%Member [template = constants.%assoc0.05b]
  1312. // CHECK:STDOUT: }
  1313. // CHECK:STDOUT:
  1314. // CHECK:STDOUT: !members:
  1315. // CHECK:STDOUT: .Self = %Self
  1316. // CHECK:STDOUT: .Member = @Member.%assoc0
  1317. // CHECK:STDOUT: witness = (%Member)
  1318. // CHECK:STDOUT: }
  1319. // CHECK:STDOUT:
  1320. // CHECK:STDOUT: generic assoc_const @Member(@I.%Self: %I.type) {
  1321. // CHECK:STDOUT: assoc_const Member:! type;
  1322. // CHECK:STDOUT: }
  1323. // CHECK:STDOUT:
  1324. // CHECK:STDOUT: generic fn @RewriteTypeMismatch(%X: <error>) {
  1325. // CHECK:STDOUT: %X.patt.loc16_24.2: <error> = symbolic_binding_pattern X, 0 [symbolic = %X.patt.loc16_24.2 (constants.%X.patt)]
  1326. // CHECK:STDOUT:
  1327. // CHECK:STDOUT: fn(%X.param_patt: <error>);
  1328. // CHECK:STDOUT: }
  1329. // CHECK:STDOUT:
  1330. // CHECK:STDOUT: specific @Member(constants.%Self.826) {}
  1331. // CHECK:STDOUT:
  1332. // CHECK:STDOUT: specific @Member(constants.%I.facet) {}
  1333. // CHECK:STDOUT:
  1334. // CHECK:STDOUT: specific @RewriteTypeMismatch(<error>) {
  1335. // CHECK:STDOUT: %X.patt.loc16_24.2 => <error>
  1336. // CHECK:STDOUT: }
  1337. // CHECK:STDOUT:
  1338. // CHECK:STDOUT: --- fail_todo_let.carbon
  1339. // CHECK:STDOUT:
  1340. // CHECK:STDOUT: constants {
  1341. // CHECK:STDOUT: %A.type: type = facet_type <@A> [template]
  1342. // CHECK:STDOUT: %Self.31d: %A.type = bind_symbolic_name Self, 0 [symbolic]
  1343. // CHECK:STDOUT: %D: type = class_type @D [template]
  1344. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  1345. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  1346. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness () [template]
  1347. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self [symbolic]
  1348. // CHECK:STDOUT: %type_where: type = facet_type <type where TODO> [template]
  1349. // CHECK:STDOUT: }
  1350. // CHECK:STDOUT:
  1351. // CHECK:STDOUT: imports {
  1352. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  1353. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  1354. // CHECK:STDOUT: import Core//prelude
  1355. // CHECK:STDOUT: import Core//prelude/...
  1356. // CHECK:STDOUT: }
  1357. // CHECK:STDOUT: }
  1358. // CHECK:STDOUT:
  1359. // CHECK:STDOUT: file {
  1360. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1361. // CHECK:STDOUT: .Core = imports.%Core
  1362. // CHECK:STDOUT: .A = %A.decl
  1363. // CHECK:STDOUT: .D = %D.decl
  1364. // CHECK:STDOUT: .B = %B
  1365. // CHECK:STDOUT: }
  1366. // CHECK:STDOUT: %Core.import = import Core
  1367. // CHECK:STDOUT: %A.decl: type = interface_decl @A [template = constants.%A.type] {} {}
  1368. // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} {}
  1369. // CHECK:STDOUT: impl_decl @impl [template] {} {
  1370. // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D]
  1371. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A.type]
  1372. // CHECK:STDOUT: }
  1373. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness () [template = constants.%impl_witness]
  1374. // CHECK:STDOUT: name_binding_decl {
  1375. // CHECK:STDOUT: %B.patt: %type_where = binding_pattern B
  1376. // CHECK:STDOUT: }
  1377. // CHECK:STDOUT: %.loc15_13.1: type = splice_block %.loc15_13.2 [template = constants.%type_where] {
  1378. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self [symbolic = constants.%.Self]
  1379. // CHECK:STDOUT: %.Self.ref: type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  1380. // CHECK:STDOUT: %A.ref: type = name_ref A, %A.decl [template = constants.%A.type]
  1381. // CHECK:STDOUT: %.loc15_13.2: type = where_expr %.Self [template = constants.%type_where] {
  1382. // CHECK:STDOUT: requirement_impls %.Self.ref, %A.ref
  1383. // CHECK:STDOUT: }
  1384. // CHECK:STDOUT: }
  1385. // CHECK:STDOUT: %.loc15_35: %type_where = converted @__global_init.%D.ref, <error> [template = <error>]
  1386. // CHECK:STDOUT: %B: %type_where = bind_name B, <error>
  1387. // CHECK:STDOUT: }
  1388. // CHECK:STDOUT:
  1389. // CHECK:STDOUT: interface @A {
  1390. // CHECK:STDOUT: %Self: %A.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.31d]
  1391. // CHECK:STDOUT:
  1392. // CHECK:STDOUT: !members:
  1393. // CHECK:STDOUT: .Self = %Self
  1394. // CHECK:STDOUT: witness = ()
  1395. // CHECK:STDOUT: }
  1396. // CHECK:STDOUT:
  1397. // CHECK:STDOUT: impl @impl: %D.ref as %A.ref {
  1398. // CHECK:STDOUT: !members:
  1399. // CHECK:STDOUT: witness = file.%impl_witness
  1400. // CHECK:STDOUT: }
  1401. // CHECK:STDOUT:
  1402. // CHECK:STDOUT: class @D {
  1403. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  1404. // CHECK:STDOUT: complete_type_witness = %complete_type
  1405. // CHECK:STDOUT:
  1406. // CHECK:STDOUT: !members:
  1407. // CHECK:STDOUT: .Self = constants.%D
  1408. // CHECK:STDOUT: }
  1409. // CHECK:STDOUT:
  1410. // CHECK:STDOUT: fn @__global_init() {
  1411. // CHECK:STDOUT: !entry:
  1412. // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D]
  1413. // CHECK:STDOUT: return
  1414. // CHECK:STDOUT: }
  1415. // CHECK:STDOUT:
  1416. // CHECK:STDOUT: --- fail_type_does_not_implement_where.carbon
  1417. // CHECK:STDOUT:
  1418. // CHECK:STDOUT: constants {
  1419. // CHECK:STDOUT: %E.type: type = facet_type <@E> [template]
  1420. // CHECK:STDOUT: %Self.19a: %E.type = bind_symbolic_name Self, 0 [symbolic]
  1421. // CHECK:STDOUT: %E.assoc_type: type = assoc_entity_type %E.type [template]
  1422. // CHECK:STDOUT: %assoc0.9c3: %E.assoc_type = assoc_entity element0, @E.%F [template]
  1423. // CHECK:STDOUT: %assoc1: %E.assoc_type = assoc_entity element1, @E.%G [template]
  1424. // CHECK:STDOUT: %.Self.da5: %E.type = bind_symbolic_name .Self [symbolic]
  1425. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  1426. // CHECK:STDOUT: %.Self.as_type.34e: type = facet_access_type %.Self.da5 [symbolic]
  1427. // CHECK:STDOUT: %.Self.as_wit.f42: <witness> = facet_access_witness %.Self.da5 [symbolic]
  1428. // CHECK:STDOUT: %E.facet.74f: %E.type = facet_value %.Self.as_type.34e, %.Self.as_wit.f42 [symbolic]
  1429. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit.f42, element0 [symbolic]
  1430. // CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template]
  1431. // CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template]
  1432. // CHECK:STDOUT: %impl.elem1.91f: type = impl_witness_access %.Self.as_wit.f42, element1 [symbolic]
  1433. // CHECK:STDOUT: %E_where.type.366: type = facet_type <@E where %impl.elem1.91f = %empty_tuple.type and %impl.elem0 = bool> [template]
  1434. // CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [template]
  1435. // CHECK:STDOUT: %Float.type: type = fn_type @Float [template]
  1436. // CHECK:STDOUT: %Float: %Float.type = struct_value () [template]
  1437. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  1438. // CHECK:STDOUT: %E_where.type.324: type = facet_type <@E where %impl.elem0 = %empty_struct_type> [template]
  1439. // CHECK:STDOUT: %.Self.665: %E_where.type.324 = bind_symbolic_name .Self [symbolic]
  1440. // CHECK:STDOUT: %.Self.as_type.c08: type = facet_access_type %.Self.665 [symbolic]
  1441. // CHECK:STDOUT: %.Self.as_wit.bb3: <witness> = facet_access_witness %.Self.665 [symbolic]
  1442. // CHECK:STDOUT: %E.facet.f08: %E.type = facet_value %.Self.as_type.c08, %.Self.as_wit.bb3 [symbolic]
  1443. // CHECK:STDOUT: %impl.elem1.244: type = impl_witness_access %.Self.as_wit.bb3, element1 [symbolic]
  1444. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
  1445. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
  1446. // CHECK:STDOUT: %E_where.type.bef: type = facet_type <@E where %impl.elem1.244 = %i32 and %impl.elem0 = %empty_struct_type> [template]
  1447. // CHECK:STDOUT: %E_where.type.503: type = facet_type <@E where %impl.elem0 = %impl.elem1.91f> [template]
  1448. // CHECK:STDOUT: }
  1449. // CHECK:STDOUT:
  1450. // CHECK:STDOUT: imports {
  1451. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  1452. // CHECK:STDOUT: .Bool = %Core.Bool
  1453. // CHECK:STDOUT: .Float = %Core.Float
  1454. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  1455. // CHECK:STDOUT: .Int = %Core.Int
  1456. // CHECK:STDOUT: import Core//prelude
  1457. // CHECK:STDOUT: import Core//prelude/...
  1458. // CHECK:STDOUT: }
  1459. // CHECK:STDOUT: }
  1460. // CHECK:STDOUT:
  1461. // CHECK:STDOUT: file {
  1462. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1463. // CHECK:STDOUT: .Core = imports.%Core
  1464. // CHECK:STDOUT: .E = %E.decl
  1465. // CHECK:STDOUT: .H = %H
  1466. // CHECK:STDOUT: .J = %J
  1467. // CHECK:STDOUT: .K = %K
  1468. // CHECK:STDOUT: }
  1469. // CHECK:STDOUT: %Core.import = import Core
  1470. // CHECK:STDOUT: %E.decl: type = interface_decl @E [template = constants.%E.type] {} {}
  1471. // CHECK:STDOUT: name_binding_decl {
  1472. // CHECK:STDOUT: %H.patt: %E_where.type.366 = binding_pattern H
  1473. // CHECK:STDOUT: }
  1474. // CHECK:STDOUT: %.loc18_11.1: type = splice_block %.loc18_11.2 [template = constants.%E_where.type.366] {
  1475. // CHECK:STDOUT: %E.ref.loc18: type = name_ref E, %E.decl [template = constants.%E.type]
  1476. // CHECK:STDOUT: %.Self.1: %E.type = bind_symbolic_name .Self [symbolic = constants.%.Self.da5]
  1477. // CHECK:STDOUT: %.Self.ref.loc18_17: %E.type = name_ref .Self, %.Self.1 [symbolic = constants.%.Self.da5]
  1478. // CHECK:STDOUT: %F.ref.loc18: %E.assoc_type = name_ref F, @F.%assoc0 [template = constants.%assoc0.9c3]
  1479. // CHECK:STDOUT: %.Self.as_type.loc18_17: type = facet_access_type %.Self.ref.loc18_17 [symbolic = constants.%.Self.as_type.34e]
  1480. // CHECK:STDOUT: %.loc18_17: type = converted %.Self.ref.loc18_17, %.Self.as_type.loc18_17 [symbolic = constants.%.Self.as_type.34e]
  1481. // CHECK:STDOUT: %.Self.as_wit.loc18_17: <witness> = facet_access_witness %.Self.ref.loc18_17 [symbolic = constants.%.Self.as_wit.f42]
  1482. // CHECK:STDOUT: %impl.elem0.loc18: type = impl_witness_access %.Self.as_wit.loc18_17, element0 [symbolic = constants.%impl.elem0]
  1483. // CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool]
  1484. // CHECK:STDOUT: %.loc18_22.1: type = value_of_initializer %bool.make_type [template = bool]
  1485. // CHECK:STDOUT: %.loc18_22.2: type = converted %bool.make_type, %.loc18_22.1 [template = bool]
  1486. // CHECK:STDOUT: %.Self.ref.loc18_31: %E.type = name_ref .Self, %.Self.1 [symbolic = constants.%.Self.da5]
  1487. // CHECK:STDOUT: %G.ref.loc18: %E.assoc_type = name_ref G, @G.%assoc1 [template = constants.%assoc1]
  1488. // CHECK:STDOUT: %.Self.as_type.loc18_31: type = facet_access_type %.Self.ref.loc18_31 [symbolic = constants.%.Self.as_type.34e]
  1489. // CHECK:STDOUT: %.loc18_31: type = converted %.Self.ref.loc18_31, %.Self.as_type.loc18_31 [symbolic = constants.%.Self.as_type.34e]
  1490. // CHECK:STDOUT: %.Self.as_wit.loc18_31: <witness> = facet_access_witness %.Self.ref.loc18_31 [symbolic = constants.%.Self.as_wit.f42]
  1491. // CHECK:STDOUT: %impl.elem1.loc18: type = impl_witness_access %.Self.as_wit.loc18_31, element1 [symbolic = constants.%impl.elem1.91f]
  1492. // CHECK:STDOUT: %.loc18_37.1: %empty_tuple.type = tuple_literal ()
  1493. // CHECK:STDOUT: %.loc18_37.2: type = converted %.loc18_37.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type]
  1494. // CHECK:STDOUT: %.loc18_11.2: type = where_expr %.Self.1 [template = constants.%E_where.type.366] {
  1495. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc18, %.loc18_22.2
  1496. // CHECK:STDOUT: requirement_rewrite %impl.elem1.loc18, %.loc18_37.2
  1497. // CHECK:STDOUT: }
  1498. // CHECK:STDOUT: }
  1499. // CHECK:STDOUT: %.loc18_42: %E_where.type.366 = converted @__global_init.%float.make_type, <error> [template = <error>]
  1500. // CHECK:STDOUT: %H: %E_where.type.366 = bind_name H, <error>
  1501. // CHECK:STDOUT: name_binding_decl {
  1502. // CHECK:STDOUT: %J.patt: %E_where.type.bef = binding_pattern J
  1503. // CHECK:STDOUT: }
  1504. // CHECK:STDOUT: %.loc27_27.1: type = splice_block %.loc27_27.2 [template = constants.%E_where.type.bef] {
  1505. // CHECK:STDOUT: %E.ref.loc27: type = name_ref E, %E.decl [template = constants.%E.type]
  1506. // CHECK:STDOUT: %.Self.2: %E.type = bind_symbolic_name .Self [symbolic = constants.%.Self.da5]
  1507. // CHECK:STDOUT: %.Self.ref.loc27_18: %E.type = name_ref .Self, %.Self.2 [symbolic = constants.%.Self.da5]
  1508. // CHECK:STDOUT: %F.ref.loc27: %E.assoc_type = name_ref F, @F.%assoc0 [template = constants.%assoc0.9c3]
  1509. // CHECK:STDOUT: %.Self.as_type.loc27_18: type = facet_access_type %.Self.ref.loc27_18 [symbolic = constants.%.Self.as_type.34e]
  1510. // CHECK:STDOUT: %.loc27_18: type = converted %.Self.ref.loc27_18, %.Self.as_type.loc27_18 [symbolic = constants.%.Self.as_type.34e]
  1511. // CHECK:STDOUT: %.Self.as_wit.loc27_18: <witness> = facet_access_witness %.Self.ref.loc27_18 [symbolic = constants.%.Self.as_wit.f42]
  1512. // CHECK:STDOUT: %impl.elem0.loc27: type = impl_witness_access %.Self.as_wit.loc27_18, element0 [symbolic = constants.%impl.elem0]
  1513. // CHECK:STDOUT: %.loc27_24.1: %empty_struct_type = struct_literal ()
  1514. // CHECK:STDOUT: %.loc27_24.2: type = converted %.loc27_24.1, constants.%empty_struct_type [template = constants.%empty_struct_type]
  1515. // CHECK:STDOUT: %.loc27_12: type = where_expr %.Self.2 [template = constants.%E_where.type.324] {
  1516. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc27, %.loc27_24.2
  1517. // CHECK:STDOUT: }
  1518. // CHECK:STDOUT: %.Self.3: %E_where.type.324 = bind_symbolic_name .Self [symbolic = constants.%.Self.665]
  1519. // CHECK:STDOUT: %.Self.ref.loc27_33: %E_where.type.324 = name_ref .Self, %.Self.3 [symbolic = constants.%.Self.665]
  1520. // CHECK:STDOUT: %G.ref.loc27: %E.assoc_type = name_ref G, @G.%assoc1 [template = constants.%assoc1]
  1521. // CHECK:STDOUT: %.Self.as_type.loc27_33: type = facet_access_type %.Self.ref.loc27_33 [symbolic = constants.%.Self.as_type.c08]
  1522. // CHECK:STDOUT: %.loc27_33: type = converted %.Self.ref.loc27_33, %.Self.as_type.loc27_33 [symbolic = constants.%.Self.as_type.c08]
  1523. // CHECK:STDOUT: %.Self.as_wit.loc27_33: <witness> = facet_access_witness %.Self.ref.loc27_33 [symbolic = constants.%.Self.as_wit.bb3]
  1524. // CHECK:STDOUT: %impl.elem1.loc27: type = impl_witness_access %.Self.as_wit.loc27_33, element1 [symbolic = constants.%impl.elem1.244]
  1525. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  1526. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  1527. // CHECK:STDOUT: %.loc27_27.2: type = where_expr %.Self.3 [template = constants.%E_where.type.bef] {
  1528. // CHECK:STDOUT: requirement_rewrite %impl.elem1.loc27, %i32
  1529. // CHECK:STDOUT: }
  1530. // CHECK:STDOUT: }
  1531. // CHECK:STDOUT: %.loc27_45: %E_where.type.bef = converted @__global_init.%bool.make_type.loc27, <error> [template = <error>]
  1532. // CHECK:STDOUT: %J: %E_where.type.bef = bind_name J, <error>
  1533. // CHECK:STDOUT: name_binding_decl {
  1534. // CHECK:STDOUT: %K.patt: %E_where.type.503 = binding_pattern K
  1535. // CHECK:STDOUT: }
  1536. // CHECK:STDOUT: %.loc36_11.1: type = splice_block %.loc36_11.2 [template = constants.%E_where.type.503] {
  1537. // CHECK:STDOUT: %E.ref.loc36: type = name_ref E, %E.decl [template = constants.%E.type]
  1538. // CHECK:STDOUT: %.Self.4: %E.type = bind_symbolic_name .Self [symbolic = constants.%.Self.da5]
  1539. // CHECK:STDOUT: %.Self.ref.loc36_17: %E.type = name_ref .Self, %.Self.4 [symbolic = constants.%.Self.da5]
  1540. // CHECK:STDOUT: %F.ref.loc36: %E.assoc_type = name_ref F, @F.%assoc0 [template = constants.%assoc0.9c3]
  1541. // CHECK:STDOUT: %.Self.as_type.loc36_17: type = facet_access_type %.Self.ref.loc36_17 [symbolic = constants.%.Self.as_type.34e]
  1542. // CHECK:STDOUT: %.loc36_17: type = converted %.Self.ref.loc36_17, %.Self.as_type.loc36_17 [symbolic = constants.%.Self.as_type.34e]
  1543. // CHECK:STDOUT: %.Self.as_wit.loc36_17: <witness> = facet_access_witness %.Self.ref.loc36_17 [symbolic = constants.%.Self.as_wit.f42]
  1544. // CHECK:STDOUT: %impl.elem0.loc36: type = impl_witness_access %.Self.as_wit.loc36_17, element0 [symbolic = constants.%impl.elem0]
  1545. // CHECK:STDOUT: %.Self.ref.loc36_22: %E.type = name_ref .Self, %.Self.4 [symbolic = constants.%.Self.da5]
  1546. // CHECK:STDOUT: %G.ref.loc36: %E.assoc_type = name_ref G, @G.%assoc1 [template = constants.%assoc1]
  1547. // CHECK:STDOUT: %.Self.as_type.loc36_27: type = facet_access_type %.Self.ref.loc36_22 [symbolic = constants.%.Self.as_type.34e]
  1548. // CHECK:STDOUT: %.loc36_27: type = converted %.Self.ref.loc36_22, %.Self.as_type.loc36_27 [symbolic = constants.%.Self.as_type.34e]
  1549. // CHECK:STDOUT: %.Self.as_wit.loc36_27: <witness> = facet_access_witness %.Self.ref.loc36_22 [symbolic = constants.%.Self.as_wit.f42]
  1550. // CHECK:STDOUT: %impl.elem1.loc36: type = impl_witness_access %.Self.as_wit.loc36_27, element1 [symbolic = constants.%impl.elem1.91f]
  1551. // CHECK:STDOUT: %.loc36_11.2: type = where_expr %.Self.4 [template = constants.%E_where.type.503] {
  1552. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc36, %impl.elem1.loc36
  1553. // CHECK:STDOUT: }
  1554. // CHECK:STDOUT: }
  1555. // CHECK:STDOUT: %.loc36_33: %E_where.type.503 = converted @__global_init.%bool.make_type.loc36, <error> [template = <error>]
  1556. // CHECK:STDOUT: %K: %E_where.type.503 = bind_name K, <error>
  1557. // CHECK:STDOUT: }
  1558. // CHECK:STDOUT:
  1559. // CHECK:STDOUT: interface @E {
  1560. // CHECK:STDOUT: %Self: %E.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.19a]
  1561. // CHECK:STDOUT: %F: type = assoc_const_decl @F [template] {
  1562. // CHECK:STDOUT: %assoc0: %E.assoc_type = assoc_entity element0, @E.%F [template = constants.%assoc0.9c3]
  1563. // CHECK:STDOUT: }
  1564. // CHECK:STDOUT: %G: type = assoc_const_decl @G [template] {
  1565. // CHECK:STDOUT: %assoc1: %E.assoc_type = assoc_entity element1, @E.%G [template = constants.%assoc1]
  1566. // CHECK:STDOUT: }
  1567. // CHECK:STDOUT:
  1568. // CHECK:STDOUT: !members:
  1569. // CHECK:STDOUT: .Self = %Self
  1570. // CHECK:STDOUT: .F = @F.%assoc0
  1571. // CHECK:STDOUT: .G = @G.%assoc1
  1572. // CHECK:STDOUT: witness = (%F, %G)
  1573. // CHECK:STDOUT: }
  1574. // CHECK:STDOUT:
  1575. // CHECK:STDOUT: generic assoc_const @F(@E.%Self: %E.type) {
  1576. // CHECK:STDOUT: assoc_const F:! type;
  1577. // CHECK:STDOUT: }
  1578. // CHECK:STDOUT:
  1579. // CHECK:STDOUT: generic assoc_const @G(@E.%Self: %E.type) {
  1580. // CHECK:STDOUT: assoc_const G:! type;
  1581. // CHECK:STDOUT: }
  1582. // CHECK:STDOUT:
  1583. // CHECK:STDOUT: fn @__global_init() {
  1584. // CHECK:STDOUT: !entry:
  1585. // CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [template = constants.%int_64]
  1586. // CHECK:STDOUT: %float.make_type: init type = call constants.%Float(%int_64) [template = f64]
  1587. // CHECK:STDOUT: %bool.make_type.loc27: init type = call constants.%Bool() [template = bool]
  1588. // CHECK:STDOUT: %bool.make_type.loc36: init type = call constants.%Bool() [template = bool]
  1589. // CHECK:STDOUT: return
  1590. // CHECK:STDOUT: }
  1591. // CHECK:STDOUT:
  1592. // CHECK:STDOUT: specific @F(constants.%Self.19a) {}
  1593. // CHECK:STDOUT:
  1594. // CHECK:STDOUT: specific @G(constants.%Self.19a) {}
  1595. // CHECK:STDOUT:
  1596. // CHECK:STDOUT: specific @F(constants.%E.facet.74f) {}
  1597. // CHECK:STDOUT:
  1598. // CHECK:STDOUT: specific @G(constants.%E.facet.74f) {}
  1599. // CHECK:STDOUT:
  1600. // CHECK:STDOUT: specific @G(constants.%E.facet.f08) {}
  1601. // CHECK:STDOUT: