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.

Post a Comment