gmcs can now finally compile System.Collections.Generic - at least the classes which are currently in CVS.
As a side note, the problem with "recursive" interfaces I mentioned yesterday is now also fixed.
Got up really early this morning and finally got everything working. Here's a summary of what I fixed the last two days:
First of all, inheritance is now actually working. Previously, simple examples like
already worked, but it did not if the base class had a different number or another order of type parameters, for instance:
or
This is now working.
The second thing are interfaces. Like I already mentioned in my blog last week, I needed to do some larger mcs changes for this. Now, I also implemented the reflection/runtime part of it.
Let's have a look at yesterday's example again:
When instantiating Bar, it's not a class (which has exactly one parent class), but it's an interface which can have any number of "parent" interfaces (ie. interfaces it implements). This means its System.Reflection.MonoGenericInst instance must also inflate the methods from all these interfaces.
Ok, so far, this is a summary of things which are already working. Now let's have a look at what still needs to be done.
Things like
Another thing I need to look at are the generic collection classes in corlib/System.Collections.Generic - can gmcs already compile them, if not, then why ....
I already mentioned this a few times in my blog and some day, I need to look at it.
I'm also planning to do a mcs bug fixing session on Sunday and Monday.
While implementing generic interfaces, I realized we have some problems with type parameters and inheritance. Let's have a look at the following example:
Now let's assume we instantiate this as Bar<int,string> and try to call Hello() on it, like this:
We need to encode this as
Update: This is not a problem anymore :-) I blogged this tonight shortly before falling asleep and already fixed it this morning.
The film was excellent :-) This weekend, I'll watch it a second time in Luxemburg - the big problem about german cinemas is that they're showing films in german ...
Today, I'm back in generics land. Ben just offered to help me implementing the System.Collections.Generic classes which is really great since I can now concentrate on gmcs stuff.
So let's have a look at the problems which impede gmcs from compiling these classes:
This example looks easy, but it's not because you could also do something like this:
So we're in the same situation than in gen-23 here.
Btw. I was asked whether gmcs can compile "normal" code like corlib. Unfortunately, it can not and it's also not trivial to fix. Things like this (from test-48):
are causing problems in the grammar.
Today, at 14:00 UTC - that's in 3 hours and 18 minutes - is the world premier of Matrix.
I'm one of the happy people who were able to get a ticket for it and - since our local cinema has numbered seats - I already know that I'll have an excellent one :-)
I'm making really good progress with generics support and getting really happy about this :-)
At the moment, I'm concentrating on reflection and runtime stuff and try to make sure gmcs produces correct IL for all the gen-* tests in mcs/tests. This is now almost working and I'm really confident that I may fix the remaining issues today.
Latest update:
gmcs is now producing valid IL for all the tests; all tests except gen-21.exe are running with Mono (gen-21.exe is valid IL and runs under the MS runtime).