Reimplement destroy as an interface (#5678)

This changes `Destroy` to use an interface for its implementation.

Note that this change includes a lot of test updates. Even when
`Destroy` is a no-op, it still causes code generation as part of
determining that.

Originally I was trying to use ranges to cut down the scope of this, and
to a degree I think they have. But a flipside here is that cases where
no destructors should be generated -- particularly globals -- would be
needed to completely remove destructor calls. Even for ranges, the range
can often include the destructor placement. So I've shifted
frame-of-thought a little: accept a bunch of destructor churn, because
destructors are needed and will be prevalent. The verbosity is a feature
of the design to make desugaring apparent in IR, not a bug.
This commit is contained in:
Jon Ross-Perkins
2025-06-27 21:57:14 +00:00
committed by GitHub
parent bba037738d
commit 0722dab0ef
171 changed files with 11900 additions and 1434 deletions
+154 -1
View File
@@ -2,7 +2,7 @@
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon
// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/destroy.carbon
//
// AUTOUPDATE
// TIP: To test this file alone, run:
@@ -391,6 +391,17 @@ fn F() {
// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
// CHECK:STDOUT: %C.val: %C = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete]
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic]
// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic]
// CHECK:STDOUT: %Destroy.impl_witness.4f0: <witness> = impl_witness imports.%Destroy.impl_witness_table, @impl(%C) [concrete]
// CHECK:STDOUT: %Op.type.1b3: type = fn_type @Op.2, @impl(%C) [concrete]
// CHECK:STDOUT: %Op.21b: %Op.type.1b3 = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C, (%Destroy.impl_witness.4f0) [concrete]
// CHECK:STDOUT: %.b20: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete]
// CHECK:STDOUT: %Op.specific_fn: <specific function> = specific_function %Op.21b, @Op.2(%C) [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -405,6 +416,8 @@ fn F() {
// CHECK:STDOUT: } {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)]
// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() {
@@ -418,6 +431,12 @@ fn F() {
// CHECK:STDOUT: %.loc8_12.5: ref %C = converted %.loc8_12.1, %.loc8_12.4
// CHECK:STDOUT: %.loc8_12.6: %C = bind_value %.loc8_12.5
// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc8_12.6)
// CHECK:STDOUT: %impl.elem0: %.b20 = impl_witness_access constants.%Destroy.impl_witness.4f0, element0 [concrete = constants.%Op.21b]
// CHECK:STDOUT: %bound_method.loc8_12.1: <bound method> = bound_method %.loc8_12.2, %impl.elem0
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Op.2(constants.%C) [concrete = constants.%Op.specific_fn]
// CHECK:STDOUT: %bound_method.loc8_12.2: <bound method> = bound_method %.loc8_12.2, %specific_fn
// CHECK:STDOUT: %.loc8_12.7: %C = bind_value %.loc8_12.2
// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_12.2(%.loc8_12.7)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -430,6 +449,17 @@ fn F() {
// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
// CHECK:STDOUT: %C.val: %C = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete]
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic]
// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic]
// CHECK:STDOUT: %Destroy.impl_witness.4f0: <witness> = impl_witness imports.%Destroy.impl_witness_table, @impl(%C) [concrete]
// CHECK:STDOUT: %Op.type.1b3: type = fn_type @Op.2, @impl(%C) [concrete]
// CHECK:STDOUT: %Op.21b: %Op.type.1b3 = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C, (%Destroy.impl_witness.4f0) [concrete]
// CHECK:STDOUT: %.b20: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete]
// CHECK:STDOUT: %Op.specific_fn: <specific function> = specific_function %Op.21b, @Op.2(%C) [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -444,6 +474,8 @@ fn F() {
// CHECK:STDOUT: } {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)]
// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() {
@@ -457,6 +489,12 @@ fn F() {
// CHECK:STDOUT: %.loc8_12.5: ref %C = converted %.loc8_12.1, %.loc8_12.4
// CHECK:STDOUT: %.loc8_12.6: %C = bind_value %.loc8_12.5
// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc8_12.6)
// CHECK:STDOUT: %impl.elem0: %.b20 = impl_witness_access constants.%Destroy.impl_witness.4f0, element0 [concrete = constants.%Op.21b]
// CHECK:STDOUT: %bound_method.loc8_12.1: <bound method> = bound_method %.loc8_12.2, %impl.elem0
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Op.2(constants.%C) [concrete = constants.%Op.specific_fn]
// CHECK:STDOUT: %bound_method.loc8_12.2: <bound method> = bound_method %.loc8_12.2, %specific_fn
// CHECK:STDOUT: %.loc8_12.7: %C = bind_value %.loc8_12.2
// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_12.2(%.loc8_12.7)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -469,6 +507,17 @@ fn F() {
// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
// CHECK:STDOUT: %C.val: %C = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete]
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic]
// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic]
// CHECK:STDOUT: %Destroy.impl_witness.4f0: <witness> = impl_witness imports.%Destroy.impl_witness_table, @impl(%C) [concrete]
// CHECK:STDOUT: %Op.type.1b3: type = fn_type @Op.2, @impl(%C) [concrete]
// CHECK:STDOUT: %Op.21b: %Op.type.1b3 = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C, (%Destroy.impl_witness.4f0) [concrete]
// CHECK:STDOUT: %.b20: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete]
// CHECK:STDOUT: %Op.specific_fn: <specific function> = specific_function %Op.21b, @Op.2(%C) [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -483,6 +532,8 @@ fn F() {
// CHECK:STDOUT: } {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)]
// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() {
@@ -496,6 +547,12 @@ fn F() {
// CHECK:STDOUT: %.loc8_12.5: ref %C = converted %.loc8_12.1, %.loc8_12.4
// CHECK:STDOUT: %.loc8_12.6: %C = bind_value %.loc8_12.5
// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc8_12.6)
// CHECK:STDOUT: %impl.elem0: %.b20 = impl_witness_access constants.%Destroy.impl_witness.4f0, element0 [concrete = constants.%Op.21b]
// CHECK:STDOUT: %bound_method.loc8_12.1: <bound method> = bound_method %.loc8_12.2, %impl.elem0
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Op.2(constants.%C) [concrete = constants.%Op.specific_fn]
// CHECK:STDOUT: %bound_method.loc8_12.2: <bound method> = bound_method %.loc8_12.2, %specific_fn
// CHECK:STDOUT: %.loc8_12.7: %C = bind_value %.loc8_12.2
// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_12.2(%.loc8_12.7)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -508,6 +565,17 @@ fn F() {
// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
// CHECK:STDOUT: %C.val: %C = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete]
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic]
// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic]
// CHECK:STDOUT: %Destroy.impl_witness.86f: <witness> = impl_witness imports.%Destroy.impl_witness_table, @impl(%C) [concrete]
// CHECK:STDOUT: %Op.type.9ae: type = fn_type @Op.2, @impl(%C) [concrete]
// CHECK:STDOUT: %Op.dbb: %Op.type.9ae = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C, (%Destroy.impl_witness.86f) [concrete]
// CHECK:STDOUT: %.268: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete]
// CHECK:STDOUT: %Op.specific_fn: <specific function> = specific_function %Op.dbb, @Op.2(%C) [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -520,6 +588,8 @@ fn F() {
// CHECK:STDOUT: } {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)]
// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() {
@@ -533,6 +603,12 @@ fn F() {
// CHECK:STDOUT: %.loc8_12.5: ref %C = converted %.loc8_12.1, %.loc8_12.4
// CHECK:STDOUT: %.loc8_12.6: %C = bind_value %.loc8_12.5
// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc8_12.6)
// CHECK:STDOUT: %impl.elem0: %.268 = impl_witness_access constants.%Destroy.impl_witness.86f, element0 [concrete = constants.%Op.dbb]
// CHECK:STDOUT: %bound_method.loc8_12.1: <bound method> = bound_method %.loc8_12.2, %impl.elem0
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Op.2(constants.%C) [concrete = constants.%Op.specific_fn]
// CHECK:STDOUT: %bound_method.loc8_12.2: <bound method> = bound_method %.loc8_12.2, %specific_fn
// CHECK:STDOUT: %.loc8_12.7: %C = bind_value %.loc8_12.2
// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_12.2(%.loc8_12.7)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -545,6 +621,17 @@ fn F() {
// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
// CHECK:STDOUT: %C.val: %C = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete]
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic]
// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic]
// CHECK:STDOUT: %Destroy.impl_witness.5c3: <witness> = impl_witness imports.%Destroy.impl_witness_table, @impl(%C) [concrete]
// CHECK:STDOUT: %Op.type.b28: type = fn_type @Op.2, @impl(%C) [concrete]
// CHECK:STDOUT: %Op.f48: %Op.type.b28 = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C, (%Destroy.impl_witness.5c3) [concrete]
// CHECK:STDOUT: %.f7d: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete]
// CHECK:STDOUT: %Op.specific_fn: <specific function> = specific_function %Op.f48, @Op.2(%C) [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -561,6 +648,8 @@ fn F() {
// CHECK:STDOUT: } {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)]
// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() {
@@ -575,6 +664,12 @@ fn F() {
// CHECK:STDOUT: %.loc8_15.5: ref %C = converted %.loc8_15.1, %.loc8_15.4
// CHECK:STDOUT: %.loc8_15.6: %C = bind_value %.loc8_15.5
// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc8_15.6)
// CHECK:STDOUT: %impl.elem0: %.f7d = impl_witness_access constants.%Destroy.impl_witness.5c3, element0 [concrete = constants.%Op.f48]
// CHECK:STDOUT: %bound_method.loc8_15.1: <bound method> = bound_method %.loc8_15.2, %impl.elem0
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Op.2(constants.%C) [concrete = constants.%Op.specific_fn]
// CHECK:STDOUT: %bound_method.loc8_15.2: <bound method> = bound_method %.loc8_15.2, %specific_fn
// CHECK:STDOUT: %.loc8_15.7: %C = bind_value %.loc8_15.2
// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_15.2(%.loc8_15.7)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -589,6 +684,17 @@ fn F() {
// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
// CHECK:STDOUT: %C.val: %C = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete]
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic]
// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic]
// CHECK:STDOUT: %Destroy.impl_witness.4f0: <witness> = impl_witness imports.%Destroy.impl_witness_table, @impl(%C) [concrete]
// CHECK:STDOUT: %Op.type.1b3: type = fn_type @Op.2, @impl(%C) [concrete]
// CHECK:STDOUT: %Op.21b: %Op.type.1b3 = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C, (%Destroy.impl_witness.4f0) [concrete]
// CHECK:STDOUT: %.b20: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete]
// CHECK:STDOUT: %Op.specific_fn: <specific function> = specific_function %Op.21b, @Op.2(%C) [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -604,6 +710,8 @@ fn F() {
// CHECK:STDOUT: } {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)]
// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() {
@@ -622,6 +730,12 @@ fn F() {
// CHECK:STDOUT: %.loc9_12.5: ref %C = converted %.loc9_12.1, %.loc9_12.4
// CHECK:STDOUT: %.loc9_12.6: %C = bind_value %.loc9_12.5
// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc9_12.6)
// CHECK:STDOUT: %impl.elem0: %.b20 = impl_witness_access constants.%Destroy.impl_witness.4f0, element0 [concrete = constants.%Op.21b]
// CHECK:STDOUT: %bound_method.loc9_12.1: <bound method> = bound_method %.loc9_12.2, %impl.elem0
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Op.2(constants.%C) [concrete = constants.%Op.specific_fn]
// CHECK:STDOUT: %bound_method.loc9_12.2: <bound method> = bound_method %.loc9_12.2, %specific_fn
// CHECK:STDOUT: %.loc9_12.7: %C = bind_value %.loc9_12.2
// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc9_12.2(%.loc9_12.7)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -636,6 +750,17 @@ fn F() {
// CHECK:STDOUT: %C.val: %C = struct_value () [concrete]
// CHECK:STDOUT: %bar.type: type = fn_type @bar [concrete]
// CHECK:STDOUT: %bar: %bar.type = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete]
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic]
// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic]
// CHECK:STDOUT: %Destroy.impl_witness.4f0: <witness> = impl_witness imports.%Destroy.impl_witness_table, @impl(%C) [concrete]
// CHECK:STDOUT: %Op.type.1b3: type = fn_type @Op.2, @impl(%C) [concrete]
// CHECK:STDOUT: %Op.21b: %Op.type.1b3 = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C, (%Destroy.impl_witness.4f0) [concrete]
// CHECK:STDOUT: %.b20: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete]
// CHECK:STDOUT: %Op.specific_fn: <specific function> = specific_function %Op.21b, @Op.2(%C) [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -651,6 +776,8 @@ fn F() {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT: %bar.decl: %bar.type = fn_decl @bar [concrete = constants.%bar] {} {}
// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)]
// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() {
@@ -668,6 +795,12 @@ fn F() {
// CHECK:STDOUT: %C.ref: type = name_ref C, imports.%C.decl [concrete = constants.%C]
// CHECK:STDOUT: %bar.ref: %bar.type = name_ref bar, imports.%bar.decl [concrete = constants.%bar]
// CHECK:STDOUT: %bar.call: init %empty_tuple.type = call %bar.ref()
// CHECK:STDOUT: %impl.elem0: %.b20 = impl_witness_access constants.%Destroy.impl_witness.4f0, element0 [concrete = constants.%Op.21b]
// CHECK:STDOUT: %bound_method.loc8_12.1: <bound method> = bound_method %.loc8_12.2, %impl.elem0
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Op.2(constants.%C) [concrete = constants.%Op.specific_fn]
// CHECK:STDOUT: %bound_method.loc8_12.2: <bound method> = bound_method %.loc8_12.2, %specific_fn
// CHECK:STDOUT: %.loc8_12.7: %C = bind_value %.loc8_12.2
// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_12.2(%.loc8_12.7)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -719,9 +852,21 @@ fn F() {
// CHECK:STDOUT: --- import_definition_value_return_type.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
// CHECK:STDOUT: %C: type = class_type @C [concrete]
// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete]
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic]
// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic]
// CHECK:STDOUT: %Destroy.impl_witness.4f0: <witness> = impl_witness imports.%Destroy.impl_witness_table, @impl(%C) [concrete]
// CHECK:STDOUT: %Op.type.1b3: type = fn_type @Op.2, @impl(%C) [concrete]
// CHECK:STDOUT: %Op.21b: %Op.type.1b3 = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %C, (%Destroy.impl_witness.4f0) [concrete]
// CHECK:STDOUT: %.b20: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete]
// CHECK:STDOUT: %Op.specific_fn: <specific function> = specific_function %Op.21b, @Op.2(%C) [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -736,6 +881,8 @@ fn F() {
// CHECK:STDOUT: } {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)]
// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() {
@@ -745,6 +892,12 @@ fn F() {
// CHECK:STDOUT: %.loc8_11.1: ref %C = temporary_storage
// CHECK:STDOUT: %foo.call: init %C = call %foo.ref() to %.loc8_11.1
// CHECK:STDOUT: %.loc8_11.2: ref %C = temporary %.loc8_11.1, %foo.call
// CHECK:STDOUT: %impl.elem0: %.b20 = impl_witness_access constants.%Destroy.impl_witness.4f0, element0 [concrete = constants.%Op.21b]
// CHECK:STDOUT: %bound_method.loc8_11.1: <bound method> = bound_method %.loc8_11.1, %impl.elem0
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Op.2(constants.%C) [concrete = constants.%Op.specific_fn]
// CHECK:STDOUT: %bound_method.loc8_11.2: <bound method> = bound_method %.loc8_11.1, %specific_fn
// CHECK:STDOUT: %.loc8_11.3: %C = bind_value %.loc8_11.1
// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_11.2(%.loc8_11.3)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
+154 -1
View File
@@ -2,7 +2,7 @@
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon
// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/destroy.carbon
//
// AUTOUPDATE
// TIP: To test this file alone, run:
@@ -391,6 +391,17 @@ fn F() {
// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
// CHECK:STDOUT: %S.val: %S = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete]
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic]
// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic]
// CHECK:STDOUT: %Destroy.impl_witness.2d2: <witness> = impl_witness imports.%Destroy.impl_witness_table, @impl(%S) [concrete]
// CHECK:STDOUT: %Op.type.642: type = fn_type @Op.2, @impl(%S) [concrete]
// CHECK:STDOUT: %Op.ab5: %Op.type.642 = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %S, (%Destroy.impl_witness.2d2) [concrete]
// CHECK:STDOUT: %.271: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete]
// CHECK:STDOUT: %Op.specific_fn: <specific function> = specific_function %Op.ab5, @Op.2(%S) [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -405,6 +416,8 @@ fn F() {
// CHECK:STDOUT: } {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)]
// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() {
@@ -418,6 +431,12 @@ fn F() {
// CHECK:STDOUT: %.loc8_12.5: ref %S = converted %.loc8_12.1, %.loc8_12.4
// CHECK:STDOUT: %.loc8_12.6: %S = bind_value %.loc8_12.5
// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc8_12.6)
// CHECK:STDOUT: %impl.elem0: %.271 = impl_witness_access constants.%Destroy.impl_witness.2d2, element0 [concrete = constants.%Op.ab5]
// CHECK:STDOUT: %bound_method.loc8_12.1: <bound method> = bound_method %.loc8_12.2, %impl.elem0
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Op.2(constants.%S) [concrete = constants.%Op.specific_fn]
// CHECK:STDOUT: %bound_method.loc8_12.2: <bound method> = bound_method %.loc8_12.2, %specific_fn
// CHECK:STDOUT: %.loc8_12.7: %S = bind_value %.loc8_12.2
// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_12.2(%.loc8_12.7)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -430,6 +449,17 @@ fn F() {
// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
// CHECK:STDOUT: %S.val: %S = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete]
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic]
// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic]
// CHECK:STDOUT: %Destroy.impl_witness.2d2: <witness> = impl_witness imports.%Destroy.impl_witness_table, @impl(%S) [concrete]
// CHECK:STDOUT: %Op.type.642: type = fn_type @Op.2, @impl(%S) [concrete]
// CHECK:STDOUT: %Op.ab5: %Op.type.642 = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %S, (%Destroy.impl_witness.2d2) [concrete]
// CHECK:STDOUT: %.271: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete]
// CHECK:STDOUT: %Op.specific_fn: <specific function> = specific_function %Op.ab5, @Op.2(%S) [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -444,6 +474,8 @@ fn F() {
// CHECK:STDOUT: } {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)]
// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() {
@@ -457,6 +489,12 @@ fn F() {
// CHECK:STDOUT: %.loc8_12.5: ref %S = converted %.loc8_12.1, %.loc8_12.4
// CHECK:STDOUT: %.loc8_12.6: %S = bind_value %.loc8_12.5
// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc8_12.6)
// CHECK:STDOUT: %impl.elem0: %.271 = impl_witness_access constants.%Destroy.impl_witness.2d2, element0 [concrete = constants.%Op.ab5]
// CHECK:STDOUT: %bound_method.loc8_12.1: <bound method> = bound_method %.loc8_12.2, %impl.elem0
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Op.2(constants.%S) [concrete = constants.%Op.specific_fn]
// CHECK:STDOUT: %bound_method.loc8_12.2: <bound method> = bound_method %.loc8_12.2, %specific_fn
// CHECK:STDOUT: %.loc8_12.7: %S = bind_value %.loc8_12.2
// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_12.2(%.loc8_12.7)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -469,6 +507,17 @@ fn F() {
// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
// CHECK:STDOUT: %S.val: %S = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete]
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic]
// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic]
// CHECK:STDOUT: %Destroy.impl_witness.2d2: <witness> = impl_witness imports.%Destroy.impl_witness_table, @impl(%S) [concrete]
// CHECK:STDOUT: %Op.type.642: type = fn_type @Op.2, @impl(%S) [concrete]
// CHECK:STDOUT: %Op.ab5: %Op.type.642 = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %S, (%Destroy.impl_witness.2d2) [concrete]
// CHECK:STDOUT: %.271: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete]
// CHECK:STDOUT: %Op.specific_fn: <specific function> = specific_function %Op.ab5, @Op.2(%S) [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -483,6 +532,8 @@ fn F() {
// CHECK:STDOUT: } {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)]
// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() {
@@ -496,6 +547,12 @@ fn F() {
// CHECK:STDOUT: %.loc8_12.5: ref %S = converted %.loc8_12.1, %.loc8_12.4
// CHECK:STDOUT: %.loc8_12.6: %S = bind_value %.loc8_12.5
// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc8_12.6)
// CHECK:STDOUT: %impl.elem0: %.271 = impl_witness_access constants.%Destroy.impl_witness.2d2, element0 [concrete = constants.%Op.ab5]
// CHECK:STDOUT: %bound_method.loc8_12.1: <bound method> = bound_method %.loc8_12.2, %impl.elem0
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Op.2(constants.%S) [concrete = constants.%Op.specific_fn]
// CHECK:STDOUT: %bound_method.loc8_12.2: <bound method> = bound_method %.loc8_12.2, %specific_fn
// CHECK:STDOUT: %.loc8_12.7: %S = bind_value %.loc8_12.2
// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_12.2(%.loc8_12.7)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -508,6 +565,17 @@ fn F() {
// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
// CHECK:STDOUT: %S.val: %S = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete]
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic]
// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic]
// CHECK:STDOUT: %Destroy.impl_witness.0f8: <witness> = impl_witness imports.%Destroy.impl_witness_table, @impl(%S) [concrete]
// CHECK:STDOUT: %Op.type.2b5: type = fn_type @Op.2, @impl(%S) [concrete]
// CHECK:STDOUT: %Op.9b3: %Op.type.2b5 = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %S, (%Destroy.impl_witness.0f8) [concrete]
// CHECK:STDOUT: %.f1f: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete]
// CHECK:STDOUT: %Op.specific_fn: <specific function> = specific_function %Op.9b3, @Op.2(%S) [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -520,6 +588,8 @@ fn F() {
// CHECK:STDOUT: } {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)]
// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() {
@@ -533,6 +603,12 @@ fn F() {
// CHECK:STDOUT: %.loc8_12.5: ref %S = converted %.loc8_12.1, %.loc8_12.4
// CHECK:STDOUT: %.loc8_12.6: %S = bind_value %.loc8_12.5
// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc8_12.6)
// CHECK:STDOUT: %impl.elem0: %.f1f = impl_witness_access constants.%Destroy.impl_witness.0f8, element0 [concrete = constants.%Op.9b3]
// CHECK:STDOUT: %bound_method.loc8_12.1: <bound method> = bound_method %.loc8_12.2, %impl.elem0
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Op.2(constants.%S) [concrete = constants.%Op.specific_fn]
// CHECK:STDOUT: %bound_method.loc8_12.2: <bound method> = bound_method %.loc8_12.2, %specific_fn
// CHECK:STDOUT: %.loc8_12.7: %S = bind_value %.loc8_12.2
// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_12.2(%.loc8_12.7)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -545,6 +621,17 @@ fn F() {
// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
// CHECK:STDOUT: %S.val: %S = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete]
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic]
// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic]
// CHECK:STDOUT: %Destroy.impl_witness.1b1: <witness> = impl_witness imports.%Destroy.impl_witness_table, @impl(%S) [concrete]
// CHECK:STDOUT: %Op.type.17f: type = fn_type @Op.2, @impl(%S) [concrete]
// CHECK:STDOUT: %Op.463: %Op.type.17f = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %S, (%Destroy.impl_witness.1b1) [concrete]
// CHECK:STDOUT: %.74f: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete]
// CHECK:STDOUT: %Op.specific_fn: <specific function> = specific_function %Op.463, @Op.2(%S) [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -561,6 +648,8 @@ fn F() {
// CHECK:STDOUT: } {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)]
// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() {
@@ -575,6 +664,12 @@ fn F() {
// CHECK:STDOUT: %.loc8_15.5: ref %S = converted %.loc8_15.1, %.loc8_15.4
// CHECK:STDOUT: %.loc8_15.6: %S = bind_value %.loc8_15.5
// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc8_15.6)
// CHECK:STDOUT: %impl.elem0: %.74f = impl_witness_access constants.%Destroy.impl_witness.1b1, element0 [concrete = constants.%Op.463]
// CHECK:STDOUT: %bound_method.loc8_15.1: <bound method> = bound_method %.loc8_15.2, %impl.elem0
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Op.2(constants.%S) [concrete = constants.%Op.specific_fn]
// CHECK:STDOUT: %bound_method.loc8_15.2: <bound method> = bound_method %.loc8_15.2, %specific_fn
// CHECK:STDOUT: %.loc8_15.7: %S = bind_value %.loc8_15.2
// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_15.2(%.loc8_15.7)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -589,6 +684,17 @@ fn F() {
// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
// CHECK:STDOUT: %S.val: %S = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete]
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic]
// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic]
// CHECK:STDOUT: %Destroy.impl_witness.2d2: <witness> = impl_witness imports.%Destroy.impl_witness_table, @impl(%S) [concrete]
// CHECK:STDOUT: %Op.type.642: type = fn_type @Op.2, @impl(%S) [concrete]
// CHECK:STDOUT: %Op.ab5: %Op.type.642 = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %S, (%Destroy.impl_witness.2d2) [concrete]
// CHECK:STDOUT: %.271: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete]
// CHECK:STDOUT: %Op.specific_fn: <specific function> = specific_function %Op.ab5, @Op.2(%S) [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -604,6 +710,8 @@ fn F() {
// CHECK:STDOUT: } {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)]
// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() {
@@ -622,6 +730,12 @@ fn F() {
// CHECK:STDOUT: %.loc9_12.5: ref %S = converted %.loc9_12.1, %.loc9_12.4
// CHECK:STDOUT: %.loc9_12.6: %S = bind_value %.loc9_12.5
// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc9_12.6)
// CHECK:STDOUT: %impl.elem0: %.271 = impl_witness_access constants.%Destroy.impl_witness.2d2, element0 [concrete = constants.%Op.ab5]
// CHECK:STDOUT: %bound_method.loc9_12.1: <bound method> = bound_method %.loc9_12.2, %impl.elem0
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Op.2(constants.%S) [concrete = constants.%Op.specific_fn]
// CHECK:STDOUT: %bound_method.loc9_12.2: <bound method> = bound_method %.loc9_12.2, %specific_fn
// CHECK:STDOUT: %.loc9_12.7: %S = bind_value %.loc9_12.2
// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc9_12.2(%.loc9_12.7)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -636,6 +750,17 @@ fn F() {
// CHECK:STDOUT: %S.val: %S = struct_value () [concrete]
// CHECK:STDOUT: %bar.type: type = fn_type @bar [concrete]
// CHECK:STDOUT: %bar: %bar.type = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete]
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic]
// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic]
// CHECK:STDOUT: %Destroy.impl_witness.2d2: <witness> = impl_witness imports.%Destroy.impl_witness_table, @impl(%S) [concrete]
// CHECK:STDOUT: %Op.type.642: type = fn_type @Op.2, @impl(%S) [concrete]
// CHECK:STDOUT: %Op.ab5: %Op.type.642 = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %S, (%Destroy.impl_witness.2d2) [concrete]
// CHECK:STDOUT: %.271: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete]
// CHECK:STDOUT: %Op.specific_fn: <specific function> = specific_function %Op.ab5, @Op.2(%S) [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -651,6 +776,8 @@ fn F() {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT: %bar.decl: %bar.type = fn_decl @bar [concrete = constants.%bar] {} {}
// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)]
// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() {
@@ -668,6 +795,12 @@ fn F() {
// CHECK:STDOUT: %S.ref: type = name_ref S, imports.%S.decl [concrete = constants.%S]
// CHECK:STDOUT: %bar.ref: %bar.type = name_ref bar, imports.%bar.decl [concrete = constants.%bar]
// CHECK:STDOUT: %bar.call: init %empty_tuple.type = call %bar.ref()
// CHECK:STDOUT: %impl.elem0: %.271 = impl_witness_access constants.%Destroy.impl_witness.2d2, element0 [concrete = constants.%Op.ab5]
// CHECK:STDOUT: %bound_method.loc8_12.1: <bound method> = bound_method %.loc8_12.2, %impl.elem0
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Op.2(constants.%S) [concrete = constants.%Op.specific_fn]
// CHECK:STDOUT: %bound_method.loc8_12.2: <bound method> = bound_method %.loc8_12.2, %specific_fn
// CHECK:STDOUT: %.loc8_12.7: %S = bind_value %.loc8_12.2
// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_12.2(%.loc8_12.7)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -719,9 +852,21 @@ fn F() {
// CHECK:STDOUT: --- import_definition_value_return_type.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
// CHECK:STDOUT: %S: type = class_type @S [concrete]
// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
// CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.1 [concrete]
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
// CHECK:STDOUT: %Op.type.bc9: type = fn_type @Op.2, @impl(%T) [symbolic]
// CHECK:STDOUT: %Op.46f: %Op.type.bc9 = struct_value () [symbolic]
// CHECK:STDOUT: %Destroy.impl_witness.2d2: <witness> = impl_witness imports.%Destroy.impl_witness_table, @impl(%S) [concrete]
// CHECK:STDOUT: %Op.type.642: type = fn_type @Op.2, @impl(%S) [concrete]
// CHECK:STDOUT: %Op.ab5: %Op.type.642 = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %S, (%Destroy.impl_witness.2d2) [concrete]
// CHECK:STDOUT: %.271: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet [concrete]
// CHECK:STDOUT: %Op.specific_fn: <specific function> = specific_function %Op.ab5, @Op.2(%S) [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -736,6 +881,8 @@ fn F() {
// CHECK:STDOUT: } {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import_ref.0b9: @impl.%Op.type (%Op.type.bc9) = import_ref Core//prelude/parts/destroy, loc8_23, loaded [symbolic = @impl.%Op (constants.%Op.46f)]
// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.0b9), @impl [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() {
@@ -745,6 +892,12 @@ fn F() {
// CHECK:STDOUT: %.loc8_11.1: ref %S = temporary_storage
// CHECK:STDOUT: %foo.call: init %S = call %foo.ref() to %.loc8_11.1
// CHECK:STDOUT: %.loc8_11.2: ref %S = temporary %.loc8_11.1, %foo.call
// CHECK:STDOUT: %impl.elem0: %.271 = impl_witness_access constants.%Destroy.impl_witness.2d2, element0 [concrete = constants.%Op.ab5]
// CHECK:STDOUT: %bound_method.loc8_11.1: <bound method> = bound_method %.loc8_11.1, %impl.elem0
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Op.2(constants.%S) [concrete = constants.%Op.specific_fn]
// CHECK:STDOUT: %bound_method.loc8_11.2: <bound method> = bound_method %.loc8_11.1, %specific_fn
// CHECK:STDOUT: %.loc8_11.3: %S = bind_value %.loc8_11.1
// CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc8_11.2(%.loc8_11.3)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT: