Mercury-Language/mercury

Compiler crash with nested lambdas/curried preds in a typeclass-constrained predicate

AlaskanEmily opened this issue · 1 comments

An example can be found here:

https://osdn.net/users/alaskanemily/pastebin/6341

This crashes with
Software Error: predicate check_hlds.modecheck_unify.modecheck_unification_rhs_undetermined_mode_lambda'/8: Unexpected: expecting single call`

For this to occur, there must be a predicate with a leading argument of another predicate which has a curried argument. The curried predicate must have multiple modes, and it doesn't have to be recursive, for instance you can replace line with: list.foldl(do(nothing), T, !X). if you add state arguments to do/2 and nothing/1 (I originally found this with rbtree.foldl_values). The predicate where this occurs must also have typeclass constraints, although the typeclass doesn't have to have anything to do with any of the preds or types (in the example, it's just empty).

Fix committed 2020 July 29.