generic.carbon 68 KB

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