Type checker incorrectly claims incompatible pointer types if redundant protocol conformance is specified

Originator:bdorfman
Number:rdar://18491222 Date Originated:29-Sep-2014
Status:Open Resolved:
Product:Developer tools Product Version:
Classification: Reproducible:
 
Summary:
When declaring a type, declaring "redundant" protocol conformance can cause the type checker to break.

E.g. Class B subclasses Class A and conforms to Protocols X and Y.

I have a method with a return value of (ClassA<ProtocolY> *)
Returning just (ClassB *) works as expected, but returning (ClassB<ProtocolX> *) gives an "incompatible pointer type" warning, even though it is not actually adding any extra information or changing the type, as ClassB by definition implements ProtocolX.

Specifying redundant protocol information can be necessary in some cases if the classes and protocols are forward-declared (and thus some scopes do not know the classes' full conformance). However, in scopes where all the class and protocol definitions have been imported, the above example should not return a warning.

Steps to Reproduce:
Sample project is included.

Expected Results:
The type checker will recognize that the return value is valid.

Actual Results:
Xcode complains of an incompatible pointer type mismatch.

Version:
Xcode, 6.0.1 OS X 10.9.5

Notes:


Configuration:


Attachments:
'TypeCheckingBugExample.zip' was successfully uploaded.


[Note: OpenRadar doesn't let you attach files, but the example project should be easy to recreate from the example described above]

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com 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!