mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Allow extend adapt of non-class types. (#4544)
Stop rejecting `extend adapt` of non-class types such as struct and tuple. These don't actually work just yet because name lookup into struct and tuple types is a special case that doesn't handle adapters, but this gets us a bit closer. This also slightly improves error recovery for name lookup into an invalid scope.
This commit is contained in:
@@ -481,6 +481,12 @@ auto Context::AppendLookupScopesForConstant(
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (base_const_id == SemIR::ConstantId::Error) {
|
||||
// Lookup into this scope should fail without producing an error.
|
||||
scopes->push_back(LookupScope{.name_scope_id = SemIR::NameScopeId::Invalid,
|
||||
.specific_id = SemIR::SpecificId::Invalid});
|
||||
return true;
|
||||
}
|
||||
// TODO: Per the design, if `base_id` is any kind of type, then lookup should
|
||||
// treat it as a name scope, even if it doesn't have members. For example,
|
||||
// `(i32*).X` should fail because there's no name `X` in `i32*`, not because
|
||||
|
||||
Reference in New Issue
Block a user