constraints.carbon 90 KB

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