- Notifications
You must be signed in to change notification settings - Fork 10.5k
/
Copy pathaccessibility_protocol_extension.swift
78 lines (51 loc) · 3.49 KB
/
accessibility_protocol_extension.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// RUN: %target-typecheck-verify-swift -swift-version 4 -package-name myPkg
fileprivatestructFilePrivateStruct{}
// expected-note@-1 4{{type declared here}}
privatestructPrivateStruct{}
// expected-note@-1 4{{type declared here}}
internalstructInternalStruct{}
// expected-note@-1 7{{type declared here}}
packagestructPackageStruct{}
// expected-note@-1 *{{type declared here}}
publicprotocolP{
typealiasTFP=FilePrivateStruct
// expected-error@-1 {{type alias cannot be declared public because its underlying type uses a fileprivate type}}
typealiasTP=PrivateStruct
// expected-error@-1 {{type alias cannot be declared public because its underlying type uses a private type}}
typealiasTI=InternalStruct
// expected-error@-1 {{type alias cannot be declared public because its underlying type uses an internal type}}
typealiasTPkg=PackageStruct
// expected-error@-1 {{type alias cannot be declared public because its underlying type uses a package type}}
}
extensionP{
func usesFilePrivateStructFunc(_:FilePrivateStruct){}
// expected-error@-1 {{method must be declared fileprivate because its parameter uses a fileprivate type}}
typealiasUsesFilePrivateStructAlias=FilePrivateStruct
// expected-error@-1 {{type alias must be declared fileprivate because its underlying type uses a fileprivate type}}
varusesFilePrivateStructProp:FilePrivateStruct{get{}set{}}
// expected-error@-1 {{property must be declared fileprivate because its type uses a fileprivate type}}
func usesPrivateStructFunc(_:PrivateStruct){}
// expected-error@-1 {{method must be declared fileprivate because its parameter uses a private type}}
typealiasUsesPrivateStructAlias=PrivateStruct
// expected-error@-1 {{type alias must be declared fileprivate because its underlying type uses a private type}}
varusesPrivateStructProp:PrivateStruct{get{}set{}}
// expected-error@-1 {{property must be declared fileprivate because its type uses a private type}}
publicfunc usesInternalStruct(_:InternalStruct){}
// expected-error@-1 {{method cannot be declared public because its parameter uses an internal type}}
publictypealiasUsesInternalStructAlias=InternalStruct
// expected-error@-1 {{type alias cannot be declared public because its underlying type uses an internal type}}
publicvarusesInternalStructProp:InternalStruct{get{}set{}}
// expected-error@-1 {{property cannot be declared public because its type uses an internal type}}
packagefunc pkgUsesInternalStruct(_:InternalStruct){}
// expected-error@-1 {{method cannot be declared package because its parameter uses an internal type}}
packagetypealiasPkgUsesInternalStructAlias=InternalStruct
// expected-error@-1 {{type alias cannot be declared package because its underlying type uses an internal type}}
packagevarpkgUsesInternalStructProp:InternalStruct{get{}set{}}
// expected-error@-1 {{property cannot be declared package because its type uses an internal type}}
publicfunc usesPackageStruct(_:PackageStruct){}
// expected-error@-1 {{method cannot be declared public because its parameter uses a package type}}
publictypealiasUsesPackageStructAlias=PackageStruct
// expected-error@-1 {{type alias cannot be declared public because its underlying type uses a package type}}
publicvarusesPackageStructProp:PackageStruct{get{}set{}}
// expected-error@-1 {{property cannot be declared public because its type uses a package type}}
}