mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +01:00
Instead of using None, use an explicit ImplWitnessTablePlaceholder in the witness table for entries that have not yet been populated, to aid debugging. This would ensure they would show up very clearly in the SemIR. This uncovered some `<invalid>` in the SemIR under erroneous conditions that have now been turned into `<error>`. Add the ImplWitnessAssociatedConstant instruction which wraps the canonical instruction found from the constant value of the rewrite constraint. This ensures that we have an instruction inside the eval block for a generic impl declaration for each rewrite constraint's value, which allows Subst to be performed to rewrite the symbolic constant of the ImplWitnessAssociatedConstant instruction to associate it with the generic. This will prevent the otherwise orphaned symbolic constant of the rewrite's value from being used which can not have a specific applied to them. While applying the new insts in InitialFacetTypeImplWitness(), rearrange the function to use less nesting. And avoid using entity names from imported instructions (as we found is not effective in deduce.cpp) and use a local instruction by going through the constant value. This PR is part of the effort to allow a rewrite to name a generic parameter, such as `impl forall [T:! type] T as Z where .X = T`, however tests for this involve a final impl so that we can typecheck that the .X value is a specific T, so the tests will come with that work. This piece is split off because introducing new instructions causes a lot of SemIR churn, and I wanted to get that done separately.