constraints.carbon 85 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451
  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/constraints.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/where_expr/constraints.carbon
  10. // --- state_constraints.carbon
  11. library "[[@TEST_NAME]]";
  12. interface J {}
  13. interface I {
  14. let Member:! type;
  15. let Second:! J;
  16. }
  17. fn EqualEqual(U:! I where .Self == ());
  18. fn Impls(V:! J where .Self impls I);
  19. fn And(W:! I where .Self impls J and .Member == ());
  20. // --- fail_todo_equal_constraint.carbon
  21. library "[[@TEST_NAME]]";
  22. interface N {
  23. let P:! type;
  24. }
  25. // CHECK:STDERR: fail_todo_equal_constraint.carbon:[[@LINE+7]]:27: error: cannot implicitly convert from `{}` to `<associated type in N>`
  26. // CHECK:STDERR: fn Equal(T:! N where .P = {});
  27. // CHECK:STDERR: ^~
  28. // CHECK:STDERR: fail_todo_equal_constraint.carbon:[[@LINE+4]]:27: note: type `{}` does not implement interface `ImplicitAs`
  29. // CHECK:STDERR: fn Equal(T:! N where .P = {});
  30. // CHECK:STDERR: ^~
  31. // CHECK:STDERR:
  32. fn Equal(T:! N where .P = {});
  33. // --- fail_todo_associated_type_impls.carbon
  34. library "[[@TEST_NAME]]";
  35. interface L {}
  36. interface M {}
  37. interface K {
  38. let Associated:! L;
  39. }
  40. // CHECK:STDERR: fail_todo_associated_type_impls.carbon:[[@LINE+7]]:36: error: cannot implicitly convert from `<associated L in K>` to `type`
  41. // CHECK:STDERR: fn AssociatedTypeImpls(W:! K where .Associated impls M);
  42. // CHECK:STDERR: ^~~~~~~~~~~
  43. // CHECK:STDERR: fail_todo_associated_type_impls.carbon:[[@LINE+4]]:36: note: type `<associated L in K>` does not implement interface `ImplicitAs`
  44. // CHECK:STDERR: fn AssociatedTypeImpls(W:! K where .Associated impls M);
  45. // CHECK:STDERR: ^~~~~~~~~~~
  46. // CHECK:STDERR:
  47. fn AssociatedTypeImpls(W:! K where .Associated impls M);
  48. // --- fail_check_rewrite_constraints.carbon
  49. library "[[@TEST_NAME]]";
  50. import library "state_constraints";
  51. // `2` can't be converted to the type of `I.Member`
  52. // TODO: The diagnostics are wrong since member access into facets isn't
  53. // working properly yet.
  54. // CHECK:STDERR: fail_check_rewrite_constraints.carbon:[[@LINE+7]]:46: error: cannot implicitly convert from `i32` to `<associated type in I>`
  55. // CHECK:STDERR: fn RewriteTypeMismatch(X:! I where .Member = 2);
  56. // CHECK:STDERR: ^
  57. // CHECK:STDERR: fail_check_rewrite_constraints.carbon:[[@LINE+4]]:46: note: type `i32` does not implement interface `ImplicitAs`
  58. // CHECK:STDERR: fn RewriteTypeMismatch(X:! I where .Member = 2);
  59. // CHECK:STDERR: ^
  60. // CHECK:STDERR:
  61. fn RewriteTypeMismatch(X:! I where .Member = 2);
  62. // --- fail_left_of_impls_non_type.carbon
  63. library "[[@TEST_NAME]]";
  64. // CHECK:STDERR: fail_left_of_impls_non_type.carbon:[[@LINE+7]]:32: error: cannot implicitly convert from `i32` to `type`
  65. // CHECK:STDERR: fn NonTypeImpls(U:! type where 7 impls type);
  66. // CHECK:STDERR: ^
  67. // CHECK:STDERR: fail_left_of_impls_non_type.carbon:[[@LINE+4]]:32: note: type `i32` does not implement interface `ImplicitAs`
  68. // CHECK:STDERR: fn NonTypeImpls(U:! type where 7 impls type);
  69. // CHECK:STDERR: ^
  70. // CHECK:STDERR:
  71. fn NonTypeImpls(U:! type where 7 impls type);
  72. // --- fail_right_of_impls_non_type.carbon
  73. library "[[@TEST_NAME]]";
  74. // CHECK:STDERR: fail_right_of_impls_non_type.carbon:[[@LINE+7]]:44: error: cannot implicitly convert from `i32` to `type`
  75. // CHECK:STDERR: fn ImplsNonType(U:! type where .Self impls 7);
  76. // CHECK:STDERR: ^
  77. // CHECK:STDERR: fail_right_of_impls_non_type.carbon:[[@LINE+4]]:44: note: type `i32` does not implement interface `ImplicitAs`
  78. // CHECK:STDERR: fn ImplsNonType(U:! type where .Self impls 7);
  79. // CHECK:STDERR: ^
  80. // CHECK:STDERR:
  81. fn ImplsNonType(U:! type where .Self impls 7);
  82. // --- fail_right_of_impls_non_facet_type.carbon
  83. library "[[@TEST_NAME]]";
  84. // CHECK:STDERR: fail_right_of_impls_non_facet_type.carbon:[[@LINE+4]]:51: error: right argument of `impls` requirement must be a facet type
  85. // CHECK:STDERR: fn ImplsOfNonFacetType(U:! type where .Self impls i32);
  86. // CHECK:STDERR: ^~~
  87. // CHECK:STDERR:
  88. fn ImplsOfNonFacetType(U:! type where .Self impls i32);
  89. // --- fail_todo_enforce_constraint.carbon
  90. library "[[@TEST_NAME]]";
  91. import library "state_constraints";
  92. // C implements J but not I.
  93. class C {}
  94. impl C as J {}
  95. // TODO: Should report that `C` does not meet the constraint.
  96. fn DoesNotImplI() {
  97. // CHECK:STDERR: fail_todo_enforce_constraint.carbon:[[@LINE+7]]:3: error: cannot implicitly convert from `type` to `J`
  98. // CHECK:STDERR: Impls(C);
  99. // CHECK:STDERR: ^~~~~~
  100. // CHECK:STDERR: fail_todo_enforce_constraint.carbon:[[@LINE+4]]:3: note: type `type` does not implement interface `ImplicitAs`
  101. // CHECK:STDERR: Impls(C);
  102. // CHECK:STDERR: ^~~~~~
  103. // CHECK:STDERR:
  104. Impls(C);
  105. }
  106. fn EmptyStruct(Y:! J where .Self == {});
  107. // TODO: Should report that `C` does not meeet the constraint.
  108. fn NotEmptyStruct() {
  109. // CHECK:STDERR: fail_todo_enforce_constraint.carbon:[[@LINE+6]]:3: error: cannot implicitly convert from `type` to `J`
  110. // CHECK:STDERR: EmptyStruct(C);
  111. // CHECK:STDERR: ^~~~~~~~~~~~
  112. // CHECK:STDERR: fail_todo_enforce_constraint.carbon:[[@LINE+3]]:3: note: type `type` does not implement interface `ImplicitAs`
  113. // CHECK:STDERR: EmptyStruct(C);
  114. // CHECK:STDERR: ^~~~~~~~~~~~
  115. EmptyStruct(C);
  116. }
  117. // CHECK:STDOUT: --- state_constraints.carbon
  118. // CHECK:STDOUT:
  119. // CHECK:STDOUT: constants {
  120. // CHECK:STDOUT: %J.type: type = interface_type @J [template]
  121. // CHECK:STDOUT: %Self.1: %J.type = bind_symbolic_name Self, 0 [symbolic]
  122. // CHECK:STDOUT: %I.type: type = interface_type @I [template]
  123. // CHECK:STDOUT: %Self.2: %I.type = bind_symbolic_name Self, 0 [symbolic]
  124. // CHECK:STDOUT: %.1: type = assoc_entity_type %I.type, type [template]
  125. // CHECK:STDOUT: %.2: %.1 = assoc_entity element0, @I.%Member [template]
  126. // CHECK:STDOUT: %.3: type = tuple_type () [template]
  127. // CHECK:STDOUT: %.4: type = assoc_entity_type %I.type, %J.type [template]
  128. // CHECK:STDOUT: %.5: %.4 = assoc_entity element1, @I.%Second [template]
  129. // CHECK:STDOUT: %.Self.1: %I.type = bind_symbolic_name .Self, 0 [symbolic]
  130. // CHECK:STDOUT: %U: %I.type = bind_symbolic_name U, 0 [symbolic]
  131. // CHECK:STDOUT: %U.patt: %I.type = symbolic_binding_pattern U, 0 [symbolic]
  132. // CHECK:STDOUT: %EqualEqual.type: type = fn_type @EqualEqual [template]
  133. // CHECK:STDOUT: %EqualEqual: %EqualEqual.type = struct_value () [template]
  134. // CHECK:STDOUT: %.Self.2: %J.type = bind_symbolic_name .Self, 0 [symbolic]
  135. // CHECK:STDOUT: %V: %J.type = bind_symbolic_name V, 0 [symbolic]
  136. // CHECK:STDOUT: %V.patt: %J.type = symbolic_binding_pattern V, 0 [symbolic]
  137. // CHECK:STDOUT: %Impls.type: type = fn_type @Impls [template]
  138. // CHECK:STDOUT: %Impls: %Impls.type = struct_value () [template]
  139. // CHECK:STDOUT: %W: %I.type = bind_symbolic_name W, 0 [symbolic]
  140. // CHECK:STDOUT: %W.patt: %I.type = symbolic_binding_pattern W, 0 [symbolic]
  141. // CHECK:STDOUT: %And.type: type = fn_type @And [template]
  142. // CHECK:STDOUT: %And: %And.type = struct_value () [template]
  143. // CHECK:STDOUT: }
  144. // CHECK:STDOUT:
  145. // CHECK:STDOUT: imports {
  146. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  147. // CHECK:STDOUT: import Core//prelude
  148. // CHECK:STDOUT: import Core//prelude/operators
  149. // CHECK:STDOUT: import Core//prelude/types
  150. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  151. // CHECK:STDOUT: import Core//prelude/operators/as
  152. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  153. // CHECK:STDOUT: import Core//prelude/operators/comparison
  154. // CHECK:STDOUT: import Core//prelude/types/bool
  155. // CHECK:STDOUT: }
  156. // CHECK:STDOUT: }
  157. // CHECK:STDOUT:
  158. // CHECK:STDOUT: file {
  159. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  160. // CHECK:STDOUT: .Core = imports.%Core
  161. // CHECK:STDOUT: .J = %J.decl
  162. // CHECK:STDOUT: .I = %I.decl
  163. // CHECK:STDOUT: .EqualEqual = %EqualEqual.decl
  164. // CHECK:STDOUT: .Impls = %Impls.decl
  165. // CHECK:STDOUT: .And = %And.decl
  166. // CHECK:STDOUT: }
  167. // CHECK:STDOUT: %Core.import = import Core
  168. // CHECK:STDOUT: %J.decl: type = interface_decl @J [template = constants.%J.type] {} {}
  169. // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%I.type] {} {}
  170. // CHECK:STDOUT: %EqualEqual.decl: %EqualEqual.type = fn_decl @EqualEqual [template = constants.%EqualEqual] {
  171. // CHECK:STDOUT: %U.patt.loc11_15.1: %I.type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc11_15.2 (constants.%U.patt)]
  172. // CHECK:STDOUT: %U.param_patt: %I.type = param_pattern %U.patt.loc11_15.1, runtime_param<invalid> [symbolic = %U.patt.loc11_15.2 (constants.%U.patt)]
  173. // CHECK:STDOUT: } {
  174. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%I.type]
  175. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self, 0 [symbolic = constants.%.Self.1]
  176. // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic = constants.%.Self.1]
  177. // CHECK:STDOUT: %.loc11_37: %.3 = tuple_literal ()
  178. // CHECK:STDOUT: %.loc11_21: type = where_expr %.Self [template = constants.%I.type] {
  179. // CHECK:STDOUT: requirement_equivalent %.Self.ref, %.loc11_37
  180. // CHECK:STDOUT: }
  181. // CHECK:STDOUT: %param: %I.type = param runtime_param<invalid>
  182. // CHECK:STDOUT: %U.loc11_15.1: %I.type = bind_symbolic_name U, 0, %param [symbolic = %U.loc11_15.2 (constants.%U)]
  183. // CHECK:STDOUT: }
  184. // CHECK:STDOUT: %Impls.decl: %Impls.type = fn_decl @Impls [template = constants.%Impls] {
  185. // CHECK:STDOUT: %V.patt.loc13_10.1: %J.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc13_10.2 (constants.%V.patt)]
  186. // CHECK:STDOUT: %V.param_patt: %J.type = param_pattern %V.patt.loc13_10.1, runtime_param<invalid> [symbolic = %V.patt.loc13_10.2 (constants.%V.patt)]
  187. // CHECK:STDOUT: } {
  188. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%J.type]
  189. // CHECK:STDOUT: %.Self: %J.type = bind_symbolic_name .Self, 0 [symbolic = constants.%.Self.2]
  190. // CHECK:STDOUT: %.Self.ref: %J.type = name_ref .Self, %.Self [symbolic = constants.%.Self.2]
  191. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%I.type]
  192. // CHECK:STDOUT: %.loc13_22.1: type = facet_type_access %.Self.ref [symbolic = constants.%.Self.2]
  193. // CHECK:STDOUT: %.loc13_22.2: type = converted %.Self.ref, %.loc13_22.1 [symbolic = constants.%.Self.2]
  194. // CHECK:STDOUT: %.loc13_16: type = where_expr %.Self [template = constants.%J.type] {
  195. // CHECK:STDOUT: requirement_impls %.loc13_22.2, %I.ref
  196. // CHECK:STDOUT: }
  197. // CHECK:STDOUT: %param: %J.type = param runtime_param<invalid>
  198. // CHECK:STDOUT: %V.loc13_10.1: %J.type = bind_symbolic_name V, 0, %param [symbolic = %V.loc13_10.2 (constants.%V)]
  199. // CHECK:STDOUT: }
  200. // CHECK:STDOUT: %And.decl: %And.type = fn_decl @And [template = constants.%And] {
  201. // CHECK:STDOUT: %W.patt.loc15_8.1: %I.type = symbolic_binding_pattern W, 0 [symbolic = %W.patt.loc15_8.2 (constants.%W.patt)]
  202. // CHECK:STDOUT: %W.param_patt: %I.type = param_pattern %W.patt.loc15_8.1, runtime_param<invalid> [symbolic = %W.patt.loc15_8.2 (constants.%W.patt)]
  203. // CHECK:STDOUT: } {
  204. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%I.type]
  205. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self, 0 [symbolic = constants.%.Self.1]
  206. // CHECK:STDOUT: %.Self.ref.loc15_20: %I.type = name_ref .Self, %.Self [symbolic = constants.%.Self.1]
  207. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%J.type]
  208. // CHECK:STDOUT: %.loc15_20.1: type = facet_type_access %.Self.ref.loc15_20 [symbolic = constants.%.Self.1]
  209. // CHECK:STDOUT: %.loc15_20.2: type = converted %.Self.ref.loc15_20, %.loc15_20.1 [symbolic = constants.%.Self.1]
  210. // CHECK:STDOUT: %.Self.ref.loc15_38: %I.type = name_ref .Self, %.Self [symbolic = constants.%.Self.1]
  211. // CHECK:STDOUT: %Member.ref: %.1 = name_ref Member, @I.%.loc7 [template = constants.%.2]
  212. // CHECK:STDOUT: %.loc15_50: %.3 = tuple_literal ()
  213. // CHECK:STDOUT: %.loc15_14: type = where_expr %.Self [template = constants.%I.type] {
  214. // CHECK:STDOUT: requirement_impls %.loc15_20.2, %J.ref
  215. // CHECK:STDOUT: requirement_equivalent %Member.ref, %.loc15_50
  216. // CHECK:STDOUT: }
  217. // CHECK:STDOUT: %param: %I.type = param runtime_param<invalid>
  218. // CHECK:STDOUT: %W.loc15_8.1: %I.type = bind_symbolic_name W, 0, %param [symbolic = %W.loc15_8.2 (constants.%W)]
  219. // CHECK:STDOUT: }
  220. // CHECK:STDOUT: }
  221. // CHECK:STDOUT:
  222. // CHECK:STDOUT: interface @J {
  223. // CHECK:STDOUT: %Self: %J.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1]
  224. // CHECK:STDOUT:
  225. // CHECK:STDOUT: !members:
  226. // CHECK:STDOUT: .Self = %Self
  227. // CHECK:STDOUT: witness = ()
  228. // CHECK:STDOUT: }
  229. // CHECK:STDOUT:
  230. // CHECK:STDOUT: interface @I {
  231. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.2]
  232. // CHECK:STDOUT: %Member: type = assoc_const_decl Member [template]
  233. // CHECK:STDOUT: %.loc7: %.1 = assoc_entity element0, %Member [template = constants.%.2]
  234. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%J.type]
  235. // CHECK:STDOUT: %Second: %J.type = assoc_const_decl Second [template]
  236. // CHECK:STDOUT: %.loc8: %.4 = assoc_entity element1, %Second [template = constants.%.5]
  237. // CHECK:STDOUT:
  238. // CHECK:STDOUT: !members:
  239. // CHECK:STDOUT: .Self = %Self
  240. // CHECK:STDOUT: .Member = %.loc7
  241. // CHECK:STDOUT: .Second = %.loc8
  242. // CHECK:STDOUT: witness = (%Member, %Second)
  243. // CHECK:STDOUT: }
  244. // CHECK:STDOUT:
  245. // CHECK:STDOUT: generic fn @EqualEqual(%U.loc11_15.1: %I.type) {
  246. // CHECK:STDOUT: %U.loc11_15.2: %I.type = bind_symbolic_name U, 0 [symbolic = %U.loc11_15.2 (constants.%U)]
  247. // CHECK:STDOUT: %U.patt.loc11_15.2: %I.type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc11_15.2 (constants.%U.patt)]
  248. // CHECK:STDOUT:
  249. // CHECK:STDOUT: fn(%U.param_patt: %I.type);
  250. // CHECK:STDOUT: }
  251. // CHECK:STDOUT:
  252. // CHECK:STDOUT: generic fn @Impls(%V.loc13_10.1: %J.type) {
  253. // CHECK:STDOUT: %V.loc13_10.2: %J.type = bind_symbolic_name V, 0 [symbolic = %V.loc13_10.2 (constants.%V)]
  254. // CHECK:STDOUT: %V.patt.loc13_10.2: %J.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc13_10.2 (constants.%V.patt)]
  255. // CHECK:STDOUT:
  256. // CHECK:STDOUT: fn(%V.param_patt: %J.type);
  257. // CHECK:STDOUT: }
  258. // CHECK:STDOUT:
  259. // CHECK:STDOUT: generic fn @And(%W.loc15_8.1: %I.type) {
  260. // CHECK:STDOUT: %W.loc15_8.2: %I.type = bind_symbolic_name W, 0 [symbolic = %W.loc15_8.2 (constants.%W)]
  261. // CHECK:STDOUT: %W.patt.loc15_8.2: %I.type = symbolic_binding_pattern W, 0 [symbolic = %W.patt.loc15_8.2 (constants.%W.patt)]
  262. // CHECK:STDOUT:
  263. // CHECK:STDOUT: fn(%W.param_patt: %I.type);
  264. // CHECK:STDOUT: }
  265. // CHECK:STDOUT:
  266. // CHECK:STDOUT: specific @EqualEqual(constants.%U) {
  267. // CHECK:STDOUT: %U.loc11_15.2 => constants.%U
  268. // CHECK:STDOUT: %U.patt.loc11_15.2 => constants.%U
  269. // CHECK:STDOUT: }
  270. // CHECK:STDOUT:
  271. // CHECK:STDOUT: specific @Impls(constants.%V) {
  272. // CHECK:STDOUT: %V.loc13_10.2 => constants.%V
  273. // CHECK:STDOUT: %V.patt.loc13_10.2 => constants.%V
  274. // CHECK:STDOUT: }
  275. // CHECK:STDOUT:
  276. // CHECK:STDOUT: specific @And(constants.%W) {
  277. // CHECK:STDOUT: %W.loc15_8.2 => constants.%W
  278. // CHECK:STDOUT: %W.patt.loc15_8.2 => constants.%W
  279. // CHECK:STDOUT: }
  280. // CHECK:STDOUT:
  281. // CHECK:STDOUT: --- fail_todo_equal_constraint.carbon
  282. // CHECK:STDOUT:
  283. // CHECK:STDOUT: constants {
  284. // CHECK:STDOUT: %N.type: type = interface_type @N [template]
  285. // CHECK:STDOUT: %Self.1: %N.type = bind_symbolic_name Self, 0 [symbolic]
  286. // CHECK:STDOUT: %.1: type = assoc_entity_type %N.type, type [template]
  287. // CHECK:STDOUT: %.2: %.1 = assoc_entity element0, @N.%P [template]
  288. // CHECK:STDOUT: %.Self: %N.type = bind_symbolic_name .Self, 0 [symbolic]
  289. // CHECK:STDOUT: %.3: type = tuple_type () [template]
  290. // CHECK:STDOUT: %.4: type = struct_type {} [template]
  291. // CHECK:STDOUT: %ImplicitAs.type.1: type = generic_interface_type @ImplicitAs [template]
  292. // CHECK:STDOUT: %ImplicitAs: %ImplicitAs.type.1 = struct_value () [template]
  293. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic]
  294. // CHECK:STDOUT: %ImplicitAs.type.2: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic]
  295. // CHECK:STDOUT: %Self.2: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic]
  296. // CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic]
  297. // CHECK:STDOUT: %Self.3: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic]
  298. // CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic]
  299. // CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic]
  300. // CHECK:STDOUT: %.5: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.1 [symbolic]
  301. // CHECK:STDOUT: %.6: %.5 = assoc_entity element0, imports.%import_ref.5 [symbolic]
  302. // CHECK:STDOUT: %ImplicitAs.type.3: type = interface_type @ImplicitAs, @ImplicitAs(%.1) [template]
  303. // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert, @ImplicitAs(%.1) [template]
  304. // CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template]
  305. // CHECK:STDOUT: %.7: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.2 [template]
  306. // CHECK:STDOUT: %.8: %.7 = assoc_entity element0, imports.%import_ref.5 [template]
  307. // CHECK:STDOUT: %.9: %.5 = assoc_entity element0, imports.%import_ref.6 [symbolic]
  308. // CHECK:STDOUT: %struct: %.4 = struct_value () [template]
  309. // CHECK:STDOUT: %T: %N.type = bind_symbolic_name T, 0 [symbolic]
  310. // CHECK:STDOUT: %T.patt: %N.type = symbolic_binding_pattern T, 0 [symbolic]
  311. // CHECK:STDOUT: %Equal.type: type = fn_type @Equal [template]
  312. // CHECK:STDOUT: %Equal: %Equal.type = struct_value () [template]
  313. // CHECK:STDOUT: }
  314. // CHECK:STDOUT:
  315. // CHECK:STDOUT: imports {
  316. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  317. // CHECK:STDOUT: .ImplicitAs = %import_ref.1
  318. // CHECK:STDOUT: import Core//prelude
  319. // CHECK:STDOUT: import Core//prelude/operators
  320. // CHECK:STDOUT: import Core//prelude/types
  321. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  322. // CHECK:STDOUT: import Core//prelude/operators/as
  323. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  324. // CHECK:STDOUT: import Core//prelude/operators/comparison
  325. // CHECK:STDOUT: import Core//prelude/types/bool
  326. // CHECK:STDOUT: }
  327. // CHECK:STDOUT: %import_ref.1: %ImplicitAs.type.1 = import_ref Core//prelude/operators/as, inst+46, loaded [template = constants.%ImplicitAs]
  328. // CHECK:STDOUT: %import_ref.2 = import_ref Core//prelude/operators/as, inst+52, unloaded
  329. // CHECK:STDOUT: %import_ref.3: @ImplicitAs.%.1 (%.5) = import_ref Core//prelude/operators/as, inst+71, loaded [symbolic = @ImplicitAs.%.2 (constants.%.9)]
  330. // CHECK:STDOUT: %import_ref.4 = import_ref Core//prelude/operators/as, inst+64, unloaded
  331. // CHECK:STDOUT: %import_ref.5 = import_ref Core//prelude/operators/as, inst+64, unloaded
  332. // CHECK:STDOUT: %import_ref.6 = import_ref Core//prelude/operators/as, inst+64, unloaded
  333. // CHECK:STDOUT: }
  334. // CHECK:STDOUT:
  335. // CHECK:STDOUT: file {
  336. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  337. // CHECK:STDOUT: .Core = imports.%Core
  338. // CHECK:STDOUT: .N = %N.decl
  339. // CHECK:STDOUT: .Equal = %Equal.decl
  340. // CHECK:STDOUT: }
  341. // CHECK:STDOUT: %Core.import = import Core
  342. // CHECK:STDOUT: %N.decl: type = interface_decl @N [template = constants.%N.type] {} {}
  343. // CHECK:STDOUT: %Equal.decl: %Equal.type = fn_decl @Equal [template = constants.%Equal] {
  344. // CHECK:STDOUT: %T.patt.loc15_10.1: %N.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc15_10.2 (constants.%T.patt)]
  345. // CHECK:STDOUT: %T.param_patt: %N.type = param_pattern %T.patt.loc15_10.1, runtime_param<invalid> [symbolic = %T.patt.loc15_10.2 (constants.%T.patt)]
  346. // CHECK:STDOUT: } {
  347. // CHECK:STDOUT: %N.ref: type = name_ref N, file.%N.decl [template = constants.%N.type]
  348. // CHECK:STDOUT: %.Self: %N.type = bind_symbolic_name .Self, 0 [symbolic = constants.%.Self]
  349. // CHECK:STDOUT: %.Self.ref: %N.type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  350. // CHECK:STDOUT: %P.ref: %.1 = name_ref P, @N.%.loc5 [template = constants.%.2]
  351. // CHECK:STDOUT: %.loc15_28.1: %.4 = struct_literal ()
  352. // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(constants.%.1) [template = constants.%ImplicitAs.type.3]
  353. // CHECK:STDOUT: %.loc15_28.2: %.7 = specific_constant imports.%import_ref.3, @ImplicitAs(constants.%.1) [template = constants.%.8]
  354. // CHECK:STDOUT: %Convert.ref: %.7 = name_ref Convert, %.loc15_28.2 [template = constants.%.8]
  355. // CHECK:STDOUT: %struct: %.4 = struct_value () [template = constants.%struct]
  356. // CHECK:STDOUT: %.loc15_28.3: %.4 = converted %.loc15_28.1, %struct [template = constants.%struct]
  357. // CHECK:STDOUT: %.loc15_28.4: %.1 = converted %.loc15_28.1, <error> [template = <error>]
  358. // CHECK:STDOUT: %.loc15_16: type = where_expr %.Self [template = constants.%N.type] {
  359. // CHECK:STDOUT: requirement_rewrite %P.ref, <error>
  360. // CHECK:STDOUT: }
  361. // CHECK:STDOUT: %param: %N.type = param runtime_param<invalid>
  362. // CHECK:STDOUT: %T.loc15_10.1: %N.type = bind_symbolic_name T, 0, %param [symbolic = %T.loc15_10.2 (constants.%T)]
  363. // CHECK:STDOUT: }
  364. // CHECK:STDOUT: }
  365. // CHECK:STDOUT:
  366. // CHECK:STDOUT: interface @N {
  367. // CHECK:STDOUT: %Self: %N.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1]
  368. // CHECK:STDOUT: %P: type = assoc_const_decl P [template]
  369. // CHECK:STDOUT: %.loc5: %.1 = assoc_entity element0, %P [template = constants.%.2]
  370. // CHECK:STDOUT:
  371. // CHECK:STDOUT: !members:
  372. // CHECK:STDOUT: .Self = %Self
  373. // CHECK:STDOUT: .P = %.loc5
  374. // CHECK:STDOUT: witness = (%P)
  375. // CHECK:STDOUT: }
  376. // CHECK:STDOUT:
  377. // CHECK:STDOUT: generic interface @ImplicitAs(constants.%Dest: type) {
  378. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
  379. // CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)]
  380. // CHECK:STDOUT:
  381. // CHECK:STDOUT: !definition:
  382. // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)]
  383. // CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.3)]
  384. // CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.1)]
  385. // CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)]
  386. // CHECK:STDOUT: %.1: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.1 (constants.%.5)]
  387. // CHECK:STDOUT: %.2: @ImplicitAs.%.1 (%.5) = assoc_entity element0, imports.%import_ref.5 [symbolic = %.2 (constants.%.6)]
  388. // CHECK:STDOUT:
  389. // CHECK:STDOUT: interface {
  390. // CHECK:STDOUT: !members:
  391. // CHECK:STDOUT: .Self = imports.%import_ref.2
  392. // CHECK:STDOUT: .Convert = imports.%import_ref.3
  393. // CHECK:STDOUT: witness = (imports.%import_ref.4)
  394. // CHECK:STDOUT: }
  395. // CHECK:STDOUT: }
  396. // CHECK:STDOUT:
  397. // CHECK:STDOUT: generic fn @Convert(constants.%Dest: type, constants.%Self.2: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2)) {
  398. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
  399. // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)]
  400. // CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.3)]
  401. // CHECK:STDOUT:
  402. // CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self (%Self.3)]() -> @Convert.%Dest (%Dest);
  403. // CHECK:STDOUT: }
  404. // CHECK:STDOUT:
  405. // CHECK:STDOUT: generic fn @Equal(%T.loc15_10.1: %N.type) {
  406. // CHECK:STDOUT: %T.loc15_10.2: %N.type = bind_symbolic_name T, 0 [symbolic = %T.loc15_10.2 (constants.%T)]
  407. // CHECK:STDOUT: %T.patt.loc15_10.2: %N.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc15_10.2 (constants.%T.patt)]
  408. // CHECK:STDOUT:
  409. // CHECK:STDOUT: fn(%T.param_patt: %N.type);
  410. // CHECK:STDOUT: }
  411. // CHECK:STDOUT:
  412. // CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) {
  413. // CHECK:STDOUT: %Dest => constants.%Dest
  414. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  415. // CHECK:STDOUT: }
  416. // CHECK:STDOUT:
  417. // CHECK:STDOUT: specific @ImplicitAs(@ImplicitAs.%Dest) {
  418. // CHECK:STDOUT: %Dest => constants.%Dest
  419. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  420. // CHECK:STDOUT: }
  421. // CHECK:STDOUT:
  422. // CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {
  423. // CHECK:STDOUT: %Dest => constants.%Dest
  424. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  425. // CHECK:STDOUT: }
  426. // CHECK:STDOUT:
  427. // CHECK:STDOUT: specific @Convert(constants.%Dest, constants.%Self.2) {
  428. // CHECK:STDOUT: %Dest => constants.%Dest
  429. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2
  430. // CHECK:STDOUT: %Self => constants.%Self.2
  431. // CHECK:STDOUT: }
  432. // CHECK:STDOUT:
  433. // CHECK:STDOUT: specific @ImplicitAs(constants.%.1) {
  434. // CHECK:STDOUT: %Dest => constants.%.1
  435. // CHECK:STDOUT: %Dest.patt => constants.%.1
  436. // CHECK:STDOUT:
  437. // CHECK:STDOUT: !definition:
  438. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3
  439. // CHECK:STDOUT: %Self => constants.%Self.3
  440. // CHECK:STDOUT: %Convert.type => constants.%Convert.type.2
  441. // CHECK:STDOUT: %Convert => constants.%Convert.2
  442. // CHECK:STDOUT: %.1 => constants.%.7
  443. // CHECK:STDOUT: %.2 => constants.%.8
  444. // CHECK:STDOUT: }
  445. // CHECK:STDOUT:
  446. // CHECK:STDOUT: specific @Equal(constants.%T) {
  447. // CHECK:STDOUT: %T.loc15_10.2 => constants.%T
  448. // CHECK:STDOUT: %T.patt.loc15_10.2 => constants.%T
  449. // CHECK:STDOUT: }
  450. // CHECK:STDOUT:
  451. // CHECK:STDOUT: --- fail_todo_associated_type_impls.carbon
  452. // CHECK:STDOUT:
  453. // CHECK:STDOUT: constants {
  454. // CHECK:STDOUT: %L.type: type = interface_type @L [template]
  455. // CHECK:STDOUT: %Self.1: %L.type = bind_symbolic_name Self, 0 [symbolic]
  456. // CHECK:STDOUT: %M.type: type = interface_type @M [template]
  457. // CHECK:STDOUT: %Self.2: %M.type = bind_symbolic_name Self, 0 [symbolic]
  458. // CHECK:STDOUT: %K.type: type = interface_type @K [template]
  459. // CHECK:STDOUT: %Self.3: %K.type = bind_symbolic_name Self, 0 [symbolic]
  460. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  461. // CHECK:STDOUT: %.2: type = assoc_entity_type %K.type, %L.type [template]
  462. // CHECK:STDOUT: %.3: %.2 = assoc_entity element0, @K.%Associated [template]
  463. // CHECK:STDOUT: %.Self: %K.type = bind_symbolic_name .Self, 0 [symbolic]
  464. // CHECK:STDOUT: %ImplicitAs.type.1: type = generic_interface_type @ImplicitAs [template]
  465. // CHECK:STDOUT: %ImplicitAs: %ImplicitAs.type.1 = struct_value () [template]
  466. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic]
  467. // CHECK:STDOUT: %ImplicitAs.type.2: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic]
  468. // CHECK:STDOUT: %Self.4: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic]
  469. // CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic]
  470. // CHECK:STDOUT: %Self.5: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic]
  471. // CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic]
  472. // CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic]
  473. // CHECK:STDOUT: %.4: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.1 [symbolic]
  474. // CHECK:STDOUT: %.5: %.4 = assoc_entity element0, imports.%import_ref.5 [symbolic]
  475. // CHECK:STDOUT: %ImplicitAs.type.3: type = interface_type @ImplicitAs, @ImplicitAs(type) [template]
  476. // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert, @ImplicitAs(type) [template]
  477. // CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template]
  478. // CHECK:STDOUT: %.6: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.2 [template]
  479. // CHECK:STDOUT: %.7: %.6 = assoc_entity element0, imports.%import_ref.5 [template]
  480. // CHECK:STDOUT: %.8: %.4 = assoc_entity element0, imports.%import_ref.6 [symbolic]
  481. // CHECK:STDOUT: %W: %K.type = bind_symbolic_name W, 0 [symbolic]
  482. // CHECK:STDOUT: %W.patt: %K.type = symbolic_binding_pattern W, 0 [symbolic]
  483. // CHECK:STDOUT: %AssociatedTypeImpls.type: type = fn_type @AssociatedTypeImpls [template]
  484. // CHECK:STDOUT: %AssociatedTypeImpls: %AssociatedTypeImpls.type = struct_value () [template]
  485. // CHECK:STDOUT: }
  486. // CHECK:STDOUT:
  487. // CHECK:STDOUT: imports {
  488. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  489. // CHECK:STDOUT: .ImplicitAs = %import_ref.1
  490. // CHECK:STDOUT: import Core//prelude
  491. // CHECK:STDOUT: import Core//prelude/operators
  492. // CHECK:STDOUT: import Core//prelude/types
  493. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  494. // CHECK:STDOUT: import Core//prelude/operators/as
  495. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  496. // CHECK:STDOUT: import Core//prelude/operators/comparison
  497. // CHECK:STDOUT: import Core//prelude/types/bool
  498. // CHECK:STDOUT: }
  499. // CHECK:STDOUT: %import_ref.1: %ImplicitAs.type.1 = import_ref Core//prelude/operators/as, inst+46, loaded [template = constants.%ImplicitAs]
  500. // CHECK:STDOUT: %import_ref.2 = import_ref Core//prelude/operators/as, inst+52, unloaded
  501. // CHECK:STDOUT: %import_ref.3: @ImplicitAs.%.1 (%.4) = import_ref Core//prelude/operators/as, inst+71, loaded [symbolic = @ImplicitAs.%.2 (constants.%.8)]
  502. // CHECK:STDOUT: %import_ref.4 = import_ref Core//prelude/operators/as, inst+64, unloaded
  503. // CHECK:STDOUT: %import_ref.5 = import_ref Core//prelude/operators/as, inst+64, unloaded
  504. // CHECK:STDOUT: %import_ref.6 = import_ref Core//prelude/operators/as, inst+64, unloaded
  505. // CHECK:STDOUT: }
  506. // CHECK:STDOUT:
  507. // CHECK:STDOUT: file {
  508. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  509. // CHECK:STDOUT: .Core = imports.%Core
  510. // CHECK:STDOUT: .L = %L.decl
  511. // CHECK:STDOUT: .M = %M.decl
  512. // CHECK:STDOUT: .K = %K.decl
  513. // CHECK:STDOUT: .AssociatedTypeImpls = %AssociatedTypeImpls.decl
  514. // CHECK:STDOUT: }
  515. // CHECK:STDOUT: %Core.import = import Core
  516. // CHECK:STDOUT: %L.decl: type = interface_decl @L [template = constants.%L.type] {} {}
  517. // CHECK:STDOUT: %M.decl: type = interface_decl @M [template = constants.%M.type] {} {}
  518. // CHECK:STDOUT: %K.decl: type = interface_decl @K [template = constants.%K.type] {} {}
  519. // CHECK:STDOUT: %AssociatedTypeImpls.decl: %AssociatedTypeImpls.type = fn_decl @AssociatedTypeImpls [template = constants.%AssociatedTypeImpls] {
  520. // CHECK:STDOUT: %W.patt.loc18_24.1: %K.type = symbolic_binding_pattern W, 0 [symbolic = %W.patt.loc18_24.2 (constants.%W.patt)]
  521. // CHECK:STDOUT: %W.param_patt: %K.type = param_pattern %W.patt.loc18_24.1, runtime_param<invalid> [symbolic = %W.patt.loc18_24.2 (constants.%W.patt)]
  522. // CHECK:STDOUT: } {
  523. // CHECK:STDOUT: %K.ref: type = name_ref K, file.%K.decl [template = constants.%K.type]
  524. // CHECK:STDOUT: %.Self: %K.type = bind_symbolic_name .Self, 0 [symbolic = constants.%.Self]
  525. // CHECK:STDOUT: %.Self.ref: %K.type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  526. // CHECK:STDOUT: %Associated.ref: %.2 = name_ref Associated, @K.%.loc8 [template = constants.%.3]
  527. // CHECK:STDOUT: %M.ref: type = name_ref M, file.%M.decl [template = constants.%M.type]
  528. // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(type) [template = constants.%ImplicitAs.type.3]
  529. // CHECK:STDOUT: %.loc18_36.1: %.6 = specific_constant imports.%import_ref.3, @ImplicitAs(type) [template = constants.%.7]
  530. // CHECK:STDOUT: %Convert.ref: %.6 = name_ref Convert, %.loc18_36.1 [template = constants.%.7]
  531. // CHECK:STDOUT: %.loc18_36.2: type = converted %Associated.ref, <error> [template = <error>]
  532. // CHECK:STDOUT: %.loc18_30: type = where_expr %.Self [template = constants.%K.type] {
  533. // CHECK:STDOUT: requirement_impls <error>, %M.ref
  534. // CHECK:STDOUT: }
  535. // CHECK:STDOUT: %param: %K.type = param runtime_param<invalid>
  536. // CHECK:STDOUT: %W.loc18_24.1: %K.type = bind_symbolic_name W, 0, %param [symbolic = %W.loc18_24.2 (constants.%W)]
  537. // CHECK:STDOUT: }
  538. // CHECK:STDOUT: }
  539. // CHECK:STDOUT:
  540. // CHECK:STDOUT: interface @L {
  541. // CHECK:STDOUT: %Self: %L.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1]
  542. // CHECK:STDOUT:
  543. // CHECK:STDOUT: !members:
  544. // CHECK:STDOUT: .Self = %Self
  545. // CHECK:STDOUT: witness = ()
  546. // CHECK:STDOUT: }
  547. // CHECK:STDOUT:
  548. // CHECK:STDOUT: interface @M {
  549. // CHECK:STDOUT: %Self: %M.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.2]
  550. // CHECK:STDOUT:
  551. // CHECK:STDOUT: !members:
  552. // CHECK:STDOUT: .Self = %Self
  553. // CHECK:STDOUT: witness = ()
  554. // CHECK:STDOUT: }
  555. // CHECK:STDOUT:
  556. // CHECK:STDOUT: interface @K {
  557. // CHECK:STDOUT: %Self: %K.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.3]
  558. // CHECK:STDOUT: %L.ref: type = name_ref L, file.%L.decl [template = constants.%L.type]
  559. // CHECK:STDOUT: %Associated: %L.type = assoc_const_decl Associated [template]
  560. // CHECK:STDOUT: %.loc8: %.2 = assoc_entity element0, %Associated [template = constants.%.3]
  561. // CHECK:STDOUT:
  562. // CHECK:STDOUT: !members:
  563. // CHECK:STDOUT: .Self = %Self
  564. // CHECK:STDOUT: .Associated = %.loc8
  565. // CHECK:STDOUT: witness = (%Associated)
  566. // CHECK:STDOUT: }
  567. // CHECK:STDOUT:
  568. // CHECK:STDOUT: generic interface @ImplicitAs(constants.%Dest: type) {
  569. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
  570. // CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)]
  571. // CHECK:STDOUT:
  572. // CHECK:STDOUT: !definition:
  573. // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)]
  574. // CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.5)]
  575. // CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.1)]
  576. // CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)]
  577. // CHECK:STDOUT: %.1: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.1 (constants.%.4)]
  578. // CHECK:STDOUT: %.2: @ImplicitAs.%.1 (%.4) = assoc_entity element0, imports.%import_ref.5 [symbolic = %.2 (constants.%.5)]
  579. // CHECK:STDOUT:
  580. // CHECK:STDOUT: interface {
  581. // CHECK:STDOUT: !members:
  582. // CHECK:STDOUT: .Self = imports.%import_ref.2
  583. // CHECK:STDOUT: .Convert = imports.%import_ref.3
  584. // CHECK:STDOUT: witness = (imports.%import_ref.4)
  585. // CHECK:STDOUT: }
  586. // CHECK:STDOUT: }
  587. // CHECK:STDOUT:
  588. // CHECK:STDOUT: generic fn @Convert(constants.%Dest: type, constants.%Self.4: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2)) {
  589. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
  590. // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)]
  591. // CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.5)]
  592. // CHECK:STDOUT:
  593. // CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self (%Self.5)]() -> @Convert.%Dest (%Dest);
  594. // CHECK:STDOUT: }
  595. // CHECK:STDOUT:
  596. // CHECK:STDOUT: generic fn @AssociatedTypeImpls(%W.loc18_24.1: %K.type) {
  597. // CHECK:STDOUT: %W.loc18_24.2: %K.type = bind_symbolic_name W, 0 [symbolic = %W.loc18_24.2 (constants.%W)]
  598. // CHECK:STDOUT: %W.patt.loc18_24.2: %K.type = symbolic_binding_pattern W, 0 [symbolic = %W.patt.loc18_24.2 (constants.%W.patt)]
  599. // CHECK:STDOUT:
  600. // CHECK:STDOUT: fn(%W.param_patt: %K.type);
  601. // CHECK:STDOUT: }
  602. // CHECK:STDOUT:
  603. // CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) {
  604. // CHECK:STDOUT: %Dest => constants.%Dest
  605. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  606. // CHECK:STDOUT: }
  607. // CHECK:STDOUT:
  608. // CHECK:STDOUT: specific @ImplicitAs(@ImplicitAs.%Dest) {
  609. // CHECK:STDOUT: %Dest => constants.%Dest
  610. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  611. // CHECK:STDOUT: }
  612. // CHECK:STDOUT:
  613. // CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {
  614. // CHECK:STDOUT: %Dest => constants.%Dest
  615. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  616. // CHECK:STDOUT: }
  617. // CHECK:STDOUT:
  618. // CHECK:STDOUT: specific @Convert(constants.%Dest, constants.%Self.4) {
  619. // CHECK:STDOUT: %Dest => constants.%Dest
  620. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2
  621. // CHECK:STDOUT: %Self => constants.%Self.4
  622. // CHECK:STDOUT: }
  623. // CHECK:STDOUT:
  624. // CHECK:STDOUT: specific @ImplicitAs(type) {
  625. // CHECK:STDOUT: %Dest => type
  626. // CHECK:STDOUT: %Dest.patt => type
  627. // CHECK:STDOUT:
  628. // CHECK:STDOUT: !definition:
  629. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3
  630. // CHECK:STDOUT: %Self => constants.%Self.5
  631. // CHECK:STDOUT: %Convert.type => constants.%Convert.type.2
  632. // CHECK:STDOUT: %Convert => constants.%Convert.2
  633. // CHECK:STDOUT: %.1 => constants.%.6
  634. // CHECK:STDOUT: %.2 => constants.%.7
  635. // CHECK:STDOUT: }
  636. // CHECK:STDOUT:
  637. // CHECK:STDOUT: specific @AssociatedTypeImpls(constants.%W) {
  638. // CHECK:STDOUT: %W.loc18_24.2 => constants.%W
  639. // CHECK:STDOUT: %W.patt.loc18_24.2 => constants.%W
  640. // CHECK:STDOUT: }
  641. // CHECK:STDOUT:
  642. // CHECK:STDOUT: --- fail_check_rewrite_constraints.carbon
  643. // CHECK:STDOUT:
  644. // CHECK:STDOUT: constants {
  645. // CHECK:STDOUT: %I.type: type = interface_type @I [template]
  646. // CHECK:STDOUT: %Self.1: %I.type = bind_symbolic_name Self, 0 [symbolic]
  647. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self, 0 [symbolic]
  648. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  649. // CHECK:STDOUT: %.2: type = assoc_entity_type %I.type, type [template]
  650. // CHECK:STDOUT: %.3: %.2 = assoc_entity element0, imports.%import_ref.11 [template]
  651. // CHECK:STDOUT: %.4: i32 = int_literal 2 [template]
  652. // CHECK:STDOUT: %ImplicitAs.type.1: type = generic_interface_type @ImplicitAs [template]
  653. // CHECK:STDOUT: %ImplicitAs: %ImplicitAs.type.1 = struct_value () [template]
  654. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic]
  655. // CHECK:STDOUT: %ImplicitAs.type.2: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic]
  656. // CHECK:STDOUT: %Self.2: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic]
  657. // CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic]
  658. // CHECK:STDOUT: %Self.3: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic]
  659. // CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic]
  660. // CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic]
  661. // CHECK:STDOUT: %.5: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.1 [symbolic]
  662. // CHECK:STDOUT: %.6: %.5 = assoc_entity element0, imports.%import_ref.16 [symbolic]
  663. // CHECK:STDOUT: %ImplicitAs.type.3: type = interface_type @ImplicitAs, @ImplicitAs(%.2) [template]
  664. // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert, @ImplicitAs(%.2) [template]
  665. // CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template]
  666. // CHECK:STDOUT: %.7: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.2 [template]
  667. // CHECK:STDOUT: %.8: %.7 = assoc_entity element0, imports.%import_ref.16 [template]
  668. // CHECK:STDOUT: %.9: %.5 = assoc_entity element0, imports.%import_ref.17 [symbolic]
  669. // CHECK:STDOUT: %X: %I.type = bind_symbolic_name X, 0 [symbolic]
  670. // CHECK:STDOUT: %X.patt: %I.type = symbolic_binding_pattern X, 0 [symbolic]
  671. // CHECK:STDOUT: %RewriteTypeMismatch.type: type = fn_type @RewriteTypeMismatch [template]
  672. // CHECK:STDOUT: %RewriteTypeMismatch: %RewriteTypeMismatch.type = struct_value () [template]
  673. // CHECK:STDOUT: }
  674. // CHECK:STDOUT:
  675. // CHECK:STDOUT: imports {
  676. // CHECK:STDOUT: %import_ref.1 = import_ref Main//state_constraints, inst+3, unloaded
  677. // CHECK:STDOUT: %import_ref.2: type = import_ref Main//state_constraints, inst+7, loaded [template = constants.%I.type]
  678. // CHECK:STDOUT: %import_ref.3 = import_ref Main//state_constraints, inst+34, unloaded
  679. // CHECK:STDOUT: %import_ref.4 = import_ref Main//state_constraints, inst+54, unloaded
  680. // CHECK:STDOUT: %import_ref.5 = import_ref Main//state_constraints, inst+77, unloaded
  681. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  682. // CHECK:STDOUT: .ImplicitAs = %import_ref.12
  683. // CHECK:STDOUT: import Core//prelude
  684. // CHECK:STDOUT: import Core//prelude/operators
  685. // CHECK:STDOUT: import Core//prelude/types
  686. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  687. // CHECK:STDOUT: import Core//prelude/operators/as
  688. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  689. // CHECK:STDOUT: import Core//prelude/operators/comparison
  690. // CHECK:STDOUT: import Core//prelude/types/bool
  691. // CHECK:STDOUT: }
  692. // CHECK:STDOUT: %import_ref.6 = import_ref Main//state_constraints, inst+9, unloaded
  693. // CHECK:STDOUT: %import_ref.7: %.2 = import_ref Main//state_constraints, inst+13, loaded [template = constants.%.3]
  694. // CHECK:STDOUT: %import_ref.8 = import_ref Main//state_constraints, inst+19, unloaded
  695. // CHECK:STDOUT: %import_ref.9 = import_ref Main//state_constraints, inst+11, unloaded
  696. // CHECK:STDOUT: %import_ref.10 = import_ref Main//state_constraints, inst+17, unloaded
  697. // CHECK:STDOUT: %import_ref.11 = import_ref Main//state_constraints, inst+11, unloaded
  698. // CHECK:STDOUT: %import_ref.12: %ImplicitAs.type.1 = import_ref Core//prelude/operators/as, inst+46, loaded [template = constants.%ImplicitAs]
  699. // CHECK:STDOUT: %import_ref.13 = import_ref Core//prelude/operators/as, inst+52, unloaded
  700. // CHECK:STDOUT: %import_ref.14: @ImplicitAs.%.1 (%.5) = import_ref Core//prelude/operators/as, inst+71, loaded [symbolic = @ImplicitAs.%.2 (constants.%.9)]
  701. // CHECK:STDOUT: %import_ref.15 = import_ref Core//prelude/operators/as, inst+64, unloaded
  702. // CHECK:STDOUT: %import_ref.16 = import_ref Core//prelude/operators/as, inst+64, unloaded
  703. // CHECK:STDOUT: %import_ref.17 = import_ref Core//prelude/operators/as, inst+64, unloaded
  704. // CHECK:STDOUT: }
  705. // CHECK:STDOUT:
  706. // CHECK:STDOUT: file {
  707. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  708. // CHECK:STDOUT: .J = imports.%import_ref.1
  709. // CHECK:STDOUT: .I = imports.%import_ref.2
  710. // CHECK:STDOUT: .EqualEqual = imports.%import_ref.3
  711. // CHECK:STDOUT: .Impls = imports.%import_ref.4
  712. // CHECK:STDOUT: .And = imports.%import_ref.5
  713. // CHECK:STDOUT: .Core = imports.%Core
  714. // CHECK:STDOUT: .RewriteTypeMismatch = %RewriteTypeMismatch.decl
  715. // CHECK:STDOUT: }
  716. // CHECK:STDOUT: %Core.import = import Core
  717. // CHECK:STDOUT: %default.import = import <invalid>
  718. // CHECK:STDOUT: %RewriteTypeMismatch.decl: %RewriteTypeMismatch.type = fn_decl @RewriteTypeMismatch [template = constants.%RewriteTypeMismatch] {
  719. // CHECK:STDOUT: %X.patt.loc16_24.1: %I.type = symbolic_binding_pattern X, 0 [symbolic = %X.patt.loc16_24.2 (constants.%X.patt)]
  720. // CHECK:STDOUT: %X.param_patt: %I.type = param_pattern %X.patt.loc16_24.1, runtime_param<invalid> [symbolic = %X.patt.loc16_24.2 (constants.%X.patt)]
  721. // CHECK:STDOUT: } {
  722. // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%import_ref.2 [template = constants.%I.type]
  723. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self, 0 [symbolic = constants.%.Self]
  724. // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  725. // CHECK:STDOUT: %Member.ref: %.2 = name_ref Member, imports.%import_ref.7 [template = constants.%.3]
  726. // CHECK:STDOUT: %.loc16_46.1: i32 = int_literal 2 [template = constants.%.4]
  727. // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(constants.%.2) [template = constants.%ImplicitAs.type.3]
  728. // CHECK:STDOUT: %.loc16_46.2: %.7 = specific_constant imports.%import_ref.14, @ImplicitAs(constants.%.2) [template = constants.%.8]
  729. // CHECK:STDOUT: %Convert.ref: %.7 = name_ref Convert, %.loc16_46.2 [template = constants.%.8]
  730. // CHECK:STDOUT: %.loc16_46.3: %.2 = converted %.loc16_46.1, <error> [template = <error>]
  731. // CHECK:STDOUT: %.loc16_30: type = where_expr %.Self [template = constants.%I.type] {
  732. // CHECK:STDOUT: requirement_rewrite %Member.ref, <error>
  733. // CHECK:STDOUT: }
  734. // CHECK:STDOUT: %param: %I.type = param runtime_param<invalid>
  735. // CHECK:STDOUT: %X.loc16_24.1: %I.type = bind_symbolic_name X, 0, %param [symbolic = %X.loc16_24.2 (constants.%X)]
  736. // CHECK:STDOUT: }
  737. // CHECK:STDOUT: }
  738. // CHECK:STDOUT:
  739. // CHECK:STDOUT: interface @I {
  740. // CHECK:STDOUT: !members:
  741. // CHECK:STDOUT: .Self = imports.%import_ref.6
  742. // CHECK:STDOUT: .Member = imports.%import_ref.7
  743. // CHECK:STDOUT: .Second = imports.%import_ref.8
  744. // CHECK:STDOUT: witness = (imports.%import_ref.9, imports.%import_ref.10)
  745. // CHECK:STDOUT: }
  746. // CHECK:STDOUT:
  747. // CHECK:STDOUT: generic interface @ImplicitAs(constants.%Dest: type) {
  748. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
  749. // CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)]
  750. // CHECK:STDOUT:
  751. // CHECK:STDOUT: !definition:
  752. // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)]
  753. // CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.3)]
  754. // CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.1)]
  755. // CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)]
  756. // CHECK:STDOUT: %.1: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.1 (constants.%.5)]
  757. // CHECK:STDOUT: %.2: @ImplicitAs.%.1 (%.5) = assoc_entity element0, imports.%import_ref.16 [symbolic = %.2 (constants.%.6)]
  758. // CHECK:STDOUT:
  759. // CHECK:STDOUT: interface {
  760. // CHECK:STDOUT: !members:
  761. // CHECK:STDOUT: .Self = imports.%import_ref.13
  762. // CHECK:STDOUT: .Convert = imports.%import_ref.14
  763. // CHECK:STDOUT: witness = (imports.%import_ref.15)
  764. // CHECK:STDOUT: }
  765. // CHECK:STDOUT: }
  766. // CHECK:STDOUT:
  767. // CHECK:STDOUT: generic fn @Convert(constants.%Dest: type, constants.%Self.2: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2)) {
  768. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
  769. // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)]
  770. // CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.3)]
  771. // CHECK:STDOUT:
  772. // CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self (%Self.3)]() -> @Convert.%Dest (%Dest);
  773. // CHECK:STDOUT: }
  774. // CHECK:STDOUT:
  775. // CHECK:STDOUT: generic fn @RewriteTypeMismatch(%X.loc16_24.1: %I.type) {
  776. // CHECK:STDOUT: %X.loc16_24.2: %I.type = bind_symbolic_name X, 0 [symbolic = %X.loc16_24.2 (constants.%X)]
  777. // CHECK:STDOUT: %X.patt.loc16_24.2: %I.type = symbolic_binding_pattern X, 0 [symbolic = %X.patt.loc16_24.2 (constants.%X.patt)]
  778. // CHECK:STDOUT:
  779. // CHECK:STDOUT: fn(%X.param_patt: %I.type);
  780. // CHECK:STDOUT: }
  781. // CHECK:STDOUT:
  782. // CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) {
  783. // CHECK:STDOUT: %Dest => constants.%Dest
  784. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  785. // CHECK:STDOUT: }
  786. // CHECK:STDOUT:
  787. // CHECK:STDOUT: specific @ImplicitAs(@ImplicitAs.%Dest) {
  788. // CHECK:STDOUT: %Dest => constants.%Dest
  789. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  790. // CHECK:STDOUT: }
  791. // CHECK:STDOUT:
  792. // CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {
  793. // CHECK:STDOUT: %Dest => constants.%Dest
  794. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  795. // CHECK:STDOUT: }
  796. // CHECK:STDOUT:
  797. // CHECK:STDOUT: specific @Convert(constants.%Dest, constants.%Self.2) {
  798. // CHECK:STDOUT: %Dest => constants.%Dest
  799. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2
  800. // CHECK:STDOUT: %Self => constants.%Self.2
  801. // CHECK:STDOUT: }
  802. // CHECK:STDOUT:
  803. // CHECK:STDOUT: specific @ImplicitAs(constants.%.2) {
  804. // CHECK:STDOUT: %Dest => constants.%.2
  805. // CHECK:STDOUT: %Dest.patt => constants.%.2
  806. // CHECK:STDOUT:
  807. // CHECK:STDOUT: !definition:
  808. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3
  809. // CHECK:STDOUT: %Self => constants.%Self.3
  810. // CHECK:STDOUT: %Convert.type => constants.%Convert.type.2
  811. // CHECK:STDOUT: %Convert => constants.%Convert.2
  812. // CHECK:STDOUT: %.1 => constants.%.7
  813. // CHECK:STDOUT: %.2 => constants.%.8
  814. // CHECK:STDOUT: }
  815. // CHECK:STDOUT:
  816. // CHECK:STDOUT: specific @RewriteTypeMismatch(constants.%X) {
  817. // CHECK:STDOUT: %X.loc16_24.2 => constants.%X
  818. // CHECK:STDOUT: %X.patt.loc16_24.2 => constants.%X
  819. // CHECK:STDOUT: }
  820. // CHECK:STDOUT:
  821. // CHECK:STDOUT: --- fail_left_of_impls_non_type.carbon
  822. // CHECK:STDOUT:
  823. // CHECK:STDOUT: constants {
  824. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self, 0 [symbolic]
  825. // CHECK:STDOUT: %.1: i32 = int_literal 7 [template]
  826. // CHECK:STDOUT: %ImplicitAs.type.1: type = generic_interface_type @ImplicitAs [template]
  827. // CHECK:STDOUT: %.2: type = tuple_type () [template]
  828. // CHECK:STDOUT: %ImplicitAs: %ImplicitAs.type.1 = struct_value () [template]
  829. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic]
  830. // CHECK:STDOUT: %ImplicitAs.type.2: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic]
  831. // CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic]
  832. // CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic]
  833. // CHECK:STDOUT: %Self.2: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic]
  834. // CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic]
  835. // CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic]
  836. // CHECK:STDOUT: %.3: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.1 [symbolic]
  837. // CHECK:STDOUT: %.4: %.3 = assoc_entity element0, imports.%import_ref.5 [symbolic]
  838. // CHECK:STDOUT: %ImplicitAs.type.3: type = interface_type @ImplicitAs, @ImplicitAs(type) [template]
  839. // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert, @ImplicitAs(type) [template]
  840. // CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template]
  841. // CHECK:STDOUT: %.5: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.2 [template]
  842. // CHECK:STDOUT: %.6: %.5 = assoc_entity element0, imports.%import_ref.5 [template]
  843. // CHECK:STDOUT: %.7: %.3 = assoc_entity element0, imports.%import_ref.6 [symbolic]
  844. // CHECK:STDOUT: %U: type = bind_symbolic_name U, 0 [symbolic]
  845. // CHECK:STDOUT: %U.patt: type = symbolic_binding_pattern U, 0 [symbolic]
  846. // CHECK:STDOUT: %NonTypeImpls.type: type = fn_type @NonTypeImpls [template]
  847. // CHECK:STDOUT: %NonTypeImpls: %NonTypeImpls.type = struct_value () [template]
  848. // CHECK:STDOUT: }
  849. // CHECK:STDOUT:
  850. // CHECK:STDOUT: imports {
  851. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  852. // CHECK:STDOUT: .ImplicitAs = %import_ref.1
  853. // CHECK:STDOUT: import Core//prelude
  854. // CHECK:STDOUT: import Core//prelude/operators
  855. // CHECK:STDOUT: import Core//prelude/types
  856. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  857. // CHECK:STDOUT: import Core//prelude/operators/as
  858. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  859. // CHECK:STDOUT: import Core//prelude/operators/comparison
  860. // CHECK:STDOUT: import Core//prelude/types/bool
  861. // CHECK:STDOUT: }
  862. // CHECK:STDOUT: %import_ref.1: %ImplicitAs.type.1 = import_ref Core//prelude/operators/as, inst+46, loaded [template = constants.%ImplicitAs]
  863. // CHECK:STDOUT: %import_ref.2 = import_ref Core//prelude/operators/as, inst+52, unloaded
  864. // CHECK:STDOUT: %import_ref.3: @ImplicitAs.%.1 (%.3) = import_ref Core//prelude/operators/as, inst+71, loaded [symbolic = @ImplicitAs.%.2 (constants.%.7)]
  865. // CHECK:STDOUT: %import_ref.4 = import_ref Core//prelude/operators/as, inst+64, unloaded
  866. // CHECK:STDOUT: %import_ref.5 = import_ref Core//prelude/operators/as, inst+64, unloaded
  867. // CHECK:STDOUT: %import_ref.6 = import_ref Core//prelude/operators/as, inst+64, unloaded
  868. // CHECK:STDOUT: }
  869. // CHECK:STDOUT:
  870. // CHECK:STDOUT: file {
  871. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  872. // CHECK:STDOUT: .Core = imports.%Core
  873. // CHECK:STDOUT: .NonTypeImpls = %NonTypeImpls.decl
  874. // CHECK:STDOUT: }
  875. // CHECK:STDOUT: %Core.import = import Core
  876. // CHECK:STDOUT: %NonTypeImpls.decl: %NonTypeImpls.type = fn_decl @NonTypeImpls [template = constants.%NonTypeImpls] {
  877. // CHECK:STDOUT: %U.patt.loc11_17.1: type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc11_17.2 (constants.%U.patt)]
  878. // CHECK:STDOUT: %U.param_patt: type = param_pattern %U.patt.loc11_17.1, runtime_param<invalid> [symbolic = %U.patt.loc11_17.2 (constants.%U.patt)]
  879. // CHECK:STDOUT: } {
  880. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self, 0 [symbolic = constants.%.Self]
  881. // CHECK:STDOUT: %.loc11_32.1: i32 = int_literal 7 [template = constants.%.1]
  882. // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(type) [template = constants.%ImplicitAs.type.3]
  883. // CHECK:STDOUT: %.loc11_32.2: %.5 = specific_constant imports.%import_ref.3, @ImplicitAs(type) [template = constants.%.6]
  884. // CHECK:STDOUT: %Convert.ref: %.5 = name_ref Convert, %.loc11_32.2 [template = constants.%.6]
  885. // CHECK:STDOUT: %.loc11_32.3: type = converted %.loc11_32.1, <error> [template = <error>]
  886. // CHECK:STDOUT: %.loc11_26: type = where_expr %.Self [template = type] {
  887. // CHECK:STDOUT: requirement_impls <error>, type
  888. // CHECK:STDOUT: }
  889. // CHECK:STDOUT: %param: type = param runtime_param<invalid>
  890. // CHECK:STDOUT: %U.loc11_17.1: type = bind_symbolic_name U, 0, %param [symbolic = %U.loc11_17.2 (constants.%U)]
  891. // CHECK:STDOUT: }
  892. // CHECK:STDOUT: }
  893. // CHECK:STDOUT:
  894. // CHECK:STDOUT: generic interface @ImplicitAs(constants.%Dest: type) {
  895. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
  896. // CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)]
  897. // CHECK:STDOUT:
  898. // CHECK:STDOUT: !definition:
  899. // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)]
  900. // CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)]
  901. // CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.1)]
  902. // CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)]
  903. // CHECK:STDOUT: %.1: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.1 (constants.%.3)]
  904. // CHECK:STDOUT: %.2: @ImplicitAs.%.1 (%.3) = assoc_entity element0, imports.%import_ref.5 [symbolic = %.2 (constants.%.4)]
  905. // CHECK:STDOUT:
  906. // CHECK:STDOUT: interface {
  907. // CHECK:STDOUT: !members:
  908. // CHECK:STDOUT: .Self = imports.%import_ref.2
  909. // CHECK:STDOUT: .Convert = imports.%import_ref.3
  910. // CHECK:STDOUT: witness = (imports.%import_ref.4)
  911. // CHECK:STDOUT: }
  912. // CHECK:STDOUT: }
  913. // CHECK:STDOUT:
  914. // CHECK:STDOUT: generic fn @Convert(constants.%Dest: type, constants.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2)) {
  915. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
  916. // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)]
  917. // CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)]
  918. // CHECK:STDOUT:
  919. // CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self (%Self.2)]() -> @Convert.%Dest (%Dest);
  920. // CHECK:STDOUT: }
  921. // CHECK:STDOUT:
  922. // CHECK:STDOUT: generic fn @NonTypeImpls(%U.loc11_17.1: type) {
  923. // CHECK:STDOUT: %U.loc11_17.2: type = bind_symbolic_name U, 0 [symbolic = %U.loc11_17.2 (constants.%U)]
  924. // CHECK:STDOUT: %U.patt.loc11_17.2: type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc11_17.2 (constants.%U.patt)]
  925. // CHECK:STDOUT:
  926. // CHECK:STDOUT: fn(%U.param_patt: type);
  927. // CHECK:STDOUT: }
  928. // CHECK:STDOUT:
  929. // CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) {
  930. // CHECK:STDOUT: %Dest => constants.%Dest
  931. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  932. // CHECK:STDOUT: }
  933. // CHECK:STDOUT:
  934. // CHECK:STDOUT: specific @ImplicitAs(@ImplicitAs.%Dest) {
  935. // CHECK:STDOUT: %Dest => constants.%Dest
  936. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  937. // CHECK:STDOUT: }
  938. // CHECK:STDOUT:
  939. // CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {
  940. // CHECK:STDOUT: %Dest => constants.%Dest
  941. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  942. // CHECK:STDOUT: }
  943. // CHECK:STDOUT:
  944. // CHECK:STDOUT: specific @Convert(constants.%Dest, constants.%Self.1) {
  945. // CHECK:STDOUT: %Dest => constants.%Dest
  946. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2
  947. // CHECK:STDOUT: %Self => constants.%Self.1
  948. // CHECK:STDOUT: }
  949. // CHECK:STDOUT:
  950. // CHECK:STDOUT: specific @ImplicitAs(type) {
  951. // CHECK:STDOUT: %Dest => type
  952. // CHECK:STDOUT: %Dest.patt => type
  953. // CHECK:STDOUT:
  954. // CHECK:STDOUT: !definition:
  955. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3
  956. // CHECK:STDOUT: %Self => constants.%Self.2
  957. // CHECK:STDOUT: %Convert.type => constants.%Convert.type.2
  958. // CHECK:STDOUT: %Convert => constants.%Convert.2
  959. // CHECK:STDOUT: %.1 => constants.%.5
  960. // CHECK:STDOUT: %.2 => constants.%.6
  961. // CHECK:STDOUT: }
  962. // CHECK:STDOUT:
  963. // CHECK:STDOUT: specific @NonTypeImpls(constants.%U) {
  964. // CHECK:STDOUT: %U.loc11_17.2 => constants.%U
  965. // CHECK:STDOUT: %U.patt.loc11_17.2 => constants.%U
  966. // CHECK:STDOUT: }
  967. // CHECK:STDOUT:
  968. // CHECK:STDOUT: --- fail_right_of_impls_non_type.carbon
  969. // CHECK:STDOUT:
  970. // CHECK:STDOUT: constants {
  971. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self, 0 [symbolic]
  972. // CHECK:STDOUT: %.1: i32 = int_literal 7 [template]
  973. // CHECK:STDOUT: %ImplicitAs.type.1: type = generic_interface_type @ImplicitAs [template]
  974. // CHECK:STDOUT: %.2: type = tuple_type () [template]
  975. // CHECK:STDOUT: %ImplicitAs: %ImplicitAs.type.1 = struct_value () [template]
  976. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic]
  977. // CHECK:STDOUT: %ImplicitAs.type.2: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic]
  978. // CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic]
  979. // CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic]
  980. // CHECK:STDOUT: %Self.2: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic]
  981. // CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic]
  982. // CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic]
  983. // CHECK:STDOUT: %.3: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.1 [symbolic]
  984. // CHECK:STDOUT: %.4: %.3 = assoc_entity element0, imports.%import_ref.5 [symbolic]
  985. // CHECK:STDOUT: %ImplicitAs.type.3: type = interface_type @ImplicitAs, @ImplicitAs(type) [template]
  986. // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert, @ImplicitAs(type) [template]
  987. // CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template]
  988. // CHECK:STDOUT: %.5: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.2 [template]
  989. // CHECK:STDOUT: %.6: %.5 = assoc_entity element0, imports.%import_ref.5 [template]
  990. // CHECK:STDOUT: %.7: %.3 = assoc_entity element0, imports.%import_ref.6 [symbolic]
  991. // CHECK:STDOUT: %U: type = bind_symbolic_name U, 0 [symbolic]
  992. // CHECK:STDOUT: %U.patt: type = symbolic_binding_pattern U, 0 [symbolic]
  993. // CHECK:STDOUT: %ImplsNonType.type: type = fn_type @ImplsNonType [template]
  994. // CHECK:STDOUT: %ImplsNonType: %ImplsNonType.type = struct_value () [template]
  995. // CHECK:STDOUT: }
  996. // CHECK:STDOUT:
  997. // CHECK:STDOUT: imports {
  998. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  999. // CHECK:STDOUT: .ImplicitAs = %import_ref.1
  1000. // CHECK:STDOUT: import Core//prelude
  1001. // CHECK:STDOUT: import Core//prelude/operators
  1002. // CHECK:STDOUT: import Core//prelude/types
  1003. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  1004. // CHECK:STDOUT: import Core//prelude/operators/as
  1005. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  1006. // CHECK:STDOUT: import Core//prelude/operators/comparison
  1007. // CHECK:STDOUT: import Core//prelude/types/bool
  1008. // CHECK:STDOUT: }
  1009. // CHECK:STDOUT: %import_ref.1: %ImplicitAs.type.1 = import_ref Core//prelude/operators/as, inst+46, loaded [template = constants.%ImplicitAs]
  1010. // CHECK:STDOUT: %import_ref.2 = import_ref Core//prelude/operators/as, inst+52, unloaded
  1011. // CHECK:STDOUT: %import_ref.3: @ImplicitAs.%.1 (%.3) = import_ref Core//prelude/operators/as, inst+71, loaded [symbolic = @ImplicitAs.%.2 (constants.%.7)]
  1012. // CHECK:STDOUT: %import_ref.4 = import_ref Core//prelude/operators/as, inst+64, unloaded
  1013. // CHECK:STDOUT: %import_ref.5 = import_ref Core//prelude/operators/as, inst+64, unloaded
  1014. // CHECK:STDOUT: %import_ref.6 = import_ref Core//prelude/operators/as, inst+64, unloaded
  1015. // CHECK:STDOUT: }
  1016. // CHECK:STDOUT:
  1017. // CHECK:STDOUT: file {
  1018. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1019. // CHECK:STDOUT: .Core = imports.%Core
  1020. // CHECK:STDOUT: .ImplsNonType = %ImplsNonType.decl
  1021. // CHECK:STDOUT: }
  1022. // CHECK:STDOUT: %Core.import = import Core
  1023. // CHECK:STDOUT: %ImplsNonType.decl: %ImplsNonType.type = fn_decl @ImplsNonType [template = constants.%ImplsNonType] {
  1024. // CHECK:STDOUT: %U.patt.loc11_17.1: type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc11_17.2 (constants.%U.patt)]
  1025. // CHECK:STDOUT: %U.param_patt: type = param_pattern %U.patt.loc11_17.1, runtime_param<invalid> [symbolic = %U.patt.loc11_17.2 (constants.%U.patt)]
  1026. // CHECK:STDOUT: } {
  1027. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self, 0 [symbolic = constants.%.Self]
  1028. // CHECK:STDOUT: %.Self.ref: type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  1029. // CHECK:STDOUT: %.loc11_44.1: i32 = int_literal 7 [template = constants.%.1]
  1030. // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(type) [template = constants.%ImplicitAs.type.3]
  1031. // CHECK:STDOUT: %.loc11_44.2: %.5 = specific_constant imports.%import_ref.3, @ImplicitAs(type) [template = constants.%.6]
  1032. // CHECK:STDOUT: %Convert.ref: %.5 = name_ref Convert, %.loc11_44.2 [template = constants.%.6]
  1033. // CHECK:STDOUT: %.loc11_44.3: type = converted %.loc11_44.1, <error> [template = <error>]
  1034. // CHECK:STDOUT: %.loc11_26: type = where_expr %.Self [template = type] {
  1035. // CHECK:STDOUT: requirement_impls %.Self.ref, <error>
  1036. // CHECK:STDOUT: }
  1037. // CHECK:STDOUT: %param: type = param runtime_param<invalid>
  1038. // CHECK:STDOUT: %U.loc11_17.1: type = bind_symbolic_name U, 0, %param [symbolic = %U.loc11_17.2 (constants.%U)]
  1039. // CHECK:STDOUT: }
  1040. // CHECK:STDOUT: }
  1041. // CHECK:STDOUT:
  1042. // CHECK:STDOUT: generic interface @ImplicitAs(constants.%Dest: type) {
  1043. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
  1044. // CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)]
  1045. // CHECK:STDOUT:
  1046. // CHECK:STDOUT: !definition:
  1047. // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)]
  1048. // CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)]
  1049. // CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.1)]
  1050. // CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)]
  1051. // CHECK:STDOUT: %.1: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.1 (constants.%.3)]
  1052. // CHECK:STDOUT: %.2: @ImplicitAs.%.1 (%.3) = assoc_entity element0, imports.%import_ref.5 [symbolic = %.2 (constants.%.4)]
  1053. // CHECK:STDOUT:
  1054. // CHECK:STDOUT: interface {
  1055. // CHECK:STDOUT: !members:
  1056. // CHECK:STDOUT: .Self = imports.%import_ref.2
  1057. // CHECK:STDOUT: .Convert = imports.%import_ref.3
  1058. // CHECK:STDOUT: witness = (imports.%import_ref.4)
  1059. // CHECK:STDOUT: }
  1060. // CHECK:STDOUT: }
  1061. // CHECK:STDOUT:
  1062. // CHECK:STDOUT: generic fn @Convert(constants.%Dest: type, constants.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2)) {
  1063. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
  1064. // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)]
  1065. // CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)]
  1066. // CHECK:STDOUT:
  1067. // CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self (%Self.2)]() -> @Convert.%Dest (%Dest);
  1068. // CHECK:STDOUT: }
  1069. // CHECK:STDOUT:
  1070. // CHECK:STDOUT: generic fn @ImplsNonType(%U.loc11_17.1: type) {
  1071. // CHECK:STDOUT: %U.loc11_17.2: type = bind_symbolic_name U, 0 [symbolic = %U.loc11_17.2 (constants.%U)]
  1072. // CHECK:STDOUT: %U.patt.loc11_17.2: type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc11_17.2 (constants.%U.patt)]
  1073. // CHECK:STDOUT:
  1074. // CHECK:STDOUT: fn(%U.param_patt: type);
  1075. // CHECK:STDOUT: }
  1076. // CHECK:STDOUT:
  1077. // CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) {
  1078. // CHECK:STDOUT: %Dest => constants.%Dest
  1079. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  1080. // CHECK:STDOUT: }
  1081. // CHECK:STDOUT:
  1082. // CHECK:STDOUT: specific @ImplicitAs(@ImplicitAs.%Dest) {
  1083. // CHECK:STDOUT: %Dest => constants.%Dest
  1084. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  1085. // CHECK:STDOUT: }
  1086. // CHECK:STDOUT:
  1087. // CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {
  1088. // CHECK:STDOUT: %Dest => constants.%Dest
  1089. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  1090. // CHECK:STDOUT: }
  1091. // CHECK:STDOUT:
  1092. // CHECK:STDOUT: specific @Convert(constants.%Dest, constants.%Self.1) {
  1093. // CHECK:STDOUT: %Dest => constants.%Dest
  1094. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2
  1095. // CHECK:STDOUT: %Self => constants.%Self.1
  1096. // CHECK:STDOUT: }
  1097. // CHECK:STDOUT:
  1098. // CHECK:STDOUT: specific @ImplicitAs(type) {
  1099. // CHECK:STDOUT: %Dest => type
  1100. // CHECK:STDOUT: %Dest.patt => type
  1101. // CHECK:STDOUT:
  1102. // CHECK:STDOUT: !definition:
  1103. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3
  1104. // CHECK:STDOUT: %Self => constants.%Self.2
  1105. // CHECK:STDOUT: %Convert.type => constants.%Convert.type.2
  1106. // CHECK:STDOUT: %Convert => constants.%Convert.2
  1107. // CHECK:STDOUT: %.1 => constants.%.5
  1108. // CHECK:STDOUT: %.2 => constants.%.6
  1109. // CHECK:STDOUT: }
  1110. // CHECK:STDOUT:
  1111. // CHECK:STDOUT: specific @ImplsNonType(constants.%U) {
  1112. // CHECK:STDOUT: %U.loc11_17.2 => constants.%U
  1113. // CHECK:STDOUT: %U.patt.loc11_17.2 => constants.%U
  1114. // CHECK:STDOUT: }
  1115. // CHECK:STDOUT:
  1116. // CHECK:STDOUT: --- fail_right_of_impls_non_facet_type.carbon
  1117. // CHECK:STDOUT:
  1118. // CHECK:STDOUT: constants {
  1119. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self, 0 [symbolic]
  1120. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  1121. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  1122. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  1123. // CHECK:STDOUT: %U: type = bind_symbolic_name U, 0 [symbolic]
  1124. // CHECK:STDOUT: %U.patt: type = symbolic_binding_pattern U, 0 [symbolic]
  1125. // CHECK:STDOUT: %ImplsOfNonFacetType.type: type = fn_type @ImplsOfNonFacetType [template]
  1126. // CHECK:STDOUT: %ImplsOfNonFacetType: %ImplsOfNonFacetType.type = struct_value () [template]
  1127. // CHECK:STDOUT: }
  1128. // CHECK:STDOUT:
  1129. // CHECK:STDOUT: imports {
  1130. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  1131. // CHECK:STDOUT: .Int32 = %import_ref
  1132. // CHECK:STDOUT: import Core//prelude
  1133. // CHECK:STDOUT: import Core//prelude/operators
  1134. // CHECK:STDOUT: import Core//prelude/types
  1135. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  1136. // CHECK:STDOUT: import Core//prelude/operators/as
  1137. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  1138. // CHECK:STDOUT: import Core//prelude/operators/comparison
  1139. // CHECK:STDOUT: import Core//prelude/types/bool
  1140. // CHECK:STDOUT: }
  1141. // CHECK:STDOUT: %import_ref: %Int32.type = import_ref Core//prelude/types, inst+9, loaded [template = constants.%Int32]
  1142. // CHECK:STDOUT: }
  1143. // CHECK:STDOUT:
  1144. // CHECK:STDOUT: file {
  1145. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1146. // CHECK:STDOUT: .Core = imports.%Core
  1147. // CHECK:STDOUT: .ImplsOfNonFacetType = %ImplsOfNonFacetType.decl
  1148. // CHECK:STDOUT: }
  1149. // CHECK:STDOUT: %Core.import = import Core
  1150. // CHECK:STDOUT: %ImplsOfNonFacetType.decl: %ImplsOfNonFacetType.type = fn_decl @ImplsOfNonFacetType [template = constants.%ImplsOfNonFacetType] {
  1151. // CHECK:STDOUT: %U.patt.loc8_24.1: type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc8_24.2 (constants.%U.patt)]
  1152. // CHECK:STDOUT: %U.param_patt: type = param_pattern %U.patt.loc8_24.1, runtime_param<invalid> [symbolic = %U.patt.loc8_24.2 (constants.%U.patt)]
  1153. // CHECK:STDOUT: } {
  1154. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self, 0 [symbolic = constants.%.Self]
  1155. // CHECK:STDOUT: %.Self.ref: type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  1156. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  1157. // CHECK:STDOUT: %.loc8_51.1: type = value_of_initializer %int.make_type_32 [template = i32]
  1158. // CHECK:STDOUT: %.loc8_51.2: type = converted %int.make_type_32, %.loc8_51.1 [template = i32]
  1159. // CHECK:STDOUT: %.loc8_33: type = where_expr %.Self [template = type] {
  1160. // CHECK:STDOUT: requirement_impls %.Self.ref, <error>
  1161. // CHECK:STDOUT: }
  1162. // CHECK:STDOUT: %param: type = param runtime_param<invalid>
  1163. // CHECK:STDOUT: %U.loc8_24.1: type = bind_symbolic_name U, 0, %param [symbolic = %U.loc8_24.2 (constants.%U)]
  1164. // CHECK:STDOUT: }
  1165. // CHECK:STDOUT: }
  1166. // CHECK:STDOUT:
  1167. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  1168. // CHECK:STDOUT:
  1169. // CHECK:STDOUT: generic fn @ImplsOfNonFacetType(%U.loc8_24.1: type) {
  1170. // CHECK:STDOUT: %U.loc8_24.2: type = bind_symbolic_name U, 0 [symbolic = %U.loc8_24.2 (constants.%U)]
  1171. // CHECK:STDOUT: %U.patt.loc8_24.2: type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc8_24.2 (constants.%U.patt)]
  1172. // CHECK:STDOUT:
  1173. // CHECK:STDOUT: fn(%U.param_patt: type);
  1174. // CHECK:STDOUT: }
  1175. // CHECK:STDOUT:
  1176. // CHECK:STDOUT: specific @ImplsOfNonFacetType(constants.%U) {
  1177. // CHECK:STDOUT: %U.loc8_24.2 => constants.%U
  1178. // CHECK:STDOUT: %U.patt.loc8_24.2 => constants.%U
  1179. // CHECK:STDOUT: }
  1180. // CHECK:STDOUT:
  1181. // CHECK:STDOUT: --- fail_todo_enforce_constraint.carbon
  1182. // CHECK:STDOUT:
  1183. // CHECK:STDOUT: constants {
  1184. // CHECK:STDOUT: %C: type = class_type @C [template]
  1185. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  1186. // CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
  1187. // CHECK:STDOUT: %J.type: type = interface_type @J [template]
  1188. // CHECK:STDOUT: %Self.1: %J.type = bind_symbolic_name Self, 0 [symbolic]
  1189. // CHECK:STDOUT: %.3: type = tuple_type () [template]
  1190. // CHECK:STDOUT: %.4: <witness> = interface_witness () [template]
  1191. // CHECK:STDOUT: %DoesNotImplI.type: type = fn_type @DoesNotImplI [template]
  1192. // CHECK:STDOUT: %DoesNotImplI: %DoesNotImplI.type = struct_value () [template]
  1193. // CHECK:STDOUT: %Impls.type: type = fn_type @Impls [template]
  1194. // CHECK:STDOUT: %Impls: %Impls.type = struct_value () [template]
  1195. // CHECK:STDOUT: %V: %J.type = bind_symbolic_name V, 0 [symbolic]
  1196. // CHECK:STDOUT: %V.patt: %J.type = symbolic_binding_pattern V, 0 [symbolic]
  1197. // CHECK:STDOUT: %ImplicitAs.type.1: type = generic_interface_type @ImplicitAs [template]
  1198. // CHECK:STDOUT: %ImplicitAs: %ImplicitAs.type.1 = struct_value () [template]
  1199. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic]
  1200. // CHECK:STDOUT: %ImplicitAs.type.2: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic]
  1201. // CHECK:STDOUT: %Self.2: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic]
  1202. // CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic]
  1203. // CHECK:STDOUT: %Self.3: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic]
  1204. // CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic]
  1205. // CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic]
  1206. // CHECK:STDOUT: %.5: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.1 [symbolic]
  1207. // CHECK:STDOUT: %.6: %.5 = assoc_entity element0, imports.%import_ref.11 [symbolic]
  1208. // CHECK:STDOUT: %ImplicitAs.type.3: type = interface_type @ImplicitAs, @ImplicitAs(%J.type) [template]
  1209. // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert, @ImplicitAs(%J.type) [template]
  1210. // CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template]
  1211. // CHECK:STDOUT: %.7: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.2 [template]
  1212. // CHECK:STDOUT: %.8: %.7 = assoc_entity element0, imports.%import_ref.11 [template]
  1213. // CHECK:STDOUT: %.9: %.5 = assoc_entity element0, imports.%import_ref.12 [symbolic]
  1214. // CHECK:STDOUT: %.Self: %J.type = bind_symbolic_name .Self, 0 [symbolic]
  1215. // CHECK:STDOUT: %Y: %J.type = bind_symbolic_name Y, 0 [symbolic]
  1216. // CHECK:STDOUT: %Y.patt: %J.type = symbolic_binding_pattern Y, 0 [symbolic]
  1217. // CHECK:STDOUT: %EmptyStruct.type: type = fn_type @EmptyStruct [template]
  1218. // CHECK:STDOUT: %EmptyStruct: %EmptyStruct.type = struct_value () [template]
  1219. // CHECK:STDOUT: %NotEmptyStruct.type: type = fn_type @NotEmptyStruct [template]
  1220. // CHECK:STDOUT: %NotEmptyStruct: %NotEmptyStruct.type = struct_value () [template]
  1221. // CHECK:STDOUT: }
  1222. // CHECK:STDOUT:
  1223. // CHECK:STDOUT: imports {
  1224. // CHECK:STDOUT: %import_ref.1: type = import_ref Main//state_constraints, inst+3, loaded [template = constants.%J.type]
  1225. // CHECK:STDOUT: %import_ref.2 = import_ref Main//state_constraints, inst+7, unloaded
  1226. // CHECK:STDOUT: %import_ref.3 = import_ref Main//state_constraints, inst+34, unloaded
  1227. // CHECK:STDOUT: %import_ref.4: %Impls.type = import_ref Main//state_constraints, inst+54, loaded [template = constants.%Impls]
  1228. // CHECK:STDOUT: %import_ref.5 = import_ref Main//state_constraints, inst+77, unloaded
  1229. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  1230. // CHECK:STDOUT: .ImplicitAs = %import_ref.7
  1231. // CHECK:STDOUT: import Core//prelude
  1232. // CHECK:STDOUT: import Core//prelude/operators
  1233. // CHECK:STDOUT: import Core//prelude/types
  1234. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  1235. // CHECK:STDOUT: import Core//prelude/operators/as
  1236. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  1237. // CHECK:STDOUT: import Core//prelude/operators/comparison
  1238. // CHECK:STDOUT: import Core//prelude/types/bool
  1239. // CHECK:STDOUT: }
  1240. // CHECK:STDOUT: %import_ref.6 = import_ref Main//state_constraints, inst+5, unloaded
  1241. // CHECK:STDOUT: %import_ref.7: %ImplicitAs.type.1 = import_ref Core//prelude/operators/as, inst+46, loaded [template = constants.%ImplicitAs]
  1242. // CHECK:STDOUT: %import_ref.8 = import_ref Core//prelude/operators/as, inst+52, unloaded
  1243. // CHECK:STDOUT: %import_ref.9: @ImplicitAs.%.1 (%.5) = import_ref Core//prelude/operators/as, inst+71, loaded [symbolic = @ImplicitAs.%.2 (constants.%.9)]
  1244. // CHECK:STDOUT: %import_ref.10 = import_ref Core//prelude/operators/as, inst+64, unloaded
  1245. // CHECK:STDOUT: %import_ref.11 = import_ref Core//prelude/operators/as, inst+64, unloaded
  1246. // CHECK:STDOUT: %import_ref.12 = import_ref Core//prelude/operators/as, inst+64, unloaded
  1247. // CHECK:STDOUT: }
  1248. // CHECK:STDOUT:
  1249. // CHECK:STDOUT: file {
  1250. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1251. // CHECK:STDOUT: .J = imports.%import_ref.1
  1252. // CHECK:STDOUT: .I = imports.%import_ref.2
  1253. // CHECK:STDOUT: .EqualEqual = imports.%import_ref.3
  1254. // CHECK:STDOUT: .Impls = imports.%import_ref.4
  1255. // CHECK:STDOUT: .And = imports.%import_ref.5
  1256. // CHECK:STDOUT: .Core = imports.%Core
  1257. // CHECK:STDOUT: .C = %C.decl
  1258. // CHECK:STDOUT: .DoesNotImplI = %DoesNotImplI.decl
  1259. // CHECK:STDOUT: .EmptyStruct = %EmptyStruct.decl
  1260. // CHECK:STDOUT: .NotEmptyStruct = %NotEmptyStruct.decl
  1261. // CHECK:STDOUT: }
  1262. // CHECK:STDOUT: %Core.import = import Core
  1263. // CHECK:STDOUT: %default.import = import <invalid>
  1264. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  1265. // CHECK:STDOUT: impl_decl @impl [template] {} {
  1266. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  1267. // CHECK:STDOUT: %J.ref: type = name_ref J, imports.%import_ref.1 [template = constants.%J.type]
  1268. // CHECK:STDOUT: }
  1269. // CHECK:STDOUT: %DoesNotImplI.decl: %DoesNotImplI.type = fn_decl @DoesNotImplI [template = constants.%DoesNotImplI] {} {}
  1270. // CHECK:STDOUT: %EmptyStruct.decl: %EmptyStruct.type = fn_decl @EmptyStruct [template = constants.%EmptyStruct] {
  1271. // CHECK:STDOUT: %Y.patt.loc22_16.1: %J.type = symbolic_binding_pattern Y, 0 [symbolic = %Y.patt.loc22_16.2 (constants.%Y.patt)]
  1272. // CHECK:STDOUT: %Y.param_patt: %J.type = param_pattern %Y.patt.loc22_16.1, runtime_param<invalid> [symbolic = %Y.patt.loc22_16.2 (constants.%Y.patt)]
  1273. // CHECK:STDOUT: } {
  1274. // CHECK:STDOUT: %J.ref: type = name_ref J, imports.%import_ref.1 [template = constants.%J.type]
  1275. // CHECK:STDOUT: %.Self: %J.type = bind_symbolic_name .Self, 0 [symbolic = constants.%.Self]
  1276. // CHECK:STDOUT: %.Self.ref: %J.type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  1277. // CHECK:STDOUT: %.loc22_38: %.1 = struct_literal ()
  1278. // CHECK:STDOUT: %.loc22_22: type = where_expr %.Self [template = constants.%J.type] {
  1279. // CHECK:STDOUT: requirement_equivalent %.Self.ref, %.loc22_38
  1280. // CHECK:STDOUT: }
  1281. // CHECK:STDOUT: %param: %J.type = param runtime_param<invalid>
  1282. // CHECK:STDOUT: %Y.loc22_16.1: %J.type = bind_symbolic_name Y, 0, %param [symbolic = %Y.loc22_16.2 (constants.%Y)]
  1283. // CHECK:STDOUT: }
  1284. // CHECK:STDOUT: %NotEmptyStruct.decl: %NotEmptyStruct.type = fn_decl @NotEmptyStruct [template = constants.%NotEmptyStruct] {} {}
  1285. // CHECK:STDOUT: }
  1286. // CHECK:STDOUT:
  1287. // CHECK:STDOUT: interface @J {
  1288. // CHECK:STDOUT: !members:
  1289. // CHECK:STDOUT: .Self = imports.%import_ref.6
  1290. // CHECK:STDOUT: witness = ()
  1291. // CHECK:STDOUT: }
  1292. // CHECK:STDOUT:
  1293. // CHECK:STDOUT: generic interface @ImplicitAs(constants.%Dest: type) {
  1294. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
  1295. // CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)]
  1296. // CHECK:STDOUT:
  1297. // CHECK:STDOUT: !definition:
  1298. // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)]
  1299. // CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.3)]
  1300. // CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.1)]
  1301. // CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)]
  1302. // CHECK:STDOUT: %.1: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.1 (constants.%.5)]
  1303. // CHECK:STDOUT: %.2: @ImplicitAs.%.1 (%.5) = assoc_entity element0, imports.%import_ref.11 [symbolic = %.2 (constants.%.6)]
  1304. // CHECK:STDOUT:
  1305. // CHECK:STDOUT: interface {
  1306. // CHECK:STDOUT: !members:
  1307. // CHECK:STDOUT: .Self = imports.%import_ref.8
  1308. // CHECK:STDOUT: .Convert = imports.%import_ref.9
  1309. // CHECK:STDOUT: witness = (imports.%import_ref.10)
  1310. // CHECK:STDOUT: }
  1311. // CHECK:STDOUT: }
  1312. // CHECK:STDOUT:
  1313. // CHECK:STDOUT: impl @impl: %C.ref as %J.ref {
  1314. // CHECK:STDOUT: %.loc8: <witness> = interface_witness () [template = constants.%.4]
  1315. // CHECK:STDOUT:
  1316. // CHECK:STDOUT: !members:
  1317. // CHECK:STDOUT: witness = %.loc8
  1318. // CHECK:STDOUT: }
  1319. // CHECK:STDOUT:
  1320. // CHECK:STDOUT: class @C {
  1321. // CHECK:STDOUT: %.loc7: <witness> = complete_type_witness %.1 [template = constants.%.2]
  1322. // CHECK:STDOUT:
  1323. // CHECK:STDOUT: !members:
  1324. // CHECK:STDOUT: .Self = constants.%C
  1325. // CHECK:STDOUT: }
  1326. // CHECK:STDOUT:
  1327. // CHECK:STDOUT: fn @DoesNotImplI() {
  1328. // CHECK:STDOUT: !entry:
  1329. // CHECK:STDOUT: %Impls.ref: %Impls.type = name_ref Impls, imports.%import_ref.4 [template = constants.%Impls]
  1330. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  1331. // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(constants.%J.type) [template = constants.%ImplicitAs.type.3]
  1332. // CHECK:STDOUT: %.loc19_8.1: %.7 = specific_constant imports.%import_ref.9, @ImplicitAs(constants.%J.type) [template = constants.%.8]
  1333. // CHECK:STDOUT: %Convert.ref: %.7 = name_ref Convert, %.loc19_8.1 [template = constants.%.8]
  1334. // CHECK:STDOUT: %.loc19_8.2: %J.type = converted %C.ref, <error> [template = <error>]
  1335. // CHECK:STDOUT: return
  1336. // CHECK:STDOUT: }
  1337. // CHECK:STDOUT:
  1338. // CHECK:STDOUT: generic fn @Impls(constants.%V: %J.type) {
  1339. // CHECK:STDOUT: %V: %J.type = bind_symbolic_name V, 0 [symbolic = %V (constants.%V)]
  1340. // CHECK:STDOUT: %V.patt: %J.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt (constants.%V.patt)]
  1341. // CHECK:STDOUT:
  1342. // CHECK:STDOUT: fn(%V.param_patt: %J.type);
  1343. // CHECK:STDOUT: }
  1344. // CHECK:STDOUT:
  1345. // CHECK:STDOUT: generic fn @Convert(constants.%Dest: type, constants.%Self.2: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2)) {
  1346. // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
  1347. // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)]
  1348. // CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.3)]
  1349. // CHECK:STDOUT:
  1350. // CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self (%Self.3)]() -> @Convert.%Dest (%Dest);
  1351. // CHECK:STDOUT: }
  1352. // CHECK:STDOUT:
  1353. // CHECK:STDOUT: generic fn @EmptyStruct(%Y.loc22_16.1: %J.type) {
  1354. // CHECK:STDOUT: %Y.loc22_16.2: %J.type = bind_symbolic_name Y, 0 [symbolic = %Y.loc22_16.2 (constants.%Y)]
  1355. // CHECK:STDOUT: %Y.patt.loc22_16.2: %J.type = symbolic_binding_pattern Y, 0 [symbolic = %Y.patt.loc22_16.2 (constants.%Y.patt)]
  1356. // CHECK:STDOUT:
  1357. // CHECK:STDOUT: fn(%Y.param_patt: %J.type);
  1358. // CHECK:STDOUT: }
  1359. // CHECK:STDOUT:
  1360. // CHECK:STDOUT: fn @NotEmptyStruct() {
  1361. // CHECK:STDOUT: !entry:
  1362. // CHECK:STDOUT: %EmptyStruct.ref: %EmptyStruct.type = name_ref EmptyStruct, file.%EmptyStruct.decl [template = constants.%EmptyStruct]
  1363. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  1364. // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(constants.%J.type) [template = constants.%ImplicitAs.type.3]
  1365. // CHECK:STDOUT: %.loc32_14.1: %.7 = specific_constant imports.%import_ref.9, @ImplicitAs(constants.%J.type) [template = constants.%.8]
  1366. // CHECK:STDOUT: %Convert.ref: %.7 = name_ref Convert, %.loc32_14.1 [template = constants.%.8]
  1367. // CHECK:STDOUT: %.loc32_14.2: %J.type = converted %C.ref, <error> [template = <error>]
  1368. // CHECK:STDOUT: return
  1369. // CHECK:STDOUT: }
  1370. // CHECK:STDOUT:
  1371. // CHECK:STDOUT: specific @Impls(constants.%V) {
  1372. // CHECK:STDOUT: %V => constants.%V
  1373. // CHECK:STDOUT: %V.patt => constants.%V
  1374. // CHECK:STDOUT: }
  1375. // CHECK:STDOUT:
  1376. // CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) {
  1377. // CHECK:STDOUT: %Dest => constants.%Dest
  1378. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  1379. // CHECK:STDOUT: }
  1380. // CHECK:STDOUT:
  1381. // CHECK:STDOUT: specific @ImplicitAs(@ImplicitAs.%Dest) {
  1382. // CHECK:STDOUT: %Dest => constants.%Dest
  1383. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  1384. // CHECK:STDOUT: }
  1385. // CHECK:STDOUT:
  1386. // CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {
  1387. // CHECK:STDOUT: %Dest => constants.%Dest
  1388. // CHECK:STDOUT: %Dest.patt => constants.%Dest
  1389. // CHECK:STDOUT: }
  1390. // CHECK:STDOUT:
  1391. // CHECK:STDOUT: specific @Convert(constants.%Dest, constants.%Self.2) {
  1392. // CHECK:STDOUT: %Dest => constants.%Dest
  1393. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2
  1394. // CHECK:STDOUT: %Self => constants.%Self.2
  1395. // CHECK:STDOUT: }
  1396. // CHECK:STDOUT:
  1397. // CHECK:STDOUT: specific @ImplicitAs(constants.%J.type) {
  1398. // CHECK:STDOUT: %Dest => constants.%J.type
  1399. // CHECK:STDOUT: %Dest.patt => constants.%J.type
  1400. // CHECK:STDOUT:
  1401. // CHECK:STDOUT: !definition:
  1402. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3
  1403. // CHECK:STDOUT: %Self => constants.%Self.3
  1404. // CHECK:STDOUT: %Convert.type => constants.%Convert.type.2
  1405. // CHECK:STDOUT: %Convert => constants.%Convert.2
  1406. // CHECK:STDOUT: %.1 => constants.%.7
  1407. // CHECK:STDOUT: %.2 => constants.%.8
  1408. // CHECK:STDOUT: }
  1409. // CHECK:STDOUT:
  1410. // CHECK:STDOUT: specific @EmptyStruct(constants.%Y) {
  1411. // CHECK:STDOUT: %Y.loc22_16.2 => constants.%Y
  1412. // CHECK:STDOUT: %Y.patt.loc22_16.2 => constants.%Y
  1413. // CHECK:STDOUT: }
  1414. // CHECK:STDOUT: