Split 'fileprivate' and 'private', but give them the same behavior.

'fileprivate' is considered a broader level of access than 'private',
but for now both of them are still available to the entire file. This
is intended as a migration aid.

One interesting fallout of the "access scope" model described in
758cf64 is that something declared 'private' at file scope is actually
treated as 'fileprivate' for diagnostic purposes. This is something
we can fix later, once the full model is in place. (It's not really
/wrong/ in that they have identical behavior, but diagnostics still
shouldn't refer to a type explicitly declared 'private' as
'fileprivate'.)

As a note, ValueDecl::getEffectiveAccess will always return 'FilePrivate'
rather than 'Private'; for purposes of optimization and code generation,
we should never try to distinguish these two cases.

This should have essentially no effect on code that's /not/ using
'fileprivate' other than altered diagnostics.

Progress on SE-0025 ('fileprivate' and 'private')
This commit is contained in:
Jordan Rose
2016-07-22 13:50:49 -07:00
parent 4f387e3379
commit 508e825ff2
40 changed files with 367 additions and 241 deletions

View File

@@ -269,6 +269,7 @@ static SILFunction::ClassVisibility_t getClassVisibility(SILDeclRef constant) {
switch (classType->getEffectiveAccess()) {
case Accessibility::Private:
case Accessibility::FilePrivate:
return SILFunction::NotRelevant;
case Accessibility::Internal:
return SILFunction::InternalClass;