constraints.carbon 92 KB

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