| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
* Remove an unused parameter
* Further simplifications / corrections from comments
|
|
|
|
| |
Co-authored-by: Florian Angeletti <florian.angeletti@inria.fr>
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
Reflect reviews
Reflect review
Pacify hygine
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
and use this new function in class error messages.
|
| |
|
| |
|
|
|
| |
Co-authored-by: Takafumi Saikawa <tscompor@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
* always row_repr
* remove the dummy field `row_bound`
Co-authored-by: Takafumi Saikawa <tscompor@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
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_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.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
| |
Co-authored-by: Takafumi Saikawa <tscompor@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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`.
|
| |
|
| |
|
| |
|
|\
| |
| | |
#6654, #9974: make include and with constraints aware of ghost components
|
| |
| |
| |
| |
| |
| | |
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.
|
| | |
|
| |
| |
| |
| |
| |
| | |
* Fit to 80-column line width
* Remove stray non-ASCII character
* Delete stray empty line at end of file
|
| | |
|
| | |
|
| | |
|