generic.carbon 67 KB

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