Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Improved error message for illegal permutations #8546
This PR supplements the error message for illegal permutations of runtime components in module types
module M: sig module type x = sig val x: int class y : object end end end = struct module type x = sig class y: object end val x : int end end
with an example of two swapped runtime components:
This illustrative transposition is chosen to increase the number of fixed points in the coercing permutation (following the traditional decomposition of permutation). Thus applying the suggested swap may yield a new error message, but this chain of error messages should be finite.
This PR comes with few new tests for illegal permutations.
If undoing the swap is not enough to fix the error, this should be hinted at by the error message formulation. What about:
("not in the same order" is nicer than "swapped" because it does not suggest that the actual change that broke the ordering was a swap -- it could be, but we don't know that it was.)
gasche left a comment
I read through the code and I like it. (From a distance it looks like too much code, but this is nice code.) Feel free to take inspiration of my nitpicking comments or not, and merge whenever you like.