Commit Graph

30 Commits (master)

Author SHA1 Message Date
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
Daniel Bünzli a7afd89003 s/string_of_int/Int.to_string/g 2018-11-07 13:52:02 +01: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
Xavier Leroy 071866c447 Create .cmi files atomically (MPR#7472) (#1307)
* MPR#7472: create .cmi files atomically

This is done by writing the data to a temporary file, compute the checksum, finish writing the data, and only then rename the temporary file to the destination .cmi file.

Writing .cmi files this way should avoid the corruption of .cmi files reported in MPR#4991.  This corruption can occur when a .cmi file is produced simultaneously by a run of ocamlc and a run of ocamlopt.

"Atomic" here means "as atomic as the underlying file system guarantees".  The atomicity guarantees of Windows file systems aren't entirely clear.

* Create .annot and .cmt files atomically, like .cmi files

Follow-up to MPR#7472.  The pattern "write to temporary file then rename"
is abstracted in the new function Misc.output_to_file_via_temporary
and applied to .cmi, .cmt and .annot files.
2017-09-06 20:01:15 +02:00
alainfrisch 502e4f9336 More warnings when compiling the compiler. 2016-03-15 22:46:35 +01:00
Damien Doligez 5401ce8473 Update headers for the new license.
Remains to be done: remove all headers in testsuite/tests.
2016-02-18 16:59:16 +01:00
Damien Doligez 94dfb61c09 fix a bug where the .annot files were truncated because of a missing "close"
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15565 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-10-29 21:18:14 +00:00
Damien Doligez 7844495624 Merge branch 4.01 from branching point to 4.01.0+rc1
Command line used:
  svn merge --accept postpone -r 13776:14055 $REPO/version/4.01 .


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14060 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-09-04 15:12:37 +00:00
Alain Frisch 207f9fb7f7 #6030: Avoid repeated flushes.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13742 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-06-04 13:46:48 +00:00
Jacques Garrigue 26e1ff7138 Merge short-paths into a fresh branch of trunk.
Also fix a bit unification and subtyping errors.
You now need the flag -short-path to activate short paths.



git-svn-id: http://caml.inria.fr/svn/ocaml/branches/short-paths-4.01@13285 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-01-29 14:21:12 +00:00
Jacques Garrigue 1430e90e89 shorten paths in annot + lookup abbreviations in persistent structures
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/short-paths@13132 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-12-17 03:18:31 +00:00
Jacques Garrigue 6a55d4f552 improve performance
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/short-paths@13124 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-12-10 10:39:26 +00:00
Alain Frisch d4ea76d782 Even faster version.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13071 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-11-07 10:14:02 +00:00
Alain Frisch 52e9f4fe9f Avoid format strings to generate .annot files; just switching to basic Format function gives a 25% speedup over total compilation time for 'ocamlc.opt -annot' applied to typing/typecore.ml.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13070 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-11-06 18:25:47 +00:00
Damien Doligez def31744f9 remove all $Id keywords
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13013 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-10-15 17:50:56 +00:00
Jacques Garrigue 35185d610b merge version/4.00 at revision 12866
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/short-paths@12869 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-08-21 07:10:35 +00:00
Fabrice Le Fessant d39d43e55f merge with branch bin-annot
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12516 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-05-30 14:52:37 +00:00
Jacques Garrigue 34578cf242 shorten paths in .annot
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/short-paths@12234 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-03-14 01:19:46 +00:00
Damien Doligez 3b507dd1aa renaming of Objective Caml to OCaml and cleanup of copyright headers
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@11156 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2011-07-27 14:17:02 +00:00
Damien Doligez 7ca1d89250 amelioration des annotations
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@8958 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2008-07-29 15:42:44 +00:00
Damien Doligez 1dd68ccf50 ajout des annotations pour variables et appels terminaux
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@8232 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2007-05-16 08:21:41 +00:00
Damien Doligez 1279ab4b76 fusion des changements 3.09.1 -> 3.09.2
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7382 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2006-04-16 23:28:22 +00:00
Damien Doligez 830d95537f dump des types dans l'ordre postfixe
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5739 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2003-07-25 18:00:40 +00:00
Damien Doligez 029b863032 RAZ des variables de types pour .annot
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5726 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2003-07-23 16:52:41 +00:00
Jacques Garrigue db806efb49 fix PR#1764
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5722 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2003-07-23 03:12:53 +00:00
Damien Doligez 7907414f8f changement .types -> .annot + format
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5594 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2003-06-12 12:52:17 +00:00
Damien Doligez a51ea25db1 -stypes -> -dtypes; meilleur mode emacs
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5494 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2003-04-03 13:59:38 +00:00
Damien Doligez 09ba0ddf30 ajout choses a faire
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5486 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2003-04-02 12:47:18 +00:00
Jacques Garrigue 36348563c4 utilise Stypes dans ocamlbrowser
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5483 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2003-04-02 06:57:15 +00:00
Damien Doligez 43b02185d7 ajout option -stypes; depend
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5478 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2003-04-02 01:32:09 +00:00