If you write a code like this:
type rec a = B(b) | C(c)
and b = {str: string, a: a}
and c = {str: string, num: int, a: a}
You’ll get a warning “the label str is defined in both types b and c.”, there’s a bit more information in Warning Numbers | ReScript Language Manual :
Two labels or constructors of the same name are defined in two mutually recursive types.
But I still don’t understand why this is bad and produces a warning.
I know having the same field names can be bad in general as the compiler determines types based on field names and can get confused. But why this produces a warning specifically when the types are mutually recursive?