Tests: Include array of derived closed generic type in GenericTypes

This commit is contained in:
Katy Coe
2020-01-30 08:00:58 +01:00
parent 007779df62
commit f04604edc7
4 changed files with 65 additions and 67 deletions

View File

@@ -11,32 +11,32 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Image 0: mscorlib.dll - Assembly: mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - Types 0-1809
// [assembly: AssemblyCompany] // 0x000000018000E050-0x000000018000E2C0
// [assembly: AssemblyCopyright] // 0x000000018000E050-0x000000018000E2C0
// [assembly: AssemblyDefaultAlias] // 0x000000018000E050-0x000000018000E2C0
// [assembly: AssemblyDelaySign] // 0x000000018000E050-0x000000018000E2C0
// [assembly: AssemblyDescription] // 0x000000018000E050-0x000000018000E2C0
// [assembly: AssemblyFileVersion] // 0x000000018000E050-0x000000018000E2C0
// [assembly: AssemblyInformationalVersion] // 0x000000018000E050-0x000000018000E2C0
// [assembly: AssemblyKeyFile] // 0x000000018000E050-0x000000018000E2C0
// [assembly: AssemblyProduct] // 0x000000018000E050-0x000000018000E2C0
// [assembly: AssemblyTitle] // 0x000000018000E050-0x000000018000E2C0
// [assembly: CLSCompliant] // 0x000000018000E050-0x000000018000E2C0
// [assembly: CompilationRelaxations] // 0x000000018000E050-0x000000018000E2C0
// [assembly: ComVisible] // 0x000000018000E050-0x000000018000E2C0
// [assembly: Debuggable] // 0x000000018000E050-0x000000018000E2C0
// [assembly: DefaultDependency] // 0x000000018000E050-0x000000018000E2C0
// [assembly: Guid] // 0x000000018000E050-0x000000018000E2C0
// [assembly: NeutralResourcesLanguage] // 0x000000018000E050-0x000000018000E2C0
[assembly: RuntimeCompatibility] // 0x000000018000E050-0x000000018000E2C0
// [assembly: SatelliteContractVersion] // 0x000000018000E050-0x000000018000E2C0
[assembly: StringFreezing] // 0x000000018000E050-0x000000018000E2C0
// [assembly: TypeLibVersion] // 0x000000018000E050-0x000000018000E2C0
// [assembly: AssemblyCompany] // 0x000000018000E500-0x000000018000E770
// [assembly: AssemblyCopyright] // 0x000000018000E500-0x000000018000E770
// [assembly: AssemblyDefaultAlias] // 0x000000018000E500-0x000000018000E770
// [assembly: AssemblyDelaySign] // 0x000000018000E500-0x000000018000E770
// [assembly: AssemblyDescription] // 0x000000018000E500-0x000000018000E770
// [assembly: AssemblyFileVersion] // 0x000000018000E500-0x000000018000E770
// [assembly: AssemblyInformationalVersion] // 0x000000018000E500-0x000000018000E770
// [assembly: AssemblyKeyFile] // 0x000000018000E500-0x000000018000E770
// [assembly: AssemblyProduct] // 0x000000018000E500-0x000000018000E770
// [assembly: AssemblyTitle] // 0x000000018000E500-0x000000018000E770
// [assembly: CLSCompliant] // 0x000000018000E500-0x000000018000E770
// [assembly: CompilationRelaxations] // 0x000000018000E500-0x000000018000E770
// [assembly: ComVisible] // 0x000000018000E500-0x000000018000E770
// [assembly: Debuggable] // 0x000000018000E500-0x000000018000E770
// [assembly: DefaultDependency] // 0x000000018000E500-0x000000018000E770
// [assembly: Guid] // 0x000000018000E500-0x000000018000E770
// [assembly: NeutralResourcesLanguage] // 0x000000018000E500-0x000000018000E770
[assembly: RuntimeCompatibility] // 0x000000018000E500-0x000000018000E770
// [assembly: SatelliteContractVersion] // 0x000000018000E500-0x000000018000E770
[assembly: StringFreezing] // 0x000000018000E500-0x000000018000E770
// [assembly: TypeLibVersion] // 0x000000018000E500-0x000000018000E770
// Image 1: GenericTypes.dll - Assembly: GenericTypes, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null - Types 1810-1832
// [assembly: CompilationRelaxations] // 0x000000018000C150-0x000000018000C1B0
// [assembly: Debuggable] // 0x000000018000C150-0x000000018000C1B0
[assembly: RuntimeCompatibility] // 0x000000018000C150-0x000000018000C1B0
// [assembly: CompilationRelaxations] // 0x000000018000C600-0x000000018000C660
// [assembly: Debuggable] // 0x000000018000C600-0x000000018000C660
[assembly: RuntimeCompatibility] // 0x000000018000C600-0x000000018000C660
internal static class Consts // TypeDefIndex: 100
{
@@ -75,11 +75,11 @@ internal static class Consts // TypeDefIndex: 100
internal sealed class Locale // TypeDefIndex: 101
{
// Constructors
private Locale() {} // 0x00000001800E3000-0x00000001800E3010
private Locale() {} // 0x00000001800E5000-0x00000001800E5010
// Methods
public static string GetText(string msg) => default; // 0x0000000180124590-0x00000001801245A0
public static string GetText(string fmt, params /* 0x00000001800090D0-0x00000001800090E0 */ object[] args) => default; // 0x00000001802C5BB0-0x00000001802C5C20
public static string GetText(string msg) => default; // 0x00000001801273C0-0x00000001801273D0
public static string GetText(string fmt, params /* 0x0000000180009200-0x0000000180009210 */ object[] args) => default; // 0x00000001802D5F20-0x00000001802D5F90
}
namespace Il2CppTests.TestSources
@@ -115,10 +115,10 @@ namespace Il2CppTests.TestSources
internal class Test // TypeDefIndex: 1819
{
// Constructors
public Test() {} // 0x00000001800E3000-0x00000001800E3010
public Test() {} // 0x00000001800E5000-0x00000001800E5010
// Methods
public void GenericTypesTest() {} // 0x00000001803EDC60-0x00000001803EDC60
public void GenericTypesTest() {} // 0x0000000180408870-0x0000000180408870
}
internal class ConstrainedValueType<V> // TypeDefIndex: 1820
@@ -169,7 +169,7 @@ namespace Il2CppTests.TestSources
public ConstrainedRefType() {}
// Methods
// [NullableContext] // 0x0000000180009190-0x00000001800091B0
// [NullableContext] // 0x0000000180008EC0-0x0000000180008EE0
public void ConstrainedMethodNotNull<N>(N notnullArgument, R bar) {}
public void ConstrainedUnmanaged<U>(U unmanagedArgument)
where U : struct {}

View File

@@ -11,32 +11,32 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Image 0: mscorlib.dll - Assembly: mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - Types 0-1809
// [assembly: AssemblyCompany] // 0x1000ED70-0x1000EF80
// [assembly: AssemblyCopyright] // 0x1000ED70-0x1000EF80
// [assembly: AssemblyDefaultAlias] // 0x1000ED70-0x1000EF80
// [assembly: AssemblyDelaySign] // 0x1000ED70-0x1000EF80
// [assembly: AssemblyDescription] // 0x1000ED70-0x1000EF80
// [assembly: AssemblyFileVersion] // 0x1000ED70-0x1000EF80
// [assembly: AssemblyInformationalVersion] // 0x1000ED70-0x1000EF80
// [assembly: AssemblyKeyFile] // 0x1000ED70-0x1000EF80
// [assembly: AssemblyProduct] // 0x1000ED70-0x1000EF80
// [assembly: AssemblyTitle] // 0x1000ED70-0x1000EF80
// [assembly: CLSCompliant] // 0x1000ED70-0x1000EF80
// [assembly: CompilationRelaxations] // 0x1000ED70-0x1000EF80
// [assembly: ComVisible] // 0x1000ED70-0x1000EF80
// [assembly: Debuggable] // 0x1000ED70-0x1000EF80
// [assembly: DefaultDependency] // 0x1000ED70-0x1000EF80
// [assembly: Guid] // 0x1000ED70-0x1000EF80
// [assembly: NeutralResourcesLanguage] // 0x1000ED70-0x1000EF80
[assembly: RuntimeCompatibility] // 0x1000ED70-0x1000EF80
// [assembly: SatelliteContractVersion] // 0x1000ED70-0x1000EF80
[assembly: StringFreezing] // 0x1000ED70-0x1000EF80
// [assembly: TypeLibVersion] // 0x1000ED70-0x1000EF80
// [assembly: AssemblyCompany] // 0x1000F350-0x1000F560
// [assembly: AssemblyCopyright] // 0x1000F350-0x1000F560
// [assembly: AssemblyDefaultAlias] // 0x1000F350-0x1000F560
// [assembly: AssemblyDelaySign] // 0x1000F350-0x1000F560
// [assembly: AssemblyDescription] // 0x1000F350-0x1000F560
// [assembly: AssemblyFileVersion] // 0x1000F350-0x1000F560
// [assembly: AssemblyInformationalVersion] // 0x1000F350-0x1000F560
// [assembly: AssemblyKeyFile] // 0x1000F350-0x1000F560
// [assembly: AssemblyProduct] // 0x1000F350-0x1000F560
// [assembly: AssemblyTitle] // 0x1000F350-0x1000F560
// [assembly: CLSCompliant] // 0x1000F350-0x1000F560
// [assembly: CompilationRelaxations] // 0x1000F350-0x1000F560
// [assembly: ComVisible] // 0x1000F350-0x1000F560
// [assembly: Debuggable] // 0x1000F350-0x1000F560
// [assembly: DefaultDependency] // 0x1000F350-0x1000F560
// [assembly: Guid] // 0x1000F350-0x1000F560
// [assembly: NeutralResourcesLanguage] // 0x1000F350-0x1000F560
[assembly: RuntimeCompatibility] // 0x1000F350-0x1000F560
// [assembly: SatelliteContractVersion] // 0x1000F350-0x1000F560
[assembly: StringFreezing] // 0x1000F350-0x1000F560
// [assembly: TypeLibVersion] // 0x1000F350-0x1000F560
// Image 1: GenericTypes.dll - Assembly: GenericTypes, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null - Types 1810-1832
// [assembly: CompilationRelaxations] // 0x1000D210-0x1000D260
// [assembly: Debuggable] // 0x1000D210-0x1000D260
[assembly: RuntimeCompatibility] // 0x1000D210-0x1000D260
// [assembly: CompilationRelaxations] // 0x1000D800-0x1000D850
// [assembly: Debuggable] // 0x1000D800-0x1000D850
[assembly: RuntimeCompatibility] // 0x1000D800-0x1000D850
internal static class Consts // TypeDefIndex: 100
{
@@ -75,11 +75,11 @@ internal static class Consts // TypeDefIndex: 100
internal sealed class Locale // TypeDefIndex: 101
{
// Constructors
private Locale() {} // 0x100C0000-0x100C0010
private Locale() {} // 0x100C3000-0x100C3010
// Methods
public static string GetText(string msg) => default; // 0x100F8810-0x100F8820
public static string GetText(string fmt, params /* 0x10009B80-0x10009BA0 */ object[] args) => default; // 0x10261620-0x10261670
public static string GetText(string msg) => default; // 0x100FD9C0-0x100FD9D0
public static string GetText(string fmt, params /* 0x10009C70-0x10009C90 */ object[] args) => default; // 0x10270000-0x10270050
}
namespace Il2CppTests.TestSources
@@ -115,10 +115,10 @@ namespace Il2CppTests.TestSources
internal class Test // TypeDefIndex: 1819
{
// Constructors
public Test() {} // 0x100C0000-0x100C0010
public Test() {} // 0x100C3000-0x100C3010
// Methods
public void GenericTypesTest() {} // 0x103584B0-0x103584B0
public void GenericTypesTest() {} // 0x1036D450-0x1036D450
}
internal class ConstrainedValueType<V> // TypeDefIndex: 1820
@@ -169,7 +169,7 @@ namespace Il2CppTests.TestSources
public ConstrainedRefType() {}
// Methods
// [NullableContext] // 0x10009B00-0x10009B20
// [NullableContext] // 0x10009C10-0x10009C30
public void ConstrainedMethodNotNull<N>(N notnullArgument, R bar) {}
public void ConstrainedUnmanaged<U>(U unmanagedArgument)
where U : struct {}

View File

@@ -6,6 +6,7 @@
using System;
using System.IO;
using System.Linq;
using Il2CppInspector.Reflection;
using NUnit.Framework;
@@ -32,9 +33,8 @@ namespace Il2CppInspector
TypeInfo tBase = asm.GetType("Il2CppTests.TestSources.Base`2");
TypeInfo tDerived = asm.GetType("Il2CppTests.TestSources.Derived`1");
TypeInfo tDerivedBase = tDerived.BaseType;
// TODO: array of Derived<int>
// TypeInfo tDerivedArray
// TODO: Use a model GetType() once implemented
TypeInfo tDerivedArray = model.Types.First(t => t.Namespace == "Il2CppTests.TestSources" && t.Name == "Derived`1[System.Int32][]");
TypeInfo tT = tBase.GenericTypeParameters[0];
TypeInfo tU = tBase.GenericTypeParameters[1];
@@ -44,7 +44,7 @@ namespace Il2CppInspector
DisplayGenericType(tBase, "Generic type definition Base<T, U>");
DisplayGenericType(tDerived, "Derived<V>");
DisplayGenericType(tDerivedBase, "Base type of Derived<V>");
//DisplayGenericType(tDerivedArray, "Array of Derived<int>");
DisplayGenericType(tDerivedArray, "Array of Derived<int>");
DisplayGenericType(tT, "Type parameter T from Base<T,U>");
DisplayGenericType(tU, "Type parameter U from Base<T,U>");
DisplayGenericType(tF, "Field type, G<Derived<V>>");
@@ -55,7 +55,7 @@ namespace Il2CppInspector
(tBase, "Base`2[T,U]", true, true, true, false, -1),
(tDerived, "Derived`1[V]", true, true, true, false, -1),
(tDerivedBase, "Base`2[System.String,V]", true, false, true, false, -1),
//(tDerivedArray, "Derived`1[System.Int32][]", false, false, false, false, -1),
(tDerivedArray, "Derived`1[System.Int32][]", false, false, false, false, -1),
(tT, "T", false, false, true, true, 0),
(tU, "U", false, false, true, true, 1),
(tF, "G`1[Derived`1[V]]", true, false, true, false, -1),

View File

@@ -45,8 +45,6 @@ namespace Il2CppTests.TestSources
Type tF = tDerived.GetField("F").FieldType;
Type tNested = typeof(Derived<>.Nested);
}
private void forceTypeReferenceToDerivedIntArray(Derived<int> typeRef) {}
}
// Constraints on type definitions