From 4c704343114c75e936f6d63356ebeca92d5e7f07 Mon Sep 17 00:00:00 2001 From: Alexander Smarus Date: Mon, 7 Sep 2020 19:26:17 +0300 Subject: [PATCH] Add test for dynamic cast issue from #2500 --- Tests/Foundation/Tests/TestBridging.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Tests/Foundation/Tests/TestBridging.swift b/Tests/Foundation/Tests/TestBridging.swift index c37c2f8634..2700509149 100644 --- a/Tests/Foundation/Tests/TestBridging.swift +++ b/Tests/Foundation/Tests/TestBridging.swift @@ -26,6 +26,7 @@ class TestBridging : XCTestCase { static var allTests: [(String, (TestBridging) -> () throws -> Void)] { return [ ("testBridgedDescription", testBridgedDescription), + ("testDynamicCast", testDynamicCast), ] } @@ -62,4 +63,11 @@ class TestBridging : XCTestCase { XCTAssertEqual("description", c.debugDescription) #endif } + + func testDynamicCast() throws { + // Covers https://github.com/apple/swift-corelibs-foundation/pull/2500 + class TestClass {} + let anyArray: Any = [TestClass()] + XCTAssertNotNil(anyArray as? NSObject) + } }