Commit Graph

180 Commits (e0cdc52ba0e7ec903878e428145417d391924773)

Author SHA1 Message Date
Jacques Garrigue 97899f37ca Support module aliases.
Namely, you can write "module L = List" in signatures,
and avoid have the compiler use directly List when you write L.
See examples in testsuite/tests/typing-modules/aliases.ml


git-svn-id: http://caml.inria.fr/svn/ocaml/branches/module-alias@14196 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-09-29 07:22:34 +00:00
Alain Frisch b414d57b0e Simplify type_structure.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14170 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-09-20 16:19:54 +00:00
Alain Frisch c8d20ade02 Do not track unused type declarations created by 'include'.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14158 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-09-17 14:28:31 +00:00
Alain Frisch af5e566d62 Switch Typetexp.Error, Typedecl.Error, Typemod.Error, Typeclass.Error.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/exception_registration@14114 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-09-12 14:06:48 +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 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 525ef9d703 Synchronize with trunk.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13897 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-07-16 13:34:30 +00:00
Jacques Garrigue 4fb61c91e6 Fix PR#5815
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13789 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-06-17 02:03:36 +00:00
Alain Frisch 2e199ef1f2 Item attributes on each let-binding.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13736 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-06-03 15:14:19 +00:00
Alain Frisch a3b1c67fff #5980: explicit way to silence the new warning (open! X).
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13685 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-05-16 13:34:53 +00:00
Jacques Garrigue e2dbb7f516 Fix PR#6005
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13647 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-05-03 14:40:11 +00:00
Jacques Garrigue 67e18e5c4d Fix PR#5985 for constrained parameters too.
Required more variance information, so variance is now an abstract type.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13645 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-05-03 13:38:30 +00:00
Jacques Garrigue c425ae1ce8 Fix PR#5985; compute injectivity of types but no new syntax
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13634 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-30 05:26:57 +00:00
Alain Frisch 96fc2316ed Fix #5965.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13619 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-29 15:39:00 +00:00
Alain Frisch eb4130e47c The arument of attributes and extension nodes is now a structure, which is syntactically more general than an expression (through the embedding E -> [Pexp_eval E]).
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13579 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-19 07:40:57 +00:00
Alain Frisch 67912da346 Allow abstract module declaration in structures to make the syntax and Parsetree more uniform.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13556 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-18 13:14:53 +00:00
Alain Frisch 3fe10139ab Better representation of with-constraints.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13540 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-16 10:47:45 +00:00
Alain Frisch 04de43bee5 Attributes on Pstr_eval.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13512 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-11 14:07:32 +00:00
Alain Frisch 92ad47d47b Keep item attributes on let-binding structure items.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13511 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-11 13:52:06 +00:00
Alain Frisch 47a3ee095e Get rid of the Default case in Asttype.rec_flag.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13481 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-04 12:38:20 +00:00
Alain Frisch 27d523ea72 Better representation of variance in the Parsetree.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13474 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-02 15:33:35 +00:00
Alain Frisch c2c5b10685 Align module type binding with Parsetree.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13448 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-26 08:21:29 +00:00
Alain Frisch 2ffa26af82 Align module binding with Parsetree.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13447 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-26 08:09:26 +00:00
Alain Frisch 77d3fce857 Align exception_declaration with Parsetree.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13446 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-25 18:42:45 +00:00
Alain Frisch f4ca2da467 Align type_declaration with parsetree.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13445 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-25 18:20:11 +00:00
Alain Frisch 25815e6e77 Align typed value_declaration with parsetree.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13444 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-25 18:04:40 +00:00
Alain Frisch fbde1f7e52 Align module and module type declarations between Parsetree and Typedtree.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13443 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-25 17:47:28 +00:00
Alain Frisch 0b9347f482 Represent exception declarations as constructor declarations in the Parsetree.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13442 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-25 15:49:10 +00:00
Alain Frisch 5c98dd91fe Starting to keep attributes in the typedtree.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13440 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-25 14:16:07 +00:00
Gabriel Scherer 75b8c0184f PR#5933 type-specialize 'let compare = compare' on ints and strings
According to the reporter 'sliquister', type-specialized comparison
can nearly halve compilation time in some cases. This patch applies
type-specialization throughout the OCaml distribution sources, so not
all changes will have performance utility, but in this case I think
it's best to be consistent, as I see no downside to the change.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13410 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-19 07:22:12 +00:00
Alain Frisch b0987fd693 Attributes on expresions (etc) are now stored in the expression record, to facilitate pattern matching on structured fragments of AST while ignoring attributes. Introducing a new Ast_helper module to help creating AST fragments.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13381 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-08 14:59:45 +00:00
Alain Frisch d50038cae7 Attribute has structure/signature item.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13359 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-06 12:27:32 +00:00
Alain Frisch 2cf65c8c85 Record for module type declarations.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13358 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-06 12:14:02 +00:00
Alain Frisch 24a0c6eb0e Name is part of the value_description record.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13357 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-06 12:00:18 +00:00
Alain Frisch 241abe55e6 Type name is part of the type declaration record.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13356 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-06 11:47:59 +00:00
Alain Frisch 59bdf321d3 Switch Pstr_modtype argument to a record type.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13355 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-06 10:49:44 +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 cc70961d4f Support item attributes on exn rebind.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13351 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-05 12:44:40 +00:00
Alain Frisch b01b7305bd Put name in the exception_declaration record.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13350 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-05 12:37:17 +00:00
Alain Frisch db579b0a1e Extension as structure/signature items [%%lid expr].
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13346 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-05 11:46:25 +00:00
Alain Frisch 8461db39f1 Attributes on module/module type/recursive module declarations in interfaces.
Module:

