-
Notifications
You must be signed in to change notification settings - Fork 85
Description
Describe the bug
A class's interface implementations are not taken into consideration for tye inference and type conversion insertion.
Example:
IMyDisposable interface implements System.IDisposable interface and MyDisposable class implements IMyDisposable interface.
OldRod produces the following code:

The castclass to System.IDisposable is redundant since the parameter which is loaded before it is of type IMyDisposable which implements IDisposable.
If we look at the code before virtualization and then devirtualization we see exactly that.

Similar behavior can be seen where the aforementioned method is used:

We see another redundant cast to, this time, IMyDisposable. As before this cast is redundant as the MyDisposable class already implements that interface.
If we look at the non-processed code we see the cast is missing:

To Reproduce
Devirtualize the sample provided in the zip file below:
sample2.zip