Skip to content

Commit dab3565

Browse files
committed
Reason V4 [Stacked Diff 1/n #2605] [Allow multiple versions of Reason]
Summary:This allows multiple versions of Reason in a single project by inferring and recording the version of syntax used into the file in an attribute. The attribute allows us to switch the parser and lexer on the fly. This attribute is not the only way we can infer the version, and we can allow project level configuration, but this is the approach that is guaranteed to work with any build system or tooling. Test Plan: Reviewers: CC:
1 parent ba4bf31 commit dab3565

File tree

98 files changed

+1630
-678
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+1630
-678
lines changed

docs/RELEASING.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,32 @@ and `rtop.json` respectively in the repo root, you would run that script after
1616
committing/bumping some versions:
1717

1818

19+
**IMPORTANT: Update The Version Numbers In Packages:**
20+
1. Make sure the version number in `esy.json` and `reason.json` is the new
21+
version number for the release.
22+
2. Make sure the file
23+
[../../src/reason-version/reason_version.ml](../../src/reason-version/reason_version.ml)
24+
also has that same version number that `refmt` has:
25+
1926
```sh
2027
git checkout -b MYRELEASE origin/master
2128
git rebase origin/master
22-
vim -O esy.json reason.json
23-
# Then edit the version number accordingly on BOTH files. With that same VERSION do:
24-
version=3.5.0 make pre_release
29+
vim -O esy.json reason.json src/reason-version/reason_version.ml
30+
31+
# Edit version field in jsons, and make sure reason_version has the new version
32+
# let package_version = {
33+
# major = 3;
34+
# minor = 7;
35+
# patch = 0;
36+
# }
37+
2538
git commit -m "Bump version"
2639
git push origin HEAD:PullRequestForVersion # Commit these version bumps
40+
41+
```
42+
43+
**Perform The Release:**
44+
```sh
2745
node ./scripts/esy-prepublish.js ./reason.json ./rtop.json
2846

2947
# Then publish. For example:

formatTest/typeCheckedTests/expected_output/arityConversion.re

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[@reason.version 3.7];
12
Some((1, 2, 3));
23

34
type bcd =

formatTest/typeCheckedTests/expected_output/attributes.4.04.0.re

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[@reason.version 3.7];
12
/* Pexp_letexception with attributes */
23
let () = {
34
[@attribute]

formatTest/typeCheckedTests/expected_output/attributes.re

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* This has a nice side effect when printing the terms:
88
* If a node has attributes attached to it,
99
*/;
10+
[@reason.version 3.7];
1011

1112
/**Floating comment text should be removed*/;
1213

formatTest/typeCheckedTests/expected_output/attributes.rei

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */
22

33
/**Floating comment text should be removed*/;
4+
[@reason.version 3.7];
5+
46
let test: int;
57

68
/**

formatTest/typeCheckedTests/expected_output/basics.re

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[@reason.version 3.7];
12
/* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */
23

34
let l =

formatTest/typeCheckedTests/expected_output/basics_no_semi.re

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[@reason.version 3.7];
12
/* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */
23

34
let l =

formatTest/typeCheckedTests/expected_output/bigarraySyntax.re

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[@reason.version 3.7];
12
/* https://github.com/facebook/reason/issues/2038 */
23
let my_big_array1 =
34
Bigarray.Array1.create(

formatTest/typeCheckedTests/expected_output/comments.re

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/* **** comment */
22
/*** comment */
33
/** docstring */;
4+
[@reason.version 3.7];
5+
46
/* comment */
57
/** docstring */;
68
/*** comment */

formatTest/typeCheckedTests/expected_output/comments.rei

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
/***** comment */
99

1010
/** */;
11+
[@reason.version 3.7];
12+
1113
/*** */
1214
/**** */
1315

formatTest/typeCheckedTests/expected_output/comments.rei.4.07.0

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/* **** comment */
22
/*** comment */
33
/** docstring */;
4+
[@reason.version 3.7];
5+
46
/* comment */
57
/** docstring */;
68
/*** comment */

formatTest/typeCheckedTests/expected_output/comments.rei.4.07.1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/* **** comment */
22
/*** comment */
33
/** docstring */;
4+
[@reason.version 3.7];
5+
46
/* comment */
57
/** docstring */;
68
/*** comment */

formatTest/typeCheckedTests/expected_output/comments.rei.4.08.0

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/* **** comment */
22
/*** comment */
33
/** docstring */;
4+
[@reason.version 3.7];
5+
46
/* comment */
57
/** docstring */;
68
/*** comment */

formatTest/typeCheckedTests/expected_output/comments.rei.4.09.0

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/* **** comment */
22
/*** comment */
33
/** docstring */;
4+
[@reason.version 3.7];
5+
46
/* comment */
57
/** docstring */;
68
/*** comment */

formatTest/typeCheckedTests/expected_output/features406.4.06.0.re

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[@reason.version 3.7];
12
module EM = {
23
/** Exception */
34

formatTest/typeCheckedTests/expected_output/features408.4.08.0.re

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[@reason.version 3.7];
12
open {
23
type t = string;
34
};

formatTest/typeCheckedTests/expected_output/features408.4.08.0.rei

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[@reason.version 3.7];
12
module X: {type t;};
23

34
module M := X;

formatTest/typeCheckedTests/expected_output/imperative.re

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[@reason.version 3.7];
12
/* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */
23

34
/*

formatTest/typeCheckedTests/expected_output/jsx.re

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[@reason.version 3.7];
12
type component = {displayName: string};
23

34
module Bar = {

formatTest/typeCheckedTests/expected_output/knownMlIssues.re

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[@reason.version 3.7];
12
/* [x] fixed */
23
type t2 = (int, int); /* attributed to entire type not binding */
34

formatTest/typeCheckedTests/expected_output/knownReIssues.re

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[@reason.version 3.7];
12
/**
23
Issue 940: https://github.com/facebook/reason/issues/940
34
The parens in the exception match case with an alias,

formatTest/typeCheckedTests/expected_output/lazy.re

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[@reason.version 3.7];
12
let myComputation =
23
lazy({
34
let tmp = 10;

formatTest/typeCheckedTests/expected_output/letop.re

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[@reason.version 3.7];
12
let (let.opt) = (x, f) =>
23
switch (x) {
34
| None => None

formatTest/typeCheckedTests/expected_output/mlSyntax.re

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
/**
44
* Testing pattern matching using ml syntax to exercise nesting of cases.
55
*/;
6+
[@reason.version 3.7];
67

78
type xyz =
89
| X

formatTest/typeCheckedTests/expected_output/mlVariants.re

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[@reason.version 3.7];
12
/* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */
23

34
type polyVariantsInMl = [

formatTest/typeCheckedTests/expected_output/mlVariants.re.4.06.1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[@reason.version 3.7];
12
/* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */
23

34
type polyVariantsInMl = [

formatTest/typeCheckedTests/expected_output/mlVariants.re.4.07.1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[@reason.version 3.7];
12
/* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */
23

34
type polyVariantsInMl = [

formatTest/typeCheckedTests/expected_output/mlVariants.re.4.08.0

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[@reason.version 3.7];
12
/* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */
23

34
type polyVariantsInMl = [

formatTest/typeCheckedTests/expected_output/mlVariants.re.4.09.0

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[@reason.version 3.7];
12
/* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */
23

34
type polyVariantsInMl = [

formatTest/typeCheckedTests/expected_output/mutation.re

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[@reason.version 3.7];
12
/* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */
23

34
/**

formatTest/typeCheckedTests/expected_output/newAST.4.06.0.re

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[@reason.version 3.7];
12
/* Oinherit (https://github.com/ocaml/ocaml/pull/1118) */
23
type t = {. a: string};
34

formatTest/typeCheckedTests/expected_output/oo.re

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[@reason.version 3.7];
12
/* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */
23

34
class virtual stack ('a) (init) = {

0 commit comments

Comments
 (0)