-
Notifications
You must be signed in to change notification settings - Fork 429
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Support OCaml 4.09 * fix oprint for older versions
- Loading branch information
1 parent
31225fc
commit ba253a3
Showing
20 changed files
with
158 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
File "comments1.re", line 1, characters 0-2: | ||
1 | /* this is an unterminated comment | ||
^^ | ||
Error: Comment not terminated | ||
|
5 changes: 5 additions & 0 deletions
5
formatTest/errorTests/expected_output/lowercase_module.re.4.09.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
|
5 changes: 5 additions & 0 deletions
5
formatTest/errorTests/expected_output/lowercase_module_rec.re.4.09.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
|
5 changes: 5 additions & 0 deletions
5
formatTest/errorTests/expected_output/reservedField.re.4.09.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
5 changes: 5 additions & 0 deletions
5
formatTest/errorTests/expected_output/reservedRecord.re.4.09.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
5 changes: 5 additions & 0 deletions
5
formatTest/errorTests/expected_output/reservedRecordPunned.re.4.09.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
5 changes: 5 additions & 0 deletions
5
formatTest/errorTests/expected_output/reservedRecordType.re.4.09.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
5 changes: 5 additions & 0 deletions
5
formatTest/errorTests/expected_output/reservedRecordTypePunned.re.4.09.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
File "syntaxError.re", line 1, characters 9-10: | ||
1 | try (bad); | ||
^ | ||
Error: Syntax error | ||
|
39 changes: 39 additions & 0 deletions
39
formatTest/typeCheckedTests/expected_output/comments.rei.4.09.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* **** comment */ | ||
/*** comment */ | ||
/** docstring */; | ||
/* comment */ | ||
/** docstring */; | ||
/*** comment */ | ||
/**** comment */ | ||
/***** comment */ | ||
|
||
/** */; | ||
/*** */ | ||
/**** */ | ||
|
||
/***/ | ||
/****/ | ||
|
||
/** (** comment *) */; | ||
/** (*** comment *) */; | ||
|
||
/* (** comment *) */ | ||
/* (*** comment *) */ | ||
/* *(*** comment *) */ | ||
|
||
/* comment **/ | ||
/* comment ***/ | ||
/* comment ****/ | ||
/* comment *****/ | ||
|
||
/** | ||
* Multiline | ||
*/; | ||
|
||
/** Multiline | ||
* | ||
*/; | ||
|
||
/** | ||
** | ||
*/; |
27 changes: 27 additions & 0 deletions
27
formatTest/typeCheckedTests/expected_output/mlVariants.re.4.09.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
let warn_latin1 lexbuf = | ||
Location.deprecated (Location.curr lexbuf) "ISO-Latin1 characters in identifiers" | ||
;; |