mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Make BindSymbolicName the canonical form of a FacetValue wrapping the BindSymbolicName (#6107)
If a `BindSymbolicName` is converted to `type` and then to its exact `FacetType`, we get a `FacetValue` wrapping the `BindSymbolicName` but providing no different information: it has the same witnesses and `FacetType` as the original `BindSymbolicName`. Yet it is a different constant value, creating multiple canonical forms with the same meaning. Now we make that `FacetValue` with the same `FacetType` as the `BindSymbolicName` it wraps evaluate back to the `BindSymbolicName`, making it the unique canonical form. This makes the "shortcut" in convert for avoiding impl lookup when converting from `FacetAccessType` to `FacetType` in this exact scenario work the same as doing the full impl lookup. --------- Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
co-authored by
Richard Smith
parent
737c329aba
commit
82679e6689
@@ -196,8 +196,8 @@ fn MyF() {
|
||||
// CHECK:STDOUT: %Copy.impl_witness.2f8: <witness> = impl_witness imports.%Copy.impl_witness_table.1ed, @Int.as.Copy.impl(%int_16) [concrete]
|
||||
// CHECK:STDOUT: %Int.as.Copy.impl.Op.type.c73: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%int_16) [concrete]
|
||||
// CHECK:STDOUT: %Int.as.Copy.impl.Op.3dc: %Int.as.Copy.impl.Op.type.c73 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Copy.facet.4bb: %Copy.type = facet_value %i16, (%Copy.impl_witness.2f8) [concrete]
|
||||
// CHECK:STDOUT: %.798: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet.4bb [concrete]
|
||||
// CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %i16, (%Copy.impl_witness.2f8) [concrete]
|
||||
// CHECK:STDOUT: %.798: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet [concrete]
|
||||
// CHECK:STDOUT: %Int.as.Copy.impl.Op.bound: <bound method> = bound_method %int_1.f90, %Int.as.Copy.impl.Op.3dc [concrete]
|
||||
// CHECK:STDOUT: %Int.as.Copy.impl.Op.specific_fn: <specific function> = specific_function %Int.as.Copy.impl.Op.3dc, @Int.as.Copy.impl.Op(%int_16) [concrete]
|
||||
// CHECK:STDOUT: %bound_method.7c2: <bound method> = bound_method %int_1.f90, %Int.as.Copy.impl.Op.specific_fn [concrete]
|
||||
|
||||
Reference in New Issue
Block a user