[Type checker] Make redeclaration checking validate fewer declarations.

Redeclaration checking was validating all declarations with the same
base name as the given declaration (and in the same general nominal
type), even when it was trivial to determine that the declarations
could not be conflicting. Separate out the easy structural checks
(based on kind, full name, instance vs. non-instance member, etc.) and
perform those first, before validation.

Fixes SR-6558, a case where redeclaration checking caused some
unnecessary recursion in the type checker.
This commit is contained in:
Doug Gregor
2017-12-28 23:49:14 -08:00
parent fc253e8a23
commit 8b58b0dbb4
8 changed files with 114 additions and 112 deletions

View File

@@ -193,7 +193,7 @@ bool swift::removeShadowedDecls(SmallVectorImpl<ValueDecl*> &decls,
// constrained extensions, so use the overload signature's
// type. This is layering a partial fix upon a total hack.
if (auto asd = dyn_cast<AbstractStorageDecl>(decl))
signature = asd->getOverloadSignature().InterfaceType;
signature = asd->getOverloadSignatureType();
// If we've seen a declaration with this signature before, note it.
auto &knownDecls =