1
1
// RUN: %empty-directory(%t)
2
2
// RUN: %target-build-swift %s -module-name SkipsPublicUnderscore -emit-module -emit-module-path %t/
3
3
// RUN: %target-swift-symbolgraph-extract -module-name SkipsPublicUnderscore -I %t -pretty-print -output-dir %t
4
- // RUN: %FileCheck %s --input-file %t/SkipsPublicUnderscore.symbols.json
4
+ // RUN: %FileCheck %s --input-file %t/SkipsPublicUnderscore.symbols.json --check-prefix PUBLIC
5
+
6
+ // RUN: %target-swift-symbolgraph-extract -module-name SkipsPublicUnderscore -I %t -pretty-print -output-dir %t -minimum-access-level internal
7
+ // RUN: %FileCheck %s --input-file %t/SkipsPublicUnderscore.symbols.json --check-prefix INTERNAL
8
+
9
+ // RUN: %target-swift-symbolgraph-extract -module-name SkipsPublicUnderscore -I %t -pretty-print -output-dir %t -minimum-access-level private
10
+ // RUN: %FileCheck %s --input-file %t/SkipsPublicUnderscore.symbols.json --check-prefix PRIVATE
5
11
6
12
public protocol PublicProtocol { }
7
13
8
- // CHECK-NOT: precise:{{.*}}_ProtocolShouldntAppear
9
- // CHECK-NOT: precise:{{.*}}PublicProtocol
14
+ public class SomeClass {
15
+ // underscored names marked `internal` or tighter should be considered `private`
16
+
17
+ // PUBLIC-NOT: "precise": "s:21SkipsPublicUnderscore9SomeClassC12_InternalVarSSvp"
18
+ // INTERNAL-NOT: "precise": "s:21SkipsPublicUnderscore9SomeClassC12_InternalVarSSvp"
19
+ // PRIVATE: "precise": "s:21SkipsPublicUnderscore9SomeClassC12_InternalVarSSvp"
20
+ internal var _InternalVar : String = " "
21
+ }
22
+
23
+ // PUBLIC-NOT: precise:{{.*}}_ProtocolShouldntAppear
24
+ // PUBLIC-NOT: precise:{{.*}}PublicProtocol
10
25
@_show_in_interface
11
26
public protocol _ProtocolShouldntAppear { }
12
27
13
- // CHECK-NOT: _ShouldntAppear
28
+ // PUBLIC-NOT: _ShouldntAppear
29
+ // INTERNAL-DAG: _ShouldntAppear
14
30
31
+ // INTERNAL-DAG: "precise": "s:21SkipsPublicUnderscore23_ProtocolShouldntAppearP"
15
32
public struct _ShouldntAppear : PublicProtocol , _ProtocolShouldntAppear {
16
33
// Although these are public and not underscored,
17
34
// they are inside an underscored type,
18
35
// so shouldn't be allowed through.
19
36
20
- // CHECK-NOT: shouldntAppear
37
+ // PUBLIC-NOT: shouldntAppear
38
+ // INTERNAL-DAG: shouldntAppear
21
39
public var shouldntAppear : Int
22
40
23
- // CHECK-NOT: InnerShouldntAppear
41
+ // PUBLIC-NOT: InnerShouldntAppear
42
+ // INTERNAL-DAG: InnerShouldntAppear
24
43
public struct InnerShouldntAppear {
25
44
26
- // CHECK-NOT: InnerInnerShouldntAppear
45
+ // PUBLIC-NOT: InnerInnerShouldntAppear
46
+ // INTERNAL-DAG: InnerInnerShouldntAppear
27
47
public struct InnerInnerShouldntAppear { }
28
48
}
29
49
}
@@ -34,22 +54,27 @@ public struct ShouldAppear: _ProtocolShouldntAppear {}
34
54
35
55
public struct PublicOuter {
36
56
// Nor should an "internal" type's relationship to a "public" protocol.
37
- // CHECK-NOT: _InnerShouldntAppear
57
+ // PUBLIC-NOT: _InnerShouldntAppear
58
+ // INTERNAL-DAG: _InnerShouldntAppear
38
59
public struct _InnerShouldntAppear : PublicProtocol { }
39
60
}
40
61
41
62
extension PublicOuter {
42
- // CHECK-NOT: _FromExtension
63
+ // PUBLIC-NOT: _FromExtension
64
+ // INTERNAL-DAG: _FromExtension
43
65
public struct _FromExtension : PublicProtocol {
44
- // CHECK-NOT: shouldntAppear
66
+ // PUBLIC-NOT: shouldntAppear
67
+ // INTERNAL-DAG: shouldntAppear
45
68
public var shouldntAppear : Int
46
69
}
47
70
}
48
71
49
72
extension _ShouldntAppear {
50
- // CHECK-NOT: FromExtension
73
+ // PUBLIC-NOT: FromExtension
74
+ // INTERNAL-DAG: FromExtension
51
75
public struct FromExtension : PublicProtocol {
52
- // CHECK-NOT: shouldntAppear
76
+ // PUBLIC-NOT: shouldntAppear
77
+ // INTERNAL-DAG: shouldntAppear
53
78
public var shouldntAppear : Int
54
79
}
55
80
}
@@ -60,4 +85,4 @@ extension _ShouldntAppear.InnerShouldntAppear {
60
85
61
86
extension _ShouldntAppear . InnerShouldntAppear : Equatable { }
62
87
63
- // CHECK : "relationships": []
88
+ // PUBLIC : "relationships": []
0 commit comments