ocaml-flambda / flambda-backend

The Flambda backend project for OCaml
92 stars 65 forks source link

Jkind Error Messages #2730

Open liam923 opened 1 week ago

liam923 commented 1 week ago

Improve errror messages for kind mismatches. The new behavior is:

  1. If the layouts disagree, the error message will only be about layouts (regardless of whether modes agree), and modes are not included in the error message. Layouts are referred to by names like float64, even though this is a white lie, since that's actually the name of a kind.
  2. If the layouts agree, then the message will be about kinds. The full jkind is printed out.

For the second case, I'd like to add some sort of hint at the end of the message about which modal axes disagree. But I don't have a great idea yet of what I think that should look like, so I chose to leave that for later work.

I think a reasonable alternative approach would be to completely get rid of case 1. Instead, always make the error message about kinds. When there is a layout disagreement, add a hint to the end of the message saying so. I'm not sure if this would be more or less confusing to users.

The diff is large, but most of it is tests. And most of those changes are the same change, repeated a bazillion times.