[Mono-devel-list] Mono .net 2.0 preview and generics
2a5gjx302 at sneakemail.com
Fri May 14 02:09:40 EDT 2004
At 02:29 PM 13/05/2004 -0500, Ben Martin wrote:
>Actually his code does that properly as far as I can see...
>This appears to be a bug in gmcs... Consider the following code which
>compiles but then chokes when run (of course...). It SHOULD NOT compile
>as is... And if you change it to USE the ref modifiers like it supposed
>to, it doesn't work... (Incidentally I tried it with non-generic classes
>and it works as expected, so it is evidently a problem only with the
>generics part). (I am using beta1, I am assuming this has not been fixed
>already; I didn't see anything about it on bugzilla).
I agree. It looks like the "ref" flag is being ignored at the method header
(not at the call site). This would explain why the compiler is trying to
convert a "ref T" to a "T"; it thinks the function takes a "T". I haven't
worked on that part of the code, and I do not have an environment set up to
make changes and test them, but I suspect the plumbing for the "ref" flag
is all in place, and that the fix is likely a one-liner within the parser
itself, before the parse tree hits the compiler proper.
More information about the Mono-devel-list