Skip to content

Commit 3908699

Browse files
authored
Merge pull request swiftlang#22552 from dcci/rdar47982630
2 parents 930ea50 + 2d73550 commit 3908699

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

lib/Parse/Lexer.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -957,8 +957,6 @@ void Lexer::lexDollarIdent() {
957957
// independent of language mode.
958958
return formToken(tok::identifier, tokStart);
959959
} else {
960-
if (LangOpts.EnableDollarIdentifiers && !LangOpts.Playground)
961-
return formToken(tok::identifier, tokStart);
962960
return formToken(tok::dollarident, tokStart);
963961
}
964962
}

lib/Parse/ParseExpr.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2923,6 +2923,12 @@ Expr *Parser::parseExprAnonClosureArg() {
29232923
auto closure = dyn_cast_or_null<ClosureExpr>(
29242924
dyn_cast<AbstractClosureExpr>(CurDeclContext));
29252925
if (!closure) {
2926+
if (Context.LangOpts.DebuggerSupport) {
2927+
auto refKind = DeclRefKind::Ordinary;
2928+
auto identifier = Context.getIdentifier(Name);
2929+
return new (Context) UnresolvedDeclRefExpr(DeclName(identifier), refKind,
2930+
DeclNameLoc(Loc));
2931+
}
29262932
diagnose(Loc, diag::anon_closure_arg_not_in_closure);
29272933
return new (Context) ErrorExpr(Loc);
29282934
}

test/Parse/closure-debugger.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// RUN: not %target-swift-frontend %s -typecheck -debugger-support 2>&1 | %FileCheck %s --check-prefix=DEBUG
2+
// RUN: not %target-swift-frontend %s -typecheck 2>&1 | %FileCheck %s --check-prefix=NODEBUG
3+
4+
// DEBUG: error: use of unresolved identifier '$0'
5+
// NODEBUG: error: anonymous closure argument not contained in a closure
6+
$0

0 commit comments

Comments
 (0)