Commit Graph

2525 Commits (1cd6e4451f04af4871675d0eecd48b3bac262b67)

Author SHA1 Message Date
muskangarg21 52dc5d793b [Refactor]: Typing/typeclass.ml 2020-03-24 04:33:45 +05:30
Nicolás Ojeda Bär 57d329e07b
Deprecate -annot (#2141)
* Move driver code from Cmt2annot to Read_cmt
* Move cmt2annot.ml into typing/
* make depend
* Use standard error handling
* Move specific logic to read_cmt
* Do not pass full cmt record as argument
* Better locations
* Emit .annot files produced from cmt data
* Remove direct calls to Stypes
* Deprecate -annot
* Changes
* make depend
* Adapt doc
* make -C tools depend
2020-03-13 12:59:34 +01:00
Thomas Refis abeaef92fb
Merge pull request #9322 from trefis/rematch-structured-rows
[matching.ml cleanup] structured rows
2020-03-10 17:02:14 +01:00
Thomas Refis 9504ede328 parmatch: export Pattern_head 2020-03-10 12:08:39 +01:00
Gabriel Scherer 0fff7a43c5
Merge pull request #9196 from gasche/clarify-disambiguation-3
disambiguation: improve the interface of `NameChoice.disambiguate`
2020-03-09 13:39:32 +01:00
Gabriel Scherer bf6c8d4b95 disambiguation: improve the API of NameChoice.disambiguate 2020-03-07 14:35:05 +01:00
Thomas Refis c323d11144
Merge pull request #8934 from trefis/usage
Stop relying on location to track usage
2020-03-06 16:49:44 +01:00
Florian Angeletti b82d5194c2
Merge pull request #9343 from lpw25/fix-short-paths-environments
Re-enable `-short-paths` for some error messages
2020-03-06 09:38:40 +01:00
Thomas Refis bea2d04582
build_subtype: assert arrow type is known (#9348)
`build_subtype` is invoked only through `enlarge_type` when typechecking Pexp_coerce.

The type passed to `build_subtype` can only have `Cok` arrows because:
- the base type is the direct result of `Typetexp.transl_simple_type_delayed` which only introduces `Cok` arrows
- the other source of arrows could be the result of unification; however at this point the type variables are fresh, they have not been unified with any existing types.

Adding this assertion ensures that this property won't be broken by accident.
2020-03-05 16:18:59 +01:00
Thomas Refis b67779b45e add forgotten word in comment 2020-03-05 14:54:21 +01:00
Thomas Refis 0a09add592
printtyp: inline a function call (#9347) 2020-03-05 14:21:35 +01:00
Thomas Refis 86b33bc450 Uid.reinit 2020-03-05 14:20:04 +01:00
Thomas Refis 3fe25383ba Types.Uid: include Identifiable 2020-03-05 13:36:11 +01:00
Thomas Refis 8abb51905b set_value_used_callback: simplify implementation 2020-03-05 13:35:14 +01:00
Thomas Refis dacf8b5a0b typecore: wrap_unpacks => type_unpacks
This allows us to give the same uid to the module bound in the guard,
and the one bound in the rhs.
2020-03-05 13:35:14 +01:00
Thomas Refis e4de6c19b1 use uid for usage warnings 2020-03-05 13:35:12 +01:00
Thomas Refis d52dd5c33e Add a unique id to every signature item 2020-03-05 13:34:12 +01:00
Thomas Refis 9fb4b05f4b typedtree.mli: un-open Types 2020-03-05 13:34:12 +01:00
Thomas Refis 70370d7004
Merge pull request #9275 from lpw25/short-circuit-simple-inclusion-checks
Short circuit simple inclusion checks
2020-03-05 12:03:24 +01:00
Leo White 971ffafffb Apply short-paths to an additional case 2020-03-05 09:44:18 +00:00
Leo White ecfaffe9de Short circuit simple inclusion checks 2020-03-04 15:20:32 +00:00
Leo White 76752f7255 Avoid polymorphic compare in Ident 2020-03-04 14:41:42 +00:00
Leo White 1188af3614 Fix some bugs in short-paths 2020-03-03 18:04:47 +00:00
Thomas Refis 0cdf996ee2 type_pat: refresh the docs 2020-02-19 10:37:06 +01:00
Thomas Refis 78ad5de955 type_pat: factorize or-pat case 2020-02-19 10:37:06 +01:00
Thomas Refis 9a85827193 use a proper type, not a boolean 2020-02-19 10:37:06 +01:00
Florian Angeletti 27cbba6cd7 add an Empty_branch exception 2020-02-19 10:37:06 +01:00
Florian Angeletti e03e29fd6d
Merge pull request #9182 from gasche/clarify-disambiguation-2
NameChoice (disambiguation): more refactoring
2020-02-18 12:25:15 +01:00
Florian Angeletti 38230a7fa7
Merge pull request #9274 from Octachron/unload_module_lookup
Printtyp: don't touch the file system
2020-01-31 13:44:57 +01:00
Florian Angeletti 51292c2956 Printtyp: don't read cmis when printing
This commit adds a function in Printtyp for searching elements of
the printing environment without reading cmis.
This function is used to ensure that the printing of types does not
trigger unrelated errors by trying to access cmis on the file system.
2020-01-30 18:07:59 +01:00
Gabriel Scherer e1addb7962
Merge pull request #9269 from Octachron/fix_annot
#9218: wrong file name error with -annot and inline records
2020-01-30 08:41:20 +01:00
Florian Angeletti 62699c1ce3 review 2020-01-29 10:00:15 +01:00
Florian Angeletti 9f696f0a8e 9218, avoid module/type path collitsion
In presence of -annot, the type printer can be requested to print the
inner path of inline records (i.e "t.A"). Before this commit, the
printing of these paths could trigger a lookup to a module with a
invalid name "t".
If this lookup fails this is fine.
However, if there is a cmi file in the environment sharing the name "t",
the lookup can partially succeed (since cmi are not required to start
with a capital letter) until we compare the module name stored in the
cmi with the requested module name.
Obviously, the valid module name "T" of the cmi cannot match the invalid
module name "t" that was requested, and the cmi reader raises a wrong
module file name error.

This commit avoids this whole process by detecting in the type printer
when we are printing an inlined record type constructor.
2020-01-28 16:30:56 +01:00
Gabriel Scherer e940f925ad typedecl_separability: handle GADT equations in a more predictable order
The separability signature of a type declaration is not inferred in
a principal way, it depends on the order in which GADT equations are
processed. In non-principal cases, we may have two parameters that are
related by an equality, with one of them being given mode Ind and the
other Sep. Either choice of which to make Sep is sound, but (Ind, Ind)
would be unsound.

We change the implementation to ensure that equations are processed in
an order such that the lefmost parameters are the most constained: if
equations imply that ('a = 'b), with the parameter 'a coming before 'b
in the type declaration, and they must be separable, then 'a gets the
mode Sep and 'b gets the mode Ind. This corresponds intuitively to
remembering that 'b is equal to a previous parameter, instead of
remembering than 'a is equal to a not-seen-yet parameter.
2020-01-28 13:56:23 +01:00
Gabriel Scherer 6bf7e16f8e changes from review comments 2020-01-28 13:56:23 +01:00
Rodolphe Lepigre 15a6ff229d typedecl: use the new Separability implementation, remove old code
Because this changes the separability of standard library types, and
those separabilities are stored in the .cmi files, this commit changes
the .cmi files in the standard libraries in way that appear to require
a bootstrap (it looks like some part of the stdlib is built with
boot/ocamlc and others with ocamlc, and the two should produce/expect
the same .cmi exactly). The bootstrap will come as a separate commit.
2020-01-28 12:09:33 +01:00
Rodolphe Lepigre dd5f8d3d4d typedecl_separability: expose the generic Typedecl_properties interface 2020-01-28 11:39:52 +01:00
Gabriel Scherer cc61027a8e typedecl_separability: protect against infinite cyclic types 2020-01-28 11:39:52 +01:00
Gabriel Scherer 87d3664a1d typedecl_separability: support for GADTs 2020-01-28 11:39:52 +01:00
Rodolphe Lepigre f3fc46adb5 typedecl_separability: support for algebraic datatypes (non-GADTs) 2020-01-28 11:39:52 +01:00
Gabriel Scherer 358c7cecd5 add separability signatures in type declarations
(this changes the .cmi format and thus requires a bootstrap,
to follow as a separate commit)

(includes bug fixes by Rodolphe Lepigre)
2020-01-28 11:39:52 +01:00
Gabriel Scherer d87c2104f2 typedecl_separability: destructure type definition to access unboxing information
In the future, we could move the arity-related checks
(one constructor, one parameter) and error logic from typedecl.ml to
typedecl_separability.ml.
2020-01-28 11:39:52 +01:00
Rodolphe Lepigre beb750b5ee typedecl_separability: interfaces and basic definitions, implementations missing 2020-01-28 11:39:52 +01:00
Rodolphe Lepigre 20b62c8386 Cleaned up [@@unbox] validity check. 2020-01-28 11:39:52 +01:00
Vincent Laviron fffea6b8da Fix Rec_check for let module _ = .. 2020-01-24 14:17:42 +01:00
Leo White c272447b1e Relax the handling of explicit polymorphic types 2020-01-20 13:48:16 +00:00
Leo White ec748c04c1 Fix level handling in unify_rows for the fixed case 2020-01-20 13:48:16 +00:00
Gabriel Scherer 8a79f6ce59
Merge pull request #9021 from Octachron/longident_parser
Expose parsers for Longident.t
2020-01-10 11:23:09 +01:00
Florian Angeletti 4fdba2f638 Merge pull request #9185 from hhugo/fix-unused-open
fix spurious 'unused open' warning with classes and polymorphic variants

(cherry picked from commit d2c4e791fad6340c74abf741af3e79eb1f9c20d7)
2020-01-10 09:49:02 +01:00
Gabriel Scherer 8d8e991ced
Merge pull request #9208 from gasche/dno-locations
-dno-locations: hide source locations (and debug events) from intermediate-representation dumps
2020-01-10 06:56:48 +01:00