Browse Source

Allow implicit conversions in return statements.

pull/844/head
Siegfried Pammer 8 years ago
parent
commit
efca6babbd
  1. 2
      ICSharpCode.Decompiler.Tests/CustomAttributes/S_CustomAttributeSamples.cs
  2. 5
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.cs
  3. 2
      ICSharpCode.Decompiler/CSharp/StatementBuilder.cs

2
ICSharpCode.Decompiler.Tests/CustomAttributes/S_CustomAttributeSamples.cs

@ -264,7 +264,7 @@ namespace NamedInitializerPropertyType
{
get
{
return (Type)null;
return null;
}
set
{

5
ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.cs

@ -73,13 +73,12 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
private int[,] Array()
{
return (int[,])null;
return null;
}
private unsafe int* GetPointer()
{
// return null;
return (int*)0u;
return null;
}
public int GetIndex()

2
ICSharpCode.Decompiler/CSharp/StatementBuilder.cs

@ -183,7 +183,7 @@ namespace ICSharpCode.Decompiler.CSharp
protected internal override Statement VisitReturn(Return inst)
{
IType targetType = currentFunction.IsAsync ? currentFunction.AsyncReturnType : currentMethod.ReturnType;
return new ReturnStatement(exprBuilder.Translate(inst.Value).ConvertTo(targetType, exprBuilder));
return new ReturnStatement(exprBuilder.Translate(inst.Value).ConvertTo(targetType, exprBuilder, allowImplicitConversion: true));
}
protected internal override Statement VisitYieldReturn(YieldReturn inst)

Loading…
Cancel
Save