access.carbon 72 KB

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