From 2bebe3606dbdd7cba1701cdd4212739dac74e9ef Mon Sep 17 00:00:00 2001 From: Max Schaefer Date: Tue, 26 Jul 2016 15:52:29 +0100 Subject: [PATCH] Fix accidental fall-through in Flow type parsing. When parsing a primary type, `>` would erroneously be treated like `(`. --- src/plugins/flow.js | 1 + test/fixtures/flow/type-annotations/106/actual.js | 1 + test/fixtures/flow/type-annotations/106/options.json | 3 +++ 3 files changed, 5 insertions(+) create mode 100644 test/fixtures/flow/type-annotations/106/actual.js create mode 100644 test/fixtures/flow/type-annotations/106/options.json diff --git a/src/plugins/flow.js b/src/plugins/flow.js index 7c85da6255..5a6fb4ad51 100644 --- a/src/plugins/flow.js +++ b/src/plugins/flow.js @@ -506,6 +506,7 @@ pp.flowParsePrimaryType = function () { return this.finishNode(node, "FunctionTypeAnnotation"); } + break; case tt.parenL: this.next(); diff --git a/test/fixtures/flow/type-annotations/106/actual.js b/test/fixtures/flow/type-annotations/106/actual.js new file mode 100644 index 0000000000..0a8290512d --- /dev/null +++ b/test/fixtures/flow/type-annotations/106/actual.js @@ -0,0 +1 @@ +var f: >x:int) => string; diff --git a/test/fixtures/flow/type-annotations/106/options.json b/test/fixtures/flow/type-annotations/106/options.json new file mode 100644 index 0000000000..c958665c03 --- /dev/null +++ b/test/fixtures/flow/type-annotations/106/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token (1:7)" +}