mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
* [cxx-interop] Add Hashable conformance to imported enums Previously, imported enums only conformed to RawRepresentable and Equatable, so they could not be used as members of a Set or keys of a Dictionary. This patch adds Hashable conformance to give them that ability, as well as some test cases to clarify the expected behavior. Existing test cases are updated to reflect this new conformance. rdar://129713687
19 lines
785 B
Swift
19 lines
785 B
Swift
// RUN: %target-swift-ide-test -print-module -module-to-print=NestedEnums -I %S/Inputs -source-filename=x -enable-experimental-cxx-interop | %FileCheck %s
|
|
|
|
// CHECK: enum ns {
|
|
// CHECK: struct EnumInNS : Hashable, Equatable, RawRepresentable {
|
|
// CHECK: }
|
|
// CHECK-NEXT: static var kA: ns.EnumInNS { get }
|
|
// CHECK-NEXT: static var kB: ns.EnumInNS { get }
|
|
// CHECK-NEXT: enum ScopedEnumInNS : Int32 {
|
|
// CHECK: case scopeA
|
|
// CHECK: case scopeB
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: enum nestedNS {
|
|
// CHECK-NEXT: struct EnumInNestedNS : Hashable, Equatable, RawRepresentable {
|
|
// CHECK: }
|
|
// CHECK-NEXT: static var kNestedA: ns.nestedNS.EnumInNestedNS { get }
|
|
// CHECK-NEXT: static var kNestedB: ns.nestedNS.EnumInNestedNS { get }
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT:}
|