mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Generate non-final Destroy witnesses for symbolics (#6731)
This is related to #6727, but is generally a necessary fix even without that issue. I'm not adding a specific test of #6727 because it should also be covered by the tests in #6726. Assisted-by: Google Antigravity with Gemini 3 Flash
This commit is contained in:
+23
-11
@@ -57,11 +57,11 @@ fn CallNegative() {
|
||||
// CHECK:STDOUT: %pattern_type.764: type = pattern_type %Int [symbolic]
|
||||
// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op.type: type = fn_type @Destroy.Op [concrete]
|
||||
// CHECK:STDOUT: %DestroyOp.type: type = fn_type @DestroyOp [concrete]
|
||||
// CHECK:STDOUT: %DestroyOp: %DestroyOp.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %custom_witness.809: <witness> = custom_witness (%DestroyOp), @Destroy [concrete]
|
||||
// CHECK:STDOUT: %Destroy.facet.3e3: %Destroy.type = facet_value %Int, (%custom_witness.809) [symbolic]
|
||||
// CHECK:STDOUT: %.623: type = fn_type_with_self_type %Destroy.Op.type, %Destroy.facet.3e3 [symbolic]
|
||||
// CHECK:STDOUT: %Destroy.lookup_impl_witness: <witness> = lookup_impl_witness %Int, @Destroy [symbolic]
|
||||
// CHECK:STDOUT: %Destroy.facet.1c0: %Destroy.type = facet_value %Int, (%Destroy.lookup_impl_witness) [symbolic]
|
||||
// CHECK:STDOUT: %.3e7: type = fn_type_with_self_type %Destroy.Op.type, %Destroy.facet.1c0 [symbolic]
|
||||
// CHECK:STDOUT: %impl.elem0: %.3e7 = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic]
|
||||
// CHECK:STDOUT: %specific_impl_fn: <specific function> = specific_impl_function %impl.elem0, @Destroy.Op(%Destroy.facet.1c0) [symbolic]
|
||||
// CHECK:STDOUT: %CallNegative.type: type = fn_type @CallNegative [concrete]
|
||||
// CHECK:STDOUT: %CallNegative: %CallNegative.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete]
|
||||
@@ -69,6 +69,9 @@ fn CallNegative() {
|
||||
// CHECK:STDOUT: %i0: type = class_type @Int, @Int(%int_0) [concrete]
|
||||
// CHECK:STDOUT: %complete_type.d94: <witness> = complete_type_witness <error> [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.47b: type = pattern_type %i0 [concrete]
|
||||
// CHECK:STDOUT: %DestroyOp.type: type = fn_type @DestroyOp [concrete]
|
||||
// CHECK:STDOUT: %DestroyOp: %DestroyOp.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %custom_witness.809: <witness> = custom_witness (%DestroyOp), @Destroy [concrete]
|
||||
// CHECK:STDOUT: %Destroy.facet.7e1: %Destroy.type = facet_value %i0, (%custom_witness.809) [concrete]
|
||||
// CHECK:STDOUT: %.918: type = fn_type_with_self_type %Destroy.Op.type, %Destroy.facet.7e1 [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
@@ -116,8 +119,11 @@ fn CallNegative() {
|
||||
// CHECK:STDOUT: %Int.loc15_20.2: type = class_type @Int, @Int(%N.loc4_19.1) [symbolic = %Int.loc15_20.2 (constants.%Int)]
|
||||
// CHECK:STDOUT: %require_complete: <witness> = require_complete_type %Int.loc15_20.2 [symbolic = %require_complete (constants.%require_complete.901)]
|
||||
// CHECK:STDOUT: %pattern_type: type = pattern_type %Int.loc15_20.2 [symbolic = %pattern_type (constants.%pattern_type.764)]
|
||||
// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %Int.loc15_20.2, (constants.%custom_witness.809) [symbolic = %Destroy.facet (constants.%Destroy.facet.3e3)]
|
||||
// CHECK:STDOUT: %.loc15_3: type = fn_type_with_self_type constants.%Destroy.Op.type, %Destroy.facet [symbolic = %.loc15_3 (constants.%.623)]
|
||||
// CHECK:STDOUT: %Destroy.lookup_impl_witness: <witness> = lookup_impl_witness %Int.loc15_20.2, @Destroy [symbolic = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness)]
|
||||
// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %Int.loc15_20.2, (%Destroy.lookup_impl_witness) [symbolic = %Destroy.facet (constants.%Destroy.facet.1c0)]
|
||||
// CHECK:STDOUT: %.loc15_3: type = fn_type_with_self_type constants.%Destroy.Op.type, %Destroy.facet [symbolic = %.loc15_3 (constants.%.3e7)]
|
||||
// CHECK:STDOUT: %impl.elem0.loc15_3.2: @ErrorIfNIsZero.%.loc15_3 (%.3e7) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc15_3.2 (constants.%impl.elem0)]
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc15_3.2: <specific function> = specific_impl_function %impl.elem0.loc15_3.2, @Destroy.Op(%Destroy.facet) [symbolic = %specific_impl_fn.loc15_3.2 (constants.%specific_impl_fn)]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
@@ -133,14 +139,15 @@ fn CallNegative() {
|
||||
// CHECK:STDOUT: %Int.loc15_20.1: type = class_type @Int, @Int(constants.%N) [symbolic = %Int.loc15_20.2 (constants.%Int)]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %v: ref @ErrorIfNIsZero.%Int.loc15_20.2 (%Int) = ref_binding v, %v.var
|
||||
// CHECK:STDOUT: %DestroyOp.bound: <bound method> = bound_method %v.var, constants.%DestroyOp
|
||||
// CHECK:STDOUT: %DestroyOp.call: init %empty_tuple.type = call %DestroyOp.bound(%v.var)
|
||||
// CHECK:STDOUT: %impl.elem0.loc15_3.1: @ErrorIfNIsZero.%.loc15_3 (%.3e7) = impl_witness_access constants.%Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc15_3.2 (constants.%impl.elem0)]
|
||||
// CHECK:STDOUT: %bound_method.loc15_3.1: <bound method> = bound_method %v.var, %impl.elem0.loc15_3.1
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc15_3.1: <specific function> = specific_impl_function %impl.elem0.loc15_3.1, @Destroy.Op(constants.%Destroy.facet.1c0) [symbolic = %specific_impl_fn.loc15_3.2 (constants.%specific_impl_fn)]
|
||||
// CHECK:STDOUT: %bound_method.loc15_3.2: <bound method> = bound_method %v.var, %specific_impl_fn.loc15_3.1
|
||||
// CHECK:STDOUT: %Destroy.Op.call: init %empty_tuple.type = call %bound_method.loc15_3.2(%v.var)
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @DestroyOp(%self.param: @ErrorIfNIsZero.%Int.loc15_20.2 (%Int)) = "no_op";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @CallNegative() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %ErrorIfNIsZero.ref: %ErrorIfNIsZero.type = name_ref ErrorIfNIsZero, file.%ErrorIfNIsZero.decl [concrete = constants.%ErrorIfNIsZero]
|
||||
@@ -150,6 +157,8 @@ fn CallNegative() {
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @DestroyOp(%self.param: %i0) = "no_op";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: specific @ErrorIfNIsZero(constants.%N) {
|
||||
// CHECK:STDOUT: %N.loc4_19.1 => constants.%N
|
||||
// CHECK:STDOUT: }
|
||||
@@ -161,7 +170,10 @@ fn CallNegative() {
|
||||
// CHECK:STDOUT: %Int.loc15_20.2 => constants.%i0
|
||||
// CHECK:STDOUT: %require_complete => constants.%complete_type.d94
|
||||
// CHECK:STDOUT: %pattern_type => constants.%pattern_type.47b
|
||||
// CHECK:STDOUT: %Destroy.lookup_impl_witness => constants.%custom_witness.809
|
||||
// CHECK:STDOUT: %Destroy.facet => constants.%Destroy.facet.7e1
|
||||
// CHECK:STDOUT: %.loc15_3 => constants.%.918
|
||||
// CHECK:STDOUT: %impl.elem0.loc15_3.2 => constants.%DestroyOp
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc15_3.2 => constants.%DestroyOp
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
+15
-11
@@ -34,11 +34,11 @@ fn F(T:! type) {
|
||||
// CHECK:STDOUT: %pattern_type.51d: type = pattern_type %T [symbolic]
|
||||
// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op.type: type = fn_type @Destroy.Op [concrete]
|
||||
// CHECK:STDOUT: %DestroyOp.type: type = fn_type @DestroyOp [concrete]
|
||||
// CHECK:STDOUT: %DestroyOp: %DestroyOp.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %custom_witness.809: <witness> = custom_witness (%DestroyOp), @Destroy [concrete]
|
||||
// CHECK:STDOUT: %Destroy.facet.06f: %Destroy.type = facet_value %ptr, (%custom_witness.809) [symbolic]
|
||||
// CHECK:STDOUT: %.660: type = fn_type_with_self_type %Destroy.Op.type, %Destroy.facet.06f [symbolic]
|
||||
// CHECK:STDOUT: %Destroy.lookup_impl_witness: <witness> = lookup_impl_witness %ptr, @Destroy [symbolic]
|
||||
// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %ptr, (%Destroy.lookup_impl_witness) [symbolic]
|
||||
// CHECK:STDOUT: %.655: type = fn_type_with_self_type %Destroy.Op.type, %Destroy.facet [symbolic]
|
||||
// CHECK:STDOUT: %impl.elem0: %.655 = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic]
|
||||
// CHECK:STDOUT: %specific_impl_fn: <specific function> = specific_impl_function %impl.elem0, @Destroy.Op(%Destroy.facet) [symbolic]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
@@ -73,8 +73,11 @@ fn F(T:! type) {
|
||||
// CHECK:STDOUT: %pattern_type.loc16: type = pattern_type %ptr.loc16_11.2 [symbolic = %pattern_type.loc16 (constants.%pattern_type.4f4)]
|
||||
// CHECK:STDOUT: %require_complete.loc17: <witness> = require_complete_type %T.loc15_6.1 [symbolic = %require_complete.loc17 (constants.%require_complete.944)]
|
||||
// CHECK:STDOUT: %pattern_type.loc17: type = pattern_type %T.loc15_6.1 [symbolic = %pattern_type.loc17 (constants.%pattern_type.51d)]
|
||||
// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %ptr.loc16_11.2, (constants.%custom_witness.809) [symbolic = %Destroy.facet (constants.%Destroy.facet.06f)]
|
||||
// CHECK:STDOUT: %.loc16_3: type = fn_type_with_self_type constants.%Destroy.Op.type, %Destroy.facet [symbolic = %.loc16_3 (constants.%.660)]
|
||||
// CHECK:STDOUT: %Destroy.lookup_impl_witness: <witness> = lookup_impl_witness %ptr.loc16_11.2, @Destroy [symbolic = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness)]
|
||||
// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %ptr.loc16_11.2, (%Destroy.lookup_impl_witness) [symbolic = %Destroy.facet (constants.%Destroy.facet)]
|
||||
// CHECK:STDOUT: %.loc16_3: type = fn_type_with_self_type constants.%Destroy.Op.type, %Destroy.facet [symbolic = %.loc16_3 (constants.%.655)]
|
||||
// CHECK:STDOUT: %impl.elem0.loc16_3.2: @F.%.loc16_3 (%.655) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc16_3.2 (constants.%impl.elem0)]
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc16_3.2: <specific function> = specific_impl_function %impl.elem0.loc16_3.2, @Destroy.Op(%Destroy.facet) [symbolic = %specific_impl_fn.loc16_3.2 (constants.%specific_impl_fn)]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
@@ -97,14 +100,15 @@ fn F(T:! type) {
|
||||
// CHECK:STDOUT: %T.ref.loc17: type = name_ref T, %T.loc15_6.2 [symbolic = %T.loc15_6.1 (constants.%T)]
|
||||
// CHECK:STDOUT: %.loc17_14.2: @F.%T.loc15_6.1 (%T) = acquire_value %.loc17_14.1
|
||||
// CHECK:STDOUT: %n: @F.%T.loc15_6.1 (%T) = value_binding n, %.loc17_14.2
|
||||
// CHECK:STDOUT: %DestroyOp.bound: <bound method> = bound_method %p.var, constants.%DestroyOp
|
||||
// CHECK:STDOUT: %DestroyOp.call: init %empty_tuple.type = call %DestroyOp.bound(%p.var)
|
||||
// CHECK:STDOUT: %impl.elem0.loc16_3.1: @F.%.loc16_3 (%.655) = impl_witness_access constants.%Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc16_3.2 (constants.%impl.elem0)]
|
||||
// CHECK:STDOUT: %bound_method.loc16_3.1: <bound method> = bound_method %p.var, %impl.elem0.loc16_3.1
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc16_3.1: <specific function> = specific_impl_function %impl.elem0.loc16_3.1, @Destroy.Op(constants.%Destroy.facet) [symbolic = %specific_impl_fn.loc16_3.2 (constants.%specific_impl_fn)]
|
||||
// CHECK:STDOUT: %bound_method.loc16_3.2: <bound method> = bound_method %p.var, %specific_impl_fn.loc16_3.1
|
||||
// CHECK:STDOUT: %Destroy.Op.call: init %empty_tuple.type = call %bound_method.loc16_3.2(%p.var)
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @DestroyOp(%self.param: @F.%ptr.loc16_11.2 (%ptr)) = "no_op";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: specific @F(constants.%T) {
|
||||
// CHECK:STDOUT: %T.loc15_6.1 => constants.%T
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
Reference in New Issue
Block a user