Bug 320094 (MONO77299) - [GMCS] error for simple recursive generic type
Summary: [GMCS] error for simple recursive generic type
Status: RESOLVED FIXED
Alias: MONO77299
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 1.1
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Martin Baulig
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-18 23:09 UTC by Bryan Silverthorn
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
first test case (compiles) (202 bytes, text/plain)
2006-01-18 23:10 UTC, Thomas Wiest
Details
second test case (doesn't compile) (294 bytes, text/plain)
2006-01-18 23:11 UTC, Thomas Wiest
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 19:45:27 UTC


---- Reported by bcs26@cornell.edu 2006-01-18 16:09:49 MST ----

The attached RecType.cs test case compiles without errors. The attached
RecTypeUse.cs test case, however, fails to compile with the following error:

$ gmcs RecType.cs
RecType.cs(17,24): error CS0309: The type `RealFoo<int>' must be
convertible to `Foo<T>' in order to use it as parameter `T' in the generic
type or method `Bar<T>'
RecType.cs(13,14):: `Bar<T>', name of symbol related to previous error
RecType.cs(7,14):: `RealFoo<E>', name of symbol related to previous error
Compilation failed: 1 error(s), 0 warnings


Using mono 1.1.12.1 under Gentoo on amd64. I'm actually not sure if either
of these test cases should compile, but it seems as if either both should
(what I would expect), or neither should (if C# disallows generic types of
this form).

If the existing behavior is correct, then the gmcs error message is
misleading, since the types listed are in fact convertible.



---- Additional Comments From bcs26@cornell.edu 2006-01-18 16:10:52 MST ----

Created an attachment (id=169142)
first test case (compiles)




---- Additional Comments From bcs26@cornell.edu 2006-01-18 16:11:15 MST ----

Created an attachment (id=169143)
second test case (doesn't compile)




---- Additional Comments From martin@ximian.com 2006-01-21 09:18:39 MST ----

Miguel, when reassigning bugs to me, could you please also set the
priority to a reasonable value ?



---- Additional Comments From miguel@ximian.com 2006-01-25 14:38:54 MST ----

Set to a reasonable value.



---- Additional Comments From martin@ximian.com 2006-03-22 08:15:46 MST ----

First test case:

======
public interface Foo<T> {
}

public abstract class FooBase<T> : Foo<T> {
}

public class RealFoo<E> : FooBase<RealFoo<E>> {
    public void ItsConvertible() {
        Foo<RealFoo<E>> f = this;
    }
}

=====



---- Additional Comments From martin@ximian.com 2006-03-22 08:16:09 MST ----

Second test case:

======
public interface Foo<T> {
}

public abstract class FooBase<T> : Foo<T> {
}

public class RealFoo<E> : FooBase<RealFoo<E>> {
    public void ItsConvertible() {
        Foo<RealFoo<E>> f = this;
    }
}

public class Bar<T>
    where T : Foo<T> {
}

public class RealBar : Bar<RealFoo<int>> {
}

======




---- Additional Comments From martin@ximian.com 2006-03-22 08:21:35 MST ----

I can't reproduce this anymore.

Imported an attachment (id=169142)
Imported an attachment (id=169143)

Unknown operating system unknown. Setting to default OS "Other".