Check for unfixed type arguments before calling overload resolution for inferred...
authorMarek Safar <marek.safar@gmail.com>
Mon, 1 Nov 2010 12:41:48 +0000 (12:41 +0000)
committerMarek Safar <marek.safar@gmail.com>
Mon, 1 Nov 2010 13:26:33 +0000 (13:26 +0000)
mcs/mcs/generic.cs
mcs/tests/gtest-546.cs [new file with mode: 0644]

index 4c5a94593273ec6672e9cf943001e2006b7781b7..6bebee4df33509a8950f0f6244c6ea2f981e727c 100644 (file)
@@ -3079,6 +3079,9 @@ namespace Mono.CSharp {
                                        if (inflated == null)
                                                return 0;
 
+                                       if (IsUnfixed (inflated) >= 0)
+                                               return 0;
+
                                        param_types[i] = inflated;
                                }
 
@@ -3088,7 +3091,7 @@ namespace Mono.CSharp {
                                if (mg == null)
                                        return 0;
 
-                               return LowerBoundInference (mg.BestCandidate.ReturnType, rtype) + 1;
+                               return LowerBoundInference (mg.BestCandidateReturnType, rtype) + 1;
                        }
 
                        //
diff --git a/mcs/tests/gtest-546.cs b/mcs/tests/gtest-546.cs
new file mode 100644 (file)
index 0000000..7e31531
--- /dev/null
@@ -0,0 +1,26 @@
+using System;
+
+class Factory
+{
+       public class S<G1, G2>
+       {
+       }
+       
+       public static S<F1, F2> Create<F1, F2> (F1 f1, F2 f2)
+       {
+               return null;
+       }
+}
+
+class A
+{
+       static TR Test<T1, T2, TR>(T1 t1, T2 t2, Func<T1, T2, TR> f)
+       {
+               return f (t1, t2);
+       }
+       
+       static void Main ()
+       {
+               var r = Test ("a", "b", Factory.Create);
+       }
+}
\ No newline at end of file