Commit Graph

2774 Commits (master)

Author SHA1 Message Date
Xavier Leroy 565c07ceb0 Test redirection of stdout and stderr to the same file descriptor 2020-05-19 19:21:18 +02:00
Stephen Dolan 2d92955749
Remove Const_pointer (#9578)
Since #9316 was merged, Cconst_pointer is compiled in exactly the same way as Cconst_int. This commit removes the now-redundant Cconst_pointer and Cconst_natpointer.
2020-05-19 15:31:08 +02:00
Florian Angeletti faec2de1d6
Merge pull request #9566 from Octachron/testsuite_aliases_and_applicative_functors
tests: aliases and applicative functors
2020-05-18 10:57:29 +02:00
Gabriel Scherer c544d640b6 fix the testsuite (and add -dno-unique-ids where reasonable) 2020-05-16 17:51:54 +02:00
Gabriel Scherer 04d9c425f3 stdlib: provide a sequential interface of the Atomic module from OCaml Multicore
This module provides a purely sequential implementation of the
concurrent atomic references provided by the Multicore OCaml
standard library:

https://github.com/ocaml-multicore/ocaml-multicore/blob/parallel_minor_gc/stdlib/atomic.mli

This sequential implementation is provided in the interest of
compatibility: when people will start writing code to run on
Multicore, it would be nice if their use of Atomic was
backward-compatible with older versions of OCaml without having to
import additional compatibility layers. *)
2020-05-16 17:51:54 +02:00
Sébastien Briais f52fdc2068
Define to_rev_seq in Set and Map module (#9075) 2020-05-15 17:38:45 +02:00
octachron c991225652 tests: aliases and applicative functors
* Enable the full test for 3476
* add the 5058 example
2020-05-15 11:02:05 +02:00
Xavier Leroy 914dd057b5
win32unix: quote the arguments to the Unix.exec* functions (#9550)
Otherwise, arguments get split at spaces.
This is the same quoting that the Win32 implementation of
Unix.create_process does.

A test was added.

Fixes: 9320
2020-05-14 18:15:10 +02:00
Nicolás Ojeda Bär f3e6d27e30 Add test 2020-05-13 20:57:21 +02:00
Gabriel Scherer f81e2b6a59
testsuite: remove a slow exhaustiveness check (#9555)
The test takes 14s to run every time we run the checksuite, and it
does not seem to serve an easily identifiable purpose. In theory
similar tests could help detect a performance regression in
exhaustiveness checking, but this test seems to only degrade in
constant factor (#9152 proposed to use ocamlc.opt instead of ocamlc to
run it, but it was declined as "hiding" potential problems, which
suggests constant-factor differences). We do not monitor the testsuite
for 10s timing difference, so it is unlikely that we would notice
a constant-factor difference during automated testing.
2020-05-13 10:52:56 +02:00
Jacques-Henri Jourdan 629fae6dc4 Add test statmemprof/thread_exit_in_callback. 2020-05-11 17:10:13 +02:00
Gabriel Scherer f7ec223df9 add a known-bug test for buggy 'rec' (non)use in the #show command 2020-05-09 08:43:23 +02:00
Gabriel Scherer 3a43b84e8a compare: correctly compare a Closure_tag with an Infix_tag 2020-05-06 22:29:01 +02:00
KC Sivaramakrishnan 9355b4e8f5
Initialise in caml_obj_block / Obj.new_block only when necessary (#9513)
caml_alloc returns initialised blocks for tag < No_scan_tag. Otherwise,
initialise the blocks as necessary.

For Abtract_tag, Double_tag and Double_array_tag, the initial contents
are irrelevant.

Uninitialised Custom_tag objects are difficult to use correctly. Hence,
reject custom block allocations through Obj.new_block.

For String_tag, the last byte encodes the string length. Hence, reject
zero-length string objects. Initialise the last byte which encodes the
length to ensure non-negative lengths for uninitialised strings.
2020-05-02 18:47:16 +02:00
Nicolás Ojeda Bär e20736dda0
unboxed-primitive-args: test does not require unix (#9517) 2020-04-30 18:26:24 +02:00
David Allsopp 42b8c20cce Fix instrumented-runtime test on OpenBSD 2020-04-30 15:52:50 +01:00
Enguerrand Decorne b7f0494df5 Rewrite the instrumented runtime to store traces in the CTF format.
The instrumentation code in the instrumented runtime was replaced
with new APIs to gather runtime statistics and output them in a new format
(Common Trace Format).
This commit also exposes new functions in the Gc module to pause or resume
instrumentation during a program execution (Gc.eventlog_pause and
Gc.eventlog_resume).
2020-04-30 10:32:01 +02:00
Jeremy Yallop 2e30946419
Support marshalling of bigarrays with dimensions that don't fit in 4 bytes (#8791)
Use a variable-length encoding (suggested by @stedolan) for dimensions that supports dimensions up to 2^64-1 each.

Change the marshalling identifier for bigarrays:_bigarray ~> _bigarr02
The identifier change reflects a change in the bigarray marshalling format.
2020-04-29 18:51:01 +02:00
Stephen Dolan 6923fd1590
fix module_coercion test on no-flat-floatarray mode (#9508) 2020-04-28 17:32:49 +01:00
Jacques-Henri Jourdan 90871480d9 Fix statmemprof/callstacks.ml when --disable-flat-float-array is used.
We do this by using a specific reference file in the case this option is used.
2020-04-27 19:14:55 +02:00
Jacques-Henri Jourdan 687076d662 Remove redundancy in testsuite/tests/statmemprof/comballoc.ml 2020-04-27 18:45:16 +02:00
Stephen Dolan b7716c4625 Update testsuite with new backtrace format, and add test for names 2020-04-27 12:58:53 +01:00
Stephen Dolan 2986beaa78 Replace Location.t with Lambda.scoped_location in Lambda code
This commit threads scopes through translation from Typedtree to
Lambda, extending the scopes when entering functions, modules,
classes and methods.
2020-04-27 12:58:53 +01:00
Nicolás Ojeda Bär 1e98c52e93
Link std_exit.cmo into binaries compiled with -output-complete-exe (#9495) 2020-04-25 13:01:03 +02:00
Mark Shinwell df20ccf838 Fix recursive module initialisation that does not terminate (#9497)
This fixes the bug reported in issue 9494 and adds a test case.

Closes: #9494 
(cherry picked from commit ff98901d11fb01ba224772c402763df20d246635)
2020-04-24 17:50:19 +02:00
Nicolás Ojeda Bär 8f3833c4d0
Add RISC-V native-code backend (#9441)
This is a port of ocamlopt for the RISC-V processor in 64-bit mode.
2020-04-24 16:04:50 +02:00
madroach 82700678b2
Don't include stdio.h in caml/misc.h (#9483)
* Don't include stdio.h in caml/misc.h
There is no need to include stdio.h in caml/misc.h
This seems to have happened by accident in commit cddec18fde
On OpenBSD, stderr and stdout are macros defined in stdio.h
ppx_expect uses stderr and stdout as identifiers in
collector/expect_test_collector_stubs.c where caml/misc.h is included.
This confuses the C compiler, because the macro will get expanded where an identifier is expected.

* Remove fallback NULL definition in caml/misc.h

ISO C guarantees that NULL is defined in <stddef.h>

* include missing stdio in tests/compatibility/stub.c
2020-04-24 14:27:32 +02:00
Leo White 2a50fef1ae
Merge pull request #9415 from lpw25/fix-open-struct-in-flambda-toplevel
Treat `open struct` as `include struct` in toplevel
2020-04-23 14:00:24 +01:00
Leo White 2ea16f6a8e Treat `open struct` as `include struct` in toplevel 2020-04-23 10:51:44 +01:00
Thomas Refis 9f49a71e90
Add forgotten substitution when compiling anonymous modules (#9477)
Fixes #9375
2020-04-23 10:55:40 +02:00
David Allsopp d732593c85 Test for linking archives with no modules 2020-04-22 14:17:29 +01:00
David Allsopp f4dc3003d5
Merge pull request #9457 from dra27/fix-mod_use
Fix #mod_use in toplevel
2020-04-20 16:13:26 +01:00
Florian Angeletti c5a1f91900
Merge pull request #9345 from Octachron/reproducible_env
Reproducible env summaries
2020-04-20 14:20:57 +02:00
Gabriel Scherer 702e34fbe5
Merge pull request #9463 from lthls/fix_int64_cmm_typ
Fix Cmm type of unboxed integers in Clet_mut
2020-04-20 11:34:15 +02:00
Florian Angeletti c041b0389e env summary: don't record implicit cmi files
We don't want to record the state of the file system at the start
of the compilation in the compiled files.
Consequently, we only add persistent modules to the env summary
if they have an observable action on the initial environment.
This is only the case if they shadow a non-persistent module of the
initially opened library (which can only be Stdlib currently).
2020-04-20 10:13:20 +02:00
Nicolás Ojeda Bär 91bbdac1f5
Fix asmcomp unit name test for bsd (#9473) 2020-04-19 17:53:57 +02:00
Nicolás Ojeda Bär ec6690fb53
x86 asm: handle unit names with special characters (#9465) 2020-04-19 11:17:00 +02:00
Gabriel Scherer 5722f78e31 add a regression test for issue 9460
See <https://github.com/ocaml/ocaml/issues/9460>.
We currently expect this test to fail on 32bit systems, and succeed on 64bits systems.

Contributed by Richard Jones.
2020-04-18 11:39:25 +02: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 9e0515f554 type_args: forbid optional arguments commuting when [ignore_labels=true] 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
Thomas Refis 046da6cd2e testsuite: -nolabels, commutes now, might get eliminated later 2020-04-18 11:01:52 +02:00
Thomas Refis 245a071938 testsuite: -nolabels and commuting optional arguments 2020-04-18 11:01:52 +02:00
Leo White a40889d6d9
Merge pull request #9393 from lpw25/improve-recmodule-usage-warnings
Improve recursive module usage warnings
2020-04-18 09:11:22 +01:00
Leo White 5f16c55316 Improve usage warnings for recursive modules 2020-04-18 08:08:54 +01:00
Leo White dd8218f8aa Add test for usage warnings of recursive modules 2020-04-18 08:08:54 +01:00
Leo White 8dcdda9674 Prohibit signature local types with constraints 2020-04-18 07:54:12 +01:00
Leo White 17257491b8 Add regression test 2020-04-18 07:54:12 +01:00
David Allsopp 528bd78c25 Add a test for #mod_use 2020-04-17 16:28:20 +01:00
Florian Angeletti 9108648867
Merge pull request #9409 from Octachron/yet_another_implicit_deps_error
packed modtype lookup can fail due to missing cmi
2020-04-17 16:28:19 +02:00
octachron 35dbd85b3e packed modtype lookup can fail due to missing cmi
This commit removes an assert false and makes the missing
cmi case behaves like the abstract case.
2020-04-17 11:22:38 +02:00
Leo White 59fac074fe
Merge pull request #9349 from lpw25/inline-hint
Add [@inlined hint] attribute
2020-04-17 08:27:58 +01:00
Leo White f46abe1916 Add [@inlined hint] attribute 2020-04-16 15:58:03 +01:00
Stephen Dolan 2208a4cbe6
Fix tail-call optimisation with a mutable ref (#9443)
Fix tail-call optimisation with a mutable ref
(Clet_mutable was not recognized properly in tail position.)

Add a test for tail-call optimisation with a mutable ref
2020-04-13 18:20:56 +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
Gabriel Scherer 7612a6d9b1 [minor] fix a Makefile warning by defining undefined variables
Report by Xavier Leroy:
  https://github.com/ocaml/ocaml/pull/9414#issuecomment-610231289
2020-04-07 15:06:12 +02:00
Florian Angeletti abda688b03
Merge pull request #1706 from Octachron/extension_disambiguated_bis
Spellchecker hints and type-directed disambiguation for extensible variants: bis
2020-04-06 11:28:37 +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
Gabriel Scherer 1d76e2ca91
Merge pull request #9365 from gasche/Set-Map-filter_map
Map.filter_map and Set.filter_map
2020-04-02 17:59:51 +02:00
Gabriel Scherer 45697b3583 testsuite/Makefile: allow users to explicit set KEEP_TEST_DIR_ON_SUCCESS=1 2020-04-02 16:19:36 +02:00
Gabriel Scherer 89b41c3219 testsuite/Makefile: refactor the -promote ocamltest logic
The existing approach requires to set all ocamltest flags at once on
recursive calls. This is very inconvenient if we want to set more than
one flag -- we wish to support choosing both -promote
and -keep-test-dir-on-success.
2020-04-02 16:07:20 +02:00
Gabriel Scherer 017d4a3ead
Merge pull request #9254 from gasche/memprof-record
Gc.Memprof.start: take a record instead of 5 optional parameters
2020-04-02 02:27:55 +02:00
Gabriel Scherer ff6b20098f Gc.Memprof.start: take a record instead of 5 optional parameters
The Gc.Memprof module provides a low-level API, that will hopefully be
paired with user libraries that provide high-level instrumentation
choices.

A natural question is: how are the higher-level API going to expose
their choice of instrumentation to their users? With the current
Memprof.start API (before this patch), they would have to either
provide their own `start` function wrapping Memprof.start, or provide
a tuple of callbacks for to their users to pass to Memprof.start
themselves.

    val start : params -> unit
    (* or *)
    val callback : params ->
      ((allocation -> foo option) * (allocation -> bar option) * ... )

With an explicit record, it is easier for libraries to expose an
instrumentation choice (possibility parametrized over
user-provided settings):

    val tracker : params -> (foo, bar) Gc.Memprof.tracker

In addition, providing a record instead of optional parameters makes
it much easier to provide "default settings" (helper functions) that
instantiates the types `'minor` and `'ḿajor`, see for example
`simple_tracker` in this patch (which stores the same information for
the minor and major heap, and does not observe promotion), or to later
define checking predicates that can verify that a given choice of
callbacks is sensible (for example: providing a major-dealloc callback
but no promotion callback (dropping all tracked value on promotion) is
probably not a good idea).

Bootstrap: to avoid requiring an awkward bootstrap, this commit keeps
the (now unused) function caml_memprof_start_byt unchanged -- it is
used in the bootstrap binaries, so removing it would break the
build. The intention is to remove it in the following commit.
2020-04-01 16:37:28 +02:00
Thomas Refis 1e78d1e10c
add more principality warnings examples for applications (#9408) 2020-04-01 10:30:30 +02:00
Gabriel Scherer 1cd6e4451f Map.filter_map and Set.filter_map 2020-03-31 15:01:41 +02:00
Jacques Garrigue e10e2bfa99
add optional argument principality examples (#9405) 2020-03-31 13:52:22 +02:00
Greta Yorsh 824ce35492
Replace caml_int_compare and caml_float_compare with primitives (#2324) 2020-03-26 10:58:10 +01:00
David Allsopp e4f3aa8c81 Don't assume . in AWKPATH
Ensure all script invocations explicitly refer to a directory.
2020-03-20 09:38:33 +00:00
David Allsopp bc867cebf8 Use $AWK not awk
Ensures gawk is used if available.
2020-03-20 09:36:07 +00:00
Jérémie Dimino c7de942730
Fix #9344 (#9368)
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2020-03-17 11:38:45 +00:00
Stephen Dolan 6246d5ce03
Merge pull request #9367 from stedolan/unify-backtraces
Make bytecode and native-code backtraces agree
2020-03-17 10:45:34 +00:00
Stephen Dolan 07d0192b22 Generate the same backtraces for method send in bytecode and native 2020-03-16 18:15:09 +00:00
Stephen Dolan cc7b687a02 Generate the same locations for raises in bytecode and native code 2020-03-16 18:15:09 +00:00
Jérémie Dimino e54876a869
Add a new toplevel directive #use_output "<command>"
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
Co-authored-by: David Allsopp <david.allsopp@metastack.com>
2020-03-16 17:48:41 +00: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 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 7e370000d3 update testsuite 2020-03-05 13:35:14 +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
Leo White 9de0113e94 Add test for short-paths in error messages 2020-03-03 18:01:13 +00:00
David Allsopp cf2db2b625 tests/tool-ocamldep-modalias is not parallel 2020-02-27 13:34:39 +00:00
David Allsopp 48e7150cc8 Testsuite is not parallel 2020-02-26 10:08:56 +00:00
David Allsopp 67c011b883
Revert "AppVeyor speed-ups" 2020-04-20 09:55:54 +01:00
David Allsopp c97b73c056
Merge pull request #9454 from dra27/faster-appveyor
AppVeyor speed-ups
2020-04-20 09:53:51 +01:00
David Allsopp 9fdd31f11b tests/tool-ocamldep-modalias is not parallel 2020-02-27 13:34:39 +00:00
David Allsopp 2ddcdf10a8 Testsuite is not parallel 2020-02-26 10:08:56 +00:00
Stephen Dolan de9e630852 Assert that Cassign is only used on Clet_mut-bound variables 2020-02-25 15:23:38 +00:00
Stephen Dolan 1336ce0c0d Use typing information from Clambda for mutable Cmm variables 2020-02-25 15:03:14 +00:00
Florian Angeletti bb15443a23 Revert "Make asmgen tests run"
This reverts commit e168edc67d.
2020-02-24 11:20:14 +01:00
Gabriel Scherer 9d8897db14
Merge pull request #9318 from trefis/empty_in_or_pattern
Fix exhaustivity checking in presence of empty types
2020-02-21 13:12:34 +01:00
Guillaume Bury 0d362f6abf Fix arith.cmm test
An error was triggered on the floating point computations because of
rounding errors between the read from the D array, and the C-side fp
computation which used 80-bit precision.
2020-02-20 15:37:39 +01:00
Guillaume Bury e168edc67d Make asmgen tests run
Relative paths are needed in ocamltest (rather than plain executable
file names), because else 'execvp' searches for the executable in the
PATH instead of the current directory.
2020-02-20 15:37:30 +01:00
Stefan Muenzel 6b94a5500d Add a test showing that the exhaustiveness check doesn't work with the empty variant 2020-02-19 13:30:16 +01:00
Florian Angeletti edabf2008c Merge pull request #9292 from lpw25/fix-best-fit-32-bit
Fix bug in best-fit on 32-bit

(cherry picked from commit 9e52341ece4e8c73087d622d2900cf3a97c6fe7b)
2020-02-11 10:45:36 +01:00
Nicolás Ojeda Bär 87296ee8e0
Dynlink: preserve module initializers backtrace (#9183)
* dynlink: preserve backtrace of module initializers
* Stabilize debug event sort
* Update test reference file
2020-02-06 07:21:23 +01:00
Pieter Goetschalckx 99224a96b7
Quoted extensions in comments, ocamllex and ocamlyacc (#9166)
* Support quoted extensions in comments
* Support quoted extensions in ocamllex
* Support quoted extensions in ocamlyacc
* Fix copying of comments in ocamlyacc
2020-02-03 10:55:28 +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
Gabriel Scherer 13ab6b4a64
Merge pull request #2188 from rlepigre/recursive-yet-unboxed
Recursive yet unboxed
2020-01-29 10:16:33 +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
Jacques-Henri Jourdan ca5f81ccd0 Fix callstack test by forcing flambda not to optimize. 2020-01-28 14:47:20 +00:00
Jacques-Henri Jourdan 35104694b5 Fix test comballoc.ml 2020-01-28 14:47:20 +00: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 c62c9d19f9 separability: add some interesting examples to the testsuite 2020-01-28 12:09:33 +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 20b62c8386 Cleaned up [@@unbox] validity check. 2020-01-28 11:39:52 +01:00
Stephen Dolan f874b3ee01 Memprof: report different callstacks for different combined allocations 2020-01-25 22:55:56 +01:00
Stephen Dolan 07bf49db5b Statmemprof support for native allocations (incl. Comballoc) 2020-01-25 22:55:56 +01:00
Gabriel Scherer d408e58ea1
Merge pull request #9261 from lthls/rec_check_ignore_fix
Fix soundness bug in Rec_check with anonymous let module
2020-01-24 22:06:37 +01:00
Gabriel Scherer a6825861ee
Merge pull request #9247 from jhjourdan/memprof-byte-loc
Memprof: get precise callstacks when memory is allocated directly in the bytecode interpreter
2020-01-24 22:06:00 +01:00
Vincent Laviron 31a14e3082 Fix the regression test 2020-01-24 14:50:48 +01:00
Vincent Laviron 643fe20ab0 Add regression test 2020-01-24 14:29:56 +01:00
Florian Angeletti dc56d71b53 types: allow class type paths in #t 2020-01-20 17:21:02 +01:00
Leo White c272447b1e Relax the handling of explicit polymorphic types 2020-01-20 13:48:16 +00:00
Jeremy Yallop 73a37d45f8 Add Seq.unfold. 2020-01-15 15:38:46 +00:00
Jacques-Henri Jourdan c4d7bcd352 Memprof: get precise callstacks when memory is allocated directly in the bytecode interpreter.
This includes two changes: first, in bytegen.ml, we add a pseudo-event after every allocation or closure instruction. Second, in the interpreter, we save the current PC in the interpreter stack in [Setup_for_gc].
2020-01-15 11:59:51 +01:00
Jacques-Henri Jourdan e1a22e80fb Memprof API: cannot be start if already running, cannot be stopped if not already running. 2020-01-14 10:42:16 +01:00
Jeremy Yallop 38eb6d5f64
Add Array.for_all2 and Array.exists2 (#9235)
* Partially revert "Removed for_all2, exists2 and find again."

This partially reverts commit 83dcf62ebf.

(Restore for_all2 and exists2.)

* Partially revert "Fixed typos and changed exists2 and for_all2."

This partially reverts commit 7a082785be.

* Array.(for_all2,exists2): simplify documentation; add @since annotations

* Changes: remove trailing whitespace
2020-01-13 13:52:39 +00:00
Jacques-Henri Jourdan 0c8416478c Drop support for tags in memprof.
They are somewhat difficult to handle for native allocations, and it is not clear how useful they are. Moreover, they are easy to add back since [Gc.Memprof.allocation] is a private record.
2020-01-11 13:19:10 +01: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
Florian Angeletti 40e40a9c20 compilerlibs: expose parsers for 'Longident.t's 2020-01-09 16:45:39 +01:00
Gabriel Scherer 50da1ce8c3 Merge pull request #9212 from kit-ty-kate/fix-dynlink
Fix access to C symbols when using Dynlink

(cherry picked from commit c67990cedea7932b5b1a877c1479c9b7b9f910da)
2020-01-09 15:28:38 +01:00
Gabriel Scherer 8938886721 -dno-locations: hide source locations (and debug events) from IR dumps
This PR was tested with also the -dsel, -dlinear output (also fixed to
not-print locations), but the output is architecture-dependent so this
part of the test was removed.
2020-01-09 15:25:16 +01:00
Jacques-Henri Jourdan 52661f14a4 Make ocamlc preserve events after primitives even if they are at tail position. 2020-01-09 00:16:42 +01:00
Gabriel Scherer 73bed21afe
Merge pull request #9225 from stedolan/bytecode-debug-info-dropped
Do not drop bytecode debug info after C calls
2020-01-07 22:05:09 +01:00
Stephen Dolan 2d21433573 Do not drop bytecode debug info after C calls 2020-01-07 10:32:41 +00:00
Jacques-Henri Jourdan d5d972d377 Fix test c-api/alloc_async_stubs.c.
We must wait for two major cycles to finish in order to make sure that finalizers have indeed be examined.
2020-01-06 14:16:12 +01:00
Jacques-Henri Jourdan 7dbbfce890 New ephemeron-free API for Memprof.
The user can register several callbacks, which are called for various
events during the block's lifetime. We need to maintain a data
structure for tracked blocks in the runtime. When using threads,
callbacks can be called concurrently in a reentrant way, so the
functions manipulating this data structure need to be reentrant.
2019-12-21 10:21:48 +01:00
Stephen Dolan 291cbaf1d1 Make tuple matching optimisation apply to Lswitch and Lstringswitch. 2019-12-19 14:29:34 +00:00
Fourchaux 1f9474c63c Fixing typos (#9162) 2019-12-04 19:38:02 +00:00
Jacques Garrigue a33f80bf00
fix typo in name + improve style in type_pat (#9161) 2019-12-04 15:06:17 +01:00
Gabriel Scherer f572295def
Merge pull request #463 from gasche/robust-ocamlobjinfo
objinfo: tell when the object file comes from a different OCaml version
2019-12-03 10:36:13 +01:00
Gabriel Scherer 9d81d6a10e new Misc.Magic_number module for magic number handling
This module was originally inspired by js_of_ocaml Misc.MagicNumber module
https://github.com/ocsigen/js_of_ocaml/blob/151b811/compiler/util.cppo.ml#L277-L347

It provides parsing and validation function for magic numbers, that
can tell the difference between "not a valid magic number" and "a
valid magic number, but with another version", and print user-friendly
user messages about it.

It does not contain any knowledge for where to find the magic number
in an OCaml file (this depends on the file format); the parsing
function should be called with an input channel already at the right
position for whichever format is expect.
2019-12-03 00:08:29 +01:00
Jacques Garrigue 27ef14dab9
Fix exhaustivity of GADTs coming from incomplete unification (#9154) 2019-12-02 20:49:51 +01:00
Florian Angeletti b768c0be59 Highlighting in the manual
* Replace caml-sl with the standard listings package
and ulem package
* update caml_tex to output nicer latex code
* simplify escaping in caml_tex
2019-11-28 11:45:08 +01:00
Gabriel Scherer 05f15cf215
Merge pull request #8820 from Drup/stringquot
Quoted extensions
2019-11-25 21:26:53 +01:00
David Allsopp 504d95c275 Fix formatting of closing brace in records 2019-11-21 12:06:53 +00:00
David Allsopp 2c82bfb35b
Merge pull request #9121 from dra27/fix-force-safe-string
Fix error in patch to configure.ac from #1859, with follow-on corrections
2019-11-17 08:44:38 +00:00
Konstantin Romanov a9b0ca44d2 Add set_position and set_filename to Lexing. 2019-11-16 22:14:16 +00:00
David Allsopp 2801fdf011 Fix cloexec test for force-safe-string 2019-11-14 11:18:43 +00:00
Gabriel Scherer 757a64464f ocamldoc: better support of multiline code blocks in the manpage backend
Before, `man Map` would show:

```
For instance: module IntPairs = struct type t = int * int let compare (x0,y0) (x1,y1) = match Stdlib.compare x0 x1 with 0 -> Stdlib.compare y0 y1 |
c -> c end module PairsMap = Map.Make(IntPairs) let m = PairsMap.(empty |> add (0,1) hello |> add (1,0) world )
```

Now it shows:

```
For instance:
     module IntPairs =
       struct
         type t = int * int
         let compare (x0,y0) (x1,y1) =
           match Stdlib.compare x0 x1 with
               0 -> Stdlib.compare y0 y1
             | c -> c
       end

     module PairsMap = Map.Make(IntPairs)

     let m = PairsMap.(empty |> add (0,1) "hello" |> add (1,0) "world")
```

(in both cases the code is in bold)
2019-11-14 11:31:05 +01:00
Drup 4092d8fc49 Fix locations for quoted extensions ids. 2019-11-13 16:08:41 +01:00
Drup 9c8b63f4ce Annotated Asttypes.constant's string with content location. 2019-11-13 16:08:40 +01:00
Drup abc53d1a6e Annotate constant literals with the location of their content. 2019-11-13 16:08:40 +01:00
Drup ddbfa18ab9 Test quoted extensions. 2019-11-13 14:54:28 +01:00
Gabriel Scherer 6465616fd9 improved error messages for exceptions in signature errors
Example:

    module Test : sig
      exception Foo
    end = struct
    end

Before this PR:

    Modules do not match: sig end is not included in sig exception Foo end
    The extension constructor `Foo' is required but not provided

After this PR (second line changed):

    Modules do not match: sig end is not included in sig exception Foo end
    The exception `Foo' is required but not provided
2019-11-12 14:16:39 +01:00
Bernhard Schommer e5ebec7058 Fold map function for List (#8894)
The fold_map function is quite common combination of fold and map
which allow it to pass an accumulator through map.
2019-11-07 14:12:58 +01:00
Leo White fb33b74bca Relax the level handling when unifying row fields (#9064) 2019-11-07 09:38:46 +00:00
Gabriel Scherer 92bfafc1ac
Merge pull request #8805 from stedolan/statmemprof-comballoc-native
Keep information about allocation sizes, for statmemprof, and use during GC.
2019-11-06 13:44:14 +01:00
Simon Parry f43323be52 Fix toplevel show directive to work with constructors
The show directive now has some basic facility to show
useful information for constructors of "normal" values,
exceptions and other non-exception extension constructors.

Also updated show_type to print out recursion status
with a default of Trec_first.
2019-11-05 20:02:03 +00:00
Gabriel Scherer b667fec2e7
Merge pull request #9079 from garrigue/refactor-ppat_of_type
Typecore.type_pat: refactor ppat_of_type and Need_backtrack in wildcards
2019-11-04 17:03:32 +01:00
Jacques Garrigue da3295c3af Typecore.type_pat: refactor ppat_of_type and Need_backtrack in wildcards
There is a small, desirable change of behavior in this PR:
we do not backtrack on all wildcard pattern explosions,
only on those where ppat_of_type knows there will be GADTs.
As a result, some exhaustivity counter-examples
have been improved with more cases (see testsuite for an example).
2019-11-04 15:20:56 +01:00
Greta Yorsh 3f36ed3d74 Tests for -stop-after scheduling 2019-10-30 19:05:23 +00:00
Gabriel Scherer 8b237caad1
Merge pull request #9074 from Octachron/regularity_error_message
#9069: reworded error messages for non-regular structural types
2019-10-30 11:04:18 +01:00
Florian Angeletti ee32976da1 reworded errors for non-regular structural types
* explicitly mention that the type definition is non-regular
* avoid implicit permutation in type parameters
* don't try to propose a "fix"
2019-10-30 10:02:31 +01:00
Nicolas Ojeda Bar 7b48e5549a Add test 2019-10-29 09:45:54 +01:00
zapashcanon c0e4096eaa add List.filteri to the stdlib (#9059) 2019-10-29 09:45:19 +01:00
Florian Angeletti 29ae0078b9 testsuite: exotic strict-sequence behavior 2019-10-25 10:16:33 +02:00
Stephen Dolan 787e2d05a7 Apply suggestions from code review, and make depend.
Co-Authored-By: Damien Doligez <damien.doligez@gmail.com>
2019-10-22 11:47:31 +01:00
Jacques-Henri Jourdan 1b17cc4e9c Fix tests/backtrace/callstack.ml by changing the order of the content of that file. (#9063)
The original test had a race condition between finalization and thread preemption.
That was probably the cause for the wrong backtrace observed here:
https://github.com/ocaml/ocaml/pull/8641#issuecomment-544231899
2019-10-21 14:45:59 +02:00
Leo White 25edeab66b
Improve errors for first-class modules (#8903)
* Improve errors for first-class modules

* Changes based on Jacques' suggestions

* Add Changes entry
2019-10-18 11:41:48 +01:00
Gabriel Scherer 87fdcd336e
Merge pull request #1848 from trefis/doctest
more docstring tests
2019-10-17 17:35:08 +02:00
Florian Angeletti 6f772ec21c
Merge pull request #8860 from Octachron/safer_type_expr_printer
#8856: cyclic type expressions in error submessages
2019-10-17 16:28:04 +02:00
Florian Angeletti 816a5088e0 Avoid duplicated mark_loops 2019-10-17 10:03:58 +02:00
Jacques Garrigue c147442b01
Fix #7636 using expansion for vanishing parameters (#9040) 2019-10-16 18:02:40 +02:00
Florian Angeletti 86248f1162 make Printtyp.type_expr safer to use 2019-10-16 15:50:59 +02:00
David Allsopp 13786d7d12 Ensure make distclean works on an unconfigured tree 2019-10-15 11:46:36 +01:00
Stephen Dolan fd568688d7 Remove the transformation untag_int(tag_int x) = x. (#9032)
This transformation is incorrect for certain large values of x,
as it can get the wrong value in the high bit. In certain cases
where the high bit is not used (esp. storing a byte into a string),
the transformation is kept intact.

Fixes #9028.
2019-10-14 14:39:17 +02:00
Thomas Refis 79f1c73462
Warn about unused functor parameters (#8891) 2019-10-14 11:11:01 +01:00
Gabriel Scherer cc1a05b055
Merge pull request #8651 from proux01/printf-h
Add printf '%#F' to output floats in hexadecimal OCaml constants
2019-10-14 11:43:01 +02:00
Jacques-Henri Jourdan 23e5bfa3bb Better stack backtraces for C calls in bytecode (#8641)
The previous mechanism worked for C calls that raise an exception, but not for C calls that call back into OCaml code which raises an exception.

This commit addresses the issue by saving the PC in the interpreter stack before a C call, so that the backtrace mechanism always sees it.

However, if an external is declared in the .ml file and exposed in the .mli file as a val, then ocamlc generates a wrapper that adds a spurious entry in the stack frame. In this PR, this change in behavior results in the re-declaration of Printexc.get_callstack as an external instead of a val, so that the spurious stack frame does not appear in call stacks obtained from Printexc.get_callstack.
2019-10-12 18:25:58 +02:00
Jacques-Henri Jourdan edb358c1eb Add test for #9027. 2019-10-11 11:19:24 +02:00
Thomas Refis 8e928caea7
a better representation for modules with no name (#8908) 2019-10-09 14:15:37 +01:00
David Allsopp fb6f58ea69
Merge pull request #8951 from shindere/make-default-target
Let make's default target build the compiler
2019-10-04 14:23:27 +01:00
Nicolás Ojeda Bär e606e49b16 Add test 2019-10-03 13:55:38 +02:00
Gabriel Scherer ba90da42ac List.concat_map : ('a -> 'b list) -> 'a list -> 'b list (#8760) 2019-10-01 15:53:14 +01:00
Gabriel Scherer 5fc29e52a4
Merge pull request #8992 from Octachron/shared_args
Share argument implementations
2019-10-01 12:08:54 +02:00
Jacques Garrigue 1e895dbaee
Allow compiling ocamldoc with -principal (#8955)
Also solves issue #6922
2019-09-30 21:14:06 +02:00
Sébastien Hinderer 987b0814d7 Let make's default target build the compiler
This commit makes it possible to build the OCaml compiler according to
its configuration by simply runnning make. There is no need to specify
neither world nor world.opt explicitly, although the two targets
remain available.

This commit also introduces (and starts making use of) the
NATIVE_COMPILER build variable whosse value is true when the native
compiler is enabled and false otherwise.
2019-09-30 16:01:29 +02:00
Florian Angeletti a509157eb9 share argument implementation across executable
This commit defines five default argument modules in
Main_args.default. Those modules provide a default implementation
for the argument of ocaml, ocamlnat, ocamlc, ocamlopt, ocamldoc,
ocamlcp, ocamloptp, and expect_test.

Grouping together those implementations allow to share as much as
possible similar implementation across executables. It should make
easier to keep synchronized the various implementation, or reuse
those implementation in alternative drivers.
2019-09-30 15:56:40 +02:00
Florian Angeletti 91c762a427 Merge dump_live and print_live 2019-09-30 15:56:40 +02:00
Nicolás Ojeda Bär 9ed5f3c1a5 Promote typing-misc/enrich-typedecl.ml 2019-09-28 18:03:59 +02:00
Nicolás Ojeda Bär 21ab659f47 Promote match-exception-warnings tests 2019-09-28 18:03:59 +02:00
Nicolás Ojeda Bär 62a7df6052 Adapt tool-caml-tex tests 2019-09-28 18:03:59 +02:00
Nicolás Ojeda Bär 3d7fc7530a Remove ocamltests files 2019-09-28 18:03:59 +02:00
Nicolás Ojeda Bär 147741f681 Adapt Makefile 2019-09-28 18:03:59 +02:00
Pierre Roux 1e3cd41fe7 Add printf `%#F` to output floats in hexadecimal OCaml constants 2019-09-26 15:55:32 +02:00
David Allsopp 7dd55f8cdd Fix redefine_largefile.ml test
The reference file included EOL at EOF but the test didn't produce one.
2019-09-25 20:09:36 +01:00
Nicolás Ojeda Bär 3aff5141fd Add a new -output-complete-exe option (#8872)
This option allows to build self-contained bytecode executable and is aimed to replace `-custom`. The main difference between the two is that executables produced by `-output-compete-exe` can be stripped.
2019-09-25 08:07:31 +01:00
Stephen Dolan b3720334e2
Merge pull request #8974 from gasche/robust-obj-id-test
Move the Obj.id+serialization tests from expect tests to reference tests
2019-09-24 12:19:10 -04:00
Gabriel Scherer 0c16e3939d Move the Obj.id+serialization tests from expect tests to reference tests
Thoses test should *not* be toplevel or expect-style tests, because
then the Obj.id counter of the compiler implementation (called by the
bytecode read-eval-print loop) is the same as the Obj.id counter of
the test code below. In particular, any change to the compiler
implementation to use more objects or exceptions will change the
reference numbers, making the test fragile in a very surprising way.

I found the issue while working on #8968, which hits the bug.

I tested this PR by adding a spurious

    let exception Unused in
    ignore Unused;

in typing/typecore.ml:unify_pat_types. Before this PR,

    make one DIR=tests/typing-objects

would be broken by the change. After this PR,

    make one DIR=tests/typing-objects
    make one DIR=tests/runtime-objects

works fine.

(no change entry needed)
2019-09-24 16:43:06 +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
Sébastien Hinderer d22bbd4db8 Accept ocamltests files not terminated by a newline 2019-09-24 06:55:07 +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 f56b59d017
Fix "open struct .. end" on clambda backend (#8944) 2019-09-17 06:50:11 -04:00
Gabriel Scherer 5c7c619d4d List.find_map : ('a -> 'b option) -> 'a list -> 'b option (#8832) 2019-09-13 17:58:01 +02:00
Armaël Guéneau 133994824e PR#8611: fix test tool-toplevel/pr6468.ml 2019-09-11 20:29:47 +02:00
Kyle Miller 03ddf295d5 Fix source highlighting for long toplevel phrases (#7925) (#8611)
Fix #7925: error messages for long toplevel inputs would have dummy locations
2019-09-11 20:07:34 +02:00
Kate c01dbc1bab Enable force-safe-string by default (#1859)
* Enable force-safe-string by default

* Run the autogen script

* Add a line to the changelog

* Remove test using the -unsafe-string argument

* Disable program comparison for tests giving different binaries between ocamlopt.opt and ocamlopt.byte after switching to force-safe-string by default

* Add a comment where the compare_programs tests have been disabled to refer to an explaination of the problem
2019-09-10 17:49:20 +02:00
Pierre Chambart 81d0d1924c Add a test for #8919 2019-09-09 18:36:55 +02:00
Pieter Goetschalckx 30fbae7265 Octal character literals and apostrophes in ocamlyacc actions (#1932) 2019-09-06 16:12:54 +02:00
Gabriel Scherer bf240cbab5
Merge pull request #8914 from gasche/clarify-unboxed-warning
clarify the warning of the unboxable-type-in-primitive warning
2019-09-05 21:01:42 +02:00
Gabriel Scherer e8498699f9 clarify the warning of the unboxable-type-in-primitive warning
A discussion in a forum thread
  https://discuss.ocaml.org/t/primitive-declaration-is-unannotated-and-unboxable/4306
points out that 'unboxable' is ambiguous as it can be read as either
un-boxable or unbox-able.

This commit reformulates the warning to avoid using 'unboxable', but
the very explicit 'may be either boxed or unboxed', along with a more
detailed explanation of the issue that the warning is about.
2019-09-05 17:09:06 +02:00
Gabriel Scherer 1ba9dce47f typing/oprint: improve printing of functor arguments
This commit improves the printing of mixed anonymous/non-anonymous
functor signatures from (before)

    module type LongFunctor =
      functor (X : A) -> B -> functor (Z : C) -> D -> E -> sig end

to (with this commit)

    module type LongFunctor =
      functor (X : A) (_ : B) (Z : C) -> D -> E -> sig end
2019-09-04 21:18:16 +02:00
Gabriel Scherer 331b322ab5 typing/oprint: rework printing of functor arguments
The new implementation is closer to the grammar rules, and I find it
easier about.

For example, I was able to implement the long-form-or-short-form
heuristic easily, improving the printing from (before)

    module type LongFunctor =
      functor (X : A) -> B -> functor (Z : C) -> D -> E -> sig end

to (with this commit)

    module type LongFunctor =
      functor (X : A) (_ : B) (Z : C) -> D -> E -> sig end

The printing should be exactly the same as with the previous
implementation -- thanks to the help of Florian Angeletti.
2019-09-03 17:48:13 +02:00
Gabriel Scherer 071bae4c5f typing/oprint: [minor] improve printing of empty signatures 2019-09-03 11:44:21 +02:00
Florian Angeletti 2bd33ee515
Merge pull request #8906 from Octachron/functor_arrow_associativity
Print parentheses in (A->B)->C
2019-09-02 17:51:17 +02:00
Florian Angeletti 740baf0317 Print parentheses in (A->B)->C 2019-09-02 15:16:47 +02:00
Florian Angeletti 0bc69e41a0
Merge pull request #8904 from Octachron/break_for_functor_args
printing: add a break hint after functor arguments
2019-08-30 10:11:53 +02:00
Gabriel Scherer fd7cbd8c49
Merge pull request #8729 from jhjourdan/memprof_intern
Memprof support for unmarshalled data
2019-08-29 22:39:46 +02:00
Florian Angeletti 6032e9cf49 oprint: add break hint after functor args 2019-08-29 14:48:46 +02:00
David Allsopp 2195dbaad0
Merge pull request #8897 from stedolan/fix-alloc-async
Ensure that C allocation functions do not trigger callbacks
2019-08-29 13:36:47 +01:00
Jacques-Henri Jourdan 857d32b94b Fix test on Windows. 2019-08-29 09:36:42 +01:00
Stephen Dolan dcf346450b Ensure that C allocation functions do not trigger callbacks.
Fixes a bug in #8691 and adds a test.
2019-08-29 09:35:42 +01:00
Thomas Refis 560f4b5cd0
Merge pull request #8885 from trefis/w60-local-mod
Warn about unused local modules
2019-08-29 09:26:24 +01:00
Thomas Refis 4a22aeccb5 warning 60: enable on local modules 2019-08-28 13:24:10 +01:00
Thomas Refis 46f180138f testsuite: missing unused module warning 2019-08-28 13:24:10 +01:00
Thomas Refis a818f1db23 testsuite: add more examples of the Scoping_pack error 2019-08-28 12:36:24 +01:00
Thomas Refis 754fec2677 update tests 2019-08-28 12:02:01 +01:00
Jacques-Henri Jourdan 90073e96e5 Memprof tracking of interned data. 2019-08-27 19:14:56 +02:00
Stephen Dolan 5ad64306d3
Merge pull request #8713 from kayceesrk/r14-globals
Move C global variables to a dedicated structure
2019-08-27 13:30:22 +01:00
David Allsopp f61bb77691 Fix compatibility test recipe 2019-08-26 17:27:35 +02:00
David Allsopp fae3345930 Compatibility test 2019-08-24 13:00:41 +02:00
Thomas Refis d233009cc9 testsuite: add a regression test for Scoping_pack error 2019-08-23 14:28:27 +01:00
Thomas Refis 57ebc987b3 testsuite: implicit_unpack use expect_test 2019-08-23 14:28:27 +01:00
KC Sivaramakrishnan c298390b5d Fix tests/asmgen for msvc32 2019-08-23 09:50:05 +05:30
KC Sivaramakrishnan fdd4d73b43 Domain state support for i386 2019-08-23 09:50:05 +05:30
KC Sivaramakrishnan c06038a0ee Move backtrace support global variables to domain state.
Since we cannot access backtrace position in cmmgen.ml anymore,
Cmm.raise_kind in removed. Instead, we use Lambda.raise_kind. When
assembly code is generated, we reset the backtrace position to 0 in the
case of regular raise. Importantly, the semantics remains the same.
2019-08-23 09:50:05 +05:30
Thomas Refis f2db8ca4ae
Merge pull request #2127 from lpw25/lookup-errors
Refactor lookup functions
2019-08-21 15:48:06 +01:00
Florian Angeletti a2d15b26d1
Merge pull request #8844 from MekhrubonT/trunk+mekh+1task+change_output
Improved error messages for type mismatches
2019-08-16 20:43:02 +02:00
Gabriel Scherer a72855eaaa
Merge pull request #8874 from Lereena/typing-misc-add
Add some tests for typechecking error messages
2019-08-16 18:31:50 +02:00
Thomas Refis f532be5158
Merge pull request #8871 from trefis/pr8862
subst: preserve scopes (fixes #8862)
2019-08-16 10:15:45 +01:00
Leo White c19e8b2350 Refactor environment lookup functions 2019-08-15 15:56:50 +01:00
Leo White 27f621da75 Add some tests related to instance variables 2019-08-15 11:03:50 +01:00
Leo White 4af0a0026d Add more unused constructor tests 2019-08-15 11:03:50 +01:00
Oxana 3e728c3899 Add tests for includeclass errors 2019-08-14 12:31:10 +03:00
Thomas Refis f03f510464 subst: don't lose scope 2019-08-13 14:17:46 +01:00
Thomas Refis 27b9aeaecd testsuite: add a test for #8862 2019-08-13 14:15:42 +01:00
Gabriel Scherer b08c4e2efc matching.ml: correct a missed optimization opportunity in split_no_or
One optimization in split_no_or is the insertion of a split before
a last matrix line that has only variables. Splitting a matrix there
creates two default environments (instead of one for the non-split
matrix), the first of which often gets specialized away by further
refinement, and the second one jumping directly to the catch-all
case -- this produces better code.

The code would detect this case (all-variable last row) by calling
`group_var` on all the patterns of the row, but the `group_*`
functions assume that their input is already simplified, and only the
first column of the row is simplified.

The present commit fixes it by defining a predicates that does not
assume the pattern is simple, and check that "all its heads" are
a variable. In the future we will refactor this code using
Parmatch.Simple_head.t, and the function invocation may change.

Note: two testcases are changed in tests/basic/patmatch_split_no_or,
the first is the actual optimization and the second is just
stamp-related noise.
2019-08-13 15:10:20 +02:00
Thomas Refis 3a55b73bd1 matching: add some documentation 2019-08-13 15:10:19 +02:00
Gabriel Scherer f53218d312
Merge pull request #8861 from trefis/matching-split_no_or
[matching.ml cleanup] merge split_constr and split_naive
2019-08-09 15:52:12 +02:00
Oxana 7087e24fe4 Add type variable name test 2019-08-09 12:27:03 +03:00
Vincent Laviron 0557f07e70 Fix lsl overflow detection (#8865)
The formula for Misc.no_overflow_lsl a k is sound only if k < width of type int.
2019-08-09 09:42:11 +02:00
Mekhrubon Turaev 38c3710eea Rollbacking changes of Constructor_names and Label_names errors message 2019-08-08 12:04:03 +01:00
Greta Yorsh e08a9688fc Eliminate dead `ICatch` handlers (#2321) 2019-08-06 12:23:13 +01:00