equal_rewrite.carbon 101 KB

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