You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Non-recursive GADT gets a different error depending on which constructor is a GADT #9067
A GADT constructor in a type declared without rec is reported in two different ways.
When the first constructor is a GADT constructor:
typet<'a> =A(int): t<int>
GADTs require recursive type syntax.
Define your type using `type rec` instead of `type`.
Example: type rec t = ...
When a later constructor is one, or in a signature:
typet<_> =Plain | Indexed(int): t<int>
GADT case syntax cannot be used in a 'nonrec' block.
nonrec is not ReScript syntax. The first message comes from a check in bs_ast_invariant.ml that only looks at the first constructor of a structure item; the second is the type checker's own error (Nonrec_gadt in typedecl.ml), which covers every case. The first message also isn't indented like the rest of the error.
Activity
Report every non-recursive GADT with the type rec hint (#9079)