Skip to content

Commit 91e27ad

Browse files
authored
Merge pull request #59666 from hamishknight/a-complete-parse
2 parents ababa79 + 53994d1 commit 91e27ad

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

lib/Parse/ParseDecl.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7383,7 +7383,8 @@ Parser::parseAbstractFunctionBodyImpl(AbstractFunctionDecl *AFD) {
73837383
// In implicit getter, if a CC token is the first token after '{', it might
73847384
// be a start of an accessor block. Perform special completion for that.
73857385
if (auto accessor = dyn_cast<AccessorDecl>(AFD)) {
7386-
if (peekToken().is(tok::code_complete) && accessor->isImplicitGetter()) {
7386+
if (CodeCompletion && peekToken().is(tok::code_complete) &&
7387+
accessor->isImplicitGetter()) {
73877388
SourceLoc LBraceLoc, RBraceLoc;
73887389
LBraceLoc = consumeToken(tok::l_brace);
73897390
auto *CCE = new (Context) CodeCompletionExpr(Tok.getLoc());
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
var foo: Double { 1 / 2 }
3+
var bar: Regex<Substring> { /x/ }
4+
var baz: Regex<Substring> { / x/ }
5+
var qux: Regex<Substring> { / x}/ }
6+
7+
// Check that we are not crashing
8+
// RUN: %sourcekitd-test \
9+
// RUN: -req=complete -pos=2:18 %s -- -enable-bare-slash-regex %s == \
10+
// RUN: -req=complete -pos=3:28 %s -- -enable-bare-slash-regex %s == \
11+
// RUN: -req=complete -pos=4:28 %s -- -enable-bare-slash-regex %s == \
12+
// RUN: -req=complete -pos=5:28 %s -- -enable-bare-slash-regex %s
13+
14+
// REQUIRES: swift_in_compiler

0 commit comments

Comments
 (0)