[Mono-bugs] [Bug 653832] New: mono 2.8 does not compile some generics

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Nov 15 20:25:35 EST 2010


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

https://bugzilla.novell.com/show_bug.cgi?id=653832#c0


           Summary: mono 2.8 does not compile some generics
    Classification: Mono
           Product: Mono: Compilers
           Version: 2.8.x
          Platform: i386
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: msafar at novell.com
        ReportedBy: angel.ignacio.colmenares at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Community User
           Blocker: No


Description of Problem:

mono 2.8 does not compile code using generics.  Mono 2.6.7 compiles it !!!

mono 

Steps to reproduce the problem:
1. code

using System;
namespace test
{
   public class ComboBox: ComboBoxBase<ListItem>
    {   
        public class Builder: ComboBoxBase<ListItem>.Builder< ComboBox,
ComboBox.Builder>
        {

        }

    }

    public abstract  class ComboBoxBase<T> where T : StateManagedItem 
    {
        public abstract  class Builder<TComboBoxBase, TBuilder>  
            where TComboBoxBase : ComboBoxBase<T>
                        where TBuilder : Builder<TComboBoxBase, TBuilder>
        {
        }

    }    


    public class ListItem: StateManagedItem
    {

    public class Builder : StateManagedItem.Builder<ListItem, ListItem.Builder>
        {
            public Builder() : base(new ListItem()) { }
    }

    }


   public  class StateManagedItem
    {
        public class Builder<TItem, TBuilder>
            where TItem : StateManagedItem
                        where TBuilder : Builder<TItem, TBuilder>
        {

            public Builder(TItem item)
            {
                this.item = item;
            }

            protected TItem item;

    }

    }

}


2.  compile:

/usr/local/bin/gmcs /noconfig
"/out:/home/angel/Projects/Projects/test/test/bin/Debug/test.dll"
"/r:/usr/local/lib/mono/2.0/System.dll" /nologo /warn:4 /debug:+ /debug:full
/optimize- /codepage:utf8 "/define:DEBUG"  /t:library 
"/home/angel/Projects/Projects/test/test/test.cs" 

Actual Results:
using mono 2.8:
Compilation failed: 1 error(s), 0 warnings

/home/angel/Projects/Projects/test/test/test.cs(7,62): error CS0311: The type
`test.ComboBox' cannot be used as type parameter `TComboBoxBase' in the generic
type or method
`test.ComboBoxBase<test.ListItem>.Builder<TComboBoxBase,TBuilder>'. There is no
implicit reference conversion from `test.ComboBox' to `test.ComboBoxBase<T>'
/home/angel/Projects/Projects/test/test/test.cs(18,40): (Location of the symbol
related to previous error)

using 2.6.7
Construcción finalizada -- 0 errores, 0 advertencias

Expected Results:

mono 2.8 must compile code as 2.6.7 do it

How often does this happen? 
allways

Additional Information:

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


More information about the mono-bugs mailing list