Skip to content

Commit ac79fa2

Browse files
committed
[Type checker] Fix DeclContext computation for inherited type lookup.
1 parent 955fab8 commit ac79fa2

File tree

2 files changed

+0
-29
lines changed

2 files changed

+0
-29
lines changed

lib/Sema/TypeCheckDecl.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -248,20 +248,6 @@ void TypeChecker::checkInheritanceClause(Decl *decl,
248248
} else if (auto ext = dyn_cast<ExtensionDecl>(decl)) {
249249
DC = ext;
250250
options |= TypeResolutionFlags::AllowUnavailableProtocol;
251-
} else if (isa<GenericTypeParamDecl>(decl)) {
252-
// For generic parameters, we want name lookup to look at just the
253-
// signature of the enclosing entity.
254-
DC = decl->getDeclContext();
255-
if (auto nominal = dyn_cast<NominalTypeDecl>(DC)) {
256-
DC = nominal;
257-
} else if (auto ext = dyn_cast<ExtensionDecl>(DC)) {
258-
DC = ext;
259-
} else if (auto func = dyn_cast<AbstractFunctionDecl>(DC)) {
260-
DC = func;
261-
} else if (!DC->isModuleScopeContext()) {
262-
// Skip the generic parameter's context entirely.
263-
DC = DC->getParent();
264-
}
265251
} else {
266252
DC = decl->getDeclContext();
267253
}

lib/Sema/TypeCheckRequestFunctions.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,6 @@ Type InheritedTypeRequest::evaluate(
3333
options |= TypeResolutionFlags::AllowUnavailableProtocol;
3434
} else {
3535
dc = typeDecl->getDeclContext();
36-
37-
if (isa<GenericTypeParamDecl>(typeDecl)) {
38-
// For generic parameters, we want name lookup to look at just the
39-
// signature of the enclosing entity.
40-
if (auto nominal = dyn_cast<NominalTypeDecl>(dc)) {
41-
dc = nominal;
42-
} else if (auto ext = dyn_cast<ExtensionDecl>(dc)) {
43-
dc = ext;
44-
} else if (auto func = dyn_cast<AbstractFunctionDecl>(dc)) {
45-
dc = func;
46-
} else if (!dc->isModuleScopeContext()) {
47-
// Skip the generic parameter's context entirely.
48-
dc = dc->getParent();
49-
}
50-
}
5136
}
5237
} else {
5338
auto ext = decl.get<ExtensionDecl *>();

0 commit comments

Comments
 (0)