Skip to content

Commit bcdcdf1

Browse files
authored
Merge pull request #74302 from nkcsgexi/revert-pkg-export
Revert recent changes for exportability for package declarations
2 parents 8428b36 + 34d9b6c commit bcdcdf1

18 files changed

+181
-627
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2301,32 +2301,32 @@ ERROR(pattern_type_not_usable_from_inline,none,
23012301
"type referenced from a '@usableFromInline' "
23022302
"%select{%select{variable|constant}0|property}1 "
23032303
"must be '@usableFromInline' or public",
2304-
(bool, bool, /*ignored*/bool))
2304+
(bool, bool))
23052305
WARNING(pattern_type_not_usable_from_inline_warn,none,
23062306
"type referenced from a '@usableFromInline' "
23072307
"%select{%select{variable|constant}0|property}1 "
23082308
"should be '@usableFromInline' or public",
2309-
(bool, bool, /*ignored*/bool))
2309+
(bool, bool))
23102310
ERROR(pattern_type_not_usable_from_inline_frozen,none,
2311-
"type referenced from a stored property in a '@frozen%select{| package}2' struct must "
2312-
"be '@usableFromInline'%select{ or public|, public, or package}2",
2313-
(/*ignored*/bool, /*ignored*/bool, bool))
2311+
"type referenced from a stored property in a '@frozen' struct must "
2312+
"be '@usableFromInline' or public",
2313+
(/*ignored*/bool, /*ignored*/bool))
23142314
ERROR(pattern_type_not_usable_from_inline_inferred,none,
23152315
"type referenced from a '@usableFromInline' "
23162316
"%select{%select{variable|constant}0|property}1 "
23172317
"with inferred type %2 "
23182318
"must be '@usableFromInline' or public",
2319-
(bool, bool, Type, /*ignored*/bool))
2319+
(bool, bool, Type))
23202320
WARNING(pattern_type_not_usable_from_inline_inferred_warn,none,
23212321
"type referenced from a '@usableFromInline' "
23222322
"%select{%select{variable|constant}0|property}1 "
23232323
"with inferred type %2 "
23242324
"should be '@usableFromInline' or public",
2325-
(bool, bool, Type, /*ignored*/bool))
2325+
(bool, bool, Type))
23262326
ERROR(pattern_type_not_usable_from_inline_inferred_frozen,none,
23272327
"type referenced from a stored property with inferred type %2 in a "
2328-
"'@frozen%select{| package}3' struct must be '@usableFromInline'%select{ or public|, public, or package}3",
2329-
(/*ignored*/bool, /*ignored*/bool, Type, bool))
2328+
"'@frozen' struct must be '@usableFromInline' or public",
2329+
(/*ignored*/bool, /*ignored*/bool, Type))
23302330

23312331
ERROR(pattern_binds_no_variables,none,
23322332
"%select{property|global variable}0 declaration does not bind any "
@@ -3648,35 +3648,28 @@ ERROR(decl_from_hidden_module,none,
36483648
"cannot use %kind0 %select{here|as property wrapper here|"
36493649
"as result builder here|"
36503650
"in an extension with public or '@usableFromInline' members|"
3651-
"in an extension with conditional conformances|"
3652-
"in an extension with public, package, or '@usableFromInline' members|"
36533651
"in an extension with conditional conformances}1; "
36543652
"%select{%2 has been imported as implementation-only|"
36553653
"it is an SPI imported from %2|"
36563654
"it is SPI|"
36573655
"%2 was imported for SPI only|"
36583656
"%2 was not imported by this file|"
36593657
"C++ types from imported module %2 do not support library evolution|"
3660-
"%2 was not imported publicly|"
3661-
"%2 was imported as package}3"
3662-
"%select{||||| or as package| or as package}1",
3658+
"%2 was not imported publicly}3",
36633659
(const Decl *, unsigned, Identifier, unsigned))
36643660
ERROR(typealias_desugars_to_type_from_hidden_module,none,
36653661
"%0 aliases '%1.%2' and cannot be used %select{here|"
36663662
"as property wrapper here|"
36673663
"as result builder here|"
36683664
"in an extension with public or '@usableFromInline' members|"
3669-
"in an extension with conditional conformances|"
3670-
"in an extension with public, package, or '@usableFromInline' members|"
36713665
"in an extension with conditional conformances}3 "
36723666
"because %select{%4 has been imported as implementation-only|"
36733667
"it is an SPI imported from %4|"
36743668
"<<ERROR>>|"
36753669
"%4 was imported for SPI only|"
36763670
"%4 was not imported by this file|"
36773671
"C++ types from imported module %4 do not support library evolution|"
3678-
"%4 was not imported publicly|"
3679-
"%4 was imported as package}5",
3672+
"%4 was not imported publicly}5",
36803673
(const TypeAliasDecl *, StringRef, StringRef, unsigned, Identifier, unsigned))
36813674
ERROR(conformance_from_implementation_only_module,none,
36823675
"cannot use conformance of %0 to %1 %select{here|as property wrapper here|"
@@ -3689,8 +3682,7 @@ ERROR(conformance_from_implementation_only_module,none,
36893682
"%3 was imported for SPI only|"
36903683
"%3 was not imported by this file|"
36913684
"C++ types from imported module %3 do not support library evolution|"
3692-
"%3 was not imported publicly|"
3693-
"%3 was imported as package}4",
3685+
"%3 was not imported publicly}4",
36943686
(Type, Identifier, unsigned, Identifier, unsigned))
36953687
NOTE(assoc_conformance_from_implementation_only_module,none,
36963688
"in associated type %0 (inferred as %1)", (Type, Type))
@@ -6928,8 +6920,7 @@ ERROR(inlinable_decl_ref_from_hidden_module,
69286920
"%2 was imported for SPI only|"
69296921
"%2 was not imported by this file|"
69306922
"C++ APIs from imported module %2 do not support library evolution|"
6931-
"%2 was not imported publicly|"
6932-
"%2 was imported as package}3",
6923+
"%2 was not imported publicly}3",
69336924
(const ValueDecl *, unsigned, Identifier, unsigned))
69346925

69356926
WARNING(inlinable_decl_ref_from_hidden_module_warn,
@@ -6947,8 +6938,7 @@ ERROR(inlinable_typealias_desugars_to_type_from_hidden_module,
69476938
"%4 was imported for SPI only|"
69486939
"%4 was not imported by this file|"
69496940
"C++ types from imported module %4 do not support library evolution|"
6950-
"%4 was not imported publicly|"
6951-
"%4 was imported as package}5",
6941+
"%4 was not imported publicly}5",
69526942
(const TypeAliasDecl *, StringRef, StringRef, unsigned, Identifier, unsigned))
69536943

69546944
NOTE(missing_import_inserted,
@@ -6962,8 +6952,8 @@ ERROR(availability_macro_in_inlinable, none,
69626952
#undef FRAGILE_FUNC_KIND
69636953

69646954
NOTE(resilience_decl_declared_here,
6965-
none, "%kind0 is not '@usableFromInline'%select{ or public|, public, or package}1",
6966-
(const ValueDecl *, bool))
6955+
none, "%kind0 is not '@usableFromInline' or public",
6956+
(const ValueDecl *))
69676957

69686958
ERROR(class_designated_init_inlinable_resilient,none,
69696959
"initializer for class %0 is "

include/swift/AST/SourceFile.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,10 +435,6 @@ class SourceFile final : public FileUnit {
435435
void setImportUsedPreconcurrency(
436436
AttributedImport<ImportedModule> import);
437437

438-
/// True if the highest access level of the declarations referencing
439-
/// this import in signature or inlinable code is internal or less.
440-
bool isMaxAccessLevelUsingImportInternal(AttributedImport<ImportedModule> import) const;
441-
442438
/// Return the highest access level of the declarations referencing
443439
/// this import in signature or inlinable code.
444440
AccessLevel

lib/AST/Decl.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2314,7 +2314,7 @@ bool VarDecl::isLayoutExposedToClients() const {
23142314
auto nominalAccess =
23152315
parent->getFormalAccessScope(/*useDC=*/nullptr,
23162316
/*treatUsableFromInlineAsPublic=*/true);
2317-
if (!nominalAccess.isPublicOrPackage()) return false;
2317+
if (!nominalAccess.isPublic()) return false;
23182318

23192319
if (!parent->getAttrs().hasAttribute<FrozenAttr>() &&
23202320
!parent->getAttrs().hasAttribute<FixedLayoutAttr>())
@@ -4680,10 +4680,8 @@ bool ValueDecl::isMoreVisibleThan(ValueDecl *other) const {
46804680

46814681
if (scope.isPublic())
46824682
return !otherScope.isPublic();
4683-
else if (scope.isPackage())
4684-
return !otherScope.isPublicOrPackage();
46854683
else if (scope.isInternal())
4686-
return !otherScope.isPublicOrPackage() && !otherScope.isInternal();
4684+
return !otherScope.isPublic() && !otherScope.isInternal();
46874685
else
46884686
return false;
46894687
}

lib/AST/DeclContext.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ swift::FragileFunctionKindRequest::evaluate(Evaluator &evaluator,
486486
auto effectiveAccess =
487487
VD->getFormalAccessScope(/*useDC=*/nullptr,
488488
/*treatUsableFromInlineAsPublic=*/true);
489-
if (effectiveAccess.isPublicOrPackage()) {
489+
if (effectiveAccess.isPublic()) {
490490
return {FragileFunctionKind::DefaultArgument};
491491
}
492492

@@ -518,7 +518,7 @@ swift::FragileFunctionKindRequest::evaluate(Evaluator &evaluator,
518518

519519
// If the function is not externally visible, we will not be serializing
520520
// its body.
521-
if (!funcAccess.isPublicOrPackage()) {
521+
if (!funcAccess.isPublic()) {
522522
return {FragileFunctionKind::None};
523523
}
524524

lib/AST/Module.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2650,12 +2650,6 @@ void SourceFile::setImportUsedPreconcurrency(
26502650
PreconcurrencyImportsUsed.insert(import);
26512651
}
26522652

2653-
bool SourceFile::isMaxAccessLevelUsingImportInternal(
2654-
AttributedImport<ImportedModule> import) const {
2655-
auto maxLevel = getMaxAccessLevelUsingImport(import.module.importedModule);
2656-
return maxLevel < AccessLevel::Package;
2657-
}
2658-
26592653
AccessLevel
26602654
SourceFile::getMaxAccessLevelUsingImport(
26612655
const ModuleDecl *mod) const {

0 commit comments

Comments
 (0)