Sunday, September 06, 2009

F# algebraic types under the covers

Consider the simple type

Innocuous, right? Well look at what Reflector has to say about the May 2009 CTP version...

Most of this is tagged as [CompilerGenerated] -- with some surprising omissions, like

which makes filtering out what is written vs what is generated for coverage analysis purposes rather more tedious than it might be. Arguably, in a unit test using the type, the latter two should get exercised anyway, but having the __DebugDisplay() method left over seems like a bit of an oversight.


By way of comparison, the Feb 2010 CTP yields

which is broadly similar, but differs in detail (such as the Tags values and the DebuggerDisplay attributes -- and the bug about __DebugDisplay not having the CompilerGenerated attribute is fixed.

2 comments :

Anonymous said...

Feel free to send stuff like this to fsbugs@microsoft.com. I've gone ahead and filed a bug about __DebugDisplay().

Steve Gilham said...

Thanks! -- and I'll keep that address in mind for the next time I find a little quirk.