Closed bcc32 closed 1 year ago
Looks sensible to me. (It would also make sense for re-search-forward
to simply return nil
if invoked beyond the starting limit, but unfortunately that's harder to change.)
Apply the same fix to
tuareg--pattern-pre-form-fun
by analogy.tuareg--pattern-equal-matcher
is already correct.
Thanks, pushed.
Here's an example snippet where this error can happen:
let xxxx_xxxxxx (type value) ~(f : xxxx -> ( xxxxx * (xxxxx_xxxx, xxx_xxxxx) Xxxxxxxx_xxxxx.Xxxx_xx_xxxxxxx_xxxxx.x , (xxxxx_xxxx, xxx_xxxxx) Xxxxxx.x , xxxxx_xxxx ) Xxxxxxx_xxxxxxxx_xxxxxx.Xx_xxx_xxxxxxxxxxx.x) ~(xxxx : Xxxx_xxxxxxx.Xxxxxx_xxxx.x) ~(xxxxxxxx : xxxxx Xxxxxxx.Xx_xxxxxxxxx.x) ~(xxxxxx_xxxxx : (xxxxx_xxxx, xxx_xxxxx) Xxxxxxxx_xxxxx.Xxxx_xx_xxxxxxx_xxxxx.xxxxxx) ~(xxxxxx_xxxxx : (xxxxx_xxxx, xxx_xxxxx) Xxxxxxxx_xxxxx.Xxxx_xx_xxxxxxx_xxxxx.xxxxxx) ~(xxxxxxxx_xxxxx : (xxxxx_xxxx, xxx_xxxxx) Xxxxxxxx_xxxxx.Xxxx_xx_xxxxxxx_xxxxx.x) ~(xxxxx_xxxxx : xxxxx -> xxxxx -> xxxx) : ( xxxxx * (xxxxx_xxxx, xxx_xxxxx) Xxxxxxxx_xxxxx.Xxxx_xx_xxxxxxx_xxxxx.x , (xxxxx_xxxx, xxx_xxxxx) Xxxxxx.x, xxxxx_xxxx ) Xxxxxxx_xxxxxxxx_xxxxxx.Xx_xxx_xxxxxxxxxxx.x = xxxx ;;
That's some clever piece of code you have here. It probably deserves an explanatory comment :-)
When
tuareg--pattern-pre-form-let
is invoked at the beginning of a let binding whose LHS is very long (> 800 characters), it can signal the following error:This happens when a balanced set of parentheses includes the limit position, so
forward-list
skips past it and thereby causes point to exceed limit.Apply the same fix to
tuareg--pattern-pre-form-fun
by analogy.tuareg--pattern-equal-matcher
is already correct.Here's an example snippet where this error can happen:
Opening this file in tuareg-mode results in the following error in the
*Messages*
buffer: