Files
swift-mirror/test/Interop/Cxx/enum/nested-enums-module-interface.swift
John Hui b58a908082 [cxx-interop] Add Hashable conformance to imported enums (#76940)
* [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
2024-10-15 20:24:35 -07:00

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:}