├── compilerlibs └── .gitignore ├── stdlib ├── sharpbang ├── .ignore └── stdlib.mllib ├── testsuite ├── lib │ └── empty ├── .ignore ├── tests │ ├── basic │ │ ├── arrays.reference │ │ ├── stringmatch.reference │ │ ├── float.reference │ │ ├── maps.reference │ │ ├── tailcalls.reference │ │ ├── recvalues.reference │ │ ├── includestruct.reference │ │ ├── bigints.reference │ │ ├── constprop.reference │ │ ├── divint.reference │ │ └── sets.reference │ ├── letrec │ │ ├── lists.reference │ │ ├── class_1.reference │ │ ├── backreferences.reference │ │ ├── float_block_2.reference │ │ ├── class_2.reference │ │ ├── mutual_functions.reference │ │ ├── record_with.reference │ │ ├── float_block_1.reference │ │ ├── mixing_value_closures_1.reference │ │ ├── mixing_value_closures_2.reference │ │ ├── evaluation_order_1.reference │ │ ├── evaluation_order_2.reference │ │ └── evaluation_order_3.reference │ ├── embedded │ │ ├── .ignore │ │ └── program.reference │ ├── lib-set │ │ ├── testmap.reference │ │ └── testset.reference │ ├── misc │ │ ├── bdd.reference │ │ ├── weaklifetime.reference │ │ ├── boyer.reference │ │ ├── fib.reference │ │ ├── takc.reference │ │ ├── taku.reference │ │ ├── weaktest.reference │ │ └── nucleic.reference │ ├── basic-private │ │ └── tlength.reference │ ├── exotic-syntax │ │ └── exotic.reference │ ├── lib-string │ │ └── test_string.reference │ ├── lib-threads │ │ ├── .ignore │ │ ├── token1.reference │ │ ├── token2.reference │ │ ├── test4.data │ │ ├── test9.reference │ │ ├── test8.reference │ │ ├── torture.data │ │ ├── test6.reference │ │ ├── test4.reference │ │ ├── torture.reference │ │ ├── close.reference │ │ ├── test5.reference │ │ ├── testsocket.reference │ │ ├── testA.reference │ │ ├── test-file-short-lines │ │ ├── testexit.reference │ │ └── testio.reference │ ├── ppx-attributes │ │ └── warning.reference │ ├── backtrace │ │ ├── backtrace.a.reference │ │ ├── backtraces_and_finalizers.reference │ │ ├── backtrace..reference │ │ ├── backtrace.c.reference │ │ ├── backtrace.d.reference │ │ ├── backtrace.b.reference │ │ └── backtraces_and_finalizers.ml │ ├── basic-modules │ │ ├── main.reference │ │ ├── offset.ml │ │ ├── main.ml │ │ └── pr6726.ml │ ├── lib-random │ │ ├── rand.reference │ │ └── rand.ml │ ├── lib-scanf │ │ ├── .ignore │ │ └── tscanf.reference │ ├── runtime-errors │ │ ├── .ignore │ │ ├── stackoverflow.bytecode.reference │ │ ├── stackoverflow.native.reference │ │ ├── syserror.bytecode.reference │ │ └── syserror.native.reference │ ├── basic-float │ │ └── tfloat_record.reference │ ├── basic-multdef │ │ └── usemultdef.reference │ ├── misc-unsafe │ │ ├── quicksort.reference │ │ ├── almabench.reference │ │ ├── fft.reference │ │ └── soli.reference │ ├── regression │ │ ├── pr6024 │ │ │ └── pr6024.reference │ │ ├── pr5757 │ │ │ └── pr5757.reference │ │ └── pr5233 │ │ │ └── pr5233.reference │ ├── tool-debugger │ │ ├── basic │ │ │ ├── .ignore │ │ │ ├── debuggee.ml │ │ │ ├── debuggee.reference │ │ │ └── input_script │ │ ├── no_debug_event │ │ │ ├── a.ml │ │ │ ├── input_script │ │ │ ├── .ignore │ │ │ ├── b.ml │ │ │ └── noev.reference │ │ └── find-artifacts │ │ │ ├── .ignore │ │ │ ├── in │ │ │ ├── blah.ml │ │ │ └── foo.ml │ │ │ ├── input_script │ │ │ └── debuggee.reference │ ├── float-unboxing │ │ ├── float_subst_boxed_number.reference │ │ ├── Makefile │ │ └── float_subst_boxed_number.ml │ ├── lib-digest │ │ └── md5.reference │ ├── typing-labels │ │ ├── mixin.reference │ │ ├── mixin2.reference │ │ └── mixin3.reference │ ├── typing-objects │ │ ├── pr6383.ml │ │ ├── pr5858.ml │ │ ├── pr6383.ml.reference │ │ ├── pr5858.ml.reference │ │ ├── pr5545.ml.reference │ │ ├── pr5545.ml.principal.reference │ │ ├── pr6123_bad.ml.reference │ │ ├── pr6123_bad.ml.principal.reference │ │ ├── pr5545.ml │ │ ├── pr6123_bad.ml │ │ ├── pr5619_bad.ml │ │ └── pr5619_bad.ml.reference │ ├── basic-more │ │ ├── pr6216.reference │ │ ├── morematch.reference │ │ ├── tbuffer.reference │ │ ├── tformat.reference │ │ ├── tprintf.reference │ │ ├── pr2719.reference │ │ ├── bounds.reference │ │ ├── pr6216.ml │ │ ├── testrandom.reference │ │ └── pr2719.ml │ ├── basic-io │ │ └── wc.reference │ ├── lib-bigarray │ │ ├── pr5115.reference │ │ └── fftba.reference │ ├── prim-revapply │ │ ├── revapply.reference │ │ └── apply.reference │ ├── tool-lexyacc │ │ └── .ignore │ ├── match-exception │ │ ├── match_failure.reference │ │ ├── nested_handlers.reference │ │ ├── allocation.reference │ │ ├── tail_calls.reference │ │ ├── exception_propagation.reference │ │ ├── streams.reference │ │ ├── raise_from_success_continuation.reference │ │ ├── exception_propagation.ml │ │ ├── raise_from_success_continuation.ml │ │ ├── tail_calls.ml │ │ └── match_failure.ml │ ├── tool-ocamldoc │ │ ├── .ignore │ │ ├── t02.reference │ │ ├── t03.reference │ │ ├── t02.ml │ │ ├── t03.ml │ │ └── t01.ml │ ├── typing-modules │ │ ├── d.ml │ │ ├── a.mli │ │ ├── b3.mli │ │ ├── pr5911.ml │ │ ├── printing.ml │ │ ├── pr5911.ml.reference │ │ ├── printing.ml.reference │ │ ├── b2.ml │ │ └── b.ml │ ├── callback │ │ └── reference │ ├── parsing │ │ └── pr6865.ml │ ├── typing-polyvariants-bugs-2 │ │ ├── pr3918a.mli │ │ ├── pr3918b.mli │ │ └── pr3918c.ml │ ├── lib-format │ │ ├── pr6824.reference │ │ └── pr6824.ml │ ├── lib-dynlink-bytecode │ │ ├── .ignore │ │ ├── custom.reference │ │ ├── static.reference │ │ └── main.reference │ ├── warnings │ │ ├── w51.reference │ │ ├── w51.ml │ │ ├── w51_bis.reference │ │ ├── w06.ml │ │ ├── w51_bis.ml │ │ ├── w06.reference │ │ └── w01.reference │ ├── asmcomp │ │ └── .ignore │ ├── lib-str │ │ ├── t01.ml │ │ └── t01.reference │ ├── prim-bswap │ │ └── bswap.reference │ ├── tool-toplevel │ │ └── tracing.ml │ ├── typing-recmod │ │ ├── t01bad.ml │ │ ├── t04bad.ml │ │ ├── t15bad.ml │ │ ├── t07bad.ml │ │ ├── t02bad.ml │ │ ├── t03ok.ml │ │ ├── t06ok.ml │ │ ├── t05bad.ml │ │ ├── t13ok.ml │ │ ├── t10ok.ml │ │ ├── t11bad.ml │ │ ├── t08bad.ml │ │ ├── t09bad.ml │ │ ├── t14bad.ml │ │ ├── t12bad.ml │ │ ├── t19ok.ml │ │ ├── t18ok.ml │ │ └── t21ok.ml │ ├── lib-scanf-2 │ │ └── reference │ ├── lib-dynlink-native │ │ ├── .ignore │ │ └── reference │ ├── lib-stream │ │ └── count_concat_bug.reference │ ├── tool-ocaml │ │ ├── t000.ml │ │ ├── t010-const0.ml │ │ ├── t010-const1.ml │ │ ├── t010-const2.ml │ │ ├── t010-const3.ml │ │ ├── t011-constint.ml │ │ ├── t050-getglobal.ml │ │ ├── t020.ml │ │ ├── t021-pushconst1.ml │ │ ├── t021-pushconst2.ml │ │ ├── t021-pushconst3.ml │ │ ├── t022-pushconstint.ml │ │ ├── t050-pushgetglobal.ml │ │ ├── t040-makeblock1.ml │ │ ├── t040-makeblock2.ml │ │ ├── t051-getglobalfield.ml │ │ ├── t060-raise.ml │ │ ├── t330-compact-1.ml │ │ ├── t040-makeblock3.ml │ │ ├── t051-pushgetglobalfield.ml │ │ ├── t190-makefloatblock-1.ml │ │ ├── t041-makeblock.ml │ │ ├── t160-closure.ml │ │ ├── t190-makefloatblock-2.ml │ │ ├── t070-branchifnot.ml │ │ ├── t101-poptrap.ml │ │ ├── t250-closurerec-1.ml │ │ ├── t071-boolnot.ml │ │ ├── t100-pushtrap.ml │ │ ├── t190-makefloatblock-3.ml │ │ ├── t080-neq.ml │ │ ├── t080-gtint.ml │ │ ├── t080-ltint.ml │ │ ├── t162-return.ml │ │ ├── t070-branch.ml │ │ ├── t070-branchif.ml │ │ ├── t080-eq.ml │ │ ├── t092-pushacc0.ml │ │ ├── t080-geint.ml │ │ ├── t080-leint.ml │ │ ├── t163.ml │ │ ├── t150-push-1.ml │ │ ├── t110-offsetint.ml │ │ ├── t110-divint-1.ml │ │ ├── t110-divint-2.ml │ │ ├── t110-mulint.ml │ │ ├── t110-andint.ml │ │ ├── t110-asrint-2.ml │ │ ├── t110-lslint.ml │ │ ├── t110-lsrint.ml │ │ ├── t110-modint-1.ml │ │ ├── t110-orint.ml │ │ ├── t110-xorint.ml │ │ ├── t092-pushacc1.ml │ │ ├── t110-asrint-1.ml │ │ ├── t164-apply2.ml │ │ ├── t090-acc0.ml │ │ ├── t240-c_call1.ml │ │ ├── t240-c_call2.ml │ │ ├── t120-getstringchar.ml │ │ ├── t110-negint.ml │ │ ├── t164-apply3.ml │ │ ├── t200-getfield0.ml │ │ ├── t130-vectlength.ml │ │ ├── t090-acc1.ml │ │ ├── t092-pushacc2.ml │ │ ├── t110-addint.ml │ │ ├── t110-subint.ml │ │ ├── t200-getfield1.ml │ │ ├── t130-getvectitem.ml │ │ ├── t220-assign.ml │ │ ├── t192-getfloatfield-1.ml │ │ ├── t192-getfloatfield-2.ml │ │ ├── t200-getfield2.ml │ │ ├── t191-vectlength.ml │ │ ├── t092-pushacc3.ml │ │ ├── t090-acc2.ml │ │ ├── t240-c_call3.ml │ │ ├── t165-apply.ml │ │ ├── t200-getfield3.ml │ │ ├── t230-check_signals.ml │ │ ├── t201-getfield.ml │ │ ├── t092-pushacc4.ml │ │ ├── t090-acc3.ml │ │ ├── t142-switch-8.ml │ │ ├── t250-closurerec-2.ml │ │ ├── t260-offsetref.ml │ │ ├── t140-switch-3.ml │ │ ├── t142-switch-9.ml │ │ ├── t142-switch-A.ml │ │ ├── t140-switch-4.ml │ │ ├── t140-switch-1.ml │ │ ├── t140-switch-2.ml │ │ ├── t092-pushacc5.ml │ │ ├── t090-acc4.ml │ │ └── t301-object.ml │ ├── typing-fstclassmod │ │ └── fstclassmod.reference │ ├── formats-transition │ │ ├── legacy_unfinished_modifiers.ml.reference │ │ ├── Makefile │ │ ├── deprecated_unsigned_printers.ml.reference │ │ ├── invalid_formats.ml │ │ ├── legacy_unfinished_modifiers.ml │ │ ├── deprecated_unsigned_printers.ml │ │ ├── legacy_incompatible_flags.ml │ │ └── ignored_scan_counters.ml.reference │ ├── typing-rectypes-bugs │ │ ├── pr6870_bad.ml │ │ ├── pr6174_bad.ml │ │ └── pr5343_bad.ml │ ├── typing-gadts │ │ ├── pr5906.ml.reference │ │ ├── pr6174.ml │ │ ├── pr6174.ml.reference │ │ ├── pr5785.ml │ │ ├── pr6174.ml.principal.reference │ │ ├── pr5848.ml.reference │ │ ├── pr5848.ml │ │ ├── pr6158.ml │ │ ├── pr6241.ml │ │ ├── pr6163.ml │ │ ├── pr6817.ml.reference │ │ ├── pr5332.ml │ │ ├── pr5785.ml.reference │ │ ├── pr5997.ml │ │ ├── pr5981.ml │ │ ├── pr5906.ml │ │ ├── pr6817.ml │ │ ├── pr6158.ml.reference │ │ ├── pr6241.ml.reference │ │ ├── pr6163.ml.reference │ │ ├── pr5989.ml │ │ ├── pr6241.ml.principal.reference │ │ ├── pr5332.ml.reference │ │ └── pr6163.ml.principal.reference │ ├── typing-misc-bugs │ │ └── pr6303_bad.ml │ ├── typing-modules-bugs │ │ ├── pr6899_first_bad.ml │ │ ├── pr6899_second_bad.ml │ │ ├── pr6293_bad.ml │ │ ├── pr6899_ok.ml │ │ ├── pr5663_ok.ml │ │ ├── pr5164_ok.ml │ │ ├── pr6651_ok.ml │ │ ├── pr6240_ok.ml │ │ ├── pr5914_ok.ml │ │ ├── pr6572_ok.ml │ │ ├── pr51_ok.ml │ │ ├── pr6427_bad.ml │ │ └── pr6513_ok.ml │ ├── lib-systhreads │ │ └── testfork.reference │ ├── typing-extensions │ │ └── Makefile │ ├── typing-short-paths │ │ ├── pr5918.ml │ │ ├── pr6836.ml │ │ ├── pr5918.ml.reference │ │ └── pr6836.ml.reference │ ├── translprim │ │ └── Makefile │ ├── typing-signatures │ │ ├── pr6672.ml │ │ ├── pr6371.ml │ │ ├── pr6371.ml.reference │ │ └── pr6672.ml.reference │ ├── typing-misc │ │ ├── occur_check.ml │ │ ├── variant.ml │ │ ├── wellfounded.ml.reference │ │ ├── wellfounded.ml.principal.reference │ │ ├── wellfounded.ml │ │ ├── labels.ml │ │ ├── variant.ml.reference │ │ ├── labels.ml.reference │ │ ├── labels.ml.principal.reference │ │ ├── polyvars.ml │ │ ├── occur_check.ml.reference │ │ └── constraints.ml │ ├── typing-warnings │ │ ├── pr5892.ml │ │ ├── pr6872.ml │ │ ├── coercions.ml │ │ ├── unused_types.ml │ │ ├── pr5892.ml.reference │ │ ├── coercions.ml.reference │ │ ├── unused_types.ml.reference │ │ └── coercions.ml.principal.reference │ ├── lib-dynlink-csharp │ │ ├── bytecode.reference │ │ ├── native.reference │ │ └── main.cs │ ├── prim-bigstring │ │ ├── bigstring_access.reference │ │ ├── string_access.reference │ │ └── Makefile │ ├── typing-objects-bugs │ │ ├── pr4824_ok.ml │ │ ├── pr4766_ok.ml │ │ ├── pr4824a_bad.ml │ │ ├── pr4435_bad.ml │ │ ├── woodyatt_ok.ml │ │ ├── pr5156_ok.ml │ │ └── pr3968_bad.ml │ ├── typing-private-bugs │ │ ├── pr5469_ok.ml │ │ └── pr5026_bad.ml │ ├── typing-poly-bugs │ │ ├── pr5322_ok.ml │ │ ├── pr5673_ok.ml │ │ └── pr5673_bad.ml │ ├── lib-printf │ │ ├── pr6534.reference │ │ └── pr6534.ml │ ├── typing-polyvariants-bugs │ │ ├── pr5057a_bad.ml │ │ ├── pr4775_ok.ml │ │ ├── pr5057_ok.ml │ │ └── pr4933_ok.ml │ ├── basic-io-2 │ │ ├── test-file-short-lines │ │ └── io.reference │ ├── match-exception-warnings │ │ ├── exhaustiveness_warnings.ml │ │ └── exhaustiveness_warnings.ml.reference │ ├── lib-hashtbl │ │ ├── hfun.reference │ │ └── htbl.reference │ └── lib-bigarray-2 │ │ └── bigarrf.f └── interactive │ ├── lib-graph-3 │ └── sorts.reference │ ├── lib-graph-2 │ └── graph_test.reference │ └── lib-graph │ └── graph_example.reference ├── utils └── .ignore ├── emacs └── .ignore ├── config ├── .ignore └── auto-aux │ ├── .ignore │ ├── sharpbang │ ├── sharpbang2 │ └── cfi.S ├── native-tests ├── Status.txt ├── test15.ml ├── test16.mli ├── test17.mli ├── test6.mli ├── test7.mli ├── test8.mli ├── test3.ml ├── test1.ml ├── test10.ml ├── test2.ml ├── test9.mli ├── test18.ml ├── test12.ml ├── test13.ml ├── test20.ml ├── test4.ml ├── test19.ml ├── test14.ml ├── test5.ml ├── test11.ml ├── test6.ml ├── test16.c ├── test17.c ├── test6.c ├── test7.c └── test8.c ├── otherlibs ├── dynlink │ ├── .ignore │ └── dynlinkaux.mlpack ├── str │ ├── libstr.clib │ └── .depend ├── systhreads │ ├── .ignore │ ├── libthreads.clib │ └── threads.mllib ├── num │ ├── libnums.clib │ ├── nums.mllib │ └── nat.ml ├── threads │ ├── unix.mllib │ ├── libvmthreads.clib │ ├── .ignore │ └── threads.mllib ├── unix │ └── unix.mllib ├── graph │ ├── graphics.mllib │ └── libgraphics.clib ├── win32graph │ ├── .ignore │ └── libgraphics.clib ├── bigarray │ ├── libbigarray.clib │ └── libbigarraywin32.clib └── win32unix │ ├── .depend │ └── .ignore ├── .ocp-indent ├── bytecomp └── .ignore ├── experimental ├── garrigue │ ├── .cvsignore │ ├── dirs_multimatch │ ├── dirs_poly │ ├── printers.ml │ ├── variable-names.ml │ ├── countchars.ml │ └── tests.ml └── frisch │ ├── test_matches.ml │ ├── test_copy_typedef.mli │ ├── test_copy_typedef.ml │ ├── test_builder.ml │ ├── test_ifdef.ml │ ├── test_nomli.ml │ ├── test_js.ml │ └── testdoc.mli ├── byterun ├── caml │ └── .ignore └── .ignore ├── yacc └── .ignore ├── boot ├── ocamlc ├── ocamldep ├── ocamllex └── .ignore ├── .travis.yml ├── lex └── .ignore ├── asmcomp └── .ignore ├── debugger └── .ignore ├── VERSION ├── parsing └── .ignore ├── .ignore ├── ocamldoc └── .ignore ├── tools ├── .ignore └── magic ├── asmrun └── .ignore └── .travis-ci.sh /compilerlibs/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /stdlib/sharpbang: -------------------------------------------------------------------------------- 1 | #! -------------------------------------------------------------------------------- /testsuite/lib/empty: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testsuite/.ignore: -------------------------------------------------------------------------------- 1 | _log 2 | -------------------------------------------------------------------------------- /utils/.ignore: -------------------------------------------------------------------------------- 1 | config.ml 2 | -------------------------------------------------------------------------------- /emacs/.ignore: -------------------------------------------------------------------------------- 1 | ocamltags 2 | *.elc 3 | -------------------------------------------------------------------------------- /testsuite/tests/basic/arrays.reference: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testsuite/tests/letrec/lists.reference: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /config/.ignore: -------------------------------------------------------------------------------- 1 | m.h 2 | s.h 3 | Makefile 4 | -------------------------------------------------------------------------------- /native-tests/Status.txt: -------------------------------------------------------------------------------- 1 | Broken: test9 2 | -------------------------------------------------------------------------------- /otherlibs/dynlink/.ignore: -------------------------------------------------------------------------------- 1 | extract_crc 2 | -------------------------------------------------------------------------------- /otherlibs/str/libstr.clib: -------------------------------------------------------------------------------- 1 | strstubs.o 2 | -------------------------------------------------------------------------------- /otherlibs/systhreads/.ignore: -------------------------------------------------------------------------------- 1 | thread.ml 2 | -------------------------------------------------------------------------------- /testsuite/tests/basic/stringmatch.reference: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testsuite/tests/embedded/.ignore: -------------------------------------------------------------------------------- 1 | caml 2 | -------------------------------------------------------------------------------- /testsuite/tests/letrec/class_1.reference: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testsuite/tests/lib-set/testmap.reference: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testsuite/tests/lib-set/testset.reference: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testsuite/tests/misc/bdd.reference: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /testsuite/tests/misc/weaklifetime.reference: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /config/auto-aux/.ignore: -------------------------------------------------------------------------------- 1 | camlp4_config.ml 2 | -------------------------------------------------------------------------------- /otherlibs/num/libnums.clib: -------------------------------------------------------------------------------- 1 | bng.o nat_stubs.o 2 | -------------------------------------------------------------------------------- /otherlibs/threads/unix.mllib: -------------------------------------------------------------------------------- 1 | Unix UnixLabels 2 | -------------------------------------------------------------------------------- /otherlibs/unix/unix.mllib: -------------------------------------------------------------------------------- 1 | Unix UnixLabels 2 | -------------------------------------------------------------------------------- /testsuite/tests/basic-private/tlength.reference: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testsuite/tests/exotic-syntax/exotic.reference: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testsuite/tests/letrec/backreferences.reference: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testsuite/tests/letrec/float_block_2.reference: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testsuite/tests/lib-string/test_string.reference: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testsuite/tests/lib-threads/.ignore: -------------------------------------------------------------------------------- 1 | *.byt 2 | -------------------------------------------------------------------------------- /testsuite/tests/lib-threads/token1.reference: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testsuite/tests/lib-threads/token2.reference: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testsuite/tests/misc/boyer.reference: -------------------------------------------------------------------------------- 1 | Proved! 2 | -------------------------------------------------------------------------------- /testsuite/tests/misc/fib.reference: -------------------------------------------------------------------------------- 1 | 165580141 2 | -------------------------------------------------------------------------------- /testsuite/tests/misc/takc.reference: -------------------------------------------------------------------------------- 1 | 14000 2 | -------------------------------------------------------------------------------- /testsuite/tests/misc/taku.reference: -------------------------------------------------------------------------------- 1 | 14000 2 | -------------------------------------------------------------------------------- /testsuite/tests/misc/weaktest.reference: -------------------------------------------------------------------------------- 1 | pass 2 | -------------------------------------------------------------------------------- /testsuite/tests/ppx-attributes/warning.reference: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.ocp-indent: -------------------------------------------------------------------------------- 1 | match_clause=4 2 | strict_with=auto 3 | -------------------------------------------------------------------------------- /bytecomp/.ignore: -------------------------------------------------------------------------------- 1 | runtimedef.ml 2 | opcodes.ml 3 | -------------------------------------------------------------------------------- /config/auto-aux/sharpbang: -------------------------------------------------------------------------------- 1 | #! /bin/cat 2 | exit 1 3 | -------------------------------------------------------------------------------- /experimental/garrigue/.cvsignore: -------------------------------------------------------------------------------- 1 | *.out 2 | *.out2 3 | -------------------------------------------------------------------------------- /otherlibs/systhreads/libthreads.clib: -------------------------------------------------------------------------------- 1 | st_stubs_b.o 2 | -------------------------------------------------------------------------------- /otherlibs/threads/libvmthreads.clib: -------------------------------------------------------------------------------- 1 | scheduler.o 2 | -------------------------------------------------------------------------------- /testsuite/interactive/lib-graph-3/sorts.reference: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testsuite/tests/backtrace/backtrace.a.reference: -------------------------------------------------------------------------------- 1 | a 2 | -------------------------------------------------------------------------------- /testsuite/tests/basic-modules/main.reference: -------------------------------------------------------------------------------- 1 | 1 2 | -------------------------------------------------------------------------------- /testsuite/tests/letrec/class_2.reference: -------------------------------------------------------------------------------- 1 | f 2 | g 3 | -------------------------------------------------------------------------------- /testsuite/tests/letrec/mutual_functions.reference: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testsuite/tests/letrec/record_with.reference: -------------------------------------------------------------------------------- 1 | 42 2 | -------------------------------------------------------------------------------- /testsuite/tests/lib-random/rand.reference: -------------------------------------------------------------------------------- 1 | PASSED 2 | -------------------------------------------------------------------------------- /testsuite/tests/lib-scanf/.ignore: -------------------------------------------------------------------------------- 1 | tscanf_data 2 | -------------------------------------------------------------------------------- /testsuite/tests/misc/nucleic.reference: -------------------------------------------------------------------------------- 1 | 33.7976 2 | -------------------------------------------------------------------------------- /testsuite/tests/runtime-errors/.ignore: -------------------------------------------------------------------------------- 1 | *.bytecode 2 | -------------------------------------------------------------------------------- /config/auto-aux/sharpbang2: -------------------------------------------------------------------------------- 1 | #! /usr/bin/cat 2 | exit 1 3 | -------------------------------------------------------------------------------- /otherlibs/graph/graphics.mllib: -------------------------------------------------------------------------------- 1 | Graphics GraphicsX11 2 | -------------------------------------------------------------------------------- /testsuite/interactive/lib-graph-2/graph_test.reference: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testsuite/interactive/lib-graph/graph_example.reference: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testsuite/tests/basic-float/tfloat_record.reference: -------------------------------------------------------------------------------- 1 | 1. 2 | -------------------------------------------------------------------------------- /testsuite/tests/basic-multdef/usemultdef.reference: -------------------------------------------------------------------------------- 1 | 2 2 | -------------------------------------------------------------------------------- /testsuite/tests/basic/float.reference: -------------------------------------------------------------------------------- 1 | 1./.0. = inf 2 | -------------------------------------------------------------------------------- /testsuite/tests/letrec/float_block_1.reference: -------------------------------------------------------------------------------- 1 | x 2 | y 3 | -------------------------------------------------------------------------------- /testsuite/tests/letrec/mixing_value_closures_1.reference: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testsuite/tests/letrec/mixing_value_closures_2.reference: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /byterun/caml/.ignore: -------------------------------------------------------------------------------- 1 | jumptbl.h 2 | opnames.h 3 | version.h 4 | -------------------------------------------------------------------------------- /otherlibs/win32graph/.ignore: -------------------------------------------------------------------------------- 1 | graphics.ml 2 | graphics.mli 3 | -------------------------------------------------------------------------------- /testsuite/tests/lib-threads/test4.data: -------------------------------------------------------------------------------- 1 | abc 2 | def 3 | ghi 4 | -------------------------------------------------------------------------------- /testsuite/tests/lib-threads/test9.reference: -------------------------------------------------------------------------------- 1 | f G 2 | g F 3 | -------------------------------------------------------------------------------- /testsuite/tests/misc-unsafe/quicksort.reference: -------------------------------------------------------------------------------- 1 | OK 2 | OK 3 | -------------------------------------------------------------------------------- /testsuite/tests/regression/pr6024/pr6024.reference: -------------------------------------------------------------------------------- 1 | @-@- 2 | -------------------------------------------------------------------------------- /testsuite/tests/tool-debugger/basic/.ignore: -------------------------------------------------------------------------------- 1 | compiler-libs 2 | -------------------------------------------------------------------------------- /testsuite/tests/tool-debugger/no_debug_event/a.ml: -------------------------------------------------------------------------------- 1 | let x = 1 2 | -------------------------------------------------------------------------------- /native-tests/test15.ml: -------------------------------------------------------------------------------- 1 | effect E : unit 2 | let () = perform E 3 | -------------------------------------------------------------------------------- /otherlibs/bigarray/libbigarray.clib: -------------------------------------------------------------------------------- 1 | bigarray_stubs.o mmap_unix.o 2 | -------------------------------------------------------------------------------- /testsuite/tests/backtrace/backtraces_and_finalizers.reference: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /testsuite/tests/float-unboxing/float_subst_boxed_number.reference: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testsuite/tests/lib-digest/md5.reference: -------------------------------------------------------------------------------- 1 | Test vectors passed. 2 | -------------------------------------------------------------------------------- /testsuite/tests/lib-threads/test8.reference: -------------------------------------------------------------------------------- 1 | 3 2 | un 3 | deux 4 | -------------------------------------------------------------------------------- /testsuite/tests/lib-threads/torture.data: -------------------------------------------------------------------------------- 1 | abc 2 | def 3 | ghi 4 | -------------------------------------------------------------------------------- /testsuite/tests/regression/pr5757/pr5757.reference: -------------------------------------------------------------------------------- 1 | hello world 2 | -------------------------------------------------------------------------------- /testsuite/tests/typing-labels/mixin.reference: -------------------------------------------------------------------------------- 1 | y 2 | -6 + x 3 | 9 4 | -------------------------------------------------------------------------------- /testsuite/tests/typing-objects/pr6383.ml: -------------------------------------------------------------------------------- 1 | let f (x: #M.foo) = 0;; 2 | -------------------------------------------------------------------------------- /otherlibs/threads/.ignore: -------------------------------------------------------------------------------- 1 | marshal.mli 2 | pervasives.mli 3 | unix.mli 4 | -------------------------------------------------------------------------------- /otherlibs/win32graph/libgraphics.clib: -------------------------------------------------------------------------------- 1 | open.o draw.o events.o dib.o 2 | -------------------------------------------------------------------------------- /testsuite/tests/basic-more/pr6216.reference: -------------------------------------------------------------------------------- 1 | 2 | All tests succeeded. 3 | -------------------------------------------------------------------------------- /testsuite/tests/letrec/evaluation_order_1.reference: -------------------------------------------------------------------------------- 1 | y 2 | x 3 | z 4 | -------------------------------------------------------------------------------- /testsuite/tests/letrec/evaluation_order_2.reference: -------------------------------------------------------------------------------- 1 | x 2 | y 3 | z 4 | -------------------------------------------------------------------------------- /testsuite/tests/lib-threads/test6.reference: -------------------------------------------------------------------------------- 1 | A: world 2 | B: hello 3 | -------------------------------------------------------------------------------- /testsuite/tests/typing-labels/mixin2.reference: -------------------------------------------------------------------------------- 1 | y 2 | -6 + x 3 | 9 4 | -------------------------------------------------------------------------------- /testsuite/tests/typing-labels/mixin3.reference: -------------------------------------------------------------------------------- 1 | y 2 | -6 + x 3 | 9 4 | -------------------------------------------------------------------------------- /native-tests/test16.mli: -------------------------------------------------------------------------------- 1 | external caml_to_c : unit -> unit = "caml_to_c" 2 | -------------------------------------------------------------------------------- /native-tests/test17.mli: -------------------------------------------------------------------------------- 1 | external caml_to_c : unit -> unit = "caml_to_c" 2 | -------------------------------------------------------------------------------- /native-tests/test6.mli: -------------------------------------------------------------------------------- 1 | external caml_to_c : unit -> unit = "caml_to_c" 2 | -------------------------------------------------------------------------------- /native-tests/test7.mli: -------------------------------------------------------------------------------- 1 | external caml_to_c : unit -> unit = "caml_to_c" 2 | -------------------------------------------------------------------------------- /native-tests/test8.mli: -------------------------------------------------------------------------------- 1 | external caml_to_c : unit -> unit = "caml_to_c" 2 | -------------------------------------------------------------------------------- /otherlibs/bigarray/libbigarraywin32.clib: -------------------------------------------------------------------------------- 1 | bigarray_stubs.o mmap_win32.o 2 | -------------------------------------------------------------------------------- /otherlibs/systhreads/threads.mllib: -------------------------------------------------------------------------------- 1 | Thread Mutex Condition Event ThreadUnix 2 | -------------------------------------------------------------------------------- /otherlibs/threads/threads.mllib: -------------------------------------------------------------------------------- 1 | Thread Mutex Condition Event ThreadUnix 2 | -------------------------------------------------------------------------------- /testsuite/tests/basic-io/wc.reference: -------------------------------------------------------------------------------- 1 | 2013 characters, 233 words, 66 lines 2 | -------------------------------------------------------------------------------- /testsuite/tests/basic-more/morematch.reference: -------------------------------------------------------------------------------- 1 | 2 | All tests succeeded. 3 | -------------------------------------------------------------------------------- /testsuite/tests/basic-more/tbuffer.reference: -------------------------------------------------------------------------------- 1 | 0 1 2 | All tests succeeded. 3 | -------------------------------------------------------------------------------- /testsuite/tests/basic-more/tformat.reference: -------------------------------------------------------------------------------- 1 | 0 2 | All tests succeeded. 3 | -------------------------------------------------------------------------------- /testsuite/tests/lib-bigarray/pr5115.reference: -------------------------------------------------------------------------------- 1 | ***EXEC*** 2 | ***EXEC*** 3 | -------------------------------------------------------------------------------- /testsuite/tests/tool-debugger/find-artifacts/.ignore: -------------------------------------------------------------------------------- 1 | compiler-libs 2 | out 3 | -------------------------------------------------------------------------------- /testsuite/tests/tool-debugger/no_debug_event/input_script: -------------------------------------------------------------------------------- 1 | run 2 | quit 3 | -------------------------------------------------------------------------------- /yacc/.ignore: -------------------------------------------------------------------------------- 1 | ocamlyacc 2 | ocamlyacc.exe 3 | version.h 4 | .gdb_history 5 | -------------------------------------------------------------------------------- /boot/ocamlc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ocamllabs/ocaml-effects/HEAD/boot/ocamlc -------------------------------------------------------------------------------- /experimental/garrigue/dirs_multimatch: -------------------------------------------------------------------------------- 1 | parsing typing bytecomp driver toplevel 2 | -------------------------------------------------------------------------------- /testsuite/tests/prim-revapply/revapply.reference: -------------------------------------------------------------------------------- 1 | 6 2 | 36 3 | 18 4 | 37 5 | 260 6 | -------------------------------------------------------------------------------- /testsuite/tests/tool-lexyacc/.ignore: -------------------------------------------------------------------------------- 1 | scanner.ml 2 | grammar.mli 3 | grammar.ml 4 | -------------------------------------------------------------------------------- /boot/ocamldep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ocamllabs/ocaml-effects/HEAD/boot/ocamldep -------------------------------------------------------------------------------- /boot/ocamllex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ocamllabs/ocaml-effects/HEAD/boot/ocamllex -------------------------------------------------------------------------------- /otherlibs/num/nums.mllib: -------------------------------------------------------------------------------- 1 | Int_misc Nat Big_int Arith_flags Ratio Num Arith_status 2 | -------------------------------------------------------------------------------- /testsuite/tests/basic-more/tprintf.reference: -------------------------------------------------------------------------------- 1 | 0 1 2 3 4 5 2 | All tests succeeded. 3 | -------------------------------------------------------------------------------- /testsuite/tests/lib-threads/test4.reference: -------------------------------------------------------------------------------- 1 | 317811 2 | >> abc 3 | >> def 4 | >> ghi 5 | -------------------------------------------------------------------------------- /testsuite/tests/lib-threads/torture.reference: -------------------------------------------------------------------------------- 1 | > >>> abc 2 | > >>> def 3 | > >>> ghi 4 | > -------------------------------------------------------------------------------- /testsuite/tests/match-exception/match_failure.reference: -------------------------------------------------------------------------------- 1 | match failure, as expected 2 | -------------------------------------------------------------------------------- /testsuite/tests/match-exception/nested_handlers.reference: -------------------------------------------------------------------------------- 1 | five four three two one 2 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocamldoc/.ignore: -------------------------------------------------------------------------------- 1 | *.html 2 | *.sty 3 | *.css 4 | ocamldoc.out 5 | -------------------------------------------------------------------------------- /testsuite/tests/typing-modules/d.ml: -------------------------------------------------------------------------------- 1 | let x = 3 2 | module M = struct let y = 5 end 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | script: bash -ex .travis-ci.sh 3 | env: 4 | - XARCH=i386 5 | -------------------------------------------------------------------------------- /testsuite/tests/basic/maps.reference: -------------------------------------------------------------------------------- 1 | Union+concat 2 | 3 X1 3 | 4 YY 4 | 5 X2 5 | Inter 6 | 4 Y 7 | -------------------------------------------------------------------------------- /testsuite/tests/callback/reference: -------------------------------------------------------------------------------- 1 | 7 2 | 7 3 | 7 4 | 7 5 | 7 6 | aaaaa 7 | aaaaa 8 | bbbbb 9 | -------------------------------------------------------------------------------- /testsuite/tests/letrec/evaluation_order_3.reference: -------------------------------------------------------------------------------- 1 | x 2 | x_y 3 | x_x 4 | y 5 | y_y 6 | y_x 7 | -------------------------------------------------------------------------------- /testsuite/tests/lib-threads/close.reference: -------------------------------------------------------------------------------- 1 | reading... 2 | closing fd... 3 | read returned 4 | -------------------------------------------------------------------------------- /testsuite/tests/lib-threads/test5.reference: -------------------------------------------------------------------------------- 1 | A: hello 2 | A: world 3 | B: hello 4 | B: world 5 | -------------------------------------------------------------------------------- /testsuite/tests/match-exception/allocation.reference: -------------------------------------------------------------------------------- 1 | no allocations for multiple-value match 2 | -------------------------------------------------------------------------------- /testsuite/tests/match-exception/tail_calls.reference: -------------------------------------------------------------------------------- 1 | handler-case (match) is tail recursive 2 | -------------------------------------------------------------------------------- /testsuite/tests/tool-debugger/no_debug_event/.ignore: -------------------------------------------------------------------------------- 1 | compiler-libs 2 | out 3 | c 4 | c.exe 5 | -------------------------------------------------------------------------------- /testsuite/tests/typing-modules/a.mli: -------------------------------------------------------------------------------- 1 | module L = List 2 | module S = String 3 | module D' = D 4 | -------------------------------------------------------------------------------- /boot/.ignore: -------------------------------------------------------------------------------- 1 | Saved 2 | ocamlrun 3 | ocamlrun.exe 4 | ocamlyacc 5 | ocamlyacc.exe 6 | camlheader 7 | -------------------------------------------------------------------------------- /experimental/garrigue/dirs_poly: -------------------------------------------------------------------------------- 1 | bytecomp byterun driver parsing stdlib tools toplevel typing utils 2 | -------------------------------------------------------------------------------- /lex/.ignore: -------------------------------------------------------------------------------- 1 | parser.ml 2 | parser.mli 3 | lexer.ml 4 | ocamllex 5 | ocamllex.opt 6 | parser.output 7 | -------------------------------------------------------------------------------- /otherlibs/num/nat.ml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ocamllabs/ocaml-effects/HEAD/otherlibs/num/nat.ml -------------------------------------------------------------------------------- /testsuite/tests/parsing/pr6865.ml: -------------------------------------------------------------------------------- 1 | let%foo x = 42 2 | let%foo _ = () and _ = () 3 | let%foo _ = () 4 | -------------------------------------------------------------------------------- /testsuite/tests/typing-polyvariants-bugs-2/pr3918a.mli: -------------------------------------------------------------------------------- 1 | type 'a voption = [ `None | `Some of 'a] 2 | -------------------------------------------------------------------------------- /testsuite/tests/basic/tailcalls.reference: -------------------------------------------------------------------------------- 1 | 10000001 2 | 10000001 3 | 10000001 4 | 11 5 | 11 6 | 10000001 7 | -------------------------------------------------------------------------------- /testsuite/tests/lib-format/pr6824.reference: -------------------------------------------------------------------------------- 1 | [1] 2 | [2] 3 | [1] 4 | [2] 5 | 6 | All tests succeeded. 7 | -------------------------------------------------------------------------------- /testsuite/tests/lib-threads/testsocket.reference: -------------------------------------------------------------------------------- 1 | 0> connecting 2 | 0> connected 3 | 0> data retrieved 4 | -------------------------------------------------------------------------------- /testsuite/tests/match-exception/exception_propagation.reference: -------------------------------------------------------------------------------- 1 | caught expected exception (Not_found) 2 | -------------------------------------------------------------------------------- /testsuite/tests/tool-debugger/find-artifacts/in/blah.ml: -------------------------------------------------------------------------------- 1 | type blah = 2 | | Foo 3 | | Bar of string 4 | -------------------------------------------------------------------------------- /testsuite/tests/typing-polyvariants-bugs-2/pr3918b.mli: -------------------------------------------------------------------------------- 1 | type 'a vlist = ('a * 'b) Pr3918a.voption as 'b 2 | -------------------------------------------------------------------------------- /asmcomp/.ignore: -------------------------------------------------------------------------------- 1 | emit.ml 2 | arch.ml 3 | proc.ml 4 | selection.ml 5 | reload.ml 6 | scheduling.ml 7 | CSE.ml 8 | -------------------------------------------------------------------------------- /native-tests/test3.ml: -------------------------------------------------------------------------------- 1 | (* Test exception from raised C to OCaml *) 2 | 3 | let a = [| |] 4 | let x = a.(0) 5 | -------------------------------------------------------------------------------- /testsuite/tests/match-exception/streams.reference: -------------------------------------------------------------------------------- 1 | iter_stream with handler case (match) is tail recursive 2 | -------------------------------------------------------------------------------- /testsuite/tests/tool-debugger/no_debug_event/b.ml: -------------------------------------------------------------------------------- 1 | let () = 2 | print_int Foo.A.x; 3 | print_newline () 4 | -------------------------------------------------------------------------------- /testsuite/tests/typing-objects/pr5858.ml: -------------------------------------------------------------------------------- 1 | class type c = object end;; 2 | module type S = sig class c: c end;; 3 | -------------------------------------------------------------------------------- /native-tests/test1.ml: -------------------------------------------------------------------------------- 1 | (* Test caml_c_call, caml_start_program *) 2 | 3 | let () = Printf.printf "Hello, world!\n" 4 | -------------------------------------------------------------------------------- /native-tests/test10.ml: -------------------------------------------------------------------------------- 1 | effect E : unit 2 | let () = 3 | Printf.printf "%d\n%!" @@ try 10 with effect E k -> 11 4 | -------------------------------------------------------------------------------- /testsuite/tests/lib-dynlink-bytecode/.ignore: -------------------------------------------------------------------------------- 1 | main 2 | static 3 | custom 4 | custom.exe 5 | marshal.data 6 | caml 7 | -------------------------------------------------------------------------------- /testsuite/tests/tool-debugger/find-artifacts/input_script: -------------------------------------------------------------------------------- 1 | break @ Foo 10 2 | run 3 | print x 4 | print y 5 | quit 6 | -------------------------------------------------------------------------------- /testsuite/tests/warnings/w51.reference: -------------------------------------------------------------------------------- 1 | File "w51.ml", line 4, characters 13-37: 2 | Warning 51: expected tailcall 3 | -------------------------------------------------------------------------------- /debugger/.ignore: -------------------------------------------------------------------------------- 1 | lexer.ml 2 | parser.ml 3 | parser.mli 4 | ocamldebug 5 | ocamldebug.exe 6 | dynlink.ml 7 | dynlink.mli 8 | -------------------------------------------------------------------------------- /testsuite/tests/asmcomp/.ignore: -------------------------------------------------------------------------------- 1 | codegen 2 | parsecmm.ml 3 | parsecmm.mli 4 | lexcmm.ml 5 | *.s 6 | *.out 7 | *.out.dSYM 8 | -------------------------------------------------------------------------------- /testsuite/tests/lib-str/t01.ml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ocamllabs/ocaml-effects/HEAD/testsuite/tests/lib-str/t01.ml -------------------------------------------------------------------------------- /testsuite/tests/lib-threads/testA.reference: -------------------------------------------------------------------------------- 1 | 1 --> un 2 | 2 --> deux 3 | 3 --> trois 4 | 4 --> quatre 5 | 5 --> cinq 6 | -------------------------------------------------------------------------------- /testsuite/tests/regression/pr5233/pr5233.reference: -------------------------------------------------------------------------------- 1 | checking... value found / testing... ok 2 | checking... no value 3 | -------------------------------------------------------------------------------- /testsuite/tests/tool-debugger/basic/debuggee.ml: -------------------------------------------------------------------------------- 1 | print_endline Sys.argv.(1);; 2 | print_endline (Sys.getenv "foo");; 3 | -------------------------------------------------------------------------------- /testsuite/tests/tool-debugger/no_debug_event/noev.reference: -------------------------------------------------------------------------------- 1 | 2 | (ocd) Loading program... done. 3 | 1 4 | Program exit. 5 | -------------------------------------------------------------------------------- /testsuite/tests/basic/recvalues.reference: -------------------------------------------------------------------------------- 1 | Test 1: passed 2 | Test 2: passed 3 | Test 3: passed 4 | foo 5 | Test 4: passed 6 | -------------------------------------------------------------------------------- /testsuite/tests/prim-bswap/bswap.reference: -------------------------------------------------------------------------------- 1 | 4433 2 | f0f0 3 | 44332211 4 | f0f0f0f0 5 | 8877665544332211 6 | f0f0f0f0f0f0f0f0 7 | -------------------------------------------------------------------------------- /testsuite/tests/prim-revapply/apply.reference: -------------------------------------------------------------------------------- 1 | 6 2 | 36 3 | 18 4 | 37 5 | 260 6 | 6 7 | 36 8 | 18 9 | 37 10 | 260 11 | -------------------------------------------------------------------------------- /testsuite/tests/runtime-errors/stackoverflow.bytecode.reference: -------------------------------------------------------------------------------- 1 | x = 20000 2 | x = 10000 3 | x = 0 4 | Stack overflow caught 5 | -------------------------------------------------------------------------------- /testsuite/tests/runtime-errors/stackoverflow.native.reference: -------------------------------------------------------------------------------- 1 | x = 20000 2 | x = 10000 3 | x = 0 4 | Stack overflow caught 5 | -------------------------------------------------------------------------------- /testsuite/tests/warnings/w51.ml: -------------------------------------------------------------------------------- 1 | 2 | let rec fact = function 3 | | 1 -> 1 4 | | n -> n * (fact [@tailcall]) (n-1) 5 | ;; 6 | -------------------------------------------------------------------------------- /testsuite/tests/warnings/w51_bis.reference: -------------------------------------------------------------------------------- 1 | File "w51_bis.ml", line 4, characters 12-48: 2 | Warning 51: expected tailcall 3 | -------------------------------------------------------------------------------- /testsuite/tests/lib-str/t01.reference: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ocamllabs/ocaml-effects/HEAD/testsuite/tests/lib-str/t01.reference -------------------------------------------------------------------------------- /testsuite/tests/tool-debugger/basic/debuggee.reference: -------------------------------------------------------------------------------- 1 | 2 | (ocd) Loading program... done. 3 | arg1 4 | notbar 5 | Program exit. 6 | -------------------------------------------------------------------------------- /testsuite/tests/tool-toplevel/tracing.ml: -------------------------------------------------------------------------------- 1 | List.fold_left;; 2 | #trace List.fold_left;; 3 | 0;; 4 | List.fold_left (+) 0 [1;2;3];; 5 | -------------------------------------------------------------------------------- /testsuite/tests/typing-recmod/t01bad.ml: -------------------------------------------------------------------------------- 1 | (* Bad (t = t) *) 2 | module rec A : sig type t = A.t end = struct type t = A.t end;; 3 | -------------------------------------------------------------------------------- /testsuite/tests/lib-scanf-2/reference: -------------------------------------------------------------------------------- 1 | Ping-pong Ping-pong Ping-pong Ping-pong Ping-pong Ping-pong Ping-pong Ping-pong! 2 | Test OK. 3 | -------------------------------------------------------------------------------- /testsuite/tests/runtime-errors/syserror.bytecode.reference: -------------------------------------------------------------------------------- 1 | Fatal error: exception Sys_error("titi:/toto: No such file or directory") 2 | -------------------------------------------------------------------------------- /testsuite/tests/runtime-errors/syserror.native.reference: -------------------------------------------------------------------------------- 1 | Fatal error: exception Sys_error("titi:/toto: No such file or directory") 2 | -------------------------------------------------------------------------------- /testsuite/tests/typing-modules/b3.mli: -------------------------------------------------------------------------------- 1 | open A 2 | (*module type S = module type of D'.M*) 3 | type t = Complex.t 4 | type s = String.t 5 | -------------------------------------------------------------------------------- /stdlib/.ignore: -------------------------------------------------------------------------------- 1 | camlheader 2 | target_camlheader 3 | camlheaderd 4 | target_camlheaderd 5 | camlheader_ur 6 | labelled-* 7 | caml 8 | sys.ml 9 | -------------------------------------------------------------------------------- /testsuite/tests/embedded/program.reference: -------------------------------------------------------------------------------- 1 | Initializing OCaml code... 2 | Back in C code... 3 | Computing fib(20)... 4 | Result = 10946 5 | -------------------------------------------------------------------------------- /testsuite/tests/lib-dynlink-native/.ignore: -------------------------------------------------------------------------------- 1 | mypack.pack.s 2 | mypack.pack.asm 3 | result 4 | main 5 | main.exe 6 | marshal.data 7 | caml 8 | -------------------------------------------------------------------------------- /testsuite/tests/lib-stream/count_concat_bug.reference: -------------------------------------------------------------------------------- 1 | 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 2 | All tests succeeded. 3 | -------------------------------------------------------------------------------- /testsuite/tests/match-exception/raise_from_success_continuation.reference: -------------------------------------------------------------------------------- 1 | test raise from val handler 2 | raise from val handler succeeded 3 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t000.ml: -------------------------------------------------------------------------------- 1 | (* empty file *) 2 | 3 | (** 4 | 0 ATOM0 5 | 1 SETGLOBAL T000 6 | 3 STOP 7 | **) 8 | -------------------------------------------------------------------------------- /testsuite/tests/typing-fstclassmod/fstclassmod.reference: -------------------------------------------------------------------------------- 1 | abc/def/xyz xyz/def/abc 2 | 1 3 | 2 4 | XXXXXXXX 5 | 10 6 | (123,("A",456)) 7 | 2 8 | -------------------------------------------------------------------------------- /experimental/frisch/test_matches.ml: -------------------------------------------------------------------------------- 1 | let l = List.filter [%matches ? 'a'..'z'] ['a';'A';'X';'x'] 2 | 3 | let f = [%matches ? Some i when i >= 0] 4 | -------------------------------------------------------------------------------- /testsuite/tests/basic-more/pr2719.reference: -------------------------------------------------------------------------------- 1 | Value of test at the beginning : false 2 | Value of test now : false 3 | 4 | All tests succeeded. 5 | -------------------------------------------------------------------------------- /testsuite/tests/formats-transition/legacy_unfinished_modifiers.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # * * * * * * * * 3 3 | # 3 4 | # 3 5 | # 3 6 | # 7 | -------------------------------------------------------------------------------- /testsuite/tests/lib-dynlink-bytecode/custom.reference: -------------------------------------------------------------------------------- 1 | This is stub2, calling stub1: 2 | This is stub1! 3 | Ok! 4 | This is stub1! 5 | ABCDEF 6 | -------------------------------------------------------------------------------- /testsuite/tests/lib-dynlink-bytecode/static.reference: -------------------------------------------------------------------------------- 1 | This is stub1! 2 | ABCDEF 3 | This is stub2, calling stub1: 4 | This is stub1! 5 | Ok! 6 | -------------------------------------------------------------------------------- /testsuite/tests/tool-debugger/basic/input_script: -------------------------------------------------------------------------------- 1 | set arguments arg1 arg2 2 | environment foo=bar 3 | environment foo=notbar 4 | run 5 | quit 6 | -------------------------------------------------------------------------------- /testsuite/tests/typing-recmod/t04bad.ml: -------------------------------------------------------------------------------- 1 | (* Bad (t = int * t) *) 2 | module rec A : sig type t = int * A.t end = struct type t = int * A.t end;; 3 | -------------------------------------------------------------------------------- /testsuite/tests/typing-rectypes-bugs/pr6870_bad.ml: -------------------------------------------------------------------------------- 1 | module type T = sig type 'a t end 2 | module Fix (T : T) = struct type r = ('r T.t as 'r) end 3 | -------------------------------------------------------------------------------- /otherlibs/graph/libgraphics.clib: -------------------------------------------------------------------------------- 1 | open.o draw.o fill.o color.o text.o 2 | image.o make_img.o dump_img.o point_col.o sound.o events.o 3 | subwindow.o 4 | -------------------------------------------------------------------------------- /testsuite/tests/typing-gadts/pr5906.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # 3 | Characters 524-524: 4 | Error: Syntax error 5 | # 6 | -------------------------------------------------------------------------------- /testsuite/tests/typing-misc-bugs/pr6303_bad.ml: -------------------------------------------------------------------------------- 1 | type 'a foo = {x: 'a; y: int} 2 | let r = {{x = 0; y = 0} with x = 0} 3 | let r' : string foo = r 4 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 4.03.0+dev8-2015-07-15 2 | 3 | # The version string is the first line of this file. 4 | # It must be in the format described in stdlib/sys.mli 5 | -------------------------------------------------------------------------------- /testsuite/tests/typing-modules-bugs/pr6899_first_bad.ml: -------------------------------------------------------------------------------- 1 | let should_reject = 2 | let table = Hashtbl.create 1 in 3 | fun x y -> Hashtbl.add table x y 4 | -------------------------------------------------------------------------------- /testsuite/tests/formats-transition/Makefile: -------------------------------------------------------------------------------- 1 | BASEDIR=../.. 2 | include $(BASEDIR)/makefiles/Makefile.toplevel 3 | include $(BASEDIR)/makefiles/Makefile.common 4 | -------------------------------------------------------------------------------- /testsuite/tests/typing-modules-bugs/pr6899_second_bad.ml: -------------------------------------------------------------------------------- 1 | include struct 2 | let foo `Test = () 3 | let wrap f `Test = f 4 | let bar = wrap () 5 | end 6 | -------------------------------------------------------------------------------- /testsuite/tests/lib-systhreads/testfork.reference: -------------------------------------------------------------------------------- 1 | Forking... 2 | In parent... 3 | In child... 4 | Child did minor GC. 5 | Child is exiting. 6 | Parent is exiting. 7 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t010-const0.ml: -------------------------------------------------------------------------------- 1 | 0;; 2 | 3 | (** 4 | 0 CONST0 5 | 1 ATOM0 6 | 2 SETGLOBAL T010-const0 7 | 4 STOP 8 | **) 9 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t010-const1.ml: -------------------------------------------------------------------------------- 1 | 1;; 2 | 3 | (** 4 | 0 CONST1 5 | 1 ATOM0 6 | 2 SETGLOBAL T010-const1 7 | 4 STOP 8 | **) 9 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t010-const2.ml: -------------------------------------------------------------------------------- 1 | 2;; 2 | 3 | (** 4 | 0 CONST2 5 | 1 ATOM0 6 | 2 SETGLOBAL T010-const2 7 | 4 STOP 8 | **) 9 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t010-const3.ml: -------------------------------------------------------------------------------- 1 | 3;; 2 | 3 | (** 4 | 0 CONST3 5 | 1 ATOM0 6 | 2 SETGLOBAL T010-const3 7 | 4 STOP 8 | **) 9 | -------------------------------------------------------------------------------- /testsuite/tests/typing-extensions/Makefile: -------------------------------------------------------------------------------- 1 | BASEDIR=../.. 2 | include $(BASEDIR)/makefiles/Makefile.toplevel 3 | include $(BASEDIR)/makefiles/Makefile.common 4 | 5 | -------------------------------------------------------------------------------- /testsuite/tests/typing-objects/pr6383.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # Characters 10-16: 3 | let f (x: #M.foo) = 0;; 4 | ^^^^^^ 5 | Error: Unbound module M 6 | # 7 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t011-constint.ml: -------------------------------------------------------------------------------- 1 | 4;; 2 | 3 | (** 4 | 0 CONSTINT 4 5 | 2 ATOM0 6 | 3 SETGLOBAL T011-constint 7 | 5 STOP 8 | **) 9 | -------------------------------------------------------------------------------- /testsuite/tests/typing-modules-bugs/pr6293_bad.ml: -------------------------------------------------------------------------------- 1 | module type S = sig type t = { a : int; b : int; } end;; 2 | let f (module M : S with type t = int) = { M.a = 0 };; 3 | -------------------------------------------------------------------------------- /testsuite/tests/typing-recmod/t15bad.ml: -------------------------------------------------------------------------------- 1 | (* Bad - PR 4512 *) 2 | module type S' = sig type t = int end 3 | module rec M : S' with type t = M.t = struct type t = M.t end;; 4 | -------------------------------------------------------------------------------- /testsuite/tests/typing-short-paths/pr5918.ml: -------------------------------------------------------------------------------- 1 | module rec A : sig 2 | type t 3 | end = struct 4 | type t = { a : unit; b : unit } 5 | let _ = { a = () } 6 | end 7 | ;; 8 | -------------------------------------------------------------------------------- /testsuite/tests/typing-short-paths/pr6836.ml: -------------------------------------------------------------------------------- 1 | type t = [`A | `B];; 2 | type 'a u = t;; 3 | let a : [< int u] = `A;; 4 | 5 | type 'a s = 'a;; 6 | let b : [< t s] = `B;; 7 | -------------------------------------------------------------------------------- /parsing/.ignore: -------------------------------------------------------------------------------- 1 | parser.ml 2 | parser.mli 3 | lexer.ml 4 | lexer_tmp.mll 5 | lexer_tmp.ml 6 | linenum.ml 7 | parser.output 8 | parser.automaton 9 | parser.conflicts 10 | -------------------------------------------------------------------------------- /testsuite/tests/translprim/Makefile: -------------------------------------------------------------------------------- 1 | BASEDIR=../.. 2 | TOPFLAGS+=-dlambda 3 | include $(BASEDIR)/makefiles/Makefile.dlambda 4 | include $(BASEDIR)/makefiles/Makefile.common 5 | -------------------------------------------------------------------------------- /.ignore: -------------------------------------------------------------------------------- 1 | configure 2 | ocamlc 3 | ocamlc.opt 4 | expunge 5 | ocaml 6 | ocamlopt 7 | ocamlopt.opt 8 | ocamlcomp.sh 9 | ocamlcompopt.sh 10 | package-macosx 11 | ocamlnat 12 | -------------------------------------------------------------------------------- /testsuite/tests/basic/includestruct.reference: -------------------------------------------------------------------------------- 1 | 1, 2 2 | 2, 3 3 | 124, 457 4 | 0 5 | 2 6 | 2 7 | 1 8 | 3 9 | F is called 10 | A 11 | 42 12 | A 13 | 42 14 | foo1 15 | foo1 16 | -------------------------------------------------------------------------------- /testsuite/tests/typing-signatures/pr6672.ml: -------------------------------------------------------------------------------- 1 | module type S = sig type 'a t end;; 2 | module type T = S with type +'a t = 'a list;; 3 | module type T = S with type -'a t = 'a list;; 4 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t050-getglobal.ml: -------------------------------------------------------------------------------- 1 | [1];; 2 | 3 | (** 4 | 0 GETGLOBAL <0>(1, 0) 5 | 2 ATOM0 6 | 3 SETGLOBAL T050-getglobal 7 | 5 STOP 8 | **) 9 | -------------------------------------------------------------------------------- /testsuite/tests/typing-misc/occur_check.ml: -------------------------------------------------------------------------------- 1 | (* PR#5907 *) 2 | 3 | type 'a t = 'a;; 4 | let f (g : 'a list -> 'a t -> 'a) s = g s s;; 5 | let f (g : 'a * 'b -> 'a t -> 'a) s = g s s;; 6 | -------------------------------------------------------------------------------- /testsuite/tests/typing-recmod/t07bad.ml: -------------------------------------------------------------------------------- 1 | (* Bad (not regular) *) 2 | module rec A : sig type 'a t = end 3 | = struct type 'a t = end;; 4 | -------------------------------------------------------------------------------- /testsuite/tests/warnings/w06.ml: -------------------------------------------------------------------------------- 1 | let foo ~bar = ignore bar (* one label *) 2 | 3 | let bar ~foo ~baz = ignore (foo, baz) (* two labels *) 4 | 5 | let () = foo 2 6 | let () = bar 4 2 7 | -------------------------------------------------------------------------------- /otherlibs/win32unix/.depend: -------------------------------------------------------------------------------- 1 | unix.cmo: unix.cmi 2 | unix.cmx: unix.cmi 3 | unixLabels.cmo: unix.cmi unixLabels.cmi 4 | unixLabels.cmx: unix.cmx unixLabels.cmi 5 | unixLabels.cmi: unix.cmi 6 | -------------------------------------------------------------------------------- /testsuite/tests/misc-unsafe/almabench.reference: -------------------------------------------------------------------------------- 1 | 0 17.00 -26.06 2 | 1 12.34 1.29 3 | 2 6.83 22.95 4 | 3 0.04 -1.26 5 | 4 2.30 12.54 6 | 5 2.93 14.35 7 | 6 21.27 -16.57 8 | 7 20.41 -19.04 9 | -------------------------------------------------------------------------------- /testsuite/tests/typing-gadts/pr6174.ml: -------------------------------------------------------------------------------- 1 | type _ t = C : ((('a -> 'o) -> 'o) -> ('b -> 'o) -> 'o) t 2 | let f : type a o. ((a -> o) -> o) t -> (a -> o) -> o = 3 | fun C k -> k (fun x -> x);; 4 | -------------------------------------------------------------------------------- /testsuite/tests/typing-misc/variant.ml: -------------------------------------------------------------------------------- 1 | (* PR#6394 *) 2 | 3 | module rec X : sig 4 | type t = int * bool 5 | end = struct 6 | type t = A | B 7 | let f = function A | B -> 0 8 | end;; 9 | -------------------------------------------------------------------------------- /testsuite/tests/typing-modules-bugs/pr6899_ok.ml: -------------------------------------------------------------------------------- 1 | type 'a t = 'a option 2 | let is_some = function 3 | | None -> false 4 | | Some _ -> true 5 | 6 | let should_accept ?x () = is_some x 7 | -------------------------------------------------------------------------------- /testsuite/tests/backtrace/backtrace..reference: -------------------------------------------------------------------------------- 1 | Fatal error: exception Invalid_argument("index out of bounds") 2 | Raised by primitive operation at file "backtrace.ml", line 29, characters 12-24 3 | -------------------------------------------------------------------------------- /testsuite/tests/basic-modules/offset.ml: -------------------------------------------------------------------------------- 1 | module M = struct 2 | type t = string 3 | 4 | let x = 0 5 | let x = 1 6 | 7 | module Set = Set.Make(String) 8 | end 9 | 10 | include M 11 | -------------------------------------------------------------------------------- /testsuite/tests/tool-debugger/find-artifacts/debuggee.reference: -------------------------------------------------------------------------------- 1 | 2 | (ocd) Loading program... done. 3 | Breakpoint: 1 4 | 10 <|b|>print x; 5 | x: Blah.blah = Foo 6 | y: Blah.blah = Bar "hi" 7 | -------------------------------------------------------------------------------- /testsuite/tests/typing-modules-bugs/pr5663_ok.ml: -------------------------------------------------------------------------------- 1 | module F (M : sig 2 | type 'a t 3 | type 'a u = string 4 | val f : unit -> _ u t 5 | end) = struct 6 | let t = M.f () 7 | end 8 | -------------------------------------------------------------------------------- /testsuite/tests/typing-recmod/t02bad.ml: -------------------------------------------------------------------------------- 1 | (* Bad (t = t) *) 2 | module rec A : sig type t = B.t end = struct type t = B.t end 3 | and B : sig type t = A.t end = struct type t = A.t end;; 4 | -------------------------------------------------------------------------------- /testsuite/tests/typing-recmod/t03ok.ml: -------------------------------------------------------------------------------- 1 | (* OK (t = int) *) 2 | module rec A : sig type t = B.t end = struct type t = B.t end 3 | and B : sig type t = int end = struct type t = int end;; 4 | -------------------------------------------------------------------------------- /native-tests/test2.ml: -------------------------------------------------------------------------------- 1 | (* Test the GC. *) 2 | 3 | let () = Printf.printf "Hello, world!\n" 4 | let () = Gc.full_major () 5 | let () = Printf.printf "Hello, world!\n" 6 | let () = Gc.full_major () 7 | -------------------------------------------------------------------------------- /testsuite/tests/typing-short-paths/pr5918.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # Characters 82-92: 3 | let _ = { a = () } 4 | ^^^^^^^^^^ 5 | Error: Some record fields are undefined: b 6 | # 7 | -------------------------------------------------------------------------------- /testsuite/tests/typing-short-paths/pr6836.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # type t = [ `A | `B ] 3 | # type 'a u = t 4 | # val a : [< int u > `A ] = `A 5 | # type 'a s = 'a 6 | # val b : [< t > `B ] = `B 7 | # 8 | -------------------------------------------------------------------------------- /testsuite/tests/typing-warnings/pr5892.ml: -------------------------------------------------------------------------------- 1 | open CamlinternalOO;; 2 | type _ choice = Left : label choice | Right : tag choice;; 3 | let f : label choice -> bool = function Left -> true;; (* warn *) 4 | -------------------------------------------------------------------------------- /testsuite/tests/basic-more/bounds.reference: -------------------------------------------------------------------------------- 1 | 0: doesn't fail 2 | 1: doesn't fail 3 | 2: doesn't fail 4 | 3: fails 5 | 4: fails 6 | -1: fails 7 | Trail: -1 4 3 2 1 0 8 | 9 | All tests succeeded. 10 | -------------------------------------------------------------------------------- /testsuite/tests/typing-recmod/t06ok.ml: -------------------------------------------------------------------------------- 1 | (* OK (t = ) *) 2 | module rec A : sig type t = end = struct type t = end 3 | and B : sig type t = A.t end = struct type t = A.t end;; 4 | -------------------------------------------------------------------------------- /testsuite/tests/typing-rectypes-bugs/pr6174_bad.ml: -------------------------------------------------------------------------------- 1 | type _ t = C : ((('a -> 'o) -> 'o) -> ('b -> 'o) -> 'o) t 2 | let f : type a o. ((a -> o) -> o) t -> (a -> o) -> o = 3 | fun C k -> k (fun x -> x);; 4 | -------------------------------------------------------------------------------- /testsuite/tests/typing-signatures/pr6371.ml: -------------------------------------------------------------------------------- 1 | module M = struct 2 | type t = int * (< m : 'a > as 'a) 3 | end;; 4 | 5 | module type S = 6 | sig module M : sig type t end end with module M = M 7 | ;; 8 | -------------------------------------------------------------------------------- /testsuite/tests/warnings/w51_bis.ml: -------------------------------------------------------------------------------- 1 | let rec foldl op acc = function 2 | [] -> acc 3 | | x :: xs -> 4 | try (foldl [@tailcall]) op (op x acc) xs 5 | with Not_found -> assert false 6 | -------------------------------------------------------------------------------- /byterun/.ignore: -------------------------------------------------------------------------------- 1 | primitives 2 | prims.c 3 | ocamlrun 4 | ocamlrun.exe 5 | ocamlrund 6 | ocamlrund.exe 7 | ld.conf 8 | interp.a.lst 9 | *.[sd]obj 10 | *.lib 11 | .gdb_history 12 | *.d.c 13 | *.pic.c 14 | -------------------------------------------------------------------------------- /config/auto-aux/cfi.S: -------------------------------------------------------------------------------- 1 | camlPervasives__loop_1128: 2 | .file 1 "pervasives.ml" 3 | .loc 1 193 4 | .cfi_startproc 5 | .cfi_adjust_cfa_offset 8 6 | .cfi_endproc 7 | -------------------------------------------------------------------------------- /native-tests/test9.mli: -------------------------------------------------------------------------------- 1 | external caml_to_c : int -> int -> int -> int -> int 2 | -> int -> int -> int -> int -> int 3 | -> int -> unit = "caml_to_c_bytecode" "caml_to_c_native" 4 | -------------------------------------------------------------------------------- /testsuite/tests/backtrace/backtrace.c.reference: -------------------------------------------------------------------------------- 1 | Fatal error: exception Backtrace.Error("c") 2 | Raised at file "backtrace.ml", line 25, characters 26-37 3 | Called from file "backtrace.ml", line 29, characters 9-25 4 | -------------------------------------------------------------------------------- /testsuite/tests/lib-format/pr6824.ml: -------------------------------------------------------------------------------- 1 | let f = Format.sprintf "[%i]";; 2 | print_endline (f 1);; 3 | print_endline (f 2);; 4 | 5 | let f = Format.asprintf "[%i]";; 6 | print_endline (f 1);; 7 | print_endline (f 2);; 8 | -------------------------------------------------------------------------------- /testsuite/tests/typing-recmod/t05bad.ml: -------------------------------------------------------------------------------- 1 | (* Bad (t = t -> int) *) 2 | module rec A : sig type t = B.t -> int end = struct type t = B.t -> int end 3 | and B : sig type t = A.t end = struct type t = A.t end;; 4 | -------------------------------------------------------------------------------- /testsuite/tests/typing-signatures/pr6371.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # module M : sig type t = int * (< m : 'a > as 'a) end 3 | # module type S = sig module M : sig type t = int * (< m : 'a > as 'a) end end 4 | # 5 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t020.ml: -------------------------------------------------------------------------------- 1 | let _ = () in ();; 2 | 3 | (** 4 | 0 CONST0 5 | 1 PUSHCONST0 6 | 2 POP 1 7 | 4 ATOM0 8 | 5 SETGLOBAL T020 9 | 7 STOP 10 | **) 11 | -------------------------------------------------------------------------------- /testsuite/tests/typing-warnings/pr6872.ml: -------------------------------------------------------------------------------- 1 | exception A;; 2 | type a = A;; 3 | 4 | A;; 5 | raise A;; 6 | fun (A : a) -> ();; 7 | function Not_found -> 1 | A -> 2 | _ -> 3;; 8 | try raise A with A -> 2;; 9 | 10 | -------------------------------------------------------------------------------- /native-tests/test18.ml: -------------------------------------------------------------------------------- 1 | effect E : string 2 | 3 | let _ = 4 | try print_endline @@ "Hello" ^ perform E with 5 | | effect E k -> 6 | let k' = Obj.clone k in 7 | continue k ""; 8 | continue k' ", again!" 9 | -------------------------------------------------------------------------------- /testsuite/tests/lib-dynlink-csharp/bytecode.reference: -------------------------------------------------------------------------------- 1 | Now starting the OCaml engine. 2 | Main is running. 3 | Loading ../../../otherlibs/bigarray/bigarray.cma 4 | I'm the plugin. 5 | Loading plugin.cmo 6 | I'm the plugin. 7 | OK. 8 | -------------------------------------------------------------------------------- /testsuite/tests/lib-dynlink-csharp/native.reference: -------------------------------------------------------------------------------- 1 | Now starting the OCaml engine. 2 | Main is running. 3 | Loading ../../../otherlibs/bigarray/bigarray.cmxs 4 | I'm the plugin. 5 | Loading plugin.cmxs 6 | I'm the plugin. 7 | OK. 8 | -------------------------------------------------------------------------------- /testsuite/tests/prim-bigstring/bigstring_access.reference: -------------------------------------------------------------------------------- 1 | 1234 12 0 2 | fedc fe 0 3 | 12345678 123456 1234 4 | fedcba09 fedcba fedc 5 | 1234567890abcdef 1234567890abcd 1234567890ab 6 | fedcba0987654321 fedcba09876543 fedcba098765 7 | -------------------------------------------------------------------------------- /testsuite/tests/prim-bigstring/string_access.reference: -------------------------------------------------------------------------------- 1 | 1234 12 0 2 | fedc fe 0 3 | 12345678 123456 1234 4 | fedcba09 fedcba fedc 5 | 1234567890abcdef 1234567890abcd 1234567890ab 6 | fedcba0987654321 fedcba09876543 fedcba098765 7 | -------------------------------------------------------------------------------- /testsuite/tests/typing-objects-bugs/pr4824_ok.ml: -------------------------------------------------------------------------------- 1 | module M : 2 | sig 3 | class x : int -> object method m : int end 4 | end 5 | = 6 | struct 7 | class x _ = object 8 | method m = 42 9 | end 10 | end;; 11 | -------------------------------------------------------------------------------- /testsuite/tests/typing-private-bugs/pr5469_ok.ml: -------------------------------------------------------------------------------- 1 | module M (T:sig type t end) 2 | = struct type t = private { t : T.t } end 3 | module P 4 | = struct 5 | module T = struct type t end 6 | module R = M(T) 7 | end 8 | -------------------------------------------------------------------------------- /testsuite/tests/float-unboxing/Makefile: -------------------------------------------------------------------------------- 1 | BASEDIR=../.. 2 | MODULES= 3 | MAIN_MODULE=float_subst_boxed_number 4 | ADD_OPTCOMPFLAGS=-inline 20 5 | 6 | include $(BASEDIR)/makefiles/Makefile.one 7 | include $(BASEDIR)/makefiles/Makefile.common 8 | -------------------------------------------------------------------------------- /testsuite/tests/lib-random/rand.ml: -------------------------------------------------------------------------------- 1 | let () = 2 | Random.self_init (); 3 | let x = Random.int 10000 in 4 | Random.self_init (); 5 | let y = Random.int 1000 in 6 | if x = y then print_endline "FAILED" else print_endline "PASSED" 7 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t021-pushconst1.ml: -------------------------------------------------------------------------------- 1 | let _ = () in 1;; 2 | 3 | (** 4 | 0 CONST0 5 | 1 PUSHCONST1 6 | 2 POP 1 7 | 4 ATOM0 8 | 5 SETGLOBAL T021-pushconst1 9 | 7 STOP 10 | **) 11 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t021-pushconst2.ml: -------------------------------------------------------------------------------- 1 | let _ = () in 2;; 2 | 3 | (** 4 | 0 CONST0 5 | 1 PUSHCONST2 6 | 2 POP 1 7 | 4 ATOM0 8 | 5 SETGLOBAL T021-pushconst2 9 | 7 STOP 10 | **) 11 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t021-pushconst3.ml: -------------------------------------------------------------------------------- 1 | let _ = () in 3;; 2 | 3 | (** 4 | 0 CONST0 5 | 1 PUSHCONST3 6 | 2 POP 1 7 | 4 ATOM0 8 | 5 SETGLOBAL T021-pushconst3 9 | 7 STOP 10 | **) 11 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocamldoc/t02.reference: -------------------------------------------------------------------------------- 1 | # 2 | # module T02: 3 | # 4 | # module T02.Foo: 5 | # 6 | # module type T02.TFoo: 7 | # 8 | # module type T02.TBar: 9 | # 10 | # module type T02.Gee: 11 | # 12 | # module T02.Gee.M: 13 | -------------------------------------------------------------------------------- /testsuite/tests/typing-objects-bugs/pr4766_ok.ml: -------------------------------------------------------------------------------- 1 | class virtual ['a] c = 2 | object (s : 'a) 3 | method virtual m : 'b 4 | end 5 | 6 | let o = 7 | object (s :'a) 8 | inherit ['a] c 9 | method m = 42 10 | end 11 | -------------------------------------------------------------------------------- /testsuite/tests/basic/bigints.reference: -------------------------------------------------------------------------------- 1 | 1000000000 2 | 10000000000 3 | 100000000000 4 | 1000000000000 5 | 10000000000000 6 | 100000000000000 7 | 1000000000000000 8 | 10000000000000000 9 | 100000000000000000 10 | 1000000000000000000 11 | -------------------------------------------------------------------------------- /testsuite/tests/lib-bigarray/fftba.reference: -------------------------------------------------------------------------------- 1 | 16... ok 2 | 32... ok 3 | 64... ok 4 | 128... ok 5 | 256... ok 6 | 512... ok 7 | 1024... ok 8 | 2048... ok 9 | 4096... ok 10 | 8192... ok 11 | 16384... ok 12 | 32768... ok 13 | 65536... ok 14 | -------------------------------------------------------------------------------- /testsuite/tests/lib-scanf/tscanf.reference: -------------------------------------------------------------------------------- 1 | 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 2 | All tests succeeded. 3 | -------------------------------------------------------------------------------- /testsuite/tests/typing-misc/wellfounded.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # type _ prod = Prod : ('a * 'y) prod 3 | # Characters 82-96: 4 | type d = d * d 5 | ^^^^^^^^^^^^^^ 6 | Error: The type abbreviation d is cyclic 7 | # 8 | -------------------------------------------------------------------------------- /native-tests/test12.ml: -------------------------------------------------------------------------------- 1 | effect E : unit 2 | exception X 3 | 4 | let () = 5 | Printf.printf "%d\n%!" @@ 6 | try 7 | Printf.printf "in handler. raising X\n%!"; 8 | raise X 9 | with 10 | | X -> 10 11 | | effect E k -> 11 12 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t022-pushconstint.ml: -------------------------------------------------------------------------------- 1 | let _ = () in -1;; 2 | 3 | (** 4 | 0 CONST0 5 | 1 PUSHCONSTINT -1 6 | 3 POP 1 7 | 5 ATOM0 8 | 6 SETGLOBAL T022-pushconstint 9 | 8 STOP 10 | **) 11 | -------------------------------------------------------------------------------- /testsuite/tests/typing-warnings/coercions.ml: -------------------------------------------------------------------------------- 1 | (* comment 9644 of PR#6000 *) 2 | 3 | fun b -> if b then format_of_string "x" else "y";; 4 | fun b -> if b then "x" else format_of_string "y";; 5 | fun b -> (if b then "x" else "y" : (_,_,_) format);; 6 | -------------------------------------------------------------------------------- /testsuite/tests/formats-transition/deprecated_unsigned_printers.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # * * val test : (int -> string, unit, string) format -> string = 3 | # %n: true 4 | # %l: true 5 | # %N: true 6 | # %L: true 7 | # 8 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t050-pushgetglobal.ml: -------------------------------------------------------------------------------- 1 | let _ = () in 0.01;; 2 | 3 | (** 4 | 0 CONST0 5 | 1 PUSHGETGLOBAL 0.01 6 | 3 POP 1 7 | 5 ATOM0 8 | 6 SETGLOBAL T050-pushgetglobal 9 | 8 STOP 10 | **) 11 | -------------------------------------------------------------------------------- /testsuite/tests/typing-misc/wellfounded.ml.principal.reference: -------------------------------------------------------------------------------- 1 | 2 | # type _ prod = Prod : ('a * 'y) prod 3 | # Characters 82-96: 4 | type d = d * d 5 | ^^^^^^^^^^^^^^ 6 | Error: The type abbreviation d is cyclic 7 | # 8 | -------------------------------------------------------------------------------- /testsuite/tests/typing-objects/pr5858.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # class type c = object end 3 | # Characters 29-30: 4 | module type S = sig class c: c end;; 5 | ^ 6 | Error: The class type c is not yet completely defined 7 | # 8 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocamldoc/t03.reference: -------------------------------------------------------------------------------- 1 | # 2 | # module T03: 3 | # 4 | # module T03.Foo: 5 | # 6 | # module type T03.MT: 7 | # 8 | # module T03.Bar: 9 | # 10 | # module type T03.MT2: 11 | # 12 | # module type T03.Gee: 13 | # 14 | # module T03.T: 15 | -------------------------------------------------------------------------------- /testsuite/tests/typing-poly-bugs/pr5322_ok.ml: -------------------------------------------------------------------------------- 1 | type 'par t = 'par 2 | module M : sig val x : end = 3 | struct let x : = Obj.magic () end 4 | 5 | let ident v = v 6 | class alias = object method alias : 'a . 'a t -> 'a = ident end 7 | -------------------------------------------------------------------------------- /testsuite/tests/lib-printf/pr6534.reference: -------------------------------------------------------------------------------- 1 | 1 [ foo] 2 | 2 [ foo] 3 | 3 [foo ] 4 | 4 [foo ] 5 | 5 [foo ] 6 | 6 [foo ] 7 | 1 [ "foo"] 8 | 2 [ "foo"] 9 | 3 ["foo" ] 10 | 4 ["foo" ] 11 | 5 ["foo" ] 12 | 6 ["foo" ] 13 | 14 | All tests succeeded. 15 | -------------------------------------------------------------------------------- /testsuite/tests/typing-misc/wellfounded.ml: -------------------------------------------------------------------------------- 1 | (* PR#6768 *) 2 | 3 | type _ prod = Prod : ('a * 'y) prod;; 4 | 5 | let f : type t. t prod -> _ = function Prod -> 6 | let module M = 7 | struct 8 | type d = d * d 9 | end 10 | in () 11 | ;; 12 | -------------------------------------------------------------------------------- /testsuite/tests/typing-objects-bugs/pr4824a_bad.ml: -------------------------------------------------------------------------------- 1 | module M : sig class c : 'a -> object val x : 'b end end = 2 | struct class c x = object val x = x end end 3 | 4 | class c (x : int) = object inherit M.c x method x : bool = x end 5 | 6 | let r = (new c 2)#x;; 7 | -------------------------------------------------------------------------------- /experimental/garrigue/printers.ml: -------------------------------------------------------------------------------- 1 | (* $Id$ *) 2 | 3 | open Types 4 | 5 | let ignore_abbrevs ppf ab = 6 | let s = match ab with 7 | Mnil -> "Mnil" 8 | | Mlink _ -> "Mlink _" 9 | | Mcons _ -> "Mcons _" 10 | in 11 | Format.pp_print_string ppf s 12 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t040-makeblock1.ml: -------------------------------------------------------------------------------- 1 | type t = { 2 | mutable a : int; 3 | };; 4 | 5 | { a = 0 };; 6 | 7 | (** 8 | 0 CONST0 9 | 1 MAKEBLOCK1 0 10 | 3 ATOM0 11 | 4 SETGLOBAL T040-makeblock1 12 | 6 STOP 13 | **) 14 | -------------------------------------------------------------------------------- /testsuite/tests/typing-misc/labels.ml: -------------------------------------------------------------------------------- 1 | (* PR#5835 *) 2 | let f ~x = x + 1;; 3 | f ?x:0;; 4 | 5 | (* PR#6352 *) 6 | let foo (f : unit -> unit) = ();; 7 | let g ?x () = ();; 8 | foo ((); g);; 9 | 10 | (* PR#5748 *) 11 | foo (fun ?opt () -> ()) ;; (* fails *) 12 | -------------------------------------------------------------------------------- /testsuite/tests/formats-transition/invalid_formats.ml: -------------------------------------------------------------------------------- 1 | (* Empty file added to create a conflict with branch 4.02 because 2 | the test only makes sense on 4.02.x and will not work on 4.03+ 3 | When merging, don't forget to remove also the .ml.reference file. 4 | *) 5 | -------------------------------------------------------------------------------- /testsuite/tests/typing-modules-bugs/pr5164_ok.ml: -------------------------------------------------------------------------------- 1 | module type INCLUDING = sig 2 | include module type of List 3 | include module type of ListLabels 4 | end 5 | 6 | module Including_typed: INCLUDING = struct 7 | include List 8 | include ListLabels 9 | end 10 | -------------------------------------------------------------------------------- /otherlibs/dynlink/dynlinkaux.mlpack: -------------------------------------------------------------------------------- 1 | Misc Config Clflags Tbl Consistbl 2 | Terminfo Warnings Asttypes Location Longident 3 | Ident Path Primitive Types Btype Subst Predef 4 | Datarepr Cmi_format Env Lambda Instruct Cmo_format Opcodes 5 | Runtimedef Bytesections Dll Meta Symtable 6 | -------------------------------------------------------------------------------- /testsuite/tests/typing-gadts/pr6174.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # Characters 137-138: 3 | fun C k -> k (fun x -> x);; 4 | ^ 5 | Error: This expression has type ex#0 but an expression was expected of type 6 | ex#1 = (ex#2 -> ex#1) -> ex#1 7 | # 8 | -------------------------------------------------------------------------------- /testsuite/tests/typing-polyvariants-bugs-2/pr3918c.ml: -------------------------------------------------------------------------------- 1 | (* 2 | ocamlc -c pr3918a.mli pr3918b.mli 3 | rm -f pr3918a.cmi 4 | ocamlc -c pr3918c.ml 5 | *) 6 | 7 | open Pr3918b 8 | 9 | let f x = (x : 'a vlist :> 'b vlist) 10 | let f (x : 'a vlist) = (x : 'b vlist) 11 | -------------------------------------------------------------------------------- /testsuite/tests/typing-recmod/t13ok.ml: -------------------------------------------------------------------------------- 1 | (* OK *) 2 | class type [ 'node ] extension = object method node : 'node end 3 | class type [ 'ext ] node = object constraint 'ext = 'ext node #extension end 4 | class x = object method node : x node = assert false end 5 | type t = x node;; 6 | -------------------------------------------------------------------------------- /testsuite/tests/warnings/w06.reference: -------------------------------------------------------------------------------- 1 | File "w06.ml", line 5, characters 9-12: 2 | Warning 6: label bar was omitted in the application of this function. 3 | File "w06.ml", line 6, characters 9-12: 4 | Warning 6: labels foo, baz were omitted in the application of this function. 5 | -------------------------------------------------------------------------------- /testsuite/tests/typing-gadts/pr5785.ml: -------------------------------------------------------------------------------- 1 | module Add (T : sig type two end) = 2 | struct 3 | type _ t = 4 | | One : [`One] t 5 | | Two : T.two t 6 | 7 | let add (type a) : a t * a t -> string = function 8 | | One, One -> "two" 9 | | Two, Two -> "four" 10 | end;; 11 | -------------------------------------------------------------------------------- /testsuite/tests/typing-gadts/pr6174.ml.principal.reference: -------------------------------------------------------------------------------- 1 | 2 | # Characters 137-138: 3 | fun C k -> k (fun x -> x);; 4 | ^ 5 | Error: This expression has type ex#0 but an expression was expected of type 6 | ex#1 = (ex#2 -> ex#1) -> ex#1 7 | # 8 | -------------------------------------------------------------------------------- /testsuite/tests/typing-objects/pr5545.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # type foo = int 3 | # class o : object method x : foo method y : int end 4 | # class o : object method x : foo method y : int end 5 | # class o : object method x : int method y : foo end 6 | # 7 | -------------------------------------------------------------------------------- /testsuite/tests/typing-recmod/t10ok.ml: -------------------------------------------------------------------------------- 1 | (* OK *) 2 | module rec A : sig type 'a t = 'a array B.t * 'a list B.t end 3 | = struct type 'a t = 'a array B.t * 'a list B.t end 4 | and B : sig type 'a t = end 5 | = struct type 'a t = end;; 6 | -------------------------------------------------------------------------------- /testsuite/tests/typing-recmod/t11bad.ml: -------------------------------------------------------------------------------- 1 | (* Bad (not regular) *) 2 | module rec A : sig type 'a t = 'a list B.t end 3 | = struct type 'a t = 'a list B.t end 4 | and B : sig type 'a t = end 5 | = struct type 'a t = end;; 6 | -------------------------------------------------------------------------------- /testsuite/tests/misc-unsafe/fft.reference: -------------------------------------------------------------------------------- 1 | 16... ok 2 | 32... ok 3 | 64... ok 4 | 128... ok 5 | 256... ok 6 | 512... ok 7 | 1024... ok 8 | 2048... ok 9 | 4096... ok 10 | 8192... ok 11 | 16384... ok 12 | 32768... ok 13 | 65536... ok 14 | 131072... ok 15 | 262144... ok 16 | 524288... ok 17 | -------------------------------------------------------------------------------- /testsuite/tests/typing-recmod/t08bad.ml: -------------------------------------------------------------------------------- 1 | (* Bad (not regular) *) 2 | module rec A : sig type 'a t = end 3 | = struct type 'a t = end 4 | and B : sig type 'a t = 'a A.t end = struct type 'a t = 'a A.t end;; 5 | -------------------------------------------------------------------------------- /testsuite/tests/typing-modules-bugs/pr6651_ok.ml: -------------------------------------------------------------------------------- 1 | module type S = sig 2 | module type T 3 | module X : T 4 | end 5 | 6 | module F (X : S) = X.X 7 | 8 | module M = struct 9 | module type T = sig type t end 10 | module X = struct type t = int end 11 | end 12 | 13 | type t = F(M).t 14 | -------------------------------------------------------------------------------- /testsuite/tests/typing-objects/pr5545.ml.principal.reference: -------------------------------------------------------------------------------- 1 | 2 | # type foo = int 3 | # class o : object method x : foo method y : int end 4 | # class o : object method x : foo method y : int end 5 | # class o : object method x : int method y : foo end 6 | # 7 | -------------------------------------------------------------------------------- /testsuite/tests/typing-modules-bugs/pr6240_ok.ml: -------------------------------------------------------------------------------- 1 | module M : sig 2 | module type T 3 | module F (X : T) : sig end 4 | end = struct 5 | module type T = sig end 6 | module F (X : T) = struct end 7 | end 8 | 9 | module type T = M.T 10 | 11 | module F : functor (X : T) -> sig end = M.F 12 | -------------------------------------------------------------------------------- /testsuite/tests/typing-polyvariants-bugs/pr5057a_bad.ml: -------------------------------------------------------------------------------- 1 | (* This one should fail *) 2 | 3 | let f flag = 4 | let module T = Set.Make(struct type t = int let compare = compare end) in 5 | let _ = match flag with `A -> 0 | `B r -> r in 6 | let _ = match flag with `A -> T.mem | `B r -> r in 7 | () 8 | -------------------------------------------------------------------------------- /testsuite/tests/lib-dynlink-bytecode/main.reference: -------------------------------------------------------------------------------- 1 | Loading plug1.cma 2 | This is stub1! 3 | ABCDEF 4 | Loading plug2.cma 5 | This is stub2, calling stub1: 6 | This is stub1! 7 | Ok! 8 | This is Plug2.f 9 | Result is: 2 10 | This is Plug1.f 11 | Result is: 1 12 | This is Main.f 13 | Result is: 0 14 | -------------------------------------------------------------------------------- /testsuite/tests/typing-recmod/t09bad.ml: -------------------------------------------------------------------------------- 1 | (* Bad (not regular) *) 2 | module rec A : sig type 'a t = 'a B.t end 3 | = struct type 'a t = 'a B.t end 4 | and B : sig type 'a t = end 5 | = struct type 'a t = end;; 6 | -------------------------------------------------------------------------------- /testsuite/tests/typing-gadts/pr5848.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # module B : 3 | sig type (_, _) t = Eq : ('a, 'a) t val f : 'a -> 'b -> ('a, 'b) t end 4 | # Characters 65-67: 5 | | Eq -> 5 6 | ^^ 7 | Error: The GADT constructor Eq of type B.t must be qualified in this pattern. 8 | # 9 | -------------------------------------------------------------------------------- /native-tests/test13.ml: -------------------------------------------------------------------------------- 1 | effect Foo : int -> int 2 | 3 | let r = 4 | try 5 | perform (Foo 3) 6 | with effect (Foo i) k -> 7 | (* continuation called outside try/with *) 8 | try 9 | continue k (i + 1) 10 | with effect (Foo i) k -> failwith "NO" 11 | 12 | let () = Printf.printf "%d\n" r 13 | -------------------------------------------------------------------------------- /ocamldoc/.ignore: -------------------------------------------------------------------------------- 1 | ocamldoc 2 | ocamldoc.opt 3 | odoc_crc.ml 4 | odoc_lexer.ml 5 | odoc_ocamlhtml.ml 6 | odoc_parser.ml 7 | odoc_parser.mli 8 | odoc_see_lexer.ml 9 | odoc_text_lexer.ml 10 | odoc_text_parser.ml 11 | odoc_text_parser.mli 12 | stdlib_man 13 | *.output 14 | test_stdlib 15 | test_latex 16 | test 17 | -------------------------------------------------------------------------------- /testsuite/tests/tool-debugger/find-artifacts/in/foo.ml: -------------------------------------------------------------------------------- 1 | open Blah 2 | 3 | let print = function 4 | | Foo -> print_endline "Foo"; 5 | | Bar s -> print_endline ("Bar(" ^ s ^ ")") 6 | 7 | let main () = 8 | let x = Foo in 9 | let y = Bar "hi" in 10 | print x; 11 | print y 12 | 13 | let _ = main () 14 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocamldoc/t02.ml: -------------------------------------------------------------------------------- 1 | module Foo = struct type u type t = int let x = 1 end;; 2 | module type TFoo = module type of Foo;; 3 | 4 | module type TBar = TFoo with type u := float;; 5 | 6 | module type Gee = 7 | sig 8 | module M : module type of Foo 9 | include module type of Foo 10 | end 11 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t040-makeblock2.ml: -------------------------------------------------------------------------------- 1 | type t = { 2 | mutable a : int; 3 | mutable b : int; 4 | };; 5 | 6 | { a = 0; b = 0 };; 7 | 8 | (** 9 | 0 CONST0 10 | 1 PUSHCONST0 11 | 2 MAKEBLOCK2 0 12 | 4 ATOM0 13 | 5 SETGLOBAL T040-makeblock2 14 | 7 STOP 15 | **) 16 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t051-getglobalfield.ml: -------------------------------------------------------------------------------- 1 | Lib.x;; 2 | 3 | (** 4 | 0 CONSTINT 42 5 | 2 PUSHACC0 6 | 3 MAKEBLOCK1 0 7 | 5 POP 1 8 | 7 SETGLOBAL Lib 9 | 9 GETGLOBALFIELD Lib, 0 10 | 12 ATOM0 11 | 13 SETGLOBAL T051-getglobalfield 12 | 15 STOP 13 | **) 14 | -------------------------------------------------------------------------------- /testsuite/tests/basic-io-2/test-file-short-lines: -------------------------------------------------------------------------------- 1 | ## 2 | # Host Database 3 | # 4 | # localhost is used to configure the loopback interface 5 | # when the system is booting. Do not change this entry. 6 | ## 7 | 127.0.0.1 localhost 8 | 255.255.255.255 broadcasthost 9 | ::1 localhost 10 | fe80::1%lo0 localhost 11 | -------------------------------------------------------------------------------- /testsuite/tests/lib-threads/test-file-short-lines: -------------------------------------------------------------------------------- 1 | ## 2 | # Host Database 3 | # 4 | # localhost is used to configure the loopback interface 5 | # when the system is booting. Do not change this entry. 6 | ## 7 | 127.0.0.1 localhost 8 | 255.255.255.255 broadcasthost 9 | ::1 localhost 10 | fe80::1%lo0 localhost 11 | -------------------------------------------------------------------------------- /experimental/garrigue/variable-names.ml: -------------------------------------------------------------------------------- 1 | let f (x : < a:int; .. > as 'me1) = (x : < b:bool; .. > as 'me2);; 2 | let f (x : < a:int; .. > as 'me1) = (x : < a:int; b:bool; .. > as 'me2);; 3 | let f (x : [> `A of int] as 'me1) = (x : [> `B of bool] as 'me2);; 4 | let f (x : [> `A of int] as 'me1) = (x : [`A of int | `B of 'me2] as 'me2);; 5 | -------------------------------------------------------------------------------- /testsuite/tests/typing-gadts/pr5848.ml: -------------------------------------------------------------------------------- 1 | module B : sig 2 | type (_, _) t = Eq: ('a, 'a) t 3 | val f: 'a -> 'b -> ('a, 'b) t 4 | end 5 | = 6 | struct 7 | type (_, _) t = Eq: ('a, 'a) t 8 | let f t1 t2 = Obj.magic Eq 9 | end;; 10 | 11 | let of_type: type a. a -> a = fun x -> 12 | match B.f x 4 with 13 | | Eq -> 5 14 | ;; 15 | -------------------------------------------------------------------------------- /testsuite/tests/typing-modules/pr5911.ml: -------------------------------------------------------------------------------- 1 | module type S = sig 2 | type t 3 | val x : t 4 | end;; 5 | 6 | module Good (X : S with type t := unit) = struct 7 | let () = X.x 8 | end;; 9 | 10 | module type T = sig module M : S end;; 11 | 12 | module Bad (X : T with type M.t := unit) = struct 13 | let () = X.M.x 14 | end;; 15 | -------------------------------------------------------------------------------- /testsuite/tests/typing-rectypes-bugs/pr5343_bad.ml: -------------------------------------------------------------------------------- 1 | module M : sig 2 | type 'a t 3 | type u = u t and v = v t 4 | val f : int -> u 5 | val g : v -> bool 6 | end = struct 7 | type 'a t = 'a 8 | type u = int and v = bool 9 | let f x = x 10 | let g x = x 11 | end;; 12 | 13 | let h (x : int) : bool = M.g (M.f x);; 14 | -------------------------------------------------------------------------------- /testsuite/tests/basic/constprop.reference: -------------------------------------------------------------------------------- 1 | booleans: passed 2 | integers: passed 3 | floats: passed 4 | 32-bit integers: passed 5 | native integers: passed 6 | 64-bit integers: passed 7 | integer conversions: passed 8 | 32-bit integer conversions: passed 9 | native integer conversions: passed 10 | 64-bit integer conversions: passed 11 | -------------------------------------------------------------------------------- /testsuite/tests/lib-threads/testexit.reference: -------------------------------------------------------------------------------- 1 | A exiting 2 | A: 1 3 | A: 2 4 | A: 3 5 | A: 4 6 | B exiting 7 | B: 1 8 | B: 2 9 | B: 3 10 | B: 4 11 | B: 5 12 | B: 6 13 | B: 7 14 | C exiting 15 | C: 1 16 | C: 10 17 | C: 2 18 | C: 3 19 | C: 4 20 | C: 5 21 | C: 6 22 | C: 7 23 | C: 8 24 | C: 9 25 | Main exiting 26 | Main: 1 27 | Main: 2 28 | -------------------------------------------------------------------------------- /experimental/frisch/test_copy_typedef.mli: -------------------------------------------------------------------------------- 1 | module type S = sig 2 | type t 3 | val x: int 4 | end 5 | 6 | module type T = sig 7 | type t 8 | 9 | module type M = sig 10 | type t = A | B of t 11 | end 12 | end 13 | 14 | module M : sig 15 | type t = 16 | | A 17 | | B of string 18 | end 19 | 20 | type t = int list 21 | -------------------------------------------------------------------------------- /native-tests/test20.ml: -------------------------------------------------------------------------------- 1 | effect E : string 2 | effect F : unit 3 | 4 | let _ = 5 | try 6 | try 7 | print_endline @@ "Hello" ^ perform E 8 | with 9 | | effect F _ -> failwith "impossible.." 10 | with 11 | | effect E k -> 12 | let k' = Obj.clone k in 13 | continue k ""; 14 | continue k' ", again!" 15 | -------------------------------------------------------------------------------- /testsuite/tests/lib-dynlink-csharp/main.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | public class M { 4 | [DllImport("main.dll")] 5 | public static extern void start_caml_engine(); 6 | 7 | public static void Main() { 8 | System.Console.WriteLine("Now starting the OCaml engine."); 9 | start_caml_engine(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/tests/typing-modules/printing.ml: -------------------------------------------------------------------------------- 1 | (* PR#6650 *) 2 | 3 | module type S = sig 4 | class type c = object method m : int end 5 | module M : sig 6 | class type d = c 7 | end 8 | end;; 9 | module F (X : S) = X.M;; 10 | 11 | (* PR#6648 *) 12 | 13 | module M = struct module N = struct let x = 1 end end;; 14 | #show_module M;; 15 | -------------------------------------------------------------------------------- /testsuite/tests/typing-gadts/pr6158.ml: -------------------------------------------------------------------------------- 1 | type 'a t = T of 'a 2 | type 'a s = S of 'a 3 | 4 | type (_, _) eq = Refl : ('a, 'a) eq;; 5 | 6 | let f : (int s, int t) eq -> unit = function Refl -> ();; 7 | 8 | module M (S : sig type 'a t = T of 'a type 'a s = T of 'a end) = 9 | struct let f : ('a S.s, 'a S.t) eq -> unit = function Refl -> () end;; 10 | -------------------------------------------------------------------------------- /testsuite/tests/typing-recmod/t14bad.ml: -------------------------------------------------------------------------------- 1 | (* Bad - PR 4261 *) 2 | 3 | module PR_4261 = struct 4 | module type S = 5 | sig 6 | type t 7 | end 8 | 9 | module type T = 10 | sig 11 | module D : S 12 | type t = D.t 13 | end 14 | 15 | module rec U : T with module D = U' = U 16 | and U' : S with type t = U'.t = U 17 | end;; 18 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t060-raise.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | raise End_of_file;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 GETGLOBAL End_of_file 11 | 11 MAKEBLOCK1 0 12 | 13 RAISE 13 | 14 SETGLOBAL T060-raise 14 | 16 STOP 15 | **) 16 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t330-compact-1.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | Gc.compact ();; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 CONST0 11 | 10 C_CALL1 gc_compaction 12 | 12 ATOM0 13 | 13 SETGLOBAL T330-compact-1 14 | 15 STOP 15 | **) 16 | -------------------------------------------------------------------------------- /testsuite/tests/typing-warnings/unused_types.ml: -------------------------------------------------------------------------------- 1 | module Unused : sig 2 | end = struct 3 | type unused = int 4 | end 5 | ;; 6 | 7 | module Unused_nonrec : sig 8 | end = struct 9 | type nonrec used = int 10 | type nonrec unused = used 11 | end 12 | ;; 13 | 14 | module Unused_rec : sig 15 | end = struct 16 | type unused = A of unused 17 | end 18 | ;; 19 | -------------------------------------------------------------------------------- /testsuite/tests/basic-more/pr6216.ml: -------------------------------------------------------------------------------- 1 | (* PR6216: wrong inlining of GADT match *) 2 | 3 | type _ t = 4 | | Float : float t 5 | | String : string t 6 | 7 | let f : type a . a t -> a -> unit = fun t a -> 8 | match t with 9 | | Float -> () 10 | | String -> ignore (String.length a : int) 11 | 12 | let _g (kind : float t) (x : float) : unit = f kind (x *. 13.) 13 | -------------------------------------------------------------------------------- /testsuite/tests/prim-bigstring/Makefile: -------------------------------------------------------------------------------- 1 | BASEDIR=../.. 2 | LIBRARIES=unix bigarray 3 | ADD_COMPFLAGS=-I $(OTOPDIR)/otherlibs/$(UNIXLIBVAR)unix \ 4 | -I $(OTOPDIR)/otherlibs/bigarray 5 | LD_PATH=$(TOPDIR)/otherlibs/$(UNIXLIBVAR)unix:$(TOPDIR)/otherlibs/bigarray 6 | 7 | include $(BASEDIR)/makefiles/Makefile.several 8 | include $(BASEDIR)/makefiles/Makefile.common 9 | -------------------------------------------------------------------------------- /native-tests/test4.ml: -------------------------------------------------------------------------------- 1 | (* input: 100000. Triggers stack overflow which invokes caml_call_realloc_stack, 2 | * which inturn causes GC to be invoked. *) 3 | 4 | let rec sum n = if n = 0 then 0 else n + sum (n-1) 5 | 6 | let n = 7 | if Array.length Sys.argv != 2 then 100000 8 | else int_of_string @@ Sys.argv.(1) 9 | let () = Printf.printf "sum(%d) = %d\n" n (sum n) 10 | -------------------------------------------------------------------------------- /testsuite/tests/basic-modules/main.ml: -------------------------------------------------------------------------------- 1 | (* PR#6435 *) 2 | 3 | module F (M : sig 4 | type t 5 | module Set : Set.S with type elt = t 6 | end) = 7 | struct 8 | let test set = Printf.printf "%d\n" (M.Set.cardinal set) 9 | end 10 | 11 | module M = F (Offset) 12 | 13 | let () = M.test (Offset.M.Set.singleton "42") 14 | let v = Pr6726.Test.v 15 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t040-makeblock3.ml: -------------------------------------------------------------------------------- 1 | type t = { 2 | mutable a : int; 3 | mutable b : int; 4 | mutable c : int; 5 | };; 6 | 7 | { a = 0; b = 0; c = 0 };; 8 | 9 | (** 10 | 0 CONST0 11 | 1 PUSHCONST0 12 | 2 PUSHCONST0 13 | 3 MAKEBLOCK3 0 14 | 5 ATOM0 15 | 6 SETGLOBAL T040-makeblock3 16 | 8 STOP 17 | **) 18 | -------------------------------------------------------------------------------- /testsuite/tests/typing-private-bugs/pr5026_bad.ml: -------------------------------------------------------------------------------- 1 | type untyped;; 2 | type -'a typed = private untyped;; 3 | type -'typing wrapped = private sexp 4 | and +'a t = 'a typed wrapped 5 | and sexp = private untyped wrapped;; 6 | class type ['a] s3 = object 7 | val underlying : 'a t 8 | end;; 9 | class ['a] s3object r : ['a] s3 = object 10 | val underlying = r 11 | end;; 12 | -------------------------------------------------------------------------------- /testsuite/tests/typing-objects-bugs/pr4435_bad.ml: -------------------------------------------------------------------------------- 1 | (* Two v's in the same class *) 2 | class c v = object initializer print_endline v val v = 42 end;; 3 | new c "42";; 4 | 5 | (* Two hidden v's in the same class! *) 6 | class c (v : int) = 7 | object 8 | method v0 = v 9 | inherit ((fun v -> object method v : string = v end) "42") 10 | end;; 11 | (new c 42)#v0;; 12 | -------------------------------------------------------------------------------- /native-tests/test19.ml: -------------------------------------------------------------------------------- 1 | effect E : string 2 | 3 | let _ = 4 | try 5 | try 6 | print_endline @@ "Hello" ^ perform E 7 | with 8 | | effect E k -> 9 | print_endline "intercepting request.."; 10 | continue k (perform E) 11 | with 12 | | effect E k -> 13 | let k' = Obj.clone k in 14 | continue k ""; 15 | continue k' ", again!" 16 | -------------------------------------------------------------------------------- /testsuite/tests/typing-modules/pr5911.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # module type S = sig type t val x : t end 3 | # module Good : functor (X : sig val x : unit end) -> sig end 4 | # module type T = sig module M : S end 5 | # Characters 33-35: 6 | module Bad (X : T with type M.t := unit) = struct 7 | ^^ 8 | Error: Syntax error 9 | # 10 | -------------------------------------------------------------------------------- /testsuite/tests/typing-modules/printing.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # module type S = 3 | sig 4 | class type c = object method m : int end 5 | module M : sig class type d = c end 6 | end 7 | # module F : functor (X : S) -> sig class type d = X.c end 8 | # module M : sig module N : sig val x : int end end 9 | # module M : sig module N : sig ... end end 10 | # 11 | -------------------------------------------------------------------------------- /testsuite/tests/typing-polyvariants-bugs/pr4775_ok.ml: -------------------------------------------------------------------------------- 1 | module type Poly = sig 2 | type 'a t = 'a constraint 'a = [> ] 3 | end 4 | 5 | module Combine (A : Poly) (B : Poly) = struct 6 | type ('a, 'b) t = 'a A.t constraint 'a = 'b B.t 7 | end 8 | 9 | module C = Combine 10 | (struct type 'a t = 'a constraint 'a = [> ] end) 11 | (struct type 'a t = 'a constraint 'a = [> ] end) 12 | -------------------------------------------------------------------------------- /testsuite/tests/typing-recmod/t12bad.ml: -------------------------------------------------------------------------------- 1 | (* Bad (not regular) *) 2 | module rec M : 3 | sig 4 | class ['a] c : 'a -> object 5 | method map : ('a -> 'b) -> 'b M.c 6 | end 7 | end 8 | = struct 9 | class ['a] c (x : 'a) = object 10 | method map : 'b. ('a -> 'b) -> 'b M.c 11 | = fun f -> new M.c (f x) 12 | end 13 | end;; 14 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t051-pushgetglobalfield.ml: -------------------------------------------------------------------------------- 1 | let _ = () in Lib.x;; 2 | 3 | (** 4 | 0 CONSTINT 42 5 | 2 PUSHACC0 6 | 3 MAKEBLOCK1 0 7 | 5 POP 1 8 | 7 SETGLOBAL Lib 9 | 9 CONST0 10 | 10 PUSHGETGLOBALFIELD Lib, 0 11 | 13 POP 1 12 | 15 ATOM0 13 | 16 SETGLOBAL T051-pushgetglobalfield 14 | 18 STOP 15 | **) 16 | -------------------------------------------------------------------------------- /experimental/frisch/test_copy_typedef.ml: -------------------------------------------------------------------------------- 1 | module type S = [%copy_typedef] 2 | 3 | module type T = sig 4 | type t 5 | 6 | module type M = [%copy_typedef] 7 | end 8 | 9 | module M = struct 10 | type t = [%copy_typedef] 11 | end 12 | 13 | type t = [%copy_typedef] 14 | 15 | let _x = M.A 16 | let _y : t = [1; 2] 17 | 18 | 19 | type _loc = [%copy_typedef "../../parsing/location.mli" t] 20 | -------------------------------------------------------------------------------- /native-tests/test14.ml: -------------------------------------------------------------------------------- 1 | effect Foo : int -> int 2 | 3 | let f () = (perform (Foo 3)) (* 3 + 1 *) 4 | + (perform (Foo 3)) (* 3 + 1 *) 5 | 6 | let r = 7 | try 8 | f () 9 | with effect (Foo i) k -> 10 | (* continuation called outside try/with *) 11 | try 12 | continue k (i + 1) 13 | with effect (Foo i) k -> failwith "NO" 14 | 15 | let () = Printf.printf "%d\n" r 16 | -------------------------------------------------------------------------------- /testsuite/tests/typing-objects-bugs/woodyatt_ok.ml: -------------------------------------------------------------------------------- 1 | (* test.ml *) 2 | class alfa = object(_:'self) 3 | method x: 'a. ('a, out_channel, unit) format -> 'a = Printf.printf 4 | end 5 | 6 | class bravo a = object 7 | val y = (a :> alfa) 8 | initializer y#x "bravo initialized" 9 | end 10 | 11 | class charlie a = object 12 | inherit bravo a 13 | initializer y#x "charlie initialized" 14 | end 15 | -------------------------------------------------------------------------------- /testsuite/tests/typing-polyvariants-bugs/pr5057_ok.ml: -------------------------------------------------------------------------------- 1 | (* PR5057 *) 2 | 3 | module TT = struct 4 | module IntSet = Set.Make(struct type t = int let compare = compare end) 5 | end 6 | 7 | let () = 8 | let f flag = 9 | let module T = TT in 10 | let _ = match flag with `A -> 0 | `B r -> r in 11 | let _ = match flag with `A -> T.IntSet.mem | `B r -> r in 12 | () 13 | in 14 | f `A 15 | -------------------------------------------------------------------------------- /testsuite/tests/match-exception-warnings/exhaustiveness_warnings.ml: -------------------------------------------------------------------------------- 1 | (** Test exhaustiveness. 2 | 3 | match clauses should continue to give warnings about inexhaustive 4 | value-matching clauses when there is an exception-matching clause 5 | *) 6 | 7 | let test_match_exhaustiveness () = 8 | match None with 9 | | exception e -> () 10 | | Some false -> () 11 | | None -> () 12 | ;; 13 | -------------------------------------------------------------------------------- /testsuite/tests/typing-modules/b2.ml: -------------------------------------------------------------------------------- 1 | open A 2 | let f = 3 | L.map S.capitalize 4 | 5 | let () = 6 | L.iter print_endline (f ["jacques"; "garrigue"]) 7 | 8 | module C : sig module L : module type of List end = struct include A end 9 | 10 | (* The following introduces a (useless) dependency on A: 11 | module C : sig module L : module type of List end = A 12 | *) 13 | 14 | (* No dependency on D *) 15 | -------------------------------------------------------------------------------- /testsuite/tests/typing-polyvariants-bugs/pr4933_ok.ml: -------------------------------------------------------------------------------- 1 | module type Priv = sig 2 | type t = private int 3 | end 4 | 5 | module Make (Unit:sig end): Priv = struct type t = int end 6 | 7 | module A = Make (struct end) 8 | 9 | module type Priv' = sig 10 | type t = private [> `A] 11 | end 12 | 13 | module Make' (Unit:sig end): Priv' = struct type t = [`A] end 14 | 15 | module A' = Make' (struct end) 16 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocamldoc/t03.ml: -------------------------------------------------------------------------------- 1 | module Foo = struct type t = int let x = 1 end;; 2 | module type MT = module type of Foo;; 3 | module Bar = struct type t = int let x = 2 end;; 4 | 5 | module type MT2 = sig type t val x : t end;; 6 | module type Gee = MT2 with type t = float ;; 7 | module T = (val (if true then (module Foo:MT2 with type t = int) else (module Bar: MT2 with type t = int)) : MT2 with type t = int);; 8 | -------------------------------------------------------------------------------- /testsuite/tests/typing-gadts/pr6241.ml: -------------------------------------------------------------------------------- 1 | type (_, _) t = 2 | A : ('a, 'a) t 3 | | B : string -> ('a, 'b) t 4 | ;; 5 | 6 | module M (A : sig module type T end) (B : sig module type T end) = 7 | struct 8 | let f : ((module A.T), (module B.T)) t -> string = function 9 | | B s -> s 10 | end;; 11 | 12 | module A = struct module type T = sig end end;; 13 | 14 | module N = M(A)(A);; 15 | 16 | let x = N.f A;; 17 | -------------------------------------------------------------------------------- /testsuite/tests/typing-objects/pr6123_bad.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # Characters 253-257: 3 | let args = List.map (fun ty -> new argument(self, ty)) args_ty in 4 | ^^^^ 5 | Error: This expression has type < arguments : 'a; .. > 6 | but an expression was expected of type 'b 7 | Self type cannot escape its class 8 | # 9 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t190-makefloatblock-1.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | let x = 0.0 in [| x |];; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 GETGLOBAL 0 11 | 11 PUSHACC0 12 | 12 MAKEFLOATBLOCK 1 13 | 14 POP 1 14 | 16 ATOM0 15 | 17 SETGLOBAL T190-makefloatblock-1 16 | 19 STOP 17 | **) 18 | -------------------------------------------------------------------------------- /testsuite/tests/match-exception-warnings/exhaustiveness_warnings.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # * * * * Characters 210-289: 3 | ....match None with 4 | | exception e -> () 5 | | Some false -> () 6 | | None -> () 7 | Warning 8: this pattern-matching is not exhaustive. 8 | Here is an example of a value that is not matched: 9 | Some true 10 | val test_match_exhaustiveness : unit -> unit = 11 | # 12 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t041-makeblock.ml: -------------------------------------------------------------------------------- 1 | type t = { 2 | mutable a : int; 3 | mutable b : int; 4 | mutable c : int; 5 | mutable d : int; 6 | };; 7 | 8 | { a = 0; b = 0; c = 0; d = 0 };; 9 | 10 | (** 11 | 0 CONST0 12 | 1 PUSHCONST0 13 | 2 PUSHCONST0 14 | 3 PUSHCONST0 15 | 4 MAKEBLOCK 4, 0 16 | 7 ATOM0 17 | 8 SETGLOBAL T041-makeblock 18 | 10 STOP 19 | **) 20 | -------------------------------------------------------------------------------- /testsuite/tests/typing-objects/pr6123_bad.ml.principal.reference: -------------------------------------------------------------------------------- 1 | 2 | # Characters 253-257: 3 | let args = List.map (fun ty -> new argument(self, ty)) args_ty in 4 | ^^^^ 5 | Error: This expression has type < arguments : 'a; .. > 6 | but an expression was expected of type 'b 7 | Self type cannot escape its class 8 | # 9 | -------------------------------------------------------------------------------- /native-tests/test5.ml: -------------------------------------------------------------------------------- 1 | (* input: 100000. Triggers heap overflow which invokes caml_call_gc, which 2 | * inturn causes GC to be invoked. *) 3 | 4 | let rec mk_list length acc = 5 | if length < 1 then acc 6 | else mk_list (length-1) ((length-1)::acc) 7 | 8 | let n = 9 | if Array.length Sys.argv != 2 then 100000 10 | else int_of_string @@ Sys.argv.(1) 11 | let l = mk_list n [] 12 | let () = Printf.printf "%d\n" (List.hd l) 13 | -------------------------------------------------------------------------------- /testsuite/tests/typing-objects/pr5545.ml: -------------------------------------------------------------------------------- 1 | type foo = int;; 2 | 3 | class o = 4 | object(this) 5 | method x : foo = 10 6 | method y : int = this # x 7 | end;; 8 | 9 | 10 | class o = 11 | object(this) 12 | method x : foo = 10 13 | method y = (this # x : int) 14 | end;; 15 | 16 | 17 | 18 | class o = 19 | object(this) 20 | method x : int = (10 : int) 21 | method y = (this # x : foo) 22 | end;; 23 | -------------------------------------------------------------------------------- /tools/.ignore: -------------------------------------------------------------------------------- 1 | ocamldep 2 | ocamldep.opt 3 | ocamldep.bak 4 | ocamlprof 5 | opnames.ml 6 | dumpobj 7 | dumpapprox 8 | objinfo 9 | cvt_emit 10 | cvt_emit.bak 11 | cvt_emit.ml 12 | ocamlcp 13 | ocamloptp 14 | ocamlmktop 15 | primreq 16 | ocamldumpobj 17 | keywords 18 | lexer299.ml 19 | ocaml299to3 20 | ocamlmklib 21 | ocamlmklibconfig.ml 22 | lexer301.ml 23 | scrapelabels 24 | addlabels 25 | objinfo_helper 26 | read_cmt 27 | read_cmt.opt 28 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t160-closure.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | let f () = ();; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 BRANCH 14 11 | 11 CONST0 12 | 12 RETURN 1 13 | 14 CLOSURE 0, 11 14 | 17 PUSHACC0 15 | 18 MAKEBLOCK1 0 16 | 20 POP 1 17 | 22 SETGLOBAL T160-closure 18 | 24 STOP 19 | **) 20 | -------------------------------------------------------------------------------- /testsuite/tests/typing-objects-bugs/pr5156_ok.ml: -------------------------------------------------------------------------------- 1 | class type t = object end;; 2 | class ['a] o1 = object (self : #t as 'a) end;; 3 | type 'a obj = ( < .. > as 'a);; 4 | class type ['a] o2 = object ('a obj) end;; 5 | class ['a] o3 = object (self : 'a obj) end;; 6 | class ['a] o4 = object (self) method m = (self : 'a obj) end;; 7 | (* 8 | let o = object (self : 'a obj) end;; 9 | let o = object (self) method m = (self : 'a obj) end;; 10 | *) 11 | -------------------------------------------------------------------------------- /testsuite/tests/basic-more/testrandom.reference: -------------------------------------------------------------------------------- 1 | 344 685 182 641 439 500 104 20 921 370 217 885 949 678 615 412 401 606 428 869 289 2 | 3 | 122.128067547 461.324792129 360.006556146 768.75882284 396.500946942 190.217751234 567.660068681 403.59226778 59.8488223602 363.816246826 764.705761642 172.627051105 481.861849093 399.173195422 629.424106752 391.547032203 676.701133948 174.382120878 994.425675487 585.00027757 34.3270777955 4 | All tests succeeded. 5 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t190-makefloatblock-2.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | let x = 0.0 in [| x; x |];; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 GETGLOBAL 0 11 | 11 PUSHACC0 12 | 12 PUSHACC1 13 | 13 MAKEFLOATBLOCK 2 14 | 15 POP 1 15 | 17 ATOM0 16 | 18 SETGLOBAL T190-makefloatblock-2 17 | 20 STOP 18 | **) 19 | -------------------------------------------------------------------------------- /otherlibs/win32unix/.ignore: -------------------------------------------------------------------------------- 1 | unixLabels.ml* 2 | unix.mli 3 | unix.lib 4 | access.c 5 | addrofstr.c 6 | chdir.c 7 | chmod.c 8 | cst2constr.c 9 | cstringv.c 10 | envir.c 11 | execv.c 12 | execve.c 13 | execvp.c 14 | exit.c 15 | getaddrinfo.c 16 | getcwd.c 17 | gethost.c 18 | gethostname.c 19 | getnameinfo.c 20 | getproto.c 21 | getserv.c 22 | gmtime.c 23 | putenv.c 24 | rmdir.c 25 | socketaddr.c 26 | strofaddr.c 27 | time.c 28 | unlink.c 29 | utimes.c 30 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t070-branchifnot.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | if false then raise Not_found;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 CONST0 11 | 10 BRANCHIFNOT 17 12 | 12 GETGLOBAL Not_found 13 | 14 MAKEBLOCK1 0 14 | 16 RAISE 15 | 17 ATOM0 16 | 18 SETGLOBAL T070-branchifnot 17 | 20 STOP 18 | **) 19 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t101-poptrap.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | try () 3 | with _ -> () 4 | ;; 5 | 6 | (** 7 | 0 CONSTINT 42 8 | 2 PUSHACC0 9 | 3 MAKEBLOCK1 0 10 | 5 POP 1 11 | 7 SETGLOBAL Lib 12 | 9 PUSHTRAP 15 13 | 11 CONST0 14 | 12 POPTRAP 15 | 13 BRANCH 18 16 | 15 PUSHCONST0 17 | 16 POP 1 18 | 18 ATOM0 19 | 19 SETGLOBAL T101-poptrap 20 | 21 STOP 21 | **) 22 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t250-closurerec-1.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | let rec f _ = 0;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 BRANCH 14 11 | 11 CONST0 12 | 12 RETURN 1 13 | 14 CLOSUREREC 0, 11 14 | 18 ACC0 15 | 19 MAKEBLOCK1 0 16 | 21 POP 1 17 | 23 SETGLOBAL T250-closurerec-1 18 | 25 STOP 19 | **) 20 | -------------------------------------------------------------------------------- /testsuite/tests/typing-modules-bugs/pr5914_ok.ml: -------------------------------------------------------------------------------- 1 | type 't a = [ `A ] 2 | type 't wrap = 't constraint 't = [> 't wrap a ] 3 | type t = t a wrap 4 | 5 | module T = struct 6 | let foo : 't wrap -> 't wrap -> unit = fun _ _ -> () 7 | let bar : ('a a wrap as 'a) = `A 8 | end 9 | 10 | module Good : sig 11 | val bar: t 12 | val foo: t -> t -> unit 13 | end = T 14 | 15 | module Bad : sig 16 | val foo: t -> t -> unit 17 | val bar: t 18 | end = T 19 | -------------------------------------------------------------------------------- /testsuite/tests/basic/divint.reference: -------------------------------------------------------------------------------- 1 | 1 int 2 | 2 int 3 | 3 int 4 | 4 int 5 | 5 int 6 | 6 int 7 | 7 int 8 | 9 int 9 | 10 int 10 | 11 int 11 | 12 int 12 | 25 int 13 | 55 int 14 | 125 int 15 | 625 int 16 | -1 int 17 | -2 int 18 | -3 int 19 | 1 nat 20 | 2 nat 21 | 3 nat 22 | 4 nat 23 | 5 nat 24 | 6 nat 25 | 7 nat 26 | 9 nat 27 | 10 nat 28 | 11 nat 29 | 12 nat 30 | 25 nat 31 | 55 nat 32 | 125 nat 33 | 625 nat 34 | -1 nat 35 | -2 nat 36 | -3 nat 37 | Test passed. 38 | -------------------------------------------------------------------------------- /testsuite/tests/match-exception/exception_propagation.ml: -------------------------------------------------------------------------------- 1 | (** 2 | Test that match allows exceptions to propagate. 3 | *) 4 | let () = 5 | try 6 | match 7 | (let _ = raise Not_found in 8 | assert false) 9 | with 10 | | _ -> assert false 11 | | exception Invalid_argument _ -> assert false 12 | with 13 | Not_found -> 14 | print_endline "caught expected exception (Not_found)" 15 | | _ -> 16 | assert false 17 | ;; 18 | -------------------------------------------------------------------------------- /testsuite/tests/typing-gadts/pr6163.ml: -------------------------------------------------------------------------------- 1 | type _ nat = 2 | Zero : [`Zero] nat 3 | | Succ : 'a nat -> [`Succ of 'a] nat;; 4 | type 'a pre_nat = [`Zero | `Succ of 'a];; 5 | type aux = 6 | | Aux : [`Succ of [<[<[<[`Zero] pre_nat] pre_nat] pre_nat]] nat -> aux;; 7 | 8 | let f (Aux x) = 9 | match x with 10 | | Succ Zero -> "1" 11 | | Succ (Succ Zero) -> "2" 12 | | Succ (Succ (Succ Zero)) -> "3" 13 | | Succ (Succ (Succ (Succ Zero))) -> "4" 14 | ;; 15 | -------------------------------------------------------------------------------- /testsuite/tests/typing-modules/b.ml: -------------------------------------------------------------------------------- 1 | open A 2 | let f = 3 | L.map S.capitalize 4 | 5 | let () = 6 | L.iter print_endline (f ["jacques"; "garrigue"]) 7 | 8 | module C : sig module L : module type of List end = struct include A end 9 | 10 | (* The following introduces a (useless) dependency on A: 11 | module C : sig module L : module type of List end = A 12 | *) 13 | 14 | include D' 15 | (* 16 | let () = 17 | print_endline (string_of_int D'.M.y) 18 | *) 19 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t071-boolnot.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | if not true then raise Not_found;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 CONST1 11 | 10 BOOLNOT 12 | 11 BRANCHIFNOT 18 13 | 13 GETGLOBAL Not_found 14 | 15 MAKEBLOCK1 0 15 | 17 RAISE 16 | 18 ATOM0 17 | 19 SETGLOBAL T071-boolnot 18 | 21 STOP 19 | **) 20 | -------------------------------------------------------------------------------- /testsuite/tests/typing-signatures/pr6672.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # module type S = sig type 'a t end 3 | # module type T = sig type 'a t = 'a list end 4 | # Characters 23-43: 5 | module type T = S with type -'a t = 'a list;; 6 | ^^^^^^^^^^^^^^^^^^^^ 7 | Error: In this definition, expected parameter variances are not satisfied. 8 | The 1st type parameter was expected to be contravariant, 9 | but it is injective covariant. 10 | # 11 | -------------------------------------------------------------------------------- /testsuite/tests/basic-modules/pr6726.ml: -------------------------------------------------------------------------------- 1 | module ExtUnixAll = struct 2 | external unused : unit -> unit = "caml_blit_string" 3 | module BigEndian = struct 4 | let get_uint8 str off = 33 5 | end 6 | end 7 | 8 | module ExtUnix = struct 9 | module All = ExtUnixAll 10 | end 11 | 12 | module Test = struct 13 | open ExtUnix.All 14 | let test_endian_string x = 15 | let module B = BigEndian in 16 | B.get_uint8 x 0 17 | let v = test_endian_string 1 18 | end 19 | -------------------------------------------------------------------------------- /experimental/frisch/test_builder.ml: -------------------------------------------------------------------------------- 1 | type t = 2 | { 3 | x: int; 4 | y [@label foo]: int; 5 | z [@default 3]: int; 6 | } [@@builder] 7 | 8 | and s = 9 | { 10 | a: string; 11 | b [@opt]: int option; 12 | c: int [@default 2]; 13 | } [@@builder] 14 | 15 | and sum = 16 | | A of int 17 | | B of string * (string [@label str]) 18 | | C of (int [@label i] [@default 0]) * (string [@label s] [@default ""]) 19 | [@@builder] 20 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t100-pushtrap.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | try raise Not_found 3 | with _ -> () 4 | ;; 5 | 6 | (** 7 | 0 CONSTINT 42 8 | 2 PUSHACC0 9 | 3 MAKEBLOCK1 0 10 | 5 POP 1 11 | 7 SETGLOBAL Lib 12 | 9 PUSHTRAP 16 13 | 11 GETGLOBAL Not_found 14 | 13 MAKEBLOCK1 0 15 | 15 RAISE 16 | 16 PUSHCONST0 17 | 17 POP 1 18 | 19 ATOM0 19 | 20 SETGLOBAL T100-pushtrap 20 | 22 STOP 21 | **) 22 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t190-makefloatblock-3.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | let x = 0.0 in [| x; x; x |];; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 GETGLOBAL 0 11 | 11 PUSHACC0 12 | 12 PUSHACC1 13 | 13 PUSHACC2 14 | 14 MAKEFLOATBLOCK 3 15 | 16 POP 1 16 | 18 ATOM0 17 | 19 SETGLOBAL T190-makefloatblock-3 18 | 21 STOP 19 | **) 20 | -------------------------------------------------------------------------------- /testsuite/tests/typing-gadts/pr6817.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # module A : sig type nil = Cstr end 3 | # type _ s = Nil : A.nil s | Cons : 't s -> ('h -> 't) s 4 | type ('stack, 'typ) var = 5 | Head : (('typ -> 'a) s, 'typ) var 6 | | Tail : ('tail s, 'typ) var -> (('b -> 'tail) s, 'typ) var 7 | type _ lst = CNil : A.nil lst | CCons : 'h * 't lst -> ('h -> 't) lst 8 | # val get_var : ('stk s, 'ret) var -> 'stk lst -> 'ret = 9 | # 10 | -------------------------------------------------------------------------------- /testsuite/tests/typing-objects-bugs/pr3968_bad.ml: -------------------------------------------------------------------------------- 1 | type expr = 2 | [ `Abs of string * expr 3 | | `App of expr * expr 4 | ] 5 | 6 | class type exp = 7 | object 8 | method eval : (string, exp) Hashtbl.t -> expr 9 | end;; 10 | 11 | class app e1 e2 : exp = 12 | object 13 | val l = e1 14 | val r = e2 15 | method eval env = 16 | match l with 17 | | `Abs(var,body) -> 18 | Hashtbl.add env var r; 19 | body 20 | | _ -> `App(l,r); 21 | end 22 | -------------------------------------------------------------------------------- /experimental/garrigue/countchars.ml: -------------------------------------------------------------------------------- 1 | let rec long_lines name n ic = 2 | let l = input_line ic in 3 | if String.length l > 80 then Printf.printf "%s: %d\n%!" name n; 4 | long_lines name (n+1) ic 5 | 6 | let process_file name = 7 | try 8 | let ic = open_in name in 9 | try long_lines name 1 ic 10 | with End_of_file -> close_in ic 11 | with _ ->() 12 | 13 | let () = 14 | for i = 1 to Array.length Sys.argv - 1 do 15 | process_file Sys.argv.(i) 16 | done 17 | -------------------------------------------------------------------------------- /testsuite/tests/basic-io-2/io.reference: -------------------------------------------------------------------------------- 1 | 16-byte chunks 2 | passed 3 | 256-byte chunks 4 | passed 5 | 4096-byte chunks 6 | passed 7 | 65536-byte chunks 8 | passed 9 | 19-byte chunks 10 | passed 11 | 263-byte chunks 12 | passed 13 | 4011-byte chunks 14 | passed 15 | 0...8192 byte chunks 16 | passed 17 | line per line, short lines 18 | passed 19 | line per line, short and long lines 20 | passed 21 | backwards, 4096-byte chunks 22 | passed 23 | backwards, 64-byte chunks 24 | passed 25 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t080-neq.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | if 0 <> 0 then raise Not_found;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 CONST0 11 | 10 PUSHCONST0 12 | 11 NEQ 13 | 12 BRANCHIFNOT 19 14 | 14 GETGLOBAL Not_found 15 | 16 MAKEBLOCK1 0 16 | 18 RAISE 17 | 19 ATOM0 18 | 20 SETGLOBAL T080-neq 19 | 22 STOP 20 | **) 21 | -------------------------------------------------------------------------------- /testsuite/tests/typing-recmod/t19ok.ml: -------------------------------------------------------------------------------- 1 | (* PR 4758, PR 4266 *) 2 | 3 | module PR_4758 = struct 4 | module type S = sig end 5 | module type Mod = sig 6 | module Other : S 7 | end 8 | module rec A : S = struct end 9 | and C : sig include Mod with module Other = A end = struct 10 | module Other = A 11 | end 12 | module C' = C (* check that we can take an alias *) 13 | module F(X:sig end) = struct type t end 14 | let f (x : F(C).t) = (x : F(C').t) 15 | end 16 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t080-gtint.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | if 0 > 0 then raise Not_found;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 CONST0 11 | 10 PUSHCONST0 12 | 11 GTINT 13 | 12 BRANCHIFNOT 19 14 | 14 GETGLOBAL Not_found 15 | 16 MAKEBLOCK1 0 16 | 18 RAISE 17 | 19 ATOM0 18 | 20 SETGLOBAL T080-gtint 19 | 22 STOP 20 | **) 21 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t080-ltint.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | if 0 < 0 then raise Not_found;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 CONST0 11 | 10 PUSHCONST0 12 | 11 LTINT 13 | 12 BRANCHIFNOT 19 14 | 14 GETGLOBAL Not_found 15 | 16 MAKEBLOCK1 0 16 | 18 RAISE 17 | 19 ATOM0 18 | 20 SETGLOBAL T080-ltint 19 | 22 STOP 20 | **) 21 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t162-return.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | let f _ = 0 in f 0;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 BRANCH 14 11 | 11 CONST0 12 | 12 RETURN 1 13 | 14 CLOSURE 0, 11 14 | 17 PUSHCONST0 15 | 18 PUSHACC1 16 | 19 APPLY1 17 | 20 POP 1 18 | 22 ATOM0 19 | 23 SETGLOBAL T162-return 20 | 25 STOP 21 | **) 22 | -------------------------------------------------------------------------------- /testsuite/tests/typing-modules-bugs/pr6572_ok.ml: -------------------------------------------------------------------------------- 1 | module type S = sig 2 | include Set.S 3 | module E : sig val x : int end 4 | end 5 | 6 | module Make(O : Set.OrderedType) : S with type elt = O.t = 7 | struct 8 | include Set.Make(O) 9 | module E = struct let x = 1 end 10 | end 11 | 12 | module rec A : Set.OrderedType = struct 13 | type t = int 14 | let compare = Pervasives.compare 15 | end 16 | and B : S = struct 17 | module C = Make(A) 18 | include C 19 | end 20 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t070-branch.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | if true then 0 else raise Not_found;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 CONST1 11 | 10 BRANCHIFNOT 15 12 | 12 CONST0 13 | 13 BRANCH 20 14 | 15 GETGLOBAL Not_found 15 | 17 MAKEBLOCK1 0 16 | 19 RAISE 17 | 20 ATOM0 18 | 21 SETGLOBAL T070-branch 19 | 23 STOP 20 | **) 21 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t070-branchif.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | if not false then 0 else raise Not_found;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 CONST0 11 | 10 BRANCHIF 15 12 | 12 CONST0 13 | 13 BRANCH 20 14 | 15 GETGLOBAL Not_found 15 | 17 MAKEBLOCK1 0 16 | 19 RAISE 17 | 20 ATOM0 18 | 21 SETGLOBAL T070-branchif 19 | 23 STOP 20 | **) 21 | -------------------------------------------------------------------------------- /testsuite/tests/typing-warnings/pr5892.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # # type _ choice = 3 | Left : CamlinternalOO.label choice 4 | | Right : CamlinternalOO.tag choice 5 | # Characters 31-52: 6 | let f : label choice -> bool = function Left -> true;; (* warn *) 7 | ^^^^^^^^^^^^^^^^^^^^^ 8 | Warning 8: this pattern-matching is not exhaustive. 9 | Here is an example of a value that is not matched: 10 | Right 11 | val f : CamlinternalOO.label choice -> bool = 12 | # 13 | -------------------------------------------------------------------------------- /testsuite/tests/basic/sets.reference: -------------------------------------------------------------------------------- 1 | -10 true false 2 | -9 false false 3 | -8 false false 4 | -7 false true 5 | -6 false false 6 | -5 false false 7 | -4 false false 8 | -3 false true 9 | -2 true false 10 | -1 false false 11 | 0 true false 12 | 1 false true 13 | 2 true false 14 | 3 false false 15 | 4 true false 16 | 5 false true 17 | 6 true false 18 | 7 false false 19 | 8 false false 20 | 9 false true 21 | 10 false false 22 | false 23 | true 24 | true 25 | false 26 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t080-eq.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | if not (0 = 0) then raise Not_found;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 CONST0 11 | 10 PUSHCONST0 12 | 11 EQ 13 | 12 BOOLNOT 14 | 13 BRANCHIFNOT 20 15 | 15 GETGLOBAL Not_found 16 | 17 MAKEBLOCK1 0 17 | 19 RAISE 18 | 20 ATOM0 19 | 21 SETGLOBAL T080-eq 20 | 23 STOP 21 | **) 22 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t092-pushacc0.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | let x = false in 3 | if x then raise Not_found 4 | ;; 5 | 6 | (** 7 | 0 CONSTINT 42 8 | 2 PUSHACC0 9 | 3 MAKEBLOCK1 0 10 | 5 POP 1 11 | 7 SETGLOBAL Lib 12 | 9 CONST0 13 | 10 PUSHACC0 14 | 11 BRANCHIFNOT 18 15 | 13 GETGLOBAL Not_found 16 | 15 MAKEBLOCK1 0 17 | 17 RAISE 18 | 18 POP 1 19 | 20 ATOM0 20 | 21 SETGLOBAL T092-pushacc0 21 | 23 STOP 22 | **) 23 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocamldoc/t01.ml: -------------------------------------------------------------------------------- 1 | (** Testing display of types. 2 | 3 | @test_types_display 4 | *) 5 | 6 | let x = 1 7 | 8 | 9 | module M = struct 10 | let y = 2 11 | 12 | end 13 | 14 | module type MT = sig 15 | type t = string -> int -> string -> (string * string * string) -> 16 | (string * string * string) -> 17 | (string * string * string) -> unit 18 | val y : int 19 | 20 | type obj_type = 21 | < foo : int ; bar : float -> string ; gee : int -> (int * string) > 22 | end 23 | -------------------------------------------------------------------------------- /testsuite/tests/lib-dynlink-native/reference: -------------------------------------------------------------------------------- 1 | Loading plugin.so 2 | Registering module Plugin 3 | COUCOU 4 | Loading plugin2.so 5 | Registering module Plugin2 6 | 1 7 | 2 8 | 6 9 | 1 10 | XXX 11 | Loading plugin_thread.so 12 | Registering module Plugin_thread 13 | Thread 14 | Thread 15 | Thread 16 | Thread 17 | Thread 18 | Thread 19 | Thread 20 | Thread 21 | Thread 22 | Thread 23 | Thread 24 | Thread 25 | Thread 26 | Thread 27 | Thread 28 | Callback from plugin2 29 | Callback from plugin 30 | Callback from main 31 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t080-geint.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | if not (0 >= 0) then raise Not_found;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 CONST0 11 | 10 PUSHCONST0 12 | 11 GEINT 13 | 12 BOOLNOT 14 | 13 BRANCHIFNOT 20 15 | 15 GETGLOBAL Not_found 16 | 17 MAKEBLOCK1 0 17 | 19 RAISE 18 | 20 ATOM0 19 | 21 SETGLOBAL T080-geint 20 | 23 STOP 21 | **) 22 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t080-leint.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | if not (0 <= 0) then raise Not_found;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 CONST0 11 | 10 PUSHCONST0 12 | 11 LEINT 13 | 12 BOOLNOT 14 | 13 BRANCHIFNOT 20 15 | 15 GETGLOBAL Not_found 16 | 17 MAKEBLOCK1 0 17 | 19 RAISE 18 | 20 ATOM0 19 | 21 SETGLOBAL T080-leint 20 | 23 STOP 21 | **) 22 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t163.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | let f _ _ = 0 in f 0;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 BRANCH 17 11 | 11 RESTART 12 | 12 GRAB 1 13 | 14 CONST0 14 | 15 RETURN 2 15 | 17 CLOSURE 0, 12 16 | 20 PUSHCONST0 17 | 21 PUSHACC1 18 | 22 APPLY1 19 | 23 POP 1 20 | 25 ATOM0 21 | 26 SETGLOBAL T163 22 | 28 STOP 23 | **) 24 | -------------------------------------------------------------------------------- /testsuite/tests/typing-objects/pr6123_bad.ml: -------------------------------------------------------------------------------- 1 | class virtual name = 2 | object 3 | end 4 | 5 | and func (args_ty, ret_ty) = 6 | object(self) 7 | inherit name 8 | 9 | val mutable memo_args = None 10 | 11 | method arguments = 12 | match memo_args with 13 | | Some xs -> xs 14 | | None -> 15 | let args = List.map (fun ty -> new argument(self, ty)) args_ty in 16 | memo_args <- Some args; args 17 | end 18 | 19 | and argument (func, ty) = 20 | object 21 | inherit name 22 | end 23 | ;; 24 | -------------------------------------------------------------------------------- /testsuite/tests/match-exception/raise_from_success_continuation.ml: -------------------------------------------------------------------------------- 1 | (** 2 | Test raising exceptions from a value-matching branch. 3 | *) 4 | let test_raise_from_val_handler = 5 | let () = print_endline "test raise from val handler" in 6 | let g () = List.find ((=)2) [1;2;4] in 7 | let h () = 8 | match 9 | g () 10 | with exception _ -> 10 11 | | _ -> raise Not_found 12 | in 13 | assert ((try h () with Not_found -> 20) = 20); 14 | print_endline "raise from val handler succeeded" 15 | ;; 16 | -------------------------------------------------------------------------------- /testsuite/tests/match-exception/tail_calls.ml: -------------------------------------------------------------------------------- 1 | (** 2 | The success continuation expression is in tail position. 3 | *) 4 | 5 | let count_to_tr_match n = 6 | let rec loop i = 7 | match 8 | i < n 9 | with exception Not_found -> () 10 | | false -> () 11 | | true -> loop (i + 1) 12 | in loop 0 13 | ;; 14 | 15 | let test_tail_recursion = 16 | try 17 | count_to_tr_match 10000000; 18 | print_endline "handler-case (match) is tail recursive" 19 | with _ -> 20 | assert false 21 | ;; 22 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t150-push-1.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | let _ = 0 in 3 | try 0 with _ -> 0 4 | ;; 5 | 6 | (** 7 | 0 CONSTINT 42 8 | 2 PUSHACC0 9 | 3 MAKEBLOCK1 0 10 | 5 POP 1 11 | 7 SETGLOBAL Lib 12 | 9 CONST0 13 | 10 PUSH 14 | 11 PUSHTRAP 17 15 | 13 CONST0 16 | 14 POPTRAP 17 | 15 BRANCH 20 18 | 17 PUSHCONST0 19 | 18 POP 1 20 | 20 POP 1 21 | 22 ATOM0 22 | 23 SETGLOBAL T150-push-1 23 | 25 STOP 24 | **) 25 | -------------------------------------------------------------------------------- /testsuite/tests/typing-misc/variant.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # Characters 61-116: 3 | ......struct 4 | type t = A | B 5 | let f = function A | B -> 0 6 | end.. 7 | Error: Signature mismatch: 8 | Modules do not match: 9 | sig type t = X.t = A | B val f : t -> int end 10 | is not included in 11 | sig type t = int * bool end 12 | Type declarations do not match: 13 | type t = X.t = A | B 14 | is not included in 15 | type t = int * bool 16 | # 17 | -------------------------------------------------------------------------------- /testsuite/tests/typing-modules-bugs/pr51_ok.ml: -------------------------------------------------------------------------------- 1 | module X=struct 2 | module type SIG=sig type t=int val x:t end 3 | module F(Y:SIG) : SIG = struct type t=Y.t let x=Y.x end 4 | end;; 5 | module DUMMY=struct type t=int let x=2 end;; 6 | let x = (3 : X.F(DUMMY).t);; 7 | 8 | module X2=struct 9 | module type SIG=sig type t=int val x:t end 10 | module F(Y:SIG)(Z:SIG) = struct type t=Y.t let x=Y.x type t'=Z.t let x'=Z.x end 11 | end;; 12 | let x = (3 : X2.F(DUMMY)(DUMMY).t);; 13 | let x = (3 : X2.F(DUMMY)(DUMMY).t');; 14 | -------------------------------------------------------------------------------- /testsuite/tests/typing-warnings/coercions.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # - : bool -> ('a, 'b, 'c, 'd, 'd, 'a) format6 = 3 | # Characters 28-48: 4 | fun b -> if b then "x" else format_of_string "y";; 5 | ^^^^^^^^^^^^^^^^^^^^ 6 | Error: This expression has type 7 | ('a, 'b, 'c, 'd, 'd, 'a) format6 = 8 | ('a, 'b, 'c, 'd, 'd, 'a) CamlinternalFormatBasics.format6 9 | but an expression was expected of type string 10 | # - : bool -> ('a, 'b, 'a) format = 11 | # 12 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t110-offsetint.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | if 2 + 2 <> 4 then raise Not_found;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 CONSTINT 4 11 | 11 PUSHCONST2 12 | 12 OFFSETINT 2 13 | 14 NEQ 14 | 15 BRANCHIFNOT 22 15 | 17 GETGLOBAL Not_found 16 | 19 MAKEBLOCK1 0 17 | 21 RAISE 18 | 22 ATOM0 19 | 23 SETGLOBAL T110-offsetint 20 | 25 STOP 21 | **) 22 | -------------------------------------------------------------------------------- /testsuite/tests/typing-gadts/pr5332.ml: -------------------------------------------------------------------------------- 1 | type ('env, 'a) var = 2 | | Zero : ('a * 'env, 'a) var 3 | | Succ : ('env, 'a) var -> ('b * 'env, 'a) var 4 | ;; 5 | type ('env, 'a) typ = 6 | | Tint : ('env, int) typ 7 | | Tbool : ('env, bool) typ 8 | | Tvar : ('env, 'a) var -> ('env, 'a) typ 9 | ;; 10 | let f : type env a. (env, a) typ -> (env, a) typ -> int = fun ta tb -> 11 | match ta, tb with 12 | | Tint, Tint -> 0 13 | | Tbool, Tbool -> 1 14 | | Tvar var, tb -> 2 15 | ;; 16 | let x = f Tint (Tvar Zero) 17 | ;; 18 | -------------------------------------------------------------------------------- /testsuite/tests/typing-gadts/pr5785.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # Characters 137-194: 3 | ...........................................function 4 | | One, One -> "two" 5 | | Two, Two -> "four" 6 | Warning 8: this pattern-matching is not exhaustive. 7 | Here is an example of a value that is not matched: 8 | (Two, One) 9 | module Add : 10 | functor (T : sig type two end) -> 11 | sig 12 | type _ t = One : [ `One ] t | Two : T.two t 13 | val add : 'a t * 'a t -> string 14 | end 15 | # 16 | -------------------------------------------------------------------------------- /testsuite/tests/typing-misc/labels.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # val f : x:int -> int = 3 | # Characters 5-6: 4 | f ?x:0;; 5 | ^ 6 | Warning 43: the label x is not optional. 7 | - : int = 1 8 | # val foo : (unit -> unit) -> unit = 9 | # val g : ?x:'a -> unit -> unit = 10 | # - : unit = () 11 | # Characters 19-38: 12 | foo (fun ?opt () -> ()) ;; (* fails *) 13 | ^^^^^^^^^^^^^^^^^^^ 14 | Error: This function should have type unit -> unit 15 | but its first argument is labelled ?opt 16 | # 17 | -------------------------------------------------------------------------------- /native-tests/test11.ml: -------------------------------------------------------------------------------- 1 | open Printf 2 | 3 | effect E : int -> int 4 | 5 | let f () = 6 | printf "perform effect (E 0)\n%!"; 7 | let v = perform (E 0) in 8 | printf "perform returns %d\n%!" v; 9 | v + 1 10 | 11 | let v = 12 | match f () with 13 | | v -> printf "done %d\n%!" v; v + 1 14 | | effect (E v) k -> 15 | printf "caught effect (E %d). continuting..\n%!" v; 16 | let v = continue k (v + 1) in 17 | printf "continue returns %d\n%!" v; 18 | v + 1 19 | 20 | let () = printf "result=%d\n%!" v 21 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t110-divint-1.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | if 2 / 2 <> 1 then raise Not_found;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 CONST1 11 | 10 PUSHCONST2 12 | 11 PUSHCONST2 13 | 12 DIVINT 14 | 13 NEQ 15 | 14 BRANCHIFNOT 21 16 | 16 GETGLOBAL Not_found 17 | 18 MAKEBLOCK1 0 18 | 20 RAISE 19 | 21 ATOM0 20 | 22 SETGLOBAL T110-divint-1 21 | 24 STOP 22 | **) 23 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t110-divint-2.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | if 3 / 2 <> 1 then raise Not_found;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 CONST1 11 | 10 PUSHCONST2 12 | 11 PUSHCONST3 13 | 12 DIVINT 14 | 13 NEQ 15 | 14 BRANCHIFNOT 21 16 | 16 GETGLOBAL Not_found 17 | 18 MAKEBLOCK1 0 18 | 20 RAISE 19 | 21 ATOM0 20 | 22 SETGLOBAL T110-divint-2 21 | 24 STOP 22 | **) 23 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t110-mulint.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | if 2 * 2 <> 4 then raise Not_found;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 CONSTINT 4 11 | 11 PUSHCONST2 12 | 12 PUSHCONST2 13 | 13 MULINT 14 | 14 NEQ 15 | 15 BRANCHIFNOT 22 16 | 17 GETGLOBAL Not_found 17 | 19 MAKEBLOCK1 0 18 | 21 RAISE 19 | 22 ATOM0 20 | 23 SETGLOBAL T110-mulint 21 | 25 STOP 22 | **) 23 | -------------------------------------------------------------------------------- /testsuite/tests/typing-misc/labels.ml.principal.reference: -------------------------------------------------------------------------------- 1 | 2 | # val f : x:int -> int = 3 | # Characters 5-6: 4 | f ?x:0;; 5 | ^ 6 | Warning 43: the label x is not optional. 7 | - : int = 1 8 | # val foo : (unit -> unit) -> unit = 9 | # val g : ?x:'a -> unit -> unit = 10 | # - : unit = () 11 | # Characters 19-38: 12 | foo (fun ?opt () -> ()) ;; (* fails *) 13 | ^^^^^^^^^^^^^^^^^^^ 14 | Error: This function should have type unit -> unit 15 | but its first argument is labelled ?opt 16 | # 17 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t110-andint.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | if (3 land 6) <> 2 then raise Not_found;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 CONST2 11 | 10 PUSHCONSTINT 6 12 | 12 PUSHCONST3 13 | 13 ANDINT 14 | 14 NEQ 15 | 15 BRANCHIFNOT 22 16 | 17 GETGLOBAL Not_found 17 | 19 MAKEBLOCK1 0 18 | 21 RAISE 19 | 22 ATOM0 20 | 23 SETGLOBAL T110-andint 21 | 25 STOP 22 | **) 23 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t110-asrint-2.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | if (3 asr 1) <> 1 then raise Not_found;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 CONST1 11 | 10 PUSHCONST1 12 | 11 PUSHCONST3 13 | 12 ASRINT 14 | 13 NEQ 15 | 14 BRANCHIFNOT 21 16 | 16 GETGLOBAL Not_found 17 | 18 MAKEBLOCK1 0 18 | 20 RAISE 19 | 21 ATOM0 20 | 22 SETGLOBAL T110-asrint-2 21 | 24 STOP 22 | **) 23 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t110-lslint.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | if (3 lsl 2) <> 12 then raise Not_found;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 CONSTINT 12 11 | 11 PUSHCONST2 12 | 12 PUSHCONST3 13 | 13 LSLINT 14 | 14 NEQ 15 | 15 BRANCHIFNOT 22 16 | 17 GETGLOBAL Not_found 17 | 19 MAKEBLOCK1 0 18 | 21 RAISE 19 | 22 ATOM0 20 | 23 SETGLOBAL T110-lslint 21 | 25 STOP 22 | **) 23 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t110-lsrint.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | if (14 lsr 2) <> 3 then raise Not_found;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 CONST3 11 | 10 PUSHCONST2 12 | 11 PUSHCONSTINT 14 13 | 13 LSRINT 14 | 14 NEQ 15 | 15 BRANCHIFNOT 22 16 | 17 GETGLOBAL Not_found 17 | 19 MAKEBLOCK1 0 18 | 21 RAISE 19 | 22 ATOM0 20 | 23 SETGLOBAL T110-lsrint 21 | 25 STOP 22 | **) 23 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t110-modint-1.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | if 20 mod 3 <> 2 then raise Not_found;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 CONST2 11 | 10 PUSHCONST3 12 | 11 PUSHCONSTINT 20 13 | 13 MODINT 14 | 14 NEQ 15 | 15 BRANCHIFNOT 22 16 | 17 GETGLOBAL Not_found 17 | 19 MAKEBLOCK1 0 18 | 21 RAISE 19 | 22 ATOM0 20 | 23 SETGLOBAL T110-modint-1 21 | 25 STOP 22 | **) 23 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t110-orint.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | if (3 lor 6) <> 7 then raise Not_found;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 CONSTINT 7 11 | 11 PUSHCONSTINT 6 12 | 13 PUSHCONST3 13 | 14 ORINT 14 | 15 NEQ 15 | 16 BRANCHIFNOT 23 16 | 18 GETGLOBAL Not_found 17 | 20 MAKEBLOCK1 0 18 | 22 RAISE 19 | 23 ATOM0 20 | 24 SETGLOBAL T110-orint 21 | 26 STOP 22 | **) 23 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t110-xorint.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | if (3 lxor 6) <> 5 then raise Not_found;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 CONSTINT 5 11 | 11 PUSHCONSTINT 6 12 | 13 PUSHCONST3 13 | 14 XORINT 14 | 15 NEQ 15 | 16 BRANCHIFNOT 23 16 | 18 GETGLOBAL Not_found 17 | 20 MAKEBLOCK1 0 18 | 22 RAISE 19 | 23 ATOM0 20 | 24 SETGLOBAL T110-xorint 21 | 26 STOP 22 | **) 23 | -------------------------------------------------------------------------------- /experimental/frisch/test_ifdef.ml: -------------------------------------------------------------------------------- 1 | type t = 2 | | A 3 | | DBG [@IFDEF DEBUG] of string 4 | | B 5 | 6 | [%%IFDEF DEBUG] 7 | let debug s = prerr_endline ([%GETENV DEBUG] ^ ":" ^ s) 8 | let x = DBG "xxx" 9 | [%%ELSE] 10 | let debug _ = () 11 | let x = A 12 | [%%END] 13 | 14 | let f = function 15 | | A -> "A" 16 | | DBG s when [%IFDEF DEBUG] -> "DEBUG:" ^ s 17 | | B -> "B" 18 | 19 | let () = debug "ABC" 20 | 21 | let () = 22 | Printf.printf "compiled by user %s in directory %s\n%!" 23 | [%GETENV USER] 24 | [%GETENV PWD] 25 | 26 | -------------------------------------------------------------------------------- /testsuite/tests/typing-recmod/t18ok.ml: -------------------------------------------------------------------------------- 1 | (* PR 4470: simplified from OMake's sources *) 2 | 3 | module rec DirElt 4 | : sig 5 | type t = DirRoot | DirSub of DirHash.t 6 | end 7 | = struct 8 | type t = DirRoot | DirSub of DirHash.t 9 | end 10 | 11 | and DirCompare 12 | : sig 13 | type t = DirElt.t 14 | end 15 | = struct 16 | type t = DirElt.t 17 | end 18 | 19 | and DirHash 20 | : sig 21 | type t = DirElt.t list 22 | end 23 | = struct 24 | type t = DirCompare.t list 25 | end 26 | -------------------------------------------------------------------------------- /native-tests/test6.ml: -------------------------------------------------------------------------------- 1 | (* Tests nested calls from C (main C) to OCaml (main OCaml) to C (caml_to_c) to 2 | * OCaml (c_to_caml) to C (printf functions). *) 3 | 4 | let printf = Printf.printf 5 | 6 | let c_to_caml () = 7 | printf "[Caml] Enter c_to_caml\n%!"; 8 | printf "[Caml] Leave c_to_caml\n%!" 9 | 10 | let _ = Callback.register "c_to_caml" c_to_caml 11 | 12 | external caml_to_c : unit -> unit = "caml_to_c" 13 | 14 | let _ = 15 | printf "[Caml] Call caml_to_c\n%!"; 16 | caml_to_c (); 17 | printf "[Caml] Return from caml_to_c\n%!" 18 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t092-pushacc1.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | let x = false in 3 | let y = true in 4 | if x then raise Not_found 5 | ;; 6 | 7 | (** 8 | 0 CONSTINT 42 9 | 2 PUSHACC0 10 | 3 MAKEBLOCK1 0 11 | 5 POP 1 12 | 7 SETGLOBAL Lib 13 | 9 CONST0 14 | 10 PUSHCONST1 15 | 11 PUSHACC1 16 | 12 BRANCHIFNOT 19 17 | 14 GETGLOBAL Not_found 18 | 16 MAKEBLOCK1 0 19 | 18 RAISE 20 | 19 POP 2 21 | 21 ATOM0 22 | 22 SETGLOBAL T092-pushacc1 23 | 24 STOP 24 | **) 25 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t110-asrint-1.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | if (-2 asr 1) <> -1 then raise Not_found;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 CONSTINT -1 11 | 11 PUSHCONST1 12 | 12 PUSHCONSTINT -2 13 | 14 ASRINT 14 | 15 NEQ 15 | 16 BRANCHIFNOT 23 16 | 18 GETGLOBAL Not_found 17 | 20 MAKEBLOCK1 0 18 | 22 RAISE 19 | 23 ATOM0 20 | 24 SETGLOBAL T110-asrint-1 21 | 26 STOP 22 | **) 23 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t164-apply2.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | let f _ _ = 0 in f 0 0;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 BRANCH 17 11 | 11 RESTART 12 | 12 GRAB 1 13 | 14 CONST0 14 | 15 RETURN 2 15 | 17 CLOSURE 0, 12 16 | 20 PUSHCONST0 17 | 21 PUSHCONST0 18 | 22 PUSHACC2 19 | 23 APPLY2 20 | 24 POP 1 21 | 26 ATOM0 22 | 27 SETGLOBAL T164-apply2 23 | 29 STOP 24 | **) 25 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t090-acc0.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | let x = true in 3 | (); 4 | if not x then raise Not_found 5 | ;; 6 | 7 | (** 8 | 0 CONSTINT 42 9 | 2 PUSHACC0 10 | 3 MAKEBLOCK1 0 11 | 5 POP 1 12 | 7 SETGLOBAL Lib 13 | 9 CONST1 14 | 10 PUSHCONST0 15 | 11 ACC0 16 | 12 BOOLNOT 17 | 13 BRANCHIFNOT 20 18 | 15 GETGLOBAL Not_found 19 | 17 MAKEBLOCK1 0 20 | 19 RAISE 21 | 20 POP 1 22 | 22 ATOM0 23 | 23 SETGLOBAL T090-acc0 24 | 25 STOP 25 | **) 26 | -------------------------------------------------------------------------------- /testsuite/tests/formats-transition/legacy_unfinished_modifiers.ml: -------------------------------------------------------------------------------- 1 | (* test whether padding modifiers are accepted without any padding 2 | size 3 | 4 | the precision modifier is accepted without precision setting, but it 5 | defaults to 0, which is not the same thing as not having precision: 6 | %.0f 3.5 => 3 7 | %.f 3.5 => 3 8 | %f 3.5 => 3.5 9 | *) 10 | 11 | let () = Printf.printf "%0d\n" 3 12 | ;; 13 | let () = Printf.printf "%-d\n" 3 14 | ;; 15 | let () = Printf.printf "%.d\n" 3 16 | ;; 17 | let () = Printf.printf "%.f\n" 3. 18 | ;; 19 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t240-c_call1.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | if Pervasives.int_of_string "123" <> 123 then raise Not_found;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 CONSTINT 123 11 | 11 PUSHGETGLOBAL "123" 12 | 13 C_CALL1 int_of_string 13 | 15 NEQ 14 | 16 BRANCHIFNOT 23 15 | 18 GETGLOBAL Not_found 16 | 20 MAKEBLOCK1 0 17 | 22 RAISE 18 | 23 ATOM0 19 | 24 SETGLOBAL T240-c_call1 20 | 26 STOP 21 | **) 22 | -------------------------------------------------------------------------------- /testsuite/tests/lib-hashtbl/hfun.reference: -------------------------------------------------------------------------------- 1 | -- Strings: 2 | "" 00000000 3 | "Hello world" 364b8272 4 | -- Integers: 5 | 0 07be548a 6 | -1 3653e015 7 | 42 1792870b 8 | 2^30-1 23c392d0 9 | -2^30 0c66fde3 10 | -- Floats: 11 | +0.0 0f478b8c 12 | -0.0 0f478b8c 13 | +infty 23ea56fb 14 | -infty 059f7872 15 | NaN 3228858d 16 | NaN#2 3228858d 17 | NaN#3 3228858d 18 | -- Native integers: 19 | 0 3f19274a 20 | -1 3653e015 21 | 42 3e33aef8 22 | 2^30-1 3711bf46 23 | -2^30 2e71f39c 24 | -- Lists: 25 | [0..10] 0ade0fc9 26 | [0..12] 0ade0fc9 27 | [10..0] 0cd6259d 28 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t240-c_call2.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | if Pervasives.compare 1 2 <> -1 then raise Not_found;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 CONSTINT -1 11 | 11 PUSHCONST2 12 | 12 PUSHCONST1 13 | 13 C_CALL2 compare 14 | 15 NEQ 15 | 16 BRANCHIFNOT 23 16 | 18 GETGLOBAL Not_found 17 | 20 MAKEBLOCK1 0 18 | 22 RAISE 19 | 23 ATOM0 20 | 24 SETGLOBAL T240-c_call2 21 | 26 STOP 22 | **) 23 | -------------------------------------------------------------------------------- /asmrun/.ignore: -------------------------------------------------------------------------------- 1 | *.p.c 2 | *.d.c 3 | libasmrun.a 4 | libasmrunp.a 5 | .depend.nt 6 | alloc.c 7 | array.c 8 | callback.c 9 | compact.c 10 | compare.c 11 | custom.c 12 | debugger.c 13 | dynlink.c 14 | extern.c 15 | finalise.c 16 | floats.c 17 | freelist.c 18 | gc_ctrl.c 19 | globroots.c 20 | hash.c 21 | intern.c 22 | ints.c 23 | io.c 24 | lexing.c 25 | main.c 26 | major_gc.c 27 | md5.c 28 | memory.c 29 | meta.c 30 | minor_gc.c 31 | misc.c 32 | obj.c 33 | parsing.c 34 | printexc.c 35 | signals.c 36 | startup_aux.c 37 | str.c 38 | sys.c 39 | terminfo.c 40 | unix.c 41 | weak.c 42 | -------------------------------------------------------------------------------- /testsuite/tests/basic-more/pr2719.ml: -------------------------------------------------------------------------------- 1 | open Printf 2 | 3 | let bug () = 4 | let mat = [| [|false|] |] 5 | and test = ref false in 6 | printf "Value of test at the beginning : %b\n" !test; flush stdout; 7 | (try let _ = mat.(0).(-1) in 8 | (test := true; 9 | printf "Am I going through this block of instructions ?\n"; 10 | flush stdout) 11 | with Invalid_argument _ -> printf "Value of test now : %b\n" !test 12 | ); 13 | (try if mat.(0).(-1) then () 14 | with Invalid_argument _ -> () 15 | ) 16 | 17 | let () = bug () 18 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t120-getstringchar.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | if "foo".[2] <> 'o' then raise Not_found;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 CONSTINT 111 11 | 11 PUSHCONST2 12 | 12 PUSHGETGLOBAL "foo" 13 | 14 GETSTRINGCHAR 14 | 15 NEQ 15 | 16 BRANCHIFNOT 23 16 | 18 GETGLOBAL Not_found 17 | 20 MAKEBLOCK1 0 18 | 22 RAISE 19 | 23 ATOM0 20 | 24 SETGLOBAL T120-getstringchar 21 | 26 STOP 22 | **) 23 | -------------------------------------------------------------------------------- /experimental/frisch/test_nomli.ml: -------------------------------------------------------------------------------- 1 | type t = A | B 2 | [@@mli] 3 | 4 | and s = C | D 5 | [@@mli abstract] 6 | 7 | 8 | module X = struct 9 | type t = X | Y 10 | [@@mli] 11 | and s 12 | 13 | let id x = x 14 | [@@mli] 15 | end 16 | 17 | module Y : sig type t type s end = struct 18 | type t = X | Y 19 | type s = A | B 20 | end 21 | 22 | let f x y = x + y 23 | [@@mli] 24 | and g a b = (a, b) 25 | [@@mli] 26 | and h a b = (a, b) 27 | [@@mli (h : int -> int -> int * int)] 28 | 29 | let (x, y, z) = (1, 2, 3) 30 | [@@mli (x : int), (y : int)] 31 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t110-negint.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | let x = 1 in 3 | if -x <> -1 then raise Not_found 4 | ;; 5 | 6 | (** 7 | 0 CONSTINT 42 8 | 2 PUSHACC0 9 | 3 MAKEBLOCK1 0 10 | 5 POP 1 11 | 7 SETGLOBAL Lib 12 | 9 CONST1 13 | 10 PUSHCONSTINT -1 14 | 12 PUSHACC1 15 | 13 NEGINT 16 | 14 NEQ 17 | 15 BRANCHIFNOT 22 18 | 17 GETGLOBAL Not_found 19 | 19 MAKEBLOCK1 0 20 | 21 RAISE 21 | 22 POP 1 22 | 24 ATOM0 23 | 25 SETGLOBAL T110-negint 24 | 27 STOP 25 | **) 26 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t164-apply3.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | let f _ _ _ = 0 in f 0 0 0;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 BRANCH 17 11 | 11 RESTART 12 | 12 GRAB 2 13 | 14 CONST0 14 | 15 RETURN 3 15 | 17 CLOSURE 0, 12 16 | 20 PUSHCONST0 17 | 21 PUSHCONST0 18 | 22 PUSHCONST0 19 | 23 PUSHACC3 20 | 24 APPLY3 21 | 25 POP 1 22 | 27 ATOM0 23 | 28 SETGLOBAL T164-apply3 24 | 30 STOP 25 | **) 26 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t200-getfield0.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | type t = { 3 | a : int; 4 | };; 5 | 6 | if { a = 7 }.a <> 7 then raise Not_found;; 7 | 8 | (** 9 | 0 CONSTINT 42 10 | 2 PUSHACC0 11 | 3 MAKEBLOCK1 0 12 | 5 POP 1 13 | 7 SETGLOBAL Lib 14 | 9 CONSTINT 7 15 | 11 PUSHGETGLOBAL <0>(7) 16 | 13 GETFIELD0 17 | 14 NEQ 18 | 15 BRANCHIFNOT 22 19 | 17 GETGLOBAL Not_found 20 | 19 MAKEBLOCK1 0 21 | 21 RAISE 22 | 22 ATOM0 23 | 23 SETGLOBAL T200-getfield0 24 | 25 STOP 25 | **) 26 | -------------------------------------------------------------------------------- /testsuite/tests/backtrace/backtrace.d.reference: -------------------------------------------------------------------------------- 1 | Fatal error: exception Backtrace.Error("d") 2 | Raised at file "backtrace.ml", line 18, characters 21-32 3 | Called from file "backtrace.ml", line 18, characters 42-53 4 | Called from file "backtrace.ml", line 18, characters 42-53 5 | Called from file "backtrace.ml", line 18, characters 42-53 6 | Called from file "backtrace.ml", line 18, characters 42-53 7 | Called from file "backtrace.ml", line 18, characters 42-53 8 | Called from file "backtrace.ml", line 22, characters 4-11 9 | Called from file "backtrace.ml", line 29, characters 9-25 10 | -------------------------------------------------------------------------------- /testsuite/tests/match-exception/match_failure.ml: -------------------------------------------------------------------------------- 1 | (** 2 | Test that value match failure in a match block raises Match_failure. 3 | *) 4 | let return_some_3 () = Some (1 + 2) 5 | ;; 6 | 7 | let test_match_partial_match = 8 | try 9 | let _ = (match return_some_3 () with 10 | | Some x when x < 3 -> "Some x" 11 | | exception Failure _ -> "failure" 12 | | exception Invalid_argument _ -> "invalid argument" 13 | | None -> "None" 14 | ) in 15 | assert false 16 | with 17 | Match_failure _ -> 18 | print_endline "match failure, as expected" 19 | ;; 20 | -------------------------------------------------------------------------------- /testsuite/tests/misc-unsafe/soli.reference: -------------------------------------------------------------------------------- 1 | 500 2 | 1000 3 | 1500 4 | 2000 5 | 2500 6 | 3000 7 | 3500 8 | 4000 9 | 4500 10 | 5000 11 | 5500 12 | 6000 13 | 6500 14 | 7000 15 | 7500 16 | 8000 17 | 8500 18 | 9000 19 | 9500 20 | 10000 21 | 10500 22 | 11000 23 | 11500 24 | 12000 25 | 12500 26 | 13000 27 | 13500 28 | 14000 29 | 14500 30 | 15000 31 | 15500 32 | 16000 33 | 16500 34 | 17000 35 | 17500 36 | 18000 37 | 18500 38 | 19000 39 | 19500 40 | 20000 41 | 42 | ......... 43 | ... ... 44 | ... ... 45 | . . 46 | . $ . 47 | . . 48 | ... ... 49 | ... ... 50 | ......... 51 | -------------------------------------------------------------------------------- /testsuite/tests/typing-misc/polyvars.ml: -------------------------------------------------------------------------------- 1 | type ab = [ `A | `B ];; 2 | let f (x : [`A]) = match x with #ab -> 1;; 3 | let f x = ignore (match x with #ab -> 1); ignore (x : [`A]);; 4 | let f x = ignore (match x with `A|`B -> 1); ignore (x : [`A]);; 5 | 6 | let f (x : [< `A | `B]) = match x with `A | `B | `C -> 0;; (* warn *) 7 | let f (x : [`A | `B]) = match x with `A | `B | `C -> 0;; (* fail *) 8 | 9 | (* PR#6787 *) 10 | let revapply x f = f x;; 11 | 12 | let f x (g : [< `Foo]) = 13 | let y = `Bar x, g in 14 | revapply y (fun ((`Bar i), _) -> i);; 15 | (* f : 'a -> [< `Foo ] -> 'a *) 16 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t130-vectlength.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | if Array.length [| 1; 2 |] <> 2 then raise Not_found;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 CONST2 11 | 10 PUSHCONST2 12 | 11 PUSHCONST1 13 | 12 MAKEBLOCK2 0 14 | 14 VECTLENGTH 15 | 15 NEQ 16 | 16 BRANCHIFNOT 23 17 | 18 GETGLOBAL Not_found 18 | 20 MAKEBLOCK1 0 19 | 22 RAISE 20 | 23 ATOM0 21 | 24 SETGLOBAL T130-vectlength 22 | 26 STOP 23 | **) 24 | -------------------------------------------------------------------------------- /otherlibs/str/.depend: -------------------------------------------------------------------------------- 1 | strstubs.o: strstubs.c ../../byterun/caml/mlvalues.h \ 2 | ../../byterun/caml/compatibility.h ../../byterun/caml/config.h \ 3 | ../../byterun/caml/../../config/m.h ../../byterun/caml/../../config/s.h \ 4 | ../../byterun/caml/misc.h ../../byterun/caml/alloc.h \ 5 | ../../byterun/caml/mlvalues.h ../../byterun/caml/memory.h \ 6 | ../../byterun/caml/gc.h ../../byterun/caml/major_gc.h \ 7 | ../../byterun/caml/freelist.h ../../byterun/caml/minor_gc.h \ 8 | ../../byterun/caml/address_class.h ../../byterun/caml/fail.h 9 | str.cmi : 10 | str.cmo : str.cmi 11 | str.cmx : str.cmi 12 | -------------------------------------------------------------------------------- /testsuite/tests/typing-gadts/pr5997.ml: -------------------------------------------------------------------------------- 1 | type (_, _) comp = 2 | | Eq : ('a, 'a) comp 3 | | Diff : ('a, 'b) comp 4 | ;; 5 | 6 | module U = struct type t = T end;; 7 | 8 | module M : sig 9 | type t = T 10 | val comp : (U.t, t) comp 11 | end = struct 12 | include U 13 | let comp = Eq 14 | end;; 15 | 16 | match M.comp with | Diff -> false;; 17 | 18 | module U = struct type t = {x : int} end;; 19 | 20 | module M : sig 21 | type t = {x : int} 22 | val comp : (U.t, t) comp 23 | end = struct 24 | include U 25 | let comp = Eq 26 | end;; 27 | 28 | match M.comp with | Diff -> false;; 29 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t090-acc1.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | let x = true in 3 | let y = false in 4 | (); 5 | if not x then raise Not_found 6 | ;; 7 | 8 | (** 9 | 0 CONSTINT 42 10 | 2 PUSHACC0 11 | 3 MAKEBLOCK1 0 12 | 5 POP 1 13 | 7 SETGLOBAL Lib 14 | 9 CONST1 15 | 10 PUSHCONST0 16 | 11 PUSHCONST0 17 | 12 ACC1 18 | 13 BOOLNOT 19 | 14 BRANCHIFNOT 21 20 | 16 GETGLOBAL Not_found 21 | 18 MAKEBLOCK1 0 22 | 20 RAISE 23 | 21 POP 2 24 | 23 ATOM0 25 | 24 SETGLOBAL T090-acc1 26 | 26 STOP 27 | **) 28 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t092-pushacc2.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | let x = false in 3 | let y = true in 4 | let z = true in 5 | if x then raise Not_found 6 | ;; 7 | 8 | (** 9 | 0 CONSTINT 42 10 | 2 PUSHACC0 11 | 3 MAKEBLOCK1 0 12 | 5 POP 1 13 | 7 SETGLOBAL Lib 14 | 9 CONST0 15 | 10 PUSHCONST1 16 | 11 PUSHCONST1 17 | 12 PUSHACC2 18 | 13 BRANCHIFNOT 20 19 | 15 GETGLOBAL Not_found 20 | 17 MAKEBLOCK1 0 21 | 19 RAISE 22 | 20 POP 3 23 | 22 ATOM0 24 | 23 SETGLOBAL T092-pushacc2 25 | 25 STOP 26 | **) 27 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t110-addint.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | let x = 1 in 3 | if 1 + x <> 2 then raise Not_found 4 | ;; 5 | 6 | (** 7 | 0 CONSTINT 42 8 | 2 PUSHACC0 9 | 3 MAKEBLOCK1 0 10 | 5 POP 1 11 | 7 SETGLOBAL Lib 12 | 9 CONST1 13 | 10 PUSHCONST2 14 | 11 PUSHACC1 15 | 12 PUSHCONST1 16 | 13 ADDINT 17 | 14 NEQ 18 | 15 BRANCHIFNOT 22 19 | 17 GETGLOBAL Not_found 20 | 19 MAKEBLOCK1 0 21 | 21 RAISE 22 | 22 POP 1 23 | 24 ATOM0 24 | 25 SETGLOBAL T110-addint 25 | 27 STOP 26 | **) 27 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t110-subint.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | let x = 1 in 3 | if 1 - x <> 0 then raise Not_found 4 | ;; 5 | 6 | (** 7 | 0 CONSTINT 42 8 | 2 PUSHACC0 9 | 3 MAKEBLOCK1 0 10 | 5 POP 1 11 | 7 SETGLOBAL Lib 12 | 9 CONST1 13 | 10 PUSHCONST0 14 | 11 PUSHACC1 15 | 12 PUSHCONST1 16 | 13 SUBINT 17 | 14 NEQ 18 | 15 BRANCHIFNOT 22 19 | 17 GETGLOBAL Not_found 20 | 19 MAKEBLOCK1 0 21 | 21 RAISE 22 | 22 POP 1 23 | 24 ATOM0 24 | 25 SETGLOBAL T110-subint 25 | 27 STOP 26 | **) 27 | -------------------------------------------------------------------------------- /testsuite/tests/float-unboxing/float_subst_boxed_number.ml: -------------------------------------------------------------------------------- 1 | module PR_6686 = struct 2 | type t = 3 | | A of float 4 | | B of (int * int) 5 | 6 | let rec foo = function 7 | | A x -> x 8 | | B (x, y) -> float x +. float y 9 | 10 | let (_ : float) = foo (A 4.) 11 | end 12 | 13 | module PR_6770 = struct 14 | type t = 15 | | Constant of float 16 | | Exponent of (float * float) 17 | 18 | let to_string = function 19 | | Exponent (_b, _e) -> 20 | ignore _b; 21 | ignore _e; 22 | "" 23 | | Constant _ -> "" 24 | 25 | let _ = to_string (Constant 4.) 26 | end 27 | -------------------------------------------------------------------------------- /testsuite/tests/lib-threads/testio.reference: -------------------------------------------------------------------------------- 1 | 256-byte chunks, 256-byte chunks 2 | passed 3 | 4096-byte chunks, 4096-byte chunks 4 | passed 5 | 65536-byte chunks, 65536-byte chunks 6 | passed 7 | 256-byte chunks, 4096-byte chunks 8 | passed 9 | 4096-byte chunks, 256-byte chunks 10 | passed 11 | 4096-byte chunks, 65536-byte chunks 12 | passed 13 | 263-byte chunks, 4011-byte chunks 14 | passed 15 | 613-byte chunks, 1027-byte chunks 16 | passed 17 | 0...8192 byte chunks 18 | passed 19 | line per line, short lines 20 | passed 21 | line per line, short and long lines 22 | passed 23 | truncated line 24 | passed 25 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t200-getfield1.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | type t = { 3 | a : int; 4 | b : int; 5 | };; 6 | 7 | if { a = 7; b = 6 }.b <> 6 then raise Not_found;; 8 | 9 | (** 10 | 0 CONSTINT 42 11 | 2 PUSHACC0 12 | 3 MAKEBLOCK1 0 13 | 5 POP 1 14 | 7 SETGLOBAL Lib 15 | 9 CONSTINT 6 16 | 11 PUSHGETGLOBAL <0>(7, 6) 17 | 13 GETFIELD1 18 | 14 NEQ 19 | 15 BRANCHIFNOT 22 20 | 17 GETGLOBAL Not_found 21 | 19 MAKEBLOCK1 0 22 | 21 RAISE 23 | 22 ATOM0 24 | 23 SETGLOBAL T200-getfield1 25 | 25 STOP 26 | **) 27 | -------------------------------------------------------------------------------- /native-tests/test16.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | value caml_to_c (value unit) { 7 | CAMLparam1 (unit); 8 | printf ("[C] Enter caml_to_c\n"); 9 | 10 | static value * c_to_caml_closure = NULL; 11 | if (c_to_caml_closure == NULL) 12 | c_to_caml_closure = caml_named_value("c_to_caml"); 13 | 14 | printf ("[C] Call c_to_caml\n"); 15 | caml_callback(*c_to_caml_closure, Val_unit); 16 | printf ("[C] Return from c_to_caml\n"); 17 | 18 | printf ("[C] Leave caml_to_c\n"); 19 | CAMLreturn (Val_unit); 20 | } 21 | -------------------------------------------------------------------------------- /native-tests/test17.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | value caml_to_c (value unit) { 7 | CAMLparam1 (unit); 8 | printf ("[C] Enter caml_to_c\n"); 9 | 10 | static value * c_to_caml_closure = NULL; 11 | if (c_to_caml_closure == NULL) 12 | c_to_caml_closure = caml_named_value("c_to_caml"); 13 | 14 | printf ("[C] Call c_to_caml\n"); 15 | caml_callback(*c_to_caml_closure, Val_unit); 16 | printf ("[C] Return from c_to_caml\n"); 17 | 18 | printf ("[C] Leave caml_to_c\n"); 19 | CAMLreturn (Val_unit); 20 | } 21 | -------------------------------------------------------------------------------- /native-tests/test6.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | value caml_to_c (value unit) { 7 | CAMLparam1 (unit); 8 | printf ("[C] Enter caml_to_c\n"); 9 | 10 | static value * c_to_caml_closure = NULL; 11 | if (c_to_caml_closure == NULL) 12 | c_to_caml_closure = caml_named_value("c_to_caml"); 13 | 14 | printf ("[C] Call c_to_caml\n"); 15 | caml_callback(*c_to_caml_closure, Val_unit); 16 | printf ("[C] Return from c_to_caml\n"); 17 | 18 | printf ("[C] Leave caml_to_c\n"); 19 | CAMLreturn (Val_unit); 20 | } 21 | -------------------------------------------------------------------------------- /native-tests/test7.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | value caml_to_c (value unit) { 7 | CAMLparam1 (unit); 8 | printf ("[C] Enter caml_to_c\n"); 9 | 10 | static value * c_to_caml_closure = NULL; 11 | if (c_to_caml_closure == NULL) 12 | c_to_caml_closure = caml_named_value("c_to_caml"); 13 | 14 | printf ("[C] Call c_to_caml\n"); 15 | caml_callback(*c_to_caml_closure, Val_unit); 16 | printf ("[C] Return from c_to_caml\n"); 17 | 18 | printf ("[C] Leave caml_to_c\n"); 19 | CAMLreturn (Val_unit); 20 | } 21 | -------------------------------------------------------------------------------- /native-tests/test8.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | value caml_to_c (value unit) { 7 | CAMLparam1 (unit); 8 | printf ("[C] Enter caml_to_c\n"); 9 | 10 | static value * c_to_caml_closure = NULL; 11 | if (c_to_caml_closure == NULL) 12 | c_to_caml_closure = caml_named_value("c_to_caml"); 13 | 14 | printf ("[C] Call c_to_caml\n"); 15 | caml_callback(*c_to_caml_closure, Val_unit); 16 | printf ("[C] Return from c_to_caml\n"); 17 | 18 | printf ("[C] Leave caml_to_c\n"); 19 | CAMLreturn (Val_unit); 20 | } 21 | -------------------------------------------------------------------------------- /testsuite/tests/lib-bigarray-2/bigarrf.f: -------------------------------------------------------------------------------- 1 | subroutine filltab() 2 | 3 | integer dimx, dimy 4 | parameter (dimx = 8, dimy = 6) 5 | real ftab(dimx, dimy) 6 | common /ftab/ ftab 7 | integer x, y 8 | 9 | do 100 x = 1, dimx 10 | do 110 y = 1, dimy 11 | ftab(x, y) = x * 100 + y 12 | 110 continue 13 | 100 continue 14 | end 15 | 16 | subroutine printtab(tab, dimx, dimy) 17 | 18 | integer dimx, dimy 19 | real tab(dimx, dimy) 20 | integer x, y 21 | 22 | do 200 x = 1, dimx 23 | print 300, x, (tab(x, y), y = 1, dimy) 24 | 300 format(/1X, I3, 2X, 10F6.1/) 25 | 200 continue 26 | end 27 | -------------------------------------------------------------------------------- /testsuite/tests/lib-printf/pr6534.ml: -------------------------------------------------------------------------------- 1 | (* these are not valid under -strict-formats, but we test them here 2 | for backward-compatibility *) 3 | open Printf 4 | 5 | let () = 6 | printf "1 [%.5s]\n" "foo"; 7 | printf "2 [%.*s]\n" 5 "foo"; 8 | printf "3 [%.-5s]\n" "foo"; 9 | printf "4 [%-.5s]\n" "foo"; 10 | printf "5 [%-.*s]\n" 5 "foo"; 11 | printf "6 [%.*s]\n" (-5) "foo"; 12 | 13 | printf "1 [%.7S]\n" "foo"; 14 | printf "2 [%.*S]\n" 7 "foo"; 15 | printf "3 [%.-7S]\n" "foo"; 16 | printf "4 [%-.7S]\n" "foo"; 17 | printf "5 [%-.*S]\n" 7 "foo"; 18 | printf "6 [%.*S]\n" (-7) "foo"; 19 | () 20 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t130-getvectitem.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | if [| 1; 2 |].(1) <> 2 then raise Not_found;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 CONST2 11 | 10 PUSHCONST1 12 | 11 PUSHCONST2 13 | 12 PUSHCONST1 14 | 13 MAKEBLOCK2 0 15 | 15 GETVECTITEM 16 | 16 NEQ 17 | 17 BRANCHIFNOT 24 18 | 19 GETGLOBAL Not_found 19 | 21 MAKEBLOCK1 0 20 | 23 RAISE 21 | 24 ATOM0 22 | 25 SETGLOBAL T130-getvectitem 23 | 27 STOP 24 | **) 25 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t220-assign.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | let x = ref 1 in 3 | x := 3; 4 | if !x <> 3 then raise Not_found 5 | ;; 6 | 7 | (** 8 | 0 CONSTINT 42 9 | 2 PUSHACC0 10 | 3 MAKEBLOCK1 0 11 | 5 POP 1 12 | 7 SETGLOBAL Lib 13 | 9 CONST1 14 | 10 PUSHCONST3 15 | 11 ASSIGN 0 16 | 13 CONST3 17 | 14 PUSHACC1 18 | 15 NEQ 19 | 16 BRANCHIFNOT 23 20 | 18 GETGLOBAL Not_found 21 | 20 MAKEBLOCK1 0 22 | 22 RAISE 23 | 23 POP 1 24 | 25 ATOM0 25 | 26 SETGLOBAL T220-assign 26 | 28 STOP 27 | **) 28 | -------------------------------------------------------------------------------- /testsuite/tests/typing-gadts/pr5981.ml: -------------------------------------------------------------------------------- 1 | module F(S : sig type 'a t end) = struct 2 | type _ ab = 3 | A : int S.t ab 4 | | B : float S.t ab 5 | 6 | let f : int S.t ab -> float S.t ab -> string = 7 | fun (l : int S.t ab) (r : float S.t ab) -> match l, r with 8 | | A, B -> "f A B" 9 | end;; 10 | 11 | module F(S : sig type 'a t end) = struct 12 | type a = int * int 13 | type b = int -> int 14 | 15 | type _ ab = 16 | A : a S.t ab 17 | | B : b S.t ab 18 | 19 | let f : a S.t ab -> b S.t ab -> string = 20 | fun l r -> match l, r with 21 | | A, B -> "f A B" 22 | end;; 23 | -------------------------------------------------------------------------------- /experimental/frisch/test_js.ml: -------------------------------------------------------------------------------- 1 | module Js = struct 2 | type +'a t 3 | type +'a gen_prop 4 | type +'a meth 5 | module Unsafe = struct 6 | type any 7 | let get (_o : 'a t) (_meth : string) = assert false 8 | let set (_o : 'a t) (_meth : string) (_v : 'b) = () 9 | let meth_call (_ : 'a) (_ : string) (_ : any array) : 'b = assert false 10 | let inject _ : any = assert false 11 | end 12 | end 13 | 14 | let foo1 o = 15 | if [%js o.bar] then [%js o.foo1.foo2] else [%js o.foo2] 16 | 17 | let foo2 o = 18 | [%js o.x <- o.x + 1] 19 | 20 | 21 | let foo3 o a = 22 | [%js o#x] + [%js o#y 1 a] 23 | -------------------------------------------------------------------------------- /testsuite/tests/lib-hashtbl/htbl.reference: -------------------------------------------------------------------------------- 1 | -- Random integers, large range 2 | Insertion: passed 3 | Insertion: passed 4 | Removal: passed 5 | -- Random integers, narrow range 6 | Insertion: passed 7 | Insertion: passed 8 | Removal: passed 9 | -- Strings, generic interface 10 | Insertion: passed 11 | Insertion: passed 12 | Removal: passed 13 | -- Strings, functorial interface 14 | Insertion: passed 15 | Insertion: passed 16 | Removal: passed 17 | -- Pairs of strings 18 | Insertion: passed 19 | Insertion: passed 20 | Removal: passed 21 | -- Lists of strings 22 | Insertion: passed 23 | Insertion: passed 24 | Removal: passed 25 | -------------------------------------------------------------------------------- /testsuite/tests/typing-gadts/pr5906.ml: -------------------------------------------------------------------------------- 1 | type _ constant = 2 | | Int: int -> int constant 3 | | Bool: bool -> bool constant 4 | 5 | type (_, _, _) binop = 6 | | Eq: ('a, 'a, bool) binop 7 | | Leq: ('a, 'a, bool) binop 8 | | Add: (int, int, int) binop 9 | 10 | let eval (type a) (type b) (type c) (bop:(a,b,c) binop) (x:a constant) (y:b constant) : c constant = 11 | match bop, x, y with 12 | | Eq, Bool x, Bool y -> Bool (if x then y else not y) 13 | | Leq, Int x, Int y -> Bool (x <= y) 14 | | Leq, Bool x, Bool y -> Bool (x <= y) 15 | | Add, Int x, Int y -> Int (x + y) 16 | 17 | let _ = eval Eq (Int 2) (Int 3) 18 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t192-getfloatfield-1.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | type t = { a : float; b : float };; 3 | 4 | if { a = 0.1; b = 0.2 }.a <> 0.1 then raise Not_found;; 5 | 6 | (** 7 | 0 CONSTINT 42 8 | 2 PUSHACC0 9 | 3 MAKEBLOCK1 0 10 | 5 POP 1 11 | 7 SETGLOBAL Lib 12 | 9 GETGLOBAL 0.1 13 | 11 PUSHGETGLOBAL [|0.1, 0.2|] 14 | 13 GETFLOATFIELD 0 15 | 15 C_CALL2 neq_float 16 | 17 BRANCHIFNOT 24 17 | 19 GETGLOBAL Not_found 18 | 21 MAKEBLOCK1 0 19 | 23 RAISE 20 | 24 ATOM0 21 | 25 SETGLOBAL T192-getfloatfield-1 22 | 27 STOP 23 | **) 24 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t192-getfloatfield-2.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | type t = { a : float; b : float };; 3 | 4 | if { a = 0.1; b = 0.2 }.b <> 0.2 then raise Not_found;; 5 | 6 | (** 7 | 0 CONSTINT 42 8 | 2 PUSHACC0 9 | 3 MAKEBLOCK1 0 10 | 5 POP 1 11 | 7 SETGLOBAL Lib 12 | 9 GETGLOBAL 0.2 13 | 11 PUSHGETGLOBAL [|0.1, 0.2|] 14 | 13 GETFLOATFIELD 1 15 | 15 C_CALL2 neq_float 16 | 17 BRANCHIFNOT 24 17 | 19 GETGLOBAL Not_found 18 | 21 MAKEBLOCK1 0 19 | 23 RAISE 20 | 24 ATOM0 21 | 25 SETGLOBAL T192-getfloatfield-2 22 | 27 STOP 23 | **) 24 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t200-getfield2.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | type t = { 3 | a : int; 4 | b : int; 5 | c : int; 6 | };; 7 | 8 | if { a = 7; b = 6; c = 5 }.c <> 5 then raise Not_found;; 9 | 10 | (** 11 | 0 CONSTINT 42 12 | 2 PUSHACC0 13 | 3 MAKEBLOCK1 0 14 | 5 POP 1 15 | 7 SETGLOBAL Lib 16 | 9 CONSTINT 5 17 | 11 PUSHGETGLOBAL <0>(7, 6, 5) 18 | 13 GETFIELD2 19 | 14 NEQ 20 | 15 BRANCHIFNOT 22 21 | 17 GETGLOBAL Not_found 22 | 19 MAKEBLOCK1 0 23 | 21 RAISE 24 | 22 ATOM0 25 | 23 SETGLOBAL T200-getfield2 26 | 25 STOP 27 | **) 28 | -------------------------------------------------------------------------------- /testsuite/tests/typing-gadts/pr6817.ml: -------------------------------------------------------------------------------- 1 | module A = struct 2 | type nil = Cstr 3 | end 4 | open A 5 | ;; 6 | 7 | type _ s = 8 | | Nil : nil s 9 | | Cons : 't s -> ('h -> 't) s 10 | 11 | type ('stack, 'typ) var = 12 | | Head : (('typ -> _) s, 'typ) var 13 | | Tail : ('tail s, 'typ) var -> ((_ -> 'tail) s, 'typ) var 14 | 15 | type _ lst = 16 | | CNil : nil lst 17 | | CCons : 'h * ('t lst) -> ('h -> 't) lst 18 | ;; 19 | 20 | let rec get_var : type stk ret. (stk s, ret) var -> stk lst -> ret = fun n s -> 21 | match n, s with 22 | | Head, CCons (h, _) -> h 23 | | Tail n', CCons (_, t) -> get_var n' t 24 | ;; 25 | -------------------------------------------------------------------------------- /testsuite/tests/typing-objects/pr5619_bad.ml: -------------------------------------------------------------------------------- 1 | class type foo_t = 2 | object 3 | method foo: string 4 | end 5 | 6 | type 'a name = 7 | Foo: foo_t name 8 | | Int: int name 9 | ;; 10 | 11 | class foo = 12 | object(self) 13 | method foo = "foo" 14 | method cast = 15 | function 16 | Foo -> (self :> ) 17 | | _ -> raise Exit 18 | end 19 | ;; 20 | 21 | class foo: foo_t = 22 | object(self) 23 | method foo = "foo" 24 | method cast: type a. a name -> a = 25 | function 26 | Foo -> (self :> foo_t) 27 | | _ -> ((raise Exit) : a) 28 | end 29 | ;; 30 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t191-vectlength.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | let x = 0.0 in 3 | if Array.length [| x |] <> 1 then raise Not_found 4 | ;; 5 | 6 | (** 7 | 0 CONSTINT 42 8 | 2 PUSHACC0 9 | 3 MAKEBLOCK1 0 10 | 5 POP 1 11 | 7 SETGLOBAL Lib 12 | 9 GETGLOBAL 0 13 | 11 PUSHCONST1 14 | 12 PUSHACC1 15 | 13 MAKEFLOATBLOCK 1 16 | 15 VECTLENGTH 17 | 16 NEQ 18 | 17 BRANCHIFNOT 24 19 | 19 GETGLOBAL Not_found 20 | 21 MAKEBLOCK1 0 21 | 23 RAISE 22 | 24 POP 1 23 | 26 ATOM0 24 | 27 SETGLOBAL T191-vectlength 25 | 29 STOP 26 | **) 27 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t092-pushacc3.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | let x = false in 3 | let y = true in 4 | let z = true in 5 | let a = true in 6 | if x then raise Not_found 7 | ;; 8 | 9 | (** 10 | 0 CONSTINT 42 11 | 2 PUSHACC0 12 | 3 MAKEBLOCK1 0 13 | 5 POP 1 14 | 7 SETGLOBAL Lib 15 | 9 CONST0 16 | 10 PUSHCONST1 17 | 11 PUSHCONST1 18 | 12 PUSHCONST1 19 | 13 PUSHACC3 20 | 14 BRANCHIFNOT 21 21 | 16 GETGLOBAL Not_found 22 | 18 MAKEBLOCK1 0 23 | 20 RAISE 24 | 21 POP 4 25 | 23 ATOM0 26 | 24 SETGLOBAL T092-pushacc3 27 | 26 STOP 28 | **) 29 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t090-acc2.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | let x = true in 3 | let y = false in 4 | let z = false in 5 | (); 6 | if not x then raise Not_found 7 | ;; 8 | 9 | (** 10 | 0 CONSTINT 42 11 | 2 PUSHACC0 12 | 3 MAKEBLOCK1 0 13 | 5 POP 1 14 | 7 SETGLOBAL Lib 15 | 9 CONST1 16 | 10 PUSHCONST0 17 | 11 PUSHCONST0 18 | 12 PUSHCONST0 19 | 13 ACC2 20 | 14 BOOLNOT 21 | 15 BRANCHIFNOT 22 22 | 17 GETGLOBAL Not_found 23 | 19 MAKEBLOCK1 0 24 | 21 RAISE 25 | 22 POP 3 26 | 24 ATOM0 27 | 25 SETGLOBAL T090-acc2 28 | 27 STOP 29 | **) 30 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t240-c_call3.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | if Hashtbl.hash_param 5 6 [1;2;3] <> 697606130 then raise Not_found;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 CONSTINT 196799 11 | 11 PUSHGETGLOBAL <0>(1, <0>(2, <0>(3, 0))) 12 | 13 PUSHCONSTINT 6 13 | 15 PUSHCONSTINT 5 14 | 17 C_CALL3 hash_univ_param 15 | 19 NEQ 16 | 20 BRANCHIFNOT 27 17 | 22 GETGLOBAL Not_found 18 | 24 MAKEBLOCK1 0 19 | 26 RAISE 20 | 27 ATOM0 21 | 28 SETGLOBAL T240-c_call3 22 | 30 STOP 23 | **) 24 | -------------------------------------------------------------------------------- /testsuite/tests/typing-misc/occur_check.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # type 'a t = 'a 3 | # Characters 42-43: 4 | let f (g : 'a list -> 'a t -> 'a) s = g s s;; 5 | ^ 6 | Error: This expression has type 'a list 7 | but an expression was expected of type 'a t = 'a 8 | The type variable 'a occurs inside 'a list 9 | # Characters 42-43: 10 | let f (g : 'a * 'b -> 'a t -> 'a) s = g s s;; 11 | ^ 12 | Error: This expression has type 'a * 'b 13 | but an expression was expected of type 'a t = 'a 14 | The type variable 'a occurs inside 'a * 'b 15 | # 16 | -------------------------------------------------------------------------------- /tools/magic: -------------------------------------------------------------------------------- 1 | # Here are some definitions that can be added to the /usr/share/magic 2 | # database so that the file(1) command recognizes OCaml compiled files. 3 | # Contributed by Sven Luther. 4 | 0 string Caml1999 OCaml 5 | >8 string X bytecode executable 6 | >8 string I interface data (.cmi) 7 | >8 string O bytecode object data (.cmo) 8 | >8 string A bytecode library data (.cma) 9 | >8 string Y native object data (.cmx) 10 | >8 string Z native library data (.cmxa) 11 | >9 string >\0 (Version %3.3s). 12 | -------------------------------------------------------------------------------- /testsuite/tests/backtrace/backtrace.b.reference: -------------------------------------------------------------------------------- 1 | b 2 | Fatal error: exception Backtrace.Error("b") 3 | Raised at file "backtrace.ml", line 18, characters 21-32 4 | Called from file "backtrace.ml", line 18, characters 42-53 5 | Called from file "backtrace.ml", line 18, characters 42-53 6 | Called from file "backtrace.ml", line 18, characters 42-53 7 | Called from file "backtrace.ml", line 18, characters 42-53 8 | Called from file "backtrace.ml", line 18, characters 42-53 9 | Called from file "backtrace.ml", line 22, characters 4-11 10 | Re-raised at file "backtrace.ml", line 24, characters 68-71 11 | Called from file "backtrace.ml", line 29, characters 9-25 12 | -------------------------------------------------------------------------------- /testsuite/tests/formats-transition/deprecated_unsigned_printers.ml: -------------------------------------------------------------------------------- 1 | (* %n, %l, %N and %L have a scanf-specific semantics, but are supposed 2 | to be interpreted by Printf and Format as %u, despite this 3 | interpretation being mildly deprecated *) 4 | 5 | let test format = (Printf.sprintf format (-3) : string) 6 | ;; 7 | 8 | let () = Printf.printf "%%n: %B\n" 9 | (test "%n" = test "%u") 10 | ;; 11 | 12 | let () = Printf.printf "%%l: %B\n" 13 | (test "%l" = test "%u") 14 | ;; 15 | 16 | let () = Printf.printf "%%N: %B\n" 17 | (test "%N" = test "%u") 18 | ;; 19 | 20 | let () = Printf.printf "%%L: %B\n" 21 | (test "%L" = test "%u") 22 | ;; 23 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t165-apply.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | let f _ _ _ _ = 0 in f 0 0 0 0;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 BRANCH 17 11 | 11 RESTART 12 | 12 GRAB 3 13 | 14 CONST0 14 | 15 RETURN 4 15 | 17 CLOSURE 0, 12 16 | 20 PUSH 17 | 21 PUSH_RETADDR 30 18 | 23 CONST0 19 | 24 PUSHCONST0 20 | 25 PUSHCONST0 21 | 26 PUSHCONST0 22 | 27 PUSHACC7 23 | 28 APPLY 4 24 | 30 POP 1 25 | 32 ATOM0 26 | 33 SETGLOBAL T165-apply 27 | 35 STOP 28 | **) 29 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t200-getfield3.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | type t = { 3 | a : int; 4 | b : int; 5 | c : int; 6 | d : int; 7 | };; 8 | 9 | if { a = 7; b = 6; c = 5; d = 4 }.d <> 4 then raise Not_found;; 10 | 11 | (** 12 | 0 CONSTINT 42 13 | 2 PUSHACC0 14 | 3 MAKEBLOCK1 0 15 | 5 POP 1 16 | 7 SETGLOBAL Lib 17 | 9 CONSTINT 4 18 | 11 PUSHGETGLOBAL <0>(7, 6, 5, 4) 19 | 13 GETFIELD3 20 | 14 NEQ 21 | 15 BRANCHIFNOT 22 22 | 17 GETGLOBAL Not_found 23 | 19 MAKEBLOCK1 0 24 | 21 RAISE 25 | 22 ATOM0 26 | 23 SETGLOBAL T200-getfield3 27 | 25 STOP 28 | **) 29 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t230-check_signals.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | for i = 0 to 0 do () done;; 3 | 4 | (** 5 | 0 CONSTINT 42 6 | 2 PUSHACC0 7 | 3 MAKEBLOCK1 0 8 | 5 POP 1 9 | 7 SETGLOBAL Lib 10 | 9 CONST0 11 | 10 PUSHCONST0 12 | 11 PUSH 13 | 12 BRANCH 21 14 | 14 CHECK_SIGNALS 15 | 15 CONST0 16 | 16 ACC1 17 | 17 OFFSETINT 1 18 | 19 ASSIGN 1 19 | 21 ACC0 20 | 22 PUSHACC2 21 | 23 LEINT 22 | 24 BRANCHIF 14 23 | 26 CONST0 24 | 27 POP 2 25 | 29 ATOM0 26 | 30 SETGLOBAL T230-check_signals 27 | 32 STOP 28 | **) 29 | -------------------------------------------------------------------------------- /testsuite/tests/typing-modules-bugs/pr6427_bad.ml: -------------------------------------------------------------------------------- 1 | let flag = ref false 2 | module F(S : sig module type T end) (A : S.T) (B : S.T) = 3 | struct 4 | module X = (val if !flag then (module A) else (module B) : S.T) 5 | end 6 | 7 | (* If the above were accepted, one could break soundness *) 8 | module type S = sig type t val x : t end 9 | module Float = struct type t = float let x = 0.0 end 10 | module Int = struct type t = int let x = 0 end 11 | 12 | module M = F(struct module type T = S end) 13 | 14 | let () = flag := false 15 | module M1 = M(Float)(Int) 16 | 17 | let () = flag := true 18 | module M2 = M(Float)(Int) 19 | 20 | let _ = [| M2.X.x; M1.X.x |] 21 | -------------------------------------------------------------------------------- /testsuite/tests/backtrace/backtraces_and_finalizers.ml: -------------------------------------------------------------------------------- 1 | let () = Printexc.record_backtrace true 2 | 3 | let finaliser _ = try raise Exit with _ -> () 4 | 5 | let create () = 6 | let x = ref () in 7 | Gc.finalise finaliser x; 8 | x 9 | 10 | let f () = raise Exit 11 | 12 | let () = 13 | let minor_size = (Gc.get ()).Gc.minor_heap_size in 14 | for i = 1 to 100 do 15 | Gc.minor (); 16 | try 17 | ignore (create () : unit ref); 18 | f () 19 | with _ -> 20 | for i = 1 to minor_size / 2 - 1 do 21 | ignore (ref ()) 22 | done; 23 | ignore (Printexc.get_backtrace () : string) 24 | done; 25 | Printf.printf "ok\n" 26 | -------------------------------------------------------------------------------- /testsuite/tests/typing-gadts/pr6158.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # type 'a t = T of 'a 3 | type 'a s = S of 'a 4 | type (_, _) eq = Refl : ('a, 'a) eq 5 | # Characters 46-50: 6 | let f : (int s, int t) eq -> unit = function Refl -> ();; 7 | ^^^^ 8 | Error: This pattern matches values of type (int s, int s) eq 9 | but a pattern was expected which matches values of type 10 | (int s, int t) eq 11 | Type int s is not compatible with type int t 12 | # module M : 13 | functor (S : sig type 'a t = T of 'a type 'a s = T of 'a end) -> 14 | sig val f : (a#0 S.s, a#0 S.t) eq -> unit end 15 | # 16 | -------------------------------------------------------------------------------- /testsuite/tests/formats-transition/legacy_incompatible_flags.ml: -------------------------------------------------------------------------------- 1 | (* the legacy parser ignores flags on formatters on which they make no 2 | sense *) 3 | 4 | let () = Printf.printf "%+s\n" "toto" 5 | ;; 6 | let () = Printf.printf "%#s\n" "toto" 7 | ;; 8 | let () = Printf.printf "% s\n" "toto" 9 | ;; 10 | let () = Printf.printf "%03s\n" "toto" 11 | ;; 12 | let () = Printf.printf "%03S\n" "toto" 13 | ;; 14 | let () = Printf.printf "%.3s\n" "toto" 15 | ;; 16 | 17 | (* it still fails on flags used with ignored formats (%_d, etc.), 18 | but it's unclear how to test that in a backward-compatible way, 19 | if we accept that the error message may have changed 20 | *) 21 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t201-getfield.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | type t = { 3 | a : int; 4 | b : int; 5 | c : int; 6 | d : int; 7 | e : int; 8 | };; 9 | 10 | if { a = 7; b = 6; c = 5; d = 4; e = 3 }.e <> 3 then raise Not_found;; 11 | 12 | (** 13 | 0 CONSTINT 42 14 | 2 PUSHACC0 15 | 3 MAKEBLOCK1 0 16 | 5 POP 1 17 | 7 SETGLOBAL Lib 18 | 9 CONST3 19 | 10 PUSHGETGLOBAL <0>(7, 6, 5, 4, 3) 20 | 12 GETFIELD 4 21 | 14 NEQ 22 | 15 BRANCHIFNOT 22 23 | 17 GETGLOBAL Not_found 24 | 19 MAKEBLOCK1 0 25 | 21 RAISE 26 | 22 ATOM0 27 | 23 SETGLOBAL T201-getfield 28 | 25 STOP 29 | **) 30 | -------------------------------------------------------------------------------- /testsuite/tests/formats-transition/ignored_scan_counters.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # Exception: Invalid_argument "Printf: bad conversion %_". 3 | # Exception: Invalid_argument "Printf: bad conversion %_". 4 | # Exception: Invalid_argument "Printf: bad conversion %_". 5 | # Exception: Invalid_argument "Printf: bad conversion %_". 6 | # Exception: Invalid_argument "Printf: bad conversion %_". 7 | # Exception: Invalid_argument "Printf: bad conversion %_". 8 | # Exception: Invalid_argument "Printf: bad conversion %_". 9 | # Exception: Invalid_argument "Printf: bad conversion %_". 10 | # Hello World! 11 | # Hello World! 12 | # Hello World! 13 | # Hello World! 14 | # 15 | -------------------------------------------------------------------------------- /testsuite/tests/typing-poly-bugs/pr5673_ok.ml: -------------------------------------------------------------------------------- 1 | module Classdef = struct 2 | class virtual ['a, 'b, 'c] cl0 = 3 | object 4 | constraint 'c = < m : 'a -> 'b -> int; .. > 5 | end 6 | 7 | class virtual ['a, 'b] cl1 = 8 | object 9 | method virtual raise_trouble : int -> 'a 10 | method virtual m : 'a -> 'b -> int 11 | end 12 | 13 | class virtual ['a, 'b] cl2 = 14 | object 15 | method virtual as_cl0 : ('a, 'b, ('a, 'b) cl1) cl0 16 | end 17 | end 18 | 19 | module M : sig 20 | type refer = { poly : 'a 'b 'c . (('b, 'c) #Classdef.cl2 as 'a) } 21 | end = struct 22 | type refer = { poly : 'a 'b 'c . (('b, 'c) #Classdef.cl2 as 'a) } 23 | end 24 | -------------------------------------------------------------------------------- /testsuite/tests/warnings/w01.reference: -------------------------------------------------------------------------------- 1 | File "w01.ml", line 15, characters 12-14: 2 | Warning 2: this is not the end of a comment. 3 | File "w01.ml", line 21, characters 0-3: 4 | Warning 5: this function application is partial, 5 | maybe some arguments are missing. 6 | File "w01.ml", line 31, characters 4-5: 7 | Warning 8: this pattern-matching is not exhaustive. 8 | Here is an example of a value that is not matched: 9 | 0 10 | File "w01.ml", line 36, characters 0-1: 11 | Warning 10: this expression should have type unit. 12 | File "w01.ml", line 20, characters 8-9: 13 | Warning 27: unused variable y. 14 | File "w01.ml", line 43, characters 2-3: 15 | Warning 11: this match case is unused. 16 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t092-pushacc4.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | let x = false in 3 | let y = true in 4 | let z = true in 5 | let a = true in 6 | let b = true in 7 | if x then raise Not_found 8 | ;; 9 | 10 | (** 11 | 0 CONSTINT 42 12 | 2 PUSHACC0 13 | 3 MAKEBLOCK1 0 14 | 5 POP 1 15 | 7 SETGLOBAL Lib 16 | 9 CONST0 17 | 10 PUSHCONST1 18 | 11 PUSHCONST1 19 | 12 PUSHCONST1 20 | 13 PUSHCONST1 21 | 14 PUSHACC4 22 | 15 BRANCHIFNOT 22 23 | 17 GETGLOBAL Not_found 24 | 19 MAKEBLOCK1 0 25 | 21 RAISE 26 | 22 POP 5 27 | 24 ATOM0 28 | 25 SETGLOBAL T092-pushacc4 29 | 27 STOP 30 | **) 31 | -------------------------------------------------------------------------------- /testsuite/tests/typing-warnings/unused_types.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # Characters 35-52: 3 | type unused = int 4 | ^^^^^^^^^^^^^^^^^ 5 | Warning 34: unused type unused. 6 | module Unused : sig end 7 | # Characters 68-93: 8 | type nonrec unused = used 9 | ^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | Warning 34: unused type unused. 11 | module Unused_nonrec : sig end 12 | # Characters 40-65: 13 | type unused = A of unused 14 | ^^^^^^^^^^^^^^^^^^^^^^^^^ 15 | Warning 34: unused type unused. 16 | Characters 40-65: 17 | type unused = A of unused 18 | ^^^^^^^^^^^^^^^^^^^^^^^^^ 19 | Warning 37: unused constructor A. 20 | module Unused_rec : sig end 21 | # 22 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t090-acc3.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | let x = true in 3 | let y = false in 4 | let z = false in 5 | let a = false in 6 | (); 7 | if not x then raise Not_found 8 | ;; 9 | 10 | (** 11 | 0 CONSTINT 42 12 | 2 PUSHACC0 13 | 3 MAKEBLOCK1 0 14 | 5 POP 1 15 | 7 SETGLOBAL Lib 16 | 9 CONST1 17 | 10 PUSHCONST0 18 | 11 PUSHCONST0 19 | 12 PUSHCONST0 20 | 13 PUSHCONST0 21 | 14 ACC3 22 | 15 BOOLNOT 23 | 16 BRANCHIFNOT 23 24 | 18 GETGLOBAL Not_found 25 | 20 MAKEBLOCK1 0 26 | 22 RAISE 27 | 23 POP 4 28 | 25 ATOM0 29 | 26 SETGLOBAL T090-acc3 30 | 28 STOP 31 | **) 32 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t142-switch-8.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | type t = 3 | | A 4 | | B of int 5 | | C of int 6 | ;; 7 | 8 | match A with 9 | | A -> () 10 | | _ -> raise Not_found 11 | ;; 12 | 13 | (** 14 | 0 CONSTINT 42 15 | 2 PUSHACC0 16 | 3 MAKEBLOCK1 0 17 | 5 POP 1 18 | 7 SETGLOBAL Lib 19 | 9 CONST0 20 | 10 PUSHACC0 21 | 11 SWITCH 22 | int 0 -> 16 23 | tag 0 -> 19 24 | tag 1 -> 19 25 | 16 CONST0 26 | 17 BRANCH 24 27 | 19 GETGLOBAL Not_found 28 | 21 MAKEBLOCK1 0 29 | 23 RAISE 30 | 24 POP 1 31 | 26 ATOM0 32 | 27 SETGLOBAL T142-switch-8 33 | 29 STOP 34 | **) 35 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t250-closurerec-2.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | let rec f _ = 23 in 3 | if f 0 <> 23 then raise Not_found 4 | ;; 5 | 6 | (** 7 | 0 CONSTINT 42 8 | 2 PUSHACC0 9 | 3 MAKEBLOCK1 0 10 | 5 POP 1 11 | 7 SETGLOBAL Lib 12 | 9 BRANCH 15 13 | 11 CONSTINT 23 14 | 13 RETURN 1 15 | 15 CLOSUREREC 0, 11 16 | 19 CONSTINT 23 17 | 21 PUSHCONST0 18 | 22 PUSHACC2 19 | 23 APPLY1 20 | 24 NEQ 21 | 25 BRANCHIFNOT 32 22 | 27 GETGLOBAL Not_found 23 | 29 MAKEBLOCK1 0 24 | 31 RAISE 25 | 32 POP 1 26 | 34 ATOM0 27 | 35 SETGLOBAL T250-closurerec-2 28 | 37 STOP 29 | **) 30 | -------------------------------------------------------------------------------- /testsuite/tests/typing-modules-bugs/pr6513_ok.ml: -------------------------------------------------------------------------------- 1 | module type PR6513 = sig 2 | module type S = sig type u end 3 | 4 | module type T = sig 5 | type 'a wrap 6 | type uri 7 | end 8 | 9 | module Make: functor (Html5 : T with type 'a wrap = 'a) -> 10 | S with type u = < foo : Html5.uri > 11 | end 12 | 13 | (* Requires -package tyxml 14 | module type PR6513_orig = sig 15 | module type S = 16 | sig 17 | type t 18 | type u 19 | end 20 | 21 | module Make: functor (Html5: Html5_sigs.T with type 'a Xml.wrap = 'a and type 'a wrap = 'a and type 'a list_wrap = 'a list) -> S with 22 | type t = Html5_types.div Html5.elt and 23 | type u = < foo: Html5.uri > 24 | end 25 | *) 26 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t260-offsetref.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | let x = ref 32 in 3 | incr x; 4 | if !x <> 33 then raise Not_found; 5 | x 6 | ;; 7 | 8 | (** 9 | 0 CONSTINT 42 10 | 2 PUSHACC0 11 | 3 MAKEBLOCK1 0 12 | 5 POP 1 13 | 7 SETGLOBAL Lib 14 | 9 CONSTINT 32 15 | 11 MAKEBLOCK1 0 16 | 13 PUSHACC0 17 | 14 OFFSETREF 1 18 | 16 CONSTINT 33 19 | 18 PUSHACC1 20 | 19 GETFIELD0 21 | 20 NEQ 22 | 21 BRANCHIFNOT 28 23 | 23 GETGLOBAL Not_found 24 | 25 MAKEBLOCK1 0 25 | 27 RAISE 26 | 28 ACC0 27 | 29 POP 1 28 | 31 ATOM0 29 | 32 SETGLOBAL T260-offsetref 30 | 34 STOP 31 | **) 32 | -------------------------------------------------------------------------------- /testsuite/tests/typing-gadts/pr6241.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # type (_, _) t = A : ('a, 'a) t | B : string -> ('a, 'b) t 3 | # Characters 127-149: 4 | ....................................................function 5 | | B s -> s 6 | Warning 8: this pattern-matching is not exhaustive. 7 | Here is an example of a value that is not matched: 8 | A 9 | module M : 10 | functor (A : sig module type T end) (B : sig module type T end) -> 11 | sig val f : ((module A.T), (module B.T)) t -> string end 12 | # module A : sig module type T = sig end end 13 | # module N : sig val f : ((module A.T), (module A.T)) t -> string end 14 | # Exception: Match_failure ("//toplevel//", 7, 52). 15 | # 16 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t140-switch-3.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | match 2 with 3 | | 0 -> raise Not_found 4 | | 1 -> raise Not_found 5 | | _ -> () 6 | ;; 7 | 8 | (** 9 | 0 CONSTINT 42 10 | 2 PUSHACC0 11 | 3 MAKEBLOCK1 0 12 | 5 POP 1 13 | 7 SETGLOBAL Lib 14 | 9 CONST2 15 | 10 PUSHACC0 16 | 11 SWITCH 17 | int 0 -> 17 18 | int 1 -> 22 19 | 15 BRANCH 27 20 | 17 GETGLOBAL Not_found 21 | 19 MAKEBLOCK1 0 22 | 21 RAISE 23 | 22 GETGLOBAL Not_found 24 | 24 MAKEBLOCK1 0 25 | 26 RAISE 26 | 27 CONST0 27 | 28 POP 1 28 | 30 ATOM0 29 | 31 SETGLOBAL T140-switch-3 30 | 33 STOP 31 | **) 32 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t142-switch-9.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | type t = 3 | | A 4 | | B of int 5 | | C of int 6 | ;; 7 | 8 | match B 0 with 9 | | B _ -> () 10 | | _ -> raise Not_found 11 | ;; 12 | 13 | (** 14 | 0 CONSTINT 42 15 | 2 PUSHACC0 16 | 3 MAKEBLOCK1 0 17 | 5 POP 1 18 | 7 SETGLOBAL Lib 19 | 9 GETGLOBAL <0>(0) 20 | 11 PUSHACC0 21 | 12 SWITCH 22 | int 0 -> 20 23 | tag 0 -> 17 24 | tag 1 -> 20 25 | 17 CONST0 26 | 18 BRANCH 25 27 | 20 GETGLOBAL Not_found 28 | 22 MAKEBLOCK1 0 29 | 24 RAISE 30 | 25 POP 1 31 | 27 ATOM0 32 | 28 SETGLOBAL T142-switch-9 33 | 30 STOP 34 | **) 35 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t142-switch-A.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | type t = 3 | | A 4 | | B of int 5 | | C of int 6 | ;; 7 | 8 | match C 0 with 9 | | C _ -> () 10 | | _ -> raise Not_found 11 | ;; 12 | 13 | (** 14 | 0 CONSTINT 42 15 | 2 PUSHACC0 16 | 3 MAKEBLOCK1 0 17 | 5 POP 1 18 | 7 SETGLOBAL Lib 19 | 9 GETGLOBAL <1>(0) 20 | 11 PUSHACC0 21 | 12 SWITCH 22 | int 0 -> 20 23 | tag 0 -> 20 24 | tag 1 -> 17 25 | 17 CONST0 26 | 18 BRANCH 25 27 | 20 GETGLOBAL Not_found 28 | 22 MAKEBLOCK1 0 29 | 24 RAISE 30 | 25 POP 1 31 | 27 ATOM0 32 | 28 SETGLOBAL T142-switch-A 33 | 30 STOP 34 | **) 35 | -------------------------------------------------------------------------------- /testsuite/tests/typing-gadts/pr6163.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # type _ nat = Zero : [ `Zero ] nat | Succ : 'a nat -> [ `Succ of 'a ] nat 3 | # type 'a pre_nat = [ `Succ of 'a | `Zero ] 4 | # type aux = 5 | Aux : 6 | [ `Succ of [< [< [< [ `Zero ] pre_nat ] pre_nat ] pre_nat ] ] nat -> 7 | aux 8 | # Characters 19-157: 9 | ..match x with 10 | | Succ Zero -> "1" 11 | | Succ (Succ Zero) -> "2" 12 | | Succ (Succ (Succ Zero)) -> "3" 13 | | Succ (Succ (Succ (Succ Zero))) -> "4" 14 | Warning 8: this pattern-matching is not exhaustive. 15 | Here is an example of a value that is not matched: 16 | Succ (Succ (Succ (Succ (Succ _)))) 17 | val f : aux -> string = 18 | # 19 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t140-switch-4.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | match -1 with 3 | | 0 -> raise Not_found 4 | | 1 -> raise Not_found 5 | | _ -> () 6 | ;; 7 | 8 | (** 9 | 0 CONSTINT 42 10 | 2 PUSHACC0 11 | 3 MAKEBLOCK1 0 12 | 5 POP 1 13 | 7 SETGLOBAL Lib 14 | 9 CONSTINT -1 15 | 11 PUSHACC0 16 | 12 SWITCH 17 | int 0 -> 18 18 | int 1 -> 23 19 | 16 BRANCH 28 20 | 18 GETGLOBAL Not_found 21 | 20 MAKEBLOCK1 0 22 | 22 RAISE 23 | 23 GETGLOBAL Not_found 24 | 25 MAKEBLOCK1 0 25 | 27 RAISE 26 | 28 CONST0 27 | 29 POP 1 28 | 31 ATOM0 29 | 32 SETGLOBAL T140-switch-4 30 | 34 STOP 31 | **) 32 | -------------------------------------------------------------------------------- /testsuite/tests/typing-gadts/pr5989.ml: -------------------------------------------------------------------------------- 1 | type (_, _) t = 2 | Any : ('a, 'b) t 3 | | Eq : ('a, 'a) t 4 | ;; 5 | 6 | module M : 7 | sig 8 | type s = private [> `A] 9 | val eq : (s, [`A | `B]) t 10 | end = 11 | struct 12 | type s = [`A | `B] 13 | let eq = Eq 14 | end;; 15 | 16 | let f : (M.s, [`A | `B]) t -> string = function 17 | | Any -> "Any" 18 | ;; 19 | 20 | let () = print_endline (f M.eq) ;; 21 | 22 | module N : 23 | sig 24 | type s = private < a : int; .. > 25 | val eq : (s, ) t 26 | end = 27 | struct 28 | type s = 29 | let eq = Eq 30 | end 31 | ;; 32 | 33 | let f : (N.s, ) t -> string = function 34 | | Any -> "Any" 35 | ;; 36 | -------------------------------------------------------------------------------- /testsuite/tests/typing-gadts/pr6241.ml.principal.reference: -------------------------------------------------------------------------------- 1 | 2 | # type (_, _) t = A : ('a, 'a) t | B : string -> ('a, 'b) t 3 | # Characters 127-149: 4 | ....................................................function 5 | | B s -> s 6 | Warning 8: this pattern-matching is not exhaustive. 7 | Here is an example of a value that is not matched: 8 | A 9 | module M : 10 | functor (A : sig module type T end) (B : sig module type T end) -> 11 | sig val f : ((module A.T), (module B.T)) t -> string end 12 | # module A : sig module type T = sig end end 13 | # module N : sig val f : ((module A.T), (module A.T)) t -> string end 14 | # Exception: Match_failure ("//toplevel//", 7, 52). 15 | # 16 | -------------------------------------------------------------------------------- /testsuite/tests/typing-gadts/pr5332.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # type ('env, 'a) var = 3 | Zero : ('a * 'env, 'a) var 4 | | Succ : ('env, 'a) var -> ('b * 'env, 'a) var 5 | # type ('env, 'a) typ = 6 | Tint : ('env, int) typ 7 | | Tbool : ('env, bool) typ 8 | | Tvar : ('env, 'a) var -> ('env, 'a) typ 9 | # Characters 72-156: 10 | .match ta, tb with 11 | | Tint, Tint -> 0 12 | | Tbool, Tbool -> 1 13 | | Tvar var, tb -> 2 14 | Warning 8: this pattern-matching is not exhaustive. 15 | Here is an example of a value that is not matched: 16 | (Tbool, Tvar _) 17 | val f : ('env, 'a) typ -> ('env, 'a) typ -> int = 18 | # Exception: Match_failure ("//toplevel//", 9, 1). 19 | # 20 | -------------------------------------------------------------------------------- /testsuite/tests/typing-gadts/pr6163.ml.principal.reference: -------------------------------------------------------------------------------- 1 | 2 | # type _ nat = Zero : [ `Zero ] nat | Succ : 'a nat -> [ `Succ of 'a ] nat 3 | # type 'a pre_nat = [ `Succ of 'a | `Zero ] 4 | # type aux = 5 | Aux : 6 | [ `Succ of [< [< [< [ `Zero ] pre_nat ] pre_nat ] pre_nat ] ] nat -> 7 | aux 8 | # Characters 19-157: 9 | ..match x with 10 | | Succ Zero -> "1" 11 | | Succ (Succ Zero) -> "2" 12 | | Succ (Succ (Succ Zero)) -> "3" 13 | | Succ (Succ (Succ (Succ Zero))) -> "4" 14 | Warning 8: this pattern-matching is not exhaustive. 15 | Here is an example of a value that is not matched: 16 | Succ (Succ (Succ (Succ (Succ _)))) 17 | val f : aux -> string = 18 | # 19 | -------------------------------------------------------------------------------- /testsuite/tests/typing-recmod/t21ok.ml: -------------------------------------------------------------------------------- 1 | module F ( X : Set.OrderedType ) = struct 2 | module rec Mod : sig 3 | module XSet : 4 | sig 5 | type elt = X.t 6 | type t = Set.Make( X ).t 7 | end 8 | module XMap : 9 | sig 10 | type key = X.t 11 | type 'a t = 'a Map.Make(X).t 12 | end 13 | type elt = X.t 14 | type t = XSet.t XMap.t 15 | val compare: t -> t -> int 16 | end 17 | = 18 | struct 19 | module XSet = Set.Make( X ) 20 | module XMap = Map.Make( X ) 21 | 22 | type elt = X.t 23 | type t = XSet.t XMap.t 24 | let compare = (fun x y -> 0) 25 | end 26 | and ModSet : Set.S with type elt = Mod.t = Set.Make( Mod ) 27 | end 28 | -------------------------------------------------------------------------------- /testsuite/tests/typing-warnings/coercions.ml.principal.reference: -------------------------------------------------------------------------------- 1 | 2 | # Characters 76-79: 3 | fun b -> if b then format_of_string "x" else "y";; 4 | ^^^ 5 | Warning 18: this coercion to format6 is not principal. 6 | - : bool -> ('a, 'b, 'c, 'd, 'd, 'a) format6 = 7 | # Characters 28-48: 8 | fun b -> if b then "x" else format_of_string "y";; 9 | ^^^^^^^^^^^^^^^^^^^^ 10 | Error: This expression has type 11 | ('a, 'b, 'c, 'd, 'd, 'a) format6 = 12 | ('a, 'b, 'c, 'd, 'd, 'a) CamlinternalFormatBasics.format6 13 | but an expression was expected of type string 14 | # - : bool -> ('a, 'b, 'a) format = 15 | # 16 | -------------------------------------------------------------------------------- /experimental/garrigue/tests.ml: -------------------------------------------------------------------------------- 1 | (* $Id$ *) 2 | 3 | let f1 = function `a x -> x=1 | `b -> true 4 | let f2 = function `a x -> x | `b -> true 5 | let f3 = function `b -> true 6 | let f x = f1 x && f2 x 7 | 8 | let sub s ?:pos{=0} ?:len{=String.length s - pos} () = 9 | String.sub s pos len 10 | 11 | let cCAMLtoTKpack_options w = function 12 | `After v1 -> "-after" 13 | | `Anchor v1 -> "-anchor" 14 | | `Before v1 -> "-before" 15 | | `Expand v1 -> "-expand" 16 | | `Fill v1 -> "-fill" 17 | | `In v1 -> "-in" 18 | | `Ipadx v1 -> "-ipadx" 19 | | `Ipady v1 -> "-ipady" 20 | | `Padx v1 -> "-padx" 21 | | `Pady v1 -> "-pady" 22 | | `Side v1 -> "-side" 23 | -------------------------------------------------------------------------------- /stdlib/stdlib.mllib: -------------------------------------------------------------------------------- 1 | # This file lists all standard library modules 2 | # (in the same order as Makefile.shared). 3 | # It is used in particular to know what to expunge in toplevels. 4 | 5 | Pervasives 6 | Array 7 | List 8 | Char 9 | String 10 | Sys 11 | Hashtbl 12 | Sort 13 | Marshal 14 | Obj 15 | Int32 16 | Int64 17 | Nativeint 18 | Lexing 19 | Parsing 20 | Set 21 | Map 22 | Stack 23 | Queue 24 | CamlinternalLazy 25 | Lazy 26 | Stream 27 | Buffer 28 | Printf 29 | Format 30 | Scanf 31 | Arg 32 | Printexc 33 | Gc 34 | Digest 35 | Random 36 | Callback 37 | CamlinternalOO 38 | Oo 39 | CamlinternalMod 40 | Genlex 41 | Weak 42 | Filename 43 | Complex 44 | ArrayLabels 45 | ListLabels 46 | StringLabels 47 | MoreLabels 48 | StdLabels 49 | -------------------------------------------------------------------------------- /testsuite/tests/typing-poly-bugs/pr5673_bad.ml: -------------------------------------------------------------------------------- 1 | module Classdef = struct 2 | class virtual ['a, 'b, 'c] cl0 = 3 | object 4 | constraint 'c = < m : 'a -> 'b -> int; .. > 5 | end 6 | 7 | class virtual ['a, 'b] cl1 = 8 | object 9 | method virtual raise_trouble : int -> 'a 10 | method virtual m : 'a -> 'b -> int 11 | end 12 | 13 | class virtual ['a, 'b] cl2 = 14 | object 15 | method virtual as_cl0 : ('a, 'b, ('a, 'b) cl1) cl0 16 | end 17 | end 18 | 19 | type refer1 = < poly : 'a 'b 'c . (('b, 'c) #Classdef.cl2 as 'a) > 20 | type refer2 = < poly : 'a 'b 'c . (('b, 'c) #Classdef.cl2 as 'a) > 21 | 22 | (* Actually this should succeed ... *) 23 | let f (x : refer1) = (x : refer2) 24 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t140-switch-1.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | match 0 with 3 | | 0 -> () 4 | | 1 -> raise Not_found 5 | | _ -> raise Not_found 6 | ;; 7 | 8 | (** 9 | 0 CONSTINT 42 10 | 2 PUSHACC0 11 | 3 MAKEBLOCK1 0 12 | 5 POP 1 13 | 7 SETGLOBAL Lib 14 | 9 CONST0 15 | 10 PUSHACC0 16 | 11 SWITCH 17 | int 0 -> 17 18 | int 1 -> 20 19 | 15 BRANCH 25 20 | 17 CONST0 21 | 18 BRANCH 30 22 | 20 GETGLOBAL Not_found 23 | 22 MAKEBLOCK1 0 24 | 24 RAISE 25 | 25 GETGLOBAL Not_found 26 | 27 MAKEBLOCK1 0 27 | 29 RAISE 28 | 30 POP 1 29 | 32 ATOM0 30 | 33 SETGLOBAL T140-switch-1 31 | 35 STOP 32 | **) 33 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t140-switch-2.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | match 1 with 3 | | 0 -> raise Not_found 4 | | 1 -> () 5 | | _ -> raise Not_found 6 | ;; 7 | 8 | (** 9 | 0 CONSTINT 42 10 | 2 PUSHACC0 11 | 3 MAKEBLOCK1 0 12 | 5 POP 1 13 | 7 SETGLOBAL Lib 14 | 9 CONST1 15 | 10 PUSHACC0 16 | 11 SWITCH 17 | int 0 -> 17 18 | int 1 -> 22 19 | 15 BRANCH 25 20 | 17 GETGLOBAL Not_found 21 | 19 MAKEBLOCK1 0 22 | 21 RAISE 23 | 22 CONST0 24 | 23 BRANCH 30 25 | 25 GETGLOBAL Not_found 26 | 27 MAKEBLOCK1 0 27 | 29 RAISE 28 | 30 POP 1 29 | 32 ATOM0 30 | 33 SETGLOBAL T140-switch-2 31 | 35 STOP 32 | **) 33 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t092-pushacc5.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | let x = false in 3 | let y = true in 4 | let z = true in 5 | let a = true in 6 | let b = true in 7 | let c = true in 8 | if x then raise Not_found 9 | ;; 10 | 11 | (** 12 | 0 CONSTINT 42 13 | 2 PUSHACC0 14 | 3 MAKEBLOCK1 0 15 | 5 POP 1 16 | 7 SETGLOBAL Lib 17 | 9 CONST0 18 | 10 PUSHCONST1 19 | 11 PUSHCONST1 20 | 12 PUSHCONST1 21 | 13 PUSHCONST1 22 | 14 PUSHCONST1 23 | 15 PUSHACC5 24 | 16 BRANCHIFNOT 23 25 | 18 GETGLOBAL Not_found 26 | 20 MAKEBLOCK1 0 27 | 22 RAISE 28 | 23 POP 6 29 | 25 ATOM0 30 | 26 SETGLOBAL T092-pushacc5 31 | 28 STOP 32 | **) 33 | -------------------------------------------------------------------------------- /.travis-ci.sh: -------------------------------------------------------------------------------- 1 | case $XARCH in 2 | i386) 3 | ./configure 4 | make world.opt 5 | sudo make install 6 | (cd testsuite && make all) 7 | mkdir external-packages 8 | cd external-packages 9 | git clone git://github.com/ocaml/camlp4 10 | (cd camlp4 && ./configure && make && sudo make install) 11 | git clone git://github.com/ocaml/opam 12 | (cd opam && ./configure && make lib-ext && make && sudo make install) 13 | git config --global user.email "some@name.com" 14 | git config --global user.name "Some Name" 15 | opam init -y -a git://github.com/ocaml/opam-repository 16 | opam install -y oasis 17 | # opam pin add -y utop git://github.com/diml/utop 18 | ;; 19 | *) 20 | echo unknown arch 21 | exit 1 22 | ;; 23 | esac 24 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t090-acc4.ml: -------------------------------------------------------------------------------- 1 | open Lib;; 2 | let x = true in 3 | let y = false in 4 | let z = false in 5 | let a = false in 6 | let b = false in 7 | (); 8 | if not x then raise Not_found 9 | ;; 10 | 11 | (** 12 | 0 CONSTINT 42 13 | 2 PUSHACC0 14 | 3 MAKEBLOCK1 0 15 | 5 POP 1 16 | 7 SETGLOBAL Lib 17 | 9 CONST1 18 | 10 PUSHCONST0 19 | 11 PUSHCONST0 20 | 12 PUSHCONST0 21 | 13 PUSHCONST0 22 | 14 PUSHCONST0 23 | 15 ACC4 24 | 16 BOOLNOT 25 | 17 BRANCHIFNOT 24 26 | 19 GETGLOBAL Not_found 27 | 21 MAKEBLOCK1 0 28 | 23 RAISE 29 | 24 POP 5 30 | 26 ATOM0 31 | 27 SETGLOBAL T090-acc4 32 | 29 STOP 33 | **) 34 | -------------------------------------------------------------------------------- /testsuite/tests/typing-misc/constraints.ml: -------------------------------------------------------------------------------- 1 | type 'a t = [`A of 'a t t] as 'a;; (* fails *) 2 | 3 | type 'a t = [`A of 'a t t];; (* fails *) 4 | 5 | type 'a t = [`A of 'a t t] constraint 'a = 'a t;; 6 | 7 | type 'a t = [`A of 'a t] constraint 'a = 'a t;; 8 | 9 | type 'a t = [`A of 'a] as 'a;; 10 | 11 | type 'a v = [`A of u v] constraint 'a = t and t = u and u = t;; (* fails *) 12 | 13 | type 'a t = 'a;; 14 | let f (x : 'a t as 'a) = ();; (* fails *) 15 | 16 | let f (x : 'a t) (y : 'a) = x = y;; 17 | 18 | (* PR#6505 *) 19 | module type PR6505 = sig 20 | type 'o is_an_object = < .. > as 'o 21 | and 'o abs constraint 'o = 'o is_an_object 22 | val abs : 'o is_an_object -> 'o abs 23 | val unabs : 'o abs -> 'o 24 | end;; (* fails *) 25 | -------------------------------------------------------------------------------- /testsuite/tests/tool-ocaml/t301-object.ml: -------------------------------------------------------------------------------- 1 | (**** file testinterp/t301-object.ml 2 | suggested by Jacques Garrigue to Basile Starynkevitch 3 | 4 | compilable with 5 | ocamlc -nostdlib -I ../../stdlib \ 6 | ../../stdlib/pervasives.cmo ../../stdlib/camlinternalOO.cmo \ 7 | t301-object.ml -o t301-object.byte 8 | 9 | ***) 10 | 11 | class c = object (self) 12 | method pubmet = 1 13 | method privmet = self#pubmet + 1 14 | val o = object method a = 3 method m = 4 end 15 | method dynmet = o#m 16 | end;; 17 | 18 | let f () = 19 | let c = new c in 20 | (c#pubmet, c#privmet, c#dynmet);; 21 | 22 | let (x,y,z) = f () in 23 | if x <> 1 then raise Not_found; 24 | if y <> 2 then raise Not_found; 25 | if z <> 4 then raise Not_found;; 26 | -------------------------------------------------------------------------------- /testsuite/tests/typing-objects/pr5619_bad.ml.reference: -------------------------------------------------------------------------------- 1 | 2 | # class type foo_t = object method foo : string end 3 | type 'a name = Foo : foo_t name | Int : int name 4 | # class foo : 5 | object method cast : foo_t name -> < foo : string > method foo : string end 6 | # Characters 22-184: 7 | ..object(self) 8 | method foo = "foo" 9 | method cast: type a. a name -> a = 10 | function 11 | Foo -> (self :> foo_t) 12 | | _ -> ((raise Exit) : a) 13 | end 14 | Error: The class type 15 | object method cast : 'a name -> 'a method foo : string end 16 | is not matched by the class type foo_t 17 | The public method cast cannot be hidden 18 | # 19 | -------------------------------------------------------------------------------- /experimental/frisch/testdoc.mli: -------------------------------------------------------------------------------- 1 | [@@doc section "First section"] 2 | 3 | module M : sig 4 | [@@doc section "Public definitions"] 5 | 6 | type t = 7 | | A 8 | | B 9 | 10 | [@@doc section "Internal definitions"] 11 | 12 | val zero: int 13 | [@@doc "A very important integer."] 14 | end 15 | [@@doc "This is an internal module."] 16 | 17 | val incr: int -> int 18 | [@@doc "This function returns the next integer."] 19 | 20 | [@@doc section "Second section"] 21 | 22 | val decr: int -> int 23 | [@@doc "This function returns the previous integer."] 24 | 25 | val is_a: M.t -> bool 26 | [@@doc "This function checks whether its argument is the A constructor."] 27 | 28 | module X: Hashtbl.HashedType 29 | [@@doc "An internal module"] 30 | --------------------------------------------------------------------------------