mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-24 04:32:42 +00:00
When a `LookupImplWitness` instruction is created in a generic function for a witness obtained from a `BindSymbolicName`, it stores the `BindSymbolicName` as the query self type along with the interface it obtained from it. Later, when an argument is substituted into the `LookupImplWitness` in deduction, and it is re-evaluated, the `BindSymbolicName` in the query interface's specific arguments was being substituted, but the same `BindSymbolicName` in the query self type was not. This was because we did not substitute into the type of `BindSymbolicName`. In this case the type is a `FacetType` which has inside it one or more specific interfaces. The same substitution needs to be applied to both the interfaces in the self type as to the interfaces in the query. This issue was found by a fuzzer - though in a weirder and more invalid way, by putting all of the code for our test case inside an `interface`, which creates an implicit generic `Self` in the enclosing context and yet makes it concrete inside a function body.