File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed
test/SourceKit/CodeExpand
tools/SourceKit/lib/SwiftLang Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -195,3 +195,24 @@ singleExprClosureMultiArg(1) {
195
195
// CHECK: withtrail {
196
196
// CHECK-NEXT: <#code#>
197
197
}
198
+
199
+ func active( ) {
200
+ foo ( < #T##value: Foo##Foo#> )
201
+ // CHECK: foo(Foo)
202
+ }
203
+ func activeWithTrailing( ) {
204
+ forEach ( < #T##( ) - > ( ) #> )
205
+ // CHECK: forEach {
206
+ // CHECK-NEXT: <#code#>
207
+ }
208
+ #if false
209
+ func inactive( ) {
210
+ foo ( < #T##value: Foo##Foo#> )
211
+ // CHECK: foo(Foo)
212
+ }
213
+ func inactiveWithTrailing( ) {
214
+ forEach ( < #T##( ) - > ( ) #> )
215
+ // CHECK: forEach {
216
+ // CHECK-NEXT: <#code#>
217
+ }
218
+ #endif
Original file line number Diff line number Diff line change @@ -1409,6 +1409,22 @@ class PlaceholderExpansionScanner {
1409
1409
}
1410
1410
return { true , E };
1411
1411
}
1412
+
1413
+ bool walkToDeclPre (Decl *D) override {
1414
+ if (auto *ICD = dyn_cast<IfConfigDecl>(D)) {
1415
+ // The base walker assumes the content of active IfConfigDecl clauses
1416
+ // has been injected into the parent context and will be walked there.
1417
+ // This doesn't hold for pre-typechecked ASTs and we need to find
1418
+ // placeholders in inactive clauses anyway, so walk them here.
1419
+ for (auto Clause: ICD->getClauses ()) {
1420
+ for (auto Elem: Clause.Elements ) {
1421
+ Elem.walk (*this );
1422
+ }
1423
+ }
1424
+ return false ;
1425
+ }
1426
+ return true ;
1427
+ }
1412
1428
};
1413
1429
1414
1430
class ClosureTypeWalker : public ASTWalker {
@@ -1571,6 +1587,8 @@ class PlaceholderExpansionScanner {
1571
1587
return true ;
1572
1588
}
1573
1589
1590
+ bool shouldWalkInactiveConfigRegion () override { return true ; }
1591
+
1574
1592
Expr *findEnclosingCallArg (SourceFile &SF, SourceLoc SL) {
1575
1593
EnclosingCallAndArg = {nullptr , nullptr };
1576
1594
OuterExpr = nullptr ;
You can’t perform that action at this time.
0 commit comments