So I have a simple function
getObject(_: String) -> T?.
Testing it with
XCTAssertNil(_: Any?) used to work before but is now broken in Swift 4.2.
XCTAssertNil(getObject(forKey: .userCacheKey)) // true in Swift 4.1, false in Swift 4.2
My understanding is that
T is inferred as
Any?. I'm aware there's been changes on casting with optional and generics. Yet I would have expected it to be inferred as
Any, just like it did in Swift 4.1
Is it really intended behaviour of the changes made in Swift 4.2?
Only way I found to fix the issue is using casting which does not satisfy me:
XCTAssertNil(getObject(forKey: .userCacheKey) as String?) // returns true