multiple_extend.carbon 59 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon
  6. // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
  7. // EXTRA-ARGS: --dump-sem-ir-ranges=if-present
  8. //
  9. // AUTOUPDATE
  10. // TIP: To test this file alone, run:
  11. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/multiple_extend.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/multiple_extend.carbon
  14. // --- different_impl_member_names.carbon
  15. library "[[@TEST_NAME]]";
  16. interface HasF {
  17. fn F();
  18. }
  19. interface HasG {
  20. fn G();
  21. }
  22. class C {
  23. extend impl as HasF {
  24. fn F() {}
  25. }
  26. extend impl as HasG {
  27. fn G() {}
  28. }
  29. }
  30. fn H(c: C) {
  31. C.F();
  32. c.F();
  33. C.G();
  34. c.G();
  35. }
  36. // --- fail_ambiguous_impls.carbon
  37. library "[[@TEST_NAME]]";
  38. interface HasA1 {
  39. fn A();
  40. }
  41. interface HasA2 {
  42. fn A();
  43. }
  44. class D {
  45. extend impl as HasA1 {
  46. fn A() {}
  47. }
  48. extend impl as HasA2 {
  49. fn A() {}
  50. }
  51. }
  52. fn B(d: D) {
  53. // CHECK:STDERR: fail_ambiguous_impls.carbon:[[@LINE+4]]:3: error: ambiguous use of name `A` found in multiple extended scopes [NameAmbiguousDueToExtend]
  54. // CHECK:STDERR: D.A();
  55. // CHECK:STDERR: ^~~
  56. // CHECK:STDERR:
  57. D.A();
  58. // CHECK:STDERR: fail_ambiguous_impls.carbon:[[@LINE+4]]:3: error: ambiguous use of name `A` found in multiple extended scopes [NameAmbiguousDueToExtend]
  59. // CHECK:STDERR: d.A();
  60. // CHECK:STDERR: ^~~
  61. // CHECK:STDERR:
  62. d.A();
  63. }
  64. // --- different_impl_and_base.carbon
  65. library "[[@TEST_NAME]]";
  66. interface HasI {
  67. fn I();
  68. }
  69. base class B {
  70. fn J() {}
  71. }
  72. class E {
  73. extend base: B;
  74. extend impl as HasI {
  75. fn I() {}
  76. }
  77. }
  78. fn H(e: E) {
  79. E.I();
  80. e.I();
  81. E.J();
  82. e.J();
  83. }
  84. // --- fail_ambiguous_impl_and_base.carbon
  85. library "[[@TEST_NAME]]";
  86. base class Base {
  87. fn K() {}
  88. }
  89. interface HasK {
  90. fn K();
  91. }
  92. class L {
  93. extend base: Base;
  94. extend impl as HasK {
  95. fn K() {}
  96. }
  97. }
  98. fn M(l: L) {
  99. // CHECK:STDERR: fail_ambiguous_impl_and_base.carbon:[[@LINE+4]]:4: error: ambiguous use of name `K` found in multiple extended scopes [NameAmbiguousDueToExtend]
  100. // CHECK:STDERR: L.K();
  101. // CHECK:STDERR: ^~~
  102. // CHECK:STDERR:
  103. L.K();
  104. // CHECK:STDERR: fail_ambiguous_impl_and_base.carbon:[[@LINE+4]]:4: error: ambiguous use of name `K` found in multiple extended scopes [NameAmbiguousDueToExtend]
  105. // CHECK:STDERR: l.K();
  106. // CHECK:STDERR: ^~~
  107. // CHECK:STDERR:
  108. l.K();
  109. }
  110. // --- ambiguity_hidden.carbon
  111. library "[[@TEST_NAME]]";
  112. base class NBase {
  113. fn N() {}
  114. }
  115. interface HasN1 {
  116. fn N();
  117. }
  118. interface HasN2 {
  119. fn N();
  120. }
  121. class O {
  122. extend base: NBase;
  123. extend impl as HasN1 {
  124. fn N() {}
  125. }
  126. extend impl as HasN2 {
  127. fn N() {}
  128. }
  129. fn N();
  130. }
  131. fn P(o: O) {
  132. O.N();
  133. o.N();
  134. }
  135. // CHECK:STDOUT: --- different_impl_member_names.carbon
  136. // CHECK:STDOUT:
  137. // CHECK:STDOUT: constants {
  138. // CHECK:STDOUT: %HasF.type: type = facet_type <@HasF> [concrete]
  139. // CHECK:STDOUT: %Self.f09: %HasF.type = symbolic_binding Self, 0 [symbolic]
  140. // CHECK:STDOUT: %HasF.WithSelf.F.type.adc: type = fn_type @HasF.WithSelf.F, @HasF.WithSelf(%Self.f09) [symbolic]
  141. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  142. // CHECK:STDOUT: %HasF.WithSelf.F.faa: %HasF.WithSelf.F.type.adc = struct_value () [symbolic]
  143. // CHECK:STDOUT: %HasF.assoc_type: type = assoc_entity_type @HasF [concrete]
  144. // CHECK:STDOUT: %assoc0.a7f: %HasF.assoc_type = assoc_entity element0, @HasF.WithSelf.%HasF.WithSelf.F.decl [concrete]
  145. // CHECK:STDOUT: %HasG.type: type = facet_type <@HasG> [concrete]
  146. // CHECK:STDOUT: %Self.5aa: %HasG.type = symbolic_binding Self, 0 [symbolic]
  147. // CHECK:STDOUT: %HasG.WithSelf.G.type.979: type = fn_type @HasG.WithSelf.G, @HasG.WithSelf(%Self.5aa) [symbolic]
  148. // CHECK:STDOUT: %HasG.WithSelf.G.ed6: %HasG.WithSelf.G.type.979 = struct_value () [symbolic]
  149. // CHECK:STDOUT: %HasG.assoc_type: type = assoc_entity_type @HasG [concrete]
  150. // CHECK:STDOUT: %assoc0.035: %HasG.assoc_type = assoc_entity element0, @HasG.WithSelf.%HasG.WithSelf.G.decl [concrete]
  151. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  152. // CHECK:STDOUT: %HasF.impl_witness: <witness> = impl_witness @C.as.HasF.impl.%HasF.impl_witness_table [concrete]
  153. // CHECK:STDOUT: %C.as.HasF.impl.F.type: type = fn_type @C.as.HasF.impl.F [concrete]
  154. // CHECK:STDOUT: %C.as.HasF.impl.F: %C.as.HasF.impl.F.type = struct_value () [concrete]
  155. // CHECK:STDOUT: %HasF.facet: %HasF.type = facet_value %C, (%HasF.impl_witness) [concrete]
  156. // CHECK:STDOUT: %HasF.WithSelf.F.type.eea: type = fn_type @HasF.WithSelf.F, @HasF.WithSelf(%HasF.facet) [concrete]
  157. // CHECK:STDOUT: %HasF.WithSelf.F.fb3: %HasF.WithSelf.F.type.eea = struct_value () [concrete]
  158. // CHECK:STDOUT: %HasG.impl_witness: <witness> = impl_witness @C.as.HasG.impl.%HasG.impl_witness_table [concrete]
  159. // CHECK:STDOUT: %C.as.HasG.impl.G.type: type = fn_type @C.as.HasG.impl.G [concrete]
  160. // CHECK:STDOUT: %C.as.HasG.impl.G: %C.as.HasG.impl.G.type = struct_value () [concrete]
  161. // CHECK:STDOUT: %HasG.facet: %HasG.type = facet_value %C, (%HasG.impl_witness) [concrete]
  162. // CHECK:STDOUT: %HasG.WithSelf.G.type.6cb: type = fn_type @HasG.WithSelf.G, @HasG.WithSelf(%HasG.facet) [concrete]
  163. // CHECK:STDOUT: %HasG.WithSelf.G.32e: %HasG.WithSelf.G.type.6cb = struct_value () [concrete]
  164. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  165. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  166. // CHECK:STDOUT: %pattern_type: type = pattern_type %C [concrete]
  167. // CHECK:STDOUT: %H.type: type = fn_type @H [concrete]
  168. // CHECK:STDOUT: %H: %H.type = struct_value () [concrete]
  169. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  170. // CHECK:STDOUT: %C.type.facet: %type = facet_value %C, () [concrete]
  171. // CHECK:STDOUT: %HasG.WithSelf.G.type.b80: type = fn_type @HasG.WithSelf.G, @HasG.WithSelf(%C.type.facet) [concrete]
  172. // CHECK:STDOUT: %HasG.WithSelf.G.11f: %HasG.WithSelf.G.type.b80 = struct_value () [concrete]
  173. // CHECK:STDOUT: %HasF.WithSelf.F.type.5ef: type = fn_type @HasF.WithSelf.F, @HasF.WithSelf(%C.type.facet) [concrete]
  174. // CHECK:STDOUT: %HasF.WithSelf.F.d3b: %HasF.WithSelf.F.type.5ef = struct_value () [concrete]
  175. // CHECK:STDOUT: %.acd: type = fn_type_with_self_type %HasF.WithSelf.F.type.eea, %HasF.facet [concrete]
  176. // CHECK:STDOUT: %.892: type = fn_type_with_self_type %HasG.WithSelf.G.type.6cb, %HasG.facet [concrete]
  177. // CHECK:STDOUT: }
  178. // CHECK:STDOUT:
  179. // CHECK:STDOUT: file {
  180. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  181. // CHECK:STDOUT: .HasF = %HasF.decl
  182. // CHECK:STDOUT: .HasG = %HasG.decl
  183. // CHECK:STDOUT: .C = %C.decl
  184. // CHECK:STDOUT: .H = %H.decl
  185. // CHECK:STDOUT: }
  186. // CHECK:STDOUT: %HasF.decl: type = interface_decl @HasF [concrete = constants.%HasF.type] {} {}
  187. // CHECK:STDOUT: %HasG.decl: type = interface_decl @HasG [concrete = constants.%HasG.type] {} {}
  188. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  189. // CHECK:STDOUT: %H.decl: %H.type = fn_decl @H [concrete = constants.%H] {
  190. // CHECK:STDOUT: %c.param_patt: %pattern_type = value_param_pattern [concrete]
  191. // CHECK:STDOUT: %c.patt: %pattern_type = at_binding_pattern c, %c.param_patt [concrete]
  192. // CHECK:STDOUT: } {
  193. // CHECK:STDOUT: %c.param: %C = value_param call_param0
  194. // CHECK:STDOUT: %C.ref.loc21: type = name_ref C, file.%C.decl [concrete = constants.%C]
  195. // CHECK:STDOUT: %c: %C = value_binding c, %c.param
  196. // CHECK:STDOUT: }
  197. // CHECK:STDOUT: }
  198. // CHECK:STDOUT:
  199. // CHECK:STDOUT: interface @HasF {
  200. // CHECK:STDOUT: %Self: %HasF.type = symbolic_binding Self, 0 [symbolic = constants.%Self.f09]
  201. // CHECK:STDOUT: %HasF.WithSelf.decl = interface_with_self_decl @HasF [concrete]
  202. // CHECK:STDOUT:
  203. // CHECK:STDOUT: !with Self:
  204. // CHECK:STDOUT: %HasF.WithSelf.F.decl: @HasF.WithSelf.%HasF.WithSelf.F.type (%HasF.WithSelf.F.type.adc) = fn_decl @HasF.WithSelf.F [symbolic = @HasF.WithSelf.%HasF.WithSelf.F (constants.%HasF.WithSelf.F.faa)] {} {}
  205. // CHECK:STDOUT: %assoc0: %HasF.assoc_type = assoc_entity element0, %HasF.WithSelf.F.decl [concrete = constants.%assoc0.a7f]
  206. // CHECK:STDOUT:
  207. // CHECK:STDOUT: !members:
  208. // CHECK:STDOUT: .Self = %Self
  209. // CHECK:STDOUT: .F = @HasF.WithSelf.%assoc0
  210. // CHECK:STDOUT: .HasG = <poisoned>
  211. // CHECK:STDOUT: .G = <poisoned>
  212. // CHECK:STDOUT: witness = (@HasF.WithSelf.%HasF.WithSelf.F.decl)
  213. // CHECK:STDOUT:
  214. // CHECK:STDOUT: !requires:
  215. // CHECK:STDOUT: }
  216. // CHECK:STDOUT:
  217. // CHECK:STDOUT: interface @HasG {
  218. // CHECK:STDOUT: %Self: %HasG.type = symbolic_binding Self, 0 [symbolic = constants.%Self.5aa]
  219. // CHECK:STDOUT: %HasG.WithSelf.decl = interface_with_self_decl @HasG [concrete]
  220. // CHECK:STDOUT:
  221. // CHECK:STDOUT: !with Self:
  222. // CHECK:STDOUT: %HasG.WithSelf.G.decl: @HasG.WithSelf.%HasG.WithSelf.G.type (%HasG.WithSelf.G.type.979) = fn_decl @HasG.WithSelf.G [symbolic = @HasG.WithSelf.%HasG.WithSelf.G (constants.%HasG.WithSelf.G.ed6)] {} {}
  223. // CHECK:STDOUT: %assoc0: %HasG.assoc_type = assoc_entity element0, %HasG.WithSelf.G.decl [concrete = constants.%assoc0.035]
  224. // CHECK:STDOUT:
  225. // CHECK:STDOUT: !members:
  226. // CHECK:STDOUT: .Self = %Self
  227. // CHECK:STDOUT: .G = @HasG.WithSelf.%assoc0
  228. // CHECK:STDOUT: .F = <poisoned>
  229. // CHECK:STDOUT: witness = (@HasG.WithSelf.%HasG.WithSelf.G.decl)
  230. // CHECK:STDOUT:
  231. // CHECK:STDOUT: !requires:
  232. // CHECK:STDOUT: }
  233. // CHECK:STDOUT:
  234. // CHECK:STDOUT: impl @C.as.HasF.impl: %Self.ref as %HasF.ref {
  235. // CHECK:STDOUT: %C.as.HasF.impl.F.decl: %C.as.HasF.impl.F.type = fn_decl @C.as.HasF.impl.F [concrete = constants.%C.as.HasF.impl.F] {} {}
  236. // CHECK:STDOUT: %HasF.impl_witness_table = impl_witness_table (%C.as.HasF.impl.F.decl), @C.as.HasF.impl [concrete]
  237. // CHECK:STDOUT: %HasF.impl_witness: <witness> = impl_witness %HasF.impl_witness_table [concrete = constants.%HasF.impl_witness]
  238. // CHECK:STDOUT:
  239. // CHECK:STDOUT: !members:
  240. // CHECK:STDOUT: .F = %C.as.HasF.impl.F.decl
  241. // CHECK:STDOUT: witness = %HasF.impl_witness
  242. // CHECK:STDOUT: }
  243. // CHECK:STDOUT:
  244. // CHECK:STDOUT: impl @C.as.HasG.impl: %Self.ref as %HasG.ref {
  245. // CHECK:STDOUT: %C.as.HasG.impl.G.decl: %C.as.HasG.impl.G.type = fn_decl @C.as.HasG.impl.G [concrete = constants.%C.as.HasG.impl.G] {} {}
  246. // CHECK:STDOUT: %HasG.impl_witness_table = impl_witness_table (%C.as.HasG.impl.G.decl), @C.as.HasG.impl [concrete]
  247. // CHECK:STDOUT: %HasG.impl_witness: <witness> = impl_witness %HasG.impl_witness_table [concrete = constants.%HasG.impl_witness]
  248. // CHECK:STDOUT:
  249. // CHECK:STDOUT: !members:
  250. // CHECK:STDOUT: .G = %C.as.HasG.impl.G.decl
  251. // CHECK:STDOUT: witness = %HasG.impl_witness
  252. // CHECK:STDOUT: }
  253. // CHECK:STDOUT:
  254. // CHECK:STDOUT: class @C {
  255. // CHECK:STDOUT: impl_decl @C.as.HasF.impl [concrete] {} {
  256. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [concrete = constants.%C]
  257. // CHECK:STDOUT: %HasF.ref: type = name_ref HasF, file.%HasF.decl [concrete = constants.%HasF.type]
  258. // CHECK:STDOUT: }
  259. // CHECK:STDOUT: impl_decl @C.as.HasG.impl [concrete] {} {
  260. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [concrete = constants.%C]
  261. // CHECK:STDOUT: %HasG.ref: type = name_ref HasG, file.%HasG.decl [concrete = constants.%HasG.type]
  262. // CHECK:STDOUT: }
  263. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  264. // CHECK:STDOUT: complete_type_witness = %complete_type
  265. // CHECK:STDOUT:
  266. // CHECK:STDOUT: !members:
  267. // CHECK:STDOUT: .Self = constants.%C
  268. // CHECK:STDOUT: .HasF = <poisoned>
  269. // CHECK:STDOUT: .HasG = <poisoned>
  270. // CHECK:STDOUT: .F = <poisoned>
  271. // CHECK:STDOUT: .G = <poisoned>
  272. // CHECK:STDOUT: extend @C.as.HasF.impl.%HasF.ref
  273. // CHECK:STDOUT: extend @C.as.HasG.impl.%HasG.ref
  274. // CHECK:STDOUT: }
  275. // CHECK:STDOUT:
  276. // CHECK:STDOUT: generic fn @HasF.WithSelf.F(@HasF.%Self: %HasF.type) {
  277. // CHECK:STDOUT: fn();
  278. // CHECK:STDOUT: }
  279. // CHECK:STDOUT:
  280. // CHECK:STDOUT: generic fn @HasG.WithSelf.G(@HasG.%Self: %HasG.type) {
  281. // CHECK:STDOUT: fn();
  282. // CHECK:STDOUT: }
  283. // CHECK:STDOUT:
  284. // CHECK:STDOUT: fn @C.as.HasF.impl.F() {
  285. // CHECK:STDOUT: !entry:
  286. // CHECK:STDOUT: return
  287. // CHECK:STDOUT: }
  288. // CHECK:STDOUT:
  289. // CHECK:STDOUT: fn @C.as.HasG.impl.G() {
  290. // CHECK:STDOUT: !entry:
  291. // CHECK:STDOUT: return
  292. // CHECK:STDOUT: }
  293. // CHECK:STDOUT:
  294. // CHECK:STDOUT: fn @H(%c.param: %C) {
  295. // CHECK:STDOUT: !entry:
  296. // CHECK:STDOUT: %C.ref.loc22: type = name_ref C, file.%C.decl [concrete = constants.%C]
  297. // CHECK:STDOUT: %F.ref.loc22: %HasF.assoc_type = name_ref F, @HasF.WithSelf.%assoc0 [concrete = constants.%assoc0.a7f]
  298. // CHECK:STDOUT: %impl.elem0.loc22: %.acd = impl_witness_access constants.%HasF.impl_witness, element0 [concrete = constants.%C.as.HasF.impl.F]
  299. // CHECK:STDOUT: %C.as.HasF.impl.F.call.loc22: init %empty_tuple.type = call %impl.elem0.loc22()
  300. // CHECK:STDOUT: %c.ref.loc23: %C = name_ref c, %c
  301. // CHECK:STDOUT: %F.ref.loc23: %HasF.assoc_type = name_ref F, @HasF.WithSelf.%assoc0 [concrete = constants.%assoc0.a7f]
  302. // CHECK:STDOUT: %impl.elem0.loc23: %.acd = impl_witness_access constants.%HasF.impl_witness, element0 [concrete = constants.%C.as.HasF.impl.F]
  303. // CHECK:STDOUT: %C.as.HasF.impl.F.call.loc23: init %empty_tuple.type = call %impl.elem0.loc23()
  304. // CHECK:STDOUT: %C.ref.loc24: type = name_ref C, file.%C.decl [concrete = constants.%C]
  305. // CHECK:STDOUT: %G.ref.loc24: %HasG.assoc_type = name_ref G, @HasG.WithSelf.%assoc0 [concrete = constants.%assoc0.035]
  306. // CHECK:STDOUT: %impl.elem0.loc24: %.892 = impl_witness_access constants.%HasG.impl_witness, element0 [concrete = constants.%C.as.HasG.impl.G]
  307. // CHECK:STDOUT: %C.as.HasG.impl.G.call.loc24: init %empty_tuple.type = call %impl.elem0.loc24()
  308. // CHECK:STDOUT: %c.ref.loc25: %C = name_ref c, %c
  309. // CHECK:STDOUT: %G.ref.loc25: %HasG.assoc_type = name_ref G, @HasG.WithSelf.%assoc0 [concrete = constants.%assoc0.035]
  310. // CHECK:STDOUT: %impl.elem0.loc25: %.892 = impl_witness_access constants.%HasG.impl_witness, element0 [concrete = constants.%C.as.HasG.impl.G]
  311. // CHECK:STDOUT: %C.as.HasG.impl.G.call.loc25: init %empty_tuple.type = call %impl.elem0.loc25()
  312. // CHECK:STDOUT: return
  313. // CHECK:STDOUT: }
  314. // CHECK:STDOUT:
  315. // CHECK:STDOUT: specific @HasF.WithSelf(constants.%Self.f09) {
  316. // CHECK:STDOUT: !definition:
  317. // CHECK:STDOUT: %Self => constants.%Self.f09
  318. // CHECK:STDOUT: %HasF.WithSelf.F.type => constants.%HasF.WithSelf.F.type.adc
  319. // CHECK:STDOUT: %HasF.WithSelf.F => constants.%HasF.WithSelf.F.faa
  320. // CHECK:STDOUT: }
  321. // CHECK:STDOUT:
  322. // CHECK:STDOUT: specific @HasF.WithSelf.F(constants.%Self.f09) {}
  323. // CHECK:STDOUT:
  324. // CHECK:STDOUT: specific @HasG.WithSelf(constants.%Self.5aa) {
  325. // CHECK:STDOUT: !definition:
  326. // CHECK:STDOUT: %Self => constants.%Self.5aa
  327. // CHECK:STDOUT: %HasG.WithSelf.G.type => constants.%HasG.WithSelf.G.type.979
  328. // CHECK:STDOUT: %HasG.WithSelf.G => constants.%HasG.WithSelf.G.ed6
  329. // CHECK:STDOUT: }
  330. // CHECK:STDOUT:
  331. // CHECK:STDOUT: specific @HasG.WithSelf.G(constants.%Self.5aa) {}
  332. // CHECK:STDOUT:
  333. // CHECK:STDOUT: specific @HasF.WithSelf(constants.%HasF.facet) {
  334. // CHECK:STDOUT: !definition:
  335. // CHECK:STDOUT: %Self => constants.%HasF.facet
  336. // CHECK:STDOUT: %HasF.WithSelf.F.type => constants.%HasF.WithSelf.F.type.eea
  337. // CHECK:STDOUT: %HasF.WithSelf.F => constants.%HasF.WithSelf.F.fb3
  338. // CHECK:STDOUT: }
  339. // CHECK:STDOUT:
  340. // CHECK:STDOUT: specific @HasF.WithSelf.F(constants.%HasF.facet) {}
  341. // CHECK:STDOUT:
  342. // CHECK:STDOUT: specific @HasG.WithSelf(constants.%HasG.facet) {
  343. // CHECK:STDOUT: !definition:
  344. // CHECK:STDOUT: %Self => constants.%HasG.facet
  345. // CHECK:STDOUT: %HasG.WithSelf.G.type => constants.%HasG.WithSelf.G.type.6cb
  346. // CHECK:STDOUT: %HasG.WithSelf.G => constants.%HasG.WithSelf.G.32e
  347. // CHECK:STDOUT: }
  348. // CHECK:STDOUT:
  349. // CHECK:STDOUT: specific @HasG.WithSelf.G(constants.%HasG.facet) {}
  350. // CHECK:STDOUT:
  351. // CHECK:STDOUT: specific @HasG.WithSelf(constants.%C.type.facet) {
  352. // CHECK:STDOUT: !definition:
  353. // CHECK:STDOUT: %Self => constants.%C.type.facet
  354. // CHECK:STDOUT: %HasG.WithSelf.G.type => constants.%HasG.WithSelf.G.type.b80
  355. // CHECK:STDOUT: %HasG.WithSelf.G => constants.%HasG.WithSelf.G.11f
  356. // CHECK:STDOUT: }
  357. // CHECK:STDOUT:
  358. // CHECK:STDOUT: specific @HasF.WithSelf(constants.%C.type.facet) {
  359. // CHECK:STDOUT: !definition:
  360. // CHECK:STDOUT: %Self => constants.%C.type.facet
  361. // CHECK:STDOUT: %HasF.WithSelf.F.type => constants.%HasF.WithSelf.F.type.5ef
  362. // CHECK:STDOUT: %HasF.WithSelf.F => constants.%HasF.WithSelf.F.d3b
  363. // CHECK:STDOUT: }
  364. // CHECK:STDOUT:
  365. // CHECK:STDOUT: --- fail_ambiguous_impls.carbon
  366. // CHECK:STDOUT:
  367. // CHECK:STDOUT: constants {
  368. // CHECK:STDOUT: %HasA1.type: type = facet_type <@HasA1> [concrete]
  369. // CHECK:STDOUT: %Self.5fb: %HasA1.type = symbolic_binding Self, 0 [symbolic]
  370. // CHECK:STDOUT: %HasA1.WithSelf.A.type.bc6: type = fn_type @HasA1.WithSelf.A, @HasA1.WithSelf(%Self.5fb) [symbolic]
  371. // CHECK:STDOUT: %HasA1.WithSelf.A.972: %HasA1.WithSelf.A.type.bc6 = struct_value () [symbolic]
  372. // CHECK:STDOUT: %HasA1.assoc_type: type = assoc_entity_type @HasA1 [concrete]
  373. // CHECK:STDOUT: %assoc0.5de: %HasA1.assoc_type = assoc_entity element0, @HasA1.WithSelf.%HasA1.WithSelf.A.decl [concrete]
  374. // CHECK:STDOUT: %HasA2.type: type = facet_type <@HasA2> [concrete]
  375. // CHECK:STDOUT: %Self.dd3: %HasA2.type = symbolic_binding Self, 0 [symbolic]
  376. // CHECK:STDOUT: %HasA2.WithSelf.A.type.b2b: type = fn_type @HasA2.WithSelf.A, @HasA2.WithSelf(%Self.dd3) [symbolic]
  377. // CHECK:STDOUT: %HasA2.WithSelf.A.39a: %HasA2.WithSelf.A.type.b2b = struct_value () [symbolic]
  378. // CHECK:STDOUT: %HasA2.assoc_type: type = assoc_entity_type @HasA2 [concrete]
  379. // CHECK:STDOUT: %assoc0.e6e: %HasA2.assoc_type = assoc_entity element0, @HasA2.WithSelf.%HasA2.WithSelf.A.decl [concrete]
  380. // CHECK:STDOUT: %D: type = class_type @D [concrete]
  381. // CHECK:STDOUT: %HasA1.impl_witness: <witness> = impl_witness @D.as.HasA1.impl.%HasA1.impl_witness_table [concrete]
  382. // CHECK:STDOUT: %D.as.HasA1.impl.A.type: type = fn_type @D.as.HasA1.impl.A [concrete]
  383. // CHECK:STDOUT: %D.as.HasA1.impl.A: %D.as.HasA1.impl.A.type = struct_value () [concrete]
  384. // CHECK:STDOUT: %HasA1.facet: %HasA1.type = facet_value %D, (%HasA1.impl_witness) [concrete]
  385. // CHECK:STDOUT: %HasA1.WithSelf.A.type.bad: type = fn_type @HasA1.WithSelf.A, @HasA1.WithSelf(%HasA1.facet) [concrete]
  386. // CHECK:STDOUT: %HasA1.WithSelf.A.4c9: %HasA1.WithSelf.A.type.bad = struct_value () [concrete]
  387. // CHECK:STDOUT: %HasA2.impl_witness: <witness> = impl_witness @D.as.HasA2.impl.%HasA2.impl_witness_table [concrete]
  388. // CHECK:STDOUT: %D.as.HasA2.impl.A.type: type = fn_type @D.as.HasA2.impl.A [concrete]
  389. // CHECK:STDOUT: %D.as.HasA2.impl.A: %D.as.HasA2.impl.A.type = struct_value () [concrete]
  390. // CHECK:STDOUT: %HasA2.facet: %HasA2.type = facet_value %D, (%HasA2.impl_witness) [concrete]
  391. // CHECK:STDOUT: %HasA2.WithSelf.A.type.1d3: type = fn_type @HasA2.WithSelf.A, @HasA2.WithSelf(%HasA2.facet) [concrete]
  392. // CHECK:STDOUT: %HasA2.WithSelf.A.c84: %HasA2.WithSelf.A.type.1d3 = struct_value () [concrete]
  393. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  394. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  395. // CHECK:STDOUT: %pattern_type: type = pattern_type %D [concrete]
  396. // CHECK:STDOUT: %B.type: type = fn_type @B [concrete]
  397. // CHECK:STDOUT: %B: %B.type = struct_value () [concrete]
  398. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  399. // CHECK:STDOUT: %D.type.facet: %type = facet_value %D, () [concrete]
  400. // CHECK:STDOUT: %HasA2.WithSelf.A.type.435: type = fn_type @HasA2.WithSelf.A, @HasA2.WithSelf(%D.type.facet) [concrete]
  401. // CHECK:STDOUT: %HasA2.WithSelf.A.6fa: %HasA2.WithSelf.A.type.435 = struct_value () [concrete]
  402. // CHECK:STDOUT: %HasA1.WithSelf.A.type.299: type = fn_type @HasA1.WithSelf.A, @HasA1.WithSelf(%D.type.facet) [concrete]
  403. // CHECK:STDOUT: %HasA1.WithSelf.A.d53: %HasA1.WithSelf.A.type.299 = struct_value () [concrete]
  404. // CHECK:STDOUT: }
  405. // CHECK:STDOUT:
  406. // CHECK:STDOUT: file {
  407. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  408. // CHECK:STDOUT: .HasA1 = %HasA1.decl
  409. // CHECK:STDOUT: .HasA2 = %HasA2.decl
  410. // CHECK:STDOUT: .D = %D.decl
  411. // CHECK:STDOUT: .B = %B.decl
  412. // CHECK:STDOUT: }
  413. // CHECK:STDOUT: %HasA1.decl: type = interface_decl @HasA1 [concrete = constants.%HasA1.type] {} {}
  414. // CHECK:STDOUT: %HasA2.decl: type = interface_decl @HasA2 [concrete = constants.%HasA2.type] {} {}
  415. // CHECK:STDOUT: %D.decl: type = class_decl @D [concrete = constants.%D] {} {}
  416. // CHECK:STDOUT: %B.decl: %B.type = fn_decl @B [concrete = constants.%B] {
  417. // CHECK:STDOUT: %d.param_patt: %pattern_type = value_param_pattern [concrete]
  418. // CHECK:STDOUT: %d.patt: %pattern_type = at_binding_pattern d, %d.param_patt [concrete]
  419. // CHECK:STDOUT: } {
  420. // CHECK:STDOUT: %d.param: %D = value_param call_param0
  421. // CHECK:STDOUT: %D.ref.loc21: type = name_ref D, file.%D.decl [concrete = constants.%D]
  422. // CHECK:STDOUT: %d: %D = value_binding d, %d.param
  423. // CHECK:STDOUT: }
  424. // CHECK:STDOUT: }
  425. // CHECK:STDOUT:
  426. // CHECK:STDOUT: interface @HasA1 {
  427. // CHECK:STDOUT: %Self: %HasA1.type = symbolic_binding Self, 0 [symbolic = constants.%Self.5fb]
  428. // CHECK:STDOUT: %HasA1.WithSelf.decl = interface_with_self_decl @HasA1 [concrete]
  429. // CHECK:STDOUT:
  430. // CHECK:STDOUT: !with Self:
  431. // CHECK:STDOUT: %HasA1.WithSelf.A.decl: @HasA1.WithSelf.%HasA1.WithSelf.A.type (%HasA1.WithSelf.A.type.bc6) = fn_decl @HasA1.WithSelf.A [symbolic = @HasA1.WithSelf.%HasA1.WithSelf.A (constants.%HasA1.WithSelf.A.972)] {} {}
  432. // CHECK:STDOUT: %assoc0: %HasA1.assoc_type = assoc_entity element0, %HasA1.WithSelf.A.decl [concrete = constants.%assoc0.5de]
  433. // CHECK:STDOUT:
  434. // CHECK:STDOUT: !members:
  435. // CHECK:STDOUT: .Self = %Self
  436. // CHECK:STDOUT: .A = @HasA1.WithSelf.%assoc0
  437. // CHECK:STDOUT: .HasA2 = <poisoned>
  438. // CHECK:STDOUT: witness = (@HasA1.WithSelf.%HasA1.WithSelf.A.decl)
  439. // CHECK:STDOUT:
  440. // CHECK:STDOUT: !requires:
  441. // CHECK:STDOUT: }
  442. // CHECK:STDOUT:
  443. // CHECK:STDOUT: interface @HasA2 {
  444. // CHECK:STDOUT: %Self: %HasA2.type = symbolic_binding Self, 0 [symbolic = constants.%Self.dd3]
  445. // CHECK:STDOUT: %HasA2.WithSelf.decl = interface_with_self_decl @HasA2 [concrete]
  446. // CHECK:STDOUT:
  447. // CHECK:STDOUT: !with Self:
  448. // CHECK:STDOUT: %HasA2.WithSelf.A.decl: @HasA2.WithSelf.%HasA2.WithSelf.A.type (%HasA2.WithSelf.A.type.b2b) = fn_decl @HasA2.WithSelf.A [symbolic = @HasA2.WithSelf.%HasA2.WithSelf.A (constants.%HasA2.WithSelf.A.39a)] {} {}
  449. // CHECK:STDOUT: %assoc0: %HasA2.assoc_type = assoc_entity element0, %HasA2.WithSelf.A.decl [concrete = constants.%assoc0.e6e]
  450. // CHECK:STDOUT:
  451. // CHECK:STDOUT: !members:
  452. // CHECK:STDOUT: .Self = %Self
  453. // CHECK:STDOUT: .A = @HasA2.WithSelf.%assoc0
  454. // CHECK:STDOUT: witness = (@HasA2.WithSelf.%HasA2.WithSelf.A.decl)
  455. // CHECK:STDOUT:
  456. // CHECK:STDOUT: !requires:
  457. // CHECK:STDOUT: }
  458. // CHECK:STDOUT:
  459. // CHECK:STDOUT: impl @D.as.HasA1.impl: %Self.ref as %HasA1.ref {
  460. // CHECK:STDOUT: %D.as.HasA1.impl.A.decl: %D.as.HasA1.impl.A.type = fn_decl @D.as.HasA1.impl.A [concrete = constants.%D.as.HasA1.impl.A] {} {}
  461. // CHECK:STDOUT: %HasA1.impl_witness_table = impl_witness_table (%D.as.HasA1.impl.A.decl), @D.as.HasA1.impl [concrete]
  462. // CHECK:STDOUT: %HasA1.impl_witness: <witness> = impl_witness %HasA1.impl_witness_table [concrete = constants.%HasA1.impl_witness]
  463. // CHECK:STDOUT:
  464. // CHECK:STDOUT: !members:
  465. // CHECK:STDOUT: .A = %D.as.HasA1.impl.A.decl
  466. // CHECK:STDOUT: witness = %HasA1.impl_witness
  467. // CHECK:STDOUT: }
  468. // CHECK:STDOUT:
  469. // CHECK:STDOUT: impl @D.as.HasA2.impl: %Self.ref as %HasA2.ref {
  470. // CHECK:STDOUT: %D.as.HasA2.impl.A.decl: %D.as.HasA2.impl.A.type = fn_decl @D.as.HasA2.impl.A [concrete = constants.%D.as.HasA2.impl.A] {} {}
  471. // CHECK:STDOUT: %HasA2.impl_witness_table = impl_witness_table (%D.as.HasA2.impl.A.decl), @D.as.HasA2.impl [concrete]
  472. // CHECK:STDOUT: %HasA2.impl_witness: <witness> = impl_witness %HasA2.impl_witness_table [concrete = constants.%HasA2.impl_witness]
  473. // CHECK:STDOUT:
  474. // CHECK:STDOUT: !members:
  475. // CHECK:STDOUT: .A = %D.as.HasA2.impl.A.decl
  476. // CHECK:STDOUT: witness = %HasA2.impl_witness
  477. // CHECK:STDOUT: }
  478. // CHECK:STDOUT:
  479. // CHECK:STDOUT: class @D {
  480. // CHECK:STDOUT: impl_decl @D.as.HasA1.impl [concrete] {} {
  481. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%D [concrete = constants.%D]
  482. // CHECK:STDOUT: %HasA1.ref: type = name_ref HasA1, file.%HasA1.decl [concrete = constants.%HasA1.type]
  483. // CHECK:STDOUT: }
  484. // CHECK:STDOUT: impl_decl @D.as.HasA2.impl [concrete] {} {
  485. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%D [concrete = constants.%D]
  486. // CHECK:STDOUT: %HasA2.ref: type = name_ref HasA2, file.%HasA2.decl [concrete = constants.%HasA2.type]
  487. // CHECK:STDOUT: }
  488. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  489. // CHECK:STDOUT: complete_type_witness = %complete_type
  490. // CHECK:STDOUT:
  491. // CHECK:STDOUT: !members:
  492. // CHECK:STDOUT: .Self = constants.%D
  493. // CHECK:STDOUT: .HasA1 = <poisoned>
  494. // CHECK:STDOUT: .HasA2 = <poisoned>
  495. // CHECK:STDOUT: .A = <poisoned>
  496. // CHECK:STDOUT: extend @D.as.HasA1.impl.%HasA1.ref
  497. // CHECK:STDOUT: extend @D.as.HasA2.impl.%HasA2.ref
  498. // CHECK:STDOUT: }
  499. // CHECK:STDOUT:
  500. // CHECK:STDOUT: generic fn @HasA1.WithSelf.A(@HasA1.%Self: %HasA1.type) {
  501. // CHECK:STDOUT: fn();
  502. // CHECK:STDOUT: }
  503. // CHECK:STDOUT:
  504. // CHECK:STDOUT: generic fn @HasA2.WithSelf.A(@HasA2.%Self: %HasA2.type) {
  505. // CHECK:STDOUT: fn();
  506. // CHECK:STDOUT: }
  507. // CHECK:STDOUT:
  508. // CHECK:STDOUT: fn @D.as.HasA1.impl.A() {
  509. // CHECK:STDOUT: !entry:
  510. // CHECK:STDOUT: return
  511. // CHECK:STDOUT: }
  512. // CHECK:STDOUT:
  513. // CHECK:STDOUT: fn @D.as.HasA2.impl.A() {
  514. // CHECK:STDOUT: !entry:
  515. // CHECK:STDOUT: return
  516. // CHECK:STDOUT: }
  517. // CHECK:STDOUT:
  518. // CHECK:STDOUT: fn @B(%d.param: %D) {
  519. // CHECK:STDOUT: !entry:
  520. // CHECK:STDOUT: %D.ref.loc26: type = name_ref D, file.%D.decl [concrete = constants.%D]
  521. // CHECK:STDOUT: %A.ref.loc26: <error> = name_ref A, <error> [concrete = <error>]
  522. // CHECK:STDOUT: %d.ref: %D = name_ref d, %d
  523. // CHECK:STDOUT: %A.ref.loc31: <error> = name_ref A, <error> [concrete = <error>]
  524. // CHECK:STDOUT: return
  525. // CHECK:STDOUT: }
  526. // CHECK:STDOUT:
  527. // CHECK:STDOUT: specific @HasA1.WithSelf(constants.%Self.5fb) {
  528. // CHECK:STDOUT: !definition:
  529. // CHECK:STDOUT: %Self => constants.%Self.5fb
  530. // CHECK:STDOUT: %HasA1.WithSelf.A.type => constants.%HasA1.WithSelf.A.type.bc6
  531. // CHECK:STDOUT: %HasA1.WithSelf.A => constants.%HasA1.WithSelf.A.972
  532. // CHECK:STDOUT: }
  533. // CHECK:STDOUT:
  534. // CHECK:STDOUT: specific @HasA1.WithSelf.A(constants.%Self.5fb) {}
  535. // CHECK:STDOUT:
  536. // CHECK:STDOUT: specific @HasA2.WithSelf(constants.%Self.dd3) {
  537. // CHECK:STDOUT: !definition:
  538. // CHECK:STDOUT: %Self => constants.%Self.dd3
  539. // CHECK:STDOUT: %HasA2.WithSelf.A.type => constants.%HasA2.WithSelf.A.type.b2b
  540. // CHECK:STDOUT: %HasA2.WithSelf.A => constants.%HasA2.WithSelf.A.39a
  541. // CHECK:STDOUT: }
  542. // CHECK:STDOUT:
  543. // CHECK:STDOUT: specific @HasA2.WithSelf.A(constants.%Self.dd3) {}
  544. // CHECK:STDOUT:
  545. // CHECK:STDOUT: specific @HasA1.WithSelf(constants.%HasA1.facet) {
  546. // CHECK:STDOUT: !definition:
  547. // CHECK:STDOUT: %Self => constants.%HasA1.facet
  548. // CHECK:STDOUT: %HasA1.WithSelf.A.type => constants.%HasA1.WithSelf.A.type.bad
  549. // CHECK:STDOUT: %HasA1.WithSelf.A => constants.%HasA1.WithSelf.A.4c9
  550. // CHECK:STDOUT: }
  551. // CHECK:STDOUT:
  552. // CHECK:STDOUT: specific @HasA1.WithSelf.A(constants.%HasA1.facet) {}
  553. // CHECK:STDOUT:
  554. // CHECK:STDOUT: specific @HasA2.WithSelf(constants.%HasA2.facet) {
  555. // CHECK:STDOUT: !definition:
  556. // CHECK:STDOUT: %Self => constants.%HasA2.facet
  557. // CHECK:STDOUT: %HasA2.WithSelf.A.type => constants.%HasA2.WithSelf.A.type.1d3
  558. // CHECK:STDOUT: %HasA2.WithSelf.A => constants.%HasA2.WithSelf.A.c84
  559. // CHECK:STDOUT: }
  560. // CHECK:STDOUT:
  561. // CHECK:STDOUT: specific @HasA2.WithSelf.A(constants.%HasA2.facet) {}
  562. // CHECK:STDOUT:
  563. // CHECK:STDOUT: specific @HasA2.WithSelf(constants.%D.type.facet) {
  564. // CHECK:STDOUT: !definition:
  565. // CHECK:STDOUT: %Self => constants.%D.type.facet
  566. // CHECK:STDOUT: %HasA2.WithSelf.A.type => constants.%HasA2.WithSelf.A.type.435
  567. // CHECK:STDOUT: %HasA2.WithSelf.A => constants.%HasA2.WithSelf.A.6fa
  568. // CHECK:STDOUT: }
  569. // CHECK:STDOUT:
  570. // CHECK:STDOUT: specific @HasA1.WithSelf(constants.%D.type.facet) {
  571. // CHECK:STDOUT: !definition:
  572. // CHECK:STDOUT: %Self => constants.%D.type.facet
  573. // CHECK:STDOUT: %HasA1.WithSelf.A.type => constants.%HasA1.WithSelf.A.type.299
  574. // CHECK:STDOUT: %HasA1.WithSelf.A => constants.%HasA1.WithSelf.A.d53
  575. // CHECK:STDOUT: }
  576. // CHECK:STDOUT:
  577. // CHECK:STDOUT: --- different_impl_and_base.carbon
  578. // CHECK:STDOUT:
  579. // CHECK:STDOUT: constants {
  580. // CHECK:STDOUT: %HasI.type: type = facet_type <@HasI> [concrete]
  581. // CHECK:STDOUT: %Self: %HasI.type = symbolic_binding Self, 0 [symbolic]
  582. // CHECK:STDOUT: %HasI.WithSelf.I.type.c0d: type = fn_type @HasI.WithSelf.I, @HasI.WithSelf(%Self) [symbolic]
  583. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  584. // CHECK:STDOUT: %HasI.WithSelf.I.4ad: %HasI.WithSelf.I.type.c0d = struct_value () [symbolic]
  585. // CHECK:STDOUT: %HasI.assoc_type: type = assoc_entity_type @HasI [concrete]
  586. // CHECK:STDOUT: %assoc0: %HasI.assoc_type = assoc_entity element0, @HasI.WithSelf.%HasI.WithSelf.I.decl [concrete]
  587. // CHECK:STDOUT: %B: type = class_type @B [concrete]
  588. // CHECK:STDOUT: %B.J.type: type = fn_type @B.J [concrete]
  589. // CHECK:STDOUT: %B.J: %B.J.type = struct_value () [concrete]
  590. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  591. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  592. // CHECK:STDOUT: %E: type = class_type @E [concrete]
  593. // CHECK:STDOUT: %E.elem: type = unbound_element_type %E, %B [concrete]
  594. // CHECK:STDOUT: %HasI.impl_witness: <witness> = impl_witness @E.as.HasI.impl.%HasI.impl_witness_table [concrete]
  595. // CHECK:STDOUT: %E.as.HasI.impl.I.type: type = fn_type @E.as.HasI.impl.I [concrete]
  596. // CHECK:STDOUT: %E.as.HasI.impl.I: %E.as.HasI.impl.I.type = struct_value () [concrete]
  597. // CHECK:STDOUT: %HasI.facet: %HasI.type = facet_value %E, (%HasI.impl_witness) [concrete]
  598. // CHECK:STDOUT: %HasI.WithSelf.I.type.ece: type = fn_type @HasI.WithSelf.I, @HasI.WithSelf(%HasI.facet) [concrete]
  599. // CHECK:STDOUT: %HasI.WithSelf.I.a85: %HasI.WithSelf.I.type.ece = struct_value () [concrete]
  600. // CHECK:STDOUT: %struct_type.base.64a: type = struct_type {.base: %B} [concrete]
  601. // CHECK:STDOUT: %complete_type.021: <witness> = complete_type_witness %struct_type.base.64a [concrete]
  602. // CHECK:STDOUT: %pattern_type: type = pattern_type %E [concrete]
  603. // CHECK:STDOUT: %H.type: type = fn_type @H [concrete]
  604. // CHECK:STDOUT: %H: %H.type = struct_value () [concrete]
  605. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  606. // CHECK:STDOUT: %E.type.facet: %type = facet_value %E, () [concrete]
  607. // CHECK:STDOUT: %HasI.WithSelf.I.type.ca9: type = fn_type @HasI.WithSelf.I, @HasI.WithSelf(%E.type.facet) [concrete]
  608. // CHECK:STDOUT: %HasI.WithSelf.I.b25: %HasI.WithSelf.I.type.ca9 = struct_value () [concrete]
  609. // CHECK:STDOUT: %.170: type = fn_type_with_self_type %HasI.WithSelf.I.type.ece, %HasI.facet [concrete]
  610. // CHECK:STDOUT: }
  611. // CHECK:STDOUT:
  612. // CHECK:STDOUT: file {
  613. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  614. // CHECK:STDOUT: .HasI = %HasI.decl
  615. // CHECK:STDOUT: .B = %B.decl
  616. // CHECK:STDOUT: .E = %E.decl
  617. // CHECK:STDOUT: .H = %H.decl
  618. // CHECK:STDOUT: }
  619. // CHECK:STDOUT: %HasI.decl: type = interface_decl @HasI [concrete = constants.%HasI.type] {} {}
  620. // CHECK:STDOUT: %B.decl: type = class_decl @B [concrete = constants.%B] {} {}
  621. // CHECK:STDOUT: %E.decl: type = class_decl @E [concrete = constants.%E] {} {}
  622. // CHECK:STDOUT: %H.decl: %H.type = fn_decl @H [concrete = constants.%H] {
  623. // CHECK:STDOUT: %e.param_patt: %pattern_type = value_param_pattern [concrete]
  624. // CHECK:STDOUT: %e.patt: %pattern_type = at_binding_pattern e, %e.param_patt [concrete]
  625. // CHECK:STDOUT: } {
  626. // CHECK:STDOUT: %e.param: %E = value_param call_param0
  627. // CHECK:STDOUT: %E.ref.loc19: type = name_ref E, file.%E.decl [concrete = constants.%E]
  628. // CHECK:STDOUT: %e: %E = value_binding e, %e.param
  629. // CHECK:STDOUT: }
  630. // CHECK:STDOUT: }
  631. // CHECK:STDOUT:
  632. // CHECK:STDOUT: interface @HasI {
  633. // CHECK:STDOUT: %Self: %HasI.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  634. // CHECK:STDOUT: %HasI.WithSelf.decl = interface_with_self_decl @HasI [concrete]
  635. // CHECK:STDOUT:
  636. // CHECK:STDOUT: !with Self:
  637. // CHECK:STDOUT: %HasI.WithSelf.I.decl: @HasI.WithSelf.%HasI.WithSelf.I.type (%HasI.WithSelf.I.type.c0d) = fn_decl @HasI.WithSelf.I [symbolic = @HasI.WithSelf.%HasI.WithSelf.I (constants.%HasI.WithSelf.I.4ad)] {} {}
  638. // CHECK:STDOUT: %assoc0: %HasI.assoc_type = assoc_entity element0, %HasI.WithSelf.I.decl [concrete = constants.%assoc0]
  639. // CHECK:STDOUT:
  640. // CHECK:STDOUT: !members:
  641. // CHECK:STDOUT: .Self = %Self
  642. // CHECK:STDOUT: .I = @HasI.WithSelf.%assoc0
  643. // CHECK:STDOUT: .J = <poisoned>
  644. // CHECK:STDOUT: witness = (@HasI.WithSelf.%HasI.WithSelf.I.decl)
  645. // CHECK:STDOUT:
  646. // CHECK:STDOUT: !requires:
  647. // CHECK:STDOUT: }
  648. // CHECK:STDOUT:
  649. // CHECK:STDOUT: impl @E.as.HasI.impl: %Self.ref as %HasI.ref {
  650. // CHECK:STDOUT: %E.as.HasI.impl.I.decl: %E.as.HasI.impl.I.type = fn_decl @E.as.HasI.impl.I [concrete = constants.%E.as.HasI.impl.I] {} {}
  651. // CHECK:STDOUT: %HasI.impl_witness_table = impl_witness_table (%E.as.HasI.impl.I.decl), @E.as.HasI.impl [concrete]
  652. // CHECK:STDOUT: %HasI.impl_witness: <witness> = impl_witness %HasI.impl_witness_table [concrete = constants.%HasI.impl_witness]
  653. // CHECK:STDOUT:
  654. // CHECK:STDOUT: !members:
  655. // CHECK:STDOUT: .I = %E.as.HasI.impl.I.decl
  656. // CHECK:STDOUT: witness = %HasI.impl_witness
  657. // CHECK:STDOUT: }
  658. // CHECK:STDOUT:
  659. // CHECK:STDOUT: class @B {
  660. // CHECK:STDOUT: %B.J.decl: %B.J.type = fn_decl @B.J [concrete = constants.%B.J] {} {}
  661. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357]
  662. // CHECK:STDOUT: complete_type_witness = %complete_type
  663. // CHECK:STDOUT:
  664. // CHECK:STDOUT: !members:
  665. // CHECK:STDOUT: .Self = constants.%B
  666. // CHECK:STDOUT: .J = %B.J.decl
  667. // CHECK:STDOUT: .HasI = <poisoned>
  668. // CHECK:STDOUT: .I = <poisoned>
  669. // CHECK:STDOUT: }
  670. // CHECK:STDOUT:
  671. // CHECK:STDOUT: class @E {
  672. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B]
  673. // CHECK:STDOUT: %.loc13: %E.elem = base_decl %B.ref, element0 [concrete]
  674. // CHECK:STDOUT: impl_decl @E.as.HasI.impl [concrete] {} {
  675. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%E [concrete = constants.%E]
  676. // CHECK:STDOUT: %HasI.ref: type = name_ref HasI, file.%HasI.decl [concrete = constants.%HasI.type]
  677. // CHECK:STDOUT: }
  678. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%struct_type.base.64a [concrete = constants.%complete_type.021]
  679. // CHECK:STDOUT: complete_type_witness = %complete_type
  680. // CHECK:STDOUT:
  681. // CHECK:STDOUT: !members:
  682. // CHECK:STDOUT: .Self = constants.%E
  683. // CHECK:STDOUT: .B = <poisoned>
  684. // CHECK:STDOUT: .base = %.loc13
  685. // CHECK:STDOUT: .HasI = <poisoned>
  686. // CHECK:STDOUT: .I = <poisoned>
  687. // CHECK:STDOUT: .J = <poisoned>
  688. // CHECK:STDOUT: extend %B.ref
  689. // CHECK:STDOUT: extend @E.as.HasI.impl.%HasI.ref
  690. // CHECK:STDOUT: }
  691. // CHECK:STDOUT:
  692. // CHECK:STDOUT: generic fn @HasI.WithSelf.I(@HasI.%Self: %HasI.type) {
  693. // CHECK:STDOUT: fn();
  694. // CHECK:STDOUT: }
  695. // CHECK:STDOUT:
  696. // CHECK:STDOUT: fn @B.J() {
  697. // CHECK:STDOUT: !entry:
  698. // CHECK:STDOUT: return
  699. // CHECK:STDOUT: }
  700. // CHECK:STDOUT:
  701. // CHECK:STDOUT: fn @E.as.HasI.impl.I() {
  702. // CHECK:STDOUT: !entry:
  703. // CHECK:STDOUT: return
  704. // CHECK:STDOUT: }
  705. // CHECK:STDOUT:
  706. // CHECK:STDOUT: fn @H(%e.param: %E) {
  707. // CHECK:STDOUT: !entry:
  708. // CHECK:STDOUT: %E.ref.loc20: type = name_ref E, file.%E.decl [concrete = constants.%E]
  709. // CHECK:STDOUT: %I.ref.loc20: %HasI.assoc_type = name_ref I, @HasI.WithSelf.%assoc0 [concrete = constants.%assoc0]
  710. // CHECK:STDOUT: %impl.elem0.loc20: %.170 = impl_witness_access constants.%HasI.impl_witness, element0 [concrete = constants.%E.as.HasI.impl.I]
  711. // CHECK:STDOUT: %E.as.HasI.impl.I.call.loc20: init %empty_tuple.type = call %impl.elem0.loc20()
  712. // CHECK:STDOUT: %e.ref.loc21: %E = name_ref e, %e
  713. // CHECK:STDOUT: %I.ref.loc21: %HasI.assoc_type = name_ref I, @HasI.WithSelf.%assoc0 [concrete = constants.%assoc0]
  714. // CHECK:STDOUT: %impl.elem0.loc21: %.170 = impl_witness_access constants.%HasI.impl_witness, element0 [concrete = constants.%E.as.HasI.impl.I]
  715. // CHECK:STDOUT: %E.as.HasI.impl.I.call.loc21: init %empty_tuple.type = call %impl.elem0.loc21()
  716. // CHECK:STDOUT: %E.ref.loc22: type = name_ref E, file.%E.decl [concrete = constants.%E]
  717. // CHECK:STDOUT: %J.ref.loc22: %B.J.type = name_ref J, @B.%B.J.decl [concrete = constants.%B.J]
  718. // CHECK:STDOUT: %B.J.call.loc22: init %empty_tuple.type = call %J.ref.loc22()
  719. // CHECK:STDOUT: %e.ref.loc23: %E = name_ref e, %e
  720. // CHECK:STDOUT: %J.ref.loc23: %B.J.type = name_ref J, @B.%B.J.decl [concrete = constants.%B.J]
  721. // CHECK:STDOUT: %B.J.call.loc23: init %empty_tuple.type = call %J.ref.loc23()
  722. // CHECK:STDOUT: return
  723. // CHECK:STDOUT: }
  724. // CHECK:STDOUT:
  725. // CHECK:STDOUT: specific @HasI.WithSelf(constants.%Self) {
  726. // CHECK:STDOUT: !definition:
  727. // CHECK:STDOUT: %Self => constants.%Self
  728. // CHECK:STDOUT: %HasI.WithSelf.I.type => constants.%HasI.WithSelf.I.type.c0d
  729. // CHECK:STDOUT: %HasI.WithSelf.I => constants.%HasI.WithSelf.I.4ad
  730. // CHECK:STDOUT: }
  731. // CHECK:STDOUT:
  732. // CHECK:STDOUT: specific @HasI.WithSelf.I(constants.%Self) {}
  733. // CHECK:STDOUT:
  734. // CHECK:STDOUT: specific @HasI.WithSelf(constants.%HasI.facet) {
  735. // CHECK:STDOUT: !definition:
  736. // CHECK:STDOUT: %Self => constants.%HasI.facet
  737. // CHECK:STDOUT: %HasI.WithSelf.I.type => constants.%HasI.WithSelf.I.type.ece
  738. // CHECK:STDOUT: %HasI.WithSelf.I => constants.%HasI.WithSelf.I.a85
  739. // CHECK:STDOUT: }
  740. // CHECK:STDOUT:
  741. // CHECK:STDOUT: specific @HasI.WithSelf.I(constants.%HasI.facet) {}
  742. // CHECK:STDOUT:
  743. // CHECK:STDOUT: specific @HasI.WithSelf(constants.%E.type.facet) {
  744. // CHECK:STDOUT: !definition:
  745. // CHECK:STDOUT: %Self => constants.%E.type.facet
  746. // CHECK:STDOUT: %HasI.WithSelf.I.type => constants.%HasI.WithSelf.I.type.ca9
  747. // CHECK:STDOUT: %HasI.WithSelf.I => constants.%HasI.WithSelf.I.b25
  748. // CHECK:STDOUT: }
  749. // CHECK:STDOUT:
  750. // CHECK:STDOUT: --- fail_ambiguous_impl_and_base.carbon
  751. // CHECK:STDOUT:
  752. // CHECK:STDOUT: constants {
  753. // CHECK:STDOUT: %Base: type = class_type @Base [concrete]
  754. // CHECK:STDOUT: %Base.K.type: type = fn_type @Base.K [concrete]
  755. // CHECK:STDOUT: %Base.K: %Base.K.type = struct_value () [concrete]
  756. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  757. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  758. // CHECK:STDOUT: %HasK.type: type = facet_type <@HasK> [concrete]
  759. // CHECK:STDOUT: %Self: %HasK.type = symbolic_binding Self, 0 [symbolic]
  760. // CHECK:STDOUT: %HasK.WithSelf.K.type.81f: type = fn_type @HasK.WithSelf.K, @HasK.WithSelf(%Self) [symbolic]
  761. // CHECK:STDOUT: %HasK.WithSelf.K.fb8: %HasK.WithSelf.K.type.81f = struct_value () [symbolic]
  762. // CHECK:STDOUT: %HasK.assoc_type: type = assoc_entity_type @HasK [concrete]
  763. // CHECK:STDOUT: %assoc0: %HasK.assoc_type = assoc_entity element0, @HasK.WithSelf.%HasK.WithSelf.K.decl [concrete]
  764. // CHECK:STDOUT: %L: type = class_type @L [concrete]
  765. // CHECK:STDOUT: %L.elem: type = unbound_element_type %L, %Base [concrete]
  766. // CHECK:STDOUT: %HasK.impl_witness: <witness> = impl_witness @L.as.HasK.impl.%HasK.impl_witness_table [concrete]
  767. // CHECK:STDOUT: %L.as.HasK.impl.K.type: type = fn_type @L.as.HasK.impl.K [concrete]
  768. // CHECK:STDOUT: %L.as.HasK.impl.K: %L.as.HasK.impl.K.type = struct_value () [concrete]
  769. // CHECK:STDOUT: %HasK.facet: %HasK.type = facet_value %L, (%HasK.impl_witness) [concrete]
  770. // CHECK:STDOUT: %HasK.WithSelf.K.type.2e3: type = fn_type @HasK.WithSelf.K, @HasK.WithSelf(%HasK.facet) [concrete]
  771. // CHECK:STDOUT: %HasK.WithSelf.K.99c: %HasK.WithSelf.K.type.2e3 = struct_value () [concrete]
  772. // CHECK:STDOUT: %struct_type.base.27a: type = struct_type {.base: %Base} [concrete]
  773. // CHECK:STDOUT: %complete_type.5a1: <witness> = complete_type_witness %struct_type.base.27a [concrete]
  774. // CHECK:STDOUT: %pattern_type: type = pattern_type %L [concrete]
  775. // CHECK:STDOUT: %M.type: type = fn_type @M [concrete]
  776. // CHECK:STDOUT: %M: %M.type = struct_value () [concrete]
  777. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  778. // CHECK:STDOUT: %L.type.facet: %type = facet_value %L, () [concrete]
  779. // CHECK:STDOUT: %HasK.WithSelf.K.type.837: type = fn_type @HasK.WithSelf.K, @HasK.WithSelf(%L.type.facet) [concrete]
  780. // CHECK:STDOUT: %HasK.WithSelf.K.0b2: %HasK.WithSelf.K.type.837 = struct_value () [concrete]
  781. // CHECK:STDOUT: }
  782. // CHECK:STDOUT:
  783. // CHECK:STDOUT: file {
  784. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  785. // CHECK:STDOUT: .Base = %Base.decl
  786. // CHECK:STDOUT: .HasK = %HasK.decl
  787. // CHECK:STDOUT: .L = %L.decl
  788. // CHECK:STDOUT: .M = %M.decl
  789. // CHECK:STDOUT: }
  790. // CHECK:STDOUT: %Base.decl: type = class_decl @Base [concrete = constants.%Base] {} {}
  791. // CHECK:STDOUT: %HasK.decl: type = interface_decl @HasK [concrete = constants.%HasK.type] {} {}
  792. // CHECK:STDOUT: %L.decl: type = class_decl @L [concrete = constants.%L] {} {}
  793. // CHECK:STDOUT: %M.decl: %M.type = fn_decl @M [concrete = constants.%M] {
  794. // CHECK:STDOUT: %l.param_patt: %pattern_type = value_param_pattern [concrete]
  795. // CHECK:STDOUT: %l.patt: %pattern_type = at_binding_pattern l, %l.param_patt [concrete]
  796. // CHECK:STDOUT: } {
  797. // CHECK:STDOUT: %l.param: %L = value_param call_param0
  798. // CHECK:STDOUT: %L.ref.loc19: type = name_ref L, file.%L.decl [concrete = constants.%L]
  799. // CHECK:STDOUT: %l: %L = value_binding l, %l.param
  800. // CHECK:STDOUT: }
  801. // CHECK:STDOUT: }
  802. // CHECK:STDOUT:
  803. // CHECK:STDOUT: interface @HasK {
  804. // CHECK:STDOUT: %Self: %HasK.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  805. // CHECK:STDOUT: %HasK.WithSelf.decl = interface_with_self_decl @HasK [concrete]
  806. // CHECK:STDOUT:
  807. // CHECK:STDOUT: !with Self:
  808. // CHECK:STDOUT: %HasK.WithSelf.K.decl: @HasK.WithSelf.%HasK.WithSelf.K.type (%HasK.WithSelf.K.type.81f) = fn_decl @HasK.WithSelf.K [symbolic = @HasK.WithSelf.%HasK.WithSelf.K (constants.%HasK.WithSelf.K.fb8)] {} {}
  809. // CHECK:STDOUT: %assoc0: %HasK.assoc_type = assoc_entity element0, %HasK.WithSelf.K.decl [concrete = constants.%assoc0]
  810. // CHECK:STDOUT:
  811. // CHECK:STDOUT: !members:
  812. // CHECK:STDOUT: .Self = %Self
  813. // CHECK:STDOUT: .K = @HasK.WithSelf.%assoc0
  814. // CHECK:STDOUT: witness = (@HasK.WithSelf.%HasK.WithSelf.K.decl)
  815. // CHECK:STDOUT:
  816. // CHECK:STDOUT: !requires:
  817. // CHECK:STDOUT: }
  818. // CHECK:STDOUT:
  819. // CHECK:STDOUT: impl @L.as.HasK.impl: %Self.ref as %HasK.ref {
  820. // CHECK:STDOUT: %L.as.HasK.impl.K.decl: %L.as.HasK.impl.K.type = fn_decl @L.as.HasK.impl.K [concrete = constants.%L.as.HasK.impl.K] {} {}
  821. // CHECK:STDOUT: %HasK.impl_witness_table = impl_witness_table (%L.as.HasK.impl.K.decl), @L.as.HasK.impl [concrete]
  822. // CHECK:STDOUT: %HasK.impl_witness: <witness> = impl_witness %HasK.impl_witness_table [concrete = constants.%HasK.impl_witness]
  823. // CHECK:STDOUT:
  824. // CHECK:STDOUT: !members:
  825. // CHECK:STDOUT: .K = %L.as.HasK.impl.K.decl
  826. // CHECK:STDOUT: witness = %HasK.impl_witness
  827. // CHECK:STDOUT: }
  828. // CHECK:STDOUT:
  829. // CHECK:STDOUT: class @Base {
  830. // CHECK:STDOUT: %Base.K.decl: %Base.K.type = fn_decl @Base.K [concrete = constants.%Base.K] {} {}
  831. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357]
  832. // CHECK:STDOUT: complete_type_witness = %complete_type
  833. // CHECK:STDOUT:
  834. // CHECK:STDOUT: !members:
  835. // CHECK:STDOUT: .Self = constants.%Base
  836. // CHECK:STDOUT: .K = %Base.K.decl
  837. // CHECK:STDOUT: .HasK = <poisoned>
  838. // CHECK:STDOUT: }
  839. // CHECK:STDOUT:
  840. // CHECK:STDOUT: class @L {
  841. // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [concrete = constants.%Base]
  842. // CHECK:STDOUT: %.loc13: %L.elem = base_decl %Base.ref, element0 [concrete]
  843. // CHECK:STDOUT: impl_decl @L.as.HasK.impl [concrete] {} {
  844. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%L [concrete = constants.%L]
  845. // CHECK:STDOUT: %HasK.ref: type = name_ref HasK, file.%HasK.decl [concrete = constants.%HasK.type]
  846. // CHECK:STDOUT: }
  847. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%struct_type.base.27a [concrete = constants.%complete_type.5a1]
  848. // CHECK:STDOUT: complete_type_witness = %complete_type
  849. // CHECK:STDOUT:
  850. // CHECK:STDOUT: !members:
  851. // CHECK:STDOUT: .Self = constants.%L
  852. // CHECK:STDOUT: .Base = <poisoned>
  853. // CHECK:STDOUT: .base = %.loc13
  854. // CHECK:STDOUT: .HasK = <poisoned>
  855. // CHECK:STDOUT: .K = <poisoned>
  856. // CHECK:STDOUT: extend %Base.ref
  857. // CHECK:STDOUT: extend @L.as.HasK.impl.%HasK.ref
  858. // CHECK:STDOUT: }
  859. // CHECK:STDOUT:
  860. // CHECK:STDOUT: fn @Base.K() {
  861. // CHECK:STDOUT: !entry:
  862. // CHECK:STDOUT: return
  863. // CHECK:STDOUT: }
  864. // CHECK:STDOUT:
  865. // CHECK:STDOUT: generic fn @HasK.WithSelf.K(@HasK.%Self: %HasK.type) {
  866. // CHECK:STDOUT: fn();
  867. // CHECK:STDOUT: }
  868. // CHECK:STDOUT:
  869. // CHECK:STDOUT: fn @L.as.HasK.impl.K() {
  870. // CHECK:STDOUT: !entry:
  871. // CHECK:STDOUT: return
  872. // CHECK:STDOUT: }
  873. // CHECK:STDOUT:
  874. // CHECK:STDOUT: fn @M(%l.param: %L) {
  875. // CHECK:STDOUT: !entry:
  876. // CHECK:STDOUT: %L.ref.loc24: type = name_ref L, file.%L.decl [concrete = constants.%L]
  877. // CHECK:STDOUT: %K.ref.loc24: <error> = name_ref K, <error> [concrete = <error>]
  878. // CHECK:STDOUT: %l.ref: %L = name_ref l, %l
  879. // CHECK:STDOUT: %K.ref.loc29: <error> = name_ref K, <error> [concrete = <error>]
  880. // CHECK:STDOUT: return
  881. // CHECK:STDOUT: }
  882. // CHECK:STDOUT:
  883. // CHECK:STDOUT: specific @HasK.WithSelf(constants.%Self) {
  884. // CHECK:STDOUT: !definition:
  885. // CHECK:STDOUT: %Self => constants.%Self
  886. // CHECK:STDOUT: %HasK.WithSelf.K.type => constants.%HasK.WithSelf.K.type.81f
  887. // CHECK:STDOUT: %HasK.WithSelf.K => constants.%HasK.WithSelf.K.fb8
  888. // CHECK:STDOUT: }
  889. // CHECK:STDOUT:
  890. // CHECK:STDOUT: specific @HasK.WithSelf.K(constants.%Self) {}
  891. // CHECK:STDOUT:
  892. // CHECK:STDOUT: specific @HasK.WithSelf(constants.%HasK.facet) {
  893. // CHECK:STDOUT: !definition:
  894. // CHECK:STDOUT: %Self => constants.%HasK.facet
  895. // CHECK:STDOUT: %HasK.WithSelf.K.type => constants.%HasK.WithSelf.K.type.2e3
  896. // CHECK:STDOUT: %HasK.WithSelf.K => constants.%HasK.WithSelf.K.99c
  897. // CHECK:STDOUT: }
  898. // CHECK:STDOUT:
  899. // CHECK:STDOUT: specific @HasK.WithSelf.K(constants.%HasK.facet) {}
  900. // CHECK:STDOUT:
  901. // CHECK:STDOUT: specific @HasK.WithSelf(constants.%L.type.facet) {
  902. // CHECK:STDOUT: !definition:
  903. // CHECK:STDOUT: %Self => constants.%L.type.facet
  904. // CHECK:STDOUT: %HasK.WithSelf.K.type => constants.%HasK.WithSelf.K.type.837
  905. // CHECK:STDOUT: %HasK.WithSelf.K => constants.%HasK.WithSelf.K.0b2
  906. // CHECK:STDOUT: }
  907. // CHECK:STDOUT:
  908. // CHECK:STDOUT: --- ambiguity_hidden.carbon
  909. // CHECK:STDOUT:
  910. // CHECK:STDOUT: constants {
  911. // CHECK:STDOUT: %NBase: type = class_type @NBase [concrete]
  912. // CHECK:STDOUT: %NBase.N.type: type = fn_type @NBase.N [concrete]
  913. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  914. // CHECK:STDOUT: %NBase.N: %NBase.N.type = struct_value () [concrete]
  915. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  916. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  917. // CHECK:STDOUT: %HasN1.type: type = facet_type <@HasN1> [concrete]
  918. // CHECK:STDOUT: %Self.874: %HasN1.type = symbolic_binding Self, 0 [symbolic]
  919. // CHECK:STDOUT: %HasN1.WithSelf.N.type.684: type = fn_type @HasN1.WithSelf.N, @HasN1.WithSelf(%Self.874) [symbolic]
  920. // CHECK:STDOUT: %HasN1.WithSelf.N.b29: %HasN1.WithSelf.N.type.684 = struct_value () [symbolic]
  921. // CHECK:STDOUT: %HasN1.assoc_type: type = assoc_entity_type @HasN1 [concrete]
  922. // CHECK:STDOUT: %assoc0.23e: %HasN1.assoc_type = assoc_entity element0, @HasN1.WithSelf.%HasN1.WithSelf.N.decl [concrete]
  923. // CHECK:STDOUT: %HasN2.type: type = facet_type <@HasN2> [concrete]
  924. // CHECK:STDOUT: %Self.20b: %HasN2.type = symbolic_binding Self, 0 [symbolic]
  925. // CHECK:STDOUT: %HasN2.WithSelf.N.type.3c7: type = fn_type @HasN2.WithSelf.N, @HasN2.WithSelf(%Self.20b) [symbolic]
  926. // CHECK:STDOUT: %HasN2.WithSelf.N.fce: %HasN2.WithSelf.N.type.3c7 = struct_value () [symbolic]
  927. // CHECK:STDOUT: %HasN2.assoc_type: type = assoc_entity_type @HasN2 [concrete]
  928. // CHECK:STDOUT: %assoc0.4bc: %HasN2.assoc_type = assoc_entity element0, @HasN2.WithSelf.%HasN2.WithSelf.N.decl [concrete]
  929. // CHECK:STDOUT: %O: type = class_type @O [concrete]
  930. // CHECK:STDOUT: %O.elem: type = unbound_element_type %O, %NBase [concrete]
  931. // CHECK:STDOUT: %HasN1.impl_witness: <witness> = impl_witness @O.as.HasN1.impl.%HasN1.impl_witness_table [concrete]
  932. // CHECK:STDOUT: %O.as.HasN1.impl.N.type: type = fn_type @O.as.HasN1.impl.N [concrete]
  933. // CHECK:STDOUT: %O.as.HasN1.impl.N: %O.as.HasN1.impl.N.type = struct_value () [concrete]
  934. // CHECK:STDOUT: %HasN1.facet: %HasN1.type = facet_value %O, (%HasN1.impl_witness) [concrete]
  935. // CHECK:STDOUT: %HasN1.WithSelf.N.type.524: type = fn_type @HasN1.WithSelf.N, @HasN1.WithSelf(%HasN1.facet) [concrete]
  936. // CHECK:STDOUT: %HasN1.WithSelf.N.1bf: %HasN1.WithSelf.N.type.524 = struct_value () [concrete]
  937. // CHECK:STDOUT: %HasN2.impl_witness: <witness> = impl_witness @O.as.HasN2.impl.%HasN2.impl_witness_table [concrete]
  938. // CHECK:STDOUT: %O.as.HasN2.impl.N.type: type = fn_type @O.as.HasN2.impl.N [concrete]
  939. // CHECK:STDOUT: %O.as.HasN2.impl.N: %O.as.HasN2.impl.N.type = struct_value () [concrete]
  940. // CHECK:STDOUT: %HasN2.facet: %HasN2.type = facet_value %O, (%HasN2.impl_witness) [concrete]
  941. // CHECK:STDOUT: %HasN2.WithSelf.N.type.4d2: type = fn_type @HasN2.WithSelf.N, @HasN2.WithSelf(%HasN2.facet) [concrete]
  942. // CHECK:STDOUT: %HasN2.WithSelf.N.b8c: %HasN2.WithSelf.N.type.4d2 = struct_value () [concrete]
  943. // CHECK:STDOUT: %O.N.type: type = fn_type @O.N [concrete]
  944. // CHECK:STDOUT: %O.N: %O.N.type = struct_value () [concrete]
  945. // CHECK:STDOUT: %struct_type.base.df9: type = struct_type {.base: %NBase} [concrete]
  946. // CHECK:STDOUT: %complete_type.0fc: <witness> = complete_type_witness %struct_type.base.df9 [concrete]
  947. // CHECK:STDOUT: %pattern_type: type = pattern_type %O [concrete]
  948. // CHECK:STDOUT: %P.type: type = fn_type @P [concrete]
  949. // CHECK:STDOUT: %P: %P.type = struct_value () [concrete]
  950. // CHECK:STDOUT: }
  951. // CHECK:STDOUT:
  952. // CHECK:STDOUT: file {
  953. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  954. // CHECK:STDOUT: .NBase = %NBase.decl
  955. // CHECK:STDOUT: .HasN1 = %HasN1.decl
  956. // CHECK:STDOUT: .HasN2 = %HasN2.decl
  957. // CHECK:STDOUT: .O = %O.decl
  958. // CHECK:STDOUT: .P = %P.decl
  959. // CHECK:STDOUT: }
  960. // CHECK:STDOUT: %NBase.decl: type = class_decl @NBase [concrete = constants.%NBase] {} {}
  961. // CHECK:STDOUT: %HasN1.decl: type = interface_decl @HasN1 [concrete = constants.%HasN1.type] {} {}
  962. // CHECK:STDOUT: %HasN2.decl: type = interface_decl @HasN2 [concrete = constants.%HasN2.type] {} {}
  963. // CHECK:STDOUT: %O.decl: type = class_decl @O [concrete = constants.%O] {} {}
  964. // CHECK:STDOUT: %P.decl: %P.type = fn_decl @P [concrete = constants.%P] {
  965. // CHECK:STDOUT: %o.param_patt: %pattern_type = value_param_pattern [concrete]
  966. // CHECK:STDOUT: %o.patt: %pattern_type = at_binding_pattern o, %o.param_patt [concrete]
  967. // CHECK:STDOUT: } {
  968. // CHECK:STDOUT: %o.param: %O = value_param call_param0
  969. // CHECK:STDOUT: %O.ref.loc27: type = name_ref O, file.%O.decl [concrete = constants.%O]
  970. // CHECK:STDOUT: %o: %O = value_binding o, %o.param
  971. // CHECK:STDOUT: }
  972. // CHECK:STDOUT: }
  973. // CHECK:STDOUT:
  974. // CHECK:STDOUT: interface @HasN1 {
  975. // CHECK:STDOUT: %Self: %HasN1.type = symbolic_binding Self, 0 [symbolic = constants.%Self.874]
  976. // CHECK:STDOUT: %HasN1.WithSelf.decl = interface_with_self_decl @HasN1 [concrete]
  977. // CHECK:STDOUT:
  978. // CHECK:STDOUT: !with Self:
  979. // CHECK:STDOUT: %HasN1.WithSelf.N.decl: @HasN1.WithSelf.%HasN1.WithSelf.N.type (%HasN1.WithSelf.N.type.684) = fn_decl @HasN1.WithSelf.N [symbolic = @HasN1.WithSelf.%HasN1.WithSelf.N (constants.%HasN1.WithSelf.N.b29)] {} {}
  980. // CHECK:STDOUT: %assoc0: %HasN1.assoc_type = assoc_entity element0, %HasN1.WithSelf.N.decl [concrete = constants.%assoc0.23e]
  981. // CHECK:STDOUT:
  982. // CHECK:STDOUT: !members:
  983. // CHECK:STDOUT: .Self = %Self
  984. // CHECK:STDOUT: .N = @HasN1.WithSelf.%assoc0
  985. // CHECK:STDOUT: .HasN2 = <poisoned>
  986. // CHECK:STDOUT: witness = (@HasN1.WithSelf.%HasN1.WithSelf.N.decl)
  987. // CHECK:STDOUT:
  988. // CHECK:STDOUT: !requires:
  989. // CHECK:STDOUT: }
  990. // CHECK:STDOUT:
  991. // CHECK:STDOUT: interface @HasN2 {
  992. // CHECK:STDOUT: %Self: %HasN2.type = symbolic_binding Self, 0 [symbolic = constants.%Self.20b]
  993. // CHECK:STDOUT: %HasN2.WithSelf.decl = interface_with_self_decl @HasN2 [concrete]
  994. // CHECK:STDOUT:
  995. // CHECK:STDOUT: !with Self:
  996. // CHECK:STDOUT: %HasN2.WithSelf.N.decl: @HasN2.WithSelf.%HasN2.WithSelf.N.type (%HasN2.WithSelf.N.type.3c7) = fn_decl @HasN2.WithSelf.N [symbolic = @HasN2.WithSelf.%HasN2.WithSelf.N (constants.%HasN2.WithSelf.N.fce)] {} {}
  997. // CHECK:STDOUT: %assoc0: %HasN2.assoc_type = assoc_entity element0, %HasN2.WithSelf.N.decl [concrete = constants.%assoc0.4bc]
  998. // CHECK:STDOUT:
  999. // CHECK:STDOUT: !members:
  1000. // CHECK:STDOUT: .Self = %Self
  1001. // CHECK:STDOUT: .N = @HasN2.WithSelf.%assoc0
  1002. // CHECK:STDOUT: witness = (@HasN2.WithSelf.%HasN2.WithSelf.N.decl)
  1003. // CHECK:STDOUT:
  1004. // CHECK:STDOUT: !requires:
  1005. // CHECK:STDOUT: }
  1006. // CHECK:STDOUT:
  1007. // CHECK:STDOUT: impl @O.as.HasN1.impl: %Self.ref as %HasN1.ref {
  1008. // CHECK:STDOUT: %O.as.HasN1.impl.N.decl: %O.as.HasN1.impl.N.type = fn_decl @O.as.HasN1.impl.N [concrete = constants.%O.as.HasN1.impl.N] {} {}
  1009. // CHECK:STDOUT: %HasN1.impl_witness_table = impl_witness_table (%O.as.HasN1.impl.N.decl), @O.as.HasN1.impl [concrete]
  1010. // CHECK:STDOUT: %HasN1.impl_witness: <witness> = impl_witness %HasN1.impl_witness_table [concrete = constants.%HasN1.impl_witness]
  1011. // CHECK:STDOUT:
  1012. // CHECK:STDOUT: !members:
  1013. // CHECK:STDOUT: .N = %O.as.HasN1.impl.N.decl
  1014. // CHECK:STDOUT: witness = %HasN1.impl_witness
  1015. // CHECK:STDOUT: }
  1016. // CHECK:STDOUT:
  1017. // CHECK:STDOUT: impl @O.as.HasN2.impl: %Self.ref as %HasN2.ref {
  1018. // CHECK:STDOUT: %O.as.HasN2.impl.N.decl: %O.as.HasN2.impl.N.type = fn_decl @O.as.HasN2.impl.N [concrete = constants.%O.as.HasN2.impl.N] {} {}
  1019. // CHECK:STDOUT: %HasN2.impl_witness_table = impl_witness_table (%O.as.HasN2.impl.N.decl), @O.as.HasN2.impl [concrete]
  1020. // CHECK:STDOUT: %HasN2.impl_witness: <witness> = impl_witness %HasN2.impl_witness_table [concrete = constants.%HasN2.impl_witness]
  1021. // CHECK:STDOUT:
  1022. // CHECK:STDOUT: !members:
  1023. // CHECK:STDOUT: .N = %O.as.HasN2.impl.N.decl
  1024. // CHECK:STDOUT: witness = %HasN2.impl_witness
  1025. // CHECK:STDOUT: }
  1026. // CHECK:STDOUT:
  1027. // CHECK:STDOUT: class @NBase {
  1028. // CHECK:STDOUT: %NBase.N.decl: %NBase.N.type = fn_decl @NBase.N [concrete = constants.%NBase.N] {} {}
  1029. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357]
  1030. // CHECK:STDOUT: complete_type_witness = %complete_type
  1031. // CHECK:STDOUT:
  1032. // CHECK:STDOUT: !members:
  1033. // CHECK:STDOUT: .Self = constants.%NBase
  1034. // CHECK:STDOUT: .N = %NBase.N.decl
  1035. // CHECK:STDOUT: .HasN1 = <poisoned>
  1036. // CHECK:STDOUT: .HasN2 = <poisoned>
  1037. // CHECK:STDOUT: }
  1038. // CHECK:STDOUT:
  1039. // CHECK:STDOUT: class @O {
  1040. // CHECK:STDOUT: %NBase.ref: type = name_ref NBase, file.%NBase.decl [concrete = constants.%NBase]
  1041. // CHECK:STDOUT: %.loc17: %O.elem = base_decl %NBase.ref, element0 [concrete]
  1042. // CHECK:STDOUT: impl_decl @O.as.HasN1.impl [concrete] {} {
  1043. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%O [concrete = constants.%O]
  1044. // CHECK:STDOUT: %HasN1.ref: type = name_ref HasN1, file.%HasN1.decl [concrete = constants.%HasN1.type]
  1045. // CHECK:STDOUT: }
  1046. // CHECK:STDOUT: impl_decl @O.as.HasN2.impl [concrete] {} {
  1047. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%O [concrete = constants.%O]
  1048. // CHECK:STDOUT: %HasN2.ref: type = name_ref HasN2, file.%HasN2.decl [concrete = constants.%HasN2.type]
  1049. // CHECK:STDOUT: }
  1050. // CHECK:STDOUT: %O.N.decl: %O.N.type = fn_decl @O.N [concrete = constants.%O.N] {} {}
  1051. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%struct_type.base.df9 [concrete = constants.%complete_type.0fc]
  1052. // CHECK:STDOUT: complete_type_witness = %complete_type
  1053. // CHECK:STDOUT:
  1054. // CHECK:STDOUT: !members:
  1055. // CHECK:STDOUT: .Self = constants.%O
  1056. // CHECK:STDOUT: .NBase = <poisoned>
  1057. // CHECK:STDOUT: .base = %.loc17
  1058. // CHECK:STDOUT: .HasN1 = <poisoned>
  1059. // CHECK:STDOUT: .HasN2 = <poisoned>
  1060. // CHECK:STDOUT: .N = %O.N.decl
  1061. // CHECK:STDOUT: extend %NBase.ref
  1062. // CHECK:STDOUT: extend @O.as.HasN1.impl.%HasN1.ref
  1063. // CHECK:STDOUT: extend @O.as.HasN2.impl.%HasN2.ref
  1064. // CHECK:STDOUT: }
  1065. // CHECK:STDOUT:
  1066. // CHECK:STDOUT: fn @NBase.N() {
  1067. // CHECK:STDOUT: !entry:
  1068. // CHECK:STDOUT: return
  1069. // CHECK:STDOUT: }
  1070. // CHECK:STDOUT:
  1071. // CHECK:STDOUT: generic fn @HasN1.WithSelf.N(@HasN1.%Self: %HasN1.type) {
  1072. // CHECK:STDOUT: fn();
  1073. // CHECK:STDOUT: }
  1074. // CHECK:STDOUT:
  1075. // CHECK:STDOUT: generic fn @HasN2.WithSelf.N(@HasN2.%Self: %HasN2.type) {
  1076. // CHECK:STDOUT: fn();
  1077. // CHECK:STDOUT: }
  1078. // CHECK:STDOUT:
  1079. // CHECK:STDOUT: fn @O.as.HasN1.impl.N() {
  1080. // CHECK:STDOUT: !entry:
  1081. // CHECK:STDOUT: return
  1082. // CHECK:STDOUT: }
  1083. // CHECK:STDOUT:
  1084. // CHECK:STDOUT: fn @O.as.HasN2.impl.N() {
  1085. // CHECK:STDOUT: !entry:
  1086. // CHECK:STDOUT: return
  1087. // CHECK:STDOUT: }
  1088. // CHECK:STDOUT:
  1089. // CHECK:STDOUT: fn @O.N();
  1090. // CHECK:STDOUT:
  1091. // CHECK:STDOUT: fn @P(%o.param: %O) {
  1092. // CHECK:STDOUT: !entry:
  1093. // CHECK:STDOUT: %O.ref.loc28: type = name_ref O, file.%O.decl [concrete = constants.%O]
  1094. // CHECK:STDOUT: %N.ref.loc28: %O.N.type = name_ref N, @O.%O.N.decl [concrete = constants.%O.N]
  1095. // CHECK:STDOUT: %O.N.call.loc28: init %empty_tuple.type = call %N.ref.loc28()
  1096. // CHECK:STDOUT: %o.ref: %O = name_ref o, %o
  1097. // CHECK:STDOUT: %N.ref.loc29: %O.N.type = name_ref N, @O.%O.N.decl [concrete = constants.%O.N]
  1098. // CHECK:STDOUT: %O.N.call.loc29: init %empty_tuple.type = call %N.ref.loc29()
  1099. // CHECK:STDOUT: return
  1100. // CHECK:STDOUT: }
  1101. // CHECK:STDOUT:
  1102. // CHECK:STDOUT: specific @HasN1.WithSelf(constants.%Self.874) {
  1103. // CHECK:STDOUT: !definition:
  1104. // CHECK:STDOUT: %Self => constants.%Self.874
  1105. // CHECK:STDOUT: %HasN1.WithSelf.N.type => constants.%HasN1.WithSelf.N.type.684
  1106. // CHECK:STDOUT: %HasN1.WithSelf.N => constants.%HasN1.WithSelf.N.b29
  1107. // CHECK:STDOUT: }
  1108. // CHECK:STDOUT:
  1109. // CHECK:STDOUT: specific @HasN1.WithSelf.N(constants.%Self.874) {}
  1110. // CHECK:STDOUT:
  1111. // CHECK:STDOUT: specific @HasN2.WithSelf(constants.%Self.20b) {
  1112. // CHECK:STDOUT: !definition:
  1113. // CHECK:STDOUT: %Self => constants.%Self.20b
  1114. // CHECK:STDOUT: %HasN2.WithSelf.N.type => constants.%HasN2.WithSelf.N.type.3c7
  1115. // CHECK:STDOUT: %HasN2.WithSelf.N => constants.%HasN2.WithSelf.N.fce
  1116. // CHECK:STDOUT: }
  1117. // CHECK:STDOUT:
  1118. // CHECK:STDOUT: specific @HasN2.WithSelf.N(constants.%Self.20b) {}
  1119. // CHECK:STDOUT:
  1120. // CHECK:STDOUT: specific @HasN1.WithSelf(constants.%HasN1.facet) {
  1121. // CHECK:STDOUT: !definition:
  1122. // CHECK:STDOUT: %Self => constants.%HasN1.facet
  1123. // CHECK:STDOUT: %HasN1.WithSelf.N.type => constants.%HasN1.WithSelf.N.type.524
  1124. // CHECK:STDOUT: %HasN1.WithSelf.N => constants.%HasN1.WithSelf.N.1bf
  1125. // CHECK:STDOUT: }
  1126. // CHECK:STDOUT:
  1127. // CHECK:STDOUT: specific @HasN1.WithSelf.N(constants.%HasN1.facet) {}
  1128. // CHECK:STDOUT:
  1129. // CHECK:STDOUT: specific @HasN2.WithSelf(constants.%HasN2.facet) {
  1130. // CHECK:STDOUT: !definition:
  1131. // CHECK:STDOUT: %Self => constants.%HasN2.facet
  1132. // CHECK:STDOUT: %HasN2.WithSelf.N.type => constants.%HasN2.WithSelf.N.type.4d2
  1133. // CHECK:STDOUT: %HasN2.WithSelf.N => constants.%HasN2.WithSelf.N.b8c
  1134. // CHECK:STDOUT: }
  1135. // CHECK:STDOUT:
  1136. // CHECK:STDOUT: specific @HasN2.WithSelf.N(constants.%HasN2.facet) {}
  1137. // CHECK:STDOUT: