Skip to content

Commit

Permalink
Update flow tests and fix underscore being a reserved type
Browse files Browse the repository at this point in the history
  • Loading branch information
danez committed Nov 2, 2018
1 parent d35563e commit 97de67b
Show file tree
Hide file tree
Showing 6 changed files with 695 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Makefile
@@ -1,5 +1,5 @@
MAKEFLAGS = -j1
FLOW_COMMIT = bea8b83f50f597454941d2a7ecef6e93a881e576
FLOW_COMMIT = e192e1a4793dd8e43415fbfe8046d832cb513c8b
TEST262_COMMIT = 06c2f019019cf7850923de4d56828e6dfd9212b8

# Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967
Expand Down Expand Up @@ -82,7 +82,7 @@ test-ci-coverage:
bootstrap-flow:
rm -rf ./build/flow
mkdir -p ./build
git clone --branch=master --single-branch --shallow-since=2017-01-01 https://github.com/facebook/flow.git ./build/flow
git clone --branch=master --single-branch --shallow-since=2018-11-01 https://github.com/facebook/flow.git ./build/flow
cd build/flow && git checkout $(FLOW_COMMIT)

test-flow:
Expand Down
3 changes: 3 additions & 0 deletions packages/babel-parser/src/plugins/flow.js
Expand Up @@ -23,6 +23,9 @@ const primitiveTypes = [
"true",
"typeof",
"void",
"interface",
"extends",
"_",
];

function isEsModuleType(bodyElement: N.Node): boolean {
Expand Down
@@ -0,0 +1,8 @@
//@flow
test<
_,
_,
number,
_,
_,
>();
@@ -0,0 +1,283 @@
{
"type": "File",
"start": 0,
"end": 48,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 8,
"column": 4
}
},
"program": {
"type": "Program",
"start": 0,
"end": 48,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 8,
"column": 4
}
},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start": 8,
"end": 48,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 8,
"column": 4
}
},
"expression": {
"type": "CallExpression",
"start": 8,
"end": 47,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 8,
"column": 3
}
},
"callee": {
"type": "Identifier",
"start": 8,
"end": 12,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 4
},
"identifierName": "test"
},
"name": "test"
},
"typeArguments": {
"type": "TypeParameterInstantiation",
"start": 12,
"end": 45,
"loc": {
"start": {
"line": 2,
"column": 4
},
"end": {
"line": 8,
"column": 1
}
},
"params": [
{
"type": "GenericTypeAnnotation",
"start": 16,
"end": 17,
"loc": {
"start": {
"line": 3,
"column": 2
},
"end": {
"line": 3,
"column": 3
}
},
"typeParameters": null,
"id": {
"type": "Identifier",
"start": 16,
"end": 17,
"loc": {
"start": {
"line": 3,
"column": 2
},
"end": {
"line": 3,
"column": 3
},
"identifierName": "_"
},
"name": "_"
}
},
{
"type": "GenericTypeAnnotation",
"start": 21,
"end": 22,
"loc": {
"start": {
"line": 4,
"column": 2
},
"end": {
"line": 4,
"column": 3
}
},
"typeParameters": null,
"id": {
"type": "Identifier",
"start": 21,
"end": 22,
"loc": {
"start": {
"line": 4,
"column": 2
},
"end": {
"line": 4,
"column": 3
},
"identifierName": "_"
},
"name": "_"
}
},
{
"type": "NumberTypeAnnotation",
"start": 26,
"end": 32,
"loc": {
"start": {
"line": 5,
"column": 2
},
"end": {
"line": 5,
"column": 8
}
}
},
{
"type": "GenericTypeAnnotation",
"start": 36,
"end": 37,
"loc": {
"start": {
"line": 6,
"column": 2
},
"end": {
"line": 6,
"column": 3
}
},
"typeParameters": null,
"id": {
"type": "Identifier",
"start": 36,
"end": 37,
"loc": {
"start": {
"line": 6,
"column": 2
},
"end": {
"line": 6,
"column": 3
},
"identifierName": "_"
},
"name": "_"
}
},
{
"type": "GenericTypeAnnotation",
"start": 41,
"end": 42,
"loc": {
"start": {
"line": 7,
"column": 2
},
"end": {
"line": 7,
"column": 3
}
},
"typeParameters": null,
"id": {
"type": "Identifier",
"start": 41,
"end": 42,
"loc": {
"start": {
"line": 7,
"column": 2
},
"end": {
"line": 7,
"column": 3
},
"identifierName": "_"
},
"name": "_"
}
}
]
},
"arguments": []
},
"leadingComments": [
{
"type": "CommentLine",
"value": "@flow",
"start": 0,
"end": 7,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 7
}
}
}
]
}
],
"directives": []
},
"comments": [
{
"type": "CommentLine",
"value": "@flow",
"start": 0,
"end": 7,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 7
}
}
}
]
}
@@ -0,0 +1,2 @@
//@flow
test<number, _, string, _, _, _, Foo, Bar, Baz>();

0 comments on commit 97de67b

Please sign in to comment.