File tree Expand file tree Collapse file tree 8 files changed +27
-16
lines changed Expand file tree Collapse file tree 8 files changed +27
-16
lines changed Original file line number Diff line number Diff line change @@ -1932,7 +1932,8 @@ namespace {
1932
1932
structDecl->computeType ();
1933
1933
1934
1934
ProtocolDecl *protocols[]
1935
- = {cxt.getProtocol (KnownProtocolKind::RawRepresentable)};
1935
+ = {cxt.getProtocol (KnownProtocolKind::RawRepresentable),
1936
+ cxt.getProtocol (KnownProtocolKind::Equatable)};
1936
1937
populateInheritedTypes (structDecl, protocols);
1937
1938
1938
1939
// Note that this is a raw representable type.
Original file line number Diff line number Diff line change @@ -54,19 +54,19 @@ struct __PrivS2 {
54
54
init(value: Int32)
55
55
}
56
56
var __PrivAnonymousA: Int { get }
57
- struct E0 : RawRepresentable {
57
+ struct E0 : RawRepresentable, Equatable {
58
58
init(_ rawValue: UInt32)
59
59
init(rawValue: UInt32)
60
60
var rawValue: UInt32
61
61
}
62
62
var __E0PrivA: E0 { get }
63
- struct __PrivE1 : RawRepresentable {
63
+ struct __PrivE1 : RawRepresentable, Equatable {
64
64
init(_ rawValue: UInt32)
65
65
init(rawValue: UInt32)
66
66
var rawValue: UInt32
67
67
}
68
68
var __PrivE1A: __PrivE1 { get }
69
- struct __PrivE2 : RawRepresentable {
69
+ struct __PrivE2 : RawRepresentable, Equatable {
70
70
init(_ rawValue: UInt32)
71
71
init(rawValue: UInt32)
72
72
var rawValue: UInt32
Original file line number Diff line number Diff line change @@ -11,12 +11,22 @@ import CoreFoundation
11
11
var cgPointVar : CGPoint
12
12
13
13
func checkRawRepresentable< T: RawRepresentable > ( _: T ) { }
14
+ func checkEquatable< T: Equatable > ( _: T ) -> Bool { }
15
+ func checkEquatablePattern( c: Color ) {
16
+ switch c {
17
+ case red: return
18
+ case green: return
19
+ case blue: return
20
+ }
21
+ }
14
22
15
23
func testColor( ) {
16
24
var c : Color = red
17
25
c = blue
18
26
_ = c. rawValue
19
27
checkRawRepresentable ( c)
28
+ checkEquatable ( c)
29
+ checkEquatablePattern ( c)
20
30
}
21
31
22
32
func testTribool( ) {
Original file line number Diff line number Diff line change 1
1
@exported import FooHelper
2
2
3
3
func fooSubFunc1(a: Int32) -> Int32
4
- struct FooSubEnum1 : RawRepresentable {
4
+ struct FooSubEnum1 : RawRepresentable, Equatable {
5
5
init(_ rawValue: UInt32)
6
6
init(rawValue: UInt32)
7
7
var rawValue: UInt32
Original file line number Diff line number Diff line change 3
3
4
4
5
5
<decl:Struct>/// Aaa. FooEnum1. Bbb.
6
- struct <loc>FooEnum1</loc> : <ref:Protocol>RawRepresentable</ref> {
6
+ struct <loc>FooEnum1</loc> : <ref:Protocol>RawRepresentable</ref>, <ref:Protocol>Equatable</ref> {
7
7
<decl:Constructor><loc>init(_ rawValue: <ref:Struct>UInt32</ref>)</loc></decl>
8
8
<decl:Constructor><loc>init(rawValue: <ref:Struct>UInt32</ref>)</loc></decl>
9
9
<decl:Var>var <loc>rawValue</loc>: <ref:Struct>UInt32</ref></decl>
10
10
}</decl>
11
11
12
12
<decl:Var>/// Aaa. FooEnum1X. Bbb.
13
13
var <loc>FooEnum1X</loc>: <ref:Struct>FooEnum1</ref> { get }</decl>
14
- <decl:Struct>struct <loc>FooEnum2</loc> : <ref:Protocol>RawRepresentable</ref> {
14
+ <decl:Struct>struct <loc>FooEnum2</loc> : <ref:Protocol>RawRepresentable</ref>, <ref:Protocol>Equatable</ref> {
15
15
<decl:Constructor><loc>init(_ rawValue: <ref:Struct>UInt32</ref>)</loc></decl>
16
16
<decl:Constructor><loc>init(rawValue: <ref:Struct>UInt32</ref>)</loc></decl>
17
17
<decl:Var>var <loc>rawValue</loc>: <ref:Struct>UInt32</ref></decl>
18
18
}</decl>
19
19
<decl:Var>var <loc>FooEnum2X</loc>: <ref:Struct>FooEnum2</ref> { get }</decl>
20
20
<decl:Var>var <loc>FooEnum2Y</loc>: <ref:Struct>FooEnum2</ref> { get }</decl>
21
- <decl:Struct>struct <loc>FooEnum3</loc> : <ref:Protocol>RawRepresentable</ref> {
21
+ <decl:Struct>struct <loc>FooEnum3</loc> : <ref:Protocol>RawRepresentable</ref>, <ref:Protocol>Equatable</ref> {
22
22
<decl:Constructor><loc>init(_ rawValue: <ref:Struct>UInt32</ref>)</loc></decl>
23
23
<decl:Constructor><loc>init(rawValue: <ref:Struct>UInt32</ref>)</loc></decl>
24
24
<decl:Var>var <loc>rawValue</loc>: <ref:Struct>UInt32</ref></decl>
Original file line number Diff line number Diff line change 3
3
4
4
5
5
/// Aaa. FooEnum1. Bbb.
6
- struct FooEnum1 : RawRepresentable {
6
+ struct FooEnum1 : RawRepresentable, Equatable {
7
7
init(_ rawValue: UInt32)
8
8
init(rawValue: UInt32)
9
9
var rawValue: UInt32
10
10
}
11
11
12
12
/// Aaa. FooEnum1X. Bbb.
13
13
var FooEnum1X: FooEnum1 { get }
14
- struct FooEnum2 : RawRepresentable {
14
+ struct FooEnum2 : RawRepresentable, Equatable {
15
15
init(_ rawValue: UInt32)
16
16
init(rawValue: UInt32)
17
17
var rawValue: UInt32
18
18
}
19
19
var FooEnum2X: FooEnum2 { get }
20
20
var FooEnum2Y: FooEnum2 { get }
21
- struct FooEnum3 : RawRepresentable {
21
+ struct FooEnum3 : RawRepresentable, Equatable {
22
22
init(_ rawValue: UInt32)
23
23
init(rawValue: UInt32)
24
24
var rawValue: UInt32
@@ -269,7 +269,7 @@ extension FooRepeatedMembers {
269
269
extension FooRepeatedMembers {
270
270
}
271
271
func fooSubFunc1(a: Int32) -> Int32
272
- struct FooSubEnum1 : RawRepresentable {
272
+ struct FooSubEnum1 : RawRepresentable, Equatable {
273
273
init(_ rawValue: UInt32)
274
274
init(rawValue: UInt32)
275
275
var rawValue: UInt32
Original file line number Diff line number Diff line change 11
11
// Yo.
12
12
13
13
/// Aaa. FooEnum1. Bbb.
14
- struct FooEnum1 : RawRepresentable {
14
+ struct FooEnum1 : RawRepresentable, Equatable {
15
15
init(_ rawValue: UInt32)
16
16
init(rawValue: UInt32)
17
17
var rawValue: UInt32
@@ -20,14 +20,14 @@ struct FooEnum1 : RawRepresentable {
20
20
/// Aaa. FooEnum1X. Bbb.
21
21
var FooEnum1X: FooEnum1 { get }
22
22
23
- struct FooEnum2 : RawRepresentable {
23
+ struct FooEnum2 : RawRepresentable, Equatable {
24
24
init(_ rawValue: UInt32)
25
25
init(rawValue: UInt32)
26
26
var rawValue: UInt32
27
27
}
28
28
var FooEnum2X: FooEnum2 { get }
29
29
var FooEnum2Y: FooEnum2 { get }
30
- struct FooEnum3 : RawRepresentable {
30
+ struct FooEnum3 : RawRepresentable, Equatable {
31
31
init(_ rawValue: UInt32)
32
32
init(rawValue: UInt32)
33
33
var rawValue: UInt32
Original file line number Diff line number Diff line change 1
1
2
2
func fooHelperSubFunc1(a: Int32) -> Int32
3
- struct FooHelperSubEnum1 : RawRepresentable {
3
+ struct FooHelperSubEnum1 : RawRepresentable, Equatable {
4
4
init(_ rawValue: UInt32)
5
5
init(rawValue: UInt32)
6
6
var rawValue: UInt32
You can’t perform that action at this time.
0 commit comments