Mercury-Language/mercury

Adding additional modes to a pred silences warnings about arms without solutions

AlaskanEmily opened this issue · 1 comments

An example can be found here:
https://osdn.net/users/alaskanemily/pastebin/6245

This causes a confusing scenario where you get a warning about determinism which could be tighter when the mode is semidet, and no error or warning when the mode is det. The warning about that clause having no solutions is missing, and so the programmer may assume (or at least I did when I first looked at this) that the compiler will generate incorrect code and somehow unify the second argument when any argument to the arity-one functor is given.

It would be nice to have that warning happen even when more modes are added, as otherwise it can be easy to overlook the (potential) programming error caused by making that mode det.

I just committed a fix for this. It should be available in the next ROTD.

I would also like to thank you for your bug reports. They are never frivolous, they are
a model of clarity, and they have cut-down-as-far-as-possible test cases. I wish
every bug report we got was as good :-(