mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-17 21:20:42 +00:00
`T as I` outside of a type position is a facet value, which does not have the interface of its original type. But when used in a type position, or converted explicitly back to `type`, it recovers its original type. See https://docs.carbon-lang.dev/docs/design/generics/details.html#facet-types: > The requirements determine which types may be implicitly converted to > a given facet type. The result of this conversion is a facet. For > example, Point_Inline from the “Inline impl” section implements > Vector, so Point_Inline may be implicitly converted to Vector as > considered as a type. The result is `Point_Inline as Vector`, which > has the members of Vector instead of the members of Point_Inline. If > the facet `Point_Inline as Vector` is used in a type position, it is > implicitly converted back to type type, see. This recovers the > original type for the facet, so `(Point_Inline as Vector) as type` is > `Point_Inline` again.