Mercury-Language / mercury

The Mercury logic programming system.
Other
904 stars 54 forks source link

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

Closed AlaskanEmily closed 4 years ago

AlaskanEmily commented 4 years ago

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.

zsomogyi commented 4 years ago

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 :-(