diff --git a/.circleci/config.yml b/.circleci/config.yml index d72502241..28c1d0e2e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -110,6 +110,14 @@ jobs: - OCAML_VERSION: "4.08.x" - NPM_CONFIG_PREFIX: "~/.npm-global" <<: *common_steps + 4.09.0: + docker: + - image: ocaml/opam2:debian-9-ocaml-4.09 + environment: + - TERM: dumb + - OCAML_VERSION: "4.09.x" + - NPM_CONFIG_PREFIX: "~/.npm-global" + <<: *common_steps esy_build: docker: - image: ocaml/opam2:debian-9-ocaml-4.06 @@ -170,4 +178,5 @@ workflows: - 4.06.1 - 4.07.0 - 4.08.0 + - 4.09.0 - esy_build diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d76b6f1e9..99ac63d36 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -17,6 +17,17 @@ jobs: steps: - template: .ci/esy-build-steps.yml +- job: Mac_opam_4090 + timeoutInMinutes: 0 + pool: + vmImage: 'macOS 10.13' + + variables: + OCAML_VERSION: 4.09.0 + + steps: + - template: .ci/opam-build-steps.yml + - job: Mac_opam_4080 timeoutInMinutes: 0 pool: diff --git a/formatTest/errorTests/expected_output/comments1.re.4.09.0 b/formatTest/errorTests/expected_output/comments1.re.4.09.0 new file mode 100644 index 000000000..87d2983fb --- /dev/null +++ b/formatTest/errorTests/expected_output/comments1.re.4.09.0 @@ -0,0 +1,5 @@ +File "comments1.re", line 1, characters 0-2: +1 | /* this is an unterminated comment + ^^ +Error: Comment not terminated + diff --git a/formatTest/errorTests/expected_output/lowercase_module.re.4.09.0 b/formatTest/errorTests/expected_output/lowercase_module.re.4.09.0 new file mode 100644 index 000000000..55a5abdf3 --- /dev/null +++ b/formatTest/errorTests/expected_output/lowercase_module.re.4.09.0 @@ -0,0 +1,5 @@ +File "lowercase_module.re", line 1, characters 7-16: +1 | module lowercase = {}; + ^^^^^^^^^ +Error: Module names must start with an uppercase letter. + diff --git a/formatTest/errorTests/expected_output/lowercase_module_rec.re.4.09.0 b/formatTest/errorTests/expected_output/lowercase_module_rec.re.4.09.0 new file mode 100644 index 000000000..b73a751da --- /dev/null +++ b/formatTest/errorTests/expected_output/lowercase_module_rec.re.4.09.0 @@ -0,0 +1,5 @@ +File "lowercase_module_rec.re", line 1, characters 11-20: +1 | module rec lowercase = {}; + ^^^^^^^^^ +Error: Module names must start with an uppercase letter. + diff --git a/formatTest/errorTests/expected_output/reservedField.re.4.09.0 b/formatTest/errorTests/expected_output/reservedField.re.4.09.0 new file mode 100644 index 000000000..400c7defb --- /dev/null +++ b/formatTest/errorTests/expected_output/reservedField.re.4.09.0 @@ -0,0 +1,5 @@ +File "reservedField.re", line 1, characters 11-15: +1 | let x = {< type >}; + ^^^^ +Error: 1054: type is a reserved keyword, it cannot be used as an identifier. Try `type_` or `_type` instead + diff --git a/formatTest/errorTests/expected_output/reservedRecord.re.4.09.0 b/formatTest/errorTests/expected_output/reservedRecord.re.4.09.0 new file mode 100644 index 000000000..9e17372a4 --- /dev/null +++ b/formatTest/errorTests/expected_output/reservedRecord.re.4.09.0 @@ -0,0 +1,5 @@ +File "reservedRecord.re", line 1, characters 24-28: +1 | let foo = { foo: "bar", type: "qux" }; + ^^^^ +Error: 1863: type is a reserved keyword, it cannot be used as an identifier. Try `type_` or `_type` instead + diff --git a/formatTest/errorTests/expected_output/reservedRecordPunned.re.4.09.0 b/formatTest/errorTests/expected_output/reservedRecordPunned.re.4.09.0 new file mode 100644 index 000000000..cbd6e0039 --- /dev/null +++ b/formatTest/errorTests/expected_output/reservedRecordPunned.re.4.09.0 @@ -0,0 +1,5 @@ +File "reservedRecordPunned.re", line 1, characters 22-26: +1 | let foo = { ...other, type }; + ^^^^ +Error: 3411: type is a reserved keyword, it cannot be used as an identifier. Try `type_` or `_type` instead + diff --git a/formatTest/errorTests/expected_output/reservedRecordType.re.4.09.0 b/formatTest/errorTests/expected_output/reservedRecordType.re.4.09.0 new file mode 100644 index 000000000..5c32eab6c --- /dev/null +++ b/formatTest/errorTests/expected_output/reservedRecordType.re.4.09.0 @@ -0,0 +1,5 @@ +File "reservedRecordType.re", line 1, characters 11-15: +1 | type x = { type: string }; + ^^^^ +Error: 770: type is a reserved keyword, it cannot be used as an identifier. Try `type_` or `_type` instead + diff --git a/formatTest/errorTests/expected_output/reservedRecordTypePunned.re.4.09.0 b/formatTest/errorTests/expected_output/reservedRecordTypePunned.re.4.09.0 new file mode 100644 index 000000000..1cbc17674 --- /dev/null +++ b/formatTest/errorTests/expected_output/reservedRecordTypePunned.re.4.09.0 @@ -0,0 +1,5 @@ +File "reservedRecordTypePunned.re", line 1, characters 11-15: +1 | type x = { type }; + ^^^^ +Error: 770: type is a reserved keyword, it cannot be used as an identifier. Try `type_` or `_type` instead + diff --git a/formatTest/errorTests/expected_output/syntaxError.re.4.09.0 b/formatTest/errorTests/expected_output/syntaxError.re.4.09.0 new file mode 100644 index 000000000..3ee84cb3c --- /dev/null +++ b/formatTest/errorTests/expected_output/syntaxError.re.4.09.0 @@ -0,0 +1,5 @@ +File "syntaxError.re", line 1, characters 9-10: +1 | try (bad); + ^ +Error: Syntax error + diff --git a/formatTest/typeCheckedTests/expected_output/comments.rei.4.09.0 b/formatTest/typeCheckedTests/expected_output/comments.rei.4.09.0 new file mode 100644 index 000000000..0d0f98b81 --- /dev/null +++ b/formatTest/typeCheckedTests/expected_output/comments.rei.4.09.0 @@ -0,0 +1,39 @@ +/* **** comment */ +/*** comment */ +/** docstring */; +/* comment */ +/** docstring */; +/*** comment */ +/**** comment */ +/***** comment */ + +/** */; +/*** */ +/**** */ + +/***/ +/****/ + +/** (** comment *) */; +/** (*** comment *) */; + +/* (** comment *) */ +/* (*** comment *) */ +/* *(*** comment *) */ + +/* comment **/ +/* comment ***/ +/* comment ****/ +/* comment *****/ + +/** + * Multiline + */; + +/** Multiline + * + */; + +/** + ** + */; diff --git a/formatTest/typeCheckedTests/expected_output/mlVariants.re.4.09.0 b/formatTest/typeCheckedTests/expected_output/mlVariants.re.4.09.0 new file mode 100644 index 000000000..2e1204e7a --- /dev/null +++ b/formatTest/typeCheckedTests/expected_output/mlVariants.re.4.09.0 @@ -0,0 +1,27 @@ +/* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */ + +type polyVariantsInMl = [ + | `IntTuple(int, int) + | `StillAnIntTuple(int, int) +]; + +let intTuple = `IntTuple((1, 2)); +let stillAnIntTuple = `StillAnIntTuple((4, 5)); +let sumThem = + fun + | `IntTuple(x, y) => x + y + | `StillAnIntTuple(a, b) => a + b; + +type nonrec t = + | A(int) + | B(bool); + +type s = [ | `Poly]; + +let x: s = `Poly; + +/* There's a bug in ocaml 4.06 resulting in an extra Pexp_constraint on the `Poly, + * duplicating the core_type. + * https://caml.inria.fr/mantis/view.php?id=7758 + * https://caml.inria.fr/mantis/view.php?id=7344 */ +let x: s = (`Poly: s); diff --git a/reason.opam b/reason.opam index 75aed723b..7b4cadce9 100644 --- a/reason.opam +++ b/reason.opam @@ -12,7 +12,7 @@ build: [ ["dune" "runtest" "-p" name "-j" jobs] {with-test} ] depends: [ - "ocaml" {>= "4.02" & < "4.09"} + "ocaml" {>= "4.02" & < "4.10"} "dune" {>= "1.4"} "ocamlfind" {build} "menhir" {>= "20170418"} diff --git a/rtop.opam b/rtop.opam index fe9c2c212..becec0304 100644 --- a/rtop.opam +++ b/rtop.opam @@ -12,7 +12,7 @@ build: [ ["dune" "runtest" "-p" name "-j" jobs] {with-test} ] depends: [ - "ocaml" {>= "4.02" & < "4.09"} + "ocaml" {>= "4.02" & < "4.10"} "dune" {>= "1.4"} "reason" "utop" {>= "1.17"} diff --git a/src/reason-parser-tests/dune b/src/reason-parser-tests/dune index 2df1c0d29..7865e11a7 100644 --- a/src/reason-parser-tests/dune +++ b/src/reason-parser-tests/dune @@ -1,3 +1,9 @@ +(rule + (targets testOprint.ml) + (deps testOprint.cppo.ml) + (action + (run %{bin:cppo} -V OCAML:%{ocaml_version} %{deps} -o %{targets}))) + (executable (name testOprint) (libraries reason)) diff --git a/src/reason-parser-tests/testOprint.ml b/src/reason-parser-tests/testOprint.cppo.ml similarity index 96% rename from src/reason-parser-tests/testOprint.ml rename to src/reason-parser-tests/testOprint.cppo.ml index 51f538570..74b5e20dd 100644 --- a/src/reason-parser-tests/testOprint.ml +++ b/src/reason-parser-tests/testOprint.cppo.ml @@ -31,7 +31,11 @@ let main () = let lexbuf = Reason_toolchain.setup_lexbuf true filename in let impl = Reason_toolchain.RE.implementation in +#if OCAML_VERSION >= (4,9,0) + Compmisc.init_path (); +#else Compmisc.init_path false; +#endif Env.set_unit_name modulename; let ast = impl lexbuf in diff --git a/src/reason-parser/dune b/src/reason-parser/dune index 9bac08533..6f5953e5f 100644 --- a/src/reason-parser/dune +++ b/src/reason-parser/dune @@ -5,13 +5,13 @@ (rule (targets lexer_warning.ml) - (deps ../generate/select.exe lexer_warning.ml-4.08 lexer_warning.ml-4.07 - lexer_warning.ml-4.06 lexer_warning.ml-default) + (deps ../generate/select.exe lexer_warning.ml-4.09 lexer_warning.ml-4.08 + lexer_warning.ml-4.07 lexer_warning.ml-4.06 lexer_warning.ml-default) (action (with-stdout-to %{targets} - (run ../generate/select.exe lexer_warning.ml-4.08 lexer_warning.ml-4.07 - lexer_warning.ml-4.06 lexer_warning.ml-default)))) + (run ../generate/select.exe lexer_warning.ml-4.09 lexer_warning.ml-4.08 + lexer_warning.ml-4.07 lexer_warning.ml-4.06 lexer_warning.ml-default)))) (rule (targets reason_string.ml) @@ -23,13 +23,13 @@ (rule (targets lexer_report_error.ml) - (deps ../generate/select.exe lexer_report_error.ml-4.08 - lexer_report_error.ml-default) + (deps ../generate/select.exe lexer_report_error.ml-4.09 + lexer_report_error.ml-4.08 lexer_report_error.ml-default) (action (with-stdout-to %{targets} - (run ../generate/select.exe lexer_report_error.ml-4.08 - lexer_report_error.ml-default)))) + (run ../generate/select.exe lexer_report_error.ml-4.09 + lexer_report_error.ml-4.08 lexer_report_error.ml-default)))) ; Update error messages based on new grammar ; Previously, called update_error in the `Makefile`. diff --git a/src/reason-parser/lexer_report_error.ml-4.09 b/src/reason-parser/lexer_report_error.ml-4.09 new file mode 100644 index 000000000..bc712f07f --- /dev/null +++ b/src/reason-parser/lexer_report_error.ml-4.09 @@ -0,0 +1,4 @@ +let report_error ppf ~loc err = + Format.fprintf ppf "@[%a@]@." + Location.print_report + (Location.error_of_printer ~loc Reason_lexer.format_error err) diff --git a/src/reason-parser/lexer_warning.ml-4.09 b/src/reason-parser/lexer_warning.ml-4.09 new file mode 100644 index 000000000..d76a07718 --- /dev/null +++ b/src/reason-parser/lexer_warning.ml-4.09 @@ -0,0 +1,3 @@ +let warn_latin1 lexbuf = + Location.deprecated (Location.curr lexbuf) "ISO-Latin1 characters in identifiers" +;;