Commit Graph

1708 Commits (166ba7147983c961f5cb220fe3222b59d68c75e2)

Author SHA1 Message Date
Thomas Refis 4b28c6ca99 PR#6422: Allow exceptions under or-patterns in match statements. 2015-12-09 11:19:59 +00:00
Jacques Garrigue 8db1b59233 PR#6542: choeger's patch for type_cases (only generalize when useful) 2015-12-08 19:47:08 +09:00
Jacques Garrigue 78a7a55609 PR#6542: solve new performance problems du to path compression and copy
of types for the delayed icheck for unused cases
2015-12-08 19:45:42 +09:00
Hugo Heuzard 9eca3e4519 Parse arbitrary precision integers ..
.. and allow any letter in [g-zG-Z] as modifier (previously 'l','L','n')
Also allow modifier for floats
This give more freedom to ppx rewritters (what about a ppx for zarith)

Checks are performed when translating from Parsetree to Typedtree.
Invalid_literal is raised if the modifier is not recognized ([lLn]?)
Integer_overflow is raised as before.

Lexer: use g-zG-Z for integer literal modifier

Lexer: Allow modifier on float

Clean wrt previous commits

Lexer: use named substring

Cleanup

typo

doc

fix after rebase

rebase on  trunk

Update typecore.ml

Fix printast.ml
2015-12-03 17:20:48 +01:00
alainfrisch ac62abe4d2 #6342: fix error message when constraints differ in type declarations. 2015-12-03 00:06:18 +01:00
alainfrisch 6b9d72d532 A new builtin attribute ocaml.deprecated_mutable; can be applied to a record label so as to trigger a Deprecated warning if the field is mutated. 2015-12-02 18:20:24 +01:00
alainfrisch c9a44eef22 Move detection of more builtin attributes to new module. 2015-12-02 15:52:04 +01:00
alainfrisch 7ad212045f Add module to deal with 'front-end' built-in attributes. 2015-12-02 14:46:14 +01:00
alainfrisch 90544ab95e Merge with trunk. 2015-12-02 12:00:44 +01:00
alainfrisch 3f2ffb7197 Fix for the debugger. 2015-12-02 11:43:10 +01:00
alainfrisch 10fbfe7643 Pass location to Env.lookup_ functions explicitly. 2015-12-02 10:21:24 +01:00
alainfrisch 2740b1bf7c Show full path on deprecated warning. 2015-12-02 09:40:02 +01:00
alainfrisch 3842acd676 Avoid warning duplication: checking module deprecation is done in Env. 2015-12-01 18:01:59 +01:00
alainfrisch 56a094e8e6 Recognize ocaml.deprecated floating attribute on top of .ml files to support marking the unit as deprecated even if it has no .mli file. 2015-12-01 17:55:26 +01:00
alainfrisch ccff19a537 Also trigger warning when accessing a qualified sub-module marked as deprecated. 2015-12-01 17:39:10 +01:00
alainfrisch e9e3da700d Trigger deprecated attribute when referring to a deprecated module itself (not one of its components): now for external unit as long as we don't compile with -no-alias-deps. 2015-12-01 17:27:30 +01:00
alainfrisch c424dd963a Trigger deprecated attribute when referring to a deprecated module itself (not one of its components). Does not work for external unit yet. 2015-12-01 17:15:36 +01:00
alainfrisch 114e733864 Store deprecated flag in 'module components' and raise the deprecated warning when accessing a component from a deprecated module if is has been marked, even for non-toplevel modules. 2015-12-01 17:11:27 +01:00
alainfrisch 6018c023aa Turn Env.components into a record, which will be later extended. 2015-12-01 16:42:37 +01:00
alainfrisch 11ea50d8e2 PR#6762: improve warning 45 (shadowing caused by open) for labels/constructors in presence of re-exported type definitions. 2015-12-01 09:30:41 +01:00
Jacques Garrigue f7d20f161a Fix for commit 9229b1 2015-12-01 01:53:24 +09:00
Jacques Garrigue a1bb57048c Fix PR#6946 2015-11-30 16:45:44 +09:00
Jacques Garrigue 20b59a3318 Fix PR#6981 2015-11-30 15:17:41 +09:00
Jacques Garrigue 9229b15aaa Fix PR#6980 and remove unused Ctype.iterative_generalization 2015-11-30 13:49:30 +09:00
alainfrisch c95f85a3f4 Interpret deprecation warning when looking up external units. 2015-11-27 19:31:58 +01:00
Jeremie Dimino ebd830b85b Add support for [%ocaml.extension_constructor <path>]
Translate [%ocaml.extension_constructor <path>] to the
runtime-representation of the extension constructor denoted by
<path>. This allows one to get the extension constructor without
having to create a dummy value.
2015-11-27 18:17:14 +00:00
alainfrisch 945d0c7d7a Keep deprecation flag on compilation unit, extracted from a floating attribute in the .mli file. 2015-11-27 19:13:56 +01:00
Jeremie Dimino 09b8c4e031 Add the predefined type extension_constructor
So that we can create constants of type [extension_constructor]
2015-11-27 17:52:33 +00:00
Jacques Garrigue 61c2dd2220 Do not warn for unused [pat -> .] clauses 2015-11-26 15:01:58 +09:00
Jacques Garrigue 88ada8c74c be more careful about undoing compression 2015-11-26 14:16:07 +09:00
Jacques Garrigue 7e880f4e0a Merge branch 'trunk' of github.com:ocaml/ocaml into compress-Tlink 2015-11-26 14:04:35 +09:00
Thomas Refis 0b1a6f93a8 make Types.type_expr.id immutable
Cf. https://github.com/ocaml/ocaml/pull/310#discussion_r45822414
2015-11-25 17:32:56 +00:00
Frederic Bour 9107f14afc Comment [Types] 2015-11-25 17:32:55 +00:00
Drup 718d1c998b Add comments to the typedtree 2015-11-25 17:32:55 +00:00
alainfrisch e2abefbe9e Do not rely on polymorphic comparison. 2015-11-25 18:06:35 +01:00
Nicolas Ojeda Bar a524920aa2 Remove Typedtree.optional
From comments in typedtree.mli:

When introduced in 2000, this [type] enabled a more efficient code
generation for optional arguments. However, today the information is
redundant as labels are passed to [transl_apply] too. Could be cleaned
up.
2015-11-25 00:37:46 +01:00
alainfrisch fe68945a20 Only the return idents are useful in pat_bound_idents, simplify accordingly. 2015-11-24 15:43:26 +01:00
Jacques Garrigue f4f85881fc Fix problem reported by trefis in PR#6437 2015-11-21 14:33:18 +09:00
Xavier Leroy 0c5e862a3e GPR#268: Hexadecimal notation for floating-point numbers
Merge of branch 'hex-float'.

- Add support in byterun/floats.c for conversions between floats and strings in hex notation. We cannot rely on the C standard library here because Microsoft consistently fails at supporting hex notation as standardized in C99. Instead, the conversions are implemented from scratch.
- Add support in the lexer so that hex float literals are recognized in OCaml sources.
- Add support in formats. The ISO C99 format letters for hex floats are %a and %A, but %a is already taken. I chose %h and %H, which are rejected today as bad formats (hence no backward incompatibility) and don't mean anything in C either (h is a modifier, not a format letter).
- Add support in printf. All the trimmings are there in the implementation of %h and %H, including sign modifier and fixed precision.
- Benoit Vaugon contributed support in scanf.

Resolved conflicts:
	boot/ocamlc
	boot/ocamldep
	boot/ocamllex
	parsing/lexer.mll
2015-11-19 10:37:20 +01:00
Gabriel Scherer c1e2080803 Merge pull request #282 from trefis/short-paths-fix
short-paths: fix and twix
2015-11-19 08:21:21 +01:00
alainfrisch 1caf9364e3 Fix bug in Tast_mapper: bad recursion in module_binding (found by Corentin De Souza). 2015-11-17 13:09:06 +01:00
Jacques Garrigue 5d8397a937 Do path compression, and undo it in case of unification error 2015-11-16 22:51:01 +09:00
Thomas Refis 3762abea10 short-paths: slight change to the penalty heuristic
Give the same penalty to ident containing double underscores as to ident
starting with an underscore.
2015-11-16 11:06:08 +01:00
Thomas Refis d7acc7989a short-paths: take penalty into consideration when walking the environment 2015-11-16 11:06:08 +01:00
Thomas Refis 7b5fcfdc0f scrape_alias_safe: relax safety restriction + rename
In PR#6812 garrigue said:
    "Note that we do not want to disable visiting of all aliases, but just of
     aliases of persistent modules, which is a bit more complex."

Which is not actually quite true, we want to disable visiting aliases of
persistent modules which we haven't already visited.
2015-11-16 11:06:04 +01:00
Jacques Garrigue ce552ccf20 Fix performance problem with PR#7016 and strengthen code 2015-11-16 16:38:08 +09:00
François Bobot c0f19965f4 Make specialized compare unboxed
- float
    - int32
    - int64
    - nativeint

  Not for int because the comparison is done directly on the untagged version.
  Useful mainly for floats since they can be stored unboxed in records or arrays.
2015-11-05 13:07:03 +01:00
Leo White 44306923a8 Merge pull request #261 from lpw25/fix-pr6998
Fix PR6998
2015-11-05 11:35:55 +00:00
Jacques Garrigue f32db119ce Fix PR#7036: Module alias and package type equality 2015-11-05 14:20:50 +09:00
Leo White 278efc9196 Use ignore because its less fragile than _ 2015-11-04 11:01:34 +00:00
Leo White 6ee0712423 Put back option in persistent struct hashtable 2015-11-04 11:01:33 +00:00
Leo White 74215da003 Fix PR6998 2015-11-04 11:01:33 +00:00
Leo White 9feda5c10a Merge pull request #264 from lpw25/better-alias-errors
Better -no-alias-deps errors
2015-10-26 11:23:56 +00:00
Leo White 99ad68d256 Improve error for ill-typed functor application 2015-10-26 10:32:41 +00:00
Gabriel Scherer 54e039901e GPR#42: Add simpler functor type syntax
(Leo White)

Add support for simple functor types of the form:

    S -> T

equivalent to:

    functor (_ : S) -> T

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16546 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-25 16:24:47 +00:00
Jacques Garrigue b96107d228 fix error in parmatch.ml, observed in testsuite/tests/tools-ocamldoc
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16543 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-25 12:40:31 +00:00
Mark Shinwell 8f7f3162a7 Fix text of message
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16535 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-23 14:36:56 +00:00
Jacques Garrigue a335b18a45 merge branches/gadt-warnings
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16532 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-23 08:33:44 +00:00
Leo White 15cc266e2f Better -no-alias-deps errors 2015-10-22 17:11:08 +01:00
Gabriel Scherer 41a8aa5771 PR#7012: hint when using [ 'A | 'B ] instead of [ B ]
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16519 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-17 13:46:02 +00:00
Gabriel Scherer c23132d6fc Revert "PR#7012: hint when using [ 'A | 'B ] instead of [ B ]"
(Sent the wrong patch version)

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16518 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-17 13:46:00 +00:00
Gabriel Scherer 88fe01cc5b PR#7012: hint when using [ 'A | 'B ] instead of [ B ]
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16517 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-17 13:42:00 +00:00
Jacques Garrigue 211888ed03 Fix PR#6907: always mark all loops...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16513 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-16 15:00:46 +00:00
Alain Frisch 3856cd00c5 Remove dead code.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16512 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-16 14:55:15 +00:00
Alain Frisch 935b2300b9 Remove dead code.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16511 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-16 14:48:16 +00:00
Jacques Garrigue 8ff158b81c Fix PR#6954: subtleties of expansion...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16509 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-16 14:03:04 +00:00
Jacques Garrigue bea2f16ec8 Fix PR#7016: occur check must handle existing recursive types
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16508 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-16 10:25:08 +00:00
Jacques Garrigue e34f40ad87 switch to 'pat -> .' and add P/Texp_unreachable
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/gadt-warnings@16507 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-16 00:13:40 +00:00
Jacques Garrigue 4188f0543d mark empty matches as Partial
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/gadt-warnings@16506 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-15 15:59:28 +00:00
Jacques Garrigue 6c7ced53a0 check unused cases if some of them are refuted, even when warnings are disabled
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/gadt-warnings@16505 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-15 15:53:56 +00:00
Jacques Garrigue b784b65925 add distinct warning for unreachable cases
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/gadt-warnings@16504 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-15 15:39:59 +00:00
Alain Frisch a21eaeaa40 GPR#254: @ocaml.arg_on_literal_pattern attribute on constructors
to warn when the argument is matches against a constant pattern.
This attributes is applied on predefined exception constructors
which take an purely informational (with no stability guarantee)
message.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16502 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-15 12:30:10 +00:00
Jacques Garrigue a09fb037ac add refuted cases, syntax is 'pat -> _'
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/gadt-warnings@16500 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-15 01:55:52 +00:00
Jacques Garrigue e6075fd1e3 recursive expansion for single cases
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/gadt-warnings@16496 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-13 12:38:07 +00:00
Jacques Garrigue bcddc5aa37 make exploding depth explicit
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/gadt-warnings@16495 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-13 09:53:27 +00:00
Jacques Garrigue 0a4f57d5b7 Fix PR#7012
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16489 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-10 07:22:35 +00:00
Gabriel Scherer 489dbbd440 Correction of spelling errors in comments
(user 'octachron')

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16483 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-09 20:41:53 +00:00
Gabriel Scherer 5383003075 Delete french metacomments on missing comments
(user 'octachron')

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16476 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-09 20:41:41 +00:00
Gabriel Scherer 3724c2e00e Delete historical french todo from 1997
(user 'octachron')

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16475 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-09 20:41:39 +00:00
Gabriel Scherer 5882fdea22 General translation of french comments
(user 'octachron')

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16474 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-09 20:41:38 +00:00
Jérémie Dimino 4098845132 Don't allow "noalloc" together with [@@noalloc]
To avoid confusion about how the "noalloc" is to be interpreted if
both are present.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16461 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-06 10:58:28 +00:00
Jérémie Dimino bd21592814 Deprecated warning for "float" and "noalloc"
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16460 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-06 10:58:27 +00:00
Jérémie Dimino 95802fe702 Accept unboxed, untagged and noalloc prefixed by "ocaml."
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16459 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-06 10:58:27 +00:00
Jérémie Dimino e982d6906e Update printing of externals
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16457 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-06 10:58:25 +00:00
Jérémie Dimino 695a592d48 Support [@@noalloc] on external declarations
This is to replace the "noalloc" annotation.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16454 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-06 10:58:20 +00:00
Jérémie Dimino 2c636c5a4f Support [@@unboxed] and [@@untagged] on external declarations
Same as adding [@unboxed]/[@@untagged] to all arguments and the
result. This is to replace the "float" annotation.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16453 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-06 10:58:19 +00:00
Jérémie Dimino d24221cb5f Use Attr_helper in typing/typedecl.ml
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16452 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-06 10:58:18 +00:00
Pierre Weis 10d5bf3724 The proper way to escape @ in a format string is %@ not deprecated @@...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16442 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-09-24 18:30:01 +00:00
Jérémie Dimino acd6067a52 Escape '@' in format strings passed to Format.fprintf
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16441 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-09-22 15:07:19 +00:00
Jacques Garrigue cf303fcc8b Fix PR#6992
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16427 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-09-18 13:46:56 +00:00
Jacques Garrigue f5bf4bdce1 Fix PR#6993: allow recursive types when doing unification on GADT indices
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16426 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-09-18 09:55:18 +00:00
Damien Doligez b860d63145 whitespace cleanup, cut long lines, add some missing headers
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16415 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-09-11 11:58:31 +00:00
Jacques Garrigue ceb8ceca82 Fix PR#6985
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16413 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-09-10 02:34:04 +00:00
Jacques Garrigue a0f6145be5 Fix PR#6944
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16412 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-09-09 09:17:02 +00:00
Jacques Garrigue 8873757fb1 partial fix of PR#5780
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16411 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-09-09 08:51:02 +00:00
Jacques Garrigue 65435149d2 Fix PR#6982
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16410 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-09-09 06:37:16 +00:00
Jacques Garrigue 3b0837181f make all
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/gadt-warnings@16404 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-09-02 18:49:52 +00:00
Jacques Garrigue 9fb224a836 slightly more efficient redundancy check
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/gadt-warnings@16403 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-09-02 16:00:19 +00:00
Jacques Garrigue e2c5a47a95 redundancy check now works / complement of exhaustiveness
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/gadt-warnings@16402 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-09-02 10:03:02 +00:00
Jacques Garrigue 254ab1d1b6 check for unused cases due to GADTs
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/gadt-warnings@16400 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-09-02 08:53:47 +00:00