You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use Swift-3-style access checking to downgrade errors to warnings.
...instead of just ignoring the errors in certain cases, in service of
source compatibility.
Swift 3.0 wasn't nearly as strict as checking access control for types
because it didn't look at the TypeRepr at all (except to highlight a
particular part of the type in diagnostics). It also looked through
typealiases in certain cases. Approximate this behavior by running the
access checking logic for Types (rather than TypeReprs), and downgrade
access violation errors to warnings when the checks disagree.
Part of rdar://problem/29855782.
publicleta0=nilasPrivateAlias.Inner? // expected-warning {{constant should not be declared public because its type 'PrivateAlias.Inner?' uses a private type}}
13
+
publicleta:PrivateAlias.Inner? // expected-warning {{constant should not be declared public because its type uses a private type}}
13
14
publicletb:PrivateAlias.Internal? // expected-error {{constant cannot be declared public because its type uses an internal type}}
14
15
publicletc:Pair<PrivateAlias.Inner,PublicStruct.Internal>? // expected-error {{constant cannot be declared public because its type uses an internal type}}
15
16
publicletc2:Pair<PublicStruct.Internal,PrivateAlias.Inner>? // expected-error {{constant cannot be declared public because its type uses an internal type}}
16
17
publicletd:PrivateAlias? // expected-error {{constant cannot be declared public because its type uses a private type}}
letspecificBoxUnboxInt:SpecificBox<PublicStruct>.InnerType=.init() // FIXME: This used to error in Swift 3.0.
39
+
letspecificBoxUnboxInt:SpecificBox<PublicStruct>.InnerType=.init() // expected-warning {{constant should be declared private because its type uses a private type}}
39
40
letspecificBoxFloat:SpecificBox<PublicStruct>.AlwaysFloat=0 // expected-error {{constant must be declared private or fileprivate because its type uses a private type}}
publicfunc foo<U :P>(u:U)where U.Element ==A.Element{} // expected-warning {{instance method should not be declared public because its generic requirement uses an internal type}}
publictypealiasElement=Sequence.Iterator.Element // expected-warning {{type alias should not be declared public because its underlying type uses an internal type}}
22
22
23
23
publicfunc next()->Element?{
24
24
returnnil
@@ -29,9 +29,9 @@ struct Generic<T> {
29
29
fileprivatetypealiasDependent=T
30
30
}
31
31
32
-
varx:Generic<Int>.Dependent=3
32
+
varx:Generic<Int>.Dependent=3 // expected-warning {{variable should be declared fileprivate because its type uses a fileprivate type}}
func internalFuncWithFileprivateAlias()->Generic<Int>.Dependent{ // expected-warning {{function should be declared fileprivate because its result uses a fileprivate type}}
35
35
return3
36
36
}
37
37
@@ -44,14 +44,14 @@ var y = privateFuncWithFileprivateAlias()
0 commit comments