File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -3149,7 +3149,8 @@ Parser::parseDecl(ParseDeclOptions Flags,
3149
3149
3150
3150
if (DeclResult.hasCodeCompletion () && isCodeCompletionFirstPass () &&
3151
3151
!CurDeclContext->isModuleScopeContext () &&
3152
- !isa<TopLevelCodeDecl>(CurDeclContext)) {
3152
+ !isa<TopLevelCodeDecl>(CurDeclContext) &&
3153
+ !isa<AbstractClosureExpr>(CurDeclContext)) {
3153
3154
// Only consume non-toplevel decls.
3154
3155
consumeDecl (BeginParserPosition, Flags, /* IsTopLevel=*/ false );
3155
3156
Original file line number Diff line number Diff line change 56
56
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_IIFE_3 | %FileCheck %s -check-prefix=IN_IIFE_1
57
57
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_IIFE_4 | %FileCheck %s -check-prefix=IN_IIFE_1
58
58
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ERROR_IN_CLOSURE_IN_INITIALIZER | %FileCheck %s -check-prefix=ERROR_IN_CLOSURE_IN_INITIALIZER
59
+ // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DECL_IN_CLOSURE_IN_TOPLEVEL_INIT | %FileCheck %s -check-prefix=DECL_IN_CLOSURE_IN_TOPLEVEL_INIT
59
60
60
61
// ERROR_COMMON: found code completion token
61
62
// ERROR_COMMON-NOT: Begin completions
@@ -389,3 +390,14 @@ class C {
389
390
} ( )
390
391
}
391
392
393
+ var foo = {
394
+ let x = " Siesta: \( 3 ) " . #^DECL_IN_CLOSURE_IN_TOPLEVEL_INIT^#
395
+ // DECL_IN_CLOSURE_IN_TOPLEVEL_INIT: Begin completions
396
+ // DECL_IN_CLOSURE_IN_TOPLEVEL_INIT-DAG: Keyword[self]/CurrNominal: self[#String#]; name=self
397
+ // DECL_IN_CLOSURE_IN_TOPLEVEL_INIT-DAG: Decl[InstanceVar]/CurrNominal: count[#Int#]; name=count
398
+ // DECL_IN_CLOSURE_IN_TOPLEVEL_INIT-DAG: Decl[InstanceVar]/CurrNominal: unicodeScalars[#String.UnicodeScalarView#]; name=unicodeScalars
399
+ // DECL_IN_CLOSURE_IN_TOPLEVEL_INIT-DAG: Decl[InstanceMethod]/CurrNominal: hasPrefix({#(prefix): String#})[#Bool#]; name=hasPrefix(prefix: String)
400
+ // DECL_IN_CLOSURE_IN_TOPLEVEL_INIT-DAG: Decl[InstanceVar]/CurrNominal: utf16[#String.UTF16View#]; name=utf16
401
+ // DECL_IN_CLOSURE_IN_TOPLEVEL_INIT-DAG: Decl[InstanceMethod]/Super: dropFirst()[#Substring#]; name=dropFirst()
402
+ // DECL_IN_CLOSURE_IN_TOPLEVEL_INIT: End completions
403
+ }
You can’t perform that action at this time.
0 commit comments