https://bugzilla.novell.com/show_bug.cgi?id=346998


           Summary: type inference bug prevents compilation of nhibernate
           Product: Mono: Compilers
           Version: SVN
          Platform: x86-64
        OS/Version: Linux
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: C#
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]
         QAContact: [EMAIL PROTECTED]
          Found By: ---


The following code does not compile -- the compiler tries to use type inference
on generic version of method B.Foo<T> () from method B.Goo () instead of using
non-generic method B.Foo (). The problem seems to happen only when the methods
are overriden.


using System.Collections;
using System.Collections.Generic;

class A
{
  public virtual IList Foo (string s)
  {
    return null;
  }

  public virtual IList<T> Foo<T> (string s)
  {
    return null;
  }
}

class B : A
{
  public IList Goo (string s)
  {
    return Foo (s);
  }

  public override IList Foo (string s)
  {
    return null;
  }

  public override IList<T> Foo<T> (string s)
  {
    return null;
  }
}


class C
{
  public static int Main ()
  {
    new B ().Goo ("q");

    return 0;
  }
}


Error message:

foo.cs(21,5): error CS0266: Cannot implicitly convert type
`System.Collections.Generic.IList<T>' to `System.Collections.IList'. An
explicit conversion exists (are you missing a cast?)
Compilation failed: 1 error(s), 0 warnings

Mono is compiled from SVN rev.90461. I have not seen any related changes in
compiler since that revision.

I think this is critical as many other projects may be also affected.


-- 
Configure bugmail: https://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.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to