equal_rewrite.carbon 106 KB

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