Commit Graph

20933 Commits (9e181ca8f446d238ba279bc22fef9d166d4f38b0)

Author SHA1 Message Date
Gabriel Scherer 9c5a2ef8dc
Merge pull request #9440 from progman1/genprintvalbug
#9148 extension constructor printing discrepancy in REPL
2020-09-09 17:11:02 +02:00
Gabriel Scherer aa858a35ae
Merge pull request #9889 from Octachron/pprintyp_short_path_cache
printtyp: cache short path data in wrap_env
2020-09-09 10:50:01 +02:00
David Allsopp 6dc2457036
Merge pull request #9884 from dra27/cygwin64-prereq-6
Missing declarations in io.h [Cygwin64 pre-req 6/6]
2020-09-09 09:24:34 +01:00
David Allsopp f62d519be7
Merge pull request #9882 from dra27/cygwin64-prereq-4
Tidy CAML_INTERNALS in minor_gc.h and memory.h [Cygwin64 pre-req 4/6]
2020-09-09 09:23:50 +01:00
David Allsopp 2235354bd5
The opposite of O_TEXT is not O_BINARY (#9892)
Extra modes were added in the version 7 CRT (.NET 2002).  Update `descriptor_is_in_binary_mode`  so that the original mode is correctly restored at exit, even if it is neither `O_TEXT` nor `O_BINARY`.
2020-09-08 18:17:02 +02:00
progman1 8f87147c9d toplevel: a discrepancy in extension constructors printing
fixes #9148

genprintval.tree_of_extension was missing instantiation of constructor argument types.
the Ctype.apply code is factorized out from a number of other places.
2020-09-08 18:04:09 +02:00
Florian Angeletti 9f804a25d2
Merge pull request #9427 from Octachron/ocamldoc_list_syntax
ocamldoc: fix the printing of (::)
2020-09-08 17:32:17 +02:00
Florian Angeletti 5d7663aaa5 review 2020-09-08 17:24:46 +02:00
Florian Angeletti bb186a8633 printtyp: cache old short path data in wrap_env 2020-09-08 17:22:23 +02:00
Nicolás Ojeda Bär 6db41e4816
riscv: fix register usage (#9890) 2020-09-08 09:55:19 +02:00
Xavier Leroy 1b48b5aa3c
Merge pull request #9872 from xavierleroy/seek-text-channels
Revised {in,out}_channel_length and seek_in for channels in text mode
2020-09-08 09:52:22 +02:00
Xavier Leroy 83c762974b Document the issue with pos_{in,out} and files opened in text mode
Add changes for 9872
2020-09-08 09:51:35 +02:00
David Allsopp 0c8e782688
Merge pull request #9854 from jberdine/ocamlparam
Treat set-but-empty OCAMLPARAM the same as unset
2020-09-07 14:45:26 +01:00
David Allsopp 558424dcbb
Merge pull request #9851 from yallop/obj-tag-noalloc
Mark Obj.tag [@@noalloc]
2020-09-07 14:34:04 +01:00
David Allsopp db0eb09fca
Merge pull request #9801 from dra27/ocamltest-cmp-take-729
Finally fix EOL-at-EOF and normalisation in ocamltest
2020-09-07 14:06:27 +01:00
David Allsopp 422c20013d Remove CAMLexport from Cash-exported primitives 2020-09-07 13:54:08 +01:00
David Allsopp e0397de83b
Merge pull request #9881 from dra27/cygwin64-prereq-3
Remove unimplemented functions in caml/alloc.h [Cygwin64 pre-req 3/6]
2020-09-07 13:46:07 +01:00
David Allsopp 02c1577e7b
Merge pull request #9883 from dra27/cygwin64-prereq-5
Guard caml_fatal_uncaught_exception with CAML_INTERNALS [Cygwin64 pre-req 5/6]
2020-09-07 13:38:22 +01:00
David Allsopp c4f9f51101
Merge pull request #9879 from dra27/cygwin64-prereq-1
Declare caml_*_ops in headers [Cygwin64 pre-req 1/6]
2020-09-07 13:37:50 +01:00
Xavier Leroy a7d1af4a87 Test rand.ml: make it less likely to fail
Use Random.bits() instead of Random.int 10000 to get a 2^-30 expected
failure rate instead of 10^-5.
2020-09-07 13:55:59 +02:00
octachron 1393a37509 ocamldoc: fix printing of (::) 2020-09-07 11:07:10 +02:00
珊瑚 961aaf5d1c
typo (#9886) 2020-09-06 12:12:38 +02:00
David Allsopp bf05018a1a Formalise the Cash exports 2020-09-04 16:22:10 +01:00
David Allsopp 0f6d3a3128 Add missing channel declarations in caml/io.h 2020-09-04 16:21:03 +01:00
David Allsopp 8835ed164d Don't export caml_input_scan_line 2020-09-04 16:19:06 +01:00
David Allsopp 0d4f1ba182 Guard caml_fatal_uncaught_exception with CAML_INTERNALS 2020-09-04 15:59:43 +01:00
David Allsopp c35dc17664 Guard heap functions with CAML_INTERNALS 2020-09-04 15:57:57 +01:00
David Allsopp b4fa324832 Explicit export caml_allocation_color 2020-09-04 15:54:52 +01:00
David Allsopp 0fce1e36ae Guard most of minor_gc.h with CAML_INTERNALS 2020-09-04 15:53:44 +01:00
David Allsopp eb6d803222 caml_gc_dispatch doesn't need exporting 2020-09-04 15:53:29 +01:00
David Allsopp ff7da588d6 Add missing caml_ prefix in minor_gc.h 2020-09-04 15:51:54 +01:00
David Allsopp bd58bcff8d Remove unimplemented functions in caml/alloc.h 2020-09-04 15:41:29 +01:00
David Allsopp bab2d10a68 Declare caml_*_ops in headers 2020-09-04 15:25:49 +01:00
Jeremy Yallop 44c053008a
Merge pull request #9066 from gasche/either
Add `('a, 'b)  Either.t = Left of 'a | Right of 'b` and `List.partition_map`
2020-09-03 22:47:55 +01:00
Gabriel Scherer de72be7c70 mention Either in the manual 2020-09-03 22:24:37 +02:00
Jeremy Yallop 1a8aa5428e Add partition_map to ListLabels. 2020-09-03 22:23:00 +02:00
Florian Angeletti ce04a5c1b1 Merge pull request #9862 from Octachron/4.11.1_with_less_daring_assertions
9859: revert 9348, inferred function types and :>
(cherry picked from commit 28b82e2e397d129840e35fb8da0b8af8b9f59633)
2020-09-03 13:55:17 +02: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
Florian Angeletti a2ecfc45a3 Reorder changes, "language feature" section 2020-09-03 13:55:17 +02:00
Greta Yorsh 2bb2bde74c
Prologue size should not depend on stack_offset (power, arm64) (#9083)
* Prologue size does not depend on stack_offset (power, arm64)

Define `initial_stack_offset` of a function, independently
of stack_offset, and use it to compute both frame_size and
prologue_size.
2020-09-03 13:26:00 +02:00
Florian Angeletti 63972f9687
Fix injectivity test wrt value restriction (#9867)
The original test is rejected when the value restriction is properly implemented.
2020-09-03 11:09:35 +02:00
Gabriel Scherer ca6f3ee057 List.partition_map : (a -> (b, c) Either.t) -> a list -> b list * c list 2020-09-02 13:59:53 +02:00
Gabriel Scherer 25e59d63d8 Add `'a Either.t = Left of 'a | Right of 'b`
```ocaml
val left : 'a -> ('a, 'b) t
val right : 'b -> ('a, 'b) t
val is_left : ('a, 'b) t -> bool
val is_right : ('a, 'b) t -> bool
val find_left : ('a, 'b) t -> 'a option
val find_right : ('a, 'b) t -> 'b option
val map_left : ('a1 -> 'a2) -> ('a1, 'b) t -> ('a2, 'b) t
val map_right : ('b1 -> 'b2) -> ('a, 'b1) t -> ('a, 'b2) t
val map : left:('a1 -> 'a2) -> right:('b1 -> 'b2) -> ('a1, 'b1) t -> ('a2, 'b2) t
val fold : left:('a -> 'c) -> right:('b -> 'c) -> ('a, 'b) t -> 'c
val equal :
  left:('a -> 'a -> bool) -> right:('b -> 'b -> bool) ->
  ('a, 'b) t -> ('a, 'b) t -> bool
val compare :
  left:('a -> 'a -> int) -> right:('b -> 'b -> int) ->
  ('a, 'b) t -> ('a, 'b) t -> int
```

Unlike [result], no [either] type is made available in Stdlib,
one needs to access [Either.t] explicitly:

- This type is less common in typical OCaml codebases,
  which prefer domain-specific variant types whose constructors
  carry more meaning.
- Adding this to Stdlib would raise warnings in existing codebases
  that already use a constructor named Left or Right:
  + when opening a module that exports such a name,
    warning 45 is raised
  + adding a second constructor of the same name in scope kicks
    in the disambiguation mechanisms, and warning 41 may now
    be raised by existing code.

If the use becomes more common in the future we can always
revisit this choice.
2020-09-02 13:59:53 +02:00
Gabriel Scherer 5cc12b8100
testsuite/tests/formatting: remove native-compiler location tests (#9871)
The tests for -dlocations are painful to update for native compiler
backends. They were previously restricted to 64bit architectures only
( e57785524b ), and disabled on AFL
( 829b00b6c7 ), but the fact that they
have to be updated for both clambda and flambda backends is annoying
in practice. This commit disables location-testing completely for the
native backend, and only checks locations in the bytecode compiler
intermediate representations, from -dparsetree to -dlambda.

Note: now the we have bytecode-only versions of the test, it should be
more portable. The test has been re-enabled for 32bit and AFL
configurations. It will still need tweaking in the future if people
perform configuration-dependent changes on the Lambda representation
(but hopefully those changes could be disabled by command-line options
to be added to the test configuration).
2020-09-02 11:41:20 +02:00
Yishuai Li 63c7071a34
Add Unix.SO_REUSEPORT (#9869)
Support the SO_REUSEPORT socket option.

Closes: #3512
2020-09-02 10:52:04 +02:00
Josh Berdine 169892a0d0 Use polymorphic compare to empty string instead of checking length for 0 2020-09-01 21:59:05 +01:00
Xavier Leroy 09f2b9dd57 Revised {in,out}_channel_length and seek_in for channels in text mode
Under Windows, for channels opened in text mode, EOL conversion causes
a mismatch between the `offset` position cached in the
`struct channel` record and actual position in the file.

This commit turns off the use of the cached "offset" in the implementations
of `{in,out}_channel_length` and `seek_in`, calling `lseek` directly instead.

To support this, a new channel flag `CHANNEL_TEXT_MODE` was added.  It
is set for channels operating in text mode under Windows, when EOL
conversion is active.

Fixes: #9868
2020-09-01 20:33:39 +02:00
Xavier Leroy 4066fbd69c Fix overflow detection in {in,out}_channel_length
The LargeFile version of these functions was incorrectly reporting
an error if the size is not representable as an OCaml unboxed int.
2020-09-01 20:26:35 +02:00
Xavier Leroy d356562d0f Test in_channel_length and seek_in on channels opened in text mode
Repro cases for #9868.
2020-09-01 20:26:29 +02:00
Raphaël Proust bed23dfbbc Stdlib.Format: add pp_print_seq 2020-09-01 17:51:34 +02:00