mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Look through extend require in an interface or named constraint in name lookup (#6630)
Add the required facet type as an extended scope of the containing interface/named constraint, and teach name lookup to look for extended scopes in named constraints. This makes name lookup work properly when the facet type does not have a specific that involves `Self`. Support for `Self` needs further work in another PR. Note that when an _interface_ requires another interface, this PR lets us find the name, but we still fail to find a witness for the interface named through `extend require`, and this is future work. For a named constraint, things work correctly as the identified facet type chases through the named constraint and includes the required interface, so impl lookup is able to provide a witness.
This commit is contained in:
@@ -2779,9 +2779,6 @@ static auto AddInterfaceDefinition(ImportContext& context,
|
||||
new_interface.body_block_id =
|
||||
context.local_context().inst_block_stack().Pop();
|
||||
new_interface.self_param_id = self_param_id;
|
||||
|
||||
CARBON_CHECK(import_scope.extended_scopes().empty(),
|
||||
"Interfaces don't currently have extended scopes to support.");
|
||||
}
|
||||
|
||||
static auto TryResolveTypedInst(ImportRefResolver& resolver,
|
||||
@@ -2930,10 +2927,6 @@ static auto AddNamedConstraintDefinition(
|
||||
context.local_context().inst_block_stack().Pop();
|
||||
new_named_constraint.self_param_id = self_param_id;
|
||||
new_named_constraint.complete = import_named_constraint.complete;
|
||||
|
||||
CARBON_CHECK(
|
||||
import_scope.extended_scopes().empty(),
|
||||
"Named constraints don't currently have extended scopes to support.");
|
||||
}
|
||||
|
||||
static auto TryResolveTypedInst(ImportRefResolver& resolver,
|
||||
|
||||
Reference in New Issue
Block a user