Confusing error message when mixing polymorphic variant and type variable name starting with a capital letter #7012
Original bug ID: 7012
The problem appears with
#type t = [ 'A_name | `Hi ]
For some reasons, the type variable name 'A_name seems to be forgotten and replaced by the generic and confusing 'a.
Moreover, this happens only when the type variable name starts with a capital letter, more standard type variable names are not subject to this erasure:
type t = [ 'a_name | `Hi ] ;;
Error: The type 'a_name is not a polymorphic variant type
Comment author: @gasche
I extended the error message with a hint as you suggest.
Note that while
type t = [ 'Foo | 'Bar ]
(or any combination with a ' and a `)
type t = [ 'Foo ]
is caught as a syntax error at an earlier stage, and does not benefit from the same treatment. We're thinking about general improvements on syntax error reporting, so I won't spend time on this error specifically.