Skip to content

Commit bbeec57

Browse files
committed
[NamedLazyMemberLoading] Handle case of source extension on deserialized type.
1 parent a8f1b42 commit bbeec57

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

lib/AST/NameLookup.cpp

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,6 +1310,20 @@ populateLookupTableEntryFromLazyIDCLoader(ASTContext &ctx,
13101310
}
13111311
}
13121312

1313+
static void
1314+
populateLookupTableEntryFromMembers(ASTContext &ctx,
1315+
MemberLookupTable &LookupTable,
1316+
DeclName name,
1317+
IterableDeclContext *IDC) {
1318+
for (auto m : IDC->getMembers()) {
1319+
if (auto v = dyn_cast<ValueDecl>(m)) {
1320+
if (v->getFullName().matchesRef(name)) {
1321+
LookupTable.addMember(m);
1322+
}
1323+
}
1324+
}
1325+
}
1326+
13131327
TinyPtrVector<ValueDecl *> NominalTypeDecl::lookupDirect(
13141328
DeclName name,
13151329
bool ignoreNewExtensions) {
@@ -1385,10 +1399,15 @@ TinyPtrVector<ValueDecl *> NominalTypeDecl::lookupDirect(
13851399
} else {
13861400
if (!ignoreNewExtensions) {
13871401
for (auto E : getExtensions()) {
1388-
if (populateLookupTableEntryFromLazyIDCLoader(ctx, Table,
1389-
name, E)) {
1390-
useNamedLazyMemberLoading = false;
1391-
break;
1402+
if (E->wasDeserialized()) {
1403+
if (populateLookupTableEntryFromLazyIDCLoader(ctx, Table,
1404+
name, E)) {
1405+
useNamedLazyMemberLoading = false;
1406+
break;
1407+
}
1408+
} else {
1409+
populateLookupTableEntryFromMembers(ctx, Table,
1410+
name, E);
13921411
}
13931412
}
13941413
}

0 commit comments

Comments
 (0)