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

Change #pattern to *pattern #581

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 9 additions & 0 deletions formatTest/typeCheckedTests/expected_output/mlVariants.re
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,12 @@ let sumThem =
| `StillAnIntTuple (a, b) => a + b;

type nonrec t = | A int | B bool;

type t2 = [ | `a | `b];

type u2 = [ t2 | `c];

let listPatternWithHash =
fun
| *t2 => 1
| `c => 2;
6 changes: 6 additions & 0 deletions formatTest/typeCheckedTests/input/mlVariants.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ let sumThem = function
| `StillAnIntTuple (a, b) -> a + b

type nonrec t = A of int | B of bool

type t2 = [ `a | `b ]
type u2 = [ t2 | `c ]
let listPatternWithHash = function
| #t2 -> 1
| `c -> 2
9 changes: 9 additions & 0 deletions formatTest/unit_tests/expected_output/variants.re
Original file line number Diff line number Diff line change
Expand Up @@ -473,3 +473,12 @@ let listPatternMayEvenIncludeAliases x =>
()
| _ => ()
};

type t = [ | `a | `b];

type u = [ t | `c];

let listPatternWithHash =
fun
| *t => 1
| `c => 2;
8 changes: 8 additions & 0 deletions formatTest/unit_tests/input/variants.re
Original file line number Diff line number Diff line change
Expand Up @@ -339,3 +339,11 @@ let listPatternMayEvenIncludeAliases x => switch x {
| [Blah x y as head, Foo a b as head2, ...Something x as tail] => ()
| _ => ()
};

type t = [ | `a | `b];
type u = [ t | `c];

let listPatternWithHash =
fun
| *t => 1
| `c => 2;
4,815 changes: 2,408 additions & 2,407 deletions src/reason_parser.messages

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/reason_parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -3339,7 +3339,7 @@ _simple_pattern_not_ident:
{ mkpat(Ppat_construct($1, None)) }
| name_tag
{ mkpat(Ppat_variant($1, None)) }
| SHARP as_loc(type_longident)
| STAR as_loc(type_longident)
{ mkpat(Ppat_type ($2)) }
| LBRACE lbl_pattern_list RBRACE
{ let (fields, closed) = $2 in mkpat(Ppat_record(fields, closed)) }
Expand Down
Loading