diff --git a/src/reason-parser/reason_parser.mly b/src/reason-parser/reason_parser.mly index f5b357302..b0dba5181 100644 --- a/src/reason-parser/reason_parser.mly +++ b/src/reason-parser/reason_parser.mly @@ -4646,6 +4646,7 @@ mark_position_typ { mktyp(Ptyp_constr($1, [])) } | object_record_type { $1 } + | LBRACKETBAR row_field_list RBRACKET | LBRACKET row_field_list RBRACKET { mktyp(Ptyp_variant ($2, Closed, None)) } | LBRACKETGREATER loption(row_field_list) RBRACKET diff --git a/test/variants.t/input.re b/test/variants.t/input.re index b3dccec37..a86a0391d 100644 --- a/test/variants.t/input.re +++ b/test/variants.t/input.re @@ -427,3 +427,11 @@ type widget_state = [ | `HOVER | `ACTIVE ]; + +/* [| purposely without space */ +type apiKeyError = [|`Dev |`Prod]; + +/* other polyvar variations */ +type apiKeyError = [ | `Dev |`Prod]; +type apiKeyError = [ `Dev |`Prod]; + diff --git a/test/variants.t/run.t b/test/variants.t/run.t index f5365b423..790e69d1f 100644 --- a/test/variants.t/run.t +++ b/test/variants.t/run.t @@ -699,6 +699,22 @@ Format variants | `HOVER | `ACTIVE ]; + + /* [| purposely without space */ + type apiKeyError = [ + | `Dev + | `Prod + ]; + + /* other polyvar variations */ + type apiKeyError = [ + | `Dev + | `Prod + ]; + type apiKeyError = [ + | `Dev + | `Prod + ]; /* Doesn't work because we've correctly annotated parse tree nodes with explicit_arity! */ /* let notTupled: notTupleVariant = NotActuallyATuple intTuple; /*Doesn't work! */ */ /* Doesn't work because we've correctly annotated parse tree nodes with explicit_arity! */