File tree Expand file tree Collapse file tree 3 files changed +26
-3
lines changed
test/SourceKit/CursorInfo Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -1159,7 +1159,6 @@ class PrintAST : public ASTVisitor<PrintAST> {
1159
1159
Type OldType = CurrentType;
1160
1160
if (CurrentType && (Old != nullptr || Options.PrintAsMember )) {
1161
1161
if (auto *NTD = dyn_cast<NominalTypeDecl>(D)) {
1162
- assert (Options.CurrentModule );
1163
1162
auto Subs = CurrentType->getContextSubstitutionMap (
1164
1163
NTD->getDeclContext ());
1165
1164
setCurrentType (NTD->getDeclaredInterfaceType ().subst (Subs));
Original file line number Diff line number Diff line change @@ -341,12 +341,13 @@ bool CursorInfoResolver::walkToExprPre(Expr *E) {
341
341
}
342
342
343
343
if (auto SAE = dyn_cast<SelfApplyExpr>(E)) {
344
- if (SAE->getFn ()->getStartLoc () == LocToResolve) {
344
+ auto *fn = SAE->getFn ();
345
+ if (!fn->isImplicit () && fn->getStartLoc () == LocToResolve) {
345
346
ContainerType = SAE->getBase ()->getType ();
346
347
}
347
348
} else if (auto ME = dyn_cast<MemberRefExpr>(E)) {
348
349
SourceLoc MemberLoc = ME->getNameLoc ().getBaseNameLoc ();
349
- if (MemberLoc.isValid () && MemberLoc == LocToResolve) {
350
+ if (!ME-> isImplicit () && MemberLoc.isValid () && MemberLoc == LocToResolve) {
350
351
ContainerType = ME->getBase ()->getType ();
351
352
}
352
353
}
Original file line number Diff line number Diff line change
1
+ @resultBuilder
2
+ struct Builder {
3
+ static func buildBlock< T> ( _ x: T ) -> T { x }
4
+ static func buildExpression< T> ( _ x: T ) -> T { x }
5
+ }
6
+
7
+ // https://github.com/swiftlang/swift/issues/79696
8
+ // Make sure we don't pick up the builder as the container type.
9
+ struct A {
10
+ struct B {
11
+ @Builder
12
+ var foo : Any {
13
+ B
14
+ // RUN: %sourcekitd-test -req=cursor -pos=%(line-1):7 %s -- %s | %FileCheck %s --check-prefix NESTED_TY
15
+ // NESTED_TY-NOT: Container
16
+ }
17
+ @Builder var bar : Any {
18
+ foo
19
+ // RUN: %sourcekitd-test -req=cursor -pos=%(line-1):7 %s -- %s | %FileCheck %s --check-prefix PROP
20
+ // PROP: <Container>$s4main1AV1BVD</Container>
21
+ }
22
+ }
23
+ }
You can’t perform that action at this time.
0 commit comments