File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -2923,10 +2923,18 @@ bool FileUnit::walk(ASTWalker &walker) {
29232923 !walker.shouldWalkSerializedTopLevelInternalDecls ();
29242924 for (Decl *D : Decls) {
29252925 if (SkipInternal) {
2926+ // Ignore if the decl isn't visible
29262927 if (auto *VD = dyn_cast<ValueDecl>(D)) {
29272928 if (!VD->isAccessibleFrom (nullptr ))
29282929 continue ;
29292930 }
2931+
2932+ // Also ignore if the extended nominal isn't visible
2933+ if (auto *ED = dyn_cast<ExtensionDecl>(D)) {
2934+ auto *ND = ED->getExtendedNominal ();
2935+ if (ND && !ND->isAccessibleFrom (nullptr ))
2936+ continue ;
2937+ }
29302938 }
29312939
29322940#ifndef NDEBUG
Original file line number Diff line number Diff line change 1+ // RUN: %empty-directory(%t)
2+ // RUN: mkdir -p %t/Frameworks/lib.framework/Modules/lib.swiftmodule
3+ // RUN: mkdir -p %t/Frameworks/lib2.framework/Modules/lib2.swiftmodule
4+ // RUN: split-file %s %t
5+
6+ // RUN: %target-swift-frontend -emit-module -emit-module-source-info -module-name lib2 -o %t/Frameworks/lib2.framework/Modules/lib2.swiftmodule/%module-target-triple.swiftmodule %t/lib2.swift
7+ // RUN: %target-swift-frontend -emit-module -emit-module-source-info -module-name lib -o %t/Frameworks/lib.framework/Modules/lib.swiftmodule/%module-target-triple.swiftmodule %t/lib.swift -Fsystem %t/Frameworks
8+
9+ // RUN: %target-swift-frontend -typecheck -index-system-modules -index-ignore-stdlib -index-store-path %t/idx -Fsystem %t/Frameworks %t/main.swift -disable-deserialization-recovery
10+
11+ //--- main.swift
12+ import lib
13+
14+ //--- lib.swift
15+ @_implementationOnly import lib2
16+
17+ struct InternalS {
18+ func structFunc( p: Lib2S ) { }
19+ }
20+
21+ extension InternalS {
22+ func extensionFunc( p: Lib2S ) { }
23+ }
24+
25+ //--- lib2.swift
26+ public struct Lib2S { }
You can’t perform that action at this time.
0 commit comments