File tree Expand file tree Collapse file tree 2 files changed +33
-6
lines changed Expand file tree Collapse file tree 2 files changed +33
-6
lines changed Original file line number Diff line number Diff line change @@ -1141,17 +1141,16 @@ bool Decl::isPrivateStdlibDecl(bool treatNonBuiltinProtocolsAsPublic) const {
11411141 }
11421142
11431143 DeclContext *DC = D->getDeclContext ()->getModuleScopeContext ();
1144- if ( DC->getParentModule ()-> isBuiltinModule () ||
1145- DC-> getParentModule () ->isSwiftShimsModule ())
1144+ auto *M = DC->getParentModule ();
1145+ if (M-> isBuiltinModule () || M ->isSwiftShimsModule ())
11461146 return true ;
1147- if (!DC-> getParentModule ()-> isSystemModule ())
1147+ if (!M-> isSystemModule () && !M-> isNonUserModule ())
11481148 return false ;
11491149 auto FU = dyn_cast<FileUnit>(DC);
11501150 if (!FU)
11511151 return false ;
1152- // Check for Swift module and overlays.
1153- if (!DC->getParentModule ()->isStdlibModule () &&
1154- FU->getKind () != FileUnitKind::SerializedAST)
1152+ // Check for stdlib and imported Swift modules.
1153+ if (!M->isStdlibModule () && FU->getKind () != FileUnitKind::SerializedAST)
11551154 return false ;
11561155
11571156 if (isa<ProtocolDecl>(D)) {
Original file line number Diff line number Diff line change 1+ // RUN: %empty-directory(%t/completions)
2+ // RUN: split-file %s %t
3+
4+ // RUN: %empty-directory(%t/Mock.platform/Developer/SDKs)
5+ // RUN: cp -r %clang-importer-sdk-path %t/Mock.platform/Developer/SDKs/Mock.sdk
6+
7+ // RUN: %empty-directory(%t/Mock.platform/Developer/usr/lib/Lib.swiftmodule)
8+ // RUN: %target-swift-frontend -emit-module %t/lib.swift -module-name Lib -swift-version 5 -emit-module-path %t/Mock.platform/Developer/usr/lib/Lib.swiftmodule/%module-target-triple.swiftmodule -enable-library-evolution -emit-module-interface-path %t/Mock.platform/Developer/usr/lib/Lib.swiftmodule/%module-target-triple.swiftinterface
9+
10+ // RUN: %target-swift-ide-test(mock-sdk: -sdk %t/Mock.platform/Developer/SDKs/Mock.sdk -I %t/Mock.platform/Developer/usr/lib) -batch-code-completion -source-filename %t/client.swift -filecheck %raw-FileCheck -completion-output-dir %t/completions
11+
12+ // REQUIRES: objc_interop
13+
14+ // rdar://131854240 - Make sure we don't show underscored decls in non-user
15+ // modules.
16+
17+ //--- lib.swift
18+
19+ public struct SomeNonUnderscoredType { }
20+ public struct _SomeUnderscoredType { }
21+
22+ //--- client.swift
23+
24+ import Lib
25+
26+ #^TOPLEVEL? check= TOPLEVEL;check= TOPLEVEL_NOT^#
27+ // TOPLEVEL: Decl[Struct]/OtherModule[Lib]/IsSystem: SomeNonUnderscoredType[#SomeNonUnderscoredType#]
28+ // TOPLEVEL_NOT-NOT: _SomeUnderscoredType
You can’t perform that action at this time.
0 commit comments