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 @@ -2914,10 +2914,18 @@ bool FileUnit::walk(ASTWalker &walker) {
29142914 !walker.shouldWalkSerializedTopLevelInternalDecls ();
29152915 for (Decl *D : Decls) {
29162916 if (SkipInternal) {
2917+ // Ignore if the decl isn't visible
29172918 if (auto *VD = dyn_cast<ValueDecl>(D)) {
29182919 if (!VD->isAccessibleFrom (nullptr ))
29192920 continue ;
29202921 }
2922+
2923+ // Also ignore if the extended nominal isn't visible
2924+ if (auto *ED = dyn_cast<ExtensionDecl>(D)) {
2925+ auto *ND = ED->getExtendedNominal ();
2926+ if (ND && !ND->isAccessibleFrom (nullptr ))
2927+ continue ;
2928+ }
29212929 }
29222930
29232931#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