summaryrefslogtreecommitdiff
path: root/typing/printtyp.ml
Commit message (Collapse)AuthorAgeFilesLines
* Print the type variable that cannot be generalized (#12051)Stefan Muenzel2023-03-271-2/+4
|
* variant with simplified oprintFlorian Angeletti2023-03-141-16/+10
|
* error messages: aliases for weakly polymorphic row variablesFlorian Angeletti2023-03-141-22/+35
|
* use find_first_mono in PrinttypGabriel Scherer2023-02-281-10/+10
|
* use Shape component kinds in printtypFlorian Angeletti2023-02-161-61/+64
|
* Remove an unused parameter in Printtyp.filter_trace (#12008)Richard Eisenberg2023-02-151-11/+6
| | | | * Remove an unused parameter * Further simplifications / corrections from comments
* printtyp: Refactor constructor printing functionalityStefan Muenzel2023-02-141-46/+116
| | | | Co-authored-by: Florian Angeletti <florian.angeletti@inria.fr>
* review: grammarFlorian Angeletti2023-01-021-1/+1
|
* review: another ordinal descriptionoctachron2023-01-021-5/+4
|
* review: correct exampleFlorian Angeletti2023-01-021-2/+2
|
* review: explanation for `bound_in_recursion`Florian Angeletti2023-01-021-1/+22
|
* review: reduced diffFlorian Angeletti2023-01-021-3/+4
|
* review: better name for tree_of_best_type_pathFlorian Angeletti2023-01-021-8/+11
|
* review: printtyp, document collect_explanationsFlorian Angeletti2023-01-021-0/+6
|
* review: restructure and explain the assignment of index in printtypFlorian Angeletti2023-01-021-13/+21
|
* review: human id abstractionFlorian Angeletti2023-01-021-3/+14
|
* review: remove dangerous "!="Florian Angeletti2023-01-021-1/+1
|
* printtyp: remove spurious space in error tracesFlorian Angeletti2023-01-021-1/+1
|
* error messages: use de bruijn indices to disambiguate namesFlorian Angeletti2023-01-021-144/+88
|
* Encode extra types within pathHyunggyu Jang2022-11-111-13/+16
| | | | | | | | Reflect reviews Reflect review Pacify hygine
* Add explicit constructors to Path.t for inline record typesLeo White2022-11-111-6/+13
|
* Add colors to error message hints (#11685)Christiana Anthony2022-11-081-4/+4
|
* Printtyp: avoid stack overflow when printing constructors or recordsFlorian Angeletti2022-10-171-0/+5
| | | | | | | | | Toplevel functions exported by the Printtyp should in general prepare all types involved in the printing. The toplevel `constructor`, `label` and `extension_only_constructor` functions didn't prepare their arguments and return types making the printer loops on such types.
* Printtyp: new function for extending set of prepared typeFlorian Angeletti2022-10-131-1/+4
| | | | and use this new function in class error messages.
* Remove uses of ;; from the codebaseSébastien Hinderer2022-02-251-2/+2
|
* Update privacy when methods are overridden. Fixes #10781.Leo White2021-11-181-2/+2
|
* abstract row_field (#10627)Jacques Garrigue2021-10-221-11/+16
| | | Co-authored-by: Takafumi Saikawa <tscompor@gmail.com>
* make field_kind and commutable abstract typesTakafumi Saikawa2021-10-181-26/+9
|
* Improve type variable name generation and recursive type detection when ↵Antal Spector-Zabusky2021-10-151-134/+188
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | printing type errors (#10488) * Separate type variable naming and loop marking when printing errors Improve type variable name generation and recursive type detection when printing type errors by 1. Iterating over the whole trace and reserving type variable names once, to ensure that type variable names aren't reused in confusing ways between types. 2. Detecting recursive types (i.e., marking loops) for each type individually during printing, ensuring that spurious `as 'a` clauses aren't generated and that `as`-bound names can't be referred to across different types. This involved updating the `Printtyp` module: first refactoring `mark_loops_rec` into a general case analysis `iter_type_expr_for_printing`, and then implementing both `reserve_names` and `mark_loops` in terms of it (via `Names.add_named_vars` and a new `mark_loops_rec` that only handles marking loops and not generating names). As a result, the API for printing types also changed: * `type_expr` still does what it always did. * To handle multiple types simultaneously, use `prepare_for_printing` and `prepared_type_expr` (replacing `marked_type_expr` and the associated marking facilities). * Within `Printtyp`, we use `named_type_expr`, which is in-between the other formatters and assumes names have been generated but does its own loop marking.
* [refactoring] Outcometree: introduce a record type for constructorsGabriel Scherer2021-09-151-3/+15
|
* Force normalization on access to `row_desc` (#10474)Jacques Garrigue2021-09-101-25/+27
| | | | | | * always row_repr * remove the dummy field `row_bound` Co-authored-by: Takafumi Saikawa <tscompor@gmail.com>
* Rename ConcrLeo White2021-07-151-2/+2
| | | | | | | | | | The Types.Concr module is just a string set, and it is used in a number of places. It was originally used for the set of concrete methods in a class signature, but it's not used for that anymore and almost none of the places it is still used are related to that. This commit replaces is with MethSet and VarSet modules for sets of method or instance variable labels, and with Misc.Stdlib.String.Set for other uses.
* Treat class_signature more like type_exprThomas Refis2021-07-141-5/+5
| | | | | | | | | | | | | | | | | | Treat class_signature more like type_expr by making all its components mutable and using three unification-like operations for manipulating them: add_method, add_instance_variable and inherit_class_signature. These operations behave similarly to filter_self_method, which they replace. We move much of the logic for handling class_signature into Btype and Ctype and use it for the typing of class signatures and class structures. Instead of using method and variable tables with both identifiers and type components as accumulators during class structure typing, we use tables with just identifiers along with a single class_signature. This makes the logic clearer and makes it easier to share things with the typing of class signatures.
* Change representation of class typesLeo White2021-07-131-52/+53
| | | | | | | | | | Previously, class types represented their methods via the csig_self field. This was a type_expr that was restricted to be syntactically a Tobject node. With this patch the methods are represented directly with a methods table. csig_self is no longer restricted to be a Tobject node and is no longer required to contain the private methods. We also add a csig_self_row field to hold the row variable of the class type -- which means we can avoid going through csig_self to find it.
* Normalize type_expr nodes on access (#10337)Jacques Garrigue2021-06-241-90/+90
| | | Co-authored-by: Takafumi Saikawa <tscompor@gmail.com>
* Respond to final round of review for #10407Antal Spector-Zabusky2021-06-211-1/+1
|
* Make `Errortrace.*_error` only contain nonempty tracesAntal Spector-Zabusky2021-06-211-8/+12
| | | | | | | | | | | | | | | This 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.
* Respond to more review for the structured error messages (#10407)Antal Spector-Zabusky2021-06-211-39/+34
|
* Respond to review for the new structured error messages (#10407)Antal Spector-Zabusky2021-06-211-139/+163
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* Use the new structured errors (#10170) for better error messagesAntal Spector-Zabusky2021-06-211-116/+196
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We now produce more detailed error messages during various kinds of module inclusion, taking advantage of the new structured error trace generation from #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`.
* TyposJPR2021-06-061-1/+1
|
* Move type_unboxed.unboxed into type_kindStephen Dolan2021-05-251-12/+15
|
* toplevel: detect recursive definitions in #showFlorian Angeletti2021-05-191-6/+7
|
* Merge pull request #10401 from Octachron/signature_group_2Gabriel Scherer2021-05-121-88/+17
|\ | | | | #6654, #9974: make include and with constraints aware of ghost components
| * Signature_group: ghost-aware iteration over signaturesoctachron2021-05-061-88/+17
| | | | | | | | | | | | Signatures contain ghost type items that depends on a core syntactic item, the module "Signature_group" provides iterators that are aware of this difference between syntactic and ghost items.
* | Add {Int,Int32,Int64,NativeInt}.{min,max} (#10392)Alain Frisch2021-05-111-1/+1
| |
* | Fix formatting issuesAntal Spector-Zabusky2021-05-061-26/+42
| | | | | | | | | | | | * Fit to 80-column line width * Remove stray non-ASCII character * Delete stray empty line at end of file
* | Replace `report_error` and `trace_format` with 3 separate functionsAntal Spector-Zabusky2021-05-061-1/+8
| |
* | Return `prepare_expansion_head` to the global scopeAntal Spector-Zabusky2021-05-061-5/+4
| |
* | Change `Printtyp.trace_format` into a GADT and expose itAntal Spector-Zabusky2021-05-061-8/+10
| |