Commit Graph

264 Commits (master)

Author SHA1 Message Date
Jacques Garrigue b47c34912c
Mark datatypes as injective in recursive module approximations (#10029) 2020-11-20 16:29:23 +09:00
Nicolás Ojeda Bär 246564e8db
Remove dead code (#9974) 2020-10-13 09:48:16 +02:00
Leo White 98d4f0b864 Widen warning 16 to more cases 2020-09-17 18:54:22 +01:00
Jacques Garrigue 46cec117a4
Fix #9721: Injectivity and recursive modules (#9727) 2020-07-07 09:04:23 +02:00
Thomas Refis 1294b28578 Typeclass.type_args rewrite in the same way 2020-04-18 11:01:52 +02:00
Thomas Refis aa5c1d37f6 typeclass: further simplification as suggested by reviewer 2020-04-18 11:01:52 +02:00
Thomas Refis b703371d7d extract_label: return an option instead of raising 2020-04-18 11:01:52 +02:00
Thomas Refis 6d43867011 apply the same treatment to Pcl_apply 2020-04-18 11:01:52 +02:00
muskangarg21 52dc5d793b [Refactor]: Typing/typeclass.ml 2020-03-24 04:33:45 +05:30
Nicolás Ojeda Bär 57d329e07b
Deprecate -annot (#2141)
* Move driver code from Cmt2annot to Read_cmt
* Move cmt2annot.ml into typing/
* make depend
* Use standard error handling
* Move specific logic to read_cmt
* Do not pass full cmt record as argument
* Better locations
* Emit .annot files produced from cmt data
* Remove direct calls to Stypes
* Deprecate -annot
* Changes
* make depend
* Adapt doc
* make -C tools depend
2020-03-13 12:59:34 +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
Gabriel Scherer 312253ce82 split patterns into "value patterns" and "computation patterns"
Value patterns match on a value (the result of computation), while
computation patterns handle the effects (hint hint) of
a computation. The only forms of computation patterns in OCaml today
are value patterns and exception patterns (exception p).

The sub-pattern `p` of the `lazy p` construction should be
a computation pattern, rather than a value pattern. This pull-request
does not make this change.

Most of the changes in this PR are boilerplate -- it really is a lot
of work now to add a new syntactic category to the typed-tree
syntax. This boilerplate is fairly automatic and should be easy to
review.

There is a subtle part to the patch, though: the implementation of the
pattern type-checking. It now has to reconstruct the value/computation
distinction (absent from the parse-tree), and return values from two
different types. Instead of splitting the type-checker in several
functions (which risked code duplications), I choose to use a GADT to
have the same [type_pat] function return two different types depending
on the caller. This is the least invasive way to adapt this part of
the codebase, whose inherent complexity is so large (unfortunately)
that adding a GADT to the mix barely makes a difference.
2019-10-31 13:29:16 +01:00
Florian Angeletti 816a5088e0 Avoid duplicated mark_loops 2019-10-17 10:03:58 +02:00
Jacques Garrigue 1e895dbaee
Allow compiling ocamldoc with -principal (#8955)
Also solves issue #6922
2019-09-30 21:14:06 +02:00
Gabriel Scherer 0f9ad95c46 [minor] clarify the implementation of Typedtree.pat_bound_idents_full
The previous implementation used global state and was making another
change more difficult than it had to be.

Note: I got rid of `rev_let_bound_idents` in the API because computing
it is no more efficient than `Fun.compose List.rev let_bound_idents`.

(Only the _full versions might have a more-efficient rev_ version,
and those are not exposed, which is the right choice:
                           a simpler API is worth a list reversal.)
2019-09-25 11:47:24 +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
Leo White acd06f1eff Remove Misc.may_map and similar 2019-05-23 16:27:58 +01:00
Ulugbek Abdullaev 3faa589666 typing/typeclass.ml: refactor some long tuples into a record
The following functions were migrated to a record:
extract_type_decls, merge_type_decls, final_env, check_coercions
2019-05-08 15:53:35 +02:00
Fourchaux 1946594bd7 Fixing typos in various files (#2246)
Note: Typos found with https://github.com/codespell-project/codespell

Here is the (semi-manual) command used to get (and correct) the typos:

$ codespell -i 3 -w --skip=".png,.gif,./ocaml/boot,./ocaml/.git,./ocaml/manual/styles,./ocaml/manual/manual/htmlman" -L minimise,instal,contructor,"o'caml",cristal,pres,clos,cmo,uint,iff,te,objext,nto,nd,mut,upto,larg,exten,leage,mthod,delte,tim,atleast,langage,hten,iwth,mke,contant,succint,methids,eles,valu,clas,modul,que,classe,missings,froms,defaut,correspondance,differents,configury,reachs,cas,approche,normale,dur,millon,amin,oje,transfert
2019-02-13 14:04:56 +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
Armaël Guéneau ef4f76b3b3
Merge pull request #2157 from gasche/split-typedecl-properties
Typedecl: split variance and immediacy logic into separate compilation units
2018-11-24 10:57:03 +01:00
Alain Frisch 7a746deed1
Keep more type information in Lambda (#2156)
* Propagate type information about function parameters and return

* Keep value kind on staticcatch parameters
2018-11-23 15:34:05 +01:00
Gabriel Scherer 24ea989c02 Typedecl: split variance to a separate unit Typedecl_variance
(pair-programming with Rodolphe Lepigre)
2018-11-23 12:05:33 +01:00
Gabriel Scherer 000795890e rename Typedecl.compute_variance_decls into compute_variance_class_decls 2018-11-18 14:53:52 +01:00
Daniel Bünzli a7afd89003 s/string_of_int/Int.to_string/g 2018-11-07 13:52:02 +01: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 94b55c1584 consistently make temporary local type idents local idents 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
Armaël Guéneau c0820e30cb Location: significantly rework the code printing errors and warnings 2018-08-08 17:42:08 +02:00
Thomas Refis 445b53182a ctype: remove instance_def which is redundant 2018-07-25 11:12:10 +01:00
Florian Angeletti 349db3d869
PR#6416 et al.: injective mapping between identifiers and printed names (#1120) 2018-06-26 22:03:45 +02:00
David Allsopp b5d1929e87 Whitespace and overlong line fixes. 2018-06-14 15:15:34 +01:00
Nicolás Ojeda Bär 0d6569fa1e Remove pv_name field 2018-06-07 16:11:47 +02:00
Armaël Guéneau 41d5658983 Re-implement the hint indicating missing "rec" keywords
This reverts commit 90fbe53ee5 except for the
Changes entry.
2018-05-06 10:08:09 +02:00
octachron b633173258 remove unreachable error: Make_seltype_nongen 2018-05-04 21:37:54 +02:00
octachron c47b234039 Fix non-collapsible conjunction error format 2018-05-01 12:05:34 +02:00
octachron b4a4ca2872 GPR#1753: existential restriction for "let ... in" 2018-04-25 17:57:14 +02:00
Damien Doligez 90fbe53ee5 Revert "Merge pull request #1472 from Armael/improved-error-letrec"
This reverts commit c224184471, reversing
changes made to 2fc77a2d58.

As an exception, commit 3b77d915b5 (Generalize Env.lookup_* functions to allow disabling marking) is NOT reverted, because it was used by subsequent commits.
2018-04-09 15:56:00 +02:00
Jacques Garrigue 3d33bd4ef5
Fix MPR#7751 (#1657)
Fix the toplevel printer, to have it properly load needed cmi's.
2018-03-27 09:25:28 +09:00
Thomas Refis dc5162a57e do not close objects which have been unified with an outer self type 2018-03-06 10:01:52 +00:00
Thomas Refis afcab61fbd only add a dummy method when typechecking a class/class type 2018-03-06 10:01:51 +00:00
Thomas Refis 86e1c8a4e0 make the dummy method disappear when finalizing a class 2018-03-06 10:01:49 +00:00
Thomas Refis f509125318 slight representation change 2018-02-27 14:52:24 +00:00
Thomas Refis 7f0e819bde we don't need an env to take instances anymore 2018-02-27 14:52:24 +00:00
Armaël Guéneau ea00ce020f Add specific error messages in case of type propagated from a keyword 2017-12-21 11:50:54 +01:00