Browse Source

Fix #2582: Assertion when using named arguments in a constrained call

pull/2687/head
Daniel Grunwald 3 years ago
parent
commit
ced6ed445a
  1. 2
      ICSharpCode.Decompiler/IL/Transforms/NamedArgumentTransform.cs

2
ICSharpCode.Decompiler/IL/Transforms/NamedArgumentTransform.cs

@ -98,7 +98,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
namedArgBlock.FinalInstruction = call; namedArgBlock.FinalInstruction = call;
if (call.IsInstanceCall) if (call.IsInstanceCall)
{ {
IType thisVarType = call.Method.DeclaringType; IType thisVarType = call.ConstrainedTo ?? call.Method.DeclaringType;
if (CallInstruction.ExpectedTypeForThisPointer(thisVarType) == StackType.Ref) if (CallInstruction.ExpectedTypeForThisPointer(thisVarType) == StackType.Ref)
{ {
thisVarType = new ByReferenceType(thisVarType); thisVarType = new ByReferenceType(thisVarType);

Loading…
Cancel
Save