Compiler throwing warning due to toll-free bridging issue in test case

Number:rdar://21349340 Date Originated:11-Jun-2015 04:17 PM
Status:Duplicate of 20502241 Resolved:14-Aug-2015 12:12 PM
Product:Developer Tools Product Version:Xcode 7.0 beta (7A120f)
Classification:Serious Bug Reproducible:Always
I ran into a compiler warning that is very interesting when trying to parse JSON in a test case. I have attached a sample project that demonstrates the behavior. I spoke with the compiler engineers at WWDC15 and they wanted me to file a radar demonstrating the issue.

Here's the compiler warning that I'm seeing:

JSONParserTests.swift:26:37: Cast from 'XCUIElement?' to unrelated type '[String : String]' always fails

I have both the offending line as well as the solution pointed out by one of the Apple engineers.

Steps to Reproduce:
Open up the sample project with Xcode 7b1

Expected Results:
No warning is presented

Actual Results:
The following warning is presented:

JSONParserTests.swift:26:37: Cast from 'XCUIElement?' to unrelated type '[String : String]' always fails

OS X 10.10.3 running Xcode 7.0 beta (7A120f)



'' was successfully uploaded.

You can also find this sample project on Github at the following link:


Same problem for me. I see 69 warnings in my test target (the same rows are not highlighted for the regular app target) for rows like this:

`if let message = JSON!["message"] as? String{... `

Still occurring with Xcode 7b5, and this time with Core Data APIs.

As far as I can tell, this is still occurring on Xcode 7b4

By eric.miller at July 22, 2015, 2:19 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!