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> {
11591159 Type OldType = CurrentType;
11601160 if (CurrentType && (Old != nullptr || Options.PrintAsMember )) {
11611161 if (auto *NTD = dyn_cast<NominalTypeDecl>(D)) {
1162- assert (Options.CurrentModule );
11631162 auto Subs = CurrentType->getContextSubstitutionMap (
11641163 NTD->getDeclContext ());
11651164 setCurrentType (NTD->getDeclaredInterfaceType ().subst (Subs));
Original file line number Diff line number Diff line change @@ -341,12 +341,13 @@ bool CursorInfoResolver::walkToExprPre(Expr *E) {
341341 }
342342
343343 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) {
345346 ContainerType = SAE->getBase ()->getType ();
346347 }
347348 } else if (auto ME = dyn_cast<MemberRefExpr>(E)) {
348349 SourceLoc MemberLoc = ME->getNameLoc ().getBaseNameLoc ();
349- if (MemberLoc.isValid () && MemberLoc == LocToResolve) {
350+ if (!ME-> isImplicit () && MemberLoc.isValid () && MemberLoc == LocToResolve) {
350351 ContainerType = ME->getBase ()->getType ();
351352 }
352353 }
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