Skip to content

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
@ghost ghost 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: -

// 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