-
Notifications
You must be signed in to change notification settings - Fork 200
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
Fix how root provider resolve generic methods #749
Fix how root provider resolve generic methods #749
Conversation
I think it's better to do matching for signature variables, but it seems that the correct approach is not as simple as the implementation in 2eef27e, Update: Done. |
@MichalStrehovsky I've added support to match all parameters, and I've tested it with below code: using System;
using System.Collections.Generic;
namespace DimRepro
{
unsafe interface ITest<T>
{
void Bar(string baz) => Console.WriteLine(baz);
void Bar(T what, string baz) => Console.WriteLine(what.ToString() + baz);
void Bar<U>(U what, string baz, List<T> how) => Console.WriteLine(what.ToString() + how.ToString() + baz);
void Bar<U>(U[] what, string baz, List<T> how) => Console.WriteLine(what.ToString() + how.ToString() + baz);
void Bar<U>(List<T> what, string baz, List<U> how) => Console.WriteLine(what.ToString() + how.ToString() + baz);
void Bar<U>(List<U[]> what, string baz, List<T> how) => Console.WriteLine(what.ToString() + how.ToString() + baz);
void Bar<U>(Dictionary<U, T> what, string baz, List<T> how) => Console.WriteLine(what.ToString() + how.ToString() + baz);
}
class Test<T> : ITest<T> { }
class Program
{
static void Main(string[] args)
{
ITest<float> x = new Test<float>();
x.Bar("test");
x.Bar(5, "test");
x.Bar(5, "hello", new List<float>());
x.Bar(new[] { 5 }, "hello", new List<float>());
x.Bar(new List<float> { 5f }, "hello", new List<string>());
x.Bar(new List<int[]> { new[] { 5 } }, "hello", new List<float>());
x.Bar(new Dictionary<int, float>(), "hello", new List<float>());
}
}
} rd.xml: <Directives>
<Application>
<Assembly Name="DimRepro">
<Type Name="DimRepro.ITest`1[[System.Single,System.Private.CoreLib]]" Dynamic="Required All">
<Method Name="Bar" Dynamic="Required">
<Parameter Name="System.Single,System.Private.CoreLib" />
<Parameter Name="System.String,System.Private.CoreLib" />
</Method>
<Method Name="Bar" Dynamic="Required">
<GenericArgument Name="System.Int32,System.Private.CoreLib" />
<Parameter Name="System.Int32,System.Private.CoreLib" />
<Parameter Name="System.String,System.Private.CoreLib" />
<Parameter Name="System.Collections.Generic.List`1[[System.Single,System.Private.CoreLib]],System.Private.CoreLib" />
</Method>
<Method Name="Bar" Dynamic="Required">
<GenericArgument Name="System.Int32,System.Private.CoreLib" />
<Parameter Name="System.Int32[],System.Private.CoreLib" />
<Parameter Name="System.String,System.Private.CoreLib" />
<Parameter Name="System.Collections.Generic.List`1[[System.Single,System.Private.CoreLib]],System.Private.CoreLib" />
</Method>
<Method Name="Bar" Dynamic="Required">
<GenericArgument Name="System.Int32,System.Private.CoreLib" />
<Parameter Name="System.Collections.Generic.List`1[[System.Single,System.Private.CoreLib]],System.Private.CoreLib" />
<Parameter Name="System.String,System.Private.CoreLib" />
<Parameter Name="System.Collections.Generic.List`1[[System.Int32,System.Private.CoreLib]],System.Private.CoreLib" />
</Method>
<Method Name="Bar" Dynamic="Required">
<GenericArgument Name="System.Int32,System.Private.CoreLib" />
<Parameter Name="System.Collections.Generic.List`1[[System.Int32[],System.Private.CoreLib]],System.Private.CoreLib" />
<Parameter Name="System.String,System.Private.CoreLib" />
<Parameter Name="System.Collections.Generic.List`1[[System.Single,System.Private.CoreLib]],System.Private.CoreLib" />
</Method>
<Method Name="Bar" Dynamic="Required">
<GenericArgument Name="System.Int32,System.Private.CoreLib" />
<Parameter Name="System.Collections.Generic.Dictionary`2[[System.Int32,System.Private.CoreLib],[System.Single,System.Private.CoreLib]],System.Private.CoreLib" />
<Parameter Name="System.String,System.Private.CoreLib" />
<Parameter Name="System.Collections.Generic.List`1[[System.Single,System.Private.CoreLib]],System.Private.CoreLib" />
</Method>
</Type>
<Type Name="DimRepro.Test`1[[System.Single,System.Private.CoreLib]]" Dynamic="Required All" />
</Assembly>
</Application>
</Directives> |
I think this PR is ready. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Contributes to #733