@@ -709,71 +709,64 @@ final class DumpTests: XCTestCase {
709709
710710 func testKeyPath( ) {
711711 var dump = " "
712+ #if swift(>=5.9)
713+ if #available( macOS 13 . 3 , iOS 16 . 4 , watchOS 9 . 4 , tvOS 16 . 4 , * ) {
714+ dump = " "
715+ customDump ( \UserClass . name, to: & dump)
716+ XCTAssertNoDifference (
717+ dump,
718+ #"""
719+ \UserClass.name
720+ """#
721+ )
722+
723+ dump = " "
724+ customDump ( \Pair . driver. name, to: & dump)
725+ XCTAssertNoDifference (
726+ dump,
727+ #"""
728+ \Pair.driver.name
729+ """#
730+ )
731+
732+ dump = " "
733+ customDump ( \User . name. count, to: & dump)
734+ XCTAssertNoDifference (
735+ dump,
736+ #"""
737+ \User.name.count
738+ """#
739+ )
712740
713- // NB: This code path marks the expectation of relying on SE-0369's
714- // `AnyKeyPath.debugDescription`, which currently has a crash related to dynamic member lookup:
715- // https://github.com/apple/swift/issues/64865
716- //
717- // #if swift(>=5.8)
718- // if #available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *) {
719- // dump = ""
720- // customDump(\UserClass.name, to: &dump)
721- // XCTAssertNoDifference(
722- // dump,
723- // #"""
724- // \UserClass.name
725- // """#
726- // )
727- //
728- // dump = ""
729- // customDump(\Pair.driver.name, to: &dump)
730- // XCTAssertNoDifference(
731- // dump,
732- // #"""
733- // \Pair.driver.name
734- // """#
735- // )
736- //
737- // dump = ""
738- // customDump(\User.name.count, to: &dump)
739- // XCTAssertNoDifference(
740- // dump,
741- // #"""
742- // \User.name.count
743- // """#
744- // )
745- //
746- // dump = ""
747- // customDump(\(x: Double, y: Double).x, to: &dump)
748- // XCTAssertNoDifference(
749- // dump,
750- // #"""
751- // \(x: Double, y: Double).x
752- // """#
753- // )
754- //
755- // dump = ""
756- // customDump(\Item.$isInStock, to: &dump)
757- // XCTAssertNoDifference(
758- // dump,
759- // #"""
760- // \Item.$isInStock
761- // """#
762- // )
763- //
764- // // NB: This currently crashes when using Swift's `debugDescription`:
765- // // https://github.com/apple/swift/issues/64865
766- // dump = ""
767- // customDump(\Wrapped<String>.count, to: &dump)
768- // XCTAssertNoDifference(
769- // dump,
770- // #"""
771- // \Wrapped.count
772- // """#
773- // )
774- // return
775- // }
776- // #endif
741+ dump = " "
742+ customDump ( \( x: Double, y: Double) . x, to: & dump)
743+ XCTAssertNoDifference (
744+ dump,
745+ #"""
746+ \(x: Double, y: Double).x
747+ """#
748+ )
749+
750+ dump = " "
751+ customDump ( \Item . $isInStock, to: & dump)
752+ XCTAssertNoDifference (
753+ dump,
754+ #"""
755+ \Item.$isInStock
756+ """#
757+ )
758+
759+ dump = " "
760+ customDump ( \Wrapped < String > . count, to: & dump)
761+ XCTAssertNoDifference (
762+ dump,
763+ #"""
764+ \Wrapped<String>.subscript(dynamicMember: <unknown>)
765+ """#
766+ )
767+ return
768+ }
769+ #endif
777770 #if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
778771 // Run twice to exercise cached lookup
779772 for _ in 1 ... 2 {
0 commit comments