Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reason V4 [Stack 3/n] [Parse Hashtags for polymorphic variants] #2614

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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:
  • Loading branch information
jordwalke committed Aug 17, 2020
commit b9d5ed44d8937392b1783e23c8b0433c68e13767
24 changes: 21 additions & 3 deletions docs/RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,32 @@ and `rtop.json` respectively in the repo root, you would run that script after
committing/bumping some versions:


**IMPORTANT: Update The Version Numbers In Packages:**
1. Make sure the version number in `esy.json` and `reason.json` is the new
version number for the release.
2. Make sure the file
[../../src/reason-version/reason_version.ml](../../src/reason-version/reason_version.ml)
also has that same version number that `refmt` has:

```sh
git checkout -b MYRELEASE origin/master
git rebase origin/master
vim -O esy.json reason.json
# Then edit the version number accordingly on BOTH files. With that same VERSION do:
version=3.5.0 make pre_release
vim -O esy.json reason.json src/reason-version/reason_version.ml

# Edit version field in jsons, and make sure reason_version has the new version
# let package_version = {
# major = 3;
# minor = 7;
# patch = 0;
# }

git commit -m "Bump version"
git push origin HEAD:PullRequestForVersion # Commit these version bumps

```

**Perform The Release:**
```sh
node ./scripts/esy-prepublish.js ./reason.json ./rtop.json

# Then publish. For example:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[@reason.version 3.7];
Some((1, 2, 3));

type bcd =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[@reason.version 3.7];
/* Pexp_letexception with attributes */
let () = {
[@attribute]
Expand Down
1 change: 1 addition & 0 deletions formatTest/typeCheckedTests/expected_output/attributes.re
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* This has a nice side effect when printing the terms:
* If a node has attributes attached to it,
*/;
[@reason.version 3.7];

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

Expand Down
2 changes: 2 additions & 0 deletions formatTest/typeCheckedTests/expected_output/attributes.rei
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */

/**Floating comment text should be removed*/;
[@reason.version 3.7];

let test: int;

/**
Expand Down
1 change: 1 addition & 0 deletions formatTest/typeCheckedTests/expected_output/basics.re
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[@reason.version 3.7];
/* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */

let l =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[@reason.version 3.7];
/* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */

let l =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[@reason.version 3.7];
/* https://github.com/facebook/reason/issues/2038 */
let my_big_array1 =
Bigarray.Array1.create(
Expand Down
2 changes: 2 additions & 0 deletions formatTest/typeCheckedTests/expected_output/comments.re
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* **** comment */
/*** comment */
/** docstring */;
[@reason.version 3.7];

/* comment */
/** docstring */;
/*** comment */
Expand Down
2 changes: 2 additions & 0 deletions formatTest/typeCheckedTests/expected_output/comments.rei
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
/***** comment */

/** */;
[@reason.version 3.7];

/*** */
/**** */

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* **** comment */
/*** comment */
/** docstring */;
[@reason.version 3.7];

/* comment */
/** docstring */;
/*** comment */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* **** comment */
/*** comment */
/** docstring */;
[@reason.version 3.7];

/* comment */
/** docstring */;
/*** comment */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* **** comment */
/*** comment */
/** docstring */;
[@reason.version 3.7];

/* comment */
/** docstring */;
/*** comment */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* **** comment */
/*** comment */
/** docstring */;
[@reason.version 3.7];

/* comment */
/** docstring */;
/*** comment */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[@reason.version 3.7];
module EM = {
/** Exception */

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[@reason.version 3.7];
open {
type t = string;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[@reason.version 3.7];
module X: {type t;};

module M := X;
Expand Down
1 change: 1 addition & 0 deletions formatTest/typeCheckedTests/expected_output/imperative.re
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[@reason.version 3.7];
/* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */

/*
Expand Down
1 change: 1 addition & 0 deletions formatTest/typeCheckedTests/expected_output/jsx.re
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[@reason.version 3.7];
type component = {displayName: string};

module Bar = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[@reason.version 3.7];
/* [x] fixed */
type t2 = (int, int); /* attributed to entire type not binding */

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[@reason.version 3.7];
/**
Issue 940: https://github.com/facebook/reason/issues/940
The parens in the exception match case with an alias,
Expand Down
1 change: 1 addition & 0 deletions formatTest/typeCheckedTests/expected_output/lazy.re
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[@reason.version 3.7];
let myComputation =
lazy({
let tmp = 10;
Expand Down
1 change: 1 addition & 0 deletions formatTest/typeCheckedTests/expected_output/letop.re
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[@reason.version 3.7];
let (let.opt) = (x, f) =>
switch (x) {
| None => None
Expand Down
1 change: 1 addition & 0 deletions formatTest/typeCheckedTests/expected_output/mlSyntax.re
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/**
* Testing pattern matching using ml syntax to exercise nesting of cases.
*/;
[@reason.version 3.7];

type xyz =
| X
Expand Down
1 change: 1 addition & 0 deletions formatTest/typeCheckedTests/expected_output/mlVariants.re
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[@reason.version 3.7];
/* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */

type polyVariantsInMl = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[@reason.version 3.7];
/* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */

type polyVariantsInMl = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[@reason.version 3.7];
/* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */

type polyVariantsInMl = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[@reason.version 3.7];
/* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */

type polyVariantsInMl = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[@reason.version 3.7];
/* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */

type polyVariantsInMl = [
Expand Down
1 change: 1 addition & 0 deletions formatTest/typeCheckedTests/expected_output/mutation.re
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[@reason.version 3.7];
/* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[@reason.version 3.7];
/* Oinherit (https://github.com/ocaml/ocaml/pull/1118) */
type t = {. a: string};

Expand Down
1 change: 1 addition & 0 deletions formatTest/typeCheckedTests/expected_output/oo.re
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[@reason.version 3.7];
/* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. */

class virtual stack ('a) (init) = {
Expand Down
Loading