Skip to content

Commit f049269

Browse files
committed
public storage with private accessor is also a problem
1 parent 5d160b6 commit f049269

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

lib/Serialization/Serialization.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2703,14 +2703,14 @@ void Serializer::writeDecl(const Decl *D) {
27032703
access <= swift::AccessLevel::FilePrivate &&
27042704
!value->getDeclContext()->isLocalContext();
27052705

2706-
// Emit the the filename for private mapping for private decls or internal
2706+
// Emit the the filename for private mapping for private decls and
27072707
// decls with private accessors if compiled with -enable-private-imports.
27082708
bool shouldEmitFilenameForPrivate =
27092709
M->arePrivateImportsEnabled() &&
27102710
!value->getDeclContext()->isLocalContext() &&
27112711
(access <= swift::AccessLevel::FilePrivate ||
27122712
(storage &&
2713-
storage->getFormalAccess() == swift::AccessLevel::Internal &&
2713+
storage->getFormalAccess() >= swift::AccessLevel::Internal &&
27142714
storage->hasPrivateAccessor()));
27152715

27162716
if (shouldEmitFilenameForPrivate || shouldEmitPrivateDescriminator) {

test/Serialization/Inputs/private_import_other.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ extension Value {
1212
struct Internal {
1313
private(set) var internalVarWithPrivateSetter : Int = 0
1414
fileprivate(set) var internalVarWithFilePrivateSetter : Int = 0
15+
public private(set) var publicVarWithPrivateSetter : Int = 0
16+
public fileprivate(set) var publicVarWithFilePrivateSetter : Int = 0
1517
}

test/Serialization/private_import.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
mutating func set() {
4646
self.internalVarWithPrivateSetter = 1
4747
self.internalVarWithFilePrivateSetter = 1
48+
self.publicVarWithPrivateSetter = 1
49+
self.publicVarWithFilePrivateSetter = 1
4850
}
4951
}
5052

0 commit comments

Comments
 (0)