mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Add alias name to name resolution after processing the target to avoid self-referencing name crash (#1295)
Fixes #1294
This commit is contained in:
@@ -66,7 +66,8 @@ static auto AddExposedNames(const Declaration& declaration,
|
||||
}
|
||||
case DeclarationKind::AliasDeclaration: {
|
||||
auto& alias = cast<AliasDeclaration>(declaration);
|
||||
CARBON_RETURN_IF_ERROR(enclosing_scope.Add(alias.name(), &alias));
|
||||
CARBON_RETURN_IF_ERROR(
|
||||
enclosing_scope.Add(alias.name(), &alias, /*usable=*/false));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -458,8 +459,9 @@ static auto ResolveNames(Declaration& declaration, StaticScope& enclosing_scope)
|
||||
}
|
||||
|
||||
case DeclarationKind::AliasDeclaration: {
|
||||
CARBON_RETURN_IF_ERROR(ResolveNames(
|
||||
cast<AliasDeclaration>(declaration).target(), enclosing_scope));
|
||||
auto& alias = cast<AliasDeclaration>(declaration);
|
||||
CARBON_RETURN_IF_ERROR(ResolveNames(alias.target(), enclosing_scope));
|
||||
enclosing_scope.MarkUsable(alias.name());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user