[Mono-bugs] [Bug 587244] New: CS1502 And CS1503 on accessing a static method within a generic inner class

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Mar 10 17:04:43 EST 2010


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

http://bugzilla.novell.com/show_bug.cgi?id=587244#c0


           Summary: CS1502 And CS1503 on accessing a static method within
                    a generic inner class
    Classification: Mono
           Product: Mono: Compilers
           Version: 2.6.x
          Platform: Other
        OS/Version: Mac OS X 10.6
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: gringod at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; en-US)
AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.1 Safari/533.2

When using a static method on a generic class which is within another class I
get two compiler errors: CS1502 and CS1503.

Bug was identified when trying to compile Lucene.Net from trunk:
https://svn.apache.org/repos/asf/lucene/lucene.net/trunk/C%23/

Reproducible: Always

Steps to Reproduce:
===== Code
using System;
using System.Collections.Generic;

namespace StaticGeneric
{
    class MainClass
    {
        public static void Main (string[] args)
        {
            Outer.Inner<string>.WriteOut(args);
        }
    }

    public class Outer 
    {    
        public class Inner<T>
        {
            public static void WriteOut (IEnumerable<T> myObject)
            {
                Console.WriteLine("{0}", myObject);
            }
        }
    }
}
Actual Results:  
Main.cs(45,45): Error CS1502: The best overloaded method match for
`StaticGeneric.Outer.Inner<T>.WriteOut(System.Collections.Generic.IEnumerable<T>)'
has some invalid arguments (CS1502)
Main.cs(45,45): Error CS1503: Argument `#1' cannot convert `string[]'
expression to type `System.Collections.Generic.IEnumerable<T>' (CS1503)


Expected Results:  
Compiles successfully

The following code does compile successfully:

===== Code

===== Code
using System;
using System.Collections.Generic;

namespace StaticGeneric
{
    class MainClass
    {
        public static void Main (string[] args)
        {
        Inner<string>.WriteOut(args);
        }
    }

        public class Inner<T>
        {
            public static void WriteOut (IEnumerable<T> myObject)
            {
                Console.WriteLine("{0}", myObject);
            }
        }
}


=======

-- 
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