Skip to content
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

Remove call to InflateInterfaces that does nothing #99070

Closed
wants to merge 1 commit into from

Conversation

jtschuster
Copy link
Member

The call to TypeReferenceExtensions.GetInflatedInterfaces is always called on a TypeDefinition, so typeRef is never a GenericInstanceType and the method will always return the uninflated InterfaceImplementation.InterfaceType property.

We should remove the Linq enumerable before we merge, but wanted to bring this up for a discussion.

@jtschuster jtschuster requested a review from sbomer February 28, 2024 19:09
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-Tools-ILLink .NET linker development as well as trimming analyzers label Feb 28, 2024
@ghost ghost assigned jtschuster Feb 28, 2024
@ghost
Copy link

ghost commented Feb 28, 2024

Tagging subscribers to this area: @agocke, @sbomer, @vitek-karas
See info in area-owners.md if you want to be subscribed.

Issue Details

The call to TypeReferenceExtensions.GetInflatedInterfaces is always called on a TypeDefinition, so typeRef is never a GenericInstanceType and the method will always return the uninflated InterfaceImplementation.InterfaceType property.

We should remove the Linq enumerable before we merge, but wanted to bring this up for a discussion.

Author: jtschuster
Assignees: jtschuster
Labels:

area-Tools-ILLink

Milestone: -

@@ -148,7 +149,7 @@ void MapInterfaceMethodsInTypeHierarchy (TypeDefinition type)

// Foreach interface and for each newslot virtual method on the interface, try
// to find the method implementation and record it.
foreach (var interfaceImpl in type.GetInflatedInterfaces (context)) {
foreach (var interfaceImpl in type.Interfaces.Select(i => (InflatedInterface: i.InterfaceType, OriginalImpl: i))) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I wonder how this is working today for generic interfaces. What if I have:

interface I<T> {
    void M(T t);
}

class C : I<int> {
    public void M(int i) {}
}

Presumably MapInterfaceMethodsInTypeHierarchy doesn't discover this? So what is keeping C.M?

@jtschuster jtschuster closed this Apr 24, 2024
@github-actions github-actions bot locked and limited conversation to collaborators May 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Tools-ILLink .NET linker development as well as trimming analyzers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants