Open C4Cypher opened 3 months ago
I just committed a fix for this bug. It should be in the next release-of-the-day.
Thank you for the precise bug report.
My pleasure. I currently stick to the major releases, for now, but the next time I build a newer version of the mmc I'll try to follow up and validate the fix action.
In the process of trying to satisfy a mode transformation on a sum algebraic type, I've run into a curious compiler error. If I create a discriminated union with both existential and universally typed constructors (
foo
andbarX
respectively in the example provided) ... the MMC will not allow me to switch on the type if it has more than ten constructors, producing the errorI tested the limits of the error by 1. removing the existentially typed data constructor (in the example:
some [T] foo(T)
) or 2. removing the barX constructors until I could compile without the error. I'm not exactly sure why the limit seems to be ten constructors. It's an odd corner case, because if the existentially typed constructor is not present, the universally typed constructors compile fine without apparent limit, and conversely if the number of universally typed constructors is less than ten, it also compiles fine.Example module:
I had been trying to create a discriminated union of every primitive mercury data type, including an existentially typed constructor for non primitive types when I ran into this issue. I can easily work around this by using the
univ
type ... if I end up needing class constraints I can be creative in finding alternatives.Please let me know if there is any further information I can provide, or if anyone has problems reproducing the issue.