Skip to content

Commit 95eed01

Browse files
authored
Merge pull request #37911 from xymus/ioi-indirect-conformance
[ModuleInterface] Fix implementation-only imported type leak in indirect conformance
2 parents 08b4eab + 73960ee commit 95eed01

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

lib/Frontend/ModuleInterfaceSupport.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,8 @@ class InheritedProtocolCollector {
562562
return TypeWalker::Action::Continue;
563563

564564
if (isPublicOrUsableFromInline(inherited) &&
565-
conformanceDeclaredInModule(M, nominal, inherited)) {
565+
conformanceDeclaredInModule(M, nominal, inherited) &&
566+
!M->isImportedImplementationOnly(inherited->getParentModule())) {
566567
protocolsToPrint.push_back({inherited, protoAndAvailability.second});
567568
return TypeWalker::Action::SkipChildren;
568569
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %{python} %utils/split_file.py -o %t %s
3+
4+
// RUN: %target-swift-frontend -emit-module %t/SecretLib.swift -o %t/SecretLib.swiftmodule
5+
// RUN: %target-swift-frontend -emit-module %t/Client.swift -I %t -emit-module-interface-path %t/Client.swiftinterface -enable-library-evolution -swift-version 5
6+
7+
/// The indirect conformance of `s` to `_p` should not be printed. (rdar://78718838)
8+
// RUN: cat %t/Client.swiftinterface | %FileCheck %s
9+
// CHECK-NOT: SecretLib
10+
11+
// BEGIN SecretLib.swift
12+
public protocol _p {}
13+
public struct _s : _p {}
14+
15+
// BEGIN Client.swift
16+
@_implementationOnly import SecretLib
17+
protocol p : _p {}
18+
public struct s : p {}
19+
public func test(s1 : s) {}

0 commit comments

Comments
 (0)