[Mono-bugs] [Bug 74995][Wis] New - gmcs does not infer types when a parameter is a delegate

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu May 19 12:41:26 EDT 2005


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by dsilva at ccs.neu.edu.

http://bugzilla.ximian.com/show_bug.cgi?id=74995

--- shadow/74995	2005-05-19 12:41:26.000000000 -0400
+++ shadow/74995.tmp.6063	2005-05-19 12:41:26.000000000 -0400
@@ -0,0 +1,46 @@
+Bug#: 74995
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: C#
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: dsilva at ccs.neu.edu               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: gmcs does not infer types when a parameter is a delegate
+
+Description of Problem:
+
+gmcs does not compile this program:
+
+
+public class Progn {
+  public static void Main() {
+    string[] names = FP.mapArray(new int[]{1, 2, 3},
+                                 delegate (int x) {
+                                   return x.ToString(); });
+  }
+}
+
+class FP {
+  public delegate U Mapping<T, U>(T obj);
+
+  public static U[] mapArray<T, U>(T[] array, Mapping<T, U> proc) {
+    U[] result = new U[array.Length];
+    for (int i = 0; i < array.Length; i++)
+      result[i] = proc(array[i]);
+    return result;
+  }
+}
+
+$ gmcs map.cs
+map.cs(6) error CS0411: The type arguments for method `mapArray' cannot be
+infered from the usage. Try specifying the type arguments explicitly.
+Compilation failed: 1 error(s), 0 warnings


More information about the mono-bugs mailing list