Commit Graph

528 Commits (9fdc759ac0847de5380e25882d690bb22a89df24)

Author SHA1 Message Date
Thomas Refis 9fdc759ac0
Centralized tracking of frontend's global state (#9963)
import Local_store from merlin, with a simplified API following review comments
2020-10-15 14:47:19 +02:00
Florian Angeletti 5e15dd8eb5
Merge pull request #9861 from trefis/9858
Catch Nondep_cannot_erase
2020-10-13 16:31:34 +02:00
Matthew Ryan b6b42f3ce6
Re-check Tpackage scope escapes after normalising paths (#9715)
Rewrite check_scope_escape using proper marking and unmarking

This uses the Btype.snapshot/backtrack mechanism, to ensure that we
always undo marking on types from the environment and to avoid a
`try ... with ...` construction for each recursive call.
2020-09-18 14:38:32 +02:00
Thomas Refis 92c36d54c5 correction following Florian's review 2020-09-14 13:33:24 +02:00
Thomas Refis 162df93916 catch Nondep_cannot_erase exception 2020-09-14 13:27:03 +02:00
Florian Angeletti ce04a5c1b1 Merge pull request #9862 from Octachron/4.11.1_with_less_daring_assertions
9859: revert 9348, inferred function types and :>
(cherry picked from commit 28b82e2e397d129840e35fb8da0b8af8b9f59633)
2020-09-03 13:55:17 +02:00
Thomas Refis 167e66e15d
type_cases: rely on levels to enforce principality (#1931)
Instead of the erasure scheme that was used up to now, where we
considered that the type was always principal.

Note: the erasure still happens when polymorphic variants appear in the
patterns, and the type of the scrutinee contains a Reither.
2020-07-08 10:35:40 +02:00
Jacques Garrigue 46cec117a4
Fix #9721: Injectivity and recursive modules (#9727) 2020-07-07 09:04:23 +02:00
Jacques Garrigue 24d087325c
Fix #7902: Type-checker infers a recursive type, even though -rectype… (#9556) 2020-06-15 10:26:26 +02:00
Jacques Garrigue abb8db459d
Fix #7520: Odd behaviour of refutation cases with polymorphic variants (#9547) 2020-06-03 17:47:12 +02:00
Jacques Garrigue 13a081b04e
Fix #7741: Failure to report escaping type variable (#9545) 2020-06-03 17:31:38 +02:00
Jacques Garrigue ee20f5e648
Fix the polymorphic recursion problem of #9603 (#9617) 2020-06-02 22:05:30 +02:00
Jacques Garrigue 1bb388bd15
Fix PR#7817: Unsound inclusion check for polymorphic variant (#9546) 2020-05-25 19:12:09 +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
Thomas Refis bea2d04582
build_subtype: assert arrow type is known (#9348)
`build_subtype` is invoked only through `enlarge_type` when typechecking Pexp_coerce.

The type passed to `build_subtype` can only have `Cok` arrows because:
- the base type is the direct result of `Typetexp.transl_simple_type_delayed` which only introduces `Cok` arrows
- the other source of arrows could be the result of unification; however at this point the type variables are fresh, they have not been unified with any existing types.

Adding this assertion ensures that this property won't be broken by accident.
2020-03-05 16:18:59 +01:00
Thomas Refis d52dd5c33e Add a unique id to every signature item 2020-03-05 13:34:12 +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
Leo White c272447b1e Relax the handling of explicit polymorphic types 2020-01-20 13:48:16 +00:00
Leo White ec748c04c1 Fix level handling in unify_rows for the fixed case 2020-01-20 13:48:16 +00:00
Gabriel Scherer 48db70608e Ctype: some documentation for the [free_vars] functions
Review by Thomas Refis, Florian Angeletti and Jacques Garrigue.

(no change entry needed.)
2019-12-03 11:21:46 +01:00
Leo White fb33b74bca Relax the level handling when unifying row fields (#9064) 2019-11-07 09:38:46 +00:00
Jacques Garrigue c147442b01
Fix #7636 using expansion for vanishing parameters (#9040) 2019-10-16 18:02:40 +02:00
Jacques Garrigue 16a13e668b
fix issue #8792 and replace log_type by set_type_desc in Btype (#9018) 2019-10-05 13:17:57 +02:00
Jeremie Dimino 2d31ebfc8b Add support for [@@immediate64]
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2019-09-24 07:56:15 +01:00
Leo White c19e8b2350 Refactor environment lookup functions 2019-08-15 15:56:50 +01:00
Florian Angeletti 15c17f5ad8 Ctype.lower_contravariant: avoid missing cmis 2019-07-25 18:56:02 +02: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
Jacques Garrigue 6e1b7f465e
Fix PR8701 by expanding types in lower_contravariant (#8725) 2019-06-13 11:09:45 +09:00
Leo White acd06f1eff Remove Misc.may_map and similar 2019-05-23 16:27:58 +01:00
Jacques Garrigue d32550f5fb
Fix #8550: Soundness issue with class generalization (#8552)
* also rename generalize_expansive -> lower_contravariant
2019-04-09 15:03:19 +09:00
Jules Aguillon 109f0b2b34 Add the explain function to Ctype.Unification_trace 2019-03-08 16:37:49 +01:00
Florian Angeletti 00c18be73c MPR#7937: avoid Unify in extract_concrete_typedecl (#2287) 2019-03-07 16:06:00 +09:00
Florian Angeletti c8a15cf006 bugfix: restore "self cannot be closed" error message 2019-02-27 14:06:51 +01:00
Thomas Refis d29455fcd4 enforce that every call to save_desc is necessarily followed by cleanup_types (#2261) 2019-02-25 09:48:50 +00: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
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
Thomas Refis 4a6f33d557 make check_scope_escape behave more like update_level 2018-10-18 10:52:50 +01:00
Thomas Refis d447a94f51 check_scope_escape: also handle type constructors escapes 2018-10-18 10:40:54 +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 e452ac15ab create a new scope whenever we create new scoped idents 2018-09-21 11:48:46 -04:00
Thomas Refis edf310ec28 properly scope idents
- when including: the elements are rescoped to the current level (as
well as being given a fresh stamp, which was already the case)
- extension constructors idents cannot be local: they can be used as
types when the constructor's argument is an inlined record. They must be
given a scope
- in check_recmod_inclusion: create a new scope at each iteration
- when checking that type declarations inside recursive modules are well
founded, we now take a generic instance of the declaration (this is
reminiscent of what is done in Ctype.moregeneral)
2018-09-21 11:47:44 -04:00
Thomas Refis b134588f28 ident: split Local into Local and Scoped
Also rename [create] into [create_scoped] and [create_var] into
[create_local].
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
Jacques Garrigue e388e2eb85 Fix MPR#7838 (#2001)
Fixes MPR#7838 by ensuring that save_desc is called in the Tvariant case of Ctype.copy even when partial <> None.
2018-08-24 08:12:35 +09:00
Thomas Refis b9312affa2 generalize_expansive: test that we treat missing types as abstract types 2018-08-07 09:10:46 +01:00
Thomas Refis 35006b9d88 ctype: remove unused function 2018-08-07 09:10:46 +01:00