destroy.carbon 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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/convert.carbon
  6. // EXTRA-ARGS: --clang-arg=--std=c++20
  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/impls/destroy.carbon
  11. // TIP: To dump output, run:
  12. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/impls/destroy.carbon
  13. // --- types.h
  14. class PublicDestructor {
  15. public:
  16. ~PublicDestructor();
  17. };
  18. class TrivialDestructor {
  19. public:
  20. ~TrivialDestructor() = default;
  21. };
  22. template<int N = 0>
  23. class AmbiguousDestructorT {
  24. public:
  25. ~AmbiguousDestructorT() requires (N != 1);
  26. ~AmbiguousDestructorT() requires (N != 2);
  27. };
  28. using AmbiguousDestructor = AmbiguousDestructorT<>;
  29. class DeletedDestructor {
  30. public:
  31. ~DeletedDestructor() = delete;
  32. };
  33. class PrivateDestructor {
  34. private:
  35. ~PrivateDestructor();
  36. };
  37. class ProtectedDestructor {
  38. protected:
  39. ~ProtectedDestructor();
  40. };
  41. // --- destroy_destroyable.carbon
  42. library "[[@TEST_NAME]]";
  43. import Cpp library "types.h";
  44. fn PublicDestroy() {
  45. //@dump-sem-ir-begin
  46. var a: Cpp.PublicDestructor = {};
  47. //@dump-sem-ir-end
  48. }
  49. fn TrivialDestroy() {
  50. //@dump-sem-ir-begin
  51. var a: Cpp.TrivialDestructor = {};
  52. //@dump-sem-ir-end
  53. }
  54. // --- destroy_protected_base_destructor.carbon
  55. library "[[@TEST_NAME]]";
  56. import Cpp library "types.h";
  57. class Derived {
  58. extend base: Cpp.ProtectedDestructor;
  59. }
  60. fn DestroyClassWithProtectedBaseDestructor() {
  61. //@dump-sem-ir-begin
  62. var a: Derived = {.base = {}};
  63. //@dump-sem-ir-end
  64. }
  65. // --- todo_fail_destroy_private_base_destructor.carbon
  66. library "[[@TEST_NAME]]";
  67. import Cpp library "types.h";
  68. class Derived {
  69. extend base: Cpp.PrivateDestructor;
  70. }
  71. fn DestroyClassWithPrivateBaseDestructor() {
  72. //@dump-sem-ir-begin
  73. // TODO: We should not allow this, as the destructor of the base class is private.
  74. var a: Derived = {.base = {}};
  75. //@dump-sem-ir-end
  76. }
  77. // --- fail_destroy_nondestroyable.carbon
  78. library "[[@TEST_NAME]]";
  79. // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+16]]:10: in file included here [InCppInclude]
  80. // CHECK:STDERR: ./types.h:13:7: error: destructor of class 'AmbiguousDestructorT<>' is ambiguous [CppInteropParseError]
  81. // CHECK:STDERR: 13 | class AmbiguousDestructorT {
  82. // CHECK:STDERR: | ^
  83. // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+12]]:10: in file included here [InCppInclude]
  84. // CHECK:STDERR: ./types.h:13:7: note: in instantiation of template class 'AmbiguousDestructorT<>' requested here [CppInteropParseNote]
  85. // CHECK:STDERR: 13 | class AmbiguousDestructorT {
  86. // CHECK:STDERR: | ^
  87. // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+8]]:10: in file included here [InCppInclude]
  88. // CHECK:STDERR: ./types.h:15:3: note: candidate function [CppInteropParseNote]
  89. // CHECK:STDERR: 15 | ~AmbiguousDestructorT() requires (N != 1);
  90. // CHECK:STDERR: | ^
  91. // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+4]]:10: in file included here [InCppInclude]
  92. // CHECK:STDERR: ./types.h:16:3: note: candidate function [CppInteropParseNote]
  93. // CHECK:STDERR: 16 | ~AmbiguousDestructorT() requires (N != 2);
  94. // CHECK:STDERR: | ^
  95. import Cpp library "types.h";
  96. fn AmbiguousDestroy() {
  97. // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+4]]:10: note: while completing C++ type `Cpp.AmbiguousDestructorT` [InCppTypeCompletion]
  98. // CHECK:STDERR: var a: Cpp.AmbiguousDestructor = {};
  99. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~
  100. // CHECK:STDERR:
  101. var a: Cpp.AmbiguousDestructor = {};
  102. }
  103. fn DeletedDestroy() {
  104. // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+8]]:3: error: attempt to use a deleted function [CppInteropParseError]
  105. // CHECK:STDERR: 39 | var a: Cpp.DeletedDestructor = {};
  106. // CHECK:STDERR: | ^
  107. // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE-14]]:10: in file included here [InCppInclude]
  108. // CHECK:STDERR: ./types.h:23:3: note: '~DeletedDestructor' has been explicitly marked deleted here [CppInteropParseNote]
  109. // CHECK:STDERR: 23 | ~DeletedDestructor() = delete;
  110. // CHECK:STDERR: | ^
  111. // CHECK:STDERR:
  112. var a: Cpp.DeletedDestructor = {};
  113. }
  114. fn PrivateDestroy() {
  115. // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+5]]:3: error: cannot access private member `<C++ destructor>` of type `Cpp.PrivateDestructor` [ClassInvalidMemberAccess]
  116. // CHECK:STDERR: var a: Cpp.PrivateDestructor = {};
  117. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  118. // CHECK:STDERR: fail_destroy_nondestroyable.carbon: note: declared here [ClassMemberDeclaration]
  119. // CHECK:STDERR:
  120. var a: Cpp.PrivateDestructor = {};
  121. }
  122. fn ProtectedDestroy() {
  123. // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+5]]:3: error: cannot access protected member `<C++ destructor>` of type `Cpp.ProtectedDestructor` [ClassInvalidMemberAccess]
  124. // CHECK:STDERR: var a: Cpp.ProtectedDestructor = {};
  125. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  126. // CHECK:STDERR: fail_destroy_nondestroyable.carbon: note: declared here [ClassMemberDeclaration]
  127. // CHECK:STDERR:
  128. var a: Cpp.ProtectedDestructor = {};
  129. }
  130. // --- destroy_generically.carbon
  131. library "[[@TEST_NAME]]";
  132. import Cpp library "types.h";
  133. fn Destroy[T:! Core.Copy & Core.Destroy](c: T) {
  134. var d: T = c;
  135. }
  136. fn DoDestroy() {
  137. Destroy({} as Cpp.PublicDestructor);
  138. }
  139. class Wrap(T:! Core.Destroy) {}
  140. fn EqualWitnesses(p: Wrap(Cpp.PublicDestructor)*) -> Wrap(Cpp.PublicDestructor)* {
  141. return p;
  142. }
  143. // CHECK:STDOUT: --- destroy_destroyable.carbon
  144. // CHECK:STDOUT:
  145. // CHECK:STDOUT: constants {
  146. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  147. // CHECK:STDOUT: %PublicDestructor: type = class_type @PublicDestructor [concrete]
  148. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  149. // CHECK:STDOUT: %pattern_type.27d: type = pattern_type %PublicDestructor [concrete]
  150. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  151. // CHECK:STDOUT: %PublicDestructor.val: %PublicDestructor = struct_value () [concrete]
  152. // CHECK:STDOUT: %PublicDestructor.cpp_destructor.type: type = fn_type @PublicDestructor.cpp_destructor [concrete]
  153. // CHECK:STDOUT: %PublicDestructor.cpp_destructor: %PublicDestructor.cpp_destructor.type = struct_value () [concrete]
  154. // CHECK:STDOUT: %TrivialDestructor: type = class_type @TrivialDestructor [concrete]
  155. // CHECK:STDOUT: %pattern_type.1b8: type = pattern_type %TrivialDestructor [concrete]
  156. // CHECK:STDOUT: %TrivialDestructor.val: %TrivialDestructor = struct_value () [concrete]
  157. // CHECK:STDOUT: %TrivialDestructor.cpp_destructor.type: type = fn_type @TrivialDestructor.cpp_destructor [concrete]
  158. // CHECK:STDOUT: %TrivialDestructor.cpp_destructor: %TrivialDestructor.cpp_destructor.type = struct_value () [concrete]
  159. // CHECK:STDOUT: }
  160. // CHECK:STDOUT:
  161. // CHECK:STDOUT: imports {
  162. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  163. // CHECK:STDOUT: .PublicDestructor = %PublicDestructor.decl
  164. // CHECK:STDOUT: .TrivialDestructor = %TrivialDestructor.decl
  165. // CHECK:STDOUT: import Cpp//...
  166. // CHECK:STDOUT: }
  167. // CHECK:STDOUT: %PublicDestructor.decl: type = class_decl @PublicDestructor [concrete = constants.%PublicDestructor] {} {}
  168. // CHECK:STDOUT: %TrivialDestructor.decl: type = class_decl @TrivialDestructor [concrete = constants.%TrivialDestructor] {} {}
  169. // CHECK:STDOUT: }
  170. // CHECK:STDOUT:
  171. // CHECK:STDOUT: fn @PublicDestroy() {
  172. // CHECK:STDOUT: !entry:
  173. // CHECK:STDOUT: name_binding_decl {
  174. // CHECK:STDOUT: %a.patt: %pattern_type.27d = ref_binding_pattern a [concrete]
  175. // CHECK:STDOUT: %a.var_patt: %pattern_type.27d = var_pattern %a.patt [concrete]
  176. // CHECK:STDOUT: }
  177. // CHECK:STDOUT: %a.var: ref %PublicDestructor = var %a.var_patt
  178. // CHECK:STDOUT: %.loc8_34.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  179. // CHECK:STDOUT: %.loc8_34.2: init %PublicDestructor = class_init (), %a.var [concrete = constants.%PublicDestructor.val]
  180. // CHECK:STDOUT: %.loc8_3: init %PublicDestructor = converted %.loc8_34.1, %.loc8_34.2 [concrete = constants.%PublicDestructor.val]
  181. // CHECK:STDOUT: assign %a.var, %.loc8_3
  182. // CHECK:STDOUT: %.loc8_13: type = splice_block %PublicDestructor.ref [concrete = constants.%PublicDestructor] {
  183. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  184. // CHECK:STDOUT: %PublicDestructor.ref: type = name_ref PublicDestructor, imports.%PublicDestructor.decl [concrete = constants.%PublicDestructor]
  185. // CHECK:STDOUT: }
  186. // CHECK:STDOUT: %a: ref %PublicDestructor = ref_binding a, %a.var
  187. // CHECK:STDOUT: %PublicDestructor.cpp_destructor.bound: <bound method> = bound_method %a.var, constants.%PublicDestructor.cpp_destructor
  188. // CHECK:STDOUT: %PublicDestructor.cpp_destructor.call: init %empty_tuple.type = call %PublicDestructor.cpp_destructor.bound(%a.var)
  189. // CHECK:STDOUT: <elided>
  190. // CHECK:STDOUT: }
  191. // CHECK:STDOUT:
  192. // CHECK:STDOUT: fn @TrivialDestroy() {
  193. // CHECK:STDOUT: !entry:
  194. // CHECK:STDOUT: name_binding_decl {
  195. // CHECK:STDOUT: %a.patt: %pattern_type.1b8 = ref_binding_pattern a [concrete]
  196. // CHECK:STDOUT: %a.var_patt: %pattern_type.1b8 = var_pattern %a.patt [concrete]
  197. // CHECK:STDOUT: }
  198. // CHECK:STDOUT: %a.var: ref %TrivialDestructor = var %a.var_patt
  199. // CHECK:STDOUT: %.loc14_35.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  200. // CHECK:STDOUT: %.loc14_35.2: init %TrivialDestructor = class_init (), %a.var [concrete = constants.%TrivialDestructor.val]
  201. // CHECK:STDOUT: %.loc14_3: init %TrivialDestructor = converted %.loc14_35.1, %.loc14_35.2 [concrete = constants.%TrivialDestructor.val]
  202. // CHECK:STDOUT: assign %a.var, %.loc14_3
  203. // CHECK:STDOUT: %.loc14_13: type = splice_block %TrivialDestructor.ref [concrete = constants.%TrivialDestructor] {
  204. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  205. // CHECK:STDOUT: %TrivialDestructor.ref: type = name_ref TrivialDestructor, imports.%TrivialDestructor.decl [concrete = constants.%TrivialDestructor]
  206. // CHECK:STDOUT: }
  207. // CHECK:STDOUT: %a: ref %TrivialDestructor = ref_binding a, %a.var
  208. // CHECK:STDOUT: %TrivialDestructor.cpp_destructor.bound: <bound method> = bound_method %a.var, constants.%TrivialDestructor.cpp_destructor
  209. // CHECK:STDOUT: %TrivialDestructor.cpp_destructor.call: init %empty_tuple.type = call %TrivialDestructor.cpp_destructor.bound(%a.var)
  210. // CHECK:STDOUT: <elided>
  211. // CHECK:STDOUT: }
  212. // CHECK:STDOUT:
  213. // CHECK:STDOUT: --- destroy_protected_base_destructor.carbon
  214. // CHECK:STDOUT:
  215. // CHECK:STDOUT: constants {
  216. // CHECK:STDOUT: %Derived: type = class_type @Derived [concrete]
  217. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  218. // CHECK:STDOUT: %ProtectedDestructor: type = class_type @ProtectedDestructor [concrete]
  219. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  220. // CHECK:STDOUT: %pattern_type.9f6: type = pattern_type %Derived [concrete]
  221. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  222. // CHECK:STDOUT: %struct_type.base.f5e: type = struct_type {.base: %empty_struct_type} [concrete]
  223. // CHECK:STDOUT: %struct: %struct_type.base.f5e = struct_value (%empty_struct) [concrete]
  224. // CHECK:STDOUT: %ProtectedDestructor.val: %ProtectedDestructor = struct_value () [concrete]
  225. // CHECK:STDOUT: %Derived.val: %Derived = struct_value (%ProtectedDestructor.val) [concrete]
  226. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
  227. // CHECK:STDOUT: %facet_value: %type_where = facet_value %Derived, () [concrete]
  228. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.da2: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value) [concrete]
  229. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.fdc: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.da2 = struct_value () [concrete]
  230. // CHECK:STDOUT: }
  231. // CHECK:STDOUT:
  232. // CHECK:STDOUT: imports {
  233. // CHECK:STDOUT: }
  234. // CHECK:STDOUT:
  235. // CHECK:STDOUT: fn @DestroyClassWithProtectedBaseDestructor() {
  236. // CHECK:STDOUT: !entry:
  237. // CHECK:STDOUT: name_binding_decl {
  238. // CHECK:STDOUT: %a.patt: %pattern_type.9f6 = ref_binding_pattern a [concrete]
  239. // CHECK:STDOUT: %a.var_patt: %pattern_type.9f6 = var_pattern %a.patt [concrete]
  240. // CHECK:STDOUT: }
  241. // CHECK:STDOUT: %a.var: ref %Derived = var %a.var_patt
  242. // CHECK:STDOUT: %.loc12_30.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  243. // CHECK:STDOUT: %.loc12_31.1: %struct_type.base.f5e = struct_literal (%.loc12_30.1) [concrete = constants.%struct]
  244. // CHECK:STDOUT: %.loc12_31.2: ref %ProtectedDestructor = class_element_access %a.var, element0
  245. // CHECK:STDOUT: %.loc12_30.2: init %ProtectedDestructor = class_init (), %.loc12_31.2 [concrete = constants.%ProtectedDestructor.val]
  246. // CHECK:STDOUT: %.loc12_31.3: init %ProtectedDestructor = converted %.loc12_30.1, %.loc12_30.2 [concrete = constants.%ProtectedDestructor.val]
  247. // CHECK:STDOUT: %.loc12_31.4: init %Derived = class_init (%.loc12_31.3), %a.var [concrete = constants.%Derived.val]
  248. // CHECK:STDOUT: %.loc12_3: init %Derived = converted %.loc12_31.1, %.loc12_31.4 [concrete = constants.%Derived.val]
  249. // CHECK:STDOUT: assign %a.var, %.loc12_3
  250. // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl [concrete = constants.%Derived]
  251. // CHECK:STDOUT: %a: ref %Derived = ref_binding a, %a.var
  252. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound: <bound method> = bound_method %a.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.fdc
  253. // CHECK:STDOUT: <elided>
  254. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %a.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn
  255. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method(%a.var)
  256. // CHECK:STDOUT: <elided>
  257. // CHECK:STDOUT: }
  258. // CHECK:STDOUT:
  259. // CHECK:STDOUT: --- todo_fail_destroy_private_base_destructor.carbon
  260. // CHECK:STDOUT:
  261. // CHECK:STDOUT: constants {
  262. // CHECK:STDOUT: %Derived: type = class_type @Derived [concrete]
  263. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  264. // CHECK:STDOUT: %PrivateDestructor: type = class_type @PrivateDestructor [concrete]
  265. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  266. // CHECK:STDOUT: %pattern_type.9f6: type = pattern_type %Derived [concrete]
  267. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  268. // CHECK:STDOUT: %struct_type.base.f5e: type = struct_type {.base: %empty_struct_type} [concrete]
  269. // CHECK:STDOUT: %struct: %struct_type.base.f5e = struct_value (%empty_struct) [concrete]
  270. // CHECK:STDOUT: %PrivateDestructor.val: %PrivateDestructor = struct_value () [concrete]
  271. // CHECK:STDOUT: %Derived.val: %Derived = struct_value (%PrivateDestructor.val) [concrete]
  272. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
  273. // CHECK:STDOUT: %facet_value: %type_where = facet_value %Derived, () [concrete]
  274. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.da2: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value) [concrete]
  275. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.fdc: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.da2 = struct_value () [concrete]
  276. // CHECK:STDOUT: }
  277. // CHECK:STDOUT:
  278. // CHECK:STDOUT: imports {
  279. // CHECK:STDOUT: }
  280. // CHECK:STDOUT:
  281. // CHECK:STDOUT: fn @DestroyClassWithPrivateBaseDestructor() {
  282. // CHECK:STDOUT: !entry:
  283. // CHECK:STDOUT: name_binding_decl {
  284. // CHECK:STDOUT: %a.patt: %pattern_type.9f6 = ref_binding_pattern a [concrete]
  285. // CHECK:STDOUT: %a.var_patt: %pattern_type.9f6 = var_pattern %a.patt [concrete]
  286. // CHECK:STDOUT: }
  287. // CHECK:STDOUT: %a.var: ref %Derived = var %a.var_patt
  288. // CHECK:STDOUT: %.loc13_30.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  289. // CHECK:STDOUT: %.loc13_31.1: %struct_type.base.f5e = struct_literal (%.loc13_30.1) [concrete = constants.%struct]
  290. // CHECK:STDOUT: %.loc13_31.2: ref %PrivateDestructor = class_element_access %a.var, element0
  291. // CHECK:STDOUT: %.loc13_30.2: init %PrivateDestructor = class_init (), %.loc13_31.2 [concrete = constants.%PrivateDestructor.val]
  292. // CHECK:STDOUT: %.loc13_31.3: init %PrivateDestructor = converted %.loc13_30.1, %.loc13_30.2 [concrete = constants.%PrivateDestructor.val]
  293. // CHECK:STDOUT: %.loc13_31.4: init %Derived = class_init (%.loc13_31.3), %a.var [concrete = constants.%Derived.val]
  294. // CHECK:STDOUT: %.loc13_3: init %Derived = converted %.loc13_31.1, %.loc13_31.4 [concrete = constants.%Derived.val]
  295. // CHECK:STDOUT: assign %a.var, %.loc13_3
  296. // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl [concrete = constants.%Derived]
  297. // CHECK:STDOUT: %a: ref %Derived = ref_binding a, %a.var
  298. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound: <bound method> = bound_method %a.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.fdc
  299. // CHECK:STDOUT: <elided>
  300. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %a.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn
  301. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method(%a.var)
  302. // CHECK:STDOUT: <elided>
  303. // CHECK:STDOUT: }
  304. // CHECK:STDOUT: