Skip to content

Commit 68c3f3b

Browse files
committed
Remove EnableSwift3Private staging option.
1 parent f99904a commit 68c3f3b

File tree

7 files changed

+4
-28
lines changed

7 files changed

+4
-28
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,6 @@ namespace swift {
141141
/// new enough?
142142
bool EnableTargetOSChecking = true;
143143

144-
/// Should 'private' use Swift 3's lexical scoping, or the Swift 2 behavior
145-
/// of 'fileprivate'?
146-
bool EnableSwift3Private = true;
147-
148144
/// Whether to use the import as member inference system
149145
///
150146
/// When importing a global, try to infer whether we can import it as a

lib/AST/Decl.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1896,16 +1896,13 @@ const DeclContext *
18961896
ValueDecl::getFormalAccessScope(const DeclContext *useDC) const {
18971897
const DeclContext *result = getDeclContext();
18981898
Accessibility access = getFormalAccess(useDC);
1899-
bool swift3PrivateChecked = false;
19001899

19011900
while (!result->isModuleScopeContext()) {
19021901
if (result->isLocalContext())
19031902
return result;
19041903

1905-
if (access == Accessibility::Private && !swift3PrivateChecked) {
1906-
if (result->getASTContext().LangOpts.EnableSwift3Private)
1907-
return result;
1908-
swift3PrivateChecked = true;
1904+
if (access == Accessibility::Private) {
1905+
return result;
19091906
}
19101907

19111908
if (auto enclosingNominal = dyn_cast<NominalTypeDecl>(result)) {

lib/AST/NameLookup.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,9 +1039,7 @@ static bool checkAccessibility(const DeclContext *useDC,
10391039
assert(sourceDC && "ValueDecl being accessed must have a valid DeclContext");
10401040
switch (access) {
10411041
case Accessibility::Private:
1042-
if (sourceDC->getASTContext().LangOpts.EnableSwift3Private)
1043-
return useDC == sourceDC || useDC->isChildContextOf(sourceDC);
1044-
SWIFT_FALLTHROUGH;
1042+
return useDC == sourceDC || useDC->isChildContextOf(sourceDC);
10451043
case Accessibility::FilePrivate:
10461044
return useDC->getModuleScopeContext() == sourceDC->getModuleScopeContext();
10471045
case Accessibility::Internal: {

lib/Parse/ParseDecl.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -507,11 +507,6 @@ bool Parser::parseNewDeclAttribute(DeclAttributes &Attributes, SourceLoc AtLoc,
507507
.Case("public", Accessibility::Public)
508508
.Case("open", Accessibility::Open);
509509

510-
if (access == Accessibility::FilePrivate &&
511-
!Context.LangOpts.EnableSwift3Private) {
512-
access = Accessibility::Private;
513-
}
514-
515510
if (!consumeIf(tok::l_paren)) {
516511
// Normal accessibility attribute.
517512
AttrRange = Loc;

lib/Sema/MiscDiagnostics.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3630,8 +3630,7 @@ swift::accessibilityFromScopeForDiagnostics(const DeclContext *accessScope) {
36303630
return Accessibility::Public;
36313631
if (isa<ModuleDecl>(accessScope))
36323632
return Accessibility::Internal;
3633-
if (accessScope->isModuleScopeContext() &&
3634-
accessScope->getASTContext().LangOpts.EnableSwift3Private) {
3633+
if (accessScope->isModuleScopeContext()) {
36353634
return Accessibility::FilePrivate;
36363635
}
36373636
return Accessibility::Private;

lib/Sema/TypeCheckAttr.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,11 +1366,6 @@ void AttributeChecker::visitAccessibilityAttr(AccessibilityAttr *attr) {
13661366
TC.computeDefaultAccessibility(extension);
13671367
Accessibility maxAccess = extension->getMaxAccessibility();
13681368
if (std::min(attr->getAccess(), Accessibility::Public) > maxAccess) {
1369-
if (maxAccess == Accessibility::FilePrivate &&
1370-
!TC.Context.LangOpts.EnableSwift3Private) {
1371-
maxAccess = Accessibility::Private;
1372-
}
1373-
13741369
// FIXME: It would be nice to say what part of the requirements actually
13751370
// end up being problematic.
13761371
auto diag =

lib/Sema/TypeCheckDecl.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,10 +1397,6 @@ void TypeChecker::computeAccessibility(ValueDecl *D) {
13971397
auto extension = cast<ExtensionDecl>(DC);
13981398
computeDefaultAccessibility(extension);
13991399
auto access = extension->getDefaultAccessibility();
1400-
if (access == Accessibility::FilePrivate &&
1401-
!Context.LangOpts.EnableSwift3Private) {
1402-
access = Accessibility::Private;
1403-
}
14041400
D->setAccessibility(access);
14051401
}
14061402
}

0 commit comments

Comments
 (0)