Flow opaque type aliases parsing (#643)
* Add support for Flow opaque type aliases * Add tests for Flow opaque type aliases
This commit is contained in:
1
test/fixtures/flow/opaque-type-alias/declare_opaque/actual.js
vendored
Normal file
1
test/fixtures/flow/opaque-type-alias/declare_opaque/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
declare opaque type ID = number;
|
||||
3
test/fixtures/flow/opaque-type-alias/declare_opaque/options.json
vendored
Normal file
3
test/fixtures/flow/opaque-type-alias/declare_opaque/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected ; (1:23)"
|
||||
}
|
||||
2
test/fixtures/flow/opaque-type-alias/opaque_collision/actual.js
vendored
Normal file
2
test/fixtures/flow/opaque-type-alias/opaque_collision/actual.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
opaque type opaque = number;
|
||||
opaque type not_transparent = opaque;
|
||||
150
test/fixtures/flow/opaque-type-alias/opaque_collision/expected.json
vendored
Normal file
150
test/fixtures/flow/opaque-type-alias/opaque_collision/expected.json
vendored
Normal file
@@ -0,0 +1,150 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 66,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 37
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 66,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 37
|
||||
}
|
||||
},
|
||||
"sourceType": "module",
|
||||
"body": [
|
||||
{
|
||||
"type": "OpaqueType",
|
||||
"start": 0,
|
||||
"end": 28,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 28
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 12,
|
||||
"end": 18,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 18
|
||||
},
|
||||
"identifierName": "opaque"
|
||||
},
|
||||
"name": "opaque"
|
||||
},
|
||||
"typeParameters": null,
|
||||
"supertype": null,
|
||||
"impltype": {
|
||||
"type": "NumberTypeAnnotation",
|
||||
"start": 21,
|
||||
"end": 27,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 21
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 27
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "OpaqueType",
|
||||
"start": 29,
|
||||
"end": 66,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 37
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 41,
|
||||
"end": 56,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 27
|
||||
},
|
||||
"identifierName": "not_transparent"
|
||||
},
|
||||
"name": "not_transparent"
|
||||
},
|
||||
"typeParameters": null,
|
||||
"supertype": null,
|
||||
"impltype": {
|
||||
"type": "GenericTypeAnnotation",
|
||||
"start": 59,
|
||||
"end": 65,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 30
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 36
|
||||
}
|
||||
},
|
||||
"typeParameters": null,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 59,
|
||||
"end": 65,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 30
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 36
|
||||
},
|
||||
"identifierName": "opaque"
|
||||
},
|
||||
"name": "opaque"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
1
test/fixtures/flow/opaque-type-alias/opaque_declare_export_neither/actual.js
vendored
Normal file
1
test/fixtures/flow/opaque-type-alias/opaque_declare_export_neither/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
declare export opaque type Foo
|
||||
85
test/fixtures/flow/opaque-type-alias/opaque_declare_export_neither/expected.json
vendored
Normal file
85
test/fixtures/flow/opaque-type-alias/opaque_declare_export_neither/expected.json
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 30,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 30
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 30,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 30
|
||||
}
|
||||
},
|
||||
"sourceType": "module",
|
||||
"body": [
|
||||
{
|
||||
"type": "DeclareExportDeclaration",
|
||||
"start": 0,
|
||||
"end": 30,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 30
|
||||
}
|
||||
},
|
||||
"declaration": {
|
||||
"type": "DeclareOpaqueType",
|
||||
"start": 15,
|
||||
"end": 30,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 15
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 30
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 27,
|
||||
"end": 30,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 27
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 30
|
||||
},
|
||||
"identifierName": "Foo"
|
||||
},
|
||||
"name": "Foo"
|
||||
},
|
||||
"typeParameters": null,
|
||||
"supertype": null,
|
||||
"impltype": null
|
||||
},
|
||||
"default": false
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
1
test/fixtures/flow/opaque-type-alias/opaque_declare_export_st_no_t/actual.js
vendored
Normal file
1
test/fixtures/flow/opaque-type-alias/opaque_declare_export_st_no_t/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
declare export opaque type Foo: Bar
|
||||
117
test/fixtures/flow/opaque-type-alias/opaque_declare_export_st_no_t/expected.json
vendored
Normal file
117
test/fixtures/flow/opaque-type-alias/opaque_declare_export_st_no_t/expected.json
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 35,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 35
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 35,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 35
|
||||
}
|
||||
},
|
||||
"sourceType": "module",
|
||||
"body": [
|
||||
{
|
||||
"type": "DeclareExportDeclaration",
|
||||
"start": 0,
|
||||
"end": 35,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 35
|
||||
}
|
||||
},
|
||||
"declaration": {
|
||||
"type": "DeclareOpaqueType",
|
||||
"start": 15,
|
||||
"end": 35,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 15
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 35
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 27,
|
||||
"end": 30,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 27
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 30
|
||||
},
|
||||
"identifierName": "Foo"
|
||||
},
|
||||
"name": "Foo"
|
||||
},
|
||||
"typeParameters": null,
|
||||
"supertype": {
|
||||
"type": "GenericTypeAnnotation",
|
||||
"start": 32,
|
||||
"end": 35,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 32
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 35
|
||||
}
|
||||
},
|
||||
"typeParameters": null,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 32,
|
||||
"end": 35,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 32
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 35
|
||||
},
|
||||
"identifierName": "Bar"
|
||||
},
|
||||
"name": "Bar"
|
||||
}
|
||||
},
|
||||
"impltype": null
|
||||
},
|
||||
"default": false
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
1
test/fixtures/flow/opaque-type-alias/opaque_declare_export_t_and_st/actual.js
vendored
Normal file
1
test/fixtures/flow/opaque-type-alias/opaque_declare_export_t_and_st/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
declare export opaque type Foo: Bar = Baz
|
||||
3
test/fixtures/flow/opaque-type-alias/opaque_declare_export_t_and_st/options.json
vendored
Normal file
3
test/fixtures/flow/opaque-type-alias/opaque_declare_export_t_and_st/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected ; (1:36)"
|
||||
}
|
||||
1
test/fixtures/flow/opaque-type-alias/opaque_declare_export_t_no_st/actual.js
vendored
Normal file
1
test/fixtures/flow/opaque-type-alias/opaque_declare_export_t_no_st/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
declare export opaque type Foo = Bar
|
||||
3
test/fixtures/flow/opaque-type-alias/opaque_declare_export_t_no_st/options.json
vendored
Normal file
3
test/fixtures/flow/opaque-type-alias/opaque_declare_export_t_no_st/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected ; (1:31)"
|
||||
}
|
||||
1
test/fixtures/flow/opaque-type-alias/opaque_declare_neither/actual.js
vendored
Normal file
1
test/fixtures/flow/opaque-type-alias/opaque_declare_neither/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
declare opaque type Foo
|
||||
69
test/fixtures/flow/opaque-type-alias/opaque_declare_neither/expected.json
vendored
Normal file
69
test/fixtures/flow/opaque-type-alias/opaque_declare_neither/expected.json
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 23,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 23
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 23,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 23
|
||||
}
|
||||
},
|
||||
"sourceType": "module",
|
||||
"body": [
|
||||
{
|
||||
"type": "DeclareOpaqueType",
|
||||
"start": 0,
|
||||
"end": 23,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 23
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 20,
|
||||
"end": 23,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 20
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 23
|
||||
},
|
||||
"identifierName": "Foo"
|
||||
},
|
||||
"name": "Foo"
|
||||
},
|
||||
"typeParameters": null,
|
||||
"supertype": null,
|
||||
"impltype": null
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
1
test/fixtures/flow/opaque-type-alias/opaque_declare_st_no_t/actual.js
vendored
Normal file
1
test/fixtures/flow/opaque-type-alias/opaque_declare_st_no_t/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
declare opaque type Test: Foo
|
||||
101
test/fixtures/flow/opaque-type-alias/opaque_declare_st_no_t/expected.json
vendored
Normal file
101
test/fixtures/flow/opaque-type-alias/opaque_declare_st_no_t/expected.json
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 29,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 29
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 29,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 29
|
||||
}
|
||||
},
|
||||
"sourceType": "module",
|
||||
"body": [
|
||||
{
|
||||
"type": "DeclareOpaqueType",
|
||||
"start": 0,
|
||||
"end": 29,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 29
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 20,
|
||||
"end": 24,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 20
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 24
|
||||
},
|
||||
"identifierName": "Test"
|
||||
},
|
||||
"name": "Test"
|
||||
},
|
||||
"typeParameters": null,
|
||||
"supertype": {
|
||||
"type": "GenericTypeAnnotation",
|
||||
"start": 26,
|
||||
"end": 29,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 26
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 29
|
||||
}
|
||||
},
|
||||
"typeParameters": null,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 26,
|
||||
"end": 29,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 26
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 29
|
||||
},
|
||||
"identifierName": "Foo"
|
||||
},
|
||||
"name": "Foo"
|
||||
}
|
||||
},
|
||||
"impltype": null
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
1
test/fixtures/flow/opaque-type-alias/opaque_declare_t_and_st/actual.js
vendored
Normal file
1
test/fixtures/flow/opaque-type-alias/opaque_declare_t_and_st/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
declare opaque type Foo: Bar = Baz
|
||||
3
test/fixtures/flow/opaque-type-alias/opaque_declare_t_and_st/options.json
vendored
Normal file
3
test/fixtures/flow/opaque-type-alias/opaque_declare_t_and_st/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected ; (1:29)"
|
||||
}
|
||||
1
test/fixtures/flow/opaque-type-alias/opaque_declare_t_no_st/actual.js
vendored
Normal file
1
test/fixtures/flow/opaque-type-alias/opaque_declare_t_no_st/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
declare opaque type Foo = Bar
|
||||
3
test/fixtures/flow/opaque-type-alias/opaque_declare_t_no_st/options.json
vendored
Normal file
3
test/fixtures/flow/opaque-type-alias/opaque_declare_t_no_st/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected ; (1:24)"
|
||||
}
|
||||
2
test/fixtures/flow/opaque-type-alias/opaque_in_exp/actual.js
vendored
Normal file
2
test/fixtures/flow/opaque-type-alias/opaque_in_exp/actual.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
var opaque = 0;
|
||||
opaque += 4;
|
||||
172
test/fixtures/flow/opaque-type-alias/opaque_in_exp/expected.json
vendored
Normal file
172
test/fixtures/flow/opaque-type-alias/opaque_in_exp/expected.json
vendored
Normal file
@@ -0,0 +1,172 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 28,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 12
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 28,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 12
|
||||
}
|
||||
},
|
||||
"sourceType": "module",
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start": 0,
|
||||
"end": 15,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 4,
|
||||
"end": 14,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 14
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 4,
|
||||
"end": 10,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 10
|
||||
},
|
||||
"identifierName": "opaque"
|
||||
},
|
||||
"name": "opaque"
|
||||
},
|
||||
"init": {
|
||||
"type": "NumericLiteral",
|
||||
"start": 13,
|
||||
"end": 14,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 13
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 14
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 0,
|
||||
"raw": "0"
|
||||
},
|
||||
"value": 0
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "var"
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 16,
|
||||
"end": 28,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 12
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "AssignmentExpression",
|
||||
"start": 16,
|
||||
"end": 27,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 11
|
||||
}
|
||||
},
|
||||
"operator": "+=",
|
||||
"left": {
|
||||
"type": "Identifier",
|
||||
"start": 16,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 6
|
||||
},
|
||||
"identifierName": "opaque"
|
||||
},
|
||||
"name": "opaque"
|
||||
},
|
||||
"right": {
|
||||
"type": "NumericLiteral",
|
||||
"start": 26,
|
||||
"end": 27,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 10
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 11
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 4,
|
||||
"raw": "4"
|
||||
},
|
||||
"value": 4
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
1
test/fixtures/flow/opaque-type-alias/opaque_in_func/actual.js
vendored
Normal file
1
test/fixtures/flow/opaque-type-alias/opaque_in_func/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
opaque(0);
|
||||
103
test/fixtures/flow/opaque-type-alias/opaque_in_func/expected.json
vendored
Normal file
103
test/fixtures/flow/opaque-type-alias/opaque_in_func/expected.json
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 10,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 10
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 10,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 10
|
||||
}
|
||||
},
|
||||
"sourceType": "module",
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 0,
|
||||
"end": 10,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 10
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "CallExpression",
|
||||
"start": 0,
|
||||
"end": 9,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 9
|
||||
}
|
||||
},
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 0,
|
||||
"end": 6,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 6
|
||||
},
|
||||
"identifierName": "opaque"
|
||||
},
|
||||
"name": "opaque"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "NumericLiteral",
|
||||
"start": 7,
|
||||
"end": 8,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 7
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 8
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 0,
|
||||
"raw": "0"
|
||||
},
|
||||
"value": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
1
test/fixtures/flow/opaque-type-alias/opaque_invalid1/actual.js
vendored
Normal file
1
test/fixtures/flow/opaque-type-alias/opaque_invalid1/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export opaque potato ID = number;
|
||||
3
test/fixtures/flow/opaque-type-alias/opaque_invalid1/options.json
vendored
Normal file
3
test/fixtures/flow/opaque-type-alias/opaque_invalid1/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token (1:14)"
|
||||
}
|
||||
1
test/fixtures/flow/opaque-type-alias/opaque_invalid2/actual.js
vendored
Normal file
1
test/fixtures/flow/opaque-type-alias/opaque_invalid2/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
opaque potato ID = number;
|
||||
3
test/fixtures/flow/opaque-type-alias/opaque_invalid2/options.json
vendored
Normal file
3
test/fixtures/flow/opaque-type-alias/opaque_invalid2/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token (1:7)"
|
||||
}
|
||||
1
test/fixtures/flow/opaque-type-alias/opaque_invalid_decl1/actual.js
vendored
Normal file
1
test/fixtures/flow/opaque-type-alias/opaque_invalid_decl1/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
declare export opaque = potato;
|
||||
3
test/fixtures/flow/opaque-type-alias/opaque_invalid_decl1/options.json
vendored
Normal file
3
test/fixtures/flow/opaque-type-alias/opaque_invalid_decl1/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token (1:22)"
|
||||
}
|
||||
1
test/fixtures/flow/opaque-type-alias/opaque_invalid_decl2/actual.js
vendored
Normal file
1
test/fixtures/flow/opaque-type-alias/opaque_invalid_decl2/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
declare export opaque type ID = number;
|
||||
3
test/fixtures/flow/opaque-type-alias/opaque_invalid_decl2/options.json
vendored
Normal file
3
test/fixtures/flow/opaque-type-alias/opaque_invalid_decl2/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected ; (1:30)"
|
||||
}
|
||||
1
test/fixtures/flow/opaque-type-alias/opaque_invalid_decl3/actual.js
vendored
Normal file
1
test/fixtures/flow/opaque-type-alias/opaque_invalid_decl3/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
declare export opaque potato ID = number;
|
||||
3
test/fixtures/flow/opaque-type-alias/opaque_invalid_decl3/options.json
vendored
Normal file
3
test/fixtures/flow/opaque-type-alias/opaque_invalid_decl3/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token (1:22)"
|
||||
}
|
||||
1
test/fixtures/flow/opaque-type-alias/opaque_subtype/actual.js
vendored
Normal file
1
test/fixtures/flow/opaque-type-alias/opaque_subtype/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
opaque type Counter: Box<T> = Container<T>;
|
||||
231
test/fixtures/flow/opaque-type-alias/opaque_subtype/expected.json
vendored
Normal file
231
test/fixtures/flow/opaque-type-alias/opaque_subtype/expected.json
vendored
Normal file
@@ -0,0 +1,231 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 43,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 43
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 43,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 43
|
||||
}
|
||||
},
|
||||
"sourceType": "module",
|
||||
"body": [
|
||||
{
|
||||
"type": "OpaqueType",
|
||||
"start": 0,
|
||||
"end": 43,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 43
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 12,
|
||||
"end": 19,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 19
|
||||
},
|
||||
"identifierName": "Counter"
|
||||
},
|
||||
"name": "Counter"
|
||||
},
|
||||
"typeParameters": null,
|
||||
"supertype": {
|
||||
"type": "GenericTypeAnnotation",
|
||||
"start": 21,
|
||||
"end": 27,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 21
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 27
|
||||
}
|
||||
},
|
||||
"typeParameters": {
|
||||
"type": "TypeParameterInstantiation",
|
||||
"start": 24,
|
||||
"end": 27,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 24
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 27
|
||||
}
|
||||
},
|
||||
"params": [
|
||||
{
|
||||
"type": "GenericTypeAnnotation",
|
||||
"start": 25,
|
||||
"end": 26,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 25
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 26
|
||||
}
|
||||
},
|
||||
"typeParameters": null,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 25,
|
||||
"end": 26,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 25
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 26
|
||||
},
|
||||
"identifierName": "T"
|
||||
},
|
||||
"name": "T"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 21,
|
||||
"end": 24,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 21
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 24
|
||||
},
|
||||
"identifierName": "Box"
|
||||
},
|
||||
"name": "Box"
|
||||
}
|
||||
},
|
||||
"impltype": {
|
||||
"type": "GenericTypeAnnotation",
|
||||
"start": 30,
|
||||
"end": 42,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 30
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 42
|
||||
}
|
||||
},
|
||||
"typeParameters": {
|
||||
"type": "TypeParameterInstantiation",
|
||||
"start": 39,
|
||||
"end": 42,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 39
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 42
|
||||
}
|
||||
},
|
||||
"params": [
|
||||
{
|
||||
"type": "GenericTypeAnnotation",
|
||||
"start": 40,
|
||||
"end": 41,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 40
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 41
|
||||
}
|
||||
},
|
||||
"typeParameters": null,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 40,
|
||||
"end": 41,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 40
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 41
|
||||
},
|
||||
"identifierName": "T"
|
||||
},
|
||||
"name": "T"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 30,
|
||||
"end": 39,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 30
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 39
|
||||
},
|
||||
"identifierName": "Container"
|
||||
},
|
||||
"name": "Container"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
3
test/fixtures/flow/opaque-type-alias/opaque_subtype_allow_export/actual.js
vendored
Normal file
3
test/fixtures/flow/opaque-type-alias/opaque_subtype_allow_export/actual.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
declare module 'foo' {
|
||||
declare export opaque type MyType: number = string;
|
||||
}
|
||||
3
test/fixtures/flow/opaque-type-alias/opaque_subtype_allow_export/options.json
vendored
Normal file
3
test/fixtures/flow/opaque-type-alias/opaque_subtype_allow_export/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected ; (2:44)"
|
||||
}
|
||||
1
test/fixtures/flow/opaque-type-alias/opaque_subtype_export/actual.js
vendored
Normal file
1
test/fixtures/flow/opaque-type-alias/opaque_subtype_export/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export opaque type Counter: Box<T> = Container<S>;
|
||||
249
test/fixtures/flow/opaque-type-alias/opaque_subtype_export/expected.json
vendored
Normal file
249
test/fixtures/flow/opaque-type-alias/opaque_subtype_export/expected.json
vendored
Normal file
@@ -0,0 +1,249 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 50,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 50
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 50,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 50
|
||||
}
|
||||
},
|
||||
"sourceType": "module",
|
||||
"body": [
|
||||
{
|
||||
"type": "ExportNamedDeclaration",
|
||||
"start": 0,
|
||||
"end": 50,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 50
|
||||
}
|
||||
},
|
||||
"specifiers": [],
|
||||
"source": null,
|
||||
"exportKind": "type",
|
||||
"declaration": {
|
||||
"type": "OpaqueType",
|
||||
"start": 7,
|
||||
"end": 50,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 7
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 50
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 19,
|
||||
"end": 26,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 19
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 26
|
||||
},
|
||||
"identifierName": "Counter"
|
||||
},
|
||||
"name": "Counter"
|
||||
},
|
||||
"typeParameters": null,
|
||||
"supertype": {
|
||||
"type": "GenericTypeAnnotation",
|
||||
"start": 28,
|
||||
"end": 34,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 28
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 34
|
||||
}
|
||||
},
|
||||
"typeParameters": {
|
||||
"type": "TypeParameterInstantiation",
|
||||
"start": 31,
|
||||
"end": 34,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 31
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 34
|
||||
}
|
||||
},
|
||||
"params": [
|
||||
{
|
||||
"type": "GenericTypeAnnotation",
|
||||
"start": 32,
|
||||
"end": 33,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 32
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 33
|
||||
}
|
||||
},
|
||||
"typeParameters": null,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 32,
|
||||
"end": 33,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 32
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 33
|
||||
},
|
||||
"identifierName": "T"
|
||||
},
|
||||
"name": "T"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 28,
|
||||
"end": 31,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 28
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 31
|
||||
},
|
||||
"identifierName": "Box"
|
||||
},
|
||||
"name": "Box"
|
||||
}
|
||||
},
|
||||
"impltype": {
|
||||
"type": "GenericTypeAnnotation",
|
||||
"start": 37,
|
||||
"end": 49,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 37
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 49
|
||||
}
|
||||
},
|
||||
"typeParameters": {
|
||||
"type": "TypeParameterInstantiation",
|
||||
"start": 46,
|
||||
"end": 49,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 46
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 49
|
||||
}
|
||||
},
|
||||
"params": [
|
||||
{
|
||||
"type": "GenericTypeAnnotation",
|
||||
"start": 47,
|
||||
"end": 48,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 47
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 48
|
||||
}
|
||||
},
|
||||
"typeParameters": null,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 47,
|
||||
"end": 48,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 47
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 48
|
||||
},
|
||||
"identifierName": "S"
|
||||
},
|
||||
"name": "S"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 37,
|
||||
"end": 46,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 37
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 46
|
||||
},
|
||||
"identifierName": "Container"
|
||||
},
|
||||
"name": "Container"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
1
test/fixtures/flow/opaque-type-alias/opaque_subtype_invalid1/actual.js
vendored
Normal file
1
test/fixtures/flow/opaque-type-alias/opaque_subtype_invalid1/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
opaque Ident: Type = SuperType;
|
||||
3
test/fixtures/flow/opaque-type-alias/opaque_subtype_invalid1/options.json
vendored
Normal file
3
test/fixtures/flow/opaque-type-alias/opaque_subtype_invalid1/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token (1:7)"
|
||||
}
|
||||
1
test/fixtures/flow/opaque-type-alias/opaque_subtype_invalid2/actual.js
vendored
Normal file
1
test/fixtures/flow/opaque-type-alias/opaque_subtype_invalid2/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export opaque potato: ID = number;
|
||||
3
test/fixtures/flow/opaque-type-alias/opaque_subtype_invalid2/options.json
vendored
Normal file
3
test/fixtures/flow/opaque-type-alias/opaque_subtype_invalid2/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token (1:14)"
|
||||
}
|
||||
1
test/fixtures/flow/opaque-type-alias/opaque_subtype_invalid3/actual.js
vendored
Normal file
1
test/fixtures/flow/opaque-type-alias/opaque_subtype_invalid3/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
opaque stuff: Box<T> = Container<T>
|
||||
3
test/fixtures/flow/opaque-type-alias/opaque_subtype_invalid3/options.json
vendored
Normal file
3
test/fixtures/flow/opaque-type-alias/opaque_subtype_invalid3/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token (1:7)"
|
||||
}
|
||||
1
test/fixtures/flow/opaque-type-alias/opaque_type/actual.js
vendored
Normal file
1
test/fixtures/flow/opaque-type-alias/opaque_type/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
opaque type ID = number;
|
||||
83
test/fixtures/flow/opaque-type-alias/opaque_type/expected.json
vendored
Normal file
83
test/fixtures/flow/opaque-type-alias/opaque_type/expected.json
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 24,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 24
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 24,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 24
|
||||
}
|
||||
},
|
||||
"sourceType": "module",
|
||||
"body": [
|
||||
{
|
||||
"type": "OpaqueType",
|
||||
"start": 0,
|
||||
"end": 24,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 24
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 12,
|
||||
"end": 14,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 14
|
||||
},
|
||||
"identifierName": "ID"
|
||||
},
|
||||
"name": "ID"
|
||||
},
|
||||
"typeParameters": null,
|
||||
"supertype": null,
|
||||
"impltype": {
|
||||
"type": "NumberTypeAnnotation",
|
||||
"start": 17,
|
||||
"end": 23,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 17
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 23
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
3
test/fixtures/flow/opaque-type-alias/opaque_type_allow_export/actual.js
vendored
Normal file
3
test/fixtures/flow/opaque-type-alias/opaque_type_allow_export/actual.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
declare module 'foo' {
|
||||
declare export opaque type MyType = string;
|
||||
}
|
||||
3
test/fixtures/flow/opaque-type-alias/opaque_type_allow_export/options.json
vendored
Normal file
3
test/fixtures/flow/opaque-type-alias/opaque_type_allow_export/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected ; (2:36)"
|
||||
}
|
||||
1
test/fixtures/flow/opaque-type-alias/opaque_type_export/actual.js
vendored
Normal file
1
test/fixtures/flow/opaque-type-alias/opaque_type_export/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export opaque type ID = number;
|
||||
101
test/fixtures/flow/opaque-type-alias/opaque_type_export/expected.json
vendored
Normal file
101
test/fixtures/flow/opaque-type-alias/opaque_type_export/expected.json
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 31,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 31
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 31,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 31
|
||||
}
|
||||
},
|
||||
"sourceType": "module",
|
||||
"body": [
|
||||
{
|
||||
"type": "ExportNamedDeclaration",
|
||||
"start": 0,
|
||||
"end": 31,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 31
|
||||
}
|
||||
},
|
||||
"specifiers": [],
|
||||
"source": null,
|
||||
"exportKind": "type",
|
||||
"declaration": {
|
||||
"type": "OpaqueType",
|
||||
"start": 7,
|
||||
"end": 31,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 7
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 31
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 19,
|
||||
"end": 21,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 19
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 21
|
||||
},
|
||||
"identifierName": "ID"
|
||||
},
|
||||
"name": "ID"
|
||||
},
|
||||
"typeParameters": null,
|
||||
"supertype": null,
|
||||
"impltype": {
|
||||
"type": "NumberTypeAnnotation",
|
||||
"start": 24,
|
||||
"end": 30,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 24
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 30
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user