From dce21575424543dadcea8fbabff9d57ffbb3dc63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Standa=20Luke=C5=A1?= Date: Wed, 17 Jan 2024 10:30:24 +0100 Subject: [PATCH] Add test for type unification with the same generic type multiple times --- src/Framework/Framework/Utils/ReflectionUtils.cs | 1 - src/Tests/Binding/BindingCompilationTests.cs | 9 --------- src/Tests/Runtime/ReflectionUtilsTests.cs | 3 +++ 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/Framework/Framework/Utils/ReflectionUtils.cs b/src/Framework/Framework/Utils/ReflectionUtils.cs index 409fbee33c..fc2a747af4 100644 --- a/src/Framework/Framework/Utils/ReflectionUtils.cs +++ b/src/Framework/Framework/Utils/ReflectionUtils.cs @@ -706,7 +706,6 @@ internal static bool TryUnifyGenericTypes(Type a, Type b, Dictionary internal static void ExpandUnifiedTypes(Dictionary genericAssignment) { - // var dirty = true; var iteration = 0; bool dirty; do diff --git a/src/Tests/Binding/BindingCompilationTests.cs b/src/Tests/Binding/BindingCompilationTests.cs index 7041302d53..135cd18363 100755 --- a/src/Tests/Binding/BindingCompilationTests.cs +++ b/src/Tests/Binding/BindingCompilationTests.cs @@ -430,11 +430,6 @@ public void BindingCompiler_Valid_LambdaParameter_PreferFunc(string expr) [DataRow("DelegateInvoker2('string', (i, a) => StringProp = (i + a))", "with int", "0string")] public void BindingCompiler_Valid_LambdaParameter_TypeFromOtherArg(string expr, string expectedResult, string stringPropResult) { - // while(!Debugger.IsAttached) - // { - // System.Threading.Thread.Sleep(100); - // } - var viewModel = new TestLambdaCompilation(); var result = ExecuteBinding(expr, viewModel); Assert.AreEqual(expectedResult, result, message: "Result mismatch"); @@ -499,10 +494,6 @@ public void BindingCompiler_Valid_LambdaParameter_CombinedTypeModifies(string ex [DataRow("_this.CustomGenericDelegateInvoker(true, as => as.Select(a => !a))", "False,False")] public void BindingCompiler_Valid_LambdaParameter_CustomDelegate(string expr, string expectedResult) { - // while(!Debugger.IsAttached) - // { - // System.Threading.Thread.Sleep(100); - // } var viewModel = new TestLambdaCompilation(); var result = ExecuteBinding(expr, viewModel); Assert.AreEqual(expectedResult, result); diff --git a/src/Tests/Runtime/ReflectionUtilsTests.cs b/src/Tests/Runtime/ReflectionUtilsTests.cs index 478da83892..048ca01da1 100644 --- a/src/Tests/Runtime/ReflectionUtilsTests.cs +++ b/src/Tests/Runtime/ReflectionUtilsTests.cs @@ -62,6 +62,9 @@ public string GetDisplayName(MethodInfo methodInfo, object[] data) => public void Test0(T a, string b, string expected) { } public void Test1(List a, List b, string expected) { } public void Test2(Func a, Func b, int expected, string expected2) { } + public void TestTypeUsedMultipleTime0(Func> a, Func b, Func expected) { } + public void TestTypeUsedMultipleTime1(Func> a, Func> b, int expected) { } + public void TestTypeUsedMultipleTime2((IEnumerable, IEnumerable<(int, int)>) a, (IEnumerable>, IEnumerable) b, IEnumerable expected, (int, int) expected2) { } public void TestPartial0(T a, T b, T expected) { } public void TestPartial1(Func a, Func b, T expected, string expected2) { } public void TestPartial2(Tuple a, U b, T expected, Tuple expected2) { }