-
Notifications
You must be signed in to change notification settings - Fork 10.5k
/
Copy pathsynthesized.swift
59 lines (49 loc) · 2.25 KB
/
synthesized.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
// RUN: %target-swift-frontend -typecheck -emit-module-interface-path - %s -disable-objc-attr-requires-foundation-module -enable-objc-interop > %t.swiftinterface
// RUN: %FileCheck %s < %t.swiftinterface
// RUN: %FileCheck -check-prefix=NEGATIVE %s < %t.swiftinterface
// CHECK-LABEL: public enum HasRawValue : Swift.Int {
public enum HasRawValue: Int {
// CHECK-NEXT: case a, b, c
case a, b = 5, c
// CHECK-DAG: public typealias RawValue = Swift.Int
// CHECK-DAG: @inlinable public init?(rawValue: Swift.Int)
// CHECK-DAG: public var rawValue: Swift.Int {
// CHECK-DAG: @inlinable get{{$}}
// CHECK-DAG: }
} // CHECK: {{^}$}}
@objc public enum ObjCEnum: Int32 {
case a, b = 5, c
}
// CHECK-LABEL: @objc public enum ObjCEnum : Swift.Int32 {
// CHECK-NEXT: case a, b = 5, c
// CHECK-DAG: public typealias RawValue = Swift.Int32
// CHECK-DAG: @inlinable public init?(rawValue: Swift.Int32)
// CHECK-DAG: public var rawValue: Swift.Int32 {
// CHECK-DAG: @inlinable get{{$}}
// CHECK-DAG: }
// CHECK: {{^}$}}
// CHECK-LABEL: public enum NoRawValueWithExplicitEquatable : Swift.Equatable {
public enum NoRawValueWithExplicitEquatable : Equatable {
// CHECK-NEXT: case a, b, c
case a, b, c
} // CHECK: {{^}$}}
// CHECK-LABEL: public enum NoRawValueWithExplicitHashable {
public enum NoRawValueWithExplicitHashable {
// CHECK-NEXT: case a, b, c
case a, b, c
} // CHECK: {{^}$}}
// CHECK-LABEL: extension NoRawValueWithExplicitHashable : Swift.Hashable {
extension NoRawValueWithExplicitHashable : Hashable {
// CHECK-NEXT: public func foo()
public func foo() {}
} // CHECK: {{^}$}}
// CHECK: extension synthesized.HasRawValue : Swift.Equatable {}
// CHECK: extension synthesized.HasRawValue : Swift.Hashable {}
// CHECK: extension synthesized.HasRawValue : Swift.RawRepresentable {}
// CHECK: extension synthesized.ObjCEnum : Swift.Equatable {}
// CHECK: extension synthesized.ObjCEnum : Swift.Hashable {}
// CHECK: extension synthesized.ObjCEnum : Swift.RawRepresentable {}
// CHECK: extension synthesized.NoRawValueWithExplicitEquatable : Swift.Hashable {}
// NEGATIVE-NOT: extension {{.+}}NoRawValueWithExplicitEquatable : Swift.Equatable
// NEGATIVE-NOT: NoRawValueWithExplicitHashable : Swift.Equatable
// NEGATIVE-NOT: NoRawValueWithExplicitHashable : Swift.Hashable {}