Skip to content

Make the shadowing logic more conservative about typealias declaratio… #2673

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions lib/AST/NameLookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,17 +154,17 @@ bool swift::removeShadowedDecls(SmallVectorImpl<ValueDecl*> &decls,
// types well.
CanType signature;

// FIXME: Egregious hack to avoid failing when there are no declared types.
if (!decl->hasType() || isa<TypeAliasDecl>(decl) || isa<AbstractTypeParamDecl>(decl)) {
// FIXME: Pass this down instead of getting it from the ASTContext.
if (typeResolver && !decl->isBeingTypeChecked())
typeResolver->resolveDeclSignature(decl);
if (!decl->hasType())
if (typeResolver && !decl->isBeingTypeChecked())
typeResolver->resolveDeclSignature(decl);

if (!decl->hasType())
continue;
if (auto aliasType = dyn_cast<TypeAliasDecl>(decl))
if (!aliasType->hasUnderlyingType())
continue;
if (auto assocType = dyn_cast<AssociatedTypeDecl>(decl))
if (!assocType->getArchetype())
continue;
if (auto assocType = dyn_cast<AssociatedTypeDecl>(decl))
if (!assocType->getArchetype())
continue;
}

// If the decl is currently being validated, this is likely a recursive
// reference and we'll want to skip ahead so as to avoid having its type
Expand Down
5 changes: 0 additions & 5 deletions validation-test/compiler_crashers_fixed/00429-vtable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

// RUN: not %target-swift-frontend %s -parse

// REQUIRES: asserts
// SR-1584
// XFAIL: objc_interop

}
struct S {
static let i: B<Q<T where A"""
Expand Down