-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate full error traces during module inclusion #10407
Commits on Jun 21, 2021
-
Bug fix:
equal_private
was being used in too many places`equal_private` should only be used when checking inclusion for private *type abbreviations*, but was being used incorrectly for private data types and private row types as well.
Configuration menu - View commit details
-
Copy full SHA for 7849115 - Browse repository at this point
Copy the full SHA 7849115View commit details -
Add new test cases for module inclusion errors
These test cases will have improved error messages in the next non-test commit.
Configuration menu - View commit details
-
Copy full SHA for 79a60b4 - Browse repository at this point
Copy the full SHA 79a60b4View commit details -
Add more new test cases for module inclusion errors
These test cases will also have improved error messages in the next non-test commit. They come from the work done to address reviewer comments for ocaml#10407.
Configuration menu - View commit details
-
Copy full SHA for 7fad56e - Browse repository at this point
Copy the full SHA 7fad56eView commit details -
Add new test cases for failures of type-specific unification methods
These test cases will also have improved error messages in the next non-test commit. They come from the work done to address reviewer comments for ocaml#10407.
Configuration menu - View commit details
-
Copy full SHA for abd5490 - Browse repository at this point
Copy the full SHA abd5490View commit details -
Use the new structured errors (ocaml#10170) for better error messages
We now produce more detailed error messages during various kinds of module inclusion, taking advantage of the new structured error trace generation from ocaml#10170. Previously, these errors were "shallow", ending as soon as there was an incompatibility; this patch makes them "deep", reporting the *reasons* for those problems. For example, consider the following module: module M : sig val x : bool * int end = struct let x = false , "not an int" end This now produces the following error: Error: Signature mismatch: Modules do not match: sig val x : bool * string end is not included in sig val x : bool * int end Values do not match: val x : bool * string is not included in val x : bool * int The type bool * string is not compatible with the type bool * int Type string is not compatible with type int The last two lines are new in this patch. Previously, the error message stopped two lines earlier, omitting the key detail that the reason there is an error is specifically that `string` is not equal to `int`.
Configuration menu - View commit details
-
Copy full SHA for 2abe3e4 - Browse repository at this point
Copy the full SHA 2abe3e4View commit details -
Respond to review for the new structured error messages (ocaml#10407)
In addition to the smaller fixes, there were two major changes: 1. `Errortrace` has its type completely refactored, removing `desc` and exposing both `'variant trace` and `'variant error`. The former is for traces that are being built up, and contains `type_expr`s; the lattern is for complete traces, and contains `expanded_type`s (a record containing two `type_expr`s). This dramatically affected a number of call sites, but is much cleaner. 2. We now detect weakly polymorphic types much better during printing. This involved fixing a bug in moregeneral, which was not restoring enough information in the error case; it also involved exposing the flag that differentiated between printing a type (no weakly polymorphic type detection) and a scheme (yes weakly polymorphic type detection) in more places, and giving it its own custom variant type, `Printtyp.type_or_scheme`. Among the minor changes, the updates to `Includecore` to more carefully detect privacy violation errors and differentiate between the various kinds thereof (recorded in the `privacy_mismatch` type) is the most visible in the code.
Configuration menu - View commit details
-
Copy full SHA for 1820e78 - Browse repository at this point
Copy the full SHA 1820e78View commit details -
Configuration menu - View commit details
-
Copy full SHA for 80855e2 - Browse repository at this point
Copy the full SHA 80855e2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4aacb71 - Browse repository at this point
Copy the full SHA 4aacb71View commit details -
Make
Errortrace.*_error
only contain nonempty tracesThis was done by making their constructors private, and introduce smart constructors that raise a fatal error if passed an empty trace. This change was made for `Errortrace.unification_error`, `Errortrace.equality_error`, `Errortrace.moregen_error`, and the new type `Errortrace.Subtype.error` (which now contains a (possibly-empty) unification trace as well). As a side effect, in order to ensure that all raised unification errors were indeed nonempty, I had to modify `Ctype.filter_arrow`, `Ctype.filter_method`, and `Ctype.filter_self_method` to raise bespoke errors rather than empty unification traces. This also allowed me to change the error messages printed in those cases to be more precise.
Configuration menu - View commit details
-
Copy full SHA for 2d62e82 - Browse repository at this point
Copy the full SHA 2d62e82View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0c99332 - Browse repository at this point
Copy the full SHA 0c99332View commit details