impl_thunk.carbon 108 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // AUTOUPDATE
  6. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/no_prelude/impl_thunk.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/no_prelude/impl_thunk.carbon
  10. // --- fail_todo_param_name_differs.carbon
  11. library "[[@TEST_NAME]]";
  12. // CHECK:STDERR: fail_todo_param_name_differs.carbon:[[@LINE+3]]:20: error: parameter has incomplete type `C` in function definition [IncompleteTypeInFunctionParam]
  13. // CHECK:STDERR: interface I { fn F(x: Self); }
  14. // CHECK:STDERR: ^~~~~~~
  15. interface I { fn F(x: Self); }
  16. // TODO: This currently uses a thunk due to the parameter name mismatch, but shouldn't!
  17. // TODO: This then fails because we attempt to build the thunk before `C` is complete.
  18. // CHECK:STDERR: fail_todo_param_name_differs.carbon:[[@LINE+3]]:1: note: class is incomplete within its definition [ClassIncompleteWithinDefinition]
  19. // CHECK:STDERR: class C {
  20. // CHECK:STDERR: ^~~~~~~~~
  21. class C {
  22. impl as I {
  23. // CHECK:STDERR: fail_todo_param_name_differs.carbon:[[@LINE+17]]:5: note: while building thunk calling this function [ThunkCallee]
  24. // CHECK:STDERR: fn F(not_x: C);
  25. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  26. // CHECK:STDERR:
  27. // CHECK:STDERR: fail_todo_param_name_differs.carbon:[[@LINE-13]]:20: error: forming value of incomplete type `C` [IncompleteTypeInValueConversion]
  28. // CHECK:STDERR: interface I { fn F(x: Self); }
  29. // CHECK:STDERR: ^~~~~~~
  30. // CHECK:STDERR: fail_todo_param_name_differs.carbon:[[@LINE-9]]:1: note: class is incomplete within its definition [ClassIncompleteWithinDefinition]
  31. // CHECK:STDERR: class C {
  32. // CHECK:STDERR: ^~~~~~~~~
  33. // CHECK:STDERR: fail_todo_param_name_differs.carbon:[[@LINE+7]]:10: note: initializing function parameter [InCallToFunctionParam]
  34. // CHECK:STDERR: fn F(not_x: C);
  35. // CHECK:STDERR: ^~~~~~~~
  36. // CHECK:STDERR: fail_todo_param_name_differs.carbon:[[@LINE-22]]:15: note: while building thunk to match the signature of this function [ThunkSignature]
  37. // CHECK:STDERR: interface I { fn F(x: Self); }
  38. // CHECK:STDERR: ^~~~~~~~~~~~~~
  39. // CHECK:STDERR:
  40. fn F(not_x: C);
  41. }
  42. }
  43. // --- struct_conversion.carbon
  44. library "[[@TEST_NAME]]";
  45. interface I {
  46. fn F(x: {.a: (), .b: {}}) -> {.c: (), .d: {}};
  47. }
  48. impl () as I {
  49. fn F(y: {.b: {}, .a: ()}) -> {.d: {}, .c: ()};
  50. }
  51. // --- inheritance_conversion.carbon
  52. library "[[@TEST_NAME]]";
  53. base class A {}
  54. base class B { extend base: A; }
  55. class C { extend base: B; }
  56. interface X {
  57. fn F[addr self: Self*](other: Self*) -> Self*;
  58. }
  59. impl B as X {
  60. fn F[addr self: A*](other: A*) -> C*;
  61. }
  62. // --- inheritance_value_conversion.carbon
  63. library "[[@TEST_NAME]]";
  64. base class A {}
  65. class B { extend base: A; }
  66. interface X {
  67. fn F[self: Self](other: Self);
  68. }
  69. impl B as X {
  70. fn F[self: A](other: A);
  71. }
  72. // --- inheritance_value_conversion_pointer.carbon
  73. library "[[@TEST_NAME]]";
  74. base class A {}
  75. base class B { extend base: A; }
  76. class C { extend base: B; }
  77. interface X {
  78. fn F[addr self: Self*](other: Self*) -> Self*;
  79. }
  80. impl B as X {
  81. fn F[addr self: A*](other: A*) -> C*;
  82. }
  83. // --- fail_inheritance_value_conversion_copy_return.carbon
  84. library "[[@TEST_NAME]]";
  85. base class A {}
  86. class B { extend base: A; }
  87. interface X {
  88. fn F() -> Self;
  89. }
  90. impl A as X {
  91. // CHECK:STDERR: fail_inheritance_value_conversion_copy_return.carbon:[[@LINE+7]]:3: error: cannot copy value of type `A` [CopyOfUncopyableType]
  92. // CHECK:STDERR: fn F() -> B;
  93. // CHECK:STDERR: ^~~~~~~~~~~~
  94. // CHECK:STDERR: fail_inheritance_value_conversion_copy_return.carbon:[[@LINE-7]]:3: note: while building thunk to match the signature of this function [ThunkSignature]
  95. // CHECK:STDERR: fn F() -> Self;
  96. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  97. // CHECK:STDERR:
  98. fn F() -> B;
  99. }
  100. // --- fail_param_type_mismatch.carbon
  101. library "[[@TEST_NAME]]";
  102. interface I {
  103. // CHECK:STDERR: fail_param_type_mismatch.carbon:[[@LINE+3]]:8: error: `Core.ImplicitAs` implicitly referenced here, but package `Core` not found [CoreNotFound]
  104. // CHECK:STDERR: fn F(a: Self);
  105. // CHECK:STDERR: ^~~~~~~
  106. fn F(a: Self);
  107. }
  108. class A {}
  109. class B {}
  110. impl A as I {
  111. // CHECK:STDERR: fail_param_type_mismatch.carbon:[[@LINE+7]]:8: note: initializing function parameter [InCallToFunctionParam]
  112. // CHECK:STDERR: fn F(a: B);
  113. // CHECK:STDERR: ^~~~
  114. // CHECK:STDERR: fail_param_type_mismatch.carbon:[[@LINE-10]]:3: note: while building thunk to match the signature of this function [ThunkSignature]
  115. // CHECK:STDERR: fn F(a: Self);
  116. // CHECK:STDERR: ^~~~~~~~~~~~~~
  117. // CHECK:STDERR:
  118. fn F(a: B);
  119. }
  120. // --- fail_return_mismatch.carbon
  121. library "[[@TEST_NAME]]";
  122. interface I {
  123. fn F() -> Self;
  124. }
  125. class A {}
  126. class B {}
  127. impl A as I {
  128. // CHECK:STDERR: fail_return_mismatch.carbon:[[@LINE+7]]:3: error: `Core.ImplicitAs` implicitly referenced here, but package `Core` not found [CoreNotFound]
  129. // CHECK:STDERR: fn F() -> B;
  130. // CHECK:STDERR: ^~~~~~~~~~~~
  131. // CHECK:STDERR: fail_return_mismatch.carbon:[[@LINE-10]]:3: note: while building thunk to match the signature of this function [ThunkSignature]
  132. // CHECK:STDERR: fn F() -> Self;
  133. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  134. // CHECK:STDERR:
  135. fn F() -> B;
  136. }
  137. // --- return_empty_tuple_mismatch_allowed.carbon
  138. library "[[@TEST_NAME]]";
  139. interface I {
  140. fn HasReturn() -> Self;
  141. fn NoReturn();
  142. fn EmptyTupleReturn() -> ();
  143. }
  144. impl () as I {
  145. // OK, can `return HasReturn();` in thunk.
  146. fn HasReturn();
  147. // OK, exact match.
  148. fn NoReturn();
  149. // OK, same as `HasReturn`.
  150. fn EmptyTupleReturn();
  151. }
  152. // --- fail_return_empty_tuple_mismatch.carbon
  153. library "[[@TEST_NAME]]";
  154. interface I {
  155. fn NoReturn();
  156. }
  157. impl () as I {
  158. // TODO: The proposal says to reject this. But should we really do so?
  159. // CHECK:STDERR: fail_return_empty_tuple_mismatch.carbon:[[@LINE+7]]:3: error: function redeclaration differs because return type is `()` [FunctionRedeclReturnTypeDiffers]
  160. // CHECK:STDERR: fn NoReturn() -> ();
  161. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
  162. // CHECK:STDERR: fail_return_empty_tuple_mismatch.carbon:[[@LINE-8]]:3: note: previously declared with no return type [FunctionRedeclReturnTypePreviousNoReturn]
  163. // CHECK:STDERR: fn NoReturn();
  164. // CHECK:STDERR: ^~~~~~~~~~~~~~
  165. // CHECK:STDERR:
  166. fn NoReturn() -> ();
  167. }
  168. class C {}
  169. impl C as I {
  170. // CHECK:STDERR: fail_return_empty_tuple_mismatch.carbon:[[@LINE+7]]:3: error: function redeclaration differs because return type is `C` [FunctionRedeclReturnTypeDiffers]
  171. // CHECK:STDERR: fn NoReturn() -> C;
  172. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
  173. // CHECK:STDERR: fail_return_empty_tuple_mismatch.carbon:[[@LINE-21]]:3: note: previously declared with no return type [FunctionRedeclReturnTypePreviousNoReturn]
  174. // CHECK:STDERR: fn NoReturn();
  175. // CHECK:STDERR: ^~~~~~~~~~~~~~
  176. // CHECK:STDERR:
  177. fn NoReturn() -> C;
  178. }
  179. // CHECK:STDOUT: --- fail_todo_param_name_differs.carbon
  180. // CHECK:STDOUT:
  181. // CHECK:STDOUT: constants {
  182. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  183. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  184. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic]
  185. // CHECK:STDOUT: %pattern_type.6de: type = pattern_type %Self.as_type [symbolic]
  186. // CHECK:STDOUT: %F.type.cf0: type = fn_type @F.1 [concrete]
  187. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  188. // CHECK:STDOUT: %F.bc6: %F.type.cf0 = struct_value () [concrete]
  189. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  190. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%F.decl [concrete]
  191. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  192. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness @C.%I.impl_witness_table [concrete]
  193. // CHECK:STDOUT: %pattern_type.c48: type = pattern_type %C [concrete]
  194. // CHECK:STDOUT: %F.type.f3605c.1: type = fn_type @F.2 [concrete]
  195. // CHECK:STDOUT: %F.4c32b3.1: %F.type.f3605c.1 = struct_value () [concrete]
  196. // CHECK:STDOUT: %I.facet: %I.type = facet_value %C, (%I.impl_witness) [concrete]
  197. // CHECK:STDOUT: %F.type.f3605c.2: type = fn_type @F.3 [concrete]
  198. // CHECK:STDOUT: %F.4c32b3.2: %F.type.f3605c.2 = struct_value () [concrete]
  199. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  200. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  201. // CHECK:STDOUT: }
  202. // CHECK:STDOUT:
  203. // CHECK:STDOUT: file {
  204. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  205. // CHECK:STDOUT: .I = %I.decl
  206. // CHECK:STDOUT: .C = %C.decl
  207. // CHECK:STDOUT: }
  208. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  209. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  210. // CHECK:STDOUT: }
  211. // CHECK:STDOUT:
  212. // CHECK:STDOUT: interface @I {
  213. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  214. // CHECK:STDOUT: %F.decl: %F.type.cf0 = fn_decl @F.1 [concrete = constants.%F.bc6] {
  215. // CHECK:STDOUT: %x.patt: @F.1.%pattern_type (%pattern_type.6de) = binding_pattern x [concrete]
  216. // CHECK:STDOUT: %x.param_patt: @F.1.%pattern_type (%pattern_type.6de) = value_param_pattern %x.patt, call_param0 [concrete]
  217. // CHECK:STDOUT: } {
  218. // CHECK:STDOUT: %x.param: @F.1.%Self.as_type.loc7_23.1 (%Self.as_type) = value_param call_param0
  219. // CHECK:STDOUT: %.loc7_23.1: type = splice_block %.loc7_23.2 [symbolic = %Self.as_type.loc7_23.1 (constants.%Self.as_type)] {
  220. // CHECK:STDOUT: %Self.ref: %I.type = name_ref Self, @I.%Self [symbolic = %Self (constants.%Self)]
  221. // CHECK:STDOUT: %Self.as_type.loc7_23.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc7_23.1 (constants.%Self.as_type)]
  222. // CHECK:STDOUT: %.loc7_23.2: type = converted %Self.ref, %Self.as_type.loc7_23.2 [symbolic = %Self.as_type.loc7_23.1 (constants.%Self.as_type)]
  223. // CHECK:STDOUT: }
  224. // CHECK:STDOUT: %x: @F.1.%Self.as_type.loc7_23.1 (%Self.as_type) = bind_name x, %x.param
  225. // CHECK:STDOUT: }
  226. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %F.decl [concrete = constants.%assoc0]
  227. // CHECK:STDOUT:
  228. // CHECK:STDOUT: !members:
  229. // CHECK:STDOUT: .Self = %Self
  230. // CHECK:STDOUT: .F = %assoc0
  231. // CHECK:STDOUT: witness = (%F.decl)
  232. // CHECK:STDOUT: }
  233. // CHECK:STDOUT:
  234. // CHECK:STDOUT: impl @impl: %Self.ref as %I.ref {
  235. // CHECK:STDOUT: %F.decl.loc33_19.1: %F.type.f3605c.1 = fn_decl @F.2 [concrete = constants.%F.4c32b3.1] {
  236. // CHECK:STDOUT: %not_x.patt: %pattern_type.c48 = binding_pattern not_x [concrete]
  237. // CHECK:STDOUT: %not_x.param_patt: %pattern_type.c48 = value_param_pattern %not_x.patt, call_param0 [concrete]
  238. // CHECK:STDOUT: } {
  239. // CHECK:STDOUT: %not_x.param: %C = value_param call_param0
  240. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  241. // CHECK:STDOUT: %not_x: %C = bind_name not_x, %not_x.param
  242. // CHECK:STDOUT: }
  243. // CHECK:STDOUT: %F.decl.loc33_19.2: %F.type.f3605c.2 = fn_decl @F.3 [concrete = constants.%F.4c32b3.2] {
  244. // CHECK:STDOUT: %x.patt: %pattern_type.c48 = binding_pattern x [concrete]
  245. // CHECK:STDOUT: %x.param_patt: %pattern_type.c48 = value_param_pattern %x.patt, call_param0 [concrete]
  246. // CHECK:STDOUT: } {
  247. // CHECK:STDOUT: %x.param: %C = value_param call_param0
  248. // CHECK:STDOUT: %x: %C = bind_name x, %x.param
  249. // CHECK:STDOUT: }
  250. // CHECK:STDOUT:
  251. // CHECK:STDOUT: !members:
  252. // CHECK:STDOUT: .C = <poisoned>
  253. // CHECK:STDOUT: .F = %F.decl.loc33_19.1
  254. // CHECK:STDOUT: witness = @C.%I.impl_witness
  255. // CHECK:STDOUT: }
  256. // CHECK:STDOUT:
  257. // CHECK:STDOUT: class @C {
  258. // CHECK:STDOUT: impl_decl @impl [concrete] {} {
  259. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [concrete = constants.%C]
  260. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  261. // CHECK:STDOUT: }
  262. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (@impl.%F.decl.loc33_19.2), @impl [concrete]
  263. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness]
  264. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  265. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  266. // CHECK:STDOUT: complete_type_witness = %complete_type
  267. // CHECK:STDOUT:
  268. // CHECK:STDOUT: !members:
  269. // CHECK:STDOUT: .Self = constants.%C
  270. // CHECK:STDOUT: .I = <poisoned>
  271. // CHECK:STDOUT: .C = <poisoned>
  272. // CHECK:STDOUT: }
  273. // CHECK:STDOUT:
  274. // CHECK:STDOUT: generic fn @F.1(@I.%Self: %I.type) {
  275. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)]
  276. // CHECK:STDOUT: %Self.as_type.loc7_23.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc7_23.1 (constants.%Self.as_type)]
  277. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc7_23.1 [symbolic = %pattern_type (constants.%pattern_type.6de)]
  278. // CHECK:STDOUT:
  279. // CHECK:STDOUT: fn(%x.param: @F.1.%Self.as_type.loc7_23.1 (%Self.as_type));
  280. // CHECK:STDOUT: }
  281. // CHECK:STDOUT:
  282. // CHECK:STDOUT: fn @F.2(%not_x.param: %C);
  283. // CHECK:STDOUT:
  284. // CHECK:STDOUT: fn @F.3(%x.param: %C) {
  285. // CHECK:STDOUT: !entry:
  286. // CHECK:STDOUT: %x.ref: %C = name_ref x, %x.param
  287. // CHECK:STDOUT: %F.call: init %empty_tuple.type = call @impl.%F.decl.loc33_19.1(<error>)
  288. // CHECK:STDOUT: return
  289. // CHECK:STDOUT: }
  290. // CHECK:STDOUT:
  291. // CHECK:STDOUT: specific @F.1(constants.%Self) {
  292. // CHECK:STDOUT: %Self => constants.%Self
  293. // CHECK:STDOUT: %Self.as_type.loc7_23.1 => constants.%Self.as_type
  294. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.6de
  295. // CHECK:STDOUT: }
  296. // CHECK:STDOUT:
  297. // CHECK:STDOUT: specific @F.1(constants.%I.facet) {
  298. // CHECK:STDOUT: %Self => constants.%I.facet
  299. // CHECK:STDOUT: %Self.as_type.loc7_23.1 => constants.%C
  300. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.c48
  301. // CHECK:STDOUT: }
  302. // CHECK:STDOUT:
  303. // CHECK:STDOUT: --- struct_conversion.carbon
  304. // CHECK:STDOUT:
  305. // CHECK:STDOUT: constants {
  306. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  307. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  308. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  309. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  310. // CHECK:STDOUT: %struct_type.a.b.391: type = struct_type {.a: %empty_tuple.type, .b: %empty_struct_type} [concrete]
  311. // CHECK:STDOUT: %pattern_type.bec: type = pattern_type %struct_type.a.b.391 [concrete]
  312. // CHECK:STDOUT: %struct_type.c.d.15a: type = struct_type {.c: %empty_tuple.type, .d: %empty_struct_type} [concrete]
  313. // CHECK:STDOUT: %pattern_type.d63: type = pattern_type %struct_type.c.d.15a [concrete]
  314. // CHECK:STDOUT: %F.type.cf0: type = fn_type @F.1 [concrete]
  315. // CHECK:STDOUT: %F.bc6: %F.type.cf0 = struct_value () [concrete]
  316. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  317. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%F.decl [concrete]
  318. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness file.%I.impl_witness_table [concrete]
  319. // CHECK:STDOUT: %struct_type.b.a.40c: type = struct_type {.b: %empty_struct_type, .a: %empty_tuple.type} [concrete]
  320. // CHECK:STDOUT: %pattern_type.231: type = pattern_type %struct_type.b.a.40c [concrete]
  321. // CHECK:STDOUT: %struct_type.d.c.b36: type = struct_type {.d: %empty_struct_type, .c: %empty_tuple.type} [concrete]
  322. // CHECK:STDOUT: %pattern_type.844: type = pattern_type %struct_type.d.c.b36 [concrete]
  323. // CHECK:STDOUT: %F.type.39e918.1: type = fn_type @F.2 [concrete]
  324. // CHECK:STDOUT: %F.c04b92.1: %F.type.39e918.1 = struct_value () [concrete]
  325. // CHECK:STDOUT: %I.facet: %I.type = facet_value %empty_tuple.type, (%I.impl_witness) [concrete]
  326. // CHECK:STDOUT: %F.type.39e918.2: type = fn_type @F.3 [concrete]
  327. // CHECK:STDOUT: %F.c04b92.2: %F.type.39e918.2 = struct_value () [concrete]
  328. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  329. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  330. // CHECK:STDOUT: %struct: %struct_type.c.d.15a = struct_value (%empty_tuple, %empty_struct) [concrete]
  331. // CHECK:STDOUT: }
  332. // CHECK:STDOUT:
  333. // CHECK:STDOUT: file {
  334. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  335. // CHECK:STDOUT: .I = %I.decl
  336. // CHECK:STDOUT: }
  337. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  338. // CHECK:STDOUT: impl_decl @impl [concrete] {} {
  339. // CHECK:STDOUT: %.loc8_7.1: %empty_tuple.type = tuple_literal ()
  340. // CHECK:STDOUT: %.loc8_7.2: type = converted %.loc8_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  341. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  342. // CHECK:STDOUT: }
  343. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (@impl.%F.decl.loc9_48.2), @impl [concrete]
  344. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness]
  345. // CHECK:STDOUT: }
  346. // CHECK:STDOUT:
  347. // CHECK:STDOUT: interface @I {
  348. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  349. // CHECK:STDOUT: %F.decl: %F.type.cf0 = fn_decl @F.1 [concrete = constants.%F.bc6] {
  350. // CHECK:STDOUT: %x.patt: %pattern_type.bec = binding_pattern x [concrete]
  351. // CHECK:STDOUT: %x.param_patt: %pattern_type.bec = value_param_pattern %x.patt, call_param0 [concrete]
  352. // CHECK:STDOUT: %return.patt: %pattern_type.d63 = return_slot_pattern [concrete]
  353. // CHECK:STDOUT: %return.param_patt: %pattern_type.d63 = out_param_pattern %return.patt, call_param1 [concrete]
  354. // CHECK:STDOUT: } {
  355. // CHECK:STDOUT: %.loc5_38.1: %empty_tuple.type = tuple_literal ()
  356. // CHECK:STDOUT: %.loc5_38.2: type = converted %.loc5_38.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  357. // CHECK:STDOUT: %.loc5_46.1: %empty_struct_type = struct_literal ()
  358. // CHECK:STDOUT: %.loc5_46.2: type = converted %.loc5_46.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  359. // CHECK:STDOUT: %struct_type.c.d: type = struct_type {.c: %empty_tuple.type, .d: %empty_struct_type} [concrete = constants.%struct_type.c.d.15a]
  360. // CHECK:STDOUT: %x.param: %struct_type.a.b.391 = value_param call_param0
  361. // CHECK:STDOUT: %.loc5_26: type = splice_block %struct_type.a.b [concrete = constants.%struct_type.a.b.391] {
  362. // CHECK:STDOUT: %.loc5_17.1: %empty_tuple.type = tuple_literal ()
  363. // CHECK:STDOUT: %.loc5_17.2: type = converted %.loc5_17.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  364. // CHECK:STDOUT: %.loc5_25.1: %empty_struct_type = struct_literal ()
  365. // CHECK:STDOUT: %.loc5_25.2: type = converted %.loc5_25.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  366. // CHECK:STDOUT: %struct_type.a.b: type = struct_type {.a: %empty_tuple.type, .b: %empty_struct_type} [concrete = constants.%struct_type.a.b.391]
  367. // CHECK:STDOUT: }
  368. // CHECK:STDOUT: %x: %struct_type.a.b.391 = bind_name x, %x.param
  369. // CHECK:STDOUT: %return.param: ref %struct_type.c.d.15a = out_param call_param1
  370. // CHECK:STDOUT: %return: ref %struct_type.c.d.15a = return_slot %return.param
  371. // CHECK:STDOUT: }
  372. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %F.decl [concrete = constants.%assoc0]
  373. // CHECK:STDOUT:
  374. // CHECK:STDOUT: !members:
  375. // CHECK:STDOUT: .Self = %Self
  376. // CHECK:STDOUT: .F = %assoc0
  377. // CHECK:STDOUT: witness = (%F.decl)
  378. // CHECK:STDOUT: }
  379. // CHECK:STDOUT:
  380. // CHECK:STDOUT: impl @impl: %.loc8_7.2 as %I.ref {
  381. // CHECK:STDOUT: %F.decl.loc9_48.1: %F.type.39e918.1 = fn_decl @F.2 [concrete = constants.%F.c04b92.1] {
  382. // CHECK:STDOUT: %y.patt: %pattern_type.231 = binding_pattern y [concrete]
  383. // CHECK:STDOUT: %y.param_patt: %pattern_type.231 = value_param_pattern %y.patt, call_param0 [concrete]
  384. // CHECK:STDOUT: %return.patt: %pattern_type.844 = return_slot_pattern [concrete]
  385. // CHECK:STDOUT: %return.param_patt: %pattern_type.844 = out_param_pattern %return.patt, call_param1 [concrete]
  386. // CHECK:STDOUT: } {
  387. // CHECK:STDOUT: %.loc9_38.1: %empty_struct_type = struct_literal ()
  388. // CHECK:STDOUT: %.loc9_38.2: type = converted %.loc9_38.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  389. // CHECK:STDOUT: %.loc9_46.1: %empty_tuple.type = tuple_literal ()
  390. // CHECK:STDOUT: %.loc9_46.2: type = converted %.loc9_46.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  391. // CHECK:STDOUT: %struct_type.d.c: type = struct_type {.d: %empty_struct_type, .c: %empty_tuple.type} [concrete = constants.%struct_type.d.c.b36]
  392. // CHECK:STDOUT: %y.param: %struct_type.b.a.40c = value_param call_param0
  393. // CHECK:STDOUT: %.loc9_26: type = splice_block %struct_type.b.a [concrete = constants.%struct_type.b.a.40c] {
  394. // CHECK:STDOUT: %.loc9_17.1: %empty_struct_type = struct_literal ()
  395. // CHECK:STDOUT: %.loc9_17.2: type = converted %.loc9_17.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  396. // CHECK:STDOUT: %.loc9_25.1: %empty_tuple.type = tuple_literal ()
  397. // CHECK:STDOUT: %.loc9_25.2: type = converted %.loc9_25.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  398. // CHECK:STDOUT: %struct_type.b.a: type = struct_type {.b: %empty_struct_type, .a: %empty_tuple.type} [concrete = constants.%struct_type.b.a.40c]
  399. // CHECK:STDOUT: }
  400. // CHECK:STDOUT: %y: %struct_type.b.a.40c = bind_name y, %y.param
  401. // CHECK:STDOUT: %return.param: ref %struct_type.d.c.b36 = out_param call_param1
  402. // CHECK:STDOUT: %return: ref %struct_type.d.c.b36 = return_slot %return.param
  403. // CHECK:STDOUT: }
  404. // CHECK:STDOUT: %F.decl.loc9_48.2: %F.type.39e918.2 = fn_decl @F.3 [concrete = constants.%F.c04b92.2] {
  405. // CHECK:STDOUT: %x.patt: %pattern_type.bec = binding_pattern x [concrete]
  406. // CHECK:STDOUT: %x.param_patt: %pattern_type.bec = value_param_pattern %x.patt, call_param0 [concrete]
  407. // CHECK:STDOUT: %return.patt: %pattern_type.d63 = return_slot_pattern [concrete]
  408. // CHECK:STDOUT: %return.param_patt: %pattern_type.d63 = out_param_pattern %return.patt, call_param1 [concrete]
  409. // CHECK:STDOUT: } {
  410. // CHECK:STDOUT: %x.param: %struct_type.a.b.391 = value_param call_param0
  411. // CHECK:STDOUT: %x: %struct_type.a.b.391 = bind_name x, %x.param
  412. // CHECK:STDOUT: %return.param: ref %struct_type.c.d.15a = out_param call_param1
  413. // CHECK:STDOUT: %return: ref %struct_type.c.d.15a = return_slot %return.param
  414. // CHECK:STDOUT: }
  415. // CHECK:STDOUT:
  416. // CHECK:STDOUT: !members:
  417. // CHECK:STDOUT: .F = %F.decl.loc9_48.1
  418. // CHECK:STDOUT: witness = file.%I.impl_witness
  419. // CHECK:STDOUT: }
  420. // CHECK:STDOUT:
  421. // CHECK:STDOUT: generic fn @F.1(@I.%Self: %I.type) {
  422. // CHECK:STDOUT: fn(%x.param: %struct_type.a.b.391) -> %return.param: %struct_type.c.d.15a;
  423. // CHECK:STDOUT: }
  424. // CHECK:STDOUT:
  425. // CHECK:STDOUT: fn @F.2(%y.param: %struct_type.b.a.40c) -> %return.param: %struct_type.d.c.b36;
  426. // CHECK:STDOUT:
  427. // CHECK:STDOUT: fn @F.3(%x.param: %struct_type.a.b.391) -> %return.param: %struct_type.c.d.15a {
  428. // CHECK:STDOUT: !entry:
  429. // CHECK:STDOUT: %x.ref: %struct_type.a.b.391 = name_ref x, %x.param
  430. // CHECK:STDOUT: %.loc9_48.1: ref %struct_type.d.c.b36 = temporary_storage
  431. // CHECK:STDOUT: %.loc5_9.1: %empty_struct_type = struct_access %x.ref, element1
  432. // CHECK:STDOUT: %.loc5_9.2: %empty_tuple.type = struct_access %x.ref, element0
  433. // CHECK:STDOUT: %struct: %struct_type.b.a.40c = struct_value (%.loc5_9.1, %.loc5_9.2)
  434. // CHECK:STDOUT: %.loc5_9.3: %struct_type.b.a.40c = converted %x.ref, %struct
  435. // CHECK:STDOUT: %F.call: init %struct_type.d.c.b36 = call @impl.%F.decl.loc9_48.1(%.loc5_9.3) to %.loc9_48.1
  436. // CHECK:STDOUT: %.loc9_48.2: ref %struct_type.d.c.b36 = temporary %.loc9_48.1, %F.call
  437. // CHECK:STDOUT: %.loc9_48.3: ref %empty_tuple.type = struct_access %.loc9_48.2, element1
  438. // CHECK:STDOUT: %.loc9_48.4: ref %empty_tuple.type = struct_access %return, element1
  439. // CHECK:STDOUT: %.loc9_48.5: init %empty_tuple.type = tuple_init () to %.loc9_48.4 [concrete = constants.%empty_tuple]
  440. // CHECK:STDOUT: %.loc9_48.6: init %empty_tuple.type = converted %.loc9_48.3, %.loc9_48.5 [concrete = constants.%empty_tuple]
  441. // CHECK:STDOUT: %.loc9_48.7: ref %empty_struct_type = struct_access %.loc9_48.2, element0
  442. // CHECK:STDOUT: %.loc9_48.8: ref %empty_struct_type = struct_access %return, element0
  443. // CHECK:STDOUT: %.loc9_48.9: init %empty_struct_type = struct_init () to %.loc9_48.8 [concrete = constants.%empty_struct]
  444. // CHECK:STDOUT: %.loc9_48.10: init %empty_struct_type = converted %.loc9_48.7, %.loc9_48.9 [concrete = constants.%empty_struct]
  445. // CHECK:STDOUT: %.loc9_48.11: init %struct_type.c.d.15a = struct_init (%.loc9_48.6, %.loc9_48.10) to %return [concrete = constants.%struct]
  446. // CHECK:STDOUT: %.loc9_48.12: init %struct_type.c.d.15a = converted %F.call, %.loc9_48.11 [concrete = constants.%struct]
  447. // CHECK:STDOUT: return %.loc9_48.12 to %return
  448. // CHECK:STDOUT: }
  449. // CHECK:STDOUT:
  450. // CHECK:STDOUT: specific @F.1(constants.%Self) {}
  451. // CHECK:STDOUT:
  452. // CHECK:STDOUT: specific @F.1(constants.%I.facet) {}
  453. // CHECK:STDOUT:
  454. // CHECK:STDOUT: --- inheritance_conversion.carbon
  455. // CHECK:STDOUT:
  456. // CHECK:STDOUT: constants {
  457. // CHECK:STDOUT: %A: type = class_type @A [concrete]
  458. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  459. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  460. // CHECK:STDOUT: %B: type = class_type @B [concrete]
  461. // CHECK:STDOUT: %B.elem: type = unbound_element_type %B, %A [concrete]
  462. // CHECK:STDOUT: %struct_type.base.953: type = struct_type {.base: %A} [concrete]
  463. // CHECK:STDOUT: %complete_type.020: <witness> = complete_type_witness %struct_type.base.953 [concrete]
  464. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  465. // CHECK:STDOUT: %C.elem: type = unbound_element_type %C, %B [concrete]
  466. // CHECK:STDOUT: %struct_type.base.0ff: type = struct_type {.base: %B} [concrete]
  467. // CHECK:STDOUT: %complete_type.98e: <witness> = complete_type_witness %struct_type.base.0ff [concrete]
  468. // CHECK:STDOUT: %X.type: type = facet_type <@X> [concrete]
  469. // CHECK:STDOUT: %Self: %X.type = bind_symbolic_name Self, 0 [symbolic]
  470. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic]
  471. // CHECK:STDOUT: %ptr.d06: type = ptr_type %Self.as_type [symbolic]
  472. // CHECK:STDOUT: %pattern_type.4c5: type = pattern_type %ptr.d06 [symbolic]
  473. // CHECK:STDOUT: %pattern_type.f6d: type = pattern_type auto [concrete]
  474. // CHECK:STDOUT: %F.type.594: type = fn_type @F.1 [concrete]
  475. // CHECK:STDOUT: %F.b69: %F.type.594 = struct_value () [concrete]
  476. // CHECK:STDOUT: %X.assoc_type: type = assoc_entity_type @X [concrete]
  477. // CHECK:STDOUT: %assoc0: %X.assoc_type = assoc_entity element0, @X.%F.decl [concrete]
  478. // CHECK:STDOUT: %X.impl_witness: <witness> = impl_witness file.%X.impl_witness_table [concrete]
  479. // CHECK:STDOUT: %ptr.6db: type = ptr_type %A [concrete]
  480. // CHECK:STDOUT: %pattern_type.5f8: type = pattern_type %ptr.6db [concrete]
  481. // CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete]
  482. // CHECK:STDOUT: %pattern_type.44a: type = pattern_type %ptr.019 [concrete]
  483. // CHECK:STDOUT: %F.type.f1b0b1.1: type = fn_type @F.2 [concrete]
  484. // CHECK:STDOUT: %F.5161e9.1: %F.type.f1b0b1.1 = struct_value () [concrete]
  485. // CHECK:STDOUT: %X.facet: %X.type = facet_value %B, (%X.impl_witness) [concrete]
  486. // CHECK:STDOUT: %ptr.e79: type = ptr_type %B [concrete]
  487. // CHECK:STDOUT: %pattern_type.960: type = pattern_type %ptr.e79 [concrete]
  488. // CHECK:STDOUT: %F.type.f1b0b1.2: type = fn_type @F.3 [concrete]
  489. // CHECK:STDOUT: %F.5161e9.2: %F.type.f1b0b1.2 = struct_value () [concrete]
  490. // CHECK:STDOUT: }
  491. // CHECK:STDOUT:
  492. // CHECK:STDOUT: file {
  493. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  494. // CHECK:STDOUT: .A = %A.decl
  495. // CHECK:STDOUT: .B = %B.decl
  496. // CHECK:STDOUT: .C = %C.decl
  497. // CHECK:STDOUT: .X = %X.decl
  498. // CHECK:STDOUT: }
  499. // CHECK:STDOUT: %A.decl: type = class_decl @A [concrete = constants.%A] {} {}
  500. // CHECK:STDOUT: %B.decl: type = class_decl @B [concrete = constants.%B] {} {}
  501. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  502. // CHECK:STDOUT: %X.decl: type = interface_decl @X [concrete = constants.%X.type] {} {}
  503. // CHECK:STDOUT: impl_decl @impl [concrete] {} {
  504. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B]
  505. // CHECK:STDOUT: %X.ref: type = name_ref X, file.%X.decl [concrete = constants.%X.type]
  506. // CHECK:STDOUT: }
  507. // CHECK:STDOUT: %X.impl_witness_table = impl_witness_table (@impl.%F.decl.loc13_39.2), @impl [concrete]
  508. // CHECK:STDOUT: %X.impl_witness: <witness> = impl_witness %X.impl_witness_table [concrete = constants.%X.impl_witness]
  509. // CHECK:STDOUT: }
  510. // CHECK:STDOUT:
  511. // CHECK:STDOUT: interface @X {
  512. // CHECK:STDOUT: %Self: %X.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  513. // CHECK:STDOUT: %F.decl: %F.type.594 = fn_decl @F.1 [concrete = constants.%F.b69] {
  514. // CHECK:STDOUT: %self.patt: @F.1.%pattern_type (%pattern_type.4c5) = binding_pattern self [concrete]
  515. // CHECK:STDOUT: %self.param_patt: @F.1.%pattern_type (%pattern_type.4c5) = value_param_pattern %self.patt, call_param0 [concrete]
  516. // CHECK:STDOUT: %.loc9_8: %pattern_type.f6d = addr_pattern %self.param_patt [concrete]
  517. // CHECK:STDOUT: %other.patt: @F.1.%pattern_type (%pattern_type.4c5) = binding_pattern other [concrete]
  518. // CHECK:STDOUT: %other.param_patt: @F.1.%pattern_type (%pattern_type.4c5) = value_param_pattern %other.patt, call_param1 [concrete]
  519. // CHECK:STDOUT: %return.patt: @F.1.%pattern_type (%pattern_type.4c5) = return_slot_pattern [concrete]
  520. // CHECK:STDOUT: %return.param_patt: @F.1.%pattern_type (%pattern_type.4c5) = out_param_pattern %return.patt, call_param2 [concrete]
  521. // CHECK:STDOUT: } {
  522. // CHECK:STDOUT: %Self.ref.loc9_43: %X.type = name_ref Self, @X.%Self [symbolic = %Self (constants.%Self)]
  523. // CHECK:STDOUT: %Self.as_type.loc9_47: type = facet_access_type %Self.ref.loc9_43 [symbolic = %Self.as_type.loc9_23.1 (constants.%Self.as_type)]
  524. // CHECK:STDOUT: %.loc9_47: type = converted %Self.ref.loc9_43, %Self.as_type.loc9_47 [symbolic = %Self.as_type.loc9_23.1 (constants.%Self.as_type)]
  525. // CHECK:STDOUT: %ptr.loc9_47: type = ptr_type %.loc9_47 [symbolic = %ptr.loc9_23.1 (constants.%ptr.d06)]
  526. // CHECK:STDOUT: %self.param: @F.1.%ptr.loc9_23.1 (%ptr.d06) = value_param call_param0
  527. // CHECK:STDOUT: %.loc9_23.1: type = splice_block %ptr.loc9_23.2 [symbolic = %ptr.loc9_23.1 (constants.%ptr.d06)] {
  528. // CHECK:STDOUT: %Self.ref.loc9_19: %X.type = name_ref Self, @X.%Self [symbolic = %Self (constants.%Self)]
  529. // CHECK:STDOUT: %Self.as_type.loc9_23.2: type = facet_access_type %Self.ref.loc9_19 [symbolic = %Self.as_type.loc9_23.1 (constants.%Self.as_type)]
  530. // CHECK:STDOUT: %.loc9_23.2: type = converted %Self.ref.loc9_19, %Self.as_type.loc9_23.2 [symbolic = %Self.as_type.loc9_23.1 (constants.%Self.as_type)]
  531. // CHECK:STDOUT: %ptr.loc9_23.2: type = ptr_type %.loc9_23.2 [symbolic = %ptr.loc9_23.1 (constants.%ptr.d06)]
  532. // CHECK:STDOUT: }
  533. // CHECK:STDOUT: %self: @F.1.%ptr.loc9_23.1 (%ptr.d06) = bind_name self, %self.param
  534. // CHECK:STDOUT: %other.param: @F.1.%ptr.loc9_23.1 (%ptr.d06) = value_param call_param1
  535. // CHECK:STDOUT: %.loc9_37.1: type = splice_block %ptr.loc9_37 [symbolic = %ptr.loc9_23.1 (constants.%ptr.d06)] {
  536. // CHECK:STDOUT: %Self.ref.loc9_33: %X.type = name_ref Self, @X.%Self [symbolic = %Self (constants.%Self)]
  537. // CHECK:STDOUT: %Self.as_type.loc9_37: type = facet_access_type %Self.ref.loc9_33 [symbolic = %Self.as_type.loc9_23.1 (constants.%Self.as_type)]
  538. // CHECK:STDOUT: %.loc9_37.2: type = converted %Self.ref.loc9_33, %Self.as_type.loc9_37 [symbolic = %Self.as_type.loc9_23.1 (constants.%Self.as_type)]
  539. // CHECK:STDOUT: %ptr.loc9_37: type = ptr_type %.loc9_37.2 [symbolic = %ptr.loc9_23.1 (constants.%ptr.d06)]
  540. // CHECK:STDOUT: }
  541. // CHECK:STDOUT: %other: @F.1.%ptr.loc9_23.1 (%ptr.d06) = bind_name other, %other.param
  542. // CHECK:STDOUT: %return.param: ref @F.1.%ptr.loc9_23.1 (%ptr.d06) = out_param call_param2
  543. // CHECK:STDOUT: %return: ref @F.1.%ptr.loc9_23.1 (%ptr.d06) = return_slot %return.param
  544. // CHECK:STDOUT: }
  545. // CHECK:STDOUT: %assoc0: %X.assoc_type = assoc_entity element0, %F.decl [concrete = constants.%assoc0]
  546. // CHECK:STDOUT:
  547. // CHECK:STDOUT: !members:
  548. // CHECK:STDOUT: .Self = %Self
  549. // CHECK:STDOUT: .F = %assoc0
  550. // CHECK:STDOUT: witness = (%F.decl)
  551. // CHECK:STDOUT: }
  552. // CHECK:STDOUT:
  553. // CHECK:STDOUT: impl @impl: %B.ref as %X.ref {
  554. // CHECK:STDOUT: %F.decl.loc13_39.1: %F.type.f1b0b1.1 = fn_decl @F.2 [concrete = constants.%F.5161e9.1] {
  555. // CHECK:STDOUT: %self.patt: %pattern_type.5f8 = binding_pattern self [concrete]
  556. // CHECK:STDOUT: %self.param_patt: %pattern_type.5f8 = value_param_pattern %self.patt, call_param0 [concrete]
  557. // CHECK:STDOUT: %.loc13_8: %pattern_type.f6d = addr_pattern %self.param_patt [concrete]
  558. // CHECK:STDOUT: %other.patt: %pattern_type.5f8 = binding_pattern other [concrete]
  559. // CHECK:STDOUT: %other.param_patt: %pattern_type.5f8 = value_param_pattern %other.patt, call_param1 [concrete]
  560. // CHECK:STDOUT: %return.patt: %pattern_type.44a = return_slot_pattern [concrete]
  561. // CHECK:STDOUT: %return.param_patt: %pattern_type.44a = out_param_pattern %return.patt, call_param2 [concrete]
  562. // CHECK:STDOUT: } {
  563. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  564. // CHECK:STDOUT: %ptr.loc13_38: type = ptr_type %C.ref [concrete = constants.%ptr.019]
  565. // CHECK:STDOUT: %self.param: %ptr.6db = value_param call_param0
  566. // CHECK:STDOUT: %.loc13_20: type = splice_block %ptr.loc13_20 [concrete = constants.%ptr.6db] {
  567. // CHECK:STDOUT: %A.ref.loc13_19: type = name_ref A, file.%A.decl [concrete = constants.%A]
  568. // CHECK:STDOUT: %ptr.loc13_20: type = ptr_type %A.ref.loc13_19 [concrete = constants.%ptr.6db]
  569. // CHECK:STDOUT: }
  570. // CHECK:STDOUT: %self: %ptr.6db = bind_name self, %self.param
  571. // CHECK:STDOUT: %other.param: %ptr.6db = value_param call_param1
  572. // CHECK:STDOUT: %.loc13_31: type = splice_block %ptr.loc13_31 [concrete = constants.%ptr.6db] {
  573. // CHECK:STDOUT: %A.ref.loc13_30: type = name_ref A, file.%A.decl [concrete = constants.%A]
  574. // CHECK:STDOUT: %ptr.loc13_31: type = ptr_type %A.ref.loc13_30 [concrete = constants.%ptr.6db]
  575. // CHECK:STDOUT: }
  576. // CHECK:STDOUT: %other: %ptr.6db = bind_name other, %other.param
  577. // CHECK:STDOUT: %return.param: ref %ptr.019 = out_param call_param2
  578. // CHECK:STDOUT: %return: ref %ptr.019 = return_slot %return.param
  579. // CHECK:STDOUT: }
  580. // CHECK:STDOUT: %F.decl.loc13_39.2: %F.type.f1b0b1.2 = fn_decl @F.3 [concrete = constants.%F.5161e9.2] {
  581. // CHECK:STDOUT: %self.patt: %pattern_type.960 = binding_pattern self [concrete]
  582. // CHECK:STDOUT: %self.param_patt: %pattern_type.960 = value_param_pattern %self.patt, call_param0 [concrete]
  583. // CHECK:STDOUT: %.loc9_8: %pattern_type.f6d = addr_pattern %self.param_patt [concrete]
  584. // CHECK:STDOUT: %other.patt: %pattern_type.960 = binding_pattern other [concrete]
  585. // CHECK:STDOUT: %other.param_patt: %pattern_type.960 = value_param_pattern %other.patt, call_param1 [concrete]
  586. // CHECK:STDOUT: %return.patt: %pattern_type.960 = return_slot_pattern [concrete]
  587. // CHECK:STDOUT: %return.param_patt: %pattern_type.960 = out_param_pattern %return.patt, call_param2 [concrete]
  588. // CHECK:STDOUT: } {
  589. // CHECK:STDOUT: %self.param: %ptr.e79 = value_param call_param0
  590. // CHECK:STDOUT: %self: %ptr.e79 = bind_name self, %self.param
  591. // CHECK:STDOUT: %other.param: %ptr.e79 = value_param call_param1
  592. // CHECK:STDOUT: %other: %ptr.e79 = bind_name other, %other.param
  593. // CHECK:STDOUT: %return.param: ref %ptr.e79 = out_param call_param2
  594. // CHECK:STDOUT: %return: ref %ptr.e79 = return_slot %return.param
  595. // CHECK:STDOUT: }
  596. // CHECK:STDOUT:
  597. // CHECK:STDOUT: !members:
  598. // CHECK:STDOUT: .A = <poisoned>
  599. // CHECK:STDOUT: .C = <poisoned>
  600. // CHECK:STDOUT: .F = %F.decl.loc13_39.1
  601. // CHECK:STDOUT: witness = file.%X.impl_witness
  602. // CHECK:STDOUT: }
  603. // CHECK:STDOUT:
  604. // CHECK:STDOUT: class @A {
  605. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  606. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357]
  607. // CHECK:STDOUT: complete_type_witness = %complete_type
  608. // CHECK:STDOUT:
  609. // CHECK:STDOUT: !members:
  610. // CHECK:STDOUT: .Self = constants.%A
  611. // CHECK:STDOUT: }
  612. // CHECK:STDOUT:
  613. // CHECK:STDOUT: class @B {
  614. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A]
  615. // CHECK:STDOUT: %.loc5: %B.elem = base_decl %A.ref, element0 [concrete]
  616. // CHECK:STDOUT: %struct_type.base: type = struct_type {.base: %A} [concrete = constants.%struct_type.base.953]
  617. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.base [concrete = constants.%complete_type.020]
  618. // CHECK:STDOUT: complete_type_witness = %complete_type
  619. // CHECK:STDOUT:
  620. // CHECK:STDOUT: !members:
  621. // CHECK:STDOUT: .Self = constants.%B
  622. // CHECK:STDOUT: .A = <poisoned>
  623. // CHECK:STDOUT: .base = %.loc5
  624. // CHECK:STDOUT: extend %A.ref
  625. // CHECK:STDOUT: }
  626. // CHECK:STDOUT:
  627. // CHECK:STDOUT: class @C {
  628. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B]
  629. // CHECK:STDOUT: %.loc6: %C.elem = base_decl %B.ref, element0 [concrete]
  630. // CHECK:STDOUT: %struct_type.base: type = struct_type {.base: %B} [concrete = constants.%struct_type.base.0ff]
  631. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.base [concrete = constants.%complete_type.98e]
  632. // CHECK:STDOUT: complete_type_witness = %complete_type
  633. // CHECK:STDOUT:
  634. // CHECK:STDOUT: !members:
  635. // CHECK:STDOUT: .Self = constants.%C
  636. // CHECK:STDOUT: .B = <poisoned>
  637. // CHECK:STDOUT: .base = %.loc6
  638. // CHECK:STDOUT: extend %B.ref
  639. // CHECK:STDOUT: }
  640. // CHECK:STDOUT:
  641. // CHECK:STDOUT: generic fn @F.1(@X.%Self: %X.type) {
  642. // CHECK:STDOUT: %Self: %X.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)]
  643. // CHECK:STDOUT: %Self.as_type.loc9_23.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_23.1 (constants.%Self.as_type)]
  644. // CHECK:STDOUT: %ptr.loc9_23.1: type = ptr_type %Self.as_type.loc9_23.1 [symbolic = %ptr.loc9_23.1 (constants.%ptr.d06)]
  645. // CHECK:STDOUT: %pattern_type: type = pattern_type %ptr.loc9_23.1 [symbolic = %pattern_type (constants.%pattern_type.4c5)]
  646. // CHECK:STDOUT:
  647. // CHECK:STDOUT: fn(%self.param: @F.1.%ptr.loc9_23.1 (%ptr.d06), %other.param: @F.1.%ptr.loc9_23.1 (%ptr.d06)) -> @F.1.%ptr.loc9_23.1 (%ptr.d06);
  648. // CHECK:STDOUT: }
  649. // CHECK:STDOUT:
  650. // CHECK:STDOUT: fn @F.2(%self.param: %ptr.6db, %other.param: %ptr.6db) -> %ptr.019;
  651. // CHECK:STDOUT:
  652. // CHECK:STDOUT: fn @F.3(%self.param: %ptr.e79, %other.param: %ptr.e79) -> %ptr.e79 {
  653. // CHECK:STDOUT: !entry:
  654. // CHECK:STDOUT: %self.ref: %ptr.e79 = name_ref self, %self.param
  655. // CHECK:STDOUT: %.loc9_17.1: ref %B = deref %self.ref
  656. // CHECK:STDOUT: %F.bound: <bound method> = bound_method %.loc9_17.1, @impl.%F.decl.loc13_39.1
  657. // CHECK:STDOUT: %other.ref: %ptr.e79 = name_ref other, %other.param
  658. // CHECK:STDOUT: %addr.loc9_17.1: %ptr.e79 = addr_of %.loc9_17.1
  659. // CHECK:STDOUT: %.loc9_17.2: ref %B = deref %addr.loc9_17.1
  660. // CHECK:STDOUT: %.loc9_17.3: ref %A = class_element_access %.loc9_17.2, element0
  661. // CHECK:STDOUT: %addr.loc9_17.2: %ptr.6db = addr_of %.loc9_17.3
  662. // CHECK:STDOUT: %.loc9_17.4: %ptr.6db = converted %addr.loc9_17.1, %addr.loc9_17.2
  663. // CHECK:STDOUT: %.loc9_31.1: ref %B = deref %other.ref
  664. // CHECK:STDOUT: %.loc9_31.2: ref %A = class_element_access %.loc9_31.1, element0
  665. // CHECK:STDOUT: %addr.loc9_31: %ptr.6db = addr_of %.loc9_31.2
  666. // CHECK:STDOUT: %.loc9_31.3: %ptr.6db = converted %other.ref, %addr.loc9_31
  667. // CHECK:STDOUT: %F.call: init %ptr.019 = call %F.bound(%.loc9_17.4, %.loc9_31.3)
  668. // CHECK:STDOUT: %.loc13_39.1: %ptr.019 = value_of_initializer %F.call
  669. // CHECK:STDOUT: %.loc13_39.2: %ptr.019 = converted %F.call, %.loc13_39.1
  670. // CHECK:STDOUT: %.loc13_39.3: ref %C = deref %.loc13_39.2
  671. // CHECK:STDOUT: %.loc13_39.4: ref %B = class_element_access %.loc13_39.3, element0
  672. // CHECK:STDOUT: %addr.loc13: %ptr.e79 = addr_of %.loc13_39.4
  673. // CHECK:STDOUT: %.loc13_39.5: %ptr.e79 = converted %F.call, %addr.loc13
  674. // CHECK:STDOUT: return %.loc13_39.5
  675. // CHECK:STDOUT: }
  676. // CHECK:STDOUT:
  677. // CHECK:STDOUT: specific @F.1(constants.%Self) {
  678. // CHECK:STDOUT: %Self => constants.%Self
  679. // CHECK:STDOUT: %Self.as_type.loc9_23.1 => constants.%Self.as_type
  680. // CHECK:STDOUT: %ptr.loc9_23.1 => constants.%ptr.d06
  681. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.4c5
  682. // CHECK:STDOUT: }
  683. // CHECK:STDOUT:
  684. // CHECK:STDOUT: specific @F.1(constants.%X.facet) {
  685. // CHECK:STDOUT: %Self => constants.%X.facet
  686. // CHECK:STDOUT: %Self.as_type.loc9_23.1 => constants.%B
  687. // CHECK:STDOUT: %ptr.loc9_23.1 => constants.%ptr.e79
  688. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.960
  689. // CHECK:STDOUT: }
  690. // CHECK:STDOUT:
  691. // CHECK:STDOUT: --- inheritance_value_conversion.carbon
  692. // CHECK:STDOUT:
  693. // CHECK:STDOUT: constants {
  694. // CHECK:STDOUT: %A: type = class_type @A [concrete]
  695. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  696. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  697. // CHECK:STDOUT: %B: type = class_type @B [concrete]
  698. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  699. // CHECK:STDOUT: %B.elem: type = unbound_element_type %B, %A [concrete]
  700. // CHECK:STDOUT: %struct_type.base.953: type = struct_type {.base: %A} [concrete]
  701. // CHECK:STDOUT: %complete_type.020: <witness> = complete_type_witness %struct_type.base.953 [concrete]
  702. // CHECK:STDOUT: %X.type: type = facet_type <@X> [concrete]
  703. // CHECK:STDOUT: %Self: %X.type = bind_symbolic_name Self, 0 [symbolic]
  704. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic]
  705. // CHECK:STDOUT: %pattern_type.331: type = pattern_type %Self.as_type [symbolic]
  706. // CHECK:STDOUT: %F.type.594: type = fn_type @F.1 [concrete]
  707. // CHECK:STDOUT: %F.b69: %F.type.594 = struct_value () [concrete]
  708. // CHECK:STDOUT: %X.assoc_type: type = assoc_entity_type @X [concrete]
  709. // CHECK:STDOUT: %assoc0: %X.assoc_type = assoc_entity element0, @X.%F.decl [concrete]
  710. // CHECK:STDOUT: %X.impl_witness: <witness> = impl_witness file.%X.impl_witness_table [concrete]
  711. // CHECK:STDOUT: %pattern_type.c10: type = pattern_type %A [concrete]
  712. // CHECK:STDOUT: %F.type.f1b0b1.1: type = fn_type @F.2 [concrete]
  713. // CHECK:STDOUT: %F.5161e9.1: %F.type.f1b0b1.1 = struct_value () [concrete]
  714. // CHECK:STDOUT: %X.facet: %X.type = facet_value %B, (%X.impl_witness) [concrete]
  715. // CHECK:STDOUT: %pattern_type.049: type = pattern_type %B [concrete]
  716. // CHECK:STDOUT: %F.type.f1b0b1.2: type = fn_type @F.3 [concrete]
  717. // CHECK:STDOUT: %F.5161e9.2: %F.type.f1b0b1.2 = struct_value () [concrete]
  718. // CHECK:STDOUT: }
  719. // CHECK:STDOUT:
  720. // CHECK:STDOUT: file {
  721. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  722. // CHECK:STDOUT: .A = %A.decl
  723. // CHECK:STDOUT: .B = %B.decl
  724. // CHECK:STDOUT: .X = %X.decl
  725. // CHECK:STDOUT: }
  726. // CHECK:STDOUT: %A.decl: type = class_decl @A [concrete = constants.%A] {} {}
  727. // CHECK:STDOUT: %B.decl: type = class_decl @B [concrete = constants.%B] {} {}
  728. // CHECK:STDOUT: %X.decl: type = interface_decl @X [concrete = constants.%X.type] {} {}
  729. // CHECK:STDOUT: impl_decl @impl [concrete] {} {
  730. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B]
  731. // CHECK:STDOUT: %X.ref: type = name_ref X, file.%X.decl [concrete = constants.%X.type]
  732. // CHECK:STDOUT: }
  733. // CHECK:STDOUT: %X.impl_witness_table = impl_witness_table (@impl.%F.decl.loc12_26.2), @impl [concrete]
  734. // CHECK:STDOUT: %X.impl_witness: <witness> = impl_witness %X.impl_witness_table [concrete = constants.%X.impl_witness]
  735. // CHECK:STDOUT: }
  736. // CHECK:STDOUT:
  737. // CHECK:STDOUT: interface @X {
  738. // CHECK:STDOUT: %Self: %X.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  739. // CHECK:STDOUT: %F.decl: %F.type.594 = fn_decl @F.1 [concrete = constants.%F.b69] {
  740. // CHECK:STDOUT: %self.patt: @F.1.%pattern_type (%pattern_type.331) = binding_pattern self [concrete]
  741. // CHECK:STDOUT: %self.param_patt: @F.1.%pattern_type (%pattern_type.331) = value_param_pattern %self.patt, call_param0 [concrete]
  742. // CHECK:STDOUT: %other.patt: @F.1.%pattern_type (%pattern_type.331) = binding_pattern other [concrete]
  743. // CHECK:STDOUT: %other.param_patt: @F.1.%pattern_type (%pattern_type.331) = value_param_pattern %other.patt, call_param1 [concrete]
  744. // CHECK:STDOUT: } {
  745. // CHECK:STDOUT: %self.param: @F.1.%Self.as_type.loc8_14.1 (%Self.as_type) = value_param call_param0
  746. // CHECK:STDOUT: %.loc8_14.1: type = splice_block %.loc8_14.2 [symbolic = %Self.as_type.loc8_14.1 (constants.%Self.as_type)] {
  747. // CHECK:STDOUT: %Self.ref.loc8_14: %X.type = name_ref Self, @X.%Self [symbolic = %Self (constants.%Self)]
  748. // CHECK:STDOUT: %Self.as_type.loc8_14.2: type = facet_access_type %Self.ref.loc8_14 [symbolic = %Self.as_type.loc8_14.1 (constants.%Self.as_type)]
  749. // CHECK:STDOUT: %.loc8_14.2: type = converted %Self.ref.loc8_14, %Self.as_type.loc8_14.2 [symbolic = %Self.as_type.loc8_14.1 (constants.%Self.as_type)]
  750. // CHECK:STDOUT: }
  751. // CHECK:STDOUT: %self: @F.1.%Self.as_type.loc8_14.1 (%Self.as_type) = bind_name self, %self.param
  752. // CHECK:STDOUT: %other.param: @F.1.%Self.as_type.loc8_14.1 (%Self.as_type) = value_param call_param1
  753. // CHECK:STDOUT: %.loc8_27.1: type = splice_block %.loc8_27.2 [symbolic = %Self.as_type.loc8_14.1 (constants.%Self.as_type)] {
  754. // CHECK:STDOUT: %Self.ref.loc8_27: %X.type = name_ref Self, @X.%Self [symbolic = %Self (constants.%Self)]
  755. // CHECK:STDOUT: %Self.as_type.loc8_27: type = facet_access_type %Self.ref.loc8_27 [symbolic = %Self.as_type.loc8_14.1 (constants.%Self.as_type)]
  756. // CHECK:STDOUT: %.loc8_27.2: type = converted %Self.ref.loc8_27, %Self.as_type.loc8_27 [symbolic = %Self.as_type.loc8_14.1 (constants.%Self.as_type)]
  757. // CHECK:STDOUT: }
  758. // CHECK:STDOUT: %other: @F.1.%Self.as_type.loc8_14.1 (%Self.as_type) = bind_name other, %other.param
  759. // CHECK:STDOUT: }
  760. // CHECK:STDOUT: %assoc0: %X.assoc_type = assoc_entity element0, %F.decl [concrete = constants.%assoc0]
  761. // CHECK:STDOUT:
  762. // CHECK:STDOUT: !members:
  763. // CHECK:STDOUT: .Self = %Self
  764. // CHECK:STDOUT: .F = %assoc0
  765. // CHECK:STDOUT: witness = (%F.decl)
  766. // CHECK:STDOUT: }
  767. // CHECK:STDOUT:
  768. // CHECK:STDOUT: impl @impl: %B.ref as %X.ref {
  769. // CHECK:STDOUT: %F.decl.loc12_26.1: %F.type.f1b0b1.1 = fn_decl @F.2 [concrete = constants.%F.5161e9.1] {
  770. // CHECK:STDOUT: %self.patt: %pattern_type.c10 = binding_pattern self [concrete]
  771. // CHECK:STDOUT: %self.param_patt: %pattern_type.c10 = value_param_pattern %self.patt, call_param0 [concrete]
  772. // CHECK:STDOUT: %other.patt: %pattern_type.c10 = binding_pattern other [concrete]
  773. // CHECK:STDOUT: %other.param_patt: %pattern_type.c10 = value_param_pattern %other.patt, call_param1 [concrete]
  774. // CHECK:STDOUT: } {
  775. // CHECK:STDOUT: %self.param: %A = value_param call_param0
  776. // CHECK:STDOUT: %A.ref.loc12_14: type = name_ref A, file.%A.decl [concrete = constants.%A]
  777. // CHECK:STDOUT: %self: %A = bind_name self, %self.param
  778. // CHECK:STDOUT: %other.param: %A = value_param call_param1
  779. // CHECK:STDOUT: %A.ref.loc12_24: type = name_ref A, file.%A.decl [concrete = constants.%A]
  780. // CHECK:STDOUT: %other: %A = bind_name other, %other.param
  781. // CHECK:STDOUT: }
  782. // CHECK:STDOUT: %F.decl.loc12_26.2: %F.type.f1b0b1.2 = fn_decl @F.3 [concrete = constants.%F.5161e9.2] {
  783. // CHECK:STDOUT: %self.patt: %pattern_type.049 = binding_pattern self [concrete]
  784. // CHECK:STDOUT: %self.param_patt: %pattern_type.049 = value_param_pattern %self.patt, call_param0 [concrete]
  785. // CHECK:STDOUT: %other.patt: %pattern_type.049 = binding_pattern other [concrete]
  786. // CHECK:STDOUT: %other.param_patt: %pattern_type.049 = value_param_pattern %other.patt, call_param1 [concrete]
  787. // CHECK:STDOUT: } {
  788. // CHECK:STDOUT: %self.param: %B = value_param call_param0
  789. // CHECK:STDOUT: %self: %B = bind_name self, %self.param
  790. // CHECK:STDOUT: %other.param: %B = value_param call_param1
  791. // CHECK:STDOUT: %other: %B = bind_name other, %other.param
  792. // CHECK:STDOUT: }
  793. // CHECK:STDOUT:
  794. // CHECK:STDOUT: !members:
  795. // CHECK:STDOUT: .A = <poisoned>
  796. // CHECK:STDOUT: .F = %F.decl.loc12_26.1
  797. // CHECK:STDOUT: witness = file.%X.impl_witness
  798. // CHECK:STDOUT: }
  799. // CHECK:STDOUT:
  800. // CHECK:STDOUT: class @A {
  801. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  802. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357]
  803. // CHECK:STDOUT: complete_type_witness = %complete_type
  804. // CHECK:STDOUT:
  805. // CHECK:STDOUT: !members:
  806. // CHECK:STDOUT: .Self = constants.%A
  807. // CHECK:STDOUT: }
  808. // CHECK:STDOUT:
  809. // CHECK:STDOUT: class @B {
  810. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A]
  811. // CHECK:STDOUT: %.loc5: %B.elem = base_decl %A.ref, element0 [concrete]
  812. // CHECK:STDOUT: %struct_type.base: type = struct_type {.base: %A} [concrete = constants.%struct_type.base.953]
  813. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.base [concrete = constants.%complete_type.020]
  814. // CHECK:STDOUT: complete_type_witness = %complete_type
  815. // CHECK:STDOUT:
  816. // CHECK:STDOUT: !members:
  817. // CHECK:STDOUT: .Self = constants.%B
  818. // CHECK:STDOUT: .A = <poisoned>
  819. // CHECK:STDOUT: .base = %.loc5
  820. // CHECK:STDOUT: extend %A.ref
  821. // CHECK:STDOUT: }
  822. // CHECK:STDOUT:
  823. // CHECK:STDOUT: generic fn @F.1(@X.%Self: %X.type) {
  824. // CHECK:STDOUT: %Self: %X.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)]
  825. // CHECK:STDOUT: %Self.as_type.loc8_14.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc8_14.1 (constants.%Self.as_type)]
  826. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc8_14.1 [symbolic = %pattern_type (constants.%pattern_type.331)]
  827. // CHECK:STDOUT:
  828. // CHECK:STDOUT: fn(%self.param: @F.1.%Self.as_type.loc8_14.1 (%Self.as_type), %other.param: @F.1.%Self.as_type.loc8_14.1 (%Self.as_type));
  829. // CHECK:STDOUT: }
  830. // CHECK:STDOUT:
  831. // CHECK:STDOUT: fn @F.2(%self.param: %A, %other.param: %A);
  832. // CHECK:STDOUT:
  833. // CHECK:STDOUT: fn @F.3(%self.param: %B, %other.param: %B) {
  834. // CHECK:STDOUT: !entry:
  835. // CHECK:STDOUT: %self.ref: %B = name_ref self, %self.param
  836. // CHECK:STDOUT: %F.bound: <bound method> = bound_method %self.ref, @impl.%F.decl.loc12_26.1
  837. // CHECK:STDOUT: %other.ref: %B = name_ref other, %other.param
  838. // CHECK:STDOUT: %.loc8_12.1: ref %A = class_element_access %self.ref, element0
  839. // CHECK:STDOUT: %.loc8_12.2: ref %A = converted %self.ref, %.loc8_12.1
  840. // CHECK:STDOUT: %.loc8_12.3: %A = bind_value %.loc8_12.2
  841. // CHECK:STDOUT: %.loc8_25.1: ref %A = class_element_access %other.ref, element0
  842. // CHECK:STDOUT: %.loc8_25.2: ref %A = converted %other.ref, %.loc8_25.1
  843. // CHECK:STDOUT: %.loc8_25.3: %A = bind_value %.loc8_25.2
  844. // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.bound(%.loc8_12.3, %.loc8_25.3)
  845. // CHECK:STDOUT: return
  846. // CHECK:STDOUT: }
  847. // CHECK:STDOUT:
  848. // CHECK:STDOUT: specific @F.1(constants.%Self) {
  849. // CHECK:STDOUT: %Self => constants.%Self
  850. // CHECK:STDOUT: %Self.as_type.loc8_14.1 => constants.%Self.as_type
  851. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.331
  852. // CHECK:STDOUT: }
  853. // CHECK:STDOUT:
  854. // CHECK:STDOUT: specific @F.1(constants.%X.facet) {
  855. // CHECK:STDOUT: %Self => constants.%X.facet
  856. // CHECK:STDOUT: %Self.as_type.loc8_14.1 => constants.%B
  857. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.049
  858. // CHECK:STDOUT: }
  859. // CHECK:STDOUT:
  860. // CHECK:STDOUT: --- inheritance_value_conversion_pointer.carbon
  861. // CHECK:STDOUT:
  862. // CHECK:STDOUT: constants {
  863. // CHECK:STDOUT: %A: type = class_type @A [concrete]
  864. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  865. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  866. // CHECK:STDOUT: %B: type = class_type @B [concrete]
  867. // CHECK:STDOUT: %B.elem: type = unbound_element_type %B, %A [concrete]
  868. // CHECK:STDOUT: %struct_type.base.953: type = struct_type {.base: %A} [concrete]
  869. // CHECK:STDOUT: %complete_type.020: <witness> = complete_type_witness %struct_type.base.953 [concrete]
  870. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  871. // CHECK:STDOUT: %C.elem: type = unbound_element_type %C, %B [concrete]
  872. // CHECK:STDOUT: %struct_type.base.0ff: type = struct_type {.base: %B} [concrete]
  873. // CHECK:STDOUT: %complete_type.98e: <witness> = complete_type_witness %struct_type.base.0ff [concrete]
  874. // CHECK:STDOUT: %X.type: type = facet_type <@X> [concrete]
  875. // CHECK:STDOUT: %Self: %X.type = bind_symbolic_name Self, 0 [symbolic]
  876. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic]
  877. // CHECK:STDOUT: %ptr.d06: type = ptr_type %Self.as_type [symbolic]
  878. // CHECK:STDOUT: %pattern_type.4c5: type = pattern_type %ptr.d06 [symbolic]
  879. // CHECK:STDOUT: %pattern_type.f6d: type = pattern_type auto [concrete]
  880. // CHECK:STDOUT: %F.type.594: type = fn_type @F.1 [concrete]
  881. // CHECK:STDOUT: %F.b69: %F.type.594 = struct_value () [concrete]
  882. // CHECK:STDOUT: %X.assoc_type: type = assoc_entity_type @X [concrete]
  883. // CHECK:STDOUT: %assoc0: %X.assoc_type = assoc_entity element0, @X.%F.decl [concrete]
  884. // CHECK:STDOUT: %X.impl_witness: <witness> = impl_witness file.%X.impl_witness_table [concrete]
  885. // CHECK:STDOUT: %ptr.6db: type = ptr_type %A [concrete]
  886. // CHECK:STDOUT: %pattern_type.5f8: type = pattern_type %ptr.6db [concrete]
  887. // CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete]
  888. // CHECK:STDOUT: %pattern_type.44a: type = pattern_type %ptr.019 [concrete]
  889. // CHECK:STDOUT: %F.type.f1b0b1.1: type = fn_type @F.2 [concrete]
  890. // CHECK:STDOUT: %F.5161e9.1: %F.type.f1b0b1.1 = struct_value () [concrete]
  891. // CHECK:STDOUT: %X.facet: %X.type = facet_value %B, (%X.impl_witness) [concrete]
  892. // CHECK:STDOUT: %ptr.e79: type = ptr_type %B [concrete]
  893. // CHECK:STDOUT: %pattern_type.960: type = pattern_type %ptr.e79 [concrete]
  894. // CHECK:STDOUT: %F.type.f1b0b1.2: type = fn_type @F.3 [concrete]
  895. // CHECK:STDOUT: %F.5161e9.2: %F.type.f1b0b1.2 = struct_value () [concrete]
  896. // CHECK:STDOUT: }
  897. // CHECK:STDOUT:
  898. // CHECK:STDOUT: file {
  899. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  900. // CHECK:STDOUT: .A = %A.decl
  901. // CHECK:STDOUT: .B = %B.decl
  902. // CHECK:STDOUT: .C = %C.decl
  903. // CHECK:STDOUT: .X = %X.decl
  904. // CHECK:STDOUT: }
  905. // CHECK:STDOUT: %A.decl: type = class_decl @A [concrete = constants.%A] {} {}
  906. // CHECK:STDOUT: %B.decl: type = class_decl @B [concrete = constants.%B] {} {}
  907. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  908. // CHECK:STDOUT: %X.decl: type = interface_decl @X [concrete = constants.%X.type] {} {}
  909. // CHECK:STDOUT: impl_decl @impl [concrete] {} {
  910. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B]
  911. // CHECK:STDOUT: %X.ref: type = name_ref X, file.%X.decl [concrete = constants.%X.type]
  912. // CHECK:STDOUT: }
  913. // CHECK:STDOUT: %X.impl_witness_table = impl_witness_table (@impl.%F.decl.loc13_39.2), @impl [concrete]
  914. // CHECK:STDOUT: %X.impl_witness: <witness> = impl_witness %X.impl_witness_table [concrete = constants.%X.impl_witness]
  915. // CHECK:STDOUT: }
  916. // CHECK:STDOUT:
  917. // CHECK:STDOUT: interface @X {
  918. // CHECK:STDOUT: %Self: %X.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  919. // CHECK:STDOUT: %F.decl: %F.type.594 = fn_decl @F.1 [concrete = constants.%F.b69] {
  920. // CHECK:STDOUT: %self.patt: @F.1.%pattern_type (%pattern_type.4c5) = binding_pattern self [concrete]
  921. // CHECK:STDOUT: %self.param_patt: @F.1.%pattern_type (%pattern_type.4c5) = value_param_pattern %self.patt, call_param0 [concrete]
  922. // CHECK:STDOUT: %.loc9_8: %pattern_type.f6d = addr_pattern %self.param_patt [concrete]
  923. // CHECK:STDOUT: %other.patt: @F.1.%pattern_type (%pattern_type.4c5) = binding_pattern other [concrete]
  924. // CHECK:STDOUT: %other.param_patt: @F.1.%pattern_type (%pattern_type.4c5) = value_param_pattern %other.patt, call_param1 [concrete]
  925. // CHECK:STDOUT: %return.patt: @F.1.%pattern_type (%pattern_type.4c5) = return_slot_pattern [concrete]
  926. // CHECK:STDOUT: %return.param_patt: @F.1.%pattern_type (%pattern_type.4c5) = out_param_pattern %return.patt, call_param2 [concrete]
  927. // CHECK:STDOUT: } {
  928. // CHECK:STDOUT: %Self.ref.loc9_43: %X.type = name_ref Self, @X.%Self [symbolic = %Self (constants.%Self)]
  929. // CHECK:STDOUT: %Self.as_type.loc9_47: type = facet_access_type %Self.ref.loc9_43 [symbolic = %Self.as_type.loc9_23.1 (constants.%Self.as_type)]
  930. // CHECK:STDOUT: %.loc9_47: type = converted %Self.ref.loc9_43, %Self.as_type.loc9_47 [symbolic = %Self.as_type.loc9_23.1 (constants.%Self.as_type)]
  931. // CHECK:STDOUT: %ptr.loc9_47: type = ptr_type %.loc9_47 [symbolic = %ptr.loc9_23.1 (constants.%ptr.d06)]
  932. // CHECK:STDOUT: %self.param: @F.1.%ptr.loc9_23.1 (%ptr.d06) = value_param call_param0
  933. // CHECK:STDOUT: %.loc9_23.1: type = splice_block %ptr.loc9_23.2 [symbolic = %ptr.loc9_23.1 (constants.%ptr.d06)] {
  934. // CHECK:STDOUT: %Self.ref.loc9_19: %X.type = name_ref Self, @X.%Self [symbolic = %Self (constants.%Self)]
  935. // CHECK:STDOUT: %Self.as_type.loc9_23.2: type = facet_access_type %Self.ref.loc9_19 [symbolic = %Self.as_type.loc9_23.1 (constants.%Self.as_type)]
  936. // CHECK:STDOUT: %.loc9_23.2: type = converted %Self.ref.loc9_19, %Self.as_type.loc9_23.2 [symbolic = %Self.as_type.loc9_23.1 (constants.%Self.as_type)]
  937. // CHECK:STDOUT: %ptr.loc9_23.2: type = ptr_type %.loc9_23.2 [symbolic = %ptr.loc9_23.1 (constants.%ptr.d06)]
  938. // CHECK:STDOUT: }
  939. // CHECK:STDOUT: %self: @F.1.%ptr.loc9_23.1 (%ptr.d06) = bind_name self, %self.param
  940. // CHECK:STDOUT: %other.param: @F.1.%ptr.loc9_23.1 (%ptr.d06) = value_param call_param1
  941. // CHECK:STDOUT: %.loc9_37.1: type = splice_block %ptr.loc9_37 [symbolic = %ptr.loc9_23.1 (constants.%ptr.d06)] {
  942. // CHECK:STDOUT: %Self.ref.loc9_33: %X.type = name_ref Self, @X.%Self [symbolic = %Self (constants.%Self)]
  943. // CHECK:STDOUT: %Self.as_type.loc9_37: type = facet_access_type %Self.ref.loc9_33 [symbolic = %Self.as_type.loc9_23.1 (constants.%Self.as_type)]
  944. // CHECK:STDOUT: %.loc9_37.2: type = converted %Self.ref.loc9_33, %Self.as_type.loc9_37 [symbolic = %Self.as_type.loc9_23.1 (constants.%Self.as_type)]
  945. // CHECK:STDOUT: %ptr.loc9_37: type = ptr_type %.loc9_37.2 [symbolic = %ptr.loc9_23.1 (constants.%ptr.d06)]
  946. // CHECK:STDOUT: }
  947. // CHECK:STDOUT: %other: @F.1.%ptr.loc9_23.1 (%ptr.d06) = bind_name other, %other.param
  948. // CHECK:STDOUT: %return.param: ref @F.1.%ptr.loc9_23.1 (%ptr.d06) = out_param call_param2
  949. // CHECK:STDOUT: %return: ref @F.1.%ptr.loc9_23.1 (%ptr.d06) = return_slot %return.param
  950. // CHECK:STDOUT: }
  951. // CHECK:STDOUT: %assoc0: %X.assoc_type = assoc_entity element0, %F.decl [concrete = constants.%assoc0]
  952. // CHECK:STDOUT:
  953. // CHECK:STDOUT: !members:
  954. // CHECK:STDOUT: .Self = %Self
  955. // CHECK:STDOUT: .F = %assoc0
  956. // CHECK:STDOUT: witness = (%F.decl)
  957. // CHECK:STDOUT: }
  958. // CHECK:STDOUT:
  959. // CHECK:STDOUT: impl @impl: %B.ref as %X.ref {
  960. // CHECK:STDOUT: %F.decl.loc13_39.1: %F.type.f1b0b1.1 = fn_decl @F.2 [concrete = constants.%F.5161e9.1] {
  961. // CHECK:STDOUT: %self.patt: %pattern_type.5f8 = binding_pattern self [concrete]
  962. // CHECK:STDOUT: %self.param_patt: %pattern_type.5f8 = value_param_pattern %self.patt, call_param0 [concrete]
  963. // CHECK:STDOUT: %.loc13_8: %pattern_type.f6d = addr_pattern %self.param_patt [concrete]
  964. // CHECK:STDOUT: %other.patt: %pattern_type.5f8 = binding_pattern other [concrete]
  965. // CHECK:STDOUT: %other.param_patt: %pattern_type.5f8 = value_param_pattern %other.patt, call_param1 [concrete]
  966. // CHECK:STDOUT: %return.patt: %pattern_type.44a = return_slot_pattern [concrete]
  967. // CHECK:STDOUT: %return.param_patt: %pattern_type.44a = out_param_pattern %return.patt, call_param2 [concrete]
  968. // CHECK:STDOUT: } {
  969. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  970. // CHECK:STDOUT: %ptr.loc13_38: type = ptr_type %C.ref [concrete = constants.%ptr.019]
  971. // CHECK:STDOUT: %self.param: %ptr.6db = value_param call_param0
  972. // CHECK:STDOUT: %.loc13_20: type = splice_block %ptr.loc13_20 [concrete = constants.%ptr.6db] {
  973. // CHECK:STDOUT: %A.ref.loc13_19: type = name_ref A, file.%A.decl [concrete = constants.%A]
  974. // CHECK:STDOUT: %ptr.loc13_20: type = ptr_type %A.ref.loc13_19 [concrete = constants.%ptr.6db]
  975. // CHECK:STDOUT: }
  976. // CHECK:STDOUT: %self: %ptr.6db = bind_name self, %self.param
  977. // CHECK:STDOUT: %other.param: %ptr.6db = value_param call_param1
  978. // CHECK:STDOUT: %.loc13_31: type = splice_block %ptr.loc13_31 [concrete = constants.%ptr.6db] {
  979. // CHECK:STDOUT: %A.ref.loc13_30: type = name_ref A, file.%A.decl [concrete = constants.%A]
  980. // CHECK:STDOUT: %ptr.loc13_31: type = ptr_type %A.ref.loc13_30 [concrete = constants.%ptr.6db]
  981. // CHECK:STDOUT: }
  982. // CHECK:STDOUT: %other: %ptr.6db = bind_name other, %other.param
  983. // CHECK:STDOUT: %return.param: ref %ptr.019 = out_param call_param2
  984. // CHECK:STDOUT: %return: ref %ptr.019 = return_slot %return.param
  985. // CHECK:STDOUT: }
  986. // CHECK:STDOUT: %F.decl.loc13_39.2: %F.type.f1b0b1.2 = fn_decl @F.3 [concrete = constants.%F.5161e9.2] {
  987. // CHECK:STDOUT: %self.patt: %pattern_type.960 = binding_pattern self [concrete]
  988. // CHECK:STDOUT: %self.param_patt: %pattern_type.960 = value_param_pattern %self.patt, call_param0 [concrete]
  989. // CHECK:STDOUT: %.loc9_8: %pattern_type.f6d = addr_pattern %self.param_patt [concrete]
  990. // CHECK:STDOUT: %other.patt: %pattern_type.960 = binding_pattern other [concrete]
  991. // CHECK:STDOUT: %other.param_patt: %pattern_type.960 = value_param_pattern %other.patt, call_param1 [concrete]
  992. // CHECK:STDOUT: %return.patt: %pattern_type.960 = return_slot_pattern [concrete]
  993. // CHECK:STDOUT: %return.param_patt: %pattern_type.960 = out_param_pattern %return.patt, call_param2 [concrete]
  994. // CHECK:STDOUT: } {
  995. // CHECK:STDOUT: %self.param: %ptr.e79 = value_param call_param0
  996. // CHECK:STDOUT: %self: %ptr.e79 = bind_name self, %self.param
  997. // CHECK:STDOUT: %other.param: %ptr.e79 = value_param call_param1
  998. // CHECK:STDOUT: %other: %ptr.e79 = bind_name other, %other.param
  999. // CHECK:STDOUT: %return.param: ref %ptr.e79 = out_param call_param2
  1000. // CHECK:STDOUT: %return: ref %ptr.e79 = return_slot %return.param
  1001. // CHECK:STDOUT: }
  1002. // CHECK:STDOUT:
  1003. // CHECK:STDOUT: !members:
  1004. // CHECK:STDOUT: .A = <poisoned>
  1005. // CHECK:STDOUT: .C = <poisoned>
  1006. // CHECK:STDOUT: .F = %F.decl.loc13_39.1
  1007. // CHECK:STDOUT: witness = file.%X.impl_witness
  1008. // CHECK:STDOUT: }
  1009. // CHECK:STDOUT:
  1010. // CHECK:STDOUT: class @A {
  1011. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  1012. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357]
  1013. // CHECK:STDOUT: complete_type_witness = %complete_type
  1014. // CHECK:STDOUT:
  1015. // CHECK:STDOUT: !members:
  1016. // CHECK:STDOUT: .Self = constants.%A
  1017. // CHECK:STDOUT: }
  1018. // CHECK:STDOUT:
  1019. // CHECK:STDOUT: class @B {
  1020. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A]
  1021. // CHECK:STDOUT: %.loc5: %B.elem = base_decl %A.ref, element0 [concrete]
  1022. // CHECK:STDOUT: %struct_type.base: type = struct_type {.base: %A} [concrete = constants.%struct_type.base.953]
  1023. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.base [concrete = constants.%complete_type.020]
  1024. // CHECK:STDOUT: complete_type_witness = %complete_type
  1025. // CHECK:STDOUT:
  1026. // CHECK:STDOUT: !members:
  1027. // CHECK:STDOUT: .Self = constants.%B
  1028. // CHECK:STDOUT: .A = <poisoned>
  1029. // CHECK:STDOUT: .base = %.loc5
  1030. // CHECK:STDOUT: extend %A.ref
  1031. // CHECK:STDOUT: }
  1032. // CHECK:STDOUT:
  1033. // CHECK:STDOUT: class @C {
  1034. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B]
  1035. // CHECK:STDOUT: %.loc6: %C.elem = base_decl %B.ref, element0 [concrete]
  1036. // CHECK:STDOUT: %struct_type.base: type = struct_type {.base: %B} [concrete = constants.%struct_type.base.0ff]
  1037. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.base [concrete = constants.%complete_type.98e]
  1038. // CHECK:STDOUT: complete_type_witness = %complete_type
  1039. // CHECK:STDOUT:
  1040. // CHECK:STDOUT: !members:
  1041. // CHECK:STDOUT: .Self = constants.%C
  1042. // CHECK:STDOUT: .B = <poisoned>
  1043. // CHECK:STDOUT: .base = %.loc6
  1044. // CHECK:STDOUT: extend %B.ref
  1045. // CHECK:STDOUT: }
  1046. // CHECK:STDOUT:
  1047. // CHECK:STDOUT: generic fn @F.1(@X.%Self: %X.type) {
  1048. // CHECK:STDOUT: %Self: %X.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)]
  1049. // CHECK:STDOUT: %Self.as_type.loc9_23.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_23.1 (constants.%Self.as_type)]
  1050. // CHECK:STDOUT: %ptr.loc9_23.1: type = ptr_type %Self.as_type.loc9_23.1 [symbolic = %ptr.loc9_23.1 (constants.%ptr.d06)]
  1051. // CHECK:STDOUT: %pattern_type: type = pattern_type %ptr.loc9_23.1 [symbolic = %pattern_type (constants.%pattern_type.4c5)]
  1052. // CHECK:STDOUT:
  1053. // CHECK:STDOUT: fn(%self.param: @F.1.%ptr.loc9_23.1 (%ptr.d06), %other.param: @F.1.%ptr.loc9_23.1 (%ptr.d06)) -> @F.1.%ptr.loc9_23.1 (%ptr.d06);
  1054. // CHECK:STDOUT: }
  1055. // CHECK:STDOUT:
  1056. // CHECK:STDOUT: fn @F.2(%self.param: %ptr.6db, %other.param: %ptr.6db) -> %ptr.019;
  1057. // CHECK:STDOUT:
  1058. // CHECK:STDOUT: fn @F.3(%self.param: %ptr.e79, %other.param: %ptr.e79) -> %ptr.e79 {
  1059. // CHECK:STDOUT: !entry:
  1060. // CHECK:STDOUT: %self.ref: %ptr.e79 = name_ref self, %self.param
  1061. // CHECK:STDOUT: %.loc9_17.1: ref %B = deref %self.ref
  1062. // CHECK:STDOUT: %F.bound: <bound method> = bound_method %.loc9_17.1, @impl.%F.decl.loc13_39.1
  1063. // CHECK:STDOUT: %other.ref: %ptr.e79 = name_ref other, %other.param
  1064. // CHECK:STDOUT: %addr.loc9_17.1: %ptr.e79 = addr_of %.loc9_17.1
  1065. // CHECK:STDOUT: %.loc9_17.2: ref %B = deref %addr.loc9_17.1
  1066. // CHECK:STDOUT: %.loc9_17.3: ref %A = class_element_access %.loc9_17.2, element0
  1067. // CHECK:STDOUT: %addr.loc9_17.2: %ptr.6db = addr_of %.loc9_17.3
  1068. // CHECK:STDOUT: %.loc9_17.4: %ptr.6db = converted %addr.loc9_17.1, %addr.loc9_17.2
  1069. // CHECK:STDOUT: %.loc9_31.1: ref %B = deref %other.ref
  1070. // CHECK:STDOUT: %.loc9_31.2: ref %A = class_element_access %.loc9_31.1, element0
  1071. // CHECK:STDOUT: %addr.loc9_31: %ptr.6db = addr_of %.loc9_31.2
  1072. // CHECK:STDOUT: %.loc9_31.3: %ptr.6db = converted %other.ref, %addr.loc9_31
  1073. // CHECK:STDOUT: %F.call: init %ptr.019 = call %F.bound(%.loc9_17.4, %.loc9_31.3)
  1074. // CHECK:STDOUT: %.loc13_39.1: %ptr.019 = value_of_initializer %F.call
  1075. // CHECK:STDOUT: %.loc13_39.2: %ptr.019 = converted %F.call, %.loc13_39.1
  1076. // CHECK:STDOUT: %.loc13_39.3: ref %C = deref %.loc13_39.2
  1077. // CHECK:STDOUT: %.loc13_39.4: ref %B = class_element_access %.loc13_39.3, element0
  1078. // CHECK:STDOUT: %addr.loc13: %ptr.e79 = addr_of %.loc13_39.4
  1079. // CHECK:STDOUT: %.loc13_39.5: %ptr.e79 = converted %F.call, %addr.loc13
  1080. // CHECK:STDOUT: return %.loc13_39.5
  1081. // CHECK:STDOUT: }
  1082. // CHECK:STDOUT:
  1083. // CHECK:STDOUT: specific @F.1(constants.%Self) {
  1084. // CHECK:STDOUT: %Self => constants.%Self
  1085. // CHECK:STDOUT: %Self.as_type.loc9_23.1 => constants.%Self.as_type
  1086. // CHECK:STDOUT: %ptr.loc9_23.1 => constants.%ptr.d06
  1087. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.4c5
  1088. // CHECK:STDOUT: }
  1089. // CHECK:STDOUT:
  1090. // CHECK:STDOUT: specific @F.1(constants.%X.facet) {
  1091. // CHECK:STDOUT: %Self => constants.%X.facet
  1092. // CHECK:STDOUT: %Self.as_type.loc9_23.1 => constants.%B
  1093. // CHECK:STDOUT: %ptr.loc9_23.1 => constants.%ptr.e79
  1094. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.960
  1095. // CHECK:STDOUT: }
  1096. // CHECK:STDOUT:
  1097. // CHECK:STDOUT: --- fail_inheritance_value_conversion_copy_return.carbon
  1098. // CHECK:STDOUT:
  1099. // CHECK:STDOUT: constants {
  1100. // CHECK:STDOUT: %A: type = class_type @A [concrete]
  1101. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  1102. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  1103. // CHECK:STDOUT: %B: type = class_type @B [concrete]
  1104. // CHECK:STDOUT: %B.elem: type = unbound_element_type %B, %A [concrete]
  1105. // CHECK:STDOUT: %struct_type.base.953: type = struct_type {.base: %A} [concrete]
  1106. // CHECK:STDOUT: %complete_type.020: <witness> = complete_type_witness %struct_type.base.953 [concrete]
  1107. // CHECK:STDOUT: %X.type: type = facet_type <@X> [concrete]
  1108. // CHECK:STDOUT: %Self: %X.type = bind_symbolic_name Self, 0 [symbolic]
  1109. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic]
  1110. // CHECK:STDOUT: %pattern_type.331: type = pattern_type %Self.as_type [symbolic]
  1111. // CHECK:STDOUT: %F.type.594: type = fn_type @F.1 [concrete]
  1112. // CHECK:STDOUT: %F.b69: %F.type.594 = struct_value () [concrete]
  1113. // CHECK:STDOUT: %X.assoc_type: type = assoc_entity_type @X [concrete]
  1114. // CHECK:STDOUT: %assoc0: %X.assoc_type = assoc_entity element0, @X.%F.decl [concrete]
  1115. // CHECK:STDOUT: %X.impl_witness: <witness> = impl_witness file.%X.impl_witness_table [concrete]
  1116. // CHECK:STDOUT: %pattern_type.049: type = pattern_type %B [concrete]
  1117. // CHECK:STDOUT: %F.type.b24d6f.1: type = fn_type @F.2 [concrete]
  1118. // CHECK:STDOUT: %F.77e9d5.1: %F.type.b24d6f.1 = struct_value () [concrete]
  1119. // CHECK:STDOUT: %X.facet: %X.type = facet_value %A, (%X.impl_witness) [concrete]
  1120. // CHECK:STDOUT: %pattern_type.c10: type = pattern_type %A [concrete]
  1121. // CHECK:STDOUT: %F.type.b24d6f.2: type = fn_type @F.3 [concrete]
  1122. // CHECK:STDOUT: %F.77e9d5.2: %F.type.b24d6f.2 = struct_value () [concrete]
  1123. // CHECK:STDOUT: }
  1124. // CHECK:STDOUT:
  1125. // CHECK:STDOUT: file {
  1126. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1127. // CHECK:STDOUT: .A = %A.decl
  1128. // CHECK:STDOUT: .B = %B.decl
  1129. // CHECK:STDOUT: .X = %X.decl
  1130. // CHECK:STDOUT: }
  1131. // CHECK:STDOUT: %A.decl: type = class_decl @A [concrete = constants.%A] {} {}
  1132. // CHECK:STDOUT: %B.decl: type = class_decl @B [concrete = constants.%B] {} {}
  1133. // CHECK:STDOUT: %X.decl: type = interface_decl @X [concrete = constants.%X.type] {} {}
  1134. // CHECK:STDOUT: impl_decl @impl [concrete] {} {
  1135. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A]
  1136. // CHECK:STDOUT: %X.ref: type = name_ref X, file.%X.decl [concrete = constants.%X.type]
  1137. // CHECK:STDOUT: }
  1138. // CHECK:STDOUT: %X.impl_witness_table = impl_witness_table (@impl.%F.decl.loc19_14.2), @impl [concrete]
  1139. // CHECK:STDOUT: %X.impl_witness: <witness> = impl_witness %X.impl_witness_table [concrete = constants.%X.impl_witness]
  1140. // CHECK:STDOUT: }
  1141. // CHECK:STDOUT:
  1142. // CHECK:STDOUT: interface @X {
  1143. // CHECK:STDOUT: %Self: %X.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  1144. // CHECK:STDOUT: %F.decl: %F.type.594 = fn_decl @F.1 [concrete = constants.%F.b69] {
  1145. // CHECK:STDOUT: %return.patt: @F.1.%pattern_type (%pattern_type.331) = return_slot_pattern [concrete]
  1146. // CHECK:STDOUT: %return.param_patt: @F.1.%pattern_type (%pattern_type.331) = out_param_pattern %return.patt, call_param0 [concrete]
  1147. // CHECK:STDOUT: } {
  1148. // CHECK:STDOUT: %Self.ref: %X.type = name_ref Self, @X.%Self [symbolic = %Self (constants.%Self)]
  1149. // CHECK:STDOUT: %Self.as_type.loc8_13.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc8_13.1 (constants.%Self.as_type)]
  1150. // CHECK:STDOUT: %.loc8: type = converted %Self.ref, %Self.as_type.loc8_13.2 [symbolic = %Self.as_type.loc8_13.1 (constants.%Self.as_type)]
  1151. // CHECK:STDOUT: %return.param: ref @F.1.%Self.as_type.loc8_13.1 (%Self.as_type) = out_param call_param0
  1152. // CHECK:STDOUT: %return: ref @F.1.%Self.as_type.loc8_13.1 (%Self.as_type) = return_slot %return.param
  1153. // CHECK:STDOUT: }
  1154. // CHECK:STDOUT: %assoc0: %X.assoc_type = assoc_entity element0, %F.decl [concrete = constants.%assoc0]
  1155. // CHECK:STDOUT:
  1156. // CHECK:STDOUT: !members:
  1157. // CHECK:STDOUT: .Self = %Self
  1158. // CHECK:STDOUT: .F = %assoc0
  1159. // CHECK:STDOUT: witness = (%F.decl)
  1160. // CHECK:STDOUT: }
  1161. // CHECK:STDOUT:
  1162. // CHECK:STDOUT: impl @impl: %A.ref as %X.ref {
  1163. // CHECK:STDOUT: %F.decl.loc19_14.1: %F.type.b24d6f.1 = fn_decl @F.2 [concrete = constants.%F.77e9d5.1] {
  1164. // CHECK:STDOUT: %return.patt: %pattern_type.049 = return_slot_pattern [concrete]
  1165. // CHECK:STDOUT: %return.param_patt: %pattern_type.049 = out_param_pattern %return.patt, call_param0 [concrete]
  1166. // CHECK:STDOUT: } {
  1167. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B]
  1168. // CHECK:STDOUT: %return.param: ref %B = out_param call_param0
  1169. // CHECK:STDOUT: %return: ref %B = return_slot %return.param
  1170. // CHECK:STDOUT: }
  1171. // CHECK:STDOUT: %F.decl.loc19_14.2: %F.type.b24d6f.2 = fn_decl @F.3 [concrete = constants.%F.77e9d5.2] {
  1172. // CHECK:STDOUT: %return.patt: %pattern_type.c10 = return_slot_pattern [concrete]
  1173. // CHECK:STDOUT: %return.param_patt: %pattern_type.c10 = out_param_pattern %return.patt, call_param0 [concrete]
  1174. // CHECK:STDOUT: } {
  1175. // CHECK:STDOUT: %return.param: ref %A = out_param call_param0
  1176. // CHECK:STDOUT: %return: ref %A = return_slot %return.param
  1177. // CHECK:STDOUT: }
  1178. // CHECK:STDOUT:
  1179. // CHECK:STDOUT: !members:
  1180. // CHECK:STDOUT: .B = <poisoned>
  1181. // CHECK:STDOUT: .F = %F.decl.loc19_14.1
  1182. // CHECK:STDOUT: witness = file.%X.impl_witness
  1183. // CHECK:STDOUT: }
  1184. // CHECK:STDOUT:
  1185. // CHECK:STDOUT: class @A {
  1186. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  1187. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357]
  1188. // CHECK:STDOUT: complete_type_witness = %complete_type
  1189. // CHECK:STDOUT:
  1190. // CHECK:STDOUT: !members:
  1191. // CHECK:STDOUT: .Self = constants.%A
  1192. // CHECK:STDOUT: }
  1193. // CHECK:STDOUT:
  1194. // CHECK:STDOUT: class @B {
  1195. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A]
  1196. // CHECK:STDOUT: %.loc5: %B.elem = base_decl %A.ref, element0 [concrete]
  1197. // CHECK:STDOUT: %struct_type.base: type = struct_type {.base: %A} [concrete = constants.%struct_type.base.953]
  1198. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.base [concrete = constants.%complete_type.020]
  1199. // CHECK:STDOUT: complete_type_witness = %complete_type
  1200. // CHECK:STDOUT:
  1201. // CHECK:STDOUT: !members:
  1202. // CHECK:STDOUT: .Self = constants.%B
  1203. // CHECK:STDOUT: .A = <poisoned>
  1204. // CHECK:STDOUT: .base = %.loc5
  1205. // CHECK:STDOUT: extend %A.ref
  1206. // CHECK:STDOUT: }
  1207. // CHECK:STDOUT:
  1208. // CHECK:STDOUT: generic fn @F.1(@X.%Self: %X.type) {
  1209. // CHECK:STDOUT: %Self: %X.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)]
  1210. // CHECK:STDOUT: %Self.as_type.loc8_13.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc8_13.1 (constants.%Self.as_type)]
  1211. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc8_13.1 [symbolic = %pattern_type (constants.%pattern_type.331)]
  1212. // CHECK:STDOUT:
  1213. // CHECK:STDOUT: fn() -> @F.1.%Self.as_type.loc8_13.1 (%Self.as_type);
  1214. // CHECK:STDOUT: }
  1215. // CHECK:STDOUT:
  1216. // CHECK:STDOUT: fn @F.2() -> %return.param: %B;
  1217. // CHECK:STDOUT:
  1218. // CHECK:STDOUT: fn @F.3() -> %return.param: %A {
  1219. // CHECK:STDOUT: !entry:
  1220. // CHECK:STDOUT: %.loc19_14.1: ref %B = temporary_storage
  1221. // CHECK:STDOUT: %F.call: init %B = call @impl.%F.decl.loc19_14.1() to %.loc19_14.1
  1222. // CHECK:STDOUT: %.loc19_14.2: ref %B = temporary %.loc19_14.1, %F.call
  1223. // CHECK:STDOUT: %.loc19_14.3: ref %A = class_element_access %.loc19_14.2, element0
  1224. // CHECK:STDOUT: %.loc19_14.4: ref %A = converted %F.call, %.loc19_14.3
  1225. // CHECK:STDOUT: %.loc19_14.5: %A = bind_value %.loc19_14.4
  1226. // CHECK:STDOUT: return <error> to %return
  1227. // CHECK:STDOUT: }
  1228. // CHECK:STDOUT:
  1229. // CHECK:STDOUT: specific @F.1(constants.%Self) {
  1230. // CHECK:STDOUT: %Self => constants.%Self
  1231. // CHECK:STDOUT: %Self.as_type.loc8_13.1 => constants.%Self.as_type
  1232. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.331
  1233. // CHECK:STDOUT: }
  1234. // CHECK:STDOUT:
  1235. // CHECK:STDOUT: specific @F.1(constants.%X.facet) {
  1236. // CHECK:STDOUT: %Self => constants.%X.facet
  1237. // CHECK:STDOUT: %Self.as_type.loc8_13.1 => constants.%A
  1238. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.c10
  1239. // CHECK:STDOUT: }
  1240. // CHECK:STDOUT:
  1241. // CHECK:STDOUT: --- fail_param_type_mismatch.carbon
  1242. // CHECK:STDOUT:
  1243. // CHECK:STDOUT: constants {
  1244. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  1245. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  1246. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic]
  1247. // CHECK:STDOUT: %pattern_type.6de: type = pattern_type %Self.as_type [symbolic]
  1248. // CHECK:STDOUT: %F.type.cf0: type = fn_type @F.1 [concrete]
  1249. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  1250. // CHECK:STDOUT: %F.bc6: %F.type.cf0 = struct_value () [concrete]
  1251. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  1252. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%F.decl [concrete]
  1253. // CHECK:STDOUT: %A: type = class_type @A [concrete]
  1254. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  1255. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  1256. // CHECK:STDOUT: %B: type = class_type @B [concrete]
  1257. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness file.%I.impl_witness_table [concrete]
  1258. // CHECK:STDOUT: %pattern_type.049: type = pattern_type %B [concrete]
  1259. // CHECK:STDOUT: %F.type.2ae1ef.1: type = fn_type @F.2 [concrete]
  1260. // CHECK:STDOUT: %F.2a7aab.1: %F.type.2ae1ef.1 = struct_value () [concrete]
  1261. // CHECK:STDOUT: %I.facet: %I.type = facet_value %A, (%I.impl_witness) [concrete]
  1262. // CHECK:STDOUT: %pattern_type.c10: type = pattern_type %A [concrete]
  1263. // CHECK:STDOUT: %F.type.2ae1ef.2: type = fn_type @F.3 [concrete]
  1264. // CHECK:STDOUT: %F.2a7aab.2: %F.type.2ae1ef.2 = struct_value () [concrete]
  1265. // CHECK:STDOUT: }
  1266. // CHECK:STDOUT:
  1267. // CHECK:STDOUT: file {
  1268. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1269. // CHECK:STDOUT: .I = %I.decl
  1270. // CHECK:STDOUT: .A = %A.decl
  1271. // CHECK:STDOUT: .B = %B.decl
  1272. // CHECK:STDOUT: }
  1273. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  1274. // CHECK:STDOUT: %A.decl: type = class_decl @A [concrete = constants.%A] {} {}
  1275. // CHECK:STDOUT: %B.decl: type = class_decl @B [concrete = constants.%B] {} {}
  1276. // CHECK:STDOUT: impl_decl @impl [concrete] {} {
  1277. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A]
  1278. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  1279. // CHECK:STDOUT: }
  1280. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (@impl.%F.decl.loc22_13.2), @impl [concrete]
  1281. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness]
  1282. // CHECK:STDOUT: }
  1283. // CHECK:STDOUT:
  1284. // CHECK:STDOUT: interface @I {
  1285. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  1286. // CHECK:STDOUT: %F.decl: %F.type.cf0 = fn_decl @F.1 [concrete = constants.%F.bc6] {
  1287. // CHECK:STDOUT: %a.patt: @F.1.%pattern_type (%pattern_type.6de) = binding_pattern a [concrete]
  1288. // CHECK:STDOUT: %a.param_patt: @F.1.%pattern_type (%pattern_type.6de) = value_param_pattern %a.patt, call_param0 [concrete]
  1289. // CHECK:STDOUT: } {
  1290. // CHECK:STDOUT: %a.param: @F.1.%Self.as_type.loc8_11.1 (%Self.as_type) = value_param call_param0
  1291. // CHECK:STDOUT: %.loc8_11.1: type = splice_block %.loc8_11.2 [symbolic = %Self.as_type.loc8_11.1 (constants.%Self.as_type)] {
  1292. // CHECK:STDOUT: %Self.ref: %I.type = name_ref Self, @I.%Self [symbolic = %Self (constants.%Self)]
  1293. // CHECK:STDOUT: %Self.as_type.loc8_11.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc8_11.1 (constants.%Self.as_type)]
  1294. // CHECK:STDOUT: %.loc8_11.2: type = converted %Self.ref, %Self.as_type.loc8_11.2 [symbolic = %Self.as_type.loc8_11.1 (constants.%Self.as_type)]
  1295. // CHECK:STDOUT: }
  1296. // CHECK:STDOUT: %a: @F.1.%Self.as_type.loc8_11.1 (%Self.as_type) = bind_name a, %a.param
  1297. // CHECK:STDOUT: }
  1298. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %F.decl [concrete = constants.%assoc0]
  1299. // CHECK:STDOUT:
  1300. // CHECK:STDOUT: !members:
  1301. // CHECK:STDOUT: .Self = %Self
  1302. // CHECK:STDOUT: .F = %assoc0
  1303. // CHECK:STDOUT: witness = (%F.decl)
  1304. // CHECK:STDOUT: }
  1305. // CHECK:STDOUT:
  1306. // CHECK:STDOUT: impl @impl: %A.ref as %I.ref {
  1307. // CHECK:STDOUT: %F.decl.loc22_13.1: %F.type.2ae1ef.1 = fn_decl @F.2 [concrete = constants.%F.2a7aab.1] {
  1308. // CHECK:STDOUT: %a.patt: %pattern_type.049 = binding_pattern a [concrete]
  1309. // CHECK:STDOUT: %a.param_patt: %pattern_type.049 = value_param_pattern %a.patt, call_param0 [concrete]
  1310. // CHECK:STDOUT: } {
  1311. // CHECK:STDOUT: %a.param: %B = value_param call_param0
  1312. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B]
  1313. // CHECK:STDOUT: %a: %B = bind_name a, %a.param
  1314. // CHECK:STDOUT: }
  1315. // CHECK:STDOUT: %F.decl.loc22_13.2: %F.type.2ae1ef.2 = fn_decl @F.3 [concrete = constants.%F.2a7aab.2] {
  1316. // CHECK:STDOUT: %a.patt: %pattern_type.c10 = binding_pattern a [concrete]
  1317. // CHECK:STDOUT: %a.param_patt: %pattern_type.c10 = value_param_pattern %a.patt, call_param0 [concrete]
  1318. // CHECK:STDOUT: } {
  1319. // CHECK:STDOUT: %a.param: %A = value_param call_param0
  1320. // CHECK:STDOUT: %a: %A = bind_name a, %a.param
  1321. // CHECK:STDOUT: }
  1322. // CHECK:STDOUT:
  1323. // CHECK:STDOUT: !members:
  1324. // CHECK:STDOUT: .B = <poisoned>
  1325. // CHECK:STDOUT: .F = %F.decl.loc22_13.1
  1326. // CHECK:STDOUT: witness = file.%I.impl_witness
  1327. // CHECK:STDOUT: }
  1328. // CHECK:STDOUT:
  1329. // CHECK:STDOUT: class @A {
  1330. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  1331. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  1332. // CHECK:STDOUT: complete_type_witness = %complete_type
  1333. // CHECK:STDOUT:
  1334. // CHECK:STDOUT: !members:
  1335. // CHECK:STDOUT: .Self = constants.%A
  1336. // CHECK:STDOUT: }
  1337. // CHECK:STDOUT:
  1338. // CHECK:STDOUT: class @B {
  1339. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  1340. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  1341. // CHECK:STDOUT: complete_type_witness = %complete_type
  1342. // CHECK:STDOUT:
  1343. // CHECK:STDOUT: !members:
  1344. // CHECK:STDOUT: .Self = constants.%B
  1345. // CHECK:STDOUT: }
  1346. // CHECK:STDOUT:
  1347. // CHECK:STDOUT: generic fn @F.1(@I.%Self: %I.type) {
  1348. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)]
  1349. // CHECK:STDOUT: %Self.as_type.loc8_11.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc8_11.1 (constants.%Self.as_type)]
  1350. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc8_11.1 [symbolic = %pattern_type (constants.%pattern_type.6de)]
  1351. // CHECK:STDOUT:
  1352. // CHECK:STDOUT: fn(%a.param: @F.1.%Self.as_type.loc8_11.1 (%Self.as_type));
  1353. // CHECK:STDOUT: }
  1354. // CHECK:STDOUT:
  1355. // CHECK:STDOUT: fn @F.2(%a.param: %B);
  1356. // CHECK:STDOUT:
  1357. // CHECK:STDOUT: fn @F.3(%a.param: %A) {
  1358. // CHECK:STDOUT: !entry:
  1359. // CHECK:STDOUT: %a.ref: %A = name_ref a, %a.param
  1360. // CHECK:STDOUT: %.loc8: %B = converted %a.ref, <error> [concrete = <error>]
  1361. // CHECK:STDOUT: %F.call: init %empty_tuple.type = call @impl.%F.decl.loc22_13.1(<error>)
  1362. // CHECK:STDOUT: return
  1363. // CHECK:STDOUT: }
  1364. // CHECK:STDOUT:
  1365. // CHECK:STDOUT: specific @F.1(constants.%Self) {
  1366. // CHECK:STDOUT: %Self => constants.%Self
  1367. // CHECK:STDOUT: %Self.as_type.loc8_11.1 => constants.%Self.as_type
  1368. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.6de
  1369. // CHECK:STDOUT: }
  1370. // CHECK:STDOUT:
  1371. // CHECK:STDOUT: specific @F.1(constants.%I.facet) {
  1372. // CHECK:STDOUT: %Self => constants.%I.facet
  1373. // CHECK:STDOUT: %Self.as_type.loc8_11.1 => constants.%A
  1374. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.c10
  1375. // CHECK:STDOUT: }
  1376. // CHECK:STDOUT:
  1377. // CHECK:STDOUT: --- fail_return_mismatch.carbon
  1378. // CHECK:STDOUT:
  1379. // CHECK:STDOUT: constants {
  1380. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  1381. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  1382. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic]
  1383. // CHECK:STDOUT: %pattern_type.6de: type = pattern_type %Self.as_type [symbolic]
  1384. // CHECK:STDOUT: %F.type.cf0: type = fn_type @F.1 [concrete]
  1385. // CHECK:STDOUT: %F.bc6: %F.type.cf0 = struct_value () [concrete]
  1386. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  1387. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%F.decl [concrete]
  1388. // CHECK:STDOUT: %A: type = class_type @A [concrete]
  1389. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  1390. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  1391. // CHECK:STDOUT: %B: type = class_type @B [concrete]
  1392. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness file.%I.impl_witness_table [concrete]
  1393. // CHECK:STDOUT: %pattern_type.049: type = pattern_type %B [concrete]
  1394. // CHECK:STDOUT: %F.type.2ae1ef.1: type = fn_type @F.2 [concrete]
  1395. // CHECK:STDOUT: %F.2a7aab.1: %F.type.2ae1ef.1 = struct_value () [concrete]
  1396. // CHECK:STDOUT: %I.facet: %I.type = facet_value %A, (%I.impl_witness) [concrete]
  1397. // CHECK:STDOUT: %pattern_type.c10: type = pattern_type %A [concrete]
  1398. // CHECK:STDOUT: %F.type.2ae1ef.2: type = fn_type @F.3 [concrete]
  1399. // CHECK:STDOUT: %F.2a7aab.2: %F.type.2ae1ef.2 = struct_value () [concrete]
  1400. // CHECK:STDOUT: }
  1401. // CHECK:STDOUT:
  1402. // CHECK:STDOUT: file {
  1403. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1404. // CHECK:STDOUT: .I = %I.decl
  1405. // CHECK:STDOUT: .A = %A.decl
  1406. // CHECK:STDOUT: .B = %B.decl
  1407. // CHECK:STDOUT: }
  1408. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  1409. // CHECK:STDOUT: %A.decl: type = class_decl @A [concrete = constants.%A] {} {}
  1410. // CHECK:STDOUT: %B.decl: type = class_decl @B [concrete = constants.%B] {} {}
  1411. // CHECK:STDOUT: impl_decl @impl [concrete] {} {
  1412. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A]
  1413. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  1414. // CHECK:STDOUT: }
  1415. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (@impl.%F.decl.loc19_14.2), @impl [concrete]
  1416. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness]
  1417. // CHECK:STDOUT: }
  1418. // CHECK:STDOUT:
  1419. // CHECK:STDOUT: interface @I {
  1420. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  1421. // CHECK:STDOUT: %F.decl: %F.type.cf0 = fn_decl @F.1 [concrete = constants.%F.bc6] {
  1422. // CHECK:STDOUT: %return.patt: @F.1.%pattern_type (%pattern_type.6de) = return_slot_pattern [concrete]
  1423. // CHECK:STDOUT: %return.param_patt: @F.1.%pattern_type (%pattern_type.6de) = out_param_pattern %return.patt, call_param0 [concrete]
  1424. // CHECK:STDOUT: } {
  1425. // CHECK:STDOUT: %Self.ref: %I.type = name_ref Self, @I.%Self [symbolic = %Self (constants.%Self)]
  1426. // CHECK:STDOUT: %Self.as_type.loc5_13.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc5_13.1 (constants.%Self.as_type)]
  1427. // CHECK:STDOUT: %.loc5: type = converted %Self.ref, %Self.as_type.loc5_13.2 [symbolic = %Self.as_type.loc5_13.1 (constants.%Self.as_type)]
  1428. // CHECK:STDOUT: %return.param: ref @F.1.%Self.as_type.loc5_13.1 (%Self.as_type) = out_param call_param0
  1429. // CHECK:STDOUT: %return: ref @F.1.%Self.as_type.loc5_13.1 (%Self.as_type) = return_slot %return.param
  1430. // CHECK:STDOUT: }
  1431. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %F.decl [concrete = constants.%assoc0]
  1432. // CHECK:STDOUT:
  1433. // CHECK:STDOUT: !members:
  1434. // CHECK:STDOUT: .Self = %Self
  1435. // CHECK:STDOUT: .F = %assoc0
  1436. // CHECK:STDOUT: witness = (%F.decl)
  1437. // CHECK:STDOUT: }
  1438. // CHECK:STDOUT:
  1439. // CHECK:STDOUT: impl @impl: %A.ref as %I.ref {
  1440. // CHECK:STDOUT: %F.decl.loc19_14.1: %F.type.2ae1ef.1 = fn_decl @F.2 [concrete = constants.%F.2a7aab.1] {
  1441. // CHECK:STDOUT: %return.patt: %pattern_type.049 = return_slot_pattern [concrete]
  1442. // CHECK:STDOUT: %return.param_patt: %pattern_type.049 = out_param_pattern %return.patt, call_param0 [concrete]
  1443. // CHECK:STDOUT: } {
  1444. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B]
  1445. // CHECK:STDOUT: %return.param: ref %B = out_param call_param0
  1446. // CHECK:STDOUT: %return: ref %B = return_slot %return.param
  1447. // CHECK:STDOUT: }
  1448. // CHECK:STDOUT: %F.decl.loc19_14.2: %F.type.2ae1ef.2 = fn_decl @F.3 [concrete = constants.%F.2a7aab.2] {
  1449. // CHECK:STDOUT: %return.patt: %pattern_type.c10 = return_slot_pattern [concrete]
  1450. // CHECK:STDOUT: %return.param_patt: %pattern_type.c10 = out_param_pattern %return.patt, call_param0 [concrete]
  1451. // CHECK:STDOUT: } {
  1452. // CHECK:STDOUT: %return.param: ref %A = out_param call_param0
  1453. // CHECK:STDOUT: %return: ref %A = return_slot %return.param
  1454. // CHECK:STDOUT: }
  1455. // CHECK:STDOUT:
  1456. // CHECK:STDOUT: !members:
  1457. // CHECK:STDOUT: .B = <poisoned>
  1458. // CHECK:STDOUT: .F = %F.decl.loc19_14.1
  1459. // CHECK:STDOUT: witness = file.%I.impl_witness
  1460. // CHECK:STDOUT: }
  1461. // CHECK:STDOUT:
  1462. // CHECK:STDOUT: class @A {
  1463. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  1464. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  1465. // CHECK:STDOUT: complete_type_witness = %complete_type
  1466. // CHECK:STDOUT:
  1467. // CHECK:STDOUT: !members:
  1468. // CHECK:STDOUT: .Self = constants.%A
  1469. // CHECK:STDOUT: }
  1470. // CHECK:STDOUT:
  1471. // CHECK:STDOUT: class @B {
  1472. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  1473. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  1474. // CHECK:STDOUT: complete_type_witness = %complete_type
  1475. // CHECK:STDOUT:
  1476. // CHECK:STDOUT: !members:
  1477. // CHECK:STDOUT: .Self = constants.%B
  1478. // CHECK:STDOUT: }
  1479. // CHECK:STDOUT:
  1480. // CHECK:STDOUT: generic fn @F.1(@I.%Self: %I.type) {
  1481. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)]
  1482. // CHECK:STDOUT: %Self.as_type.loc5_13.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_13.1 (constants.%Self.as_type)]
  1483. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc5_13.1 [symbolic = %pattern_type (constants.%pattern_type.6de)]
  1484. // CHECK:STDOUT:
  1485. // CHECK:STDOUT: fn() -> @F.1.%Self.as_type.loc5_13.1 (%Self.as_type);
  1486. // CHECK:STDOUT: }
  1487. // CHECK:STDOUT:
  1488. // CHECK:STDOUT: fn @F.2() -> %return.param: %B;
  1489. // CHECK:STDOUT:
  1490. // CHECK:STDOUT: fn @F.3() -> %return.param: %A {
  1491. // CHECK:STDOUT: !entry:
  1492. // CHECK:STDOUT: %.loc19_14.1: ref %B = temporary_storage
  1493. // CHECK:STDOUT: %F.call: init %B = call @impl.%F.decl.loc19_14.1() to %.loc19_14.1
  1494. // CHECK:STDOUT: %.loc19_14.2: %A = converted %F.call, <error> [concrete = <error>]
  1495. // CHECK:STDOUT: return <error> to %return
  1496. // CHECK:STDOUT: }
  1497. // CHECK:STDOUT:
  1498. // CHECK:STDOUT: specific @F.1(constants.%Self) {
  1499. // CHECK:STDOUT: %Self => constants.%Self
  1500. // CHECK:STDOUT: %Self.as_type.loc5_13.1 => constants.%Self.as_type
  1501. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.6de
  1502. // CHECK:STDOUT: }
  1503. // CHECK:STDOUT:
  1504. // CHECK:STDOUT: specific @F.1(constants.%I.facet) {
  1505. // CHECK:STDOUT: %Self => constants.%I.facet
  1506. // CHECK:STDOUT: %Self.as_type.loc5_13.1 => constants.%A
  1507. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.c10
  1508. // CHECK:STDOUT: }
  1509. // CHECK:STDOUT:
  1510. // CHECK:STDOUT: --- return_empty_tuple_mismatch_allowed.carbon
  1511. // CHECK:STDOUT:
  1512. // CHECK:STDOUT: constants {
  1513. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  1514. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  1515. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic]
  1516. // CHECK:STDOUT: %pattern_type.6de: type = pattern_type %Self.as_type [symbolic]
  1517. // CHECK:STDOUT: %HasReturn.type.bf9: type = fn_type @HasReturn.1 [concrete]
  1518. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  1519. // CHECK:STDOUT: %HasReturn.dcf: %HasReturn.type.bf9 = struct_value () [concrete]
  1520. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  1521. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%HasReturn.decl [concrete]
  1522. // CHECK:STDOUT: %NoReturn.type.7ff: type = fn_type @NoReturn.1 [concrete]
  1523. // CHECK:STDOUT: %NoReturn.7fd: %NoReturn.type.7ff = struct_value () [concrete]
  1524. // CHECK:STDOUT: %assoc1: %I.assoc_type = assoc_entity element1, @I.%NoReturn.decl [concrete]
  1525. // CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete]
  1526. // CHECK:STDOUT: %EmptyTupleReturn.type.1cb: type = fn_type @EmptyTupleReturn.1 [concrete]
  1527. // CHECK:STDOUT: %EmptyTupleReturn.c56: %EmptyTupleReturn.type.1cb = struct_value () [concrete]
  1528. // CHECK:STDOUT: %assoc2: %I.assoc_type = assoc_entity element2, @I.%EmptyTupleReturn.decl [concrete]
  1529. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness file.%I.impl_witness_table [concrete]
  1530. // CHECK:STDOUT: %HasReturn.type.c73908.1: type = fn_type @HasReturn.2 [concrete]
  1531. // CHECK:STDOUT: %HasReturn.424378.1: %HasReturn.type.c73908.1 = struct_value () [concrete]
  1532. // CHECK:STDOUT: %NoReturn.type.948: type = fn_type @NoReturn.2 [concrete]
  1533. // CHECK:STDOUT: %NoReturn.9fa: %NoReturn.type.948 = struct_value () [concrete]
  1534. // CHECK:STDOUT: %EmptyTupleReturn.type.9ea74f.1: type = fn_type @EmptyTupleReturn.2 [concrete]
  1535. // CHECK:STDOUT: %EmptyTupleReturn.282179.1: %EmptyTupleReturn.type.9ea74f.1 = struct_value () [concrete]
  1536. // CHECK:STDOUT: %I.facet: %I.type = facet_value %empty_tuple.type, (%I.impl_witness) [concrete]
  1537. // CHECK:STDOUT: %HasReturn.type.c73908.2: type = fn_type @HasReturn.3 [concrete]
  1538. // CHECK:STDOUT: %HasReturn.424378.2: %HasReturn.type.c73908.2 = struct_value () [concrete]
  1539. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  1540. // CHECK:STDOUT: %EmptyTupleReturn.type.9ea74f.2: type = fn_type @EmptyTupleReturn.3 [concrete]
  1541. // CHECK:STDOUT: %EmptyTupleReturn.282179.2: %EmptyTupleReturn.type.9ea74f.2 = struct_value () [concrete]
  1542. // CHECK:STDOUT: }
  1543. // CHECK:STDOUT:
  1544. // CHECK:STDOUT: file {
  1545. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1546. // CHECK:STDOUT: .I = %I.decl
  1547. // CHECK:STDOUT: }
  1548. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  1549. // CHECK:STDOUT: impl_decl @impl [concrete] {} {
  1550. // CHECK:STDOUT: %.loc10_7.1: %empty_tuple.type = tuple_literal ()
  1551. // CHECK:STDOUT: %.loc10_7.2: type = converted %.loc10_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  1552. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  1553. // CHECK:STDOUT: }
  1554. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (@impl.%HasReturn.decl.loc12_17.2, @impl.%NoReturn.decl, @impl.%EmptyTupleReturn.decl.loc18_24.2), @impl [concrete]
  1555. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness]
  1556. // CHECK:STDOUT: }
  1557. // CHECK:STDOUT:
  1558. // CHECK:STDOUT: interface @I {
  1559. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  1560. // CHECK:STDOUT: %HasReturn.decl: %HasReturn.type.bf9 = fn_decl @HasReturn.1 [concrete = constants.%HasReturn.dcf] {
  1561. // CHECK:STDOUT: %return.patt: @HasReturn.1.%pattern_type (%pattern_type.6de) = return_slot_pattern [concrete]
  1562. // CHECK:STDOUT: %return.param_patt: @HasReturn.1.%pattern_type (%pattern_type.6de) = out_param_pattern %return.patt, call_param0 [concrete]
  1563. // CHECK:STDOUT: } {
  1564. // CHECK:STDOUT: %Self.ref: %I.type = name_ref Self, @I.%Self [symbolic = %Self (constants.%Self)]
  1565. // CHECK:STDOUT: %Self.as_type.loc5_21.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc5_21.1 (constants.%Self.as_type)]
  1566. // CHECK:STDOUT: %.loc5: type = converted %Self.ref, %Self.as_type.loc5_21.2 [symbolic = %Self.as_type.loc5_21.1 (constants.%Self.as_type)]
  1567. // CHECK:STDOUT: %return.param: ref @HasReturn.1.%Self.as_type.loc5_21.1 (%Self.as_type) = out_param call_param0
  1568. // CHECK:STDOUT: %return: ref @HasReturn.1.%Self.as_type.loc5_21.1 (%Self.as_type) = return_slot %return.param
  1569. // CHECK:STDOUT: }
  1570. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %HasReturn.decl [concrete = constants.%assoc0]
  1571. // CHECK:STDOUT: %NoReturn.decl: %NoReturn.type.7ff = fn_decl @NoReturn.1 [concrete = constants.%NoReturn.7fd] {} {}
  1572. // CHECK:STDOUT: %assoc1: %I.assoc_type = assoc_entity element1, %NoReturn.decl [concrete = constants.%assoc1]
  1573. // CHECK:STDOUT: %EmptyTupleReturn.decl: %EmptyTupleReturn.type.1cb = fn_decl @EmptyTupleReturn.1 [concrete = constants.%EmptyTupleReturn.c56] {
  1574. // CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern [concrete]
  1575. // CHECK:STDOUT: %return.param_patt: %pattern_type.cb1 = out_param_pattern %return.patt, call_param0 [concrete]
  1576. // CHECK:STDOUT: } {
  1577. // CHECK:STDOUT: %.loc7_29.1: %empty_tuple.type = tuple_literal ()
  1578. // CHECK:STDOUT: %.loc7_29.2: type = converted %.loc7_29.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  1579. // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0
  1580. // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param
  1581. // CHECK:STDOUT: }
  1582. // CHECK:STDOUT: %assoc2: %I.assoc_type = assoc_entity element2, %EmptyTupleReturn.decl [concrete = constants.%assoc2]
  1583. // CHECK:STDOUT:
  1584. // CHECK:STDOUT: !members:
  1585. // CHECK:STDOUT: .Self = %Self
  1586. // CHECK:STDOUT: .HasReturn = %assoc0
  1587. // CHECK:STDOUT: .NoReturn = %assoc1
  1588. // CHECK:STDOUT: .EmptyTupleReturn = %assoc2
  1589. // CHECK:STDOUT: witness = (%HasReturn.decl, %NoReturn.decl, %EmptyTupleReturn.decl)
  1590. // CHECK:STDOUT: }
  1591. // CHECK:STDOUT:
  1592. // CHECK:STDOUT: impl @impl: %.loc10_7.2 as %I.ref {
  1593. // CHECK:STDOUT: %HasReturn.decl.loc12_17.1: %HasReturn.type.c73908.1 = fn_decl @HasReturn.2 [concrete = constants.%HasReturn.424378.1] {} {}
  1594. // CHECK:STDOUT: %NoReturn.decl: %NoReturn.type.948 = fn_decl @NoReturn.2 [concrete = constants.%NoReturn.9fa] {} {}
  1595. // CHECK:STDOUT: %EmptyTupleReturn.decl.loc18_24.1: %EmptyTupleReturn.type.9ea74f.1 = fn_decl @EmptyTupleReturn.2 [concrete = constants.%EmptyTupleReturn.282179.1] {} {}
  1596. // CHECK:STDOUT: %HasReturn.decl.loc12_17.2: %HasReturn.type.c73908.2 = fn_decl @HasReturn.3 [concrete = constants.%HasReturn.424378.2] {
  1597. // CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern [concrete]
  1598. // CHECK:STDOUT: %return.param_patt: %pattern_type.cb1 = out_param_pattern %return.patt, call_param0 [concrete]
  1599. // CHECK:STDOUT: } {
  1600. // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0
  1601. // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param
  1602. // CHECK:STDOUT: }
  1603. // CHECK:STDOUT: %EmptyTupleReturn.decl.loc18_24.2: %EmptyTupleReturn.type.9ea74f.2 = fn_decl @EmptyTupleReturn.3 [concrete = constants.%EmptyTupleReturn.282179.2] {
  1604. // CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern [concrete]
  1605. // CHECK:STDOUT: %return.param_patt: %pattern_type.cb1 = out_param_pattern %return.patt, call_param0 [concrete]
  1606. // CHECK:STDOUT: } {
  1607. // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0
  1608. // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param
  1609. // CHECK:STDOUT: }
  1610. // CHECK:STDOUT:
  1611. // CHECK:STDOUT: !members:
  1612. // CHECK:STDOUT: .HasReturn = %HasReturn.decl.loc12_17.1
  1613. // CHECK:STDOUT: .NoReturn = %NoReturn.decl
  1614. // CHECK:STDOUT: .EmptyTupleReturn = %EmptyTupleReturn.decl.loc18_24.1
  1615. // CHECK:STDOUT: witness = file.%I.impl_witness
  1616. // CHECK:STDOUT: }
  1617. // CHECK:STDOUT:
  1618. // CHECK:STDOUT: generic fn @HasReturn.1(@I.%Self: %I.type) {
  1619. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)]
  1620. // CHECK:STDOUT: %Self.as_type.loc5_21.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_21.1 (constants.%Self.as_type)]
  1621. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc5_21.1 [symbolic = %pattern_type (constants.%pattern_type.6de)]
  1622. // CHECK:STDOUT:
  1623. // CHECK:STDOUT: fn() -> @HasReturn.1.%Self.as_type.loc5_21.1 (%Self.as_type);
  1624. // CHECK:STDOUT: }
  1625. // CHECK:STDOUT:
  1626. // CHECK:STDOUT: generic fn @NoReturn.1(@I.%Self: %I.type) {
  1627. // CHECK:STDOUT: fn();
  1628. // CHECK:STDOUT: }
  1629. // CHECK:STDOUT:
  1630. // CHECK:STDOUT: generic fn @EmptyTupleReturn.1(@I.%Self: %I.type) {
  1631. // CHECK:STDOUT: fn() -> %empty_tuple.type;
  1632. // CHECK:STDOUT: }
  1633. // CHECK:STDOUT:
  1634. // CHECK:STDOUT: fn @HasReturn.2();
  1635. // CHECK:STDOUT:
  1636. // CHECK:STDOUT: fn @NoReturn.2();
  1637. // CHECK:STDOUT:
  1638. // CHECK:STDOUT: fn @EmptyTupleReturn.2();
  1639. // CHECK:STDOUT:
  1640. // CHECK:STDOUT: fn @HasReturn.3() -> %empty_tuple.type {
  1641. // CHECK:STDOUT: !entry:
  1642. // CHECK:STDOUT: %HasReturn.call: init %empty_tuple.type = call @impl.%HasReturn.decl.loc12_17.1()
  1643. // CHECK:STDOUT: %.loc12_17.1: ref %empty_tuple.type = temporary_storage
  1644. // CHECK:STDOUT: %.loc12_17.2: ref %empty_tuple.type = temporary %.loc12_17.1, %HasReturn.call
  1645. // CHECK:STDOUT: %tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple]
  1646. // CHECK:STDOUT: %.loc12_17.3: %empty_tuple.type = converted %HasReturn.call, %tuple [concrete = constants.%empty_tuple]
  1647. // CHECK:STDOUT: return %.loc12_17.3
  1648. // CHECK:STDOUT: }
  1649. // CHECK:STDOUT:
  1650. // CHECK:STDOUT: fn @EmptyTupleReturn.3() -> %empty_tuple.type {
  1651. // CHECK:STDOUT: !entry:
  1652. // CHECK:STDOUT: %EmptyTupleReturn.call: init %empty_tuple.type = call @impl.%EmptyTupleReturn.decl.loc18_24.1()
  1653. // CHECK:STDOUT: %.loc18_24.1: ref %empty_tuple.type = temporary_storage
  1654. // CHECK:STDOUT: %.loc18_24.2: ref %empty_tuple.type = temporary %.loc18_24.1, %EmptyTupleReturn.call
  1655. // CHECK:STDOUT: %tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple]
  1656. // CHECK:STDOUT: %.loc18_24.3: %empty_tuple.type = converted %EmptyTupleReturn.call, %tuple [concrete = constants.%empty_tuple]
  1657. // CHECK:STDOUT: return %.loc18_24.3
  1658. // CHECK:STDOUT: }
  1659. // CHECK:STDOUT:
  1660. // CHECK:STDOUT: specific @HasReturn.1(constants.%Self) {
  1661. // CHECK:STDOUT: %Self => constants.%Self
  1662. // CHECK:STDOUT: %Self.as_type.loc5_21.1 => constants.%Self.as_type
  1663. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.6de
  1664. // CHECK:STDOUT: }
  1665. // CHECK:STDOUT:
  1666. // CHECK:STDOUT: specific @NoReturn.1(constants.%Self) {}
  1667. // CHECK:STDOUT:
  1668. // CHECK:STDOUT: specific @EmptyTupleReturn.1(constants.%Self) {}
  1669. // CHECK:STDOUT:
  1670. // CHECK:STDOUT: specific @HasReturn.1(constants.%I.facet) {
  1671. // CHECK:STDOUT: %Self => constants.%I.facet
  1672. // CHECK:STDOUT: %Self.as_type.loc5_21.1 => constants.%empty_tuple.type
  1673. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.cb1
  1674. // CHECK:STDOUT: }
  1675. // CHECK:STDOUT:
  1676. // CHECK:STDOUT: specific @NoReturn.1(constants.%I.facet) {}
  1677. // CHECK:STDOUT:
  1678. // CHECK:STDOUT: specific @EmptyTupleReturn.1(constants.%I.facet) {}
  1679. // CHECK:STDOUT:
  1680. // CHECK:STDOUT: --- fail_return_empty_tuple_mismatch.carbon
  1681. // CHECK:STDOUT:
  1682. // CHECK:STDOUT: constants {
  1683. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  1684. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  1685. // CHECK:STDOUT: %NoReturn.type.7ff: type = fn_type @NoReturn.1 [concrete]
  1686. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  1687. // CHECK:STDOUT: %NoReturn.7fd: %NoReturn.type.7ff = struct_value () [concrete]
  1688. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  1689. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%NoReturn.decl [concrete]
  1690. // CHECK:STDOUT: %I.impl_witness.c4e: <witness> = impl_witness file.%I.impl_witness_table.loc8 [concrete]
  1691. // CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete]
  1692. // CHECK:STDOUT: %NoReturn.type.948: type = fn_type @NoReturn.2 [concrete]
  1693. // CHECK:STDOUT: %NoReturn.9fa: %NoReturn.type.948 = struct_value () [concrete]
  1694. // CHECK:STDOUT: %I.facet.372: %I.type = facet_value %empty_tuple.type, (%I.impl_witness.c4e) [concrete]
  1695. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  1696. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  1697. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  1698. // CHECK:STDOUT: %I.impl_witness.464: <witness> = impl_witness file.%I.impl_witness_table.loc22 [concrete]
  1699. // CHECK:STDOUT: %pattern_type.c48: type = pattern_type %C [concrete]
  1700. // CHECK:STDOUT: %NoReturn.type.930: type = fn_type @NoReturn.3 [concrete]
  1701. // CHECK:STDOUT: %NoReturn.ac0: %NoReturn.type.930 = struct_value () [concrete]
  1702. // CHECK:STDOUT: %I.facet.be9: %I.type = facet_value %C, (%I.impl_witness.464) [concrete]
  1703. // CHECK:STDOUT: }
  1704. // CHECK:STDOUT:
  1705. // CHECK:STDOUT: file {
  1706. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1707. // CHECK:STDOUT: .I = %I.decl
  1708. // CHECK:STDOUT: .C = %C.decl
  1709. // CHECK:STDOUT: }
  1710. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  1711. // CHECK:STDOUT: impl_decl @impl.4ab [concrete] {} {
  1712. // CHECK:STDOUT: %.loc8_7.1: %empty_tuple.type = tuple_literal ()
  1713. // CHECK:STDOUT: %.loc8_7.2: type = converted %.loc8_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  1714. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  1715. // CHECK:STDOUT: }
  1716. // CHECK:STDOUT: %I.impl_witness_table.loc8 = impl_witness_table (<error>), @impl.4ab [concrete]
  1717. // CHECK:STDOUT: %I.impl_witness.loc8: <witness> = impl_witness %I.impl_witness_table.loc8 [concrete = constants.%I.impl_witness.c4e]
  1718. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  1719. // CHECK:STDOUT: impl_decl @impl.770 [concrete] {} {
  1720. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  1721. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  1722. // CHECK:STDOUT: }
  1723. // CHECK:STDOUT: %I.impl_witness_table.loc22 = impl_witness_table (<error>), @impl.770 [concrete]
  1724. // CHECK:STDOUT: %I.impl_witness.loc22: <witness> = impl_witness %I.impl_witness_table.loc22 [concrete = constants.%I.impl_witness.464]
  1725. // CHECK:STDOUT: }
  1726. // CHECK:STDOUT:
  1727. // CHECK:STDOUT: interface @I {
  1728. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  1729. // CHECK:STDOUT: %NoReturn.decl: %NoReturn.type.7ff = fn_decl @NoReturn.1 [concrete = constants.%NoReturn.7fd] {} {}
  1730. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %NoReturn.decl [concrete = constants.%assoc0]
  1731. // CHECK:STDOUT:
  1732. // CHECK:STDOUT: !members:
  1733. // CHECK:STDOUT: .Self = %Self
  1734. // CHECK:STDOUT: .NoReturn = %assoc0
  1735. // CHECK:STDOUT: witness = (%NoReturn.decl)
  1736. // CHECK:STDOUT: }
  1737. // CHECK:STDOUT:
  1738. // CHECK:STDOUT: impl @impl.4ab: %.loc8_7.2 as %I.ref {
  1739. // CHECK:STDOUT: %NoReturn.decl: %NoReturn.type.948 = fn_decl @NoReturn.2 [concrete = constants.%NoReturn.9fa] {
  1740. // CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern [concrete]
  1741. // CHECK:STDOUT: %return.param_patt: %pattern_type.cb1 = out_param_pattern %return.patt, call_param0 [concrete]
  1742. // CHECK:STDOUT: } {
  1743. // CHECK:STDOUT: %.loc17_21.1: %empty_tuple.type = tuple_literal ()
  1744. // CHECK:STDOUT: %.loc17_21.2: type = converted %.loc17_21.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  1745. // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0
  1746. // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param
  1747. // CHECK:STDOUT: }
  1748. // CHECK:STDOUT:
  1749. // CHECK:STDOUT: !members:
  1750. // CHECK:STDOUT: .NoReturn = %NoReturn.decl
  1751. // CHECK:STDOUT: witness = file.%I.impl_witness.loc8
  1752. // CHECK:STDOUT: }
  1753. // CHECK:STDOUT:
  1754. // CHECK:STDOUT: impl @impl.770: %C.ref as %I.ref {
  1755. // CHECK:STDOUT: %NoReturn.decl: %NoReturn.type.930 = fn_decl @NoReturn.3 [concrete = constants.%NoReturn.ac0] {
  1756. // CHECK:STDOUT: %return.patt: %pattern_type.c48 = return_slot_pattern [concrete]
  1757. // CHECK:STDOUT: %return.param_patt: %pattern_type.c48 = out_param_pattern %return.patt, call_param0 [concrete]
  1758. // CHECK:STDOUT: } {
  1759. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  1760. // CHECK:STDOUT: %return.param: ref %C = out_param call_param0
  1761. // CHECK:STDOUT: %return: ref %C = return_slot %return.param
  1762. // CHECK:STDOUT: }
  1763. // CHECK:STDOUT:
  1764. // CHECK:STDOUT: !members:
  1765. // CHECK:STDOUT: .C = <poisoned>
  1766. // CHECK:STDOUT: .NoReturn = %NoReturn.decl
  1767. // CHECK:STDOUT: witness = file.%I.impl_witness.loc22
  1768. // CHECK:STDOUT: }
  1769. // CHECK:STDOUT:
  1770. // CHECK:STDOUT: class @C {
  1771. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  1772. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  1773. // CHECK:STDOUT: complete_type_witness = %complete_type
  1774. // CHECK:STDOUT:
  1775. // CHECK:STDOUT: !members:
  1776. // CHECK:STDOUT: .Self = constants.%C
  1777. // CHECK:STDOUT: }
  1778. // CHECK:STDOUT:
  1779. // CHECK:STDOUT: generic fn @NoReturn.1(@I.%Self: %I.type) {
  1780. // CHECK:STDOUT: fn();
  1781. // CHECK:STDOUT: }
  1782. // CHECK:STDOUT:
  1783. // CHECK:STDOUT: fn @NoReturn.2() -> %empty_tuple.type;
  1784. // CHECK:STDOUT:
  1785. // CHECK:STDOUT: fn @NoReturn.3() -> %C;
  1786. // CHECK:STDOUT:
  1787. // CHECK:STDOUT: specific @NoReturn.1(constants.%Self) {}
  1788. // CHECK:STDOUT:
  1789. // CHECK:STDOUT: specific @NoReturn.1(constants.%I.facet.372) {}
  1790. // CHECK:STDOUT:
  1791. // CHECK:STDOUT: specific @NoReturn.1(constants.%I.facet.be9) {}
  1792. // CHECK:STDOUT: