Open gaschd opened 1 week ago
The IsOriginalSymbolGenericMethod func in VbNameExpander returns true for the correct case (IsReducedTypeParameterMethod returns true), but is false for the wrongly converted case. Overwriting it with true yields the expected output for the input code.
The intSum assignment
Method Function System.Collections.Generic.IEnumerable(Of System.Int32).Sum(selector As System.Func(Of System.Int32, System.Int32)) As System.Int32
is reduced to the generic form:
Method Function System.Linq.Enumerable.Sum(Of TSource)(source As System.Collections.Generic.IEnumerable(Of TSource), selector As System.Func(Of TSource, System.Int32)) As System.Int32
while the intSum2 assignment
Method Function System.Collections.Generic.IEnumerable(Of System.Int32).Sum() As System.Int32
is reduced to a non generic form:
Method Function System.Linq.Enumerable.Sum(source As System.Collections.Generic.IEnumerable(Of System.Int32)) As System.Int32
Thanks for the report. Sounds like you're close to a fix, feel free to PR ☺️
IEnumerable.Select is replaced with Enumerable.Select if predicate is empty. Same happens to .Zip() and .OrderBy() but not to .Where().
It seems to be depended on the extension method used afterwards, while .Sum() and .Max() cause this bug, .Count() does not.
Tested with different numeric types, resulting in the same issue.
Also one generic type parameter is missing from the methods so it does not compile, e.g. .Select needs two but only has one or .Zip needs three but only has two.
VB.Net input code
Erroneous output
Expected output
Details