Browse Source

Upgrade Roslyn version used for our tests (from 3.7.0 to 3.8.0-2.final) and adjust NativeInteger attribute decoding.

pull/2145/head
Daniel Grunwald 5 years ago
parent
commit
c775d3a98f
  1. 7
      ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj
  2. 3
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/NativeInts.cs
  3. 1
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/NullableRefTypes.cs
  4. 6
      ICSharpCode.Decompiler/TypeSystem/ApplyAttributeTypeVisitor.cs
  5. 7
      ILSpy.Tests/ILSpy.Tests.csproj

7
ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj

@ -42,11 +42,12 @@ @@ -42,11 +42,12 @@
<ItemGroup>
<PackageReference Include="DiffLib" Version="2017.7.26.1241" />
<PackageReference Include="Microsoft.Build.Locator" Version="1.2.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.7.0" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="3.7.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.8.0-2.final" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="3.8.0-2.final" />
<PackageReference Include="System.Collections.Immutable" Version="5.0.0-preview.8.20407.11" />
<PackageReference Include="System.Reflection.Metadata" Version="5.0.0-preview.8.20407.11" />
<PackageReference Include="Microsoft.DiaSymReader.Converter.Xml" Version="1.1.0-beta1-63314-01" />
<PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
<PackageReference Include="System.Collections.Immutable" Version="1.5.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="System.Memory" Version="4.5.4" />
<PackageReference Include="Mono.Cecil" Version="0.10.3" />

3
ICSharpCode.Decompiler.Tests/TestCases/Pretty/NativeInts.cs

@ -35,8 +35,11 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -35,8 +35,11 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
private long i64;
private ulong u64;
private (IntPtr, nint, UIntPtr, nuint) tuple_field;
private (object, int, IntPtr, nint, UIntPtr, nuint) tuple_field2;
private Dictionary<nint, IntPtr> dict1;
private Dictionary<IntPtr, nint> dict2;
private Dictionary<IntPtr?, nint?> dict3;
private Dictionary<IntPtr, nint[]> dict4;
public void Convert()
{

1
ICSharpCode.Decompiler.Tests/TestCases/Pretty/NullableRefTypes.cs

@ -18,6 +18,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -18,6 +18,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
private (string, string?, string) field_tuple;
private string[]?[] field_array;
private Dictionary<(string, string?), (int, string[]?, string?[])> field_complex;
private dynamic[][,]?[,,][,,,] field_complex_nested_array;
public (string A, dynamic? B) PropertyNamedTuple {
get {

6
ICSharpCode.Decompiler/TypeSystem/ApplyAttributeTypeVisitor.cs

@ -160,6 +160,7 @@ namespace ICSharpCode.Decompiler.TypeSystem @@ -160,6 +160,7 @@ namespace ICSharpCode.Decompiler.TypeSystem
int dynamicTypeIndex = 0;
int tupleTypeIndex = 0;
int nullabilityTypeIndex = 0;
int nativeIntTypeIndex = 0;
private ApplyAttributeTypeVisitor(ICompilation compilation,
bool hasDynamicAttribute, bool[] dynamicAttributeData,
@ -322,10 +323,11 @@ namespace ICSharpCode.Decompiler.TypeSystem @@ -322,10 +323,11 @@ namespace ICSharpCode.Decompiler.TypeSystem
else if ((ktc == KnownTypeCode.IntPtr || ktc == KnownTypeCode.UIntPtr) && hasNativeIntegersAttribute)
{
// native integers use the same indexing logic as 'dynamic'
if (nativeIntegersAttributeData == null || dynamicTypeIndex > nativeIntegersAttributeData.Length)
if (nativeIntegersAttributeData == null || nativeIntTypeIndex >= nativeIntegersAttributeData.Length)
newType = (ktc == KnownTypeCode.IntPtr ? SpecialType.NInt : SpecialType.NUInt);
else if (nativeIntegersAttributeData[dynamicTypeIndex])
else if (nativeIntegersAttributeData[nativeIntTypeIndex])
newType = (ktc == KnownTypeCode.IntPtr ? SpecialType.NInt : SpecialType.NUInt);
nativeIntTypeIndex++;
}
if (type.IsReferenceType == true)
{

7
ILSpy.Tests/ILSpy.Tests.csproj

@ -46,10 +46,11 @@ @@ -46,10 +46,11 @@
<ItemGroup>
<PackageReference Include="DiffLib" Version="2017.7.26.1241" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.7.0" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="3.7.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.8.0-2.final" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="3.8.0-2.final" />
<PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
<PackageReference Include="System.Collections.Immutable" Version="1.7.1" />
<PackageReference Include="System.Collections.Immutable" Version="5.0.0-preview.8.20407.11" />
<PackageReference Include="System.Reflection.Metadata" Version="5.0.0-preview.8.20407.11" />
<PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="Moq" Version="4.14.1" />
</ItemGroup>

Loading…
Cancel
Save