Commit Graph

2774 Commits (master)

Author SHA1 Message Date
Leo White fdbb4e201e Fix PR#7538 2020-09-18 09:38:08 +01:00
Leo White cfb1d66387 Add test for PR#7538 2020-09-18 09:16:52 +01:00
Leo White bbad93d222
Merge pull request #9783 from lpw25/widen-warning-16
Widen warning 16 to more cases
2020-09-18 09:12:56 +01:00
Leo White 98d4f0b864 Widen warning 16 to more cases 2020-09-17 18:54:22 +01:00
Leo White 74270315a0 Add some tests for warning 16 2020-09-17 18:54:22 +01:00
Xavier Leroy a55b0e17dc Test for immediates: also test "checkbound"
Plus: bow to check-typo.
2020-09-17 10:41:16 +02:00
Xavier Leroy a61052edf5 New test exercising immediate arguments to integer operations 2020-09-16 11:52:30 +02:00
Florian Angeletti d0e983e2aa
Merge pull request #9745 from johnwhitington/trunk
Unify labeled and unlabeled Standard Library module interfaces
2020-09-15 11:07:25 +02:00
Xavier Leroy ba0a9c2ce8
Export, document, and use Unix._exit (#9914)
This is a wrapper around the _exit system call.  It has been implemented
in otherlibs/unix/exit.c for a long time but never exported.

This commit exports and documents it as `Unix._exit`.

The Unix implementation of `establish_server` is changed to use `_exit`
and to have gender-neutral comments.

A test was added to check that OCaml finalization actions are not performed.
2020-09-14 19:03:42 +02:00
Florian Angeletti bc4d260de7
Merge pull request #9865 from raphael-proust/pp_print_seq
Stdlib.Format: add pp_print_seq
2020-09-14 16:52:11 +02:00
Thomas Refis 162df93916 catch Nondep_cannot_erase exception 2020-09-14 13:27:03 +02:00
Thomas Refis 6aad418899 add test from #9858 2020-09-14 13:27:03 +02:00
Raphaël Proust faeb43ba5a Add test for Stdlib.Format.pp_print_seq 2020-09-12 09:19:30 +02:00
Florian Angeletti 9a31c888b1
Merge pull request #9433 from lpw25/fix-package-constraints-for-module-aliases
Fix package constraints for module aliases
2020-09-11 18:21:24 +02:00
John Whitington c3f6cd7ff7 Merge remote-tracking branch 'upstream/trunk' into trunk 2020-09-11 14:14:38 +01:00
Chet Murthy 0d46b5206d redo: This little patch fixes the pretty-printing of "rebind" extension-constructors (and also rebind exceptions) so that it matches the parser. With tests. a rebind extension like
type t  += A = M.A [@a]
was pretty-printed as

type t += A[@a] = M.A
[obviously wrong, also not accepted by parser]

With tests for extension-constructors and exceptions.

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch pr-extension-constructor-rebind-pprint-4.11
# Changes to be committed:
#	modified:   Changes
#	modified:   parsing/pprintast.ml
#	modified:   testsuite/tests/parsetree/source.ml
#
# Untracked files:
#	Changes.orig
#	parsing/pprintast.ml.orig
#	testsuite/tests/parsetree/source.ml.orig
#	testsuite/tests/parsetree/source.ml.rej
#
2020-09-10 11:09:06 -07:00
Chet Murthy e2ec81fe56 re-do of print polyvariants that start with a core_type,closed, not low with leading bar ("|").
a type "[ | w ]" must be printed with the "|", or it won't be
reparseable.

with tests, Changes entry.

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch pr-polyvariant-pprint
# Changes to be committed:
#	modified:   Changes
#	modified:   parsing/parsetree.mli
#	modified:   parsing/pprintast.ml
#	modified:   testsuite/tests/parsetree/source.ml
#
# Untracked files:
#	Changes.orig
#	parsing/pprintast.ml.orig
#	testsuite/tests/parsetree/source.ml.orig
#	testsuite/tests/parsetree/source.ml.rej
#
2020-09-09 13:37:36 -07:00
Gabriel Scherer 03839754f4
List.equal, List.compare (#9668)
`List.equal f foo bar` is nicer than
`List.length foo = List.length bar && List.for_all2 f foo bar`.

Note: with List.compare there is a risk of users having opened the
List module, and then using 'compare' from the stdlib unqualified. For
example:

    List.(sort compare foo bar)

Such code will break (type error), and has to be fixed by using
Stdlib.compare. Stdlib is available since OCaml 4.07; people wishing
to support both 4.12 and older releases would have to avoid opening
List, or rebind 'compare' locally.
2020-09-09 20:01:04 +02:00
David Allsopp 212c0fa70c
Allow running a single test in testsuite/Makefile (#9807)
* Allow running a single test in testsuite/Makefile.  Syntax is `make one FILE=...`

* Rename `make list` into `make one LIST=...` for consistency.

* Always read actual lines from files

read should, as a general rule, always be followed by -r in scripts. If
IFS is not empty, then spaces are stripped as well.
2020-09-09 19:54:00 +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
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
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
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
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
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 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
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
Stephen Dolan 6e84a11181
Fix double free of toplevel bytecode (#9855) 2020-08-25 15:22:46 +01:00
Xavier Leroy 53fe14a541 channel_of.ml test: create temp file with O_SHARE_DELETE
Otherwise, under Win32, we can get an error on Sys.remove because
handles remain opened on the file.
2020-08-20 14:36:27 +02:00
hhugo 49aa87c316
Introduce warning 68 to warn about hidden allocation due to pattern match of mutable field in curried functions (#9751)
Introduce new warning 68
2020-08-17 09:47:36 +01:00
Florian Angeletti b73b8a3299
Merge pull request #9831 from yallop/short-paths-show-fix
Fix #show with -short-paths
2020-08-06 10:44:20 +02:00
Anil Madhavapeddy 829b00b6c7 Restrict 'test_locations' to not run with afl active
The AFL code generator alters the generated output and the
expect tests fail.  This test is already restricted to 64-bit
only architectures for similar reasons (the output locations
change).

Also updates the expected outputs to account for the extra line
in the test case now.

Fixes #9822
2020-08-05 20:04:34 +01:00
Jeremy Yallop 395a47eed9
Add Bigarray 'init' functions (#9779)
Add Bigarray init functions.
2020-08-05 13:26:10 +01:00
Jeremy Yallop 27f1012bc6 Revert to printing types as 'nonrec' to avoid a bug
See: https://github.com/ocaml/ocaml/issues/9828
2020-08-05 11:21:11 +01:00
Jeremy Yallop aa06fa819e Add a failing test for #show with -short-paths. 2020-08-05 11:00:02 +01:00
Stephen Dolan 3f5c5ca820 fix floatarray.ml on 32-bit 2020-08-03 18:47:40 +01:00
Stephen Dolan 0bf255cd7e
Fix signals_alloc test (#9814) 2020-08-02 21:30:58 +02:00
Xavier Leroy 8b6241c64c Skip tests/unwind on iOS / macOS ARM64, continued
Follow-up to 482b7feb3
2020-07-31 09:29:43 +02:00
Xavier Leroy 482b7feb37 Skip tests/unwind on iOS / macOS ARM64
On iOS / macOS ARM64, libunwind seems unable to unwind anything, not
just OCaml function calls, but even C function calls.  Maybe this is
related to the observation that the C compiler doesn't produce DWARF
unwinding info by default.

The DWARF unwinding info produced by ocamlopt seems correct, given that
lldb prints correct stack backtraces for this "unwind" example.
2020-07-31 09:04:20 +02:00
Stephen Dolan 5b4b834578
Ensure signals are handled before Unix.{kill,sigprocmask} return (#9802) 2020-07-30 14:30:42 +01:00
David Allsopp a9fc1cd84f Assume --no-print-directory option
At the time the test was added, GNU make was not a requirement. It is
now, an --no-print-directory was added in 1993...
2020-07-27 16:33:41 +01: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
Xavier Leroy 8b3ac9bcb2
Merge pull request #9722 from stedolan/eintr-again
EINTR-based signal handling: ensure that signals are handled
only at polling points, and that I/O locks are not held during signal
handling.
2020-07-28 19:20:57 +02:00
Xavier Leroy a0a1ba4f1e
Merge pull request #9699 from EduardoRFS/trunk-ios
Add support for iOS and macOS on ARM64
2020-07-28 16:40:55 +02:00
Fourchaux 44e6cf4e0f
typos (#9806) 2020-07-28 12:22:03 +01:00
Stephen Dolan c2b2da2234 Tests for EINTR-based signal handling 2020-07-28 10:54:54 +01:00
Xavier Leroy 82625c6105 test/unwind: exit with nonzero error code in case of failure
Follow-up to d374d7d23
2020-07-28 10:27:07 +02:00
Xavier Leroy ba2b98608a
Merge pull request #9742 from jhjourdan/fix_7810
Make Ephemeron compatible with infix pointers.
2020-07-27 16:51:14 +02:00
John Whitington d0263ac0e4
Merge branch 'trunk' into trunk 2020-07-27 13:53:52 +01:00
Xavier Leroy d374d7d230 tests/unwind: produce trace in case of failure 2020-07-26 11:52:46 +02:00
David Allsopp a651a82488 Fix handling of EOL-at-EOF in ocamltest 2020-07-25 10:04:31 +01:00
EduardoRFS f323d2ad67 arm64 runtime: apply ios assembler requirements 2020-07-25 08:36:23 +00:00
EduardoRFS 42943915a7 arm64 runtime: macro for global and local symbols 2020-07-25 08:36:22 +00:00
Xavier Leroy e41dc9c443
Merge pull request #9752 from xavierleroy/c-calling-conventions
Revised handing of calling conventions for external C functions
2020-07-25 09:50:42 +02:00
Xavier Leroy 9fcb295b98 Revised passing of arguments to external C functions
Introduce the type Cmm.exttype to precisely describe arguments to
external C functions, especially unboxed numerical arguments.

Annotate Cmm.Cextcall with the types of the arguments (Cmm.exttype list).
An empty list means "all arguments have default type XInt".

Annotate Mach.Iextcall with the type of the result (Cmm.machtype)
and the types of the arguments (Cmm.exttype list).

Change (slightly) the API for describing calling conventions in Proc:
- loc_external_arguments now takes a Cmm.exttype list,
  in order to know more precisely the types of the arguments.
- loc_arguments, loc_parameters, loc_results, loc_external_results
  now take a Cmm.machype instead of an array of pseudoregisters.
  (Only the types of the pseudoregisters mattered anyway.)

Update the implementations of module Proc accordingly, in every port.

Introduce a new overridable method in Selectgen, insert_move_extcall_arg,
to produce the code that moves an argument of an external C function
to the locations returned by Proc.loc_external_arguments.

Revise the selection of external calls accordingly
(method emit_extcall_args in Selectgen).
2020-07-24 17:39:22 +02:00
Daniel Bünzli 33dcae9509 Promote failing Dynlink tests: stacktrace line numbers changed. 2020-07-23 11:38:39 +02:00
Daniel Bünzli 1578a359e0 Dynlink.*_unit functions: make sure they call the internal init ().
Otherwise they report inaccurate information before any load
occurs. Closes #9338.
2020-07-23 11:38:39 +02:00
Sébastien Hinderer 9f25b62fb4 Update expected test output
Follow-up to PR #9657
2020-07-21 15:28:54 +02:00
Gabriel Scherer b1d1c0b77c
Merge pull request #9657 from nojb/warning_mnemonics
Add mnemonics for warnings
2020-07-21 11:47:37 +02:00
Nicolás Ojeda Bär 3407c3b22e Update test reference files 2020-07-21 08:11:03 +02:00
Nicolás Ojeda Bär a803cd4cc2
Merge pull request #9781 from yallop/injective-stdlib
Add some injectivity annotations to the standard library.
2020-07-20 19:40:50 +02:00
Nicolás Ojeda Bär 39f637436e Add constructor-mnemonic check to testsuite 2020-07-20 08:31:18 +02:00
Nicolás Ojeda Bär db9b707e0c
Merge pull request #9763 from xavierleroy/remove-old-hash-function
Remove pre-4.00 generic hash function
2020-07-20 08:10:18 +02:00
Matthew Ryan dd7ddf9e71
Fix printing of bindings with polymorphic type annotations and attributes (#9778) 2020-07-20 06:10:13 +02:00
Xavier Leroy cfabfe6edd Add a test for Hashtbl.rebuild 2020-07-19 19:58:06 +02:00
Xavier Leroy 40399cca5e Hashtbl: remove support for pre-4.00 hash tables
When the hash function and the internal representation of hash tables
was changed in 4.00, some compatibility code was left so that "old"
hash tables (created with OCaml < 4.00 and marshaled to files)
could still be operated upon by the functions of the new implementation.

This was 9 years ago, so it is reasonable to expect that none of these
"old" hash tables are still in use.

This commit removes the compatibility code in stdlib/hashtbl.ml.
It still tries to detect "old" hash tables and raise an
Invalid_argument exception instead of crashing.
2020-07-19 19:58:01 +02:00
Jeremy Yallop fb2f26a02e Stdlib injectivity: update tests. 2020-07-18 17:42:06 +01:00
John Whitington 926995b012 Generate moreLabels.mli programatically 2020-07-18 17:12:16 +01:00
John Whitington e8e5b7e73f Make hashtbl.mli / set.mli / map.mli from labeled 2020-07-18 12:03:03 +01:00
Jacques-Henri Jourdan 95400d7ee0 Make Ephemeron compatible with infix pointers. 2020-07-18 08:07:35 +02:00
David Allsopp d2190d192c Adapted lib-stdlabels test for unixLabels 2020-07-17 17:57:15 +01:00
Xavier Leroy 0802bacf4b
Merge pull request #9551 from nojb/microbfd
Implement (in utils/binutils.ml) a simple parser for ELF, Mach-O and PE shared object files.  Use it to get rid of libbfd in ocamlobjinfo and to improve the checking of external primitives during linking in ocamlc.
2020-07-14 10:47:12 +02:00
Thomas Refis 4edc4b9928
pattern aliases do not ignore type constraints (#1655) 2020-07-09 12:20:37 +02:00
Florian Angeletti f879c052b1
Merge pull request #9541 from Engil/instrumented_runtime_manual
Add a chapter for the instrumented runtime
2020-07-08 18:29:44 +02:00
John Whitington dea23a56c5 Restore String.prefix/suffix status quo ante 2020-07-08 12:23:16 +01: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
Enguerrand Decorne f674c275aa instrumented runtime: change environment variable from OCAML_EVENTLOG_FILE to OCAML_EVENTLOG_PREFIX 2020-07-08 03:13:56 +02:00
John Whitington efe8ca02f1 Unify labeled and unlabeled Standard Library modules 2020-07-07 19:34:14 +01:00
Jacques Garrigue 46cec117a4
Fix #9721: Injectivity and recursive modules (#9727) 2020-07-07 09:04:23 +02:00
Nicolás Ojeda Bär 32cc562315 Adapt test 2020-07-02 06:40:10 +02:00
Jacques Garrigue e0ec63ae21
Fix #8747: incorrect principality warning on functional updates of records (#9709) 2020-06-28 23:20:12 +02:00
Leo White 042b1ca737 Fix handling of presence when comparing package types 2020-06-26 14:27:00 +01:00
Leo White cbfd25fe78 Add test for module aliases in package types 2020-06-26 14:24:36 +01:00
Leo White 794a15e5a3 Add tests for missing cmi package type errors 2020-06-26 14:24:36 +01:00
Florian Angeletti 1fb6a464a8
Merge pull request #9244 from lpw25/fix-usage-warnings
Fix usage warnings
2020-06-25 18:21:04 +02:00
Florian Angeletti 457304d075
Merge pull request #9673 from xvw/attempt-to-fix-6633
Add Hint when a module is used in place of a module type
2020-06-25 17:00:37 +02:00
Leo White 1f9be49f02
Merge pull request #9385 from lpw25/fix-copy-scope-bugs
Fix copy scope bugs
2020-06-25 10:59:59 +01:00
Nicolás Ojeda Bär 34dbc549b8
Merge pull request #9533 from bschommer/string-suffix-prefix
String suffix and prefix functions.
2020-06-24 17:39:32 +02:00
Xavier Leroy 4f387e4cb0 Update reference output in no-flat-float-array mode
Follow-up to bd510cdf9
2020-06-24 17:05:42 +02:00
Xavier Leroy a9fad824ca Make some tests conditional on naked pointers support
These tests use the "Is_in_static_data" predicate, which is no longer
supported in no-naked-pointers mode.
2020-06-24 15:25:03 +02:00
xvw 50848feb10 Add Hint when a module is used in place of a module type
Add hint when a module is used instead of a module type or when a
module type is used instead of a module or when a class type is
used instead of a class.
2020-06-24 14:37:03 +02:00
Gabriel Scherer 038fb85bac
Merge pull request #9702 from garrigue/fix9695
Fix #9695: no error when opening an alias to a missing module
2020-06-24 13:23:18 +02:00
Bernhard Schommer e00d7f3a42
Added String prefix and suffix tests.
The functions test if the second argument is a prefix or suffix of the
first argument.
2020-06-24 12:01:55 +02:00
Nicolás Ojeda Bär 7f0dbd4e65
ocamltest: show failing logs (#9696) 2020-06-23 20:47:38 +02:00
Jacques Garrigue ab83af0322 add example without -no-alias-deps 2020-06-23 18:37:37 +02:00
Nicolás Ojeda Bär bd510cdf93
ocamltest: do not compare binaries produced by ocamlopt.opt and ocamlopt.byte (#9677) 2020-06-23 17:36:37 +02:00