[Mono-bugs] [Bug 523899] New: GMCS fails to resolve generic types when using Nullable enums - regression

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Jul 21 12:06:37 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=523899


           Summary: GMCS fails to resolve generic types when using
                    Nullable enums - regression
    Classification: Mono
           Product: Mono: Compilers
           Version: SVN
          Platform: Macintosh
        OS/Version: Mac OS X 10.5
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: tom.philpot at logos.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US;
rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1

using System;
using System.Collections.Generic;

namespace Test
{
   public enum Enum
   {
      One,
      Two
   }

   class CompilerTest
   {

      public static void Main(string[] s) {
         ThisDoesNotWork();
      }

      protected static int DoSomething<T>(string s, T t, ref T t2)
      {
         Console.WriteLine("s={0}", s);
         Console.WriteLine("t={0}", t.ToString());
         Console.WriteLine("t2={0}", t2.ToString());

         t2 = default(T);

         return 0;
      }

      // .NET 3.5 infers Enum? from T, Mono is confused
      public static void ThisDoesNotWork()
      {
         // Nullable does not work
         Enum? e = Enum.One;
         DoSomething("abc", Enum.Two, ref e);
      }

      public static void ThisWorksFine()
      {
         Enum e = Enum.Two;
         DoSomething("abc", Enum.Two, ref e);
         Console.WriteLine("e={0}", e.ToString());
      }
   }
}

Reproducible: Always

Steps to Reproduce:
1. Try to compile the above code with gmcs (r138189)

Actual Results:  
CompilerTest2.cs(35,10): error CS0411: The type arguments for method
`Test.CompilerTest.DoSomething<T>(string, T, ref T)' cannot be inferred from
the usage. Try specifying the type arguments explicitly


Expected Results:  
Should compile.

This can be worked around by explictly specifying <Enum?> as the type.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list