Consider this type:
[<Struct>]
type ABC = A | B | C
F# 9 compiles it to a struct with this attribute (among others):
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto, Size = 1)]
However, because of the compiler-generated _tag field, the size is actually 4:
> sizeof<ABC>;;
val it: int = 4
This seems not to cause any problems, but the documentation states "This field must be equal or greater than the total size, in bytes, of the members of the class or structure," which suggests this should be corrected.
Consider this type:
F# 9 compiles it to a struct with this attribute (among others):
However, because of the compiler-generated
_tagfield, the size is actually 4:This seems not to cause any problems, but the documentation states "This field must be equal or greater than the total size, in bytes, of the members of the class or structure," which suggests this should be corrected.