mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 16:11:06 +01:00
Resolve nested accesses in rewrite constraints (#5872)
A rewrite constraint like `.X = .Y.Z and .Y = .Self and .Z = ()` has a nested `ImplWitnessAccess` `.Y.Z` (technically `(.Self.Y).Z`). The inner access `.Self.Y` needs to be resolved (in this case to `.Self`) before the outer `???.Z` can be resolved as `.Self.Z` which is `()`.
This commit is contained in:
@@ -635,10 +635,7 @@ static auto GetConstantFacetTypeInfo(EvalContext& eval_context,
|
||||
// Rewrite constraints are resolved first before replacing them with their
|
||||
// canonical instruction, so that in a `WhereExpr` we can work with the
|
||||
// `ImplWitnessAccess` references to `.Self` on the LHS of the constraints
|
||||
// rather than the value of the associated constant they reference. It also
|
||||
// ensures that any errors inserted during resolution will be seen by
|
||||
// GetConstantValueIgnoringPeriodSelf() which will update the phase
|
||||
// accordingly.
|
||||
// rather than the value of the associated constant they reference.
|
||||
info.rewrite_constraints = orig.rewrite_constraints;
|
||||
if (!ResolveFacetTypeRewriteConstraints(eval_context.context(), loc_id,
|
||||
info.rewrite_constraints)) {
|
||||
|
||||
Reference in New Issue
Block a user