[^^id expr] [^^id expr] ...
module X : S
[@@id expr] [@@id expr] ...

Module types:

[^^id expr] [^^id expr] ...
module type X = S
[@@id expr] [@@id expr] ...

Recursive modules:

module rec [^^id expr] [^^id expr] X1 : S1 [@@id expr] [@@id expr] ...
       and [^^id expr] [^^id expr] X1 : S1 [@@id expr] [@@id expr] ...




git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13344 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-04 17:39:07 +00:00
Alain Frisch a5059464fe Attributes on open/include in signatures.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13343 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-04 16:36:32 +00:00
Alain Frisch be76a15a6b Attributes/extensions as module types.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13336 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-04 14:11:15 +00:00
Alain Frisch e58b2cd036 Continue.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13333 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-04 12:54:57 +00:00
Alain Frisch c8d3ff52a2 Cleanup + support attributes on type declarations (syntax: type t = ... with (:a1 expr1) (:a2 expr2) ... (:an exprn)).
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13332 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-01 12:44:04 +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
Gabriel Scherer 35160d3712 fix two minor stale locations (Location.none) in typemod.ml
The two bewildering "_none_" error messages fixed by this commit
could be observed in the following way:
  echo "let f (x, y) = x + 1" > test.ml
  touch test.mli
  ocamlc -c -annot test.ml
    File "_none_", line 1:
    Error: Could not find the .cmi file for interface test.mli.
  grep "def f" test.annot
    def f "test.ml" 1 0 20 "_none_" 1 0 -1

Behavior after the fixes:
  echo "let f (x, y) = x + 1" > test.ml
  touch test.mli
  ocamlc -c -annot test.ml
    File "test.ml", line 1:
    Error: Could not find the .cmi file for interface test.mli.
  grep "def f" test.annot
    def f "test.ml" 1 0 20 "test.ml" 1 0 -1

One could argue that for the "could not find the .cmi" error, the file
chosen could be test.mli. I find it more natural to have the name of
the file that the user asked to compile (and therefore provoked the
error). Any of those choices is better than "_none_" anyway.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13091 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-11-11 10:59:43 +00:00
Alain Frisch a3f4a6ead5 #5809: do not store a structure item together with sub-components in partial cmt files.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13081 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-11-08 13:47:41 +00:00