Skip to content

Commit 411ad87

Browse files
committed
[Sema] Ignore "exportability" check for non-public code
Exportability checking logic detects when decls are referenced from API or inlinable code. This duplicates the check applied for the access level. Skip the exportability reports about non-public imports and keep the more familiar access-level check.
1 parent e90e2de commit 411ad87

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3436,7 +3436,8 @@ ERROR(decl_from_hidden_module,none,
34363436
"it is SPI|"
34373437
"%2 was imported for SPI only|"
34383438
"%2 was not imported by this file|"
3439-
"C++ types from imported module %2 do not support library evolution}3",
3439+
"C++ types from imported module %2 do not support library evolution|"
3440+
"<<ERROR>>}3",
34403441
(const Decl *, unsigned, Identifier, unsigned))
34413442
ERROR(typealias_desugars_to_type_from_hidden_module,none,
34423443
"%0 aliases '%1.%2' and cannot be used %select{here|"
@@ -6567,7 +6568,8 @@ ERROR(inlinable_decl_ref_from_hidden_module,
65676568
"it is SPI|"
65686569
"%2 was imported for SPI only|"
65696570
"%2 was not imported by this file|"
6570-
"C++ APIs from imported module %2 do not support library evolution}3",
6571+
"C++ APIs from imported module %2 do not support library evolution|"
6572+
"<<ERROR>>}3",
65716573
(const ValueDecl *, unsigned, Identifier, unsigned))
65726574

65736575
WARNING(inlinable_decl_ref_from_hidden_module_warn,

lib/Sema/ResilienceDiagnostics.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ static bool diagnoseValueDeclRefExportability(SourceLoc loc, const ValueDecl *D,
192192
if (originKind == DisallowedOriginKind::None)
193193
return false;
194194

195+
// Access levels from imports are reported with the others access levels.
196+
if (originKind == DisallowedOriginKind::NonPublicImport)
197+
return false;
198+
195199
auto diagName = D->getName();
196200
if (auto accessor = dyn_cast<AccessorDecl>(D)) {
197201
// Only diagnose accessors if their disallowed origin kind differs from

0 commit comments

Comments
 (0)