-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interface implementations are not taken into consideration for type analysis. #47
Labels
bug
Something isn't working
Comments
This is a direct result of
Including interfaces in the type hierarchy complicates things, as the inheritance graph is no longer necessarily a tree any more. This makes looking for common base types more involved, especially if there is diverging paths in the inheritance graphs (which path to take? do we take a path or just resort to Object in those cases?). We'll have to think about what is best here. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
A class's interface implementations are not taken into consideration for tye inference and type conversion insertion.
Example:
IMyDisposable
interface implementsSystem.IDisposable
interface andMyDisposable
class implementsIMyDisposable
interface.OldRod produces the following code:
The
castclass
toSystem.IDisposable
is redundant since the parameter which is loaded before it is of typeIMyDisposable
which implementsIDisposable
.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 theMyDisposable
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
The text was updated successfully, but these errors were encountered: