method.carbon 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  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. // EXTRA-ARGS: --clang-arg=-std=c++23
  7. //
  8. // AUTOUPDATE
  9. // TIP: To test this file alone, run:
  10. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/class/method.carbon
  11. // TIP: To dump output, run:
  12. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/class/method.carbon
  13. // --- object_param_qualifiers.h
  14. struct HasQualifiers {
  15. void plain();
  16. void const_this() const;
  17. void volatile_this() volatile;
  18. void ref_this() &;
  19. void const_ref_this() const&;
  20. void ref_ref_this() &&;
  21. void const_ref_ref_this() const&&;
  22. };
  23. // --- use_object_param_qualifiers.carbon
  24. library "[[@TEST_NAME]]";
  25. import Cpp library "object_param_qualifiers.h";
  26. fn F(v: Cpp.HasQualifiers, p: Cpp.HasQualifiers*) {
  27. //@dump-sem-ir-begin
  28. v.const_this();
  29. v.const_ref_this();
  30. p->plain();
  31. p->ref_this();
  32. p->const_this();
  33. p->const_ref_this();
  34. //@dump-sem-ir-end
  35. }
  36. // --- fail_bad_object_param_qualifiers_by_value.carbon
  37. library "[[@TEST_NAME]]";
  38. import Cpp library "object_param_qualifiers.h";
  39. fn Value(v: Cpp.HasQualifiers) {
  40. // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+5]]:3: error: `addr self` method cannot be invoked on a value [AddrSelfIsNonRef]
  41. // CHECK:STDERR: v.plain();
  42. // CHECK:STDERR: ^
  43. // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon: note: initializing function parameter [InCallToFunctionParam]
  44. // CHECK:STDERR:
  45. v.plain();
  46. // TODO: This should remain invalid once we support `volatile`.
  47. // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: object parameter type: volatile struct HasQualifiers` [SemanticsTodo]
  48. // CHECK:STDERR: v.volatile_this();
  49. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  50. // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `volatile_this` [InCppNameLookup]
  51. // CHECK:STDERR: v.volatile_this();
  52. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  53. // CHECK:STDERR:
  54. v.volatile_this();
  55. // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+5]]:3: error: `addr self` method cannot be invoked on a value [AddrSelfIsNonRef]
  56. // CHECK:STDERR: v.ref_this();
  57. // CHECK:STDERR: ^
  58. // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon: note: initializing function parameter [InCallToFunctionParam]
  59. // CHECK:STDERR:
  60. v.ref_this();
  61. // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: object parameter type: struct HasQualifiers &&` [SemanticsTodo]
  62. // CHECK:STDERR: v.ref_ref_this();
  63. // CHECK:STDERR: ^~~~~~~~~~~~~~
  64. // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `ref_ref_this` [InCppNameLookup]
  65. // CHECK:STDERR: v.ref_ref_this();
  66. // CHECK:STDERR: ^~~~~~~~~~~~~~
  67. // CHECK:STDERR:
  68. v.ref_ref_this();
  69. // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: object parameter type: const struct HasQualifiers &&` [SemanticsTodo]
  70. // CHECK:STDERR: v.const_ref_ref_this();
  71. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
  72. // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `const_ref_ref_this` [InCppNameLookup]
  73. // CHECK:STDERR: v.const_ref_ref_this();
  74. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
  75. // CHECK:STDERR:
  76. v.const_ref_ref_this();
  77. }
  78. // --- fail_todo_bad_object_param_qualifiers_by_ref.carbon
  79. library "[[@TEST_NAME]]";
  80. import Cpp library "object_param_qualifiers.h";
  81. fn Ref(p: Cpp.HasQualifiers*) {
  82. // TODO: This should eventually be accepted if we support `volatile`.
  83. // CHECK:STDERR: fail_todo_bad_object_param_qualifiers_by_ref.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: object parameter type: volatile struct HasQualifiers` [SemanticsTodo]
  84. // CHECK:STDERR: p->volatile_this();
  85. // CHECK:STDERR: ^~~~~~~~~~~~~~~~
  86. // CHECK:STDERR: fail_todo_bad_object_param_qualifiers_by_ref.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `volatile_this` [InCppNameLookup]
  87. // CHECK:STDERR: p->volatile_this();
  88. // CHECK:STDERR: ^~~~~~~~~~~~~~~~
  89. // CHECK:STDERR:
  90. p->volatile_this();
  91. }
  92. // --- fail_bad_object_param_qualifiers_ref_ref.carbon
  93. library "[[@TEST_NAME]]";
  94. import Cpp library "object_param_qualifiers.h";
  95. fn Ref(p: Cpp.HasQualifiers*) {
  96. // CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: object parameter type: struct HasQualifiers &&` [SemanticsTodo]
  97. // CHECK:STDERR: p->ref_ref_this();
  98. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  99. // CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `ref_ref_this` [InCppNameLookup]
  100. // CHECK:STDERR: p->ref_ref_this();
  101. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  102. // CHECK:STDERR:
  103. p->ref_ref_this();
  104. // CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: object parameter type: const struct HasQualifiers &&` [SemanticsTodo]
  105. // CHECK:STDERR: p->const_ref_ref_this();
  106. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
  107. // CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `const_ref_ref_this` [InCppNameLookup]
  108. // CHECK:STDERR: p->const_ref_ref_this();
  109. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
  110. // CHECK:STDERR:
  111. p->const_ref_ref_this();
  112. }
  113. // --- explicit_object_param.h
  114. struct Another {
  115. };
  116. struct ExplicitObjectParam {
  117. void F(this ExplicitObjectParam);
  118. void G(this int);
  119. void H(this Another);
  120. };
  121. // --- call_explicit_object_param.carbon
  122. library "[[@TEST_NAME]]";
  123. import Cpp library "explicit_object_param.h";
  124. fn Call(e: Cpp.ExplicitObjectParam, n: i32, a: Cpp.Another) {
  125. //@dump-sem-ir-begin
  126. e.F();
  127. n.(Cpp.ExplicitObjectParam.G)();
  128. a.(Cpp.ExplicitObjectParam.H)();
  129. //@dump-sem-ir-end
  130. }
  131. // CHECK:STDOUT: --- use_object_param_qualifiers.carbon
  132. // CHECK:STDOUT:
  133. // CHECK:STDOUT: constants {
  134. // CHECK:STDOUT: %HasQualifiers: type = class_type @HasQualifiers [concrete]
  135. // CHECK:STDOUT: %ptr.ec3: type = ptr_type %HasQualifiers [concrete]
  136. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  137. // CHECK:STDOUT: %HasQualifiers.const_this.type: type = fn_type @HasQualifiers.const_this [concrete]
  138. // CHECK:STDOUT: %HasQualifiers.const_this: %HasQualifiers.const_this.type = struct_value () [concrete]
  139. // CHECK:STDOUT: %const: type = const_type %HasQualifiers [concrete]
  140. // CHECK:STDOUT: %ptr.2cb: type = ptr_type %const [concrete]
  141. // CHECK:STDOUT: %const_this__carbon_thunk.type: type = fn_type @const_this__carbon_thunk [concrete]
  142. // CHECK:STDOUT: %const_this__carbon_thunk: %const_this__carbon_thunk.type = struct_value () [concrete]
  143. // CHECK:STDOUT: %HasQualifiers.const_ref_this.type: type = fn_type @HasQualifiers.const_ref_this [concrete]
  144. // CHECK:STDOUT: %HasQualifiers.const_ref_this: %HasQualifiers.const_ref_this.type = struct_value () [concrete]
  145. // CHECK:STDOUT: %const_ref_this__carbon_thunk.type: type = fn_type @const_ref_this__carbon_thunk [concrete]
  146. // CHECK:STDOUT: %const_ref_this__carbon_thunk: %const_ref_this__carbon_thunk.type = struct_value () [concrete]
  147. // CHECK:STDOUT: %HasQualifiers.plain.type: type = fn_type @HasQualifiers.plain [concrete]
  148. // CHECK:STDOUT: %HasQualifiers.plain: %HasQualifiers.plain.type = struct_value () [concrete]
  149. // CHECK:STDOUT: %HasQualifiers.ref_this.type: type = fn_type @HasQualifiers.ref_this [concrete]
  150. // CHECK:STDOUT: %HasQualifiers.ref_this: %HasQualifiers.ref_this.type = struct_value () [concrete]
  151. // CHECK:STDOUT: }
  152. // CHECK:STDOUT:
  153. // CHECK:STDOUT: imports {
  154. // CHECK:STDOUT: %HasQualifiers.const_this.decl: %HasQualifiers.const_this.type = fn_decl @HasQualifiers.const_this [concrete = constants.%HasQualifiers.const_this] {
  155. // CHECK:STDOUT: <elided>
  156. // CHECK:STDOUT: } {
  157. // CHECK:STDOUT: <elided>
  158. // CHECK:STDOUT: }
  159. // CHECK:STDOUT: %const_this__carbon_thunk.decl: %const_this__carbon_thunk.type = fn_decl @const_this__carbon_thunk [concrete = constants.%const_this__carbon_thunk] {
  160. // CHECK:STDOUT: <elided>
  161. // CHECK:STDOUT: } {
  162. // CHECK:STDOUT: <elided>
  163. // CHECK:STDOUT: }
  164. // CHECK:STDOUT: %HasQualifiers.const_ref_this.decl: %HasQualifiers.const_ref_this.type = fn_decl @HasQualifiers.const_ref_this [concrete = constants.%HasQualifiers.const_ref_this] {
  165. // CHECK:STDOUT: <elided>
  166. // CHECK:STDOUT: } {
  167. // CHECK:STDOUT: <elided>
  168. // CHECK:STDOUT: }
  169. // CHECK:STDOUT: %const_ref_this__carbon_thunk.decl: %const_ref_this__carbon_thunk.type = fn_decl @const_ref_this__carbon_thunk [concrete = constants.%const_ref_this__carbon_thunk] {
  170. // CHECK:STDOUT: <elided>
  171. // CHECK:STDOUT: } {
  172. // CHECK:STDOUT: <elided>
  173. // CHECK:STDOUT: }
  174. // CHECK:STDOUT: %HasQualifiers.plain.decl: %HasQualifiers.plain.type = fn_decl @HasQualifiers.plain [concrete = constants.%HasQualifiers.plain] {
  175. // CHECK:STDOUT: <elided>
  176. // CHECK:STDOUT: } {
  177. // CHECK:STDOUT: <elided>
  178. // CHECK:STDOUT: }
  179. // CHECK:STDOUT: %HasQualifiers.ref_this.decl: %HasQualifiers.ref_this.type = fn_decl @HasQualifiers.ref_this [concrete = constants.%HasQualifiers.ref_this] {
  180. // CHECK:STDOUT: <elided>
  181. // CHECK:STDOUT: } {
  182. // CHECK:STDOUT: <elided>
  183. // CHECK:STDOUT: }
  184. // CHECK:STDOUT: }
  185. // CHECK:STDOUT:
  186. // CHECK:STDOUT: fn @F(%v.param: %HasQualifiers, %p.param: %ptr.ec3) {
  187. // CHECK:STDOUT: !entry:
  188. // CHECK:STDOUT: %v.ref.loc8: %HasQualifiers = name_ref v, %v
  189. // CHECK:STDOUT: %const_this.ref.loc8: %HasQualifiers.const_this.type = name_ref const_this, imports.%HasQualifiers.const_this.decl [concrete = constants.%HasQualifiers.const_this]
  190. // CHECK:STDOUT: %HasQualifiers.const_this.bound.loc8: <bound method> = bound_method %v.ref.loc8, %const_this.ref.loc8
  191. // CHECK:STDOUT: %.loc8_3: ref %HasQualifiers = value_as_ref %v.ref.loc8
  192. // CHECK:STDOUT: %addr.loc8: %ptr.ec3 = addr_of %.loc8_3
  193. // CHECK:STDOUT: %.loc8_16.1: %ptr.2cb = as_compatible %addr.loc8
  194. // CHECK:STDOUT: %.loc8_16.2: %ptr.2cb = converted %addr.loc8, %.loc8_16.1
  195. // CHECK:STDOUT: %const_this__carbon_thunk.call.loc8: init %empty_tuple.type = call imports.%const_this__carbon_thunk.decl(%.loc8_16.2)
  196. // CHECK:STDOUT: %v.ref.loc9: %HasQualifiers = name_ref v, %v
  197. // CHECK:STDOUT: %const_ref_this.ref.loc9: %HasQualifiers.const_ref_this.type = name_ref const_ref_this, imports.%HasQualifiers.const_ref_this.decl [concrete = constants.%HasQualifiers.const_ref_this]
  198. // CHECK:STDOUT: %HasQualifiers.const_ref_this.bound.loc9: <bound method> = bound_method %v.ref.loc9, %const_ref_this.ref.loc9
  199. // CHECK:STDOUT: %.loc9_3: ref %HasQualifiers = value_as_ref %v.ref.loc9
  200. // CHECK:STDOUT: %addr.loc9: %ptr.ec3 = addr_of %.loc9_3
  201. // CHECK:STDOUT: %.loc9_20.1: %ptr.2cb = as_compatible %addr.loc9
  202. // CHECK:STDOUT: %.loc9_20.2: %ptr.2cb = converted %addr.loc9, %.loc9_20.1
  203. // CHECK:STDOUT: %const_ref_this__carbon_thunk.call.loc9: init %empty_tuple.type = call imports.%const_ref_this__carbon_thunk.decl(%.loc9_20.2)
  204. // CHECK:STDOUT: %p.ref.loc11: %ptr.ec3 = name_ref p, %p
  205. // CHECK:STDOUT: %.loc11: ref %HasQualifiers = deref %p.ref.loc11
  206. // CHECK:STDOUT: %plain.ref: %HasQualifiers.plain.type = name_ref plain, imports.%HasQualifiers.plain.decl [concrete = constants.%HasQualifiers.plain]
  207. // CHECK:STDOUT: %HasQualifiers.plain.bound: <bound method> = bound_method %.loc11, %plain.ref
  208. // CHECK:STDOUT: %addr.loc11: %ptr.ec3 = addr_of %.loc11
  209. // CHECK:STDOUT: %HasQualifiers.plain.call: init %empty_tuple.type = call %HasQualifiers.plain.bound(%addr.loc11)
  210. // CHECK:STDOUT: %p.ref.loc12: %ptr.ec3 = name_ref p, %p
  211. // CHECK:STDOUT: %.loc12: ref %HasQualifiers = deref %p.ref.loc12
  212. // CHECK:STDOUT: %ref_this.ref: %HasQualifiers.ref_this.type = name_ref ref_this, imports.%HasQualifiers.ref_this.decl [concrete = constants.%HasQualifiers.ref_this]
  213. // CHECK:STDOUT: %HasQualifiers.ref_this.bound: <bound method> = bound_method %.loc12, %ref_this.ref
  214. // CHECK:STDOUT: %addr.loc12: %ptr.ec3 = addr_of %.loc12
  215. // CHECK:STDOUT: %HasQualifiers.ref_this.call: init %empty_tuple.type = call %HasQualifiers.ref_this.bound(%addr.loc12)
  216. // CHECK:STDOUT: %p.ref.loc13: %ptr.ec3 = name_ref p, %p
  217. // CHECK:STDOUT: %.loc13_4.1: ref %HasQualifiers = deref %p.ref.loc13
  218. // CHECK:STDOUT: %const_this.ref.loc13: %HasQualifiers.const_this.type = name_ref const_this, imports.%HasQualifiers.const_this.decl [concrete = constants.%HasQualifiers.const_this]
  219. // CHECK:STDOUT: %HasQualifiers.const_this.bound.loc13: <bound method> = bound_method %.loc13_4.1, %const_this.ref.loc13
  220. // CHECK:STDOUT: %.loc13_4.2: %HasQualifiers = bind_value %.loc13_4.1
  221. // CHECK:STDOUT: %.loc13_4.3: ref %HasQualifiers = value_as_ref %.loc13_4.2
  222. // CHECK:STDOUT: %addr.loc13: %ptr.ec3 = addr_of %.loc13_4.3
  223. // CHECK:STDOUT: %.loc13_17.1: %ptr.2cb = as_compatible %addr.loc13
  224. // CHECK:STDOUT: %.loc13_17.2: %ptr.2cb = converted %addr.loc13, %.loc13_17.1
  225. // CHECK:STDOUT: %const_this__carbon_thunk.call.loc13: init %empty_tuple.type = call imports.%const_this__carbon_thunk.decl(%.loc13_17.2)
  226. // CHECK:STDOUT: %p.ref.loc14: %ptr.ec3 = name_ref p, %p
  227. // CHECK:STDOUT: %.loc14_4.1: ref %HasQualifiers = deref %p.ref.loc14
  228. // CHECK:STDOUT: %const_ref_this.ref.loc14: %HasQualifiers.const_ref_this.type = name_ref const_ref_this, imports.%HasQualifiers.const_ref_this.decl [concrete = constants.%HasQualifiers.const_ref_this]
  229. // CHECK:STDOUT: %HasQualifiers.const_ref_this.bound.loc14: <bound method> = bound_method %.loc14_4.1, %const_ref_this.ref.loc14
  230. // CHECK:STDOUT: %.loc14_4.2: %HasQualifiers = bind_value %.loc14_4.1
  231. // CHECK:STDOUT: %.loc14_4.3: ref %HasQualifiers = value_as_ref %.loc14_4.2
  232. // CHECK:STDOUT: %addr.loc14: %ptr.ec3 = addr_of %.loc14_4.3
  233. // CHECK:STDOUT: %.loc14_21.1: %ptr.2cb = as_compatible %addr.loc14
  234. // CHECK:STDOUT: %.loc14_21.2: %ptr.2cb = converted %addr.loc14, %.loc14_21.1
  235. // CHECK:STDOUT: %const_ref_this__carbon_thunk.call.loc14: init %empty_tuple.type = call imports.%const_ref_this__carbon_thunk.decl(%.loc14_21.2)
  236. // CHECK:STDOUT: <elided>
  237. // CHECK:STDOUT: }
  238. // CHECK:STDOUT:
  239. // CHECK:STDOUT: --- call_explicit_object_param.carbon
  240. // CHECK:STDOUT:
  241. // CHECK:STDOUT: constants {
  242. // CHECK:STDOUT: %ExplicitObjectParam: type = class_type @ExplicitObjectParam [concrete]
  243. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  244. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  245. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  246. // CHECK:STDOUT: %Another: type = class_type @Another [concrete]
  247. // CHECK:STDOUT: %ExplicitObjectParam.F.type: type = fn_type @ExplicitObjectParam.F [concrete]
  248. // CHECK:STDOUT: %ExplicitObjectParam.F: %ExplicitObjectParam.F.type = struct_value () [concrete]
  249. // CHECK:STDOUT: %ptr.7f5: type = ptr_type %ExplicitObjectParam [concrete]
  250. // CHECK:STDOUT: %F__carbon_thunk.type: type = fn_type @F__carbon_thunk [concrete]
  251. // CHECK:STDOUT: %F__carbon_thunk: %F__carbon_thunk.type = struct_value () [concrete]
  252. // CHECK:STDOUT: %ExplicitObjectParam.G.type: type = fn_type @ExplicitObjectParam.G [concrete]
  253. // CHECK:STDOUT: %ExplicitObjectParam.G: %ExplicitObjectParam.G.type = struct_value () [concrete]
  254. // CHECK:STDOUT: %ExplicitObjectParam.H.type: type = fn_type @ExplicitObjectParam.H [concrete]
  255. // CHECK:STDOUT: %ExplicitObjectParam.H: %ExplicitObjectParam.H.type = struct_value () [concrete]
  256. // CHECK:STDOUT: %ptr.289: type = ptr_type %Another [concrete]
  257. // CHECK:STDOUT: %H__carbon_thunk.type: type = fn_type @H__carbon_thunk [concrete]
  258. // CHECK:STDOUT: %H__carbon_thunk: %H__carbon_thunk.type = struct_value () [concrete]
  259. // CHECK:STDOUT: }
  260. // CHECK:STDOUT:
  261. // CHECK:STDOUT: imports {
  262. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  263. // CHECK:STDOUT: .ExplicitObjectParam = %ExplicitObjectParam.decl
  264. // CHECK:STDOUT: .Another = %Another.decl
  265. // CHECK:STDOUT: import Cpp//...
  266. // CHECK:STDOUT: }
  267. // CHECK:STDOUT: %ExplicitObjectParam.decl: type = class_decl @ExplicitObjectParam [concrete = constants.%ExplicitObjectParam] {} {}
  268. // CHECK:STDOUT: %Another.decl: type = class_decl @Another [concrete = constants.%Another] {} {}
  269. // CHECK:STDOUT: %ExplicitObjectParam.F.decl: %ExplicitObjectParam.F.type = fn_decl @ExplicitObjectParam.F [concrete = constants.%ExplicitObjectParam.F] {
  270. // CHECK:STDOUT: <elided>
  271. // CHECK:STDOUT: } {
  272. // CHECK:STDOUT: <elided>
  273. // CHECK:STDOUT: }
  274. // CHECK:STDOUT: %F__carbon_thunk.decl: %F__carbon_thunk.type = fn_decl @F__carbon_thunk [concrete = constants.%F__carbon_thunk] {
  275. // CHECK:STDOUT: <elided>
  276. // CHECK:STDOUT: } {
  277. // CHECK:STDOUT: <elided>
  278. // CHECK:STDOUT: }
  279. // CHECK:STDOUT: %ExplicitObjectParam.G.decl: %ExplicitObjectParam.G.type = fn_decl @ExplicitObjectParam.G [concrete = constants.%ExplicitObjectParam.G] {
  280. // CHECK:STDOUT: <elided>
  281. // CHECK:STDOUT: } {
  282. // CHECK:STDOUT: <elided>
  283. // CHECK:STDOUT: }
  284. // CHECK:STDOUT: %ExplicitObjectParam.H.decl: %ExplicitObjectParam.H.type = fn_decl @ExplicitObjectParam.H [concrete = constants.%ExplicitObjectParam.H] {
  285. // CHECK:STDOUT: <elided>
  286. // CHECK:STDOUT: } {
  287. // CHECK:STDOUT: <elided>
  288. // CHECK:STDOUT: }
  289. // CHECK:STDOUT: %H__carbon_thunk.decl: %H__carbon_thunk.type = fn_decl @H__carbon_thunk [concrete = constants.%H__carbon_thunk] {
  290. // CHECK:STDOUT: <elided>
  291. // CHECK:STDOUT: } {
  292. // CHECK:STDOUT: <elided>
  293. // CHECK:STDOUT: }
  294. // CHECK:STDOUT: }
  295. // CHECK:STDOUT:
  296. // CHECK:STDOUT: fn @Call(%e.param: %ExplicitObjectParam, %n.param: %i32, %a.param: %Another) {
  297. // CHECK:STDOUT: !entry:
  298. // CHECK:STDOUT: %e.ref: %ExplicitObjectParam = name_ref e, %e
  299. // CHECK:STDOUT: %F.ref: %ExplicitObjectParam.F.type = name_ref F, imports.%ExplicitObjectParam.F.decl [concrete = constants.%ExplicitObjectParam.F]
  300. // CHECK:STDOUT: %ExplicitObjectParam.F.bound: <bound method> = bound_method %e.ref, %F.ref
  301. // CHECK:STDOUT: %.loc8: ref %ExplicitObjectParam = value_as_ref %e.ref
  302. // CHECK:STDOUT: %addr.loc8: %ptr.7f5 = addr_of %.loc8
  303. // CHECK:STDOUT: %F__carbon_thunk.call: init %empty_tuple.type = call imports.%F__carbon_thunk.decl(%addr.loc8)
  304. // CHECK:STDOUT: %n.ref: %i32 = name_ref n, %n
  305. // CHECK:STDOUT: %Cpp.ref.loc9: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  306. // CHECK:STDOUT: %ExplicitObjectParam.ref.loc9: type = name_ref ExplicitObjectParam, imports.%ExplicitObjectParam.decl [concrete = constants.%ExplicitObjectParam]
  307. // CHECK:STDOUT: %G.ref: %ExplicitObjectParam.G.type = name_ref G, imports.%ExplicitObjectParam.G.decl [concrete = constants.%ExplicitObjectParam.G]
  308. // CHECK:STDOUT: %ExplicitObjectParam.G.bound: <bound method> = bound_method %n.ref, %G.ref
  309. // CHECK:STDOUT: %ExplicitObjectParam.G.call: init %empty_tuple.type = call %ExplicitObjectParam.G.bound(%n.ref)
  310. // CHECK:STDOUT: %a.ref: %Another = name_ref a, %a
  311. // CHECK:STDOUT: %Cpp.ref.loc10: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  312. // CHECK:STDOUT: %ExplicitObjectParam.ref.loc10: type = name_ref ExplicitObjectParam, imports.%ExplicitObjectParam.decl [concrete = constants.%ExplicitObjectParam]
  313. // CHECK:STDOUT: %H.ref: %ExplicitObjectParam.H.type = name_ref H, imports.%ExplicitObjectParam.H.decl [concrete = constants.%ExplicitObjectParam.H]
  314. // CHECK:STDOUT: %ExplicitObjectParam.H.bound: <bound method> = bound_method %a.ref, %H.ref
  315. // CHECK:STDOUT: %.loc10: ref %Another = value_as_ref %a.ref
  316. // CHECK:STDOUT: %addr.loc10: %ptr.289 = addr_of %.loc10
  317. // CHECK:STDOUT: %H__carbon_thunk.call: init %empty_tuple.type = call imports.%H__carbon_thunk.decl(%addr.loc10)
  318. // CHECK:STDOUT: <elided>
  319. // CHECK:STDOUT: }
  320. // CHECK:STDOUT: