Subclass doesn't effectively inherit protocol on runtime.

Originator:arthuralves.p
Number:rdar://50161512 Date Originated:24-04-2019
Status:Open Resolved:
Product:Xcode Product Version:10.2
Classification: Reproducible:Always
 
Summary:
On Xcode 10.2 only, when subclassing a class that complies to protocol P, the subclass will also comply to that protocol, but when coming to practice and trying to access anything using the protocol, it simply won't work.

Steps to Reproduce:
1. Have a protocol P with a method
2. Create class A, complying to protocol P, making the protocol's method implementation print a simple message.
3. Pass class A somewhere, expecting protocol P class. Make a call to your method.
4. Create class B, subclassing class A. Pass class B somewhere, expecting protocol P class. Your received class won't be nil, you will be able to call your method.

Expected Results:
When passing class A, calling your method should print the message to the console.
When passing class B, calling your method should also print the message to the console.

Actual Results:
Only when using class A directly, the method prints a message.
When class B is in use, its properly received as complying to the inherited protocol P but calling that method won't print any message.

Version/Build:
10.2

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!