mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 12:01:05 +01:00
Resolve the definition of the self specific when re-entering its scope for an inline method definition. (#4281)
This fixes a crash if an inline method definition attempts to access a member of the enclosing generic scope directly. Fixes #4229.
This commit is contained in:
@@ -112,6 +112,12 @@ auto DeclNameStack::Restore(SuspendedName sus) -> void {
|
||||
// NOLINTNEXTLINE(performance-move-const-arg)
|
||||
decl_name_stack_.push_back(std::move(sus.name_context));
|
||||
for (auto& suspended_scope : llvm::reverse(sus.scopes)) {
|
||||
// Reattempt to resolve the definition of the specific. The generic might
|
||||
// have been defined after we suspended this scope.
|
||||
if (suspended_scope.entry.specific_id.is_valid()) {
|
||||
ResolveSpecificDefinition(*context_, suspended_scope.entry.specific_id);
|
||||
}
|
||||
|
||||
context_->scope_stack().Restore(std::move(suspended_scope));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user