Skip to content

Commit 7b6b08b

Browse files
committed
Resolves rdar://59844232
1 parent 889ebaa commit 7b6b08b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/Casting/Casts.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -847,4 +847,15 @@ CastsTests.test("Failing cast from Any to Optional<Protocol> [SR-6279]") {
847847
expectNotNil(f)
848848
}
849849

850+
protocol SuperProtocol{}
851+
CastsTests.test("Casting Objects retained from KeyPaths to Protocols is not working properly") {
852+
// This is the simplified reproduction from rdar://59844232 which doesn't
853+
// actually use KeyPaths
854+
class SubClass : SuperProtocol{}
855+
let value = SubClass() as Any? as Any
856+
857+
expectNotNil(value as? SubClass)
858+
expectNotNil(value as? SuperProtocol)
859+
}
860+
850861
runAllTests()

0 commit comments

Comments
 (0)