Commit Graph

827 Commits (master)

Author SHA1 Message Date
Jacques Garrigue 9e181ca8f4 must use set_state rather than backtrack in Typecore.type_cases 2020-11-05 11:12:01 +09:00
Thomas Refis 10364b67d5
build_as_type: document why generic_instance can't be used (#9983) 2020-10-20 15:04:58 +02:00
Nicolás Ojeda Bär 246564e8db
Remove dead code (#9974) 2020-10-13 09:48:16 +02:00
Thomas Refis c7f9c8e559 pat_env: I must not tell lies 2020-10-07 15:54:23 +02:00
Jacques Garrigue a5f63ba65f
Remove propagation from previous branches (#9811) 2020-10-03 10:48:57 +09:00
Leo White 98d4f0b864 Widen warning 16 to more cases 2020-09-17 18:54:22 +01:00
Florian Angeletti 66c368ae77 Merge pull request #9857 from lpw25/fix-poly-refs-check
Add missing `lower_contravariant` call (fixes #9856)

(cherry picked from commit 56707233fb6e33d0e5d0719b8550a15db8aa02d9)
2020-09-03 13:55:17 +02:00
Jacques Garrigue 302d735ce8
Righteous ambivalence (#9767)
* Fix #9759: Typing without -principal is broken in 4.11 and trunk
* compile stdlib in -principal mode
* never modify generic part of ty_expected_explained
* use generic_instance where possible
* add comment for -no-principal in stdlib__oo.cmi
2020-07-29 09:10:17 +09:00
Nicolás Ojeda Bär fb76c322b4 Rename Ignored_argument => Ignored_extra_argument 2020-07-20 08:31:18 +02:00
Nicolás Ojeda Bär 958281de38 Rename Unreachable_argument => Ignored_argument 2020-07-20 08:31:18 +02:00
Nicolás Ojeda Bär ca4b8dcbd7 Rename Non_closed_record_pattern => Missing_record_field_pattern 2020-07-20 08:31:18 +02:00
Nicolás Ojeda Bär f3c6b16ad7 Rename Partial_application => Ignored_partial_application 2020-07-20 08:31:18 +02:00
Nicolás Ojeda Bär 358a6c1ae8 Rename Unused_argument => Unreachable_argument 2020-07-20 08:31:18 +02:00
Nicolás Ojeda Bär e05f119ea1 Rename Without_principality => Non_principal_labels 2020-07-20 08:31:18 +02:00
Nicolás Ojeda Bär fd48548c05 Rename Statement_type => Non_unit_statement 2020-07-20 08:31:18 +02:00
Thomas Refis 4edc4b9928
pattern aliases do not ignore type constraints (#1655) 2020-07-09 12:20:37 +02:00
Thomas Refis 167e66e15d
type_cases: rely on levels to enforce principality (#1931)
Instead of the erasure scheme that was used up to now, where we
considered that the type was always principal.

Note: the erasure still happens when polymorphic variants appear in the
patterns, and the type of the scrutinee contains a Reither.
2020-07-08 10:35:40 +02:00
Jacques Garrigue e0ec63ae21
Fix #8747: incorrect principality warning on functional updates of records (#9709) 2020-06-28 23:20:12 +02:00
Jacques Garrigue 24d087325c
Fix #7902: Type-checker infers a recursive type, even though -rectype… (#9556) 2020-06-15 10:26:26 +02:00
Jacques Garrigue abb8db459d
Fix #7520: Odd behaviour of refutation cases with polymorphic variants (#9547) 2020-06-03 17:47:12 +02:00
Jacques Garrigue ee20f5e648
Fix the polymorphic recursion problem of #9603 (#9617) 2020-06-02 22:05:30 +02:00
Stephen Dolan fd1bb255e1 More partial application warnings 2020-06-02 12:11:41 +01:00
Thomas Refis e01966a8b1 illegal commutation: more information in error message 2020-04-18 11:09:32 +02:00
Thomas Refis 384aa215fa optional arguments eliminated only when followed by unlabelled argument 2020-04-18 11:09:32 +02:00
Thomas Refis ed654dc98f type_application: better variable name 2020-04-18 11:01:52 +02:00
Thomas Refis 22657fa622 type_application: better names, some more comments 2020-04-18 11:01:52 +02:00
Thomas Refis 02a7388602 type_application: implement ignored and omitted in the same way 2020-04-18 11:01:52 +02:00
Thomas Refis 21656b259c inline type_unknown_args 2020-04-18 11:01:52 +02:00
Thomas Refis 5e78b177b8 type_unknown_args is a fold 2020-04-18 11:01:52 +02:00
Thomas Refis f444ecde29 type_application: primitives inspection helper 2020-04-18 11:01:52 +02:00
Thomas Refis 9632e02d6a type_args: some comments (and formatting noise) 2020-04-18 11:01:52 +02:00
Thomas Refis 0deda5100c type_args: remove ty_old
This was useful when commuting optional arguments was allowed with
`ignore_labels = true`. Which it isn't anymore.
2020-04-18 11:01:52 +02:00
Thomas Refis 9e0515f554 type_args: forbid optional arguments commuting when [ignore_labels=true] 2020-04-18 11:01:52 +02:00
Thomas Refis b703371d7d extract_label: return an option instead of raising 2020-04-18 11:01:52 +02:00
Thomas Refis 2b1e211df9 type_application: merge sargs and more_sargs 2020-04-18 11:01:52 +02:00
Jacques Garrigue d67c704c4d
In `{expr with ...}`, always evaluate `expr` even if all labels are redefined (#9432)
This commit reverts c1a7ace (originally c545e04), which was a
temporary fix that is no longer needed because it was superseded by
#6608.

The temporary fix caused `{expr with lbl1 = e1; ... }` to not evaluate
`expr` if all labels of its type are overriden.  As reported in #7696
this is not desirable.  Reverting the temporary fix causes `expr` to
be evaluated always.

As a consequence, a corner case of value "let rec" is no longer accepted.
The corresponding test was updated.

Closes: #7696
2020-04-08 18:58:43 +02:00
octachron 4f9f41e73a disambiguation for extension constructors
This commit exposes all extension constructors when looking up for
a construction with a given type in the environment.

This makes constructor disambiguation work for extension constructors.

Going one step further, when the name of an extension constructors
is misspelled, we cannot rely on the type to find all possible
names. However, since we are in an error path, we have some
path at hand.
Thus, this commit alters the "lookup_from_type" function in the
Constructor module to make it scan the whole environment for
extension constructors with the right type.

This commit should not change anything for labels and standard constructors.
2020-04-03 16:05:23 +02:00
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
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
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
Leo White 971ffafffb Apply short-paths to an additional case 2020-03-05 09:44:18 +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