Commit Graph

75 Commits (ee2f3b428c074539f14dacae1faeb07a9de4be77)

Author SHA1 Message Date
Leandro Ostera ee2f3b428c
Move typed_impl to Typedtree.t 2020-11-05 19:06:12 +01:00
Leandro Ostera f6e428acf2
Introduce typed_impl record 2020-11-05 18:29:45 +01:00
Leandro Ostera 3a125b8c3c
Expose module signature when typing implementation
While working on a new backend for OCaml to generate Erlang sources, I
found the need to read the .cmi file back into a `Types.signature`
value.

@Drup spotted that I was reading the file and pointed out this value was
already being read during the type checking process.

A quick check at the `Typedtree.module_coercion` showed us that it would
be difficul to extract the same information that is readily available in
the signature value.

This change will expose the signature value directly, so other backends
relying on this signature information do not need to do the extra work
of reading it again.
2020-11-05 17:33:19 +01:00
Nicolás Ojeda Bär 246564e8db
Remove dead code (#9974) 2020-10-13 09:48:16 +02:00
Leo White 042b1ca737 Fix handling of presence when comparing package types 2020-06-26 14:27:00 +01:00
Mark Shinwell 36c163248d Remove support for compiler plugins (#2276)
After consultation on the core developers' list I am proposing this patch to remove support for compiler plugins.

The main motivations for removing compiler plugins are:
- They are a potential security risk.
 - They increase the complexity of the build system and make maintenance of the Dynlink libraries more difficult (although actually, this complexity could probably be reduced after #2268 is merged).
 - Many applications of plugins should be able to be expressed by building custom compiler drivers that link against compilerlibs.

* Remove compiler plugins and hooks
* Add new function Dynlink.unsafe_get_global_symbol but keep it outside the documented API.
* Remove otherlibs/dynlink/nodynlink.ml
* Update Changes
2019-03-13 11:46:37 +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
Thomas Refis 6805595f57 introduce local substitutions in signatures
type [params] id := type_expr { and [params] id := type_expr }
    module Uid := extended-module-path
2018-11-09 16:43:43 +00:00
Florian Angeletti 558530a8b4 manual: compiler-libs.mld -> compiler_libs.mld 2018-09-12 16:32:37 +02:00
Florian Angeletti ef135a71ae
MPR7546, manual: preambles and warnings for compiler-libs modules (#2020)
* preambles for compiler-libs modules

* Compilerlibs intro and warning link
2018-09-12 09:51:47 +02:00
Thomas Refis 2403ffb1b5 typemod: allow items coming from includes to be shadowed 2018-07-25 13:06:38 +01:00
Jacques Garrigue 7aa377a630
New attempt at fixing MPR#7726 (#1676)
* Fix MPR#7726 by re-checking recursive modules in signatures after substitution
* Check module applications when translating types in Typetexp
* Check all results of functor applications lazily
* Reduce the overhead of checking module types by building the environment lazily
2018-07-13 05:29:59 +09:00
Jeremie Dimino 225d1c65b9 Prefix the compilation unit names of all modules in the stdlib
Except for the Camlinternal* modules and the new Stdlib module, all
modules in the stdlib now compile to Stdlib__<module>.

Pervasives is renamed to Stdlib and now contains a list of aliases
from the long names to the short ones, so that from inside and outside
the stdlib we can refer to the standard modules as just List or
Stdlib.List rather than Stdlib__list.

In order to avoid printing the long names in error messages and in the
toplevel, the following heuristic is added to Printtyp: given a path
Foo__bar, if Foo.Bar exists and is a direct or indirect alias to
Foo__bar, then prefer Foo.Bar.

A bootstrap step was required to replace Pervasives by Stdlib as the
module opened by default.
2018-02-12 08:29:16 +00:00
Jérémie Dimino 49f6dd5d20
Allow compilation units to shadow sub-modules of Pervasives (#1513) 2018-02-02 10:44:23 +00:00
Valentin Gatien-Baron 66cb5de78f Substitute as path instead of expression if possible.
For backwards compatibility (since we now reject contrained types),
and to support extensible sum types.
2017-08-01 07:42:05 -04:00
Valentin Gatien-Baron f29cd5ab6d Support syntax: S with M.N.t := ... 2017-08-01 07:32:08 -04:00
Valentin Gatien-Baron 44b6bbf5d1 Support syntax: S with type t := valid-type-expression 2017-07-29 17:18:32 -04:00
Alain Frisch fd47ba9649 Support 'let open' in class and class type expressions (#1249)
* Support 'let open' in class and class type expressions.

* Adapt ocamlprof.

* Adapt ocamldoc.

* Add tests.

* Changelog.

* Manual.
2017-07-20 08:17:30 +02:00
octachron 1a4dc2fa26 GPR#1187: cite typemod and pparse plugin hooks 2017-06-01 22:43:30 +02:00
Alain Frisch 227bdc6217 Avoid rebuilding cmi_info record when creating .cmti files (#781)
Instead of rebuilding cmi_info in Cmt_format.save_cmt, the record
created in Env.save_signature is kept and passed to that function.  In
addition to simplifying the code, this avoids possible mismatch between
the two records, including:

  - Duplicated entry in cmi_crcs for the current unit as noted in #744.

  - Missing flags (Unsafe_string/Deprecated were not properly set in
    Cmt_format).

The interface is also stronger, since the signature passed to save_cmt
was supposed to be already mapped by Subst.for_saving but this was not
reflected in the API.
2016-08-30 13:11:01 +02:00
Fabrice Le Fessant bfc36003aa Add hooks on some compilation phases 2016-07-12 17:59:58 +02: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
Leo White 15cc266e2f Better -no-alias-deps errors 2015-10-22 17:11:08 +01:00
Damien Doligez 860c670848 merge branch 4.02 from 4.02.1 (rev 15540) to a few fixes after 4.02.2 (rev 16205)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16214 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-07-17 14:31:05 +00:00
Jacques Garrigue fbcfd218f1 Fix PR#6899
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16184 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-06-23 08:40:10 +00:00
Jacques Garrigue 721266bf30 Fix PR#6842: export Typemod.modtype_of_package
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16033 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-04-23 07:07:43 +00:00
Jacques Garrigue 77cf8b999e * split Typetexp.lookup_module and Typetexp.find_module
* fix semantics of -open by using Typemod.type_open_


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14795 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-12 12:02:26 +00:00
Alain Frisch f0ef09de26 Expose a Typemod.type_interface (currently an alias of Typemod.transl_signature) by symmetry with type_implementation.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14759 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-07 12:46:00 +00:00
Alain Frisch 9961e6a1c2 #6399: protocol (based on a built-in ocaml.error extension node) to let ppx tools send located errors to be reported by the compiler (patch by Peter Zotov).
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14756 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-07 08:26:17 +00:00
Damien Doligez 5b8df637d2 merge branch "safe-string"
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14705 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-29 11:56:17 +00:00
Jacques Garrigue cfa350c31a merge generative functors
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14365 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-12-17 03:52:50 +00:00
Alain Frisch b0d5fc28a2 Synchronize with trunk.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13922 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-07-22 17:03:39 +00:00
Alain Frisch d3be8230a7 #6073: Add signature to Tstr_include. (Cherry-picked from commit 13903 on 4.01.)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13904 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-07-17 15:25:47 +00:00
Alain Frisch d32b19008a Parse recursive module as standard modules, and check in the type-checker that an explicit type is provided. (Unfinished.)
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13353 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-05 16:50:05 +00:00
Alain Frisch 152255e512 First version with attributes and extensions on expressions, type expressions and structure items.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13330 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-02-28 16:51:59 +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
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
Alain Frisch 76c4f6d0b8 #5629: A toplevel 'open' in the REPL does not trigger an unused open warning.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12541 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-06-01 14:05:49 +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 477b2dd743 propagate path-expansion environment everywhere
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/short-paths@12068 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-01-23 07:59:45 +00:00
Alain Frisch ece3353035 #5358: package types allow constraints on typed in sub-modules. Camlp4 compiles but does not support this new feature yet.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@11311 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2011-12-14 10:26:15 +00:00
Jacques Garrigue 7c94bbd294 fix bug in first-class module unpacking
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@11173 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2011-08-20 02:51:34 +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
Jacques Garrigue ce605c042a merge branches/implicit-unpack + update camlp4
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@10738 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2010-10-21 23:59:33 +00:00
Alain Frisch ccb1381991 Error narrowing for module type lookups.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@10419 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2010-05-18 17:18:24 +00:00
Alain Frisch 5d64f0e504 Error narrowing for module lookups.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@10418 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2010-05-18 17:14:31 +00:00
Jacques Garrigue 49a83dd965 merge branches/sigsubst 9626:10205
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@10263 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2010-04-17 14:45:12 +00:00
Alain Frisch 1e5b4a4857 Merge first class modules: svn merge -r 9369:9396 $caml/branches/fstclassmod.
Adapt the Changes file. Bump magic numbers. Bootstrap.



git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@9397 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2009-10-26 10:53:16 +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