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
Promote a bunch of Swift 3 compatibility access warnings to errors. (#10086)
This was done back in Swift 3.0.1 or 3.0.2. Let's finally make them
errors in Swift 4!
I also fixed up a number of '%error' entries in diagnostics that can
actually happen in invalid code. These are the ones that were already
present in the warnings.
varprivateVar:VeryPrivateType{fatalError()} // expected-warning {{property should be declared private because its type uses a private type}}
172
-
varprivateVar2=VeryPrivateType() // expected-warning {{property should be declared private because its type 'Container.VeryPrivateStruct.VeryPrivateType' (aka 'Int') uses a private type}}
173
-
typealiasPrivateAlias=VeryPrivateType // expected-warning {{type alias should be declared private because its underlying type uses a private type}}
174
-
subscript(_:VeryPrivateType)->Void{return()} // expected-warning {{subscript should be declared private because its index uses a private type}}
175
-
func privateMethod(_:VeryPrivateType)->Void{} // expected-warning {{method should be declared private because its parameter uses a private type}} {{none}}
176
-
enumPrivateRawValue:VeryPrivateType{ // expected-warning {{enum should be declared private because its raw type uses a private type}} {{none}}
171
+
varprivateVar:VeryPrivateType{fatalError()} // expected-error {{property must be declared private because its type uses a private type}}
172
+
varprivateVar2=VeryPrivateType() // expected-error {{property must be declared private because its type 'Container.VeryPrivateStruct.VeryPrivateType' (aka 'Int') uses a private type}}
173
+
typealiasPrivateAlias=VeryPrivateType // expected-error {{type alias must be declared private because its underlying type uses a private type}}
174
+
subscript(_:VeryPrivateType)->Void{return()} // expected-error {{subscript must be declared private because its index uses a private type}}
175
+
func privateMethod(_:VeryPrivateType)->Void{} // expected-error {{method must be declared private because its parameter uses a private type}} {{none}}
176
+
enumPrivateRawValue:VeryPrivateType{ // expected-error {{enum must be declared private because its raw type uses a private type}} {{none}}
177
177
case A
178
178
}
179
179
enumPrivatePayload{
180
-
case A(VeryPrivateType) // expected-warning {{enum case in an internal enum uses a private type}} {{none}}
180
+
case A(VeryPrivateType) // expected-error {{enum case in an internal enum uses a private type}} {{none}}
classPrivateSuper:PrivateInnerClass{} // expected-warning {{class should be declared private because its superclass is private}} {{none}}
184
+
classPrivateSuper:PrivateInnerClass{} // expected-error {{class must be declared private because its superclass is private}} {{none}}
185
185
}
186
186
187
-
fileprivatevarprivateVar:VeryPrivateStruct{fatalError()} // expected-warning {{property should not be declared fileprivate because its type uses a private type}} {{none}}
188
-
fileprivatetypealiasPrivateAlias=VeryPrivateStruct // expected-warning {{type alias should not be declared fileprivate because its underlying type uses a private type}} {{none}}
189
-
fileprivate subscript(_:VeryPrivateStruct)->Void{return()} // expected-warning {{subscript should not be declared fileprivate because its index uses a private type}} {{none}}
190
-
fileprivatefunc privateMethod(_:VeryPrivateStruct)->Void{} // expected-warning {{method should not be declared fileprivate because its parameter uses a private type}} {{none}}
191
-
fileprivateenumPrivateRawValue:VeryPrivateStruct{} // expected-warning {{enum should not be declared fileprivate because its raw type uses a private type}} {{none}}
187
+
fileprivatevarprivateVar:VeryPrivateStruct{fatalError()} // expected-error {{property cannot be declared fileprivate because its type uses a private type}} {{none}}
188
+
fileprivatetypealiasPrivateAlias=VeryPrivateStruct // expected-error {{type alias cannot be declared fileprivate because its underlying type uses a private type}} {{none}}
189
+
fileprivate subscript(_:VeryPrivateStruct)->Void{return()} // expected-error {{subscript cannot be declared fileprivate because its index uses a private type}} {{none}}
190
+
fileprivatefunc privateMethod(_:VeryPrivateStruct)->Void{} // expected-error {{method cannot be declared fileprivate because its parameter uses a private type}} {{none}}
191
+
fileprivateenumPrivateRawValue:VeryPrivateStruct{} // expected-error {{enum cannot be declared fileprivate because its raw type uses a private type}} {{none}}
192
192
// expected-error@-1 {{raw type 'Container.VeryPrivateStruct' is not expressible by any literal}}
193
193
// expected-error@-2 {{'Container.PrivateRawValue' declares raw type 'Container.VeryPrivateStruct', but does not conform to RawRepresentable and conformance could not be synthesized}}
194
194
// expected-error@-3 {{RawRepresentable conformance cannot be synthesized because raw type 'Container.VeryPrivateStruct' is not Equatable}}
195
195
fileprivateenumPrivatePayload{
196
-
case A(VeryPrivateStruct) // expected-warning {{enum case in an internal enum uses a private type}} {{none}}
196
+
case A(VeryPrivateStruct) // expected-error {{enum case in an internal enum uses a private type}} {{none}}
fileprivateclassPrivateSuperClass:PrivateInnerClass{} // expected-warning {{class should not be declared fileprivate because its superclass is private}} {{none}}
201
-
fileprivateclassPrivateGenericUser<T>where T:PrivateInnerClass{} // expected-warning {{generic class should not be declared fileprivate because its generic requirement uses a private type}} {{none}}
200
+
fileprivateclassPrivateSuperClass:PrivateInnerClass{} // expected-error {{class cannot be declared fileprivate because its superclass is private}} {{none}}
201
+
fileprivateclassPrivateGenericUser<T>where T:PrivateInnerClass{} // expected-error {{generic class cannot be declared fileprivate because its generic requirement uses a private type}} {{none}}
202
202
}
203
203
204
204
fileprivatestructSR2579{
205
205
privatestructInner{
206
206
privatestructInnerPrivateType{}
207
-
varinnerProperty=InnerPrivateType() // expected-warning {{property should be declared private because its type 'SR2579.Inner.InnerPrivateType' uses a private type}}
207
+
varinnerProperty=InnerPrivateType() // expected-error {{property must be declared private because its type 'SR2579.Inner.InnerPrivateType' uses a private type}}
208
208
}
209
209
// FIXME: We need better errors when one access violation results in more
210
210
// downstream.
211
-
privatevarouterProperty=Inner().innerProperty // expected-warning {{property should not be declared in this context because its type 'SR2579.Inner.InnerPrivateType' uses a private type}}
212
-
varouterProperty2=Inner().innerProperty // expected-warning {{property should be declared private because its type 'SR2579.Inner.InnerPrivateType' uses a private type}}
211
+
privatevarouterProperty=Inner().innerProperty // expected-error {{property cannot be declared in this context because its type 'SR2579.Inner.InnerPrivateType' uses a private type}}
212
+
varouterProperty2=Inner().innerProperty // expected-error {{property must be declared private because its type 'SR2579.Inner.InnerPrivateType' uses a private type}}
0 commit comments