Getting FS0035 => Design is out of date

In a fsyacc based project I have this line:

type 'a cucomment = string


This is the complete description of the error that I am getting:

CALast.fs (117,9): bug FS0035: This construct is deprecated: this type of abbreviation has one or more parameters of the declared type that do not appear in the abbreviated type. Type abbreviations must be used by all declared type parameters in the abbreviated type. Consider removing one or more type parameters, or using a specific type definition that wraps a base type, such as' type C <'a> = C of ...'.

Any idea how to solve this?


source to share

1 answer

F # no longer allows type aliases that add type type parameters to a type without declaring a new type. If you want to define a generic type that wraps some other type, you must use some kind of constructor. For example, you can use a uniform discriminatory union:

type 'a Cucomment = CC of string


Unfortunately, this means that you will have to change all the code that uses this type to expand the value using pattern matching or by adding a member Value

to the type.

The only time generic type aliases are allowed is when you declare a unit version of the type, which requires a special attribute. However, this probably won't work for you (because the units behave completely differently):

type 'a Cucomment = string 


If it is in some code generated by fsyacc , then the bug in fsyacc should be fixed (I think this was a fairly recent change). In this case, report it fsbugs

to microsoft

dot com




All Articles