Commit Graph

322 Commits (master)

Author SHA1 Message Date
Florian Angeletti 5d7663aaa5 review 2020-09-08 17:24:46 +02:00
Florian Angeletti bb186a8633 printtyp: cache old short path data in wrap_env 2020-09-08 17:22:23 +02:00
Jacques Garrigue 302d735ce8
Righteous ambivalence (#9767)
* 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
2020-07-29 09:10:17 +09:00
Jacques Garrigue 603506aa34
Add injectivity annotations (#9500) 2020-06-15 13:51:50 +02:00
Thomas Refis c323d11144
Merge pull request #8934 from trefis/usage
Stop relying on location to track usage
2020-03-06 16:49:44 +01:00
Florian Angeletti b82d5194c2
Merge pull request #9343 from lpw25/fix-short-paths-environments
Re-enable `-short-paths` for some error messages
2020-03-06 09:38:40 +01:00
Thomas Refis 0a09add592
printtyp: inline a function call (#9347) 2020-03-05 14:21:35 +01:00
Thomas Refis d52dd5c33e Add a unique id to every signature item 2020-03-05 13:34:12 +01:00
Leo White 971ffafffb Apply short-paths to an additional case 2020-03-05 09:44:18 +00:00
Florian Angeletti 38230a7fa7
Merge pull request #9274 from Octachron/unload_module_lookup
Printtyp: don't touch the file system
2020-01-31 13:44:57 +01:00
Florian Angeletti 51292c2956 Printtyp: don't read cmis when printing
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.
2020-01-30 18:07:59 +01:00
Gabriel Scherer e1addb7962
Merge pull request #9269 from Octachron/fix_annot
#9218: wrong file name error with -annot and inline records
2020-01-30 08:41:20 +01:00
Florian Angeletti 62699c1ce3 review 2020-01-29 10:00:15 +01:00
Florian Angeletti 9f696f0a8e 9218, avoid module/type path collitsion
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.
2020-01-28 16:30:56 +01:00
Gabriel Scherer 358c7cecd5 add separability signatures in type declarations
(this changes the .cmi format and thus requires a bootstrap,
to follow as a separate commit)

(includes bug fixes by Rodolphe Lepigre)
2020-01-28 11:39:52 +01:00
Florian Angeletti 816a5088e0 Avoid duplicated mark_loops 2019-10-17 10:03:58 +02:00
Florian Angeletti 86248f1162 make Printtyp.type_expr safer to use 2019-10-16 15:50:59 +02:00
Thomas Refis 8e928caea7
a better representation for modules with no name (#8908) 2019-10-09 14:15:37 +01:00
Jeremie Dimino 2d31ebfc8b Add support for [@@immediate64]
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2019-09-24 07:56:15 +01:00
Thomas Refis f2db8ca4ae
Merge pull request #2127 from lpw25/lookup-errors
Refactor lookup functions
2019-08-21 15:48:06 +01:00
Florian Angeletti a2d15b26d1
Merge pull request #8844 from MekhrubonT/trunk+mekh+1task+change_output
Improved error messages for type mismatches
2019-08-16 20:43:02 +02:00
Leo White c19e8b2350 Refactor environment lookup functions 2019-08-15 15:56:50 +01:00
Florian Angeletti 04a9c8be61 Rename printing function in Printtyp.Conflicts 2019-07-31 13:52:59 +02:00
Florian Angeletti c5dedcd32a Hint: redefinition of types in toplevel sessions 2019-07-31 13:52:20 +02:00
Mekhrubon Turaev 77b876a117 reseting context in constructors and labels methods before printing 2019-07-30 16:20:30 +01:00
Mekhrubon Turaev 407d650f6e Printing additional info about types mismatch during compilation error. 2019-07-30 09:51:02 +01:00
Florian Angeletti 6582335689
#8702: fix some polymorphic variant error messages (#8777)
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.
2019-07-12 17:47:25 +02:00
Leo White acd06f1eff Remove Misc.may_map and similar 2019-05-23 16:27:58 +01:00
Florian Angeletti b83d4730df
#8610: toplevel printing, consistent deduplicated name for types (#8613)
* 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
2019-04-15 19:35:59 +02:00
Jules Aguillon 109f0b2b34 Add the explain function to Ctype.Unification_trace 2019-03-08 16:37:49 +01:00
Florian Angeletti c8a15cf006 bugfix: restore "self cannot be closed" error message 2019-02-27 14:06:51 +01:00
Runhang Li 97329f30ed Extend `open` to arbritrary module expressions in structures and to
applicative module paths in signatures
2018-11-26 16:20:37 +00:00
Florian Angeletti 385223e007 MPR7565 bis: more context for universal variable in error messages (#2140)
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 .
2018-11-24 21:04:40 +01:00
Alain Frisch 4c130cae87
Fix wrong calls to Env.normalize_path on non-module paths (#2131) 2018-11-22 16:07:15 +01:00
Leo White 111d4e1827 Remove positions from paths 2018-11-21 03:39:34 -05:00
Daniel Bünzli a7afd89003 s/string_of_int/Int.to_string/g 2018-11-07 13:52:02 +01:00
Florian Angeletti e8bdc6af67 unification trace: properly track universal variable renaming (#2135)
* 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).
2018-11-06 09:33:47 +01:00
Florian Angeletti ca043e91ef unification trace: reify object error earlier 2018-10-17 17:34:47 +02:00
Florian Angeletti 233d66611c Add context for unification errors 2018-10-17 17:31:31 +02:00
Florian Angeletti 3de40984ba a type for unification traces 2018-10-17 17:27:16 +02:00
Thomas Refis 2ccad26bd0 always associate a scope to a type (previously it was optional)
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.
2018-10-05 10:51:26 +01:00
Thomas Refis 582127f240 ident: remove create_hidden 2018-09-21 11:47:44 -04:00
Thomas Refis 67f29d1a18 ident: add an explicit scope field
- 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.
2018-09-21 11:47:42 -04:00
Thomas Refis 7f3567a63f printtyp: use ident map for naming context, not a stamp map 2018-09-21 11:46:20 -04:00
Thomas Refis 9da3327b9f printtyp: use scope instead of stamp for -short-paths 2018-09-21 11:46:20 -04:00
Jérémie Dimino 9124ab82d1
Deprecate Pervasives (#1605)
- 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
2018-08-27 12:42:14 +01:00
Armael f8ceab6308 Printtyp: minor refactoring of Path.t printing functions (#1988)
* 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
2018-08-14 15:32:05 +02:00
Armaël Guéneau c0820e30cb Location: significantly rework the code printing errors and warnings 2018-08-08 17:42:08 +02:00
Hugo Heuzard 8043144494 Add locations to attributes
Changes

fix typo
2018-08-06 13:19:28 +01:00
François Bobot da3f9f34f5 Use reraise_raw_backtrace in Misc.try_finally
And add labels ~always for previous cleanup function and
    ~exceptionally for new cleanup function in exceptional case
2018-07-25 17:58:32 +02:00