* Fix#9759: Typing without -principal is broken in 4.11 and trunk
* compile stdlib in -principal mode
* never modify generic part of ty_expected_explained
* use generic_instance where possible
* add comment for -no-principal in stdlib__oo.cmi
This commit adds a function in Printtyp for searching elements of
the printing environment without reading cmis.
This function is used to ensure that the printing of types does not
trigger unrelated errors by trying to access cmis on the file system.
In presence of -annot, the type printer can be requested to print the
inner path of inline records (i.e "t.A"). Before this commit, the
printing of these paths could trigger a lookup to a module with a
invalid name "t".
If this lookup fails this is fine.
However, if there is a cmi file in the environment sharing the name "t",
the lookup can partially succeed (since cmi are not required to start
with a capital letter) until we compare the module name stored in the
cmi with the requested module name.
Obviously, the valid module name "T" of the cmi cannot match the invalid
module name "t" that was requested, and the cmi reader raises a wrong
module file name error.
This commit avoids this whole process by detecting in the type printer
when we are printing an inlined record type constructor.
improved error messages for fixed row polymorphic variants: keep track of the motivation behind a fixed row (e.g it was bound to an universal or existential type variable, or private) in the types themselves and use this explanation in error messages.
* Fix `Printtyp.print_items` final state
* make `Printtyp.tree_of_type_declaration` more cautious when hiding the declared type within the body of the declaration.
* test
This PR is a follow-up of #1212, it proposes to give more context for universal type variables that escape their scope when unifying methods, by precising the actual type and expected type at the method level, as suggested by @garrigue in #1212 .
* unification trace: track univar renaming
This PR fixes an inconsistency introduced by #2047 : when an universal type variable was renamed in Printtyp, the explanation part of the error message kept the original name leading to potentially confusing error messages.
This PR fixes this inconsistency by keeping the whole type expression in the explanation part of the unification message instead of just its original name (and add a test for this behavior).
Previously, not having a scope meant the type was used in every context,
now we set the scope to "Btype.lowest_level" to mean the same thing.
The equivalence was made obvious by the recent changes to identifiers
scoping.
- Ident.create now takes a scope as argument
- added Ident.create_var to use when the scope doesn't matter
- the current_time and the current_level are unrelated as of this
commit. But one has to remember to bump the level when creating new
scopes.
- inline Pervasives in Stdlib and re-add Pervasives as a deprecated
module that aliases all elements of Stdlib except the stdlib modules.
- remove special case for Stdlib.Pervasives in printtyp.ml
* Printtyp: minor refactoring of Path.t printing functions
Implement more cleanly and expose the separation of printing in two phases for
Path.t: first, build an outcome tree component (possibly reading printing_env
and updating global state), second, print the outcome tree (without side-effect
apart for printing).
* Expose Oprint.out_ident and remove its duplicata in Printtyp