mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-01 22:02:45 +01:00
Pursuant to recent decisions on #6124, switch `Destroy` to use a `CustomWitness` for its implementation. Right now this is manufacturing no-op implementation functions on each lookup, which obviously isn't ideal but is intended as a first pass. I'm mostly trying to find the right balance between updating the approach to reflect new decisions, while still breaking apart work in a way. The `CoreInterface` logic is intended to build on `CoreIdentifier` support. We have a number of additional interfaces that require specialized logic, and that'll extend pretty far with C++ interop, so it seemed easiest to have a generic function for it. That's what's replacing the logic inside C++ interop that was doing string comparisons (which could have already been moved to `CoreIdentifier`, I just missed it in my first pass). This adds `CustomWitness` support because the `Destroy` witnesses can be imported cross-file. `CustomWitness` was previously only used for C++ types, which don't yet support import, which is why that wasn't previously an issue. The addition of `query_specific_interface_id` is similarly needed in order to get correct sorting of witness blocks when imported. This PR also removes builtin constraint logic (note this is in a separate commit to help review; it's not a separate PR because it's difficult to split apart without tests breaking). This had been made generic with the expectation that destroy, copy, move, and conversions would all need related support. Under the new decision, we are not going to do blanket impls and will instead just manufacture a `CustomWitness` for everything. A lot of SemIR fingerprints change, but that's probably because the addition of `Destroy` on core classes is yielding structural changes.
343 lines
17 KiB
Plaintext
343 lines
17 KiB
Plaintext
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/convert.carbon
|
|
// EXTRA-ARGS: --clang-arg=--std=c++20
|
|
//
|
|
// AUTOUPDATE
|
|
// TIP: To test this file alone, run:
|
|
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/impls/destroy.carbon
|
|
// TIP: To dump output, run:
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/impls/destroy.carbon
|
|
|
|
// --- types.h
|
|
|
|
class PublicDestructor {
|
|
public:
|
|
~PublicDestructor();
|
|
};
|
|
|
|
class TrivialDestructor {
|
|
public:
|
|
~TrivialDestructor() = default;
|
|
};
|
|
|
|
template<int N = 0>
|
|
class AmbiguousDestructorT {
|
|
public:
|
|
~AmbiguousDestructorT() requires (N != 1);
|
|
~AmbiguousDestructorT() requires (N != 2);
|
|
};
|
|
|
|
using AmbiguousDestructor = AmbiguousDestructorT<>;
|
|
|
|
class DeletedDestructor {
|
|
public:
|
|
~DeletedDestructor() = delete;
|
|
};
|
|
|
|
class PrivateDestructor {
|
|
private:
|
|
~PrivateDestructor();
|
|
};
|
|
|
|
class ProtectedDestructor {
|
|
protected:
|
|
~ProtectedDestructor();
|
|
};
|
|
|
|
// --- destroy_destroyable.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
import Cpp library "types.h";
|
|
|
|
fn PublicDestroy() {
|
|
//@dump-sem-ir-begin
|
|
var a: Cpp.PublicDestructor = {};
|
|
//@dump-sem-ir-end
|
|
}
|
|
|
|
fn TrivialDestroy() {
|
|
//@dump-sem-ir-begin
|
|
var a: Cpp.TrivialDestructor = {};
|
|
//@dump-sem-ir-end
|
|
}
|
|
|
|
// --- destroy_protected_base_destructor.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
import Cpp library "types.h";
|
|
|
|
class Derived {
|
|
extend base: Cpp.ProtectedDestructor;
|
|
}
|
|
|
|
fn DestroyClassWithProtectedBaseDestructor() {
|
|
//@dump-sem-ir-begin
|
|
var a: Derived = {.base = {}};
|
|
//@dump-sem-ir-end
|
|
}
|
|
|
|
// --- todo_fail_destroy_private_base_destructor.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
import Cpp library "types.h";
|
|
|
|
class Derived {
|
|
extend base: Cpp.PrivateDestructor;
|
|
}
|
|
|
|
fn DestroyClassWithPrivateBaseDestructor() {
|
|
//@dump-sem-ir-begin
|
|
// TODO: We should not allow this, as the destructor of the base class is private.
|
|
var a: Derived = {.base = {}};
|
|
//@dump-sem-ir-end
|
|
}
|
|
|
|
// --- fail_destroy_nondestroyable.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
// CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+16]]:10: in file included here [InCppInclude]
|
|
// CHECK:STDERR: ./types.h:13:7: error: destructor of class 'AmbiguousDestructorT<>' is ambiguous [CppInteropParseError]
|
|
// CHECK:STDERR: 13 | class AmbiguousDestructorT {
|
|
// CHECK:STDERR: | ^
|
|
// CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+12]]:10: in file included here [InCppInclude]
|
|
// CHECK:STDERR: ./types.h:13:7: note: in instantiation of template class 'AmbiguousDestructorT<>' requested here [CppInteropParseNote]
|
|
// CHECK:STDERR: 13 | class AmbiguousDestructorT {
|
|
// CHECK:STDERR: | ^
|
|
// CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+8]]:10: in file included here [InCppInclude]
|
|
// CHECK:STDERR: ./types.h:15:3: note: candidate function [CppInteropParseNote]
|
|
// CHECK:STDERR: 15 | ~AmbiguousDestructorT() requires (N != 1);
|
|
// CHECK:STDERR: | ^
|
|
// CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+4]]:10: in file included here [InCppInclude]
|
|
// CHECK:STDERR: ./types.h:16:3: note: candidate function [CppInteropParseNote]
|
|
// CHECK:STDERR: 16 | ~AmbiguousDestructorT() requires (N != 2);
|
|
// CHECK:STDERR: | ^
|
|
import Cpp library "types.h";
|
|
|
|
fn AmbiguousDestroy() {
|
|
// CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+4]]:10: note: while completing C++ type `Cpp.AmbiguousDestructorT` [InCppTypeCompletion]
|
|
// CHECK:STDERR: var a: Cpp.AmbiguousDestructor = {};
|
|
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~
|
|
// CHECK:STDERR:
|
|
var a: Cpp.AmbiguousDestructor = {};
|
|
}
|
|
|
|
fn DeletedDestroy() {
|
|
// CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+8]]:3: error: attempt to use a deleted function [CppInteropParseError]
|
|
// CHECK:STDERR: 39 | var a: Cpp.DeletedDestructor = {};
|
|
// CHECK:STDERR: | ^
|
|
// CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE-14]]:10: in file included here [InCppInclude]
|
|
// CHECK:STDERR: ./types.h:23:3: note: '~DeletedDestructor' has been explicitly marked deleted here [CppInteropParseNote]
|
|
// CHECK:STDERR: 23 | ~DeletedDestructor() = delete;
|
|
// CHECK:STDERR: | ^
|
|
// CHECK:STDERR:
|
|
var a: Cpp.DeletedDestructor = {};
|
|
}
|
|
|
|
fn PrivateDestroy() {
|
|
// CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+5]]:3: error: cannot access private member `<C++ destructor>` of type `Cpp.PrivateDestructor` [ClassInvalidMemberAccess]
|
|
// CHECK:STDERR: var a: Cpp.PrivateDestructor = {};
|
|
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// CHECK:STDERR: fail_destroy_nondestroyable.carbon: note: declared here [ClassMemberDeclaration]
|
|
// CHECK:STDERR:
|
|
var a: Cpp.PrivateDestructor = {};
|
|
}
|
|
|
|
fn ProtectedDestroy() {
|
|
// CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+5]]:3: error: cannot access protected member `<C++ destructor>` of type `Cpp.ProtectedDestructor` [ClassInvalidMemberAccess]
|
|
// CHECK:STDERR: var a: Cpp.ProtectedDestructor = {};
|
|
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// CHECK:STDERR: fail_destroy_nondestroyable.carbon: note: declared here [ClassMemberDeclaration]
|
|
// CHECK:STDERR:
|
|
var a: Cpp.ProtectedDestructor = {};
|
|
}
|
|
|
|
// --- destroy_generically.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
import Cpp library "types.h";
|
|
|
|
fn Destroy[T:! Core.Copy & Core.Destroy](c: T) {
|
|
var d: T = c;
|
|
}
|
|
|
|
fn DoDestroy() {
|
|
Destroy({} as Cpp.PublicDestructor);
|
|
}
|
|
|
|
class Wrap(T:! Core.Destroy) {}
|
|
|
|
fn EqualWitnesses(p: Wrap(Cpp.PublicDestructor)*) -> Wrap(Cpp.PublicDestructor)* {
|
|
return p;
|
|
}
|
|
|
|
// CHECK:STDOUT: --- destroy_destroyable.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
|
// CHECK:STDOUT: %PublicDestructor: type = class_type @PublicDestructor [concrete]
|
|
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
|
// CHECK:STDOUT: %pattern_type.27d: type = pattern_type %PublicDestructor [concrete]
|
|
// CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
|
|
// CHECK:STDOUT: %PublicDestructor.val: %PublicDestructor = struct_value () [concrete]
|
|
// CHECK:STDOUT: %PublicDestructor.cpp_destructor.type: type = fn_type @PublicDestructor.cpp_destructor [concrete]
|
|
// CHECK:STDOUT: %PublicDestructor.cpp_destructor: %PublicDestructor.cpp_destructor.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: %TrivialDestructor: type = class_type @TrivialDestructor [concrete]
|
|
// CHECK:STDOUT: %pattern_type.1b8: type = pattern_type %TrivialDestructor [concrete]
|
|
// CHECK:STDOUT: %TrivialDestructor.val: %TrivialDestructor = struct_value () [concrete]
|
|
// CHECK:STDOUT: %TrivialDestructor.cpp_destructor.type: type = fn_type @TrivialDestructor.cpp_destructor [concrete]
|
|
// CHECK:STDOUT: %TrivialDestructor.cpp_destructor: %TrivialDestructor.cpp_destructor.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
|
// CHECK:STDOUT: .PublicDestructor = %PublicDestructor.decl
|
|
// CHECK:STDOUT: .TrivialDestructor = %TrivialDestructor.decl
|
|
// CHECK:STDOUT: import Cpp//...
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %PublicDestructor.decl: type = class_decl @PublicDestructor [concrete = constants.%PublicDestructor] {} {}
|
|
// CHECK:STDOUT: %TrivialDestructor.decl: type = class_decl @TrivialDestructor [concrete = constants.%TrivialDestructor] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @PublicDestroy() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %a.patt: %pattern_type.27d = ref_binding_pattern a [concrete]
|
|
// CHECK:STDOUT: %a.var_patt: %pattern_type.27d = var_pattern %a.patt [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %a.var: ref %PublicDestructor = var %a.var_patt
|
|
// CHECK:STDOUT: %.loc8_34.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
|
|
// CHECK:STDOUT: %.loc8_34.2: init %PublicDestructor = class_init (), %a.var [concrete = constants.%PublicDestructor.val]
|
|
// CHECK:STDOUT: %.loc8_3: init %PublicDestructor = converted %.loc8_34.1, %.loc8_34.2 [concrete = constants.%PublicDestructor.val]
|
|
// CHECK:STDOUT: assign %a.var, %.loc8_3
|
|
// CHECK:STDOUT: %.loc8_13: type = splice_block %PublicDestructor.ref [concrete = constants.%PublicDestructor] {
|
|
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
|
// CHECK:STDOUT: %PublicDestructor.ref: type = name_ref PublicDestructor, imports.%PublicDestructor.decl [concrete = constants.%PublicDestructor]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %a: ref %PublicDestructor = ref_binding a, %a.var
|
|
// CHECK:STDOUT: %PublicDestructor.cpp_destructor.bound: <bound method> = bound_method %a.var, constants.%PublicDestructor.cpp_destructor
|
|
// CHECK:STDOUT: %PublicDestructor.cpp_destructor.call: init %empty_tuple.type = call %PublicDestructor.cpp_destructor.bound(%a.var)
|
|
// CHECK:STDOUT: <elided>
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @DestroyOp.loc8(%self.param: %PublicDestructor) = "no_op";
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @TrivialDestroy() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %a.patt: %pattern_type.1b8 = ref_binding_pattern a [concrete]
|
|
// CHECK:STDOUT: %a.var_patt: %pattern_type.1b8 = var_pattern %a.patt [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %a.var: ref %TrivialDestructor = var %a.var_patt
|
|
// CHECK:STDOUT: %.loc14_35.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
|
|
// CHECK:STDOUT: %.loc14_35.2: init %TrivialDestructor = class_init (), %a.var [concrete = constants.%TrivialDestructor.val]
|
|
// CHECK:STDOUT: %.loc14_3: init %TrivialDestructor = converted %.loc14_35.1, %.loc14_35.2 [concrete = constants.%TrivialDestructor.val]
|
|
// CHECK:STDOUT: assign %a.var, %.loc14_3
|
|
// CHECK:STDOUT: %.loc14_13: type = splice_block %TrivialDestructor.ref [concrete = constants.%TrivialDestructor] {
|
|
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
|
// CHECK:STDOUT: %TrivialDestructor.ref: type = name_ref TrivialDestructor, imports.%TrivialDestructor.decl [concrete = constants.%TrivialDestructor]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %a: ref %TrivialDestructor = ref_binding a, %a.var
|
|
// CHECK:STDOUT: %TrivialDestructor.cpp_destructor.bound: <bound method> = bound_method %a.var, constants.%TrivialDestructor.cpp_destructor
|
|
// CHECK:STDOUT: %TrivialDestructor.cpp_destructor.call: init %empty_tuple.type = call %TrivialDestructor.cpp_destructor.bound(%a.var)
|
|
// CHECK:STDOUT: <elided>
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @DestroyOp.loc14(%self.param: %TrivialDestructor) = "no_op";
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- destroy_protected_base_destructor.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %Derived: type = class_type @Derived [concrete]
|
|
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
|
// CHECK:STDOUT: %ProtectedDestructor: type = class_type @ProtectedDestructor [concrete]
|
|
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
|
// CHECK:STDOUT: %pattern_type.9f6: type = pattern_type %Derived [concrete]
|
|
// CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
|
|
// CHECK:STDOUT: %struct_type.base.f5e: type = struct_type {.base: %empty_struct_type} [concrete]
|
|
// CHECK:STDOUT: %struct: %struct_type.base.f5e = struct_value (%empty_struct) [concrete]
|
|
// CHECK:STDOUT: %ProtectedDestructor.val: %ProtectedDestructor = struct_value () [concrete]
|
|
// CHECK:STDOUT: %Derived.val: %Derived = struct_value (%ProtectedDestructor.val) [concrete]
|
|
// CHECK:STDOUT: %DestroyOp.type: type = fn_type @DestroyOp [concrete]
|
|
// CHECK:STDOUT: %DestroyOp: %DestroyOp.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @DestroyClassWithProtectedBaseDestructor() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %a.patt: %pattern_type.9f6 = ref_binding_pattern a [concrete]
|
|
// CHECK:STDOUT: %a.var_patt: %pattern_type.9f6 = var_pattern %a.patt [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %a.var: ref %Derived = var %a.var_patt
|
|
// CHECK:STDOUT: %.loc12_30.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
|
|
// CHECK:STDOUT: %.loc12_31.1: %struct_type.base.f5e = struct_literal (%.loc12_30.1) [concrete = constants.%struct]
|
|
// CHECK:STDOUT: %.loc12_31.2: ref %ProtectedDestructor = class_element_access %a.var, element0
|
|
// CHECK:STDOUT: %.loc12_30.2: init %ProtectedDestructor = class_init (), %.loc12_31.2 [concrete = constants.%ProtectedDestructor.val]
|
|
// CHECK:STDOUT: %.loc12_31.3: init %ProtectedDestructor = converted %.loc12_30.1, %.loc12_30.2 [concrete = constants.%ProtectedDestructor.val]
|
|
// CHECK:STDOUT: %.loc12_31.4: init %Derived = class_init (%.loc12_31.3), %a.var [concrete = constants.%Derived.val]
|
|
// CHECK:STDOUT: %.loc12_3: init %Derived = converted %.loc12_31.1, %.loc12_31.4 [concrete = constants.%Derived.val]
|
|
// CHECK:STDOUT: assign %a.var, %.loc12_3
|
|
// CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl [concrete = constants.%Derived]
|
|
// CHECK:STDOUT: %a: ref %Derived = ref_binding a, %a.var
|
|
// CHECK:STDOUT: %DestroyOp.bound: <bound method> = bound_method %a.var, constants.%DestroyOp
|
|
// CHECK:STDOUT: %DestroyOp.call: init %empty_tuple.type = call %DestroyOp.bound(%a.var)
|
|
// CHECK:STDOUT: <elided>
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @DestroyOp(%self.param: %Derived) = "no_op";
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- todo_fail_destroy_private_base_destructor.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %Derived: type = class_type @Derived [concrete]
|
|
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
|
// CHECK:STDOUT: %PrivateDestructor: type = class_type @PrivateDestructor [concrete]
|
|
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
|
// CHECK:STDOUT: %pattern_type.9f6: type = pattern_type %Derived [concrete]
|
|
// CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
|
|
// CHECK:STDOUT: %struct_type.base.f5e: type = struct_type {.base: %empty_struct_type} [concrete]
|
|
// CHECK:STDOUT: %struct: %struct_type.base.f5e = struct_value (%empty_struct) [concrete]
|
|
// CHECK:STDOUT: %PrivateDestructor.val: %PrivateDestructor = struct_value () [concrete]
|
|
// CHECK:STDOUT: %Derived.val: %Derived = struct_value (%PrivateDestructor.val) [concrete]
|
|
// CHECK:STDOUT: %DestroyOp.type: type = fn_type @DestroyOp [concrete]
|
|
// CHECK:STDOUT: %DestroyOp: %DestroyOp.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @DestroyClassWithPrivateBaseDestructor() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %a.patt: %pattern_type.9f6 = ref_binding_pattern a [concrete]
|
|
// CHECK:STDOUT: %a.var_patt: %pattern_type.9f6 = var_pattern %a.patt [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %a.var: ref %Derived = var %a.var_patt
|
|
// CHECK:STDOUT: %.loc13_30.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
|
|
// CHECK:STDOUT: %.loc13_31.1: %struct_type.base.f5e = struct_literal (%.loc13_30.1) [concrete = constants.%struct]
|
|
// CHECK:STDOUT: %.loc13_31.2: ref %PrivateDestructor = class_element_access %a.var, element0
|
|
// CHECK:STDOUT: %.loc13_30.2: init %PrivateDestructor = class_init (), %.loc13_31.2 [concrete = constants.%PrivateDestructor.val]
|
|
// CHECK:STDOUT: %.loc13_31.3: init %PrivateDestructor = converted %.loc13_30.1, %.loc13_30.2 [concrete = constants.%PrivateDestructor.val]
|
|
// CHECK:STDOUT: %.loc13_31.4: init %Derived = class_init (%.loc13_31.3), %a.var [concrete = constants.%Derived.val]
|
|
// CHECK:STDOUT: %.loc13_3: init %Derived = converted %.loc13_31.1, %.loc13_31.4 [concrete = constants.%Derived.val]
|
|
// CHECK:STDOUT: assign %a.var, %.loc13_3
|
|
// CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl [concrete = constants.%Derived]
|
|
// CHECK:STDOUT: %a: ref %Derived = ref_binding a, %a.var
|
|
// CHECK:STDOUT: %DestroyOp.bound: <bound method> = bound_method %a.var, constants.%DestroyOp
|
|
// CHECK:STDOUT: %DestroyOp.call: init %empty_tuple.type = call %DestroyOp.bound(%a.var)
|
|
// CHECK:STDOUT: <elided>
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @DestroyOp(%self.param: %Derived) = "no_op";
|
|
// CHECK:STDOUT:
|