mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-15 16:48:10 +00:00
If we perform impl lookup during identify by resolving a specific, we can run into IdentifiedWitnesses in a FacetValue. If the witness is the only one in the FacetValue we may use it as a final witness, which is not correct. IdentifiedWitness is not a final witness. To test this, we add a test that places an IdentifiedWitness into a FacetValue and then uses that facet value to get an associated constant. If treated as a final witness, we try to do a lookup where the query self contains the IdentifiedWitness and we crash coming across it in the TypeIterator. We should never come across an IdentifiedWitness in an impl lookup query. The test also shows a case that should work but does not because of `impl_lookup_no_symbolic_final_lookups`. We set `impl_lookup_no_symbolic_final_lookups` while collecting witnesses to avoid cycles in impl lookup. This test fails because of that. It prevents us from forming a correct specific for the class `C` by creating a specific where `C.C1` is a symbolic value. Later we try to form the specific again, where we would see a concrete value for `C.C1`, but the specific already exists, so we can't get to the concrete value.