base_method_qualified.carbon 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/int.carbon
  6. // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
  7. // EXTRA-ARGS: --dump-sem-ir-ranges=if-present
  8. //
  9. // AUTOUPDATE
  10. // TIP: To test this file alone, run:
  11. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/base_method_qualified.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/base_method_qualified.carbon
  14. class Derived;
  15. base class Base {
  16. fn F[self: Self]() -> i32;
  17. fn G[self: Derived]() -> i32;
  18. }
  19. class Derived {
  20. extend base: Base;
  21. fn F[self: Self]();
  22. fn G[self: Self]();
  23. }
  24. fn Call(a: Derived) -> i32 {
  25. return a.(Base.F)();
  26. }
  27. fn CallIndirect(p: Derived*) -> i32 {
  28. return p->(Base.F)();
  29. }
  30. fn PassDerivedToBase(a: Derived) -> i32 {
  31. return a.(Base.G)();
  32. }
  33. fn PassDerivedToBaseIndirect(p: Derived*) -> i32 {
  34. return p->(Base.G)();
  35. }
  36. // CHECK:STDOUT: --- base_method_qualified.carbon
  37. // CHECK:STDOUT:
  38. // CHECK:STDOUT: constants {
  39. // CHECK:STDOUT: %Derived: type = class_type @Derived [concrete]
  40. // CHECK:STDOUT: %Base: type = class_type @Base [concrete]
  41. // CHECK:STDOUT: %pattern_type.101: type = pattern_type %Base [concrete]
  42. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  43. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  44. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  45. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  46. // CHECK:STDOUT: %.4d5: form = init_form %i32, call_param1 [concrete]
  47. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  48. // CHECK:STDOUT: %Base.F.type: type = fn_type @Base.F [concrete]
  49. // CHECK:STDOUT: %Base.F: %Base.F.type = struct_value () [concrete]
  50. // CHECK:STDOUT: %pattern_type.9f6: type = pattern_type %Derived [concrete]
  51. // CHECK:STDOUT: %Base.G.type: type = fn_type @Base.G [concrete]
  52. // CHECK:STDOUT: %Base.G: %Base.G.type = struct_value () [concrete]
  53. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  54. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  55. // CHECK:STDOUT: %Derived.elem: type = unbound_element_type %Derived, %Base [concrete]
  56. // CHECK:STDOUT: %Derived.F.type: type = fn_type @Derived.F [concrete]
  57. // CHECK:STDOUT: %Derived.F: %Derived.F.type = struct_value () [concrete]
  58. // CHECK:STDOUT: %Derived.G.type: type = fn_type @Derived.G [concrete]
  59. // CHECK:STDOUT: %Derived.G: %Derived.G.type = struct_value () [concrete]
  60. // CHECK:STDOUT: %struct_type.base.27a: type = struct_type {.base: %Base} [concrete]
  61. // CHECK:STDOUT: %complete_type.5a1: <witness> = complete_type_witness %struct_type.base.27a [concrete]
  62. // CHECK:STDOUT: %Call.type: type = fn_type @Call [concrete]
  63. // CHECK:STDOUT: %Call: %Call.type = struct_value () [concrete]
  64. // CHECK:STDOUT: %ptr.f74: type = ptr_type %Derived [concrete]
  65. // CHECK:STDOUT: %pattern_type.0dd: type = pattern_type %ptr.f74 [concrete]
  66. // CHECK:STDOUT: %CallIndirect.type: type = fn_type @CallIndirect [concrete]
  67. // CHECK:STDOUT: %CallIndirect: %CallIndirect.type = struct_value () [concrete]
  68. // CHECK:STDOUT: %PassDerivedToBase.type: type = fn_type @PassDerivedToBase [concrete]
  69. // CHECK:STDOUT: %PassDerivedToBase: %PassDerivedToBase.type = struct_value () [concrete]
  70. // CHECK:STDOUT: %PassDerivedToBaseIndirect.type: type = fn_type @PassDerivedToBaseIndirect [concrete]
  71. // CHECK:STDOUT: %PassDerivedToBaseIndirect: %PassDerivedToBaseIndirect.type = struct_value () [concrete]
  72. // CHECK:STDOUT: }
  73. // CHECK:STDOUT:
  74. // CHECK:STDOUT: imports {
  75. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  76. // CHECK:STDOUT: .Int = %Core.Int
  77. // CHECK:STDOUT: import Core//prelude
  78. // CHECK:STDOUT: import Core//prelude/...
  79. // CHECK:STDOUT: }
  80. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  81. // CHECK:STDOUT: }
  82. // CHECK:STDOUT:
  83. // CHECK:STDOUT: file {
  84. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  85. // CHECK:STDOUT: .Core = imports.%Core
  86. // CHECK:STDOUT: .Derived = %Derived.decl.loc15
  87. // CHECK:STDOUT: .Base = %Base.decl
  88. // CHECK:STDOUT: .Call = %Call.decl
  89. // CHECK:STDOUT: .CallIndirect = %CallIndirect.decl
  90. // CHECK:STDOUT: .PassDerivedToBase = %PassDerivedToBase.decl
  91. // CHECK:STDOUT: .PassDerivedToBaseIndirect = %PassDerivedToBaseIndirect.decl
  92. // CHECK:STDOUT: }
  93. // CHECK:STDOUT: %Core.import = import Core
  94. // CHECK:STDOUT: %Derived.decl.loc15: type = class_decl @Derived [concrete = constants.%Derived] {} {}
  95. // CHECK:STDOUT: %Base.decl: type = class_decl @Base [concrete = constants.%Base] {} {}
  96. // CHECK:STDOUT: %Derived.decl.loc22: type = class_decl @Derived [concrete = constants.%Derived] {} {}
  97. // CHECK:STDOUT: %Call.decl: %Call.type = fn_decl @Call [concrete = constants.%Call] {
  98. // CHECK:STDOUT: %a.patt: %pattern_type.9f6 = value_binding_pattern a [concrete]
  99. // CHECK:STDOUT: %a.param_patt: %pattern_type.9f6 = value_param_pattern %a.patt, call_param0 [concrete]
  100. // CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern [concrete]
  101. // CHECK:STDOUT: %return.param_patt: %pattern_type.7ce = out_param_pattern %return.patt, call_param1 [concrete]
  102. // CHECK:STDOUT: } {
  103. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  104. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  105. // CHECK:STDOUT: %.loc29: form = init_form %i32, call_param1 [concrete = constants.%.4d5]
  106. // CHECK:STDOUT: %a.param: %Derived = value_param call_param0
  107. // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl.loc15 [concrete = constants.%Derived]
  108. // CHECK:STDOUT: %a: %Derived = value_binding a, %a.param
  109. // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param1
  110. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  111. // CHECK:STDOUT: }
  112. // CHECK:STDOUT: %CallIndirect.decl: %CallIndirect.type = fn_decl @CallIndirect [concrete = constants.%CallIndirect] {
  113. // CHECK:STDOUT: %p.patt: %pattern_type.0dd = value_binding_pattern p [concrete]
  114. // CHECK:STDOUT: %p.param_patt: %pattern_type.0dd = value_param_pattern %p.patt, call_param0 [concrete]
  115. // CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern [concrete]
  116. // CHECK:STDOUT: %return.param_patt: %pattern_type.7ce = out_param_pattern %return.patt, call_param1 [concrete]
  117. // CHECK:STDOUT: } {
  118. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  119. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  120. // CHECK:STDOUT: %.loc33_33: form = init_form %i32, call_param1 [concrete = constants.%.4d5]
  121. // CHECK:STDOUT: %p.param: %ptr.f74 = value_param call_param0
  122. // CHECK:STDOUT: %.loc33_27: type = splice_block %ptr [concrete = constants.%ptr.f74] {
  123. // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl.loc15 [concrete = constants.%Derived]
  124. // CHECK:STDOUT: %ptr: type = ptr_type %Derived.ref [concrete = constants.%ptr.f74]
  125. // CHECK:STDOUT: }
  126. // CHECK:STDOUT: %p: %ptr.f74 = value_binding p, %p.param
  127. // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param1
  128. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  129. // CHECK:STDOUT: }
  130. // CHECK:STDOUT: %PassDerivedToBase.decl: %PassDerivedToBase.type = fn_decl @PassDerivedToBase [concrete = constants.%PassDerivedToBase] {
  131. // CHECK:STDOUT: %a.patt: %pattern_type.9f6 = value_binding_pattern a [concrete]
  132. // CHECK:STDOUT: %a.param_patt: %pattern_type.9f6 = value_param_pattern %a.patt, call_param0 [concrete]
  133. // CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern [concrete]
  134. // CHECK:STDOUT: %return.param_patt: %pattern_type.7ce = out_param_pattern %return.patt, call_param1 [concrete]
  135. // CHECK:STDOUT: } {
  136. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  137. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  138. // CHECK:STDOUT: %.loc37: form = init_form %i32, call_param1 [concrete = constants.%.4d5]
  139. // CHECK:STDOUT: %a.param: %Derived = value_param call_param0
  140. // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl.loc15 [concrete = constants.%Derived]
  141. // CHECK:STDOUT: %a: %Derived = value_binding a, %a.param
  142. // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param1
  143. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  144. // CHECK:STDOUT: }
  145. // CHECK:STDOUT: %PassDerivedToBaseIndirect.decl: %PassDerivedToBaseIndirect.type = fn_decl @PassDerivedToBaseIndirect [concrete = constants.%PassDerivedToBaseIndirect] {
  146. // CHECK:STDOUT: %p.patt: %pattern_type.0dd = value_binding_pattern p [concrete]
  147. // CHECK:STDOUT: %p.param_patt: %pattern_type.0dd = value_param_pattern %p.patt, call_param0 [concrete]
  148. // CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern [concrete]
  149. // CHECK:STDOUT: %return.param_patt: %pattern_type.7ce = out_param_pattern %return.patt, call_param1 [concrete]
  150. // CHECK:STDOUT: } {
  151. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  152. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  153. // CHECK:STDOUT: %.loc41_46: form = init_form %i32, call_param1 [concrete = constants.%.4d5]
  154. // CHECK:STDOUT: %p.param: %ptr.f74 = value_param call_param0
  155. // CHECK:STDOUT: %.loc41_40: type = splice_block %ptr [concrete = constants.%ptr.f74] {
  156. // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl.loc15 [concrete = constants.%Derived]
  157. // CHECK:STDOUT: %ptr: type = ptr_type %Derived.ref [concrete = constants.%ptr.f74]
  158. // CHECK:STDOUT: }
  159. // CHECK:STDOUT: %p: %ptr.f74 = value_binding p, %p.param
  160. // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param1
  161. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  162. // CHECK:STDOUT: }
  163. // CHECK:STDOUT: }
  164. // CHECK:STDOUT:
  165. // CHECK:STDOUT: class @Derived {
  166. // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [concrete = constants.%Base]
  167. // CHECK:STDOUT: %.loc23: %Derived.elem = base_decl %Base.ref, element0 [concrete]
  168. // CHECK:STDOUT: %Derived.F.decl: %Derived.F.type = fn_decl @Derived.F [concrete = constants.%Derived.F] {
  169. // CHECK:STDOUT: %self.patt: %pattern_type.9f6 = value_binding_pattern self [concrete]
  170. // CHECK:STDOUT: %self.param_patt: %pattern_type.9f6 = value_param_pattern %self.patt, call_param0 [concrete]
  171. // CHECK:STDOUT: } {
  172. // CHECK:STDOUT: %self.param: %Derived = value_param call_param0
  173. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Derived [concrete = constants.%Derived]
  174. // CHECK:STDOUT: %self: %Derived = value_binding self, %self.param
  175. // CHECK:STDOUT: }
  176. // CHECK:STDOUT: %Derived.G.decl: %Derived.G.type = fn_decl @Derived.G [concrete = constants.%Derived.G] {
  177. // CHECK:STDOUT: %self.patt: %pattern_type.9f6 = value_binding_pattern self [concrete]
  178. // CHECK:STDOUT: %self.param_patt: %pattern_type.9f6 = value_param_pattern %self.patt, call_param0 [concrete]
  179. // CHECK:STDOUT: } {
  180. // CHECK:STDOUT: %self.param: %Derived = value_param call_param0
  181. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Derived [concrete = constants.%Derived]
  182. // CHECK:STDOUT: %self: %Derived = value_binding self, %self.param
  183. // CHECK:STDOUT: }
  184. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%struct_type.base.27a [concrete = constants.%complete_type.5a1]
  185. // CHECK:STDOUT: complete_type_witness = %complete_type
  186. // CHECK:STDOUT:
  187. // CHECK:STDOUT: !members:
  188. // CHECK:STDOUT: .Self = constants.%Derived
  189. // CHECK:STDOUT: .Base = <poisoned>
  190. // CHECK:STDOUT: .base = %.loc23
  191. // CHECK:STDOUT: .F = %Derived.F.decl
  192. // CHECK:STDOUT: .G = %Derived.G.decl
  193. // CHECK:STDOUT: extend %Base.ref
  194. // CHECK:STDOUT: }
  195. // CHECK:STDOUT:
  196. // CHECK:STDOUT: class @Base {
  197. // CHECK:STDOUT: %Base.F.decl: %Base.F.type = fn_decl @Base.F [concrete = constants.%Base.F] {
  198. // CHECK:STDOUT: %self.patt: %pattern_type.101 = value_binding_pattern self [concrete]
  199. // CHECK:STDOUT: %self.param_patt: %pattern_type.101 = value_param_pattern %self.patt, call_param0 [concrete]
  200. // CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern [concrete]
  201. // CHECK:STDOUT: %return.param_patt: %pattern_type.7ce = out_param_pattern %return.patt, call_param1 [concrete]
  202. // CHECK:STDOUT: } {
  203. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  204. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  205. // CHECK:STDOUT: %.loc18: form = init_form %i32, call_param1 [concrete = constants.%.4d5]
  206. // CHECK:STDOUT: %self.param: %Base = value_param call_param0
  207. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Base [concrete = constants.%Base]
  208. // CHECK:STDOUT: %self: %Base = value_binding self, %self.param
  209. // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param1
  210. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  211. // CHECK:STDOUT: }
  212. // CHECK:STDOUT: %Base.G.decl: %Base.G.type = fn_decl @Base.G [concrete = constants.%Base.G] {
  213. // CHECK:STDOUT: %self.patt: %pattern_type.9f6 = value_binding_pattern self [concrete]
  214. // CHECK:STDOUT: %self.param_patt: %pattern_type.9f6 = value_param_pattern %self.patt, call_param0 [concrete]
  215. // CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern [concrete]
  216. // CHECK:STDOUT: %return.param_patt: %pattern_type.7ce = out_param_pattern %return.patt, call_param1 [concrete]
  217. // CHECK:STDOUT: } {
  218. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  219. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  220. // CHECK:STDOUT: %.loc19: form = init_form %i32, call_param1 [concrete = constants.%.4d5]
  221. // CHECK:STDOUT: %self.param: %Derived = value_param call_param0
  222. // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl.loc15 [concrete = constants.%Derived]
  223. // CHECK:STDOUT: %self: %Derived = value_binding self, %self.param
  224. // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param1
  225. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  226. // CHECK:STDOUT: }
  227. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357]
  228. // CHECK:STDOUT: complete_type_witness = %complete_type
  229. // CHECK:STDOUT:
  230. // CHECK:STDOUT: !members:
  231. // CHECK:STDOUT: .Self = constants.%Base
  232. // CHECK:STDOUT: .F = %Base.F.decl
  233. // CHECK:STDOUT: .Derived = <poisoned>
  234. // CHECK:STDOUT: .G = %Base.G.decl
  235. // CHECK:STDOUT: }
  236. // CHECK:STDOUT:
  237. // CHECK:STDOUT: fn @Base.F(%self.param: %Base) -> %i32;
  238. // CHECK:STDOUT:
  239. // CHECK:STDOUT: fn @Base.G(%self.param: %Derived) -> %i32;
  240. // CHECK:STDOUT:
  241. // CHECK:STDOUT: fn @Derived.F(%self.param: %Derived);
  242. // CHECK:STDOUT:
  243. // CHECK:STDOUT: fn @Derived.G(%self.param: %Derived);
  244. // CHECK:STDOUT:
  245. // CHECK:STDOUT: fn @Call(%a.param: %Derived) -> %i32 {
  246. // CHECK:STDOUT: !entry:
  247. // CHECK:STDOUT: %a.ref: %Derived = name_ref a, %a
  248. // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [concrete = constants.%Base]
  249. // CHECK:STDOUT: %F.ref: %Base.F.type = name_ref F, @Base.%Base.F.decl [concrete = constants.%Base.F]
  250. // CHECK:STDOUT: %Base.F.bound: <bound method> = bound_method %a.ref, %F.ref
  251. // CHECK:STDOUT: %.loc30_10.1: ref %Base = class_element_access %a.ref, element0
  252. // CHECK:STDOUT: %.loc30_10.2: ref %Base = converted %a.ref, %.loc30_10.1
  253. // CHECK:STDOUT: %.loc30_10.3: %Base = acquire_value %.loc30_10.2
  254. // CHECK:STDOUT: %Base.F.call: init %i32 = call %Base.F.bound(%.loc30_10.3)
  255. // CHECK:STDOUT: return %Base.F.call to %return
  256. // CHECK:STDOUT: }
  257. // CHECK:STDOUT:
  258. // CHECK:STDOUT: fn @CallIndirect(%p.param: %ptr.f74) -> %i32 {
  259. // CHECK:STDOUT: !entry:
  260. // CHECK:STDOUT: %p.ref: %ptr.f74 = name_ref p, %p
  261. // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [concrete = constants.%Base]
  262. // CHECK:STDOUT: %F.ref: %Base.F.type = name_ref F, @Base.%Base.F.decl [concrete = constants.%Base.F]
  263. // CHECK:STDOUT: %.loc34_11.1: ref %Derived = deref %p.ref
  264. // CHECK:STDOUT: %Base.F.bound: <bound method> = bound_method %.loc34_11.1, %F.ref
  265. // CHECK:STDOUT: %.loc34_11.2: ref %Base = class_element_access %.loc34_11.1, element0
  266. // CHECK:STDOUT: %.loc34_11.3: ref %Base = converted %.loc34_11.1, %.loc34_11.2
  267. // CHECK:STDOUT: %.loc34_11.4: %Base = acquire_value %.loc34_11.3
  268. // CHECK:STDOUT: %Base.F.call: init %i32 = call %Base.F.bound(%.loc34_11.4)
  269. // CHECK:STDOUT: return %Base.F.call to %return
  270. // CHECK:STDOUT: }
  271. // CHECK:STDOUT:
  272. // CHECK:STDOUT: fn @PassDerivedToBase(%a.param: %Derived) -> %i32 {
  273. // CHECK:STDOUT: !entry:
  274. // CHECK:STDOUT: %a.ref: %Derived = name_ref a, %a
  275. // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [concrete = constants.%Base]
  276. // CHECK:STDOUT: %G.ref: %Base.G.type = name_ref G, @Base.%Base.G.decl [concrete = constants.%Base.G]
  277. // CHECK:STDOUT: %Base.G.bound: <bound method> = bound_method %a.ref, %G.ref
  278. // CHECK:STDOUT: %Base.G.call: init %i32 = call %Base.G.bound(%a.ref)
  279. // CHECK:STDOUT: return %Base.G.call to %return
  280. // CHECK:STDOUT: }
  281. // CHECK:STDOUT:
  282. // CHECK:STDOUT: fn @PassDerivedToBaseIndirect(%p.param: %ptr.f74) -> %i32 {
  283. // CHECK:STDOUT: !entry:
  284. // CHECK:STDOUT: %p.ref: %ptr.f74 = name_ref p, %p
  285. // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [concrete = constants.%Base]
  286. // CHECK:STDOUT: %G.ref: %Base.G.type = name_ref G, @Base.%Base.G.decl [concrete = constants.%Base.G]
  287. // CHECK:STDOUT: %.loc42_11.1: ref %Derived = deref %p.ref
  288. // CHECK:STDOUT: %Base.G.bound: <bound method> = bound_method %.loc42_11.1, %G.ref
  289. // CHECK:STDOUT: %.loc42_11.2: %Derived = acquire_value %.loc42_11.1
  290. // CHECK:STDOUT: %Base.G.call: init %i32 = call %Base.G.bound(%.loc42_11.2)
  291. // CHECK:STDOUT: return %Base.G.call to %return
  292. // CHECK:STDOUT: }
  293. // CHECK:STDOUT: