Skip to content

Commit f59c16f

Browse files
committed
Fix lookupVisibleDecls from inside an AutoClosureExpr.
1 parent 4ba74a2 commit f59c16f

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

lib/AST/LookupVisibleDecls.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,9 +799,8 @@ void swift::lookupVisibleDecls(VisibleDeclConsumer &Consumer,
799799

800800
// Look in the generic parameters after checking our local declaration.
801801
GenericParams = AFD->getGenericParams();
802-
} else if (auto ACE = dyn_cast<AbstractClosureExpr>(DC)) {
802+
} else if (auto CE = dyn_cast<ClosureExpr>(DC)) {
803803
if (Loc.isValid()) {
804-
auto CE = cast<ClosureExpr>(ACE);
805804
namelookup::FindLocalVal(SM, Loc, Consumer).visit(CE->getBody());
806805
if (auto P = CE->getParameters()) {
807806
namelookup::FindLocalVal(SM, Loc, Consumer).checkParameterList(P);

validation-test/compiler_crashers/28297-swift-lookupvisibledecls.swift renamed to validation-test/compiler_crashers_fixed/28297-swift-lookupvisibledecls.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
// See http://swift.org/LICENSE.txt for license information
66
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
77

8-
// RUN: not --crash %target-swift-frontend %s -parse
8+
// RUN: not %target-swift-frontend %s -parse
99
// REQUIRES: asserts
1010
{} ?? {let a{p

0 commit comments

Comments
 (0)