Browse Source

Pin disambiguators for constraints on sibling method type parameters

The chain cases in the fixture route T : TOuter through a class-level
type parameter; the variant where the dependency target is a sibling
method type parameter (M<T, U> with T : U) was uncovered. It pins the
same alignment from a different angle: csc rejects 'class' with CS8665
when U is merely class-constrained and requires 'default', but accepts
'class' when U carries a class-type constraint, matching what the
tri-state IsReferenceType derives. Both directions were verified
against csc before adding the expected output.

Assisted-by: Claude:claude-fable-5:Claude Code
pull/3910/head
Siegfried Pammer 2 months ago
parent
commit
ffbd2055b0
  1. 26
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Issue3909.cs

26
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Issue3909.cs

@ -207,6 +207,32 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -207,6 +207,32 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
}
}
public abstract class MethodChainBase
{
public virtual T? DependentOnClassConstrained<T, U>(T? value, U other) where T : U where U : class
{
return value;
}
public virtual T? DependentOnClassType<T, U>(T? value, U other) where T : U where U : Node
{
return value;
}
}
public sealed class MethodChainDerived : MethodChainBase
{
public override T? DependentOnClassConstrained<T, U>(T? value, U other) where T : default
{
return value;
}
public override T? DependentOnClassType<T, U>(T? value, U other) where T : class
{
return value;
}
}
public class ContainerBase<TOuter> where TOuter : class
{
public virtual TOuter? Pick<TItem>(TItem item)

Loading…
Cancel
Save