Fix methods with multiple generic constraints

This commit is contained in:
sinaioutlander
2020-09-19 01:27:33 +10:00
parent c39e097378
commit ad5fc04a3b
3 changed files with 44 additions and 15 deletions

View File

@ -3,6 +3,14 @@ using System.Collections.Generic;
using System;
using UnityEngine;
// used to test multiple generic constraints
public class TestGeneric : IComparable<string>
{
public TestGeneric() { }
public int CompareTo(string other) => throw new NotImplementedException();
}
namespace Explorer.Tests
{
public class TestClass
@ -22,7 +30,8 @@ namespace Explorer.Tests
public static int StaticField = 5;
public int NonStaticField;
public static string TestGeneric<C, T>(string arg0) where C : Component
public static string TestGeneric<C, T>(string arg0) where C : Component where T : TestGeneric, IComparable<string>
{
return $"C: '{typeof(C).FullName}', T: '{typeof(T).FullName}', arg0: '{arg0}'";
}