Tests: Update GenericTypes and all test results

This commit is contained in:
Katy Coe
2019-11-11 23:29:42 +01:00
parent 06ed21747e
commit 612df92730
19 changed files with 301 additions and 101 deletions

View File

@@ -5,6 +5,7 @@
*/
using System;
using System.Collections.Generic;
namespace Il2CppTests.TestSources
{
@@ -45,4 +46,29 @@ namespace Il2CppTests.TestSources
Type tNested = typeof(Derived<>.Nested);
}
}
// Constraints on type definitions
internal class ConstrainedValueType<V> where V : struct {} // Value type constraint
internal class ConstrainedRefType<R> where R : class { // Reference type constraint
// Constraints on method definitions
#nullable enable
public void ConstrainedMethodNotNull<N>(N notnullArgument, R bar) where N : notnull {} // Non-nullable reference type constraint (suppressed if not in nullable enable context)
#nullable restore
public unsafe void ConstrainedUnmanaged<U>(U unmanagedArgument) where U : unmanaged {} // Unmanaged type constraint (added in C# 7.3; suppressed if not in unsafe context)
// Multiple constraints
public void MultipleConstraintsMethod<C>(C constrained) where C : R, new() {} // Derived type argument constraint + public parameterless constructor constraint
// Multiple type arguments with multiple constraints
public void MultipleArgumentsMultipleConstraintsMethod<B, I>(B baseArgument, I interfaceArgument)
where B : Derived<R>, new() // Base type constraint + public parameterless constructor constraint
where I : Test, IDisposable, IEnumerable<R> // Base type constraint + Interface implementation constraint x2
{ }
// Special type constraints (these must be specified as their full type names and not the C# shorthand versions
// Added in C# 7.3
public void DelegateConstraint<D>(D del) where D : Delegate {}
public void EnumConstraint<E>(E enumeration) where E : Enum {}
}
}