self_conversion.carbon 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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/self_conversion.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/self_conversion.carbon
  14. base class Base {
  15. var a: i32;
  16. }
  17. class Derived {
  18. extend base: Base;
  19. fn SelfBase[self: Base]() -> i32;
  20. fn RefSelfBase[ref self: Base]();
  21. }
  22. fn Derived.SelfBase[self: Base]() -> i32 {
  23. return self.a;
  24. }
  25. fn Derived.RefSelfBase[ref self: Base]() {
  26. self.a = 1;
  27. }
  28. fn Call(p: Derived*) -> i32 {
  29. (*p).RefSelfBase();
  30. return (*p).SelfBase();
  31. }
  32. // CHECK:STDOUT: --- self_conversion.carbon
  33. // CHECK:STDOUT:
  34. // CHECK:STDOUT: constants {
  35. // CHECK:STDOUT: %Base: type = class_type @Base [concrete]
  36. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  37. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  38. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  39. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  40. // CHECK:STDOUT: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic]
  41. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  42. // CHECK:STDOUT: %Base.elem: type = unbound_element_type %Base, %i32 [concrete]
  43. // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %i32} [concrete]
  44. // CHECK:STDOUT: %complete_type.fd7: <witness> = complete_type_witness %struct_type.a [concrete]
  45. // CHECK:STDOUT: %Derived: type = class_type @Derived [concrete]
  46. // CHECK:STDOUT: %Derived.elem: type = unbound_element_type %Derived, %Base [concrete]
  47. // CHECK:STDOUT: %pattern_type.bcc: type = pattern_type %Base [concrete]
  48. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  49. // CHECK:STDOUT: %Derived.SelfBase.type: type = fn_type @Derived.SelfBase [concrete]
  50. // CHECK:STDOUT: %Derived.SelfBase: %Derived.SelfBase.type = struct_value () [concrete]
  51. // CHECK:STDOUT: %Derived.RefSelfBase.type: type = fn_type @Derived.RefSelfBase [concrete]
  52. // CHECK:STDOUT: %Derived.RefSelfBase: %Derived.RefSelfBase.type = struct_value () [concrete]
  53. // CHECK:STDOUT: %struct_type.base.b1e: type = struct_type {.base: %Base} [concrete]
  54. // CHECK:STDOUT: %complete_type.15c: <witness> = complete_type_witness %struct_type.base.b1e [concrete]
  55. // CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete]
  56. // CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete]
  57. // CHECK:STDOUT: %Int.as.Copy.impl.Op.type.24b: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%N) [symbolic]
  58. // CHECK:STDOUT: %Int.as.Copy.impl.Op.c95: %Int.as.Copy.impl.Op.type.24b = struct_value () [symbolic]
  59. // CHECK:STDOUT: %Copy.impl_witness.fb7: <witness> = impl_witness imports.%Copy.impl_witness_table.b6a, @Int.as.Copy.impl(%int_32) [concrete]
  60. // CHECK:STDOUT: %Int.as.Copy.impl.Op.type.469: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%int_32) [concrete]
  61. // CHECK:STDOUT: %Int.as.Copy.impl.Op.dfd: %Int.as.Copy.impl.Op.type.469 = struct_value () [concrete]
  62. // CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %i32, (%Copy.impl_witness.fb7) [concrete]
  63. // CHECK:STDOUT: %.65f: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet [concrete]
  64. // CHECK:STDOUT: %Int.as.Copy.impl.Op.specific_fn: <specific function> = specific_function %Int.as.Copy.impl.Op.dfd, @Int.as.Copy.impl.Op(%int_32) [concrete]
  65. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  66. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  67. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  68. // CHECK:STDOUT: %ImplicitAs.type.d14: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  69. // CHECK:STDOUT: %ImplicitAs.Convert.type.1b6: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%i32) [concrete]
  70. // CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
  71. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.f51: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%To) [symbolic]
  72. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.2a1: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.f51 = struct_value () [symbolic]
  73. // CHECK:STDOUT: %ImplicitAs.impl_witness.bc9: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.132, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  74. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.51e: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  75. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.51e = struct_value () [concrete]
  76. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.d14 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.bc9) [concrete]
  77. // CHECK:STDOUT: %.322: type = fn_type_with_self_type %ImplicitAs.Convert.type.1b6, %ImplicitAs.facet [concrete]
  78. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b [concrete]
  79. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b, @Core.IntLiteral.as.ImplicitAs.impl.Convert(%int_32) [concrete]
  80. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  81. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  82. // CHECK:STDOUT: %ptr.404: type = ptr_type %Derived [concrete]
  83. // CHECK:STDOUT: %pattern_type.605: type = pattern_type %ptr.404 [concrete]
  84. // CHECK:STDOUT: %Call.type: type = fn_type @Call [concrete]
  85. // CHECK:STDOUT: %Call: %Call.type = struct_value () [concrete]
  86. // CHECK:STDOUT: }
  87. // CHECK:STDOUT:
  88. // CHECK:STDOUT: imports {
  89. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  90. // CHECK:STDOUT: .Int = %Core.Int
  91. // CHECK:STDOUT: .Copy = %Core.Copy
  92. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  93. // CHECK:STDOUT: import Core//prelude
  94. // CHECK:STDOUT: import Core//prelude/...
  95. // CHECK:STDOUT: }
  96. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  97. // CHECK:STDOUT: %Core.Copy: type = import_ref Core//prelude/parts/copy, Copy, loaded [concrete = constants.%Copy.type]
  98. // CHECK:STDOUT: %Core.import_ref.d12: @Int.as.Copy.impl.%Int.as.Copy.impl.Op.type (%Int.as.Copy.impl.Op.type.24b) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Int.as.Copy.impl.%Int.as.Copy.impl.Op (constants.%Int.as.Copy.impl.Op.c95)]
  99. // CHECK:STDOUT: %Copy.impl_witness_table.b6a = impl_witness_table (%Core.import_ref.d12), @Int.as.Copy.impl [concrete]
  100. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  101. // CHECK:STDOUT: %Core.import_ref.e24: @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.f51) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert (constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.2a1)]
  102. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.132 = impl_witness_table (%Core.import_ref.e24), @Core.IntLiteral.as.ImplicitAs.impl [concrete]
  103. // CHECK:STDOUT: }
  104. // CHECK:STDOUT:
  105. // CHECK:STDOUT: file {
  106. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  107. // CHECK:STDOUT: .Core = imports.%Core
  108. // CHECK:STDOUT: .Base = %Base.decl
  109. // CHECK:STDOUT: .Derived = %Derived.decl
  110. // CHECK:STDOUT: .Call = %Call.decl
  111. // CHECK:STDOUT: }
  112. // CHECK:STDOUT: %Core.import = import Core
  113. // CHECK:STDOUT: %Base.decl: type = class_decl @Base [concrete = constants.%Base] {} {}
  114. // CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [concrete = constants.%Derived] {} {}
  115. // CHECK:STDOUT: %Derived.SelfBase.decl: %Derived.SelfBase.type = fn_decl @Derived.SelfBase [concrete = constants.%Derived.SelfBase] {
  116. // CHECK:STDOUT: %self.patt: %pattern_type.bcc = value_binding_pattern self [concrete]
  117. // CHECK:STDOUT: %self.param_patt: %pattern_type.bcc = value_param_pattern %self.patt, call_param0 [concrete]
  118. // CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern [concrete]
  119. // CHECK:STDOUT: %return.param_patt: %pattern_type.7ce = out_param_pattern %return.patt, call_param1 [concrete]
  120. // CHECK:STDOUT: } {
  121. // CHECK:STDOUT: %int_32.loc26: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  122. // CHECK:STDOUT: %i32.loc26: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  123. // CHECK:STDOUT: %self.param.loc26: %Base = value_param call_param0
  124. // CHECK:STDOUT: %Base.ref.loc26: type = name_ref Base, file.%Base.decl [concrete = constants.%Base]
  125. // CHECK:STDOUT: %self.loc26: %Base = value_binding self, %self.param.loc26
  126. // CHECK:STDOUT: %return.param.loc26: ref %i32 = out_param call_param1
  127. // CHECK:STDOUT: %return.loc26: ref %i32 = return_slot %return.param.loc26
  128. // CHECK:STDOUT: }
  129. // CHECK:STDOUT: %Derived.RefSelfBase.decl: %Derived.RefSelfBase.type = fn_decl @Derived.RefSelfBase [concrete = constants.%Derived.RefSelfBase] {
  130. // CHECK:STDOUT: %self.patt: %pattern_type.bcc = ref_binding_pattern self [concrete]
  131. // CHECK:STDOUT: %self.param_patt: %pattern_type.bcc = ref_param_pattern %self.patt, call_param0 [concrete]
  132. // CHECK:STDOUT: } {
  133. // CHECK:STDOUT: %self.param.loc30: ref %Base = ref_param call_param0
  134. // CHECK:STDOUT: %Base.ref.loc30: type = name_ref Base, file.%Base.decl [concrete = constants.%Base]
  135. // CHECK:STDOUT: %self.loc30: ref %Base = ref_binding self, %self.param.loc30
  136. // CHECK:STDOUT: }
  137. // CHECK:STDOUT: %Call.decl: %Call.type = fn_decl @Call [concrete = constants.%Call] {
  138. // CHECK:STDOUT: %p.patt: %pattern_type.605 = value_binding_pattern p [concrete]
  139. // CHECK:STDOUT: %p.param_patt: %pattern_type.605 = value_param_pattern %p.patt, call_param0 [concrete]
  140. // CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern [concrete]
  141. // CHECK:STDOUT: %return.param_patt: %pattern_type.7ce = out_param_pattern %return.patt, call_param1 [concrete]
  142. // CHECK:STDOUT: } {
  143. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  144. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  145. // CHECK:STDOUT: %p.param: %ptr.404 = value_param call_param0
  146. // CHECK:STDOUT: %.loc34: type = splice_block %ptr [concrete = constants.%ptr.404] {
  147. // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl [concrete = constants.%Derived]
  148. // CHECK:STDOUT: %ptr: type = ptr_type %Derived.ref [concrete = constants.%ptr.404]
  149. // CHECK:STDOUT: }
  150. // CHECK:STDOUT: %p: %ptr.404 = value_binding p, %p.param
  151. // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param1
  152. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  153. // CHECK:STDOUT: }
  154. // CHECK:STDOUT: }
  155. // CHECK:STDOUT:
  156. // CHECK:STDOUT: class @Base {
  157. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  158. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  159. // CHECK:STDOUT: %.loc16: %Base.elem = field_decl a, element0 [concrete]
  160. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%struct_type.a [concrete = constants.%complete_type.fd7]
  161. // CHECK:STDOUT: complete_type_witness = %complete_type
  162. // CHECK:STDOUT:
  163. // CHECK:STDOUT: !members:
  164. // CHECK:STDOUT: .Self = constants.%Base
  165. // CHECK:STDOUT: .a = %.loc16
  166. // CHECK:STDOUT: .Base = <poisoned>
  167. // CHECK:STDOUT: }
  168. // CHECK:STDOUT:
  169. // CHECK:STDOUT: class @Derived {
  170. // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [concrete = constants.%Base]
  171. // CHECK:STDOUT: %.loc20: %Derived.elem = base_decl %Base.ref, element0 [concrete]
  172. // CHECK:STDOUT: %Derived.SelfBase.decl: %Derived.SelfBase.type = fn_decl @Derived.SelfBase [concrete = constants.%Derived.SelfBase] {
  173. // CHECK:STDOUT: %self.patt: %pattern_type.bcc = value_binding_pattern self [concrete]
  174. // CHECK:STDOUT: %self.param_patt: %pattern_type.bcc = value_param_pattern %self.patt, call_param0 [concrete]
  175. // CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern [concrete]
  176. // CHECK:STDOUT: %return.param_patt: %pattern_type.7ce = out_param_pattern %return.patt, call_param1 [concrete]
  177. // CHECK:STDOUT: } {
  178. // CHECK:STDOUT: %int_32.loc22: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  179. // CHECK:STDOUT: %i32.loc22: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  180. // CHECK:STDOUT: %self.param.loc22: %Base = value_param call_param0
  181. // CHECK:STDOUT: %Base.ref.loc22: type = name_ref Base, file.%Base.decl [concrete = constants.%Base]
  182. // CHECK:STDOUT: %self.loc22: %Base = value_binding self, %self.param.loc22
  183. // CHECK:STDOUT: %return.param.loc22: ref %i32 = out_param call_param1
  184. // CHECK:STDOUT: %return.loc22: ref %i32 = return_slot %return.param.loc22
  185. // CHECK:STDOUT: }
  186. // CHECK:STDOUT: %Derived.RefSelfBase.decl: %Derived.RefSelfBase.type = fn_decl @Derived.RefSelfBase [concrete = constants.%Derived.RefSelfBase] {
  187. // CHECK:STDOUT: %self.patt: %pattern_type.bcc = ref_binding_pattern self [concrete]
  188. // CHECK:STDOUT: %self.param_patt: %pattern_type.bcc = ref_param_pattern %self.patt, call_param0 [concrete]
  189. // CHECK:STDOUT: } {
  190. // CHECK:STDOUT: %self.param.loc23: ref %Base = ref_param call_param0
  191. // CHECK:STDOUT: %Base.ref.loc23: type = name_ref Base, file.%Base.decl [concrete = constants.%Base]
  192. // CHECK:STDOUT: %self.loc23: ref %Base = ref_binding self, %self.param.loc23
  193. // CHECK:STDOUT: }
  194. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%struct_type.base.b1e [concrete = constants.%complete_type.15c]
  195. // CHECK:STDOUT: complete_type_witness = %complete_type
  196. // CHECK:STDOUT:
  197. // CHECK:STDOUT: !members:
  198. // CHECK:STDOUT: .Self = constants.%Derived
  199. // CHECK:STDOUT: .Base = <poisoned>
  200. // CHECK:STDOUT: .base = %.loc20
  201. // CHECK:STDOUT: .SelfBase = %Derived.SelfBase.decl
  202. // CHECK:STDOUT: .RefSelfBase = %Derived.RefSelfBase.decl
  203. // CHECK:STDOUT: extend %Base.ref
  204. // CHECK:STDOUT: }
  205. // CHECK:STDOUT:
  206. // CHECK:STDOUT: fn @Derived.SelfBase(%self.param.loc26: %Base) -> %i32 {
  207. // CHECK:STDOUT: !entry:
  208. // CHECK:STDOUT: %self.ref: %Base = name_ref self, %self.loc26
  209. // CHECK:STDOUT: %a.ref: %Base.elem = name_ref a, @Base.%.loc16 [concrete = @Base.%.loc16]
  210. // CHECK:STDOUT: %.loc27_14.1: ref %i32 = class_element_access %self.ref, element0
  211. // CHECK:STDOUT: %.loc27_14.2: %i32 = acquire_value %.loc27_14.1
  212. // CHECK:STDOUT: %impl.elem0: %.65f = impl_witness_access constants.%Copy.impl_witness.fb7, element0 [concrete = constants.%Int.as.Copy.impl.Op.dfd]
  213. // CHECK:STDOUT: %bound_method.loc27_14.1: <bound method> = bound_method %.loc27_14.2, %impl.elem0
  214. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  215. // CHECK:STDOUT: %bound_method.loc27_14.2: <bound method> = bound_method %.loc27_14.2, %specific_fn
  216. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc27_14.2(%.loc27_14.2)
  217. // CHECK:STDOUT: return %Int.as.Copy.impl.Op.call to %return.loc26
  218. // CHECK:STDOUT: }
  219. // CHECK:STDOUT:
  220. // CHECK:STDOUT: fn @Derived.RefSelfBase(%self.param.loc30: %Base) {
  221. // CHECK:STDOUT: !entry:
  222. // CHECK:STDOUT: %self.ref: ref %Base = name_ref self, %self.loc30
  223. // CHECK:STDOUT: %a.ref: %Base.elem = name_ref a, @Base.%.loc16 [concrete = @Base.%.loc16]
  224. // CHECK:STDOUT: %.loc31_7: ref %i32 = class_element_access %self.ref, element0
  225. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  226. // CHECK:STDOUT: %impl.elem0: %.322 = impl_witness_access constants.%ImplicitAs.impl_witness.bc9, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b]
  227. // CHECK:STDOUT: %bound_method.loc31_10.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
  228. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  229. // CHECK:STDOUT: %bound_method.loc31_10.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  230. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc31_10.2(%int_1) [concrete = constants.%int_1.5d2]
  231. // CHECK:STDOUT: %.loc31_10: init %i32 = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_1.5d2]
  232. // CHECK:STDOUT: assign %.loc31_7, %.loc31_10
  233. // CHECK:STDOUT: return
  234. // CHECK:STDOUT: }
  235. // CHECK:STDOUT:
  236. // CHECK:STDOUT: fn @Call(%p.param: %ptr.404) -> %i32 {
  237. // CHECK:STDOUT: !entry:
  238. // CHECK:STDOUT: %p.ref.loc35: %ptr.404 = name_ref p, %p
  239. // CHECK:STDOUT: %.loc35_4.1: ref %Derived = deref %p.ref.loc35
  240. // CHECK:STDOUT: %RefSelfBase.ref: %Derived.RefSelfBase.type = name_ref RefSelfBase, @Derived.%Derived.RefSelfBase.decl [concrete = constants.%Derived.RefSelfBase]
  241. // CHECK:STDOUT: %Derived.RefSelfBase.bound: <bound method> = bound_method %.loc35_4.1, %RefSelfBase.ref
  242. // CHECK:STDOUT: %.loc35_4.2: ref %Base = class_element_access %.loc35_4.1, element0
  243. // CHECK:STDOUT: %.loc35_4.3: ref %Base = converted %.loc35_4.1, %.loc35_4.2
  244. // CHECK:STDOUT: %Derived.RefSelfBase.call: init %empty_tuple.type = call %Derived.RefSelfBase.bound(%.loc35_4.3)
  245. // CHECK:STDOUT: %p.ref.loc36: %ptr.404 = name_ref p, %p
  246. // CHECK:STDOUT: %.loc36_11.1: ref %Derived = deref %p.ref.loc36
  247. // CHECK:STDOUT: %SelfBase.ref: %Derived.SelfBase.type = name_ref SelfBase, @Derived.%Derived.SelfBase.decl [concrete = constants.%Derived.SelfBase]
  248. // CHECK:STDOUT: %Derived.SelfBase.bound: <bound method> = bound_method %.loc36_11.1, %SelfBase.ref
  249. // CHECK:STDOUT: %.loc36_11.2: ref %Base = class_element_access %.loc36_11.1, element0
  250. // CHECK:STDOUT: %.loc36_11.3: ref %Base = converted %.loc36_11.1, %.loc36_11.2
  251. // CHECK:STDOUT: %.loc36_11.4: %Base = acquire_value %.loc36_11.3
  252. // CHECK:STDOUT: %Derived.SelfBase.call: init %i32 = call %Derived.SelfBase.bound(%.loc36_11.4)
  253. // CHECK:STDOUT: return %Derived.SelfBase.call to %return
  254. // CHECK:STDOUT: }
  255. // CHECK:STDOUT: