mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-02 22:02:51 +01:00
The TypeStructureBuilder recursively iterates through a type, interface, or facet value and constructs a type structure that includes each concrete and symbolic value found. This iteration is a more general thing that can be useful elsewhere. For instance, to get just the root type out of a general type, it is the result of the first iteration step. We abstract out the iteration logic into a SemIR::TypeIterator to create a clear boundary between the work of iterating and the work of building the TypeStructure from it. Along the way this pointed out some issues in the TypeStructureBuilder where it could have ambiguity between types that include non-type values. So we add some tests for these cases, and they now pass. There are also TODOs left behind, as concrete TypeStructure is overly specific right now in order to keep these tests passing, which means that the concrete elements can't be used for impl lookup matching yet. Only the shape of concrete vs symbolic is used for now, and then type deduction is used to compare the actual concrete types, which could be skipped when the concrete values could be compared directly and reject an impl for not matching.