virtual_modifiers.carbon 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038
  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/class/virtual_modifiers.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/virtual_modifiers.carbon
  10. // --- modifiers.carbon
  11. package Modifiers;
  12. base class Base {
  13. virtual fn H();
  14. }
  15. abstract class Abstract {
  16. abstract fn J();
  17. virtual fn K();
  18. }
  19. // --- override_import.carbon
  20. package OverrideImport;
  21. import Modifiers;
  22. class Derived {
  23. extend base: Modifiers.Base;
  24. impl fn H();
  25. }
  26. // --- todo_fail_later_base.carbon
  27. package FailLaterBase;
  28. import Modifiers;
  29. base class Derived {
  30. virtual fn F();
  31. extend base: Modifiers.Base;
  32. }
  33. // --- init.carbon
  34. package Init;
  35. import Modifiers;
  36. fn F() {
  37. var v: Modifiers.Base = {};
  38. }
  39. // --- impl_abstract.carbon
  40. package ImplAbstract;
  41. abstract class A1 {
  42. virtual fn F();
  43. }
  44. abstract class A2 {
  45. extend base: A1;
  46. impl fn F();
  47. }
  48. // --- impl_base.carbon
  49. package ImplBase;
  50. base class B1 {
  51. virtual fn F();
  52. }
  53. base class B2 {
  54. extend base: B1;
  55. impl fn F();
  56. }
  57. class C {
  58. extend base: B2;
  59. impl fn F();
  60. }
  61. // --- fail_modifiers.carbon
  62. package FailModifiers;
  63. class C {
  64. // CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:3: error: impl without base class [ImplWithoutBase]
  65. // CHECK:STDERR: impl fn F();
  66. // CHECK:STDERR: ^~~~~~~~~~~~
  67. // CHECK:STDERR:
  68. impl fn F();
  69. }
  70. // --- init_members.carbon
  71. package InitMembers;
  72. base class Base {
  73. var m1: i32;
  74. var m2: i32;
  75. virtual fn F();
  76. }
  77. fn F() {
  78. var i: i32 = 3;
  79. // TODO: These should initialize element1 (.m), not element0 (the vptr)
  80. var b1: Base = {.m2 = i, .m1 = i};
  81. var b2: Base = {.m2 = 3, .m1 = 5};
  82. // This one is good, though.
  83. b1.m2 = 4;
  84. }
  85. // --- todo_fail_impl_without_base_declaration.carbon
  86. package ImplWithoutBaseDeclaration;
  87. base class Base {
  88. }
  89. class Derived {
  90. extend base: Base;
  91. impl fn F();
  92. }
  93. // --- abstract_impl.carbon
  94. package AbstractImpl;
  95. abstract class AbstractBase {
  96. abstract fn F();
  97. }
  98. abstract class AbstractIntermediate {
  99. extend base: AbstractBase;
  100. }
  101. class Derived {
  102. extend base: AbstractIntermediate;
  103. impl fn F();
  104. }
  105. // --- virtual_impl.carbon
  106. package VirtualImpl;
  107. base class VirtualBase {
  108. virtual fn F();
  109. }
  110. base class VirtualIntermediate {
  111. extend base: VirtualBase;
  112. }
  113. class Derived {
  114. extend base: VirtualIntermediate;
  115. impl fn F();
  116. }
  117. // CHECK:STDOUT: --- modifiers.carbon
  118. // CHECK:STDOUT:
  119. // CHECK:STDOUT: constants {
  120. // CHECK:STDOUT: %Base: type = class_type @Base [template]
  121. // CHECK:STDOUT: %H.type: type = fn_type @H [template]
  122. // CHECK:STDOUT: %H: %H.type = struct_value () [template]
  123. // CHECK:STDOUT: %ptr: type = ptr_type <vtable> [template]
  124. // CHECK:STDOUT: %.c3d: <vtable> = vtable (%H) [template]
  125. // CHECK:STDOUT: %struct_type.vptr: type = struct_type {.<vptr>: %ptr} [template]
  126. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.vptr [template]
  127. // CHECK:STDOUT: %Abstract: type = class_type @Abstract [template]
  128. // CHECK:STDOUT: %J.type: type = fn_type @J [template]
  129. // CHECK:STDOUT: %J: %J.type = struct_value () [template]
  130. // CHECK:STDOUT: %K.type: type = fn_type @K [template]
  131. // CHECK:STDOUT: %K: %K.type = struct_value () [template]
  132. // CHECK:STDOUT: %.2b2: <vtable> = vtable (%J, %K) [template]
  133. // CHECK:STDOUT: }
  134. // CHECK:STDOUT:
  135. // CHECK:STDOUT: imports {
  136. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  137. // CHECK:STDOUT: import Core//prelude
  138. // CHECK:STDOUT: import Core//prelude/...
  139. // CHECK:STDOUT: }
  140. // CHECK:STDOUT: }
  141. // CHECK:STDOUT:
  142. // CHECK:STDOUT: file {
  143. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  144. // CHECK:STDOUT: .Core = imports.%Core
  145. // CHECK:STDOUT: .Base = %Base.decl
  146. // CHECK:STDOUT: .Abstract = %Abstract.decl
  147. // CHECK:STDOUT: }
  148. // CHECK:STDOUT: %Core.import = import Core
  149. // CHECK:STDOUT: %Base.decl: type = class_decl @Base [template = constants.%Base] {} {}
  150. // CHECK:STDOUT: %Abstract.decl: type = class_decl @Abstract [template = constants.%Abstract] {} {}
  151. // CHECK:STDOUT: }
  152. // CHECK:STDOUT:
  153. // CHECK:STDOUT: class @Base {
  154. // CHECK:STDOUT: %H.decl: %H.type = fn_decl @H [template = constants.%H] {} {}
  155. // CHECK:STDOUT: %.loc6: <vtable> = vtable (%H.decl) [template = constants.%.c3d]
  156. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.vptr [template = constants.%complete_type]
  157. // CHECK:STDOUT: complete_type_witness = %complete_type
  158. // CHECK:STDOUT:
  159. // CHECK:STDOUT: !members:
  160. // CHECK:STDOUT: .Self = constants.%Base
  161. // CHECK:STDOUT: .H = %H.decl
  162. // CHECK:STDOUT: }
  163. // CHECK:STDOUT:
  164. // CHECK:STDOUT: class @Abstract {
  165. // CHECK:STDOUT: %J.decl: %J.type = fn_decl @J [template = constants.%J] {} {}
  166. // CHECK:STDOUT: %K.decl: %K.type = fn_decl @K [template = constants.%K] {} {}
  167. // CHECK:STDOUT: %.loc12: <vtable> = vtable (%J.decl, %K.decl) [template = constants.%.2b2]
  168. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.vptr [template = constants.%complete_type]
  169. // CHECK:STDOUT: complete_type_witness = %complete_type
  170. // CHECK:STDOUT:
  171. // CHECK:STDOUT: !members:
  172. // CHECK:STDOUT: .Self = constants.%Abstract
  173. // CHECK:STDOUT: .J = %J.decl
  174. // CHECK:STDOUT: .K = %K.decl
  175. // CHECK:STDOUT: }
  176. // CHECK:STDOUT:
  177. // CHECK:STDOUT: virtual fn @H();
  178. // CHECK:STDOUT:
  179. // CHECK:STDOUT: abstract fn @J();
  180. // CHECK:STDOUT:
  181. // CHECK:STDOUT: virtual fn @K();
  182. // CHECK:STDOUT:
  183. // CHECK:STDOUT: --- override_import.carbon
  184. // CHECK:STDOUT:
  185. // CHECK:STDOUT: constants {
  186. // CHECK:STDOUT: %Derived: type = class_type @Derived [template]
  187. // CHECK:STDOUT: %Base: type = class_type @Base [template]
  188. // CHECK:STDOUT: %ptr.454: type = ptr_type <vtable> [template]
  189. // CHECK:STDOUT: %struct_type.vptr: type = struct_type {.<vptr>: %ptr.454} [template]
  190. // CHECK:STDOUT: %complete_type.513: <witness> = complete_type_witness %struct_type.vptr [template]
  191. // CHECK:STDOUT: %Derived.elem: type = unbound_element_type %Derived, %Base [template]
  192. // CHECK:STDOUT: %H.type.dba: type = fn_type @H.1 [template]
  193. // CHECK:STDOUT: %H.bce: %H.type.dba = struct_value () [template]
  194. // CHECK:STDOUT: %.dce: <vtable> = vtable (%H.bce) [template]
  195. // CHECK:STDOUT: %struct_type.base: type = struct_type {.base: %Base} [template]
  196. // CHECK:STDOUT: %complete_type.0e2: <witness> = complete_type_witness %struct_type.base [template]
  197. // CHECK:STDOUT: }
  198. // CHECK:STDOUT:
  199. // CHECK:STDOUT: imports {
  200. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  201. // CHECK:STDOUT: import Core//prelude
  202. // CHECK:STDOUT: import Core//prelude/...
  203. // CHECK:STDOUT: }
  204. // CHECK:STDOUT: %Modifiers: <namespace> = namespace file.%Modifiers.import, [template] {
  205. // CHECK:STDOUT: .Base = %import_ref.917
  206. // CHECK:STDOUT: import Modifiers//default
  207. // CHECK:STDOUT: }
  208. // CHECK:STDOUT: %import_ref.917: type = import_ref Modifiers//default, Base, loaded [template = constants.%Base]
  209. // CHECK:STDOUT: %import_ref.05e: <witness> = import_ref Modifiers//default, loc6_1, loaded [template = constants.%complete_type.513]
  210. // CHECK:STDOUT: %import_ref.1f3 = import_ref Modifiers//default, inst16 [no loc], unloaded
  211. // CHECK:STDOUT: %import_ref.2cc = import_ref Modifiers//default, loc5_17, unloaded
  212. // CHECK:STDOUT: }
  213. // CHECK:STDOUT:
  214. // CHECK:STDOUT: file {
  215. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  216. // CHECK:STDOUT: .Core = imports.%Core
  217. // CHECK:STDOUT: .Modifiers = imports.%Modifiers
  218. // CHECK:STDOUT: .Derived = %Derived.decl
  219. // CHECK:STDOUT: }
  220. // CHECK:STDOUT: %Core.import = import Core
  221. // CHECK:STDOUT: %Modifiers.import = import Modifiers
  222. // CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {} {}
  223. // CHECK:STDOUT: }
  224. // CHECK:STDOUT:
  225. // CHECK:STDOUT: class @Derived {
  226. // CHECK:STDOUT: %Modifiers.ref: <namespace> = name_ref Modifiers, imports.%Modifiers [template = imports.%Modifiers]
  227. // CHECK:STDOUT: %Base.ref: type = name_ref Base, imports.%import_ref.917 [template = constants.%Base]
  228. // CHECK:STDOUT: %.loc7: %Derived.elem = base_decl %Base.ref, element0 [template]
  229. // CHECK:STDOUT: %H.decl: %H.type.dba = fn_decl @H.1 [template = constants.%H.bce] {} {}
  230. // CHECK:STDOUT: %.loc9: <vtable> = vtable (%H.decl) [template = constants.%.dce]
  231. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.base [template = constants.%complete_type.0e2]
  232. // CHECK:STDOUT: complete_type_witness = %complete_type
  233. // CHECK:STDOUT:
  234. // CHECK:STDOUT: !members:
  235. // CHECK:STDOUT: .Self = constants.%Derived
  236. // CHECK:STDOUT: .base = %.loc7
  237. // CHECK:STDOUT: .H = %H.decl
  238. // CHECK:STDOUT: extend %Base.ref
  239. // CHECK:STDOUT: }
  240. // CHECK:STDOUT:
  241. // CHECK:STDOUT: class @Base [from "modifiers.carbon"] {
  242. // CHECK:STDOUT: complete_type_witness = imports.%import_ref.05e
  243. // CHECK:STDOUT:
  244. // CHECK:STDOUT: !members:
  245. // CHECK:STDOUT: .Self = imports.%import_ref.1f3
  246. // CHECK:STDOUT: .H = imports.%import_ref.2cc
  247. // CHECK:STDOUT: }
  248. // CHECK:STDOUT:
  249. // CHECK:STDOUT: impl fn @H.1();
  250. // CHECK:STDOUT:
  251. // CHECK:STDOUT: fn @H.2() [from "modifiers.carbon"];
  252. // CHECK:STDOUT:
  253. // CHECK:STDOUT: --- todo_fail_later_base.carbon
  254. // CHECK:STDOUT:
  255. // CHECK:STDOUT: constants {
  256. // CHECK:STDOUT: %Derived: type = class_type @Derived [template]
  257. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  258. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  259. // CHECK:STDOUT: %Base: type = class_type @Base [template]
  260. // CHECK:STDOUT: %ptr.454: type = ptr_type <vtable> [template]
  261. // CHECK:STDOUT: %struct_type.vptr: type = struct_type {.<vptr>: %ptr.454} [template]
  262. // CHECK:STDOUT: %complete_type.513: <witness> = complete_type_witness %struct_type.vptr [template]
  263. // CHECK:STDOUT: %Derived.elem: type = unbound_element_type %Derived, %Base [template]
  264. // CHECK:STDOUT: %H.type: type = fn_type @H [template]
  265. // CHECK:STDOUT: %H: %H.type = struct_value () [template]
  266. // CHECK:STDOUT: %.02f: <vtable> = vtable (%H, %F) [template]
  267. // CHECK:STDOUT: %struct_type.base: type = struct_type {.base: %Base} [template]
  268. // CHECK:STDOUT: %complete_type.0e2: <witness> = complete_type_witness %struct_type.base [template]
  269. // CHECK:STDOUT: }
  270. // CHECK:STDOUT:
  271. // CHECK:STDOUT: imports {
  272. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  273. // CHECK:STDOUT: import Core//prelude
  274. // CHECK:STDOUT: import Core//prelude/...
  275. // CHECK:STDOUT: }
  276. // CHECK:STDOUT: %Modifiers: <namespace> = namespace file.%Modifiers.import, [template] {
  277. // CHECK:STDOUT: .Base = %import_ref.917
  278. // CHECK:STDOUT: import Modifiers//default
  279. // CHECK:STDOUT: }
  280. // CHECK:STDOUT: %import_ref.917: type = import_ref Modifiers//default, Base, loaded [template = constants.%Base]
  281. // CHECK:STDOUT: %import_ref.05e: <witness> = import_ref Modifiers//default, loc6_1, loaded [template = constants.%complete_type.513]
  282. // CHECK:STDOUT: %import_ref.1f3 = import_ref Modifiers//default, inst16 [no loc], unloaded
  283. // CHECK:STDOUT: %import_ref.2cc = import_ref Modifiers//default, loc5_17, unloaded
  284. // CHECK:STDOUT: }
  285. // CHECK:STDOUT:
  286. // CHECK:STDOUT: file {
  287. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  288. // CHECK:STDOUT: .Core = imports.%Core
  289. // CHECK:STDOUT: .Modifiers = imports.%Modifiers
  290. // CHECK:STDOUT: .Derived = %Derived.decl
  291. // CHECK:STDOUT: }
  292. // CHECK:STDOUT: %Core.import = import Core
  293. // CHECK:STDOUT: %Modifiers.import = import Modifiers
  294. // CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {} {}
  295. // CHECK:STDOUT: }
  296. // CHECK:STDOUT:
  297. // CHECK:STDOUT: class @Derived {
  298. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {}
  299. // CHECK:STDOUT: %Modifiers.ref: <namespace> = name_ref Modifiers, imports.%Modifiers [template = imports.%Modifiers]
  300. // CHECK:STDOUT: %Base.ref: type = name_ref Base, imports.%import_ref.917 [template = constants.%Base]
  301. // CHECK:STDOUT: %.loc8: %Derived.elem = base_decl %Base.ref, element0 [template]
  302. // CHECK:STDOUT: %.loc9: <vtable> = vtable (constants.%H, %F.decl) [template = constants.%.02f]
  303. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.base [template = constants.%complete_type.0e2]
  304. // CHECK:STDOUT: complete_type_witness = %complete_type
  305. // CHECK:STDOUT:
  306. // CHECK:STDOUT: !members:
  307. // CHECK:STDOUT: .Self = constants.%Derived
  308. // CHECK:STDOUT: .F = %F.decl
  309. // CHECK:STDOUT: .base = %.loc8
  310. // CHECK:STDOUT: extend %Base.ref
  311. // CHECK:STDOUT: }
  312. // CHECK:STDOUT:
  313. // CHECK:STDOUT: class @Base [from "modifiers.carbon"] {
  314. // CHECK:STDOUT: complete_type_witness = imports.%import_ref.05e
  315. // CHECK:STDOUT:
  316. // CHECK:STDOUT: !members:
  317. // CHECK:STDOUT: .Self = imports.%import_ref.1f3
  318. // CHECK:STDOUT: .H = imports.%import_ref.2cc
  319. // CHECK:STDOUT: }
  320. // CHECK:STDOUT:
  321. // CHECK:STDOUT: virtual fn @F();
  322. // CHECK:STDOUT:
  323. // CHECK:STDOUT: fn @H() [from "modifiers.carbon"];
  324. // CHECK:STDOUT:
  325. // CHECK:STDOUT: --- init.carbon
  326. // CHECK:STDOUT:
  327. // CHECK:STDOUT: constants {
  328. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  329. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  330. // CHECK:STDOUT: %Base: type = class_type @Base [template]
  331. // CHECK:STDOUT: %ptr.454: type = ptr_type <vtable> [template]
  332. // CHECK:STDOUT: %struct_type.vptr: type = struct_type {.<vptr>: %ptr.454} [template]
  333. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.vptr [template]
  334. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  335. // CHECK:STDOUT: }
  336. // CHECK:STDOUT:
  337. // CHECK:STDOUT: imports {
  338. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  339. // CHECK:STDOUT: import Core//prelude
  340. // CHECK:STDOUT: import Core//prelude/...
  341. // CHECK:STDOUT: }
  342. // CHECK:STDOUT: %Modifiers: <namespace> = namespace file.%Modifiers.import, [template] {
  343. // CHECK:STDOUT: .Base = %import_ref.917
  344. // CHECK:STDOUT: import Modifiers//default
  345. // CHECK:STDOUT: }
  346. // CHECK:STDOUT: %import_ref.917: type = import_ref Modifiers//default, Base, loaded [template = constants.%Base]
  347. // CHECK:STDOUT: %import_ref.05e: <witness> = import_ref Modifiers//default, loc6_1, loaded [template = constants.%complete_type]
  348. // CHECK:STDOUT: %import_ref.1f3 = import_ref Modifiers//default, inst16 [no loc], unloaded
  349. // CHECK:STDOUT: %import_ref.2cc = import_ref Modifiers//default, loc5_17, unloaded
  350. // CHECK:STDOUT: }
  351. // CHECK:STDOUT:
  352. // CHECK:STDOUT: file {
  353. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  354. // CHECK:STDOUT: .Core = imports.%Core
  355. // CHECK:STDOUT: .Modifiers = imports.%Modifiers
  356. // CHECK:STDOUT: .F = %F.decl
  357. // CHECK:STDOUT: }
  358. // CHECK:STDOUT: %Core.import = import Core
  359. // CHECK:STDOUT: %Modifiers.import = import Modifiers
  360. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {}
  361. // CHECK:STDOUT: }
  362. // CHECK:STDOUT:
  363. // CHECK:STDOUT: class @Base [from "modifiers.carbon"] {
  364. // CHECK:STDOUT: complete_type_witness = imports.%import_ref.05e
  365. // CHECK:STDOUT:
  366. // CHECK:STDOUT: !members:
  367. // CHECK:STDOUT: .Self = imports.%import_ref.1f3
  368. // CHECK:STDOUT: .H = imports.%import_ref.2cc
  369. // CHECK:STDOUT: }
  370. // CHECK:STDOUT:
  371. // CHECK:STDOUT: fn @F() {
  372. // CHECK:STDOUT: !entry:
  373. // CHECK:STDOUT: name_binding_decl {
  374. // CHECK:STDOUT: %v.patt: %Base = binding_pattern v
  375. // CHECK:STDOUT: %.loc7_3.1: %Base = var_pattern %v.patt
  376. // CHECK:STDOUT: }
  377. // CHECK:STDOUT: %v.var: ref %Base = var v
  378. // CHECK:STDOUT: %.loc7_28.1: %empty_struct_type = struct_literal ()
  379. // CHECK:STDOUT: %.loc7_28.2: ref %ptr.454 = class_element_access %v.var, element0
  380. // CHECK:STDOUT: %.loc7_28.3: ref %ptr.454 = vtable_ptr
  381. // CHECK:STDOUT: %.loc7_28.4: init %ptr.454 = initialize_from %.loc7_28.3 to %.loc7_28.2
  382. // CHECK:STDOUT: %.loc7_28.5: init %Base = class_init (%.loc7_28.4), %v.var
  383. // CHECK:STDOUT: %.loc7_3.2: init %Base = converted %.loc7_28.1, %.loc7_28.5
  384. // CHECK:STDOUT: assign %v.var, %.loc7_3.2
  385. // CHECK:STDOUT: %.loc7_19: type = splice_block %Base.ref [template = constants.%Base] {
  386. // CHECK:STDOUT: %Modifiers.ref: <namespace> = name_ref Modifiers, imports.%Modifiers [template = imports.%Modifiers]
  387. // CHECK:STDOUT: %Base.ref: type = name_ref Base, imports.%import_ref.917 [template = constants.%Base]
  388. // CHECK:STDOUT: }
  389. // CHECK:STDOUT: %v: ref %Base = bind_name v, %v.var
  390. // CHECK:STDOUT: return
  391. // CHECK:STDOUT: }
  392. // CHECK:STDOUT:
  393. // CHECK:STDOUT: --- impl_abstract.carbon
  394. // CHECK:STDOUT:
  395. // CHECK:STDOUT: constants {
  396. // CHECK:STDOUT: %A1: type = class_type @A1 [template]
  397. // CHECK:STDOUT: %F.type.13a: type = fn_type @F.1 [template]
  398. // CHECK:STDOUT: %F.df5: %F.type.13a = struct_value () [template]
  399. // CHECK:STDOUT: %ptr.454: type = ptr_type <vtable> [template]
  400. // CHECK:STDOUT: %.593: <vtable> = vtable (%F.df5) [template]
  401. // CHECK:STDOUT: %struct_type.vptr: type = struct_type {.<vptr>: %ptr.454} [template]
  402. // CHECK:STDOUT: %complete_type.513: <witness> = complete_type_witness %struct_type.vptr [template]
  403. // CHECK:STDOUT: %A2: type = class_type @A2 [template]
  404. // CHECK:STDOUT: %A2.elem: type = unbound_element_type %A2, %A1 [template]
  405. // CHECK:STDOUT: %F.type.4ae: type = fn_type @F.2 [template]
  406. // CHECK:STDOUT: %F.1d5: %F.type.4ae = struct_value () [template]
  407. // CHECK:STDOUT: %.943: <vtable> = vtable (%F.1d5) [template]
  408. // CHECK:STDOUT: %struct_type.base: type = struct_type {.base: %A1} [template]
  409. // CHECK:STDOUT: %complete_type.a6f: <witness> = complete_type_witness %struct_type.base [template]
  410. // CHECK:STDOUT: }
  411. // CHECK:STDOUT:
  412. // CHECK:STDOUT: imports {
  413. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  414. // CHECK:STDOUT: import Core//prelude
  415. // CHECK:STDOUT: import Core//prelude/...
  416. // CHECK:STDOUT: }
  417. // CHECK:STDOUT: }
  418. // CHECK:STDOUT:
  419. // CHECK:STDOUT: file {
  420. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  421. // CHECK:STDOUT: .Core = imports.%Core
  422. // CHECK:STDOUT: .A1 = %A1.decl
  423. // CHECK:STDOUT: .A2 = %A2.decl
  424. // CHECK:STDOUT: }
  425. // CHECK:STDOUT: %Core.import = import Core
  426. // CHECK:STDOUT: %A1.decl: type = class_decl @A1 [template = constants.%A1] {} {}
  427. // CHECK:STDOUT: %A2.decl: type = class_decl @A2 [template = constants.%A2] {} {}
  428. // CHECK:STDOUT: }
  429. // CHECK:STDOUT:
  430. // CHECK:STDOUT: class @A1 {
  431. // CHECK:STDOUT: %F.decl: %F.type.13a = fn_decl @F.1 [template = constants.%F.df5] {} {}
  432. // CHECK:STDOUT: %.loc6: <vtable> = vtable (%F.decl) [template = constants.%.593]
  433. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.vptr [template = constants.%complete_type.513]
  434. // CHECK:STDOUT: complete_type_witness = %complete_type
  435. // CHECK:STDOUT:
  436. // CHECK:STDOUT: !members:
  437. // CHECK:STDOUT: .Self = constants.%A1
  438. // CHECK:STDOUT: .F = %F.decl
  439. // CHECK:STDOUT: }
  440. // CHECK:STDOUT:
  441. // CHECK:STDOUT: class @A2 {
  442. // CHECK:STDOUT: %A1.ref: type = name_ref A1, file.%A1.decl [template = constants.%A1]
  443. // CHECK:STDOUT: %.loc9: %A2.elem = base_decl %A1.ref, element0 [template]
  444. // CHECK:STDOUT: %F.decl: %F.type.4ae = fn_decl @F.2 [template = constants.%F.1d5] {} {}
  445. // CHECK:STDOUT: %.loc11: <vtable> = vtable (%F.decl) [template = constants.%.943]
  446. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.base [template = constants.%complete_type.a6f]
  447. // CHECK:STDOUT: complete_type_witness = %complete_type
  448. // CHECK:STDOUT:
  449. // CHECK:STDOUT: !members:
  450. // CHECK:STDOUT: .Self = constants.%A2
  451. // CHECK:STDOUT: .base = %.loc9
  452. // CHECK:STDOUT: .F = %F.decl
  453. // CHECK:STDOUT: extend %A1.ref
  454. // CHECK:STDOUT: }
  455. // CHECK:STDOUT:
  456. // CHECK:STDOUT: virtual fn @F.1();
  457. // CHECK:STDOUT:
  458. // CHECK:STDOUT: impl fn @F.2();
  459. // CHECK:STDOUT:
  460. // CHECK:STDOUT: --- impl_base.carbon
  461. // CHECK:STDOUT:
  462. // CHECK:STDOUT: constants {
  463. // CHECK:STDOUT: %B1: type = class_type @B1 [template]
  464. // CHECK:STDOUT: %F.type.e4c: type = fn_type @F.1 [template]
  465. // CHECK:STDOUT: %F.8f5: %F.type.e4c = struct_value () [template]
  466. // CHECK:STDOUT: %ptr.454: type = ptr_type <vtable> [template]
  467. // CHECK:STDOUT: %.bc5: <vtable> = vtable (%F.8f5) [template]
  468. // CHECK:STDOUT: %struct_type.vptr: type = struct_type {.<vptr>: %ptr.454} [template]
  469. // CHECK:STDOUT: %complete_type.513: <witness> = complete_type_witness %struct_type.vptr [template]
  470. // CHECK:STDOUT: %B2: type = class_type @B2 [template]
  471. // CHECK:STDOUT: %B2.elem: type = unbound_element_type %B2, %B1 [template]
  472. // CHECK:STDOUT: %F.type.b26: type = fn_type @F.2 [template]
  473. // CHECK:STDOUT: %F.d48: %F.type.b26 = struct_value () [template]
  474. // CHECK:STDOUT: %.579: <vtable> = vtable (%F.d48) [template]
  475. // CHECK:STDOUT: %struct_type.base.508: type = struct_type {.base: %B1} [template]
  476. // CHECK:STDOUT: %complete_type.5ac: <witness> = complete_type_witness %struct_type.base.508 [template]
  477. // CHECK:STDOUT: %C: type = class_type @C [template]
  478. // CHECK:STDOUT: %C.elem: type = unbound_element_type %C, %B2 [template]
  479. // CHECK:STDOUT: %F.type.c29: type = fn_type @F.3 [template]
  480. // CHECK:STDOUT: %F.437: %F.type.c29 = struct_value () [template]
  481. // CHECK:STDOUT: %.5f6: <vtable> = vtable (%F.437) [template]
  482. // CHECK:STDOUT: %struct_type.base.421: type = struct_type {.base: %B2} [template]
  483. // CHECK:STDOUT: %complete_type.066: <witness> = complete_type_witness %struct_type.base.421 [template]
  484. // CHECK:STDOUT: }
  485. // CHECK:STDOUT:
  486. // CHECK:STDOUT: imports {
  487. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  488. // CHECK:STDOUT: import Core//prelude
  489. // CHECK:STDOUT: import Core//prelude/...
  490. // CHECK:STDOUT: }
  491. // CHECK:STDOUT: }
  492. // CHECK:STDOUT:
  493. // CHECK:STDOUT: file {
  494. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  495. // CHECK:STDOUT: .Core = imports.%Core
  496. // CHECK:STDOUT: .B1 = %B1.decl
  497. // CHECK:STDOUT: .B2 = %B2.decl
  498. // CHECK:STDOUT: .C = %C.decl
  499. // CHECK:STDOUT: }
  500. // CHECK:STDOUT: %Core.import = import Core
  501. // CHECK:STDOUT: %B1.decl: type = class_decl @B1 [template = constants.%B1] {} {}
  502. // CHECK:STDOUT: %B2.decl: type = class_decl @B2 [template = constants.%B2] {} {}
  503. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  504. // CHECK:STDOUT: }
  505. // CHECK:STDOUT:
  506. // CHECK:STDOUT: class @B1 {
  507. // CHECK:STDOUT: %F.decl: %F.type.e4c = fn_decl @F.1 [template = constants.%F.8f5] {} {}
  508. // CHECK:STDOUT: %.loc6: <vtable> = vtable (%F.decl) [template = constants.%.bc5]
  509. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.vptr [template = constants.%complete_type.513]
  510. // CHECK:STDOUT: complete_type_witness = %complete_type
  511. // CHECK:STDOUT:
  512. // CHECK:STDOUT: !members:
  513. // CHECK:STDOUT: .Self = constants.%B1
  514. // CHECK:STDOUT: .F = %F.decl
  515. // CHECK:STDOUT: }
  516. // CHECK:STDOUT:
  517. // CHECK:STDOUT: class @B2 {
  518. // CHECK:STDOUT: %B1.ref: type = name_ref B1, file.%B1.decl [template = constants.%B1]
  519. // CHECK:STDOUT: %.loc9: %B2.elem = base_decl %B1.ref, element0 [template]
  520. // CHECK:STDOUT: %F.decl: %F.type.b26 = fn_decl @F.2 [template = constants.%F.d48] {} {}
  521. // CHECK:STDOUT: %.loc11: <vtable> = vtable (%F.decl) [template = constants.%.579]
  522. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.base.508 [template = constants.%complete_type.5ac]
  523. // CHECK:STDOUT: complete_type_witness = %complete_type
  524. // CHECK:STDOUT:
  525. // CHECK:STDOUT: !members:
  526. // CHECK:STDOUT: .Self = constants.%B2
  527. // CHECK:STDOUT: .base = %.loc9
  528. // CHECK:STDOUT: .F = %F.decl
  529. // CHECK:STDOUT: extend %B1.ref
  530. // CHECK:STDOUT: }
  531. // CHECK:STDOUT:
  532. // CHECK:STDOUT: class @C {
  533. // CHECK:STDOUT: %B2.ref: type = name_ref B2, file.%B2.decl [template = constants.%B2]
  534. // CHECK:STDOUT: %.loc14: %C.elem = base_decl %B2.ref, element0 [template]
  535. // CHECK:STDOUT: %F.decl: %F.type.c29 = fn_decl @F.3 [template = constants.%F.437] {} {}
  536. // CHECK:STDOUT: %.loc16: <vtable> = vtable (%F.decl) [template = constants.%.5f6]
  537. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.base.421 [template = constants.%complete_type.066]
  538. // CHECK:STDOUT: complete_type_witness = %complete_type
  539. // CHECK:STDOUT:
  540. // CHECK:STDOUT: !members:
  541. // CHECK:STDOUT: .Self = constants.%C
  542. // CHECK:STDOUT: .base = %.loc14
  543. // CHECK:STDOUT: .F = %F.decl
  544. // CHECK:STDOUT: extend %B2.ref
  545. // CHECK:STDOUT: }
  546. // CHECK:STDOUT:
  547. // CHECK:STDOUT: virtual fn @F.1();
  548. // CHECK:STDOUT:
  549. // CHECK:STDOUT: impl fn @F.2();
  550. // CHECK:STDOUT:
  551. // CHECK:STDOUT: impl fn @F.3();
  552. // CHECK:STDOUT:
  553. // CHECK:STDOUT: --- fail_modifiers.carbon
  554. // CHECK:STDOUT:
  555. // CHECK:STDOUT: constants {
  556. // CHECK:STDOUT: %C: type = class_type @C [template]
  557. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  558. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  559. // CHECK:STDOUT: %ptr: type = ptr_type <vtable> [template]
  560. // CHECK:STDOUT: %.f2b: <vtable> = vtable () [template]
  561. // CHECK:STDOUT: %struct_type.vptr: type = struct_type {.<vptr>: %ptr} [template]
  562. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.vptr [template]
  563. // CHECK:STDOUT: }
  564. // CHECK:STDOUT:
  565. // CHECK:STDOUT: imports {
  566. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  567. // CHECK:STDOUT: import Core//prelude
  568. // CHECK:STDOUT: import Core//prelude/...
  569. // CHECK:STDOUT: }
  570. // CHECK:STDOUT: }
  571. // CHECK:STDOUT:
  572. // CHECK:STDOUT: file {
  573. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  574. // CHECK:STDOUT: .Core = imports.%Core
  575. // CHECK:STDOUT: .C = %C.decl
  576. // CHECK:STDOUT: }
  577. // CHECK:STDOUT: %Core.import = import Core
  578. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  579. // CHECK:STDOUT: }
  580. // CHECK:STDOUT:
  581. // CHECK:STDOUT: class @C {
  582. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {}
  583. // CHECK:STDOUT: %.loc10: <vtable> = vtable () [template = constants.%.f2b]
  584. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.vptr [template = constants.%complete_type]
  585. // CHECK:STDOUT: complete_type_witness = %complete_type
  586. // CHECK:STDOUT:
  587. // CHECK:STDOUT: !members:
  588. // CHECK:STDOUT: .Self = constants.%C
  589. // CHECK:STDOUT: .F = %F.decl
  590. // CHECK:STDOUT: }
  591. // CHECK:STDOUT:
  592. // CHECK:STDOUT: impl fn @F();
  593. // CHECK:STDOUT:
  594. // CHECK:STDOUT: --- init_members.carbon
  595. // CHECK:STDOUT:
  596. // CHECK:STDOUT: constants {
  597. // CHECK:STDOUT: %Base: type = class_type @Base [template]
  598. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
  599. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
  600. // CHECK:STDOUT: %Base.elem: type = unbound_element_type %Base, %i32 [template]
  601. // CHECK:STDOUT: %F.type.7c6: type = fn_type @F.1 [template]
  602. // CHECK:STDOUT: %F.d17: %F.type.7c6 = struct_value () [template]
  603. // CHECK:STDOUT: %ptr.454: type = ptr_type <vtable> [template]
  604. // CHECK:STDOUT: %.5ee: <vtable> = vtable (%F.d17) [template]
  605. // CHECK:STDOUT: %struct_type.vptr.m1.m2: type = struct_type {.<vptr>: %ptr.454, .m1: %i32, .m2: %i32} [template]
  606. // CHECK:STDOUT: %complete_type.cf7: <witness> = complete_type_witness %struct_type.vptr.m1.m2 [template]
  607. // CHECK:STDOUT: %F.type.b25: type = fn_type @F.2 [template]
  608. // CHECK:STDOUT: %F.c41: %F.type.b25 = struct_value () [template]
  609. // CHECK:STDOUT: %int_3.1ba: Core.IntLiteral = int_value 3 [template]
  610. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [template]
  611. // CHECK:STDOUT: %impl_witness.d39: <witness> = impl_witness (imports.%import_ref.a5b), @impl.1(%int_32) [template]
  612. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.1(%int_32) [template]
  613. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [template]
  614. // CHECK:STDOUT: %Convert.bound.b30: <bound method> = bound_method %int_3.1ba, %Convert.956 [template]
  615. // CHECK:STDOUT: %Convert.specific_fn.b42: <specific function> = specific_function %Convert.bound.b30, @Convert.2(%int_32) [template]
  616. // CHECK:STDOUT: %int_3.822: %i32 = int_value 3 [template]
  617. // CHECK:STDOUT: %struct_type.m2.m1.68c: type = struct_type {.m2: %i32, .m1: %i32} [template]
  618. // CHECK:STDOUT: %int_5.64b: Core.IntLiteral = int_value 5 [template]
  619. // CHECK:STDOUT: %struct_type.m2.m1.5f2: type = struct_type {.m2: Core.IntLiteral, .m1: Core.IntLiteral} [template]
  620. // CHECK:STDOUT: %Convert.bound.4e6: <bound method> = bound_method %int_5.64b, %Convert.956 [template]
  621. // CHECK:STDOUT: %Convert.specific_fn.ba9: <specific function> = specific_function %Convert.bound.4e6, @Convert.2(%int_32) [template]
  622. // CHECK:STDOUT: %int_5.0f6: %i32 = int_value 5 [template]
  623. // CHECK:STDOUT: %int_4.0c1: Core.IntLiteral = int_value 4 [template]
  624. // CHECK:STDOUT: %Convert.bound.ac3: <bound method> = bound_method %int_4.0c1, %Convert.956 [template]
  625. // CHECK:STDOUT: %Convert.specific_fn.450: <specific function> = specific_function %Convert.bound.ac3, @Convert.2(%int_32) [template]
  626. // CHECK:STDOUT: %int_4.940: %i32 = int_value 4 [template]
  627. // CHECK:STDOUT: }
  628. // CHECK:STDOUT:
  629. // CHECK:STDOUT: imports {
  630. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  631. // CHECK:STDOUT: .Int = %import_ref.485
  632. // CHECK:STDOUT: .ImplicitAs = %import_ref.d44
  633. // CHECK:STDOUT: import Core//prelude
  634. // CHECK:STDOUT: import Core//prelude/...
  635. // CHECK:STDOUT: }
  636. // CHECK:STDOUT: }
  637. // CHECK:STDOUT:
  638. // CHECK:STDOUT: file {
  639. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  640. // CHECK:STDOUT: .Core = imports.%Core
  641. // CHECK:STDOUT: .Base = %Base.decl
  642. // CHECK:STDOUT: .F = %F.decl
  643. // CHECK:STDOUT: }
  644. // CHECK:STDOUT: %Core.import = import Core
  645. // CHECK:STDOUT: %Base.decl: type = class_decl @Base [template = constants.%Base] {} {}
  646. // CHECK:STDOUT: %F.decl: %F.type.b25 = fn_decl @F.2 [template = constants.%F.c41] {} {}
  647. // CHECK:STDOUT: }
  648. // CHECK:STDOUT:
  649. // CHECK:STDOUT: class @Base {
  650. // CHECK:STDOUT: %.loc5_9: %Base.elem = field_decl m1, element1 [template]
  651. // CHECK:STDOUT: name_binding_decl {
  652. // CHECK:STDOUT: %.loc5_3: %Base.elem = var_pattern %.loc5_9
  653. // CHECK:STDOUT: }
  654. // CHECK:STDOUT: %.var.loc5: ref %Base.elem = var <invalid>
  655. // CHECK:STDOUT: %.loc6_9: %Base.elem = field_decl m2, element2 [template]
  656. // CHECK:STDOUT: name_binding_decl {
  657. // CHECK:STDOUT: %.loc6_3: %Base.elem = var_pattern %.loc6_9
  658. // CHECK:STDOUT: }
  659. // CHECK:STDOUT: %.var.loc6: ref %Base.elem = var <invalid>
  660. // CHECK:STDOUT: %F.decl: %F.type.7c6 = fn_decl @F.1 [template = constants.%F.d17] {} {}
  661. // CHECK:STDOUT: %.loc9: <vtable> = vtable (%F.decl) [template = constants.%.5ee]
  662. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.vptr.m1.m2 [template = constants.%complete_type.cf7]
  663. // CHECK:STDOUT: complete_type_witness = %complete_type
  664. // CHECK:STDOUT:
  665. // CHECK:STDOUT: !members:
  666. // CHECK:STDOUT: .Self = constants.%Base
  667. // CHECK:STDOUT: .m1 = %.loc5_9
  668. // CHECK:STDOUT: .m2 = %.loc6_9
  669. // CHECK:STDOUT: .F = %F.decl
  670. // CHECK:STDOUT: }
  671. // CHECK:STDOUT:
  672. // CHECK:STDOUT: virtual fn @F.1();
  673. // CHECK:STDOUT:
  674. // CHECK:STDOUT: fn @F.2() {
  675. // CHECK:STDOUT: !entry:
  676. // CHECK:STDOUT: name_binding_decl {
  677. // CHECK:STDOUT: %i.patt: %i32 = binding_pattern i
  678. // CHECK:STDOUT: %.loc12_3.1: %i32 = var_pattern %i.patt
  679. // CHECK:STDOUT: }
  680. // CHECK:STDOUT: %i.var: ref %i32 = var i
  681. // CHECK:STDOUT: %int_3.loc12: Core.IntLiteral = int_value 3 [template = constants.%int_3.1ba]
  682. // CHECK:STDOUT: %impl.elem0.loc12: %Convert.type.1b6 = impl_witness_access constants.%impl_witness.d39, element0 [template = constants.%Convert.956]
  683. // CHECK:STDOUT: %Convert.bound.loc12: <bound method> = bound_method %int_3.loc12, %impl.elem0.loc12 [template = constants.%Convert.bound.b30]
  684. // CHECK:STDOUT: %Convert.specific_fn.loc12: <specific function> = specific_function %Convert.bound.loc12, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.b42]
  685. // CHECK:STDOUT: %int.convert_checked.loc12: init %i32 = call %Convert.specific_fn.loc12(%int_3.loc12) [template = constants.%int_3.822]
  686. // CHECK:STDOUT: %.loc12_3.2: init %i32 = converted %int_3.loc12, %int.convert_checked.loc12 [template = constants.%int_3.822]
  687. // CHECK:STDOUT: assign %i.var, %.loc12_3.2
  688. // CHECK:STDOUT: %.loc12_10: type = splice_block %i32 [template = constants.%i32] {
  689. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  690. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  691. // CHECK:STDOUT: }
  692. // CHECK:STDOUT: %i: ref %i32 = bind_name i, %i.var
  693. // CHECK:STDOUT: name_binding_decl {
  694. // CHECK:STDOUT: %b1.patt: %Base = binding_pattern b1
  695. // CHECK:STDOUT: %.loc14_3.1: %Base = var_pattern %b1.patt
  696. // CHECK:STDOUT: }
  697. // CHECK:STDOUT: %b1.var: ref %Base = var b1
  698. // CHECK:STDOUT: %i.ref.loc14_25: ref %i32 = name_ref i, %i
  699. // CHECK:STDOUT: %i.ref.loc14_34: ref %i32 = name_ref i, %i
  700. // CHECK:STDOUT: %.loc14_35.1: %struct_type.m2.m1.68c = struct_literal (%i.ref.loc14_25, %i.ref.loc14_34)
  701. // CHECK:STDOUT: %.loc14_35.2: ref %ptr.454 = class_element_access %b1.var, element0
  702. // CHECK:STDOUT: %.loc14_35.3: ref %ptr.454 = vtable_ptr
  703. // CHECK:STDOUT: %.loc14_35.4: init %ptr.454 = initialize_from %.loc14_35.3 to %.loc14_35.2
  704. // CHECK:STDOUT: %.loc14_34: %i32 = bind_value %i.ref.loc14_34
  705. // CHECK:STDOUT: %.loc14_35.5: ref %i32 = class_element_access %b1.var, element2
  706. // CHECK:STDOUT: %.loc14_35.6: init %i32 = initialize_from %.loc14_34 to %.loc14_35.5
  707. // CHECK:STDOUT: %.loc14_25: %i32 = bind_value %i.ref.loc14_25
  708. // CHECK:STDOUT: %.loc14_35.7: ref %i32 = class_element_access %b1.var, element1
  709. // CHECK:STDOUT: %.loc14_35.8: init %i32 = initialize_from %.loc14_25 to %.loc14_35.7
  710. // CHECK:STDOUT: %.loc14_35.9: init %Base = class_init (%.loc14_35.4, %.loc14_35.6, %.loc14_35.8), %b1.var
  711. // CHECK:STDOUT: %.loc14_3.2: init %Base = converted %.loc14_35.1, %.loc14_35.9
  712. // CHECK:STDOUT: assign %b1.var, %.loc14_3.2
  713. // CHECK:STDOUT: %Base.ref.loc14: type = name_ref Base, file.%Base.decl [template = constants.%Base]
  714. // CHECK:STDOUT: %b1: ref %Base = bind_name b1, %b1.var
  715. // CHECK:STDOUT: name_binding_decl {
  716. // CHECK:STDOUT: %b2.patt: %Base = binding_pattern b2
  717. // CHECK:STDOUT: %.loc15_3.1: %Base = var_pattern %b2.patt
  718. // CHECK:STDOUT: }
  719. // CHECK:STDOUT: %b2.var: ref %Base = var b2
  720. // CHECK:STDOUT: %int_3.loc15: Core.IntLiteral = int_value 3 [template = constants.%int_3.1ba]
  721. // CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [template = constants.%int_5.64b]
  722. // CHECK:STDOUT: %.loc15_35.1: %struct_type.m2.m1.5f2 = struct_literal (%int_3.loc15, %int_5)
  723. // CHECK:STDOUT: %.loc15_35.2: ref %ptr.454 = class_element_access %b2.var, element0
  724. // CHECK:STDOUT: %.loc15_35.3: ref %ptr.454 = vtable_ptr
  725. // CHECK:STDOUT: %.loc15_35.4: init %ptr.454 = initialize_from %.loc15_35.3 to %.loc15_35.2
  726. // CHECK:STDOUT: %impl.elem0.loc15_35.1: %Convert.type.1b6 = impl_witness_access constants.%impl_witness.d39, element0 [template = constants.%Convert.956]
  727. // CHECK:STDOUT: %Convert.bound.loc15_35.1: <bound method> = bound_method %int_5, %impl.elem0.loc15_35.1 [template = constants.%Convert.bound.4e6]
  728. // CHECK:STDOUT: %Convert.specific_fn.loc15_35.1: <specific function> = specific_function %Convert.bound.loc15_35.1, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.ba9]
  729. // CHECK:STDOUT: %int.convert_checked.loc15_35.1: init %i32 = call %Convert.specific_fn.loc15_35.1(%int_5) [template = constants.%int_5.0f6]
  730. // CHECK:STDOUT: %.loc15_35.5: init %i32 = converted %int_5, %int.convert_checked.loc15_35.1 [template = constants.%int_5.0f6]
  731. // CHECK:STDOUT: %.loc15_35.6: ref %i32 = class_element_access %b2.var, element2
  732. // CHECK:STDOUT: %.loc15_35.7: init %i32 = initialize_from %.loc15_35.5 to %.loc15_35.6 [template = constants.%int_5.0f6]
  733. // CHECK:STDOUT: %impl.elem0.loc15_35.2: %Convert.type.1b6 = impl_witness_access constants.%impl_witness.d39, element0 [template = constants.%Convert.956]
  734. // CHECK:STDOUT: %Convert.bound.loc15_35.2: <bound method> = bound_method %int_3.loc15, %impl.elem0.loc15_35.2 [template = constants.%Convert.bound.b30]
  735. // CHECK:STDOUT: %Convert.specific_fn.loc15_35.2: <specific function> = specific_function %Convert.bound.loc15_35.2, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.b42]
  736. // CHECK:STDOUT: %int.convert_checked.loc15_35.2: init %i32 = call %Convert.specific_fn.loc15_35.2(%int_3.loc15) [template = constants.%int_3.822]
  737. // CHECK:STDOUT: %.loc15_35.8: init %i32 = converted %int_3.loc15, %int.convert_checked.loc15_35.2 [template = constants.%int_3.822]
  738. // CHECK:STDOUT: %.loc15_35.9: ref %i32 = class_element_access %b2.var, element1
  739. // CHECK:STDOUT: %.loc15_35.10: init %i32 = initialize_from %.loc15_35.8 to %.loc15_35.9 [template = constants.%int_3.822]
  740. // CHECK:STDOUT: %.loc15_35.11: init %Base = class_init (%.loc15_35.4, %.loc15_35.7, %.loc15_35.10), %b2.var
  741. // CHECK:STDOUT: %.loc15_3.2: init %Base = converted %.loc15_35.1, %.loc15_35.11
  742. // CHECK:STDOUT: assign %b2.var, %.loc15_3.2
  743. // CHECK:STDOUT: %Base.ref.loc15: type = name_ref Base, file.%Base.decl [template = constants.%Base]
  744. // CHECK:STDOUT: %b2: ref %Base = bind_name b2, %b2.var
  745. // CHECK:STDOUT: %b1.ref: ref %Base = name_ref b1, %b1
  746. // CHECK:STDOUT: %m2.ref: %Base.elem = name_ref m2, @Base.%.loc6_9 [template = @Base.%.loc6_9]
  747. // CHECK:STDOUT: %.loc18_5: ref %i32 = class_element_access %b1.ref, element2
  748. // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [template = constants.%int_4.0c1]
  749. // CHECK:STDOUT: %impl.elem0.loc18: %Convert.type.1b6 = impl_witness_access constants.%impl_witness.d39, element0 [template = constants.%Convert.956]
  750. // CHECK:STDOUT: %Convert.bound.loc18: <bound method> = bound_method %int_4, %impl.elem0.loc18 [template = constants.%Convert.bound.ac3]
  751. // CHECK:STDOUT: %Convert.specific_fn.loc18: <specific function> = specific_function %Convert.bound.loc18, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn.450]
  752. // CHECK:STDOUT: %int.convert_checked.loc18: init %i32 = call %Convert.specific_fn.loc18(%int_4) [template = constants.%int_4.940]
  753. // CHECK:STDOUT: %.loc18_9: init %i32 = converted %int_4, %int.convert_checked.loc18 [template = constants.%int_4.940]
  754. // CHECK:STDOUT: assign %.loc18_5, %.loc18_9
  755. // CHECK:STDOUT: return
  756. // CHECK:STDOUT: }
  757. // CHECK:STDOUT:
  758. // CHECK:STDOUT: --- todo_fail_impl_without_base_declaration.carbon
  759. // CHECK:STDOUT:
  760. // CHECK:STDOUT: constants {
  761. // CHECK:STDOUT: %Base: type = class_type @Base [template]
  762. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  763. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [template]
  764. // CHECK:STDOUT: %Derived: type = class_type @Derived [template]
  765. // CHECK:STDOUT: %Derived.elem: type = unbound_element_type %Derived, %Base [template]
  766. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  767. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  768. // CHECK:STDOUT: %ptr.454: type = ptr_type <vtable> [template]
  769. // CHECK:STDOUT: %.f2b: <vtable> = vtable () [template]
  770. // CHECK:STDOUT: %struct_type.vptr.base: type = struct_type {.<vptr>: %ptr.454, .base: %Base} [template]
  771. // CHECK:STDOUT: %complete_type.336: <witness> = complete_type_witness %struct_type.vptr.base [template]
  772. // CHECK:STDOUT: }
  773. // CHECK:STDOUT:
  774. // CHECK:STDOUT: imports {
  775. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  776. // CHECK:STDOUT: import Core//prelude
  777. // CHECK:STDOUT: import Core//prelude/...
  778. // CHECK:STDOUT: }
  779. // CHECK:STDOUT: }
  780. // CHECK:STDOUT:
  781. // CHECK:STDOUT: file {
  782. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  783. // CHECK:STDOUT: .Core = imports.%Core
  784. // CHECK:STDOUT: .Base = %Base.decl
  785. // CHECK:STDOUT: .Derived = %Derived.decl
  786. // CHECK:STDOUT: }
  787. // CHECK:STDOUT: %Core.import = import Core
  788. // CHECK:STDOUT: %Base.decl: type = class_decl @Base [template = constants.%Base] {} {}
  789. // CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {} {}
  790. // CHECK:STDOUT: }
  791. // CHECK:STDOUT:
  792. // CHECK:STDOUT: class @Base {
  793. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type.357]
  794. // CHECK:STDOUT: complete_type_witness = %complete_type
  795. // CHECK:STDOUT:
  796. // CHECK:STDOUT: !members:
  797. // CHECK:STDOUT: .Self = constants.%Base
  798. // CHECK:STDOUT: }
  799. // CHECK:STDOUT:
  800. // CHECK:STDOUT: class @Derived {
  801. // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base]
  802. // CHECK:STDOUT: %.loc8: %Derived.elem = base_decl %Base.ref, element1 [template]
  803. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {}
  804. // CHECK:STDOUT: %.loc10: <vtable> = vtable () [template = constants.%.f2b]
  805. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.vptr.base [template = constants.%complete_type.336]
  806. // CHECK:STDOUT: complete_type_witness = %complete_type
  807. // CHECK:STDOUT:
  808. // CHECK:STDOUT: !members:
  809. // CHECK:STDOUT: .Self = constants.%Derived
  810. // CHECK:STDOUT: .base = %.loc8
  811. // CHECK:STDOUT: .F = %F.decl
  812. // CHECK:STDOUT: extend %Base.ref
  813. // CHECK:STDOUT: }
  814. // CHECK:STDOUT:
  815. // CHECK:STDOUT: impl fn @F();
  816. // CHECK:STDOUT:
  817. // CHECK:STDOUT: --- abstract_impl.carbon
  818. // CHECK:STDOUT:
  819. // CHECK:STDOUT: constants {
  820. // CHECK:STDOUT: %AbstractBase: type = class_type @AbstractBase [template]
  821. // CHECK:STDOUT: %F.type.85b: type = fn_type @F.1 [template]
  822. // CHECK:STDOUT: %F.6e9: %F.type.85b = struct_value () [template]
  823. // CHECK:STDOUT: %ptr.454: type = ptr_type <vtable> [template]
  824. // CHECK:STDOUT: %.6ec: <vtable> = vtable (%F.6e9) [template]
  825. // CHECK:STDOUT: %struct_type.vptr: type = struct_type {.<vptr>: %ptr.454} [template]
  826. // CHECK:STDOUT: %complete_type.513: <witness> = complete_type_witness %struct_type.vptr [template]
  827. // CHECK:STDOUT: %AbstractIntermediate: type = class_type @AbstractIntermediate [template]
  828. // CHECK:STDOUT: %AbstractIntermediate.elem: type = unbound_element_type %AbstractIntermediate, %AbstractBase [template]
  829. // CHECK:STDOUT: %struct_type.base.efd: type = struct_type {.base: %AbstractBase} [template]
  830. // CHECK:STDOUT: %complete_type.2d3: <witness> = complete_type_witness %struct_type.base.efd [template]
  831. // CHECK:STDOUT: %Derived: type = class_type @Derived [template]
  832. // CHECK:STDOUT: %Derived.elem: type = unbound_element_type %Derived, %AbstractIntermediate [template]
  833. // CHECK:STDOUT: %F.type.5da: type = fn_type @F.2 [template]
  834. // CHECK:STDOUT: %F.fa3: %F.type.5da = struct_value () [template]
  835. // CHECK:STDOUT: %.88d: <vtable> = vtable (%F.fa3) [template]
  836. // CHECK:STDOUT: %struct_type.base.da5: type = struct_type {.base: %AbstractIntermediate} [template]
  837. // CHECK:STDOUT: %complete_type.f8c: <witness> = complete_type_witness %struct_type.base.da5 [template]
  838. // CHECK:STDOUT: }
  839. // CHECK:STDOUT:
  840. // CHECK:STDOUT: imports {
  841. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  842. // CHECK:STDOUT: import Core//prelude
  843. // CHECK:STDOUT: import Core//prelude/...
  844. // CHECK:STDOUT: }
  845. // CHECK:STDOUT: }
  846. // CHECK:STDOUT:
  847. // CHECK:STDOUT: file {
  848. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  849. // CHECK:STDOUT: .Core = imports.%Core
  850. // CHECK:STDOUT: .AbstractBase = %AbstractBase.decl
  851. // CHECK:STDOUT: .AbstractIntermediate = %AbstractIntermediate.decl
  852. // CHECK:STDOUT: .Derived = %Derived.decl
  853. // CHECK:STDOUT: }
  854. // CHECK:STDOUT: %Core.import = import Core
  855. // CHECK:STDOUT: %AbstractBase.decl: type = class_decl @AbstractBase [template = constants.%AbstractBase] {} {}
  856. // CHECK:STDOUT: %AbstractIntermediate.decl: type = class_decl @AbstractIntermediate [template = constants.%AbstractIntermediate] {} {}
  857. // CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {} {}
  858. // CHECK:STDOUT: }
  859. // CHECK:STDOUT:
  860. // CHECK:STDOUT: class @AbstractBase {
  861. // CHECK:STDOUT: %F.decl: %F.type.85b = fn_decl @F.1 [template = constants.%F.6e9] {} {}
  862. // CHECK:STDOUT: %.loc6: <vtable> = vtable (%F.decl) [template = constants.%.6ec]
  863. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.vptr [template = constants.%complete_type.513]
  864. // CHECK:STDOUT: complete_type_witness = %complete_type
  865. // CHECK:STDOUT:
  866. // CHECK:STDOUT: !members:
  867. // CHECK:STDOUT: .Self = constants.%AbstractBase
  868. // CHECK:STDOUT: .F = %F.decl
  869. // CHECK:STDOUT: }
  870. // CHECK:STDOUT:
  871. // CHECK:STDOUT: class @AbstractIntermediate {
  872. // CHECK:STDOUT: %AbstractBase.ref: type = name_ref AbstractBase, file.%AbstractBase.decl [template = constants.%AbstractBase]
  873. // CHECK:STDOUT: %.loc9: %AbstractIntermediate.elem = base_decl %AbstractBase.ref, element0 [template]
  874. // CHECK:STDOUT: %.loc10: <vtable> = vtable (constants.%F.6e9) [template = constants.%.6ec]
  875. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.base.efd [template = constants.%complete_type.2d3]
  876. // CHECK:STDOUT: complete_type_witness = %complete_type
  877. // CHECK:STDOUT:
  878. // CHECK:STDOUT: !members:
  879. // CHECK:STDOUT: .Self = constants.%AbstractIntermediate
  880. // CHECK:STDOUT: .base = %.loc9
  881. // CHECK:STDOUT: extend %AbstractBase.ref
  882. // CHECK:STDOUT: }
  883. // CHECK:STDOUT:
  884. // CHECK:STDOUT: class @Derived {
  885. // CHECK:STDOUT: %AbstractIntermediate.ref: type = name_ref AbstractIntermediate, file.%AbstractIntermediate.decl [template = constants.%AbstractIntermediate]
  886. // CHECK:STDOUT: %.loc13: %Derived.elem = base_decl %AbstractIntermediate.ref, element0 [template]
  887. // CHECK:STDOUT: %F.decl: %F.type.5da = fn_decl @F.2 [template = constants.%F.fa3] {} {}
  888. // CHECK:STDOUT: %.loc15: <vtable> = vtable (%F.decl) [template = constants.%.88d]
  889. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.base.da5 [template = constants.%complete_type.f8c]
  890. // CHECK:STDOUT: complete_type_witness = %complete_type
  891. // CHECK:STDOUT:
  892. // CHECK:STDOUT: !members:
  893. // CHECK:STDOUT: .Self = constants.%Derived
  894. // CHECK:STDOUT: .base = %.loc13
  895. // CHECK:STDOUT: .F = %F.decl
  896. // CHECK:STDOUT: extend %AbstractIntermediate.ref
  897. // CHECK:STDOUT: }
  898. // CHECK:STDOUT:
  899. // CHECK:STDOUT: abstract fn @F.1();
  900. // CHECK:STDOUT:
  901. // CHECK:STDOUT: impl fn @F.2();
  902. // CHECK:STDOUT:
  903. // CHECK:STDOUT: --- virtual_impl.carbon
  904. // CHECK:STDOUT:
  905. // CHECK:STDOUT: constants {
  906. // CHECK:STDOUT: %VirtualBase: type = class_type @VirtualBase [template]
  907. // CHECK:STDOUT: %F.type.e62: type = fn_type @F.1 [template]
  908. // CHECK:STDOUT: %F.3e7: %F.type.e62 = struct_value () [template]
  909. // CHECK:STDOUT: %ptr.454: type = ptr_type <vtable> [template]
  910. // CHECK:STDOUT: %.def: <vtable> = vtable (%F.3e7) [template]
  911. // CHECK:STDOUT: %struct_type.vptr: type = struct_type {.<vptr>: %ptr.454} [template]
  912. // CHECK:STDOUT: %complete_type.513: <witness> = complete_type_witness %struct_type.vptr [template]
  913. // CHECK:STDOUT: %VirtualIntermediate: type = class_type @VirtualIntermediate [template]
  914. // CHECK:STDOUT: %VirtualIntermediate.elem: type = unbound_element_type %VirtualIntermediate, %VirtualBase [template]
  915. // CHECK:STDOUT: %struct_type.base.61e: type = struct_type {.base: %VirtualBase} [template]
  916. // CHECK:STDOUT: %complete_type.f09: <witness> = complete_type_witness %struct_type.base.61e [template]
  917. // CHECK:STDOUT: %Derived: type = class_type @Derived [template]
  918. // CHECK:STDOUT: %Derived.elem: type = unbound_element_type %Derived, %VirtualIntermediate [template]
  919. // CHECK:STDOUT: %F.type.5da: type = fn_type @F.2 [template]
  920. // CHECK:STDOUT: %F.fa3: %F.type.5da = struct_value () [template]
  921. // CHECK:STDOUT: %.88d: <vtable> = vtable (%F.fa3) [template]
  922. // CHECK:STDOUT: %struct_type.base.43c: type = struct_type {.base: %VirtualIntermediate} [template]
  923. // CHECK:STDOUT: %complete_type.fa6: <witness> = complete_type_witness %struct_type.base.43c [template]
  924. // CHECK:STDOUT: }
  925. // CHECK:STDOUT:
  926. // CHECK:STDOUT: imports {
  927. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  928. // CHECK:STDOUT: import Core//prelude
  929. // CHECK:STDOUT: import Core//prelude/...
  930. // CHECK:STDOUT: }
  931. // CHECK:STDOUT: }
  932. // CHECK:STDOUT:
  933. // CHECK:STDOUT: file {
  934. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  935. // CHECK:STDOUT: .Core = imports.%Core
  936. // CHECK:STDOUT: .VirtualBase = %VirtualBase.decl
  937. // CHECK:STDOUT: .VirtualIntermediate = %VirtualIntermediate.decl
  938. // CHECK:STDOUT: .Derived = %Derived.decl
  939. // CHECK:STDOUT: }
  940. // CHECK:STDOUT: %Core.import = import Core
  941. // CHECK:STDOUT: %VirtualBase.decl: type = class_decl @VirtualBase [template = constants.%VirtualBase] {} {}
  942. // CHECK:STDOUT: %VirtualIntermediate.decl: type = class_decl @VirtualIntermediate [template = constants.%VirtualIntermediate] {} {}
  943. // CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {} {}
  944. // CHECK:STDOUT: }
  945. // CHECK:STDOUT:
  946. // CHECK:STDOUT: class @VirtualBase {
  947. // CHECK:STDOUT: %F.decl: %F.type.e62 = fn_decl @F.1 [template = constants.%F.3e7] {} {}
  948. // CHECK:STDOUT: %.loc6: <vtable> = vtable (%F.decl) [template = constants.%.def]
  949. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.vptr [template = constants.%complete_type.513]
  950. // CHECK:STDOUT: complete_type_witness = %complete_type
  951. // CHECK:STDOUT:
  952. // CHECK:STDOUT: !members:
  953. // CHECK:STDOUT: .Self = constants.%VirtualBase
  954. // CHECK:STDOUT: .F = %F.decl
  955. // CHECK:STDOUT: }
  956. // CHECK:STDOUT:
  957. // CHECK:STDOUT: class @VirtualIntermediate {
  958. // CHECK:STDOUT: %VirtualBase.ref: type = name_ref VirtualBase, file.%VirtualBase.decl [template = constants.%VirtualBase]
  959. // CHECK:STDOUT: %.loc9: %VirtualIntermediate.elem = base_decl %VirtualBase.ref, element0 [template]
  960. // CHECK:STDOUT: %.loc10: <vtable> = vtable (constants.%F.3e7) [template = constants.%.def]
  961. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.base.61e [template = constants.%complete_type.f09]
  962. // CHECK:STDOUT: complete_type_witness = %complete_type
  963. // CHECK:STDOUT:
  964. // CHECK:STDOUT: !members:
  965. // CHECK:STDOUT: .Self = constants.%VirtualIntermediate
  966. // CHECK:STDOUT: .base = %.loc9
  967. // CHECK:STDOUT: extend %VirtualBase.ref
  968. // CHECK:STDOUT: }
  969. // CHECK:STDOUT:
  970. // CHECK:STDOUT: class @Derived {
  971. // CHECK:STDOUT: %VirtualIntermediate.ref: type = name_ref VirtualIntermediate, file.%VirtualIntermediate.decl [template = constants.%VirtualIntermediate]
  972. // CHECK:STDOUT: %.loc13: %Derived.elem = base_decl %VirtualIntermediate.ref, element0 [template]
  973. // CHECK:STDOUT: %F.decl: %F.type.5da = fn_decl @F.2 [template = constants.%F.fa3] {} {}
  974. // CHECK:STDOUT: %.loc15: <vtable> = vtable (%F.decl) [template = constants.%.88d]
  975. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.base.43c [template = constants.%complete_type.fa6]
  976. // CHECK:STDOUT: complete_type_witness = %complete_type
  977. // CHECK:STDOUT:
  978. // CHECK:STDOUT: !members:
  979. // CHECK:STDOUT: .Self = constants.%Derived
  980. // CHECK:STDOUT: .base = %.loc13
  981. // CHECK:STDOUT: .F = %F.decl
  982. // CHECK:STDOUT: extend %VirtualIntermediate.ref
  983. // CHECK:STDOUT: }
  984. // CHECK:STDOUT:
  985. // CHECK:STDOUT: virtual fn @F.1();
  986. // CHECK:STDOUT:
  987. // CHECK:STDOUT: impl fn @F.2();
  988. // CHECK:STDOUT: