Commit Graph

740 Commits (8e928caea7c47e6ba8508cf2caaaa1ba9f8dca85)

Author SHA1 Message Date
Thomas Refis 8e928caea7
a better representation for modules with no name (#8908) 2019-10-09 14:15:37 +01:00
Jacques Garrigue 16a13e668b
fix issue #8792 and replace log_type by set_type_desc in Btype (#9018) 2019-10-05 13:17:57 +02:00
Jacques Garrigue 285b9806de
remove disambiguation for constructor map (#9017)
remove disambiguation for constructor map
2019-10-04 18:54:07 +02:00
Gabriel Scherer e6ffdba72a
Merge pull request #8968 from gasche/refactor-pattern-traversals
typedtree: refactor the generic pattern traversal functions
2019-09-24 22:47:44 +02:00
Gabriel Scherer 7b10a26bc8 refactor the generic pattern traversal functions 2019-09-24 21:20:10 +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
Gabriel Scherer ab13c54366 typecore: fix a small bug in type_pat
The Tpat_exception case would make several calls to the continuation
'k', which must be used linearily -- exactly once.

This bug is harmless and hard to reach today because Tpat_exception is
mostly used at the toplevel or under an or-pattern, where the
continuation is the identity. But the type-checker still allows
Ppat_constraint and Ppat_open nodes above exception-patterns, allowing
to observe the duplication. And maybe more tomorrow?

    $ ocaml -dsource
    # fun f x -> match f x with _ -> () | (exception _ : exn) -> ();;
      [...]
        pattern
           Tpat_constraint
           core_type
             Ttyp_constr "exn/7!"
             []
           pattern
             Tpat_exception
             pattern
               Tpat_constraint
               core_type
                 Ttyp_constr "exn/7!"
                 []
               pattern
                 Tpat_any
      [...]
    # fun f x -> match f x with _ -> () | Stdlib.(exception _) -> ();;
      [...]
        pattern
          Tpat_open ""Stdlib!""
          pattern
            Tpat_exception
            pattern
              Tpat_open ""Stdlib!""
              pattern (//toplevel//[1,0+42]..//toplevel//[1,0+43])
                Tpat_any
      [...]
2019-09-21 00:46:18 +02:00
Florian Angeletti c56ed411f8 Merge pull request #8827 from gasche/revert-numeric-operators-hint
Revert #2307 ( Hint on type error on numeric operators )

(cherry picked from commit 1fadc49604a791a7e9fa41c90fedad9304267f19)
2019-09-19 15:00:24 +02:00
Thomas Refis 4a22aeccb5 warning 60: enable on local modules 2019-08-28 13:24:10 +01:00
Leo White c19e8b2350 Refactor environment lookup functions 2019-08-15 15:56:50 +01:00
Florian Angeletti 04a9c8be61 Rename printing function in Printtyp.Conflicts 2019-07-31 13:52:59 +02:00
Alain Frisch 5ccf3c52dc New implementation of Env.make_copy_of_types (#8774) 2019-07-18 10:11:41 +09:00
Florian Angeletti 6582335689
#8702: fix some polymorphic variant error messages (#8777)
improved error messages for fixed row polymorphic variants: keep track of the motivation behind a fixed row (e.g it was bound to an universal or existential type variable, or private) in the types themselves and use this explanation in error messages.
2019-07-12 17:47:25 +02:00
Alain Frisch bc9ec3856d Traverse let-module/exception/open 2019-06-28 14:53:29 +02:00
Alain Frisch 73f4847f06 Compute final_subexpression on Typedtree, not Parsetree 2019-06-28 14:00:59 +02:00
Leo White a74009d9c1 Fix check-typos 2019-05-24 13:17:39 +01:00
Leo White acd06f1eff Remove Misc.may_map and similar 2019-05-23 16:27:58 +01:00
Jules Aguillon e728886c3e Clean up int literal hint (#2313)
In particular, print the hint literal hint as a sub message
2019-04-11 13:54:50 +02:00
Thomas Refis 4218eeb8d4 move guard to body 2019-04-09 11:33:49 +01:00
Thomas Refis 6b4aed6c90 merge some branches 2019-04-09 11:33:10 +01:00
Thomas Refis 36c06856b3 Texp_unreachable is nonexpansive 2019-04-09 11:31:24 +01:00
Thomas Refis ad206e4d43 unfragilize is_nonexpansive 2019-04-09 11:28:55 +01:00
Thomas Refis 1b3a6f6700 not is_nonexpansive => maybe_expansive 2019-04-09 11:28:13 +01:00
Jacques Garrigue d32550f5fb
Fix #8550: Soundness issue with class generalization (#8552)
* also rename generalize_expansive -> lower_contravariant
2019-04-09 15:03:19 +09:00
Guillaume Bury aec35c5f44 Better error message for private constructors of extensible types (#8579) 2019-04-04 13:03:26 +01:00
Thomas Refis 87eedfa931 type_let: update some comment as suggested during review 2019-03-26 11:16:25 +08:00
Matthew Ryan c33e46d69b Use newtype names as the underlying variable names (#2277)
* Use newtype names as the corresponding name when they are valid
2019-03-26 08:22:21 +09:00
Thomas Refis 784a39f94e type_let: be more careful generalizing parts of the pattern 2019-03-25 10:21:36 +08:00
Jules Aguillon d926fdb9f8 Add hint on numeric operator type clash 2019-03-11 01:58:52 +01:00
Jules Aguillon e1ca14da22 Refactor report_error to return a Location.error 2019-03-10 23:48:17 +01:00
Pierre Roux ed74b5b237 Enforce precision in printf %F 2019-03-09 12:03:43 +01:00
Jules Aguillon 6794943b32 Implements on patterns 2019-03-08 16:37:49 +01:00
Jules Aguillon 9ab5efc1ec Add hint on int literals where expecting int32 or int64 literal 2019-03-08 16:37:49 +01:00
Gabriel Scherer 93f0ce31bb env refactoring: separate the cmi/crc handling into a persistent_env module
Persistent_env is a new module that handles the relation between the
type-checking state and the "persistent" typing information laying in
.cmi files on the filesystem. In particular, it handles the collection
and production of CRC information for the .cmi files being read and
written to the filesystem; the using modules (in our case, only Env)
are in charge of turning the cmi files into higher-level information
(components and signatures).

Persistent_env exposes a type `'a t` of a persistent environment,
which acts as a mutable store of `'a` values. There is no global state
in the module itself: while Env (and thus the OCaml type-checker) uses
a single global persistent environment, it should be possible to
create several independent environments to represent, for example,
several independent type-checking sessions.
2019-02-18 17:02:47 +01:00
yallop d8c52273fa Generalized open: fix another expansiveness bug (#2167)
* open struct: add a failing test for expansiveness checking

* bug fix: 'open M' should only be non-expansive if 'M' is.

* open struct expansiveness fix: Changes entry
2018-11-28 11:35:47 +01:00
Leo White 403003cad5 Add support for "let" operators 2018-11-27 13:30:55 +00:00
Thomas Refis 0ae2da110a Fix is_nonexpansive for Texp_open (#2166) 2018-11-27 08:28:40 -05: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
Alain Frisch 4c130cae87
Fix wrong calls to Env.normalize_path on non-module paths (#2131) 2018-11-22 16:07:15 +01:00
Leo White 111d4e1827 Remove positions from paths 2018-11-21 03:39:34 -05:00
Nicolás Ojeda Bär 4494397e71 Warn about partial application on let _ = (arrow type) 2018-11-17 19:08:39 +01:00
Alain Frisch 2e5b9d1ef1
"Alerts" as a generalization of "deprecated" (#1804) 2018-11-15 09:51:35 +01:00
Thomas Refis e2338820c5
Merge pull request #2110 from trefis/gadt-under-or-pattern
Allow GADT constructors to introduce equations and existential types under or-patterns
2018-11-12 09:30:56 +01:00
Daniel Bünzli a7afd89003 s/string_of_int/Int.to_string/g 2018-11-07 13:52:02 +01:00
Thomas Refis 25d1a56da3 allow GADTs under or-patterns 2018-11-05 13:15:35 +00:00
Jeremy Yallop 82a30bac62 Warn on literal patterns found anywhere in a constructor's arguments. 2018-11-05 09:02:59 +00:00
Thomas Refis 4a6f33d557 make check_scope_escape behave more like update_level 2018-10-18 10:52:50 +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