lionheart / openradar-mirror

A mirror of radars pulled from http://openradar.me/.
245 stars 17 forks source link

50161512: Subclass doesn't effectively inherit protocol on runtime. #21208

Open openradar-mirror opened 5 years ago

openradar-mirror commented 5 years ago

Description

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

- Product Version: 10.2 Created: 2019-04-24T09:28:40.932808 Originated: 2019-04-24T00:00:00 Open Radar Link: http://www.openradar.me/50161512