@@ -84,6 +84,11 @@ auto Lookup::lookupHelper(Scope* scope, const Name* name,
8484 cache.insert (scope);
8585
8686 for (auto symbol : scope->find (name)) {
87+ if (auto u = symbol_cast<UsingDeclarationSymbol>(symbol);
88+ u && u->target ()) {
89+ return u->target ();
90+ }
91+
8792 return symbol;
8893 }
8994
@@ -185,6 +190,30 @@ auto Lookup::lookupType(NestedNameSpecifierAST* nestedNameSpecifier,
185190 return nullptr ;
186191 }
187192
193+ case SymbolKind::kUsingDeclaration : {
194+ auto usingDeclaration =
195+ symbol_cast<UsingDeclarationSymbol>(nestedNameSpecifier->symbol );
196+
197+ if (!usingDeclaration->target ()) return nullptr ;
198+
199+ if (auto classSymbol =
200+ symbol_cast<ClassSymbol>(usingDeclaration->target ())) {
201+ return lookupTypeHelper (classSymbol->scope (), id, set);
202+ }
203+
204+ if (auto enumSymbol =
205+ symbol_cast<EnumSymbol>(usingDeclaration->target ())) {
206+ return lookupTypeHelper (enumSymbol->scope (), id, set);
207+ }
208+
209+ if (auto scopedEnumSymbol =
210+ symbol_cast<ScopedEnumSymbol>(usingDeclaration->target ())) {
211+ return lookupTypeHelper (scopedEnumSymbol->scope (), id, set);
212+ }
213+
214+ return nullptr ;
215+ }
216+
188217 default :
189218 return nullptr ;
190219 } // swotch
@@ -198,9 +227,9 @@ auto Lookup::lookupTypeHelper(Scope* scope, const Identifier* id,
198227 }
199228
200229 for (auto candidate : scope->find (id)) {
201- if (candidate->isClassOrNamespace () || candidate->isEnumOrScopedEnum () ||
202- candidate->isTypeAlias () || candidate->isTypeParameter ())
230+ if (is_type (candidate) || candidate->isNamespace ()) {
203231 return candidate;
232+ }
204233 }
205234
206235 if (auto classSymbol = symbol_cast<ClassSymbol>(scope->owner ())) {
0 commit comments