generic.carbon 91 KB

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