From 26809e8ce7d6d0e79db919577d84ed62ac100f5b Mon Sep 17 00:00:00 2001 From: Sam Goldman Date: Fri, 14 Oct 2016 14:13:27 -0700 Subject: [PATCH] Property variance type annotations for Flow plugin (#161) * Property variance type annotations for Flow plugin Non-method properties and indexers of object types, declare class, and interfaces can be "positive" or "negative." Class fields, but again not methods, can also have variance. This PR generalizes the variance annotations for type parameters into a new node type, and reuses that node for those properties. The code for object types is reused for interfaces and declare classes. The changes there are straightfoward. The code for class fields is reused for object literals, which do not support variance annotations (currently). This code is a bit sketchy, because we always parse variance annotations in the `parsePropertyName` extension, then error in a the subsequent parse phase for object literals (`parseObjPropValue`) or class methods (`parseClassMethod`). * Remove bogus unreachable code, clarify variance parsing conditional * Don't use a new node type for variance annotations Adding a new node type, specifically changing the TypeParameter node's variance property to be node-valued, is a breaking change. We might choose to make this breaking change in a later version. * s/start/variancePos --- src/plugins/flow.js | 61 ++++-- .../flow/call-properties/3/expected.json | 3 +- .../flow/declare-statements/10/expected.json | 3 +- .../flow/declare-statements/11/expected.json | 3 +- .../flow/declare-statements/14/expected.json | 3 +- .../flow/declare-statements/15/expected.json | 6 +- .../flow/declare-statements/17/expected.json | 9 +- .../flow/declare-statements/9/expected.json | 3 +- .../flow/def-site-variance/1/expected.json | 2 +- .../4/expected.json | 3 +- .../5/expected.json | 6 +- test/fixtures/flow/type-alias/4/expected.json | 6 +- .../flow/type-annotations/108/expected.json | 36 ++-- .../flow/type-annotations/110/actual.js | 1 + .../flow/type-annotations/110/expected.json | 155 +++++++++++++++ .../flow/type-annotations/111/actual.js | 1 + .../flow/type-annotations/111/expected.json | 155 +++++++++++++++ .../flow/type-annotations/112/actual.js | 1 + .../flow/type-annotations/112/options.json | 3 + .../flow/type-annotations/113/actual.js | 2 + .../flow/type-annotations/113/options.json | 3 + .../flow/type-annotations/114/actual.js | 1 + .../flow/type-annotations/114/expected.json | 187 ++++++++++++++++++ .../flow/type-annotations/115/actual.js | 1 + .../flow/type-annotations/115/expected.json | 187 ++++++++++++++++++ .../flow/type-annotations/116/actual.js | 1 + .../flow/type-annotations/116/options.json | 3 + .../flow/type-annotations/117/actual.js | 1 + .../flow/type-annotations/117/options.json | 3 + .../flow/type-annotations/118/actual.js | 1 + .../flow/type-annotations/118/expected.json | 168 ++++++++++++++++ .../flow/type-annotations/119/actual.js | 1 + .../flow/type-annotations/119/expected.json | 168 ++++++++++++++++ .../flow/type-annotations/120/actual.js | 1 + .../flow/type-annotations/120/options.json | 3 + .../flow/type-annotations/121/actual.js | 1 + .../flow/type-annotations/121/options.json | 3 + .../flow/type-annotations/122/actual.js | 1 + .../flow/type-annotations/122/options.json | 3 + .../flow/type-annotations/123/actual.js | 1 + .../flow/type-annotations/123/options.json | 3 + .../flow/type-annotations/124/actual.js | 1 + .../flow/type-annotations/124/options.json | 3 + .../flow/type-annotations/125/actual.js | 1 + .../flow/type-annotations/125/options.json | 3 + .../flow/type-annotations/126/actual.js | 1 + .../flow/type-annotations/126/options.json | 3 + .../flow/type-annotations/32/expected.json | 3 +- .../flow/type-annotations/33/expected.json | 3 +- .../flow/type-annotations/34/expected.json | 6 +- .../flow/type-annotations/35/expected.json | 3 +- .../flow/type-annotations/36/expected.json | 6 +- .../flow/type-annotations/37/expected.json | 6 +- .../flow/type-annotations/38/expected.json | 6 +- .../flow/type-annotations/39/expected.json | 6 +- .../flow/type-annotations/40/expected.json | 6 +- .../flow/type-annotations/41/expected.json | 3 +- .../flow/type-annotations/60/expected.json | 3 +- .../flow/type-annotations/61/expected.json | 3 +- .../flow/type-annotations/63/expected.json | 3 +- .../flow/type-annotations/98/expected.json | 9 +- .../flow/type-exports/interface/expected.json | 6 +- test/fixtures/flow/typecasts/2/expected.json | 6 +- 63 files changed, 1228 insertions(+), 65 deletions(-) create mode 100644 test/fixtures/flow/type-annotations/110/actual.js create mode 100644 test/fixtures/flow/type-annotations/110/expected.json create mode 100644 test/fixtures/flow/type-annotations/111/actual.js create mode 100644 test/fixtures/flow/type-annotations/111/expected.json create mode 100644 test/fixtures/flow/type-annotations/112/actual.js create mode 100644 test/fixtures/flow/type-annotations/112/options.json create mode 100644 test/fixtures/flow/type-annotations/113/actual.js create mode 100644 test/fixtures/flow/type-annotations/113/options.json create mode 100644 test/fixtures/flow/type-annotations/114/actual.js create mode 100644 test/fixtures/flow/type-annotations/114/expected.json create mode 100644 test/fixtures/flow/type-annotations/115/actual.js create mode 100644 test/fixtures/flow/type-annotations/115/expected.json create mode 100644 test/fixtures/flow/type-annotations/116/actual.js create mode 100644 test/fixtures/flow/type-annotations/116/options.json create mode 100644 test/fixtures/flow/type-annotations/117/actual.js create mode 100644 test/fixtures/flow/type-annotations/117/options.json create mode 100644 test/fixtures/flow/type-annotations/118/actual.js create mode 100644 test/fixtures/flow/type-annotations/118/expected.json create mode 100644 test/fixtures/flow/type-annotations/119/actual.js create mode 100644 test/fixtures/flow/type-annotations/119/expected.json create mode 100644 test/fixtures/flow/type-annotations/120/actual.js create mode 100644 test/fixtures/flow/type-annotations/120/options.json create mode 100644 test/fixtures/flow/type-annotations/121/actual.js create mode 100644 test/fixtures/flow/type-annotations/121/options.json create mode 100644 test/fixtures/flow/type-annotations/122/actual.js create mode 100644 test/fixtures/flow/type-annotations/122/options.json create mode 100644 test/fixtures/flow/type-annotations/123/actual.js create mode 100644 test/fixtures/flow/type-annotations/123/options.json create mode 100644 test/fixtures/flow/type-annotations/124/actual.js create mode 100644 test/fixtures/flow/type-annotations/124/options.json create mode 100644 test/fixtures/flow/type-annotations/125/actual.js create mode 100644 test/fixtures/flow/type-annotations/125/options.json create mode 100644 test/fixtures/flow/type-annotations/126/actual.js create mode 100644 test/fixtures/flow/type-annotations/126/options.json diff --git a/src/plugins/flow.js b/src/plugins/flow.js index 327f7913f7..50d48b5eb2 100644 --- a/src/plugins/flow.js +++ b/src/plugins/flow.js @@ -205,15 +205,7 @@ pp.flowParseTypeAlias = function (node) { pp.flowParseTypeParameter = function () { let node = this.startNode(); - let variance; - if (this.match(tt.plusMin)) { - if (this.state.value === "+") { - variance = "plus"; - } else if (this.state.value === "-") { - variance = "minus"; - } - this.eat(tt.plusMin); - } + let variance = this.flowParseVariance(); let ident = this.flowParseTypeAnnotatableIdentifier(false, false); node.name = ident.name; @@ -278,7 +270,7 @@ pp.flowParseObjectPropertyKey = function () { return (this.match(tt.num) || this.match(tt.string)) ? this.parseExprAtom() : this.parseIdentifier(true); }; -pp.flowParseObjectTypeIndexer = function (node, isStatic) { +pp.flowParseObjectTypeIndexer = function (node, isStatic, variance) { node.static = isStatic; this.expect(tt.bracketL); @@ -286,6 +278,7 @@ pp.flowParseObjectTypeIndexer = function (node, isStatic) { node.key = this.flowParseTypeInitialiser(); this.expect(tt.bracketR); node.value = this.flowParseTypeInitialiser(); + node.variance = variance; this.flowObjectTypeSemicolon(); return this.finishNode(node, "ObjectTypeIndexer"); @@ -371,9 +364,15 @@ pp.flowParseObjectType = function (allowStatic, allowExact) { isStatic = true; } + let variancePos = this.state.start; + let variance = this.flowParseVariance(); + if (this.match(tt.bracketL)) { - nodeStart.indexers.push(this.flowParseObjectTypeIndexer(node, isStatic)); + nodeStart.indexers.push(this.flowParseObjectTypeIndexer(node, isStatic, variance)); } else if (this.match(tt.parenL) || this.isRelational("<")) { + if (variance) { + this.unexpected(variancePos); + } nodeStart.callProperties.push(this.flowParseObjectTypeCallProperty(node, allowStatic)); } else { if (isStatic && this.match(tt.colon)) { @@ -383,6 +382,9 @@ pp.flowParseObjectType = function (allowStatic, allowExact) { } if (this.isRelational("<") || this.match(tt.parenL)) { // This is a method property + if (variance) { + this.unexpected(variancePos); + } nodeStart.properties.push(this.flowParseObjectTypeMethod(startPos, startLoc, isStatic, propertyKey)); } else { if (this.eat(tt.question)) { @@ -392,6 +394,7 @@ pp.flowParseObjectType = function (allowStatic, allowExact) { node.value = this.flowParseTypeInitialiser(); node.optional = optional; node.static = isStatic; + node.variance = variance; this.flowObjectTypeSemicolon(); nodeStart.properties.push(this.finishNode(node, "ObjectTypeProperty")); } @@ -736,6 +739,19 @@ pp.typeCastToParameter = function (node) { ); }; +pp.flowParseVariance = function() { + let variance = null; + if (this.match(tt.plusMin)) { + if (this.state.value === "+") { + variance = "plus"; + } else if (this.state.value === "-") { + variance = "minus"; + } + this.next(); + } + return variance; +}; + export default function (instance) { // plain function return types: function name(): string {} instance.extend("parseFunctionBody", function (inner) { @@ -990,6 +1006,7 @@ export default function (instance) { // parse class property type annotations instance.extend("parseClassProperty", function (inner) { return function (node) { + delete node.variancePos; if (this.match(tt.colon)) { node.typeAnnotation = this.flowParseTypeAnnotation(); } @@ -1007,6 +1024,11 @@ export default function (instance) { // parse type parameters for class methods instance.extend("parseClassMethod", function () { return function (classBody, method, isGenerator, isAsync) { + if (method.variance) { + this.unexpected(method.variancePos); + } + delete method.variance; + delete method.variancePos; if (this.isRelational("<")) { method.typeParameters = this.flowParseTypeParameterDeclaration(); } @@ -1039,9 +1061,26 @@ export default function (instance) { }; }); + instance.extend("parsePropertyName", function (inner) { + return function (node) { + let variancePos = this.state.start; + let variance = this.flowParseVariance(); + let key = inner.call(this, node); + node.variance = variance; + node.variancePos = variancePos; + return key; + }; + }); + // parse type parameters for object method shorthand instance.extend("parseObjPropValue", function (inner) { return function (prop) { + if (prop.variance) { + this.unexpected(prop.variancePos); + } + delete prop.variance; + delete prop.variancePos; + let typeParameters; // method shorthand diff --git a/test/fixtures/flow/call-properties/3/expected.json b/test/fixtures/flow/call-properties/3/expected.json index 10229e681d..cd2eadb7d0 100644 --- a/test/fixtures/flow/call-properties/3/expected.json +++ b/test/fixtures/flow/call-properties/3/expected.json @@ -292,7 +292,8 @@ } } }, - "optional": false + "optional": false, + "variance": null } ], "indexers": [] diff --git a/test/fixtures/flow/declare-statements/10/expected.json b/test/fixtures/flow/declare-statements/10/expected.json index ef044f87af..9254cba4fe 100644 --- a/test/fixtures/flow/declare-statements/10/expected.json +++ b/test/fixtures/flow/declare-statements/10/expected.json @@ -188,7 +188,8 @@ } }, "optional": false, - "static": true + "static": true, + "variance": null } ], "indexers": [] diff --git a/test/fixtures/flow/declare-statements/11/expected.json b/test/fixtures/flow/declare-statements/11/expected.json index 8756ca2a0c..cbc8903f9e 100644 --- a/test/fixtures/flow/declare-statements/11/expected.json +++ b/test/fixtures/flow/declare-statements/11/expected.json @@ -137,7 +137,8 @@ "column": 51 } } - } + }, + "variance": null } ] } diff --git a/test/fixtures/flow/declare-statements/14/expected.json b/test/fixtures/flow/declare-statements/14/expected.json index 3c4a8421c5..a43cb40adf 100644 --- a/test/fixtures/flow/declare-statements/14/expected.json +++ b/test/fixtures/flow/declare-statements/14/expected.json @@ -231,7 +231,8 @@ }, "name": "U" } - } + }, + "variance": null } ] } diff --git a/test/fixtures/flow/declare-statements/15/expected.json b/test/fixtures/flow/declare-statements/15/expected.json index fa08af5c9f..81024f30bd 100644 --- a/test/fixtures/flow/declare-statements/15/expected.json +++ b/test/fixtures/flow/declare-statements/15/expected.json @@ -122,7 +122,8 @@ } } }, - "optional": false + "optional": false, + "variance": null } ], "indexers": [] @@ -271,7 +272,8 @@ "name": "T" } }, - "optional": false + "optional": false, + "variance": null } ], "indexers": [] diff --git a/test/fixtures/flow/declare-statements/17/expected.json b/test/fixtures/flow/declare-statements/17/expected.json index 4b3e8c2b59..292b96e24c 100644 --- a/test/fixtures/flow/declare-statements/17/expected.json +++ b/test/fixtures/flow/declare-statements/17/expected.json @@ -125,7 +125,8 @@ } }, "optional": false, - "static": false + "static": false, + "variance": null }, { "type": "ObjectTypeProperty", @@ -174,7 +175,8 @@ } }, "optional": false, - "static": true + "static": true, + "variance": null }, { "type": "ObjectTypeProperty", @@ -223,7 +225,8 @@ } }, "optional": false, - "static": false + "static": false, + "variance": null } ], "indexers": [], diff --git a/test/fixtures/flow/declare-statements/9/expected.json b/test/fixtures/flow/declare-statements/9/expected.json index fb5c934f3d..d3d340e972 100644 --- a/test/fixtures/flow/declare-statements/9/expected.json +++ b/test/fixtures/flow/declare-statements/9/expected.json @@ -235,7 +235,8 @@ } } }, - "optional": false + "optional": false, + "variance": null } ], "indexers": [] diff --git a/test/fixtures/flow/def-site-variance/1/expected.json b/test/fixtures/flow/def-site-variance/1/expected.json index bbb8e7aaa7..ad7acee460 100644 --- a/test/fixtures/flow/def-site-variance/1/expected.json +++ b/test/fixtures/flow/def-site-variance/1/expected.json @@ -333,4 +333,4 @@ ], "directives": [] } -} \ No newline at end of file +} diff --git a/test/fixtures/flow/interfaces-module-and-script/4/expected.json b/test/fixtures/flow/interfaces-module-and-script/4/expected.json index bf9c53c0fa..922afad5c6 100644 --- a/test/fixtures/flow/interfaces-module-and-script/4/expected.json +++ b/test/fixtures/flow/interfaces-module-and-script/4/expected.json @@ -139,7 +139,8 @@ }, "typeParameters": null }, - "optional": false + "optional": false, + "variance": null } ], "indexers": [] diff --git a/test/fixtures/flow/interfaces-module-and-script/5/expected.json b/test/fixtures/flow/interfaces-module-and-script/5/expected.json index 8c08920f33..23bbe6bc92 100644 --- a/test/fixtures/flow/interfaces-module-and-script/5/expected.json +++ b/test/fixtures/flow/interfaces-module-and-script/5/expected.json @@ -121,7 +121,8 @@ } } }, - "optional": false + "optional": false, + "variance": null } ], "indexers": [ @@ -184,7 +185,8 @@ "column": 46 } } - } + }, + "variance": null } ] } diff --git a/test/fixtures/flow/type-alias/4/expected.json b/test/fixtures/flow/type-alias/4/expected.json index 5f3a6408b4..2f90efab42 100644 --- a/test/fixtures/flow/type-alias/4/expected.json +++ b/test/fixtures/flow/type-alias/4/expected.json @@ -140,7 +140,8 @@ "raw": "\"A\"" } }, - "optional": false + "optional": false, + "variance": null } ], "indexers": [] @@ -211,7 +212,8 @@ "raw": "\"B\"" } }, - "optional": false + "optional": false, + "variance": null } ], "indexers": [] diff --git a/test/fixtures/flow/type-annotations/108/expected.json b/test/fixtures/flow/type-annotations/108/expected.json index c76a2032ef..4d147cf4f4 100644 --- a/test/fixtures/flow/type-annotations/108/expected.json +++ b/test/fixtures/flow/type-annotations/108/expected.json @@ -149,7 +149,8 @@ } } }, - "optional": false + "optional": false, + "variance": null }, { "type": "ObjectTypeProperty", @@ -197,7 +198,8 @@ } } }, - "optional": false + "optional": false, + "variance": null } ], "indexers": [], @@ -457,7 +459,8 @@ } } }, - "optional": false + "optional": false, + "variance": null }, { "type": "ObjectTypeProperty", @@ -505,7 +508,8 @@ } } }, - "optional": false + "optional": false, + "variance": null } ], "indexers": [], @@ -912,7 +916,8 @@ } } }, - "optional": false + "optional": false, + "variance": null }, { "type": "ObjectTypeProperty", @@ -960,13 +965,15 @@ } } }, - "optional": false + "optional": false, + "variance": null } ], "indexers": [], "exact": true }, - "optional": false + "optional": false, + "variance": null }, { "type": "ObjectTypeProperty", @@ -1014,7 +1021,8 @@ } } }, - "optional": false + "optional": false, + "variance": null } ], "indexers": [], @@ -1424,7 +1432,8 @@ } } }, - "optional": false + "optional": false, + "variance": null }, { "type": "ObjectTypeProperty", @@ -1472,13 +1481,15 @@ } } }, - "optional": false + "optional": false, + "variance": null } ], "indexers": [], "exact": false }, - "optional": false + "optional": false, + "variance": null }, { "type": "ObjectTypeProperty", @@ -1526,7 +1537,8 @@ } } }, - "optional": false + "optional": false, + "variance": null } ], "indexers": [], diff --git a/test/fixtures/flow/type-annotations/110/actual.js b/test/fixtures/flow/type-annotations/110/actual.js new file mode 100644 index 0000000000..5c99b466e5 --- /dev/null +++ b/test/fixtures/flow/type-annotations/110/actual.js @@ -0,0 +1 @@ +type X = {+p:T} diff --git a/test/fixtures/flow/type-annotations/110/expected.json b/test/fixtures/flow/type-annotations/110/expected.json new file mode 100644 index 0000000000..6556914731 --- /dev/null +++ b/test/fixtures/flow/type-annotations/110/expected.json @@ -0,0 +1,155 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "module", + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "X" + }, + "name": "X" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "key": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "p" + }, + "name": "p" + }, + "value": { + "type": "GenericTypeAnnotation", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "T" + }, + "name": "T" + } + }, + "optional": false, + "static": false, + "variance": "plus" + } + ], + "indexers": [], + "exact": false + } + } + ], + "directives": [] + } +} diff --git a/test/fixtures/flow/type-annotations/111/actual.js b/test/fixtures/flow/type-annotations/111/actual.js new file mode 100644 index 0000000000..1e3d98d63f --- /dev/null +++ b/test/fixtures/flow/type-annotations/111/actual.js @@ -0,0 +1 @@ +type X = {-p:T} diff --git a/test/fixtures/flow/type-annotations/111/expected.json b/test/fixtures/flow/type-annotations/111/expected.json new file mode 100644 index 0000000000..8dde23737d --- /dev/null +++ b/test/fixtures/flow/type-annotations/111/expected.json @@ -0,0 +1,155 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "module", + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "X" + }, + "name": "X" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "key": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "p" + }, + "name": "p" + }, + "value": { + "type": "GenericTypeAnnotation", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "T" + }, + "name": "T" + } + }, + "optional": false, + "static": false, + "variance": "minus" + } + ], + "indexers": [], + "exact": false + } + } + ], + "directives": [] + } +} diff --git a/test/fixtures/flow/type-annotations/112/actual.js b/test/fixtures/flow/type-annotations/112/actual.js new file mode 100644 index 0000000000..aa076756aa --- /dev/null +++ b/test/fixtures/flow/type-annotations/112/actual.js @@ -0,0 +1 @@ +type X = {+m(): T} diff --git a/test/fixtures/flow/type-annotations/112/options.json b/test/fixtures/flow/type-annotations/112/options.json new file mode 100644 index 0000000000..89bfc2d73f --- /dev/null +++ b/test/fixtures/flow/type-annotations/112/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token (1:10)" +} diff --git a/test/fixtures/flow/type-annotations/113/actual.js b/test/fixtures/flow/type-annotations/113/actual.js new file mode 100644 index 0000000000..c05de9aae1 --- /dev/null +++ b/test/fixtures/flow/type-annotations/113/actual.js @@ -0,0 +1,2 @@ +type X = {-m(): T} + diff --git a/test/fixtures/flow/type-annotations/113/options.json b/test/fixtures/flow/type-annotations/113/options.json new file mode 100644 index 0000000000..89bfc2d73f --- /dev/null +++ b/test/fixtures/flow/type-annotations/113/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token (1:10)" +} diff --git a/test/fixtures/flow/type-annotations/114/actual.js b/test/fixtures/flow/type-annotations/114/actual.js new file mode 100644 index 0000000000..0c7b18f436 --- /dev/null +++ b/test/fixtures/flow/type-annotations/114/actual.js @@ -0,0 +1 @@ +type X = {+[k:K]:V} diff --git a/test/fixtures/flow/type-annotations/114/expected.json b/test/fixtures/flow/type-annotations/114/expected.json new file mode 100644 index 0000000000..6279284056 --- /dev/null +++ b/test/fixtures/flow/type-annotations/114/expected.json @@ -0,0 +1,187 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "module", + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "X" + }, + "name": "X" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 9, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "callProperties": [], + "properties": [], + "indexers": [ + { + "type": "ObjectTypeIndexer", + "start": 10, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "static": false, + "id": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "k" + }, + "name": "k" + }, + "key": { + "type": "GenericTypeAnnotation", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "K" + }, + "name": "K" + } + }, + "value": { + "type": "GenericTypeAnnotation", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "V" + }, + "name": "V" + } + }, + "variance": "plus" + } + ], + "exact": false + } + } + ], + "directives": [] + } +} diff --git a/test/fixtures/flow/type-annotations/115/actual.js b/test/fixtures/flow/type-annotations/115/actual.js new file mode 100644 index 0000000000..b86bc57ae4 --- /dev/null +++ b/test/fixtures/flow/type-annotations/115/actual.js @@ -0,0 +1 @@ +type X = {-[k:K]:V} diff --git a/test/fixtures/flow/type-annotations/115/expected.json b/test/fixtures/flow/type-annotations/115/expected.json new file mode 100644 index 0000000000..2ed71ae23e --- /dev/null +++ b/test/fixtures/flow/type-annotations/115/expected.json @@ -0,0 +1,187 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "module", + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "X" + }, + "name": "X" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 9, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "callProperties": [], + "properties": [], + "indexers": [ + { + "type": "ObjectTypeIndexer", + "start": 10, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "static": false, + "id": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "k" + }, + "name": "k" + }, + "key": { + "type": "GenericTypeAnnotation", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "K" + }, + "name": "K" + } + }, + "value": { + "type": "GenericTypeAnnotation", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "V" + }, + "name": "V" + } + }, + "variance": "minus" + } + ], + "exact": false + } + } + ], + "directives": [] + } +} diff --git a/test/fixtures/flow/type-annotations/116/actual.js b/test/fixtures/flow/type-annotations/116/actual.js new file mode 100644 index 0000000000..1fd8ff26e2 --- /dev/null +++ b/test/fixtures/flow/type-annotations/116/actual.js @@ -0,0 +1 @@ +type X = {+():T} diff --git a/test/fixtures/flow/type-annotations/116/options.json b/test/fixtures/flow/type-annotations/116/options.json new file mode 100644 index 0000000000..89bfc2d73f --- /dev/null +++ b/test/fixtures/flow/type-annotations/116/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token (1:10)" +} diff --git a/test/fixtures/flow/type-annotations/117/actual.js b/test/fixtures/flow/type-annotations/117/actual.js new file mode 100644 index 0000000000..c4a38e7a18 --- /dev/null +++ b/test/fixtures/flow/type-annotations/117/actual.js @@ -0,0 +1 @@ +type X = {-():T} diff --git a/test/fixtures/flow/type-annotations/117/options.json b/test/fixtures/flow/type-annotations/117/options.json new file mode 100644 index 0000000000..89bfc2d73f --- /dev/null +++ b/test/fixtures/flow/type-annotations/117/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token (1:10)" +} diff --git a/test/fixtures/flow/type-annotations/118/actual.js b/test/fixtures/flow/type-annotations/118/actual.js new file mode 100644 index 0000000000..c7577cc5fd --- /dev/null +++ b/test/fixtures/flow/type-annotations/118/actual.js @@ -0,0 +1 @@ +class A {+p:T} diff --git a/test/fixtures/flow/type-annotations/118/expected.json b/test/fixtures/flow/type-annotations/118/expected.json new file mode 100644 index 0000000000..3197ff95a7 --- /dev/null +++ b/test/fixtures/flow/type-annotations/118/expected.json @@ -0,0 +1,168 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "module", + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "computed": false, + "key": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "p" + }, + "name": "p" + }, + "variance": "plus", + "static": false, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 11, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "typeAnnotation": { + "type": "GenericTypeAnnotation", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "T" + }, + "name": "T" + } + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} diff --git a/test/fixtures/flow/type-annotations/119/actual.js b/test/fixtures/flow/type-annotations/119/actual.js new file mode 100644 index 0000000000..6cd0e5b864 --- /dev/null +++ b/test/fixtures/flow/type-annotations/119/actual.js @@ -0,0 +1 @@ +class A {-p:T} diff --git a/test/fixtures/flow/type-annotations/119/expected.json b/test/fixtures/flow/type-annotations/119/expected.json new file mode 100644 index 0000000000..601ec1663f --- /dev/null +++ b/test/fixtures/flow/type-annotations/119/expected.json @@ -0,0 +1,168 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "module", + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "computed": false, + "key": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "p" + }, + "name": "p" + }, + "variance": "minus", + "static": false, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 11, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "typeAnnotation": { + "type": "GenericTypeAnnotation", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "T" + }, + "name": "T" + } + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} diff --git a/test/fixtures/flow/type-annotations/120/actual.js b/test/fixtures/flow/type-annotations/120/actual.js new file mode 100644 index 0000000000..da0acba02f --- /dev/null +++ b/test/fixtures/flow/type-annotations/120/actual.js @@ -0,0 +1 @@ +class A {+m():T} diff --git a/test/fixtures/flow/type-annotations/120/options.json b/test/fixtures/flow/type-annotations/120/options.json new file mode 100644 index 0000000000..2a28555f76 --- /dev/null +++ b/test/fixtures/flow/type-annotations/120/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token (1:9)" +} diff --git a/test/fixtures/flow/type-annotations/121/actual.js b/test/fixtures/flow/type-annotations/121/actual.js new file mode 100644 index 0000000000..8fad2e1832 --- /dev/null +++ b/test/fixtures/flow/type-annotations/121/actual.js @@ -0,0 +1 @@ +class A {-m():T} diff --git a/test/fixtures/flow/type-annotations/121/options.json b/test/fixtures/flow/type-annotations/121/options.json new file mode 100644 index 0000000000..2a28555f76 --- /dev/null +++ b/test/fixtures/flow/type-annotations/121/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token (1:9)" +} diff --git a/test/fixtures/flow/type-annotations/122/actual.js b/test/fixtures/flow/type-annotations/122/actual.js new file mode 100644 index 0000000000..5e651136d9 --- /dev/null +++ b/test/fixtures/flow/type-annotations/122/actual.js @@ -0,0 +1 @@ +({+p:e}) diff --git a/test/fixtures/flow/type-annotations/122/options.json b/test/fixtures/flow/type-annotations/122/options.json new file mode 100644 index 0000000000..10bd5624f0 --- /dev/null +++ b/test/fixtures/flow/type-annotations/122/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token (1:2)" +} diff --git a/test/fixtures/flow/type-annotations/123/actual.js b/test/fixtures/flow/type-annotations/123/actual.js new file mode 100644 index 0000000000..ec5e687c52 --- /dev/null +++ b/test/fixtures/flow/type-annotations/123/actual.js @@ -0,0 +1 @@ +({-p:e}) diff --git a/test/fixtures/flow/type-annotations/123/options.json b/test/fixtures/flow/type-annotations/123/options.json new file mode 100644 index 0000000000..10bd5624f0 --- /dev/null +++ b/test/fixtures/flow/type-annotations/123/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token (1:2)" +} diff --git a/test/fixtures/flow/type-annotations/124/actual.js b/test/fixtures/flow/type-annotations/124/actual.js new file mode 100644 index 0000000000..613fc9eed6 --- /dev/null +++ b/test/fixtures/flow/type-annotations/124/actual.js @@ -0,0 +1 @@ +class C { static + m() {} } diff --git a/test/fixtures/flow/type-annotations/124/options.json b/test/fixtures/flow/type-annotations/124/options.json new file mode 100644 index 0000000000..b8b06c3a03 --- /dev/null +++ b/test/fixtures/flow/type-annotations/124/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token (1:18)" +} diff --git a/test/fixtures/flow/type-annotations/125/actual.js b/test/fixtures/flow/type-annotations/125/actual.js new file mode 100644 index 0000000000..2803cabc93 --- /dev/null +++ b/test/fixtures/flow/type-annotations/125/actual.js @@ -0,0 +1 @@ +declare class C { static + m() {} } diff --git a/test/fixtures/flow/type-annotations/125/options.json b/test/fixtures/flow/type-annotations/125/options.json new file mode 100644 index 0000000000..2e4647b080 --- /dev/null +++ b/test/fixtures/flow/type-annotations/125/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token (1:26)" +} diff --git a/test/fixtures/flow/type-annotations/126/actual.js b/test/fixtures/flow/type-annotations/126/actual.js new file mode 100644 index 0000000000..a0f3071bee --- /dev/null +++ b/test/fixtures/flow/type-annotations/126/actual.js @@ -0,0 +1 @@ +({ + m() {} }); diff --git a/test/fixtures/flow/type-annotations/126/options.json b/test/fixtures/flow/type-annotations/126/options.json new file mode 100644 index 0000000000..05dbd26b33 --- /dev/null +++ b/test/fixtures/flow/type-annotations/126/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token (1:3)" +} diff --git a/test/fixtures/flow/type-annotations/32/expected.json b/test/fixtures/flow/type-annotations/32/expected.json index e635f2e773..272d0ef394 100644 --- a/test/fixtures/flow/type-annotations/32/expected.json +++ b/test/fixtures/flow/type-annotations/32/expected.json @@ -147,7 +147,8 @@ } } }, - "optional": false + "optional": false, + "variance": null } ], "indexers": [] diff --git a/test/fixtures/flow/type-annotations/33/expected.json b/test/fixtures/flow/type-annotations/33/expected.json index 379f052e3b..0debe1f0b4 100644 --- a/test/fixtures/flow/type-annotations/33/expected.json +++ b/test/fixtures/flow/type-annotations/33/expected.json @@ -147,7 +147,8 @@ } } }, - "optional": false + "optional": false, + "variance": null } ], "indexers": [] diff --git a/test/fixtures/flow/type-annotations/34/expected.json b/test/fixtures/flow/type-annotations/34/expected.json index a8e74adb3e..dda3fa64e2 100644 --- a/test/fixtures/flow/type-annotations/34/expected.json +++ b/test/fixtures/flow/type-annotations/34/expected.json @@ -147,7 +147,8 @@ } } }, - "optional": false + "optional": false, + "variance": null } ], "indexers": [ @@ -210,7 +211,8 @@ "column": 49 } } - } + }, + "variance": null } ] } diff --git a/test/fixtures/flow/type-annotations/35/expected.json b/test/fixtures/flow/type-annotations/35/expected.json index 5ecc7fb5b7..9b7e857b25 100644 --- a/test/fixtures/flow/type-annotations/35/expected.json +++ b/test/fixtures/flow/type-annotations/35/expected.json @@ -161,7 +161,8 @@ } } }, - "optional": false + "optional": false, + "variance": null } ], "indexers": [] diff --git a/test/fixtures/flow/type-annotations/36/expected.json b/test/fixtures/flow/type-annotations/36/expected.json index b461873b82..564ecad3f2 100644 --- a/test/fixtures/flow/type-annotations/36/expected.json +++ b/test/fixtures/flow/type-annotations/36/expected.json @@ -147,7 +147,8 @@ } } }, - "optional": false + "optional": false, + "variance": null }, { "type": "ObjectTypeProperty", @@ -194,7 +195,8 @@ } } }, - "optional": false + "optional": false, + "variance": null } ], "indexers": [] diff --git a/test/fixtures/flow/type-annotations/37/expected.json b/test/fixtures/flow/type-annotations/37/expected.json index 3082874e1b..b28c546643 100644 --- a/test/fixtures/flow/type-annotations/37/expected.json +++ b/test/fixtures/flow/type-annotations/37/expected.json @@ -193,12 +193,14 @@ } } }, - "optional": false + "optional": false, + "variance": null } ], "indexers": [] }, - "optional": false + "optional": false, + "variance": null } ], "indexers": [] diff --git a/test/fixtures/flow/type-annotations/38/expected.json b/test/fixtures/flow/type-annotations/38/expected.json index 110e4bb063..d9a1247969 100644 --- a/test/fixtures/flow/type-annotations/38/expected.json +++ b/test/fixtures/flow/type-annotations/38/expected.json @@ -207,13 +207,15 @@ } } }, - "optional": false + "optional": false, + "variance": null } ], "indexers": [] } }, - "optional": false + "optional": false, + "variance": null } ], "indexers": [] diff --git a/test/fixtures/flow/type-annotations/39/expected.json b/test/fixtures/flow/type-annotations/39/expected.json index 25ed700944..4e263242a8 100644 --- a/test/fixtures/flow/type-annotations/39/expected.json +++ b/test/fixtures/flow/type-annotations/39/expected.json @@ -147,7 +147,8 @@ } } }, - "optional": false + "optional": false, + "variance": null }, { "type": "ObjectTypeProperty", @@ -194,7 +195,8 @@ } } }, - "optional": false + "optional": false, + "variance": null } ], "indexers": [] diff --git a/test/fixtures/flow/type-annotations/40/expected.json b/test/fixtures/flow/type-annotations/40/expected.json index b0202c430f..14d938827c 100644 --- a/test/fixtures/flow/type-annotations/40/expected.json +++ b/test/fixtures/flow/type-annotations/40/expected.json @@ -147,7 +147,8 @@ } } }, - "optional": false + "optional": false, + "variance": null }, { "type": "ObjectTypeProperty", @@ -194,7 +195,8 @@ } } }, - "optional": true + "optional": true, + "variance": null } ], "indexers": [] diff --git a/test/fixtures/flow/type-annotations/41/expected.json b/test/fixtures/flow/type-annotations/41/expected.json index cb969401e0..11f1b5529a 100644 --- a/test/fixtures/flow/type-annotations/41/expected.json +++ b/test/fixtures/flow/type-annotations/41/expected.json @@ -223,7 +223,8 @@ "column": 49 } } - } + }, + "variance": null } ] } diff --git a/test/fixtures/flow/type-annotations/60/expected.json b/test/fixtures/flow/type-annotations/60/expected.json index a2db556539..c7c805bc0d 100644 --- a/test/fixtures/flow/type-annotations/60/expected.json +++ b/test/fixtures/flow/type-annotations/60/expected.json @@ -198,7 +198,8 @@ } } }, - "optional": false + "optional": false, + "variance": null } ], "indexers": [] diff --git a/test/fixtures/flow/type-annotations/61/expected.json b/test/fixtures/flow/type-annotations/61/expected.json index b4cdb54e7d..5745269b9c 100644 --- a/test/fixtures/flow/type-annotations/61/expected.json +++ b/test/fixtures/flow/type-annotations/61/expected.json @@ -198,7 +198,8 @@ } } }, - "optional": false + "optional": false, + "variance": null } ], "indexers": [] diff --git a/test/fixtures/flow/type-annotations/63/expected.json b/test/fixtures/flow/type-annotations/63/expected.json index 55cd213628..085e483fb1 100644 --- a/test/fixtures/flow/type-annotations/63/expected.json +++ b/test/fixtures/flow/type-annotations/63/expected.json @@ -203,7 +203,8 @@ } } }, - "optional": false + "optional": false, + "variance": null } ], "indexers": [] diff --git a/test/fixtures/flow/type-annotations/98/expected.json b/test/fixtures/flow/type-annotations/98/expected.json index be91dcae65..953654304c 100644 --- a/test/fixtures/flow/type-annotations/98/expected.json +++ b/test/fixtures/flow/type-annotations/98/expected.json @@ -147,7 +147,8 @@ } } }, - "optional": true + "optional": true, + "variance": null }, { "type": "ObjectTypeProperty", @@ -194,7 +195,8 @@ } } }, - "optional": false + "optional": false, + "variance": null }, { "type": "ObjectTypeProperty", @@ -241,7 +243,8 @@ } } }, - "optional": false + "optional": false, + "variance": null } ], "indexers": [] diff --git a/test/fixtures/flow/type-exports/interface/expected.json b/test/fixtures/flow/type-exports/interface/expected.json index 49aeb479a6..ee9953051b 100644 --- a/test/fixtures/flow/type-exports/interface/expected.json +++ b/test/fixtures/flow/type-exports/interface/expected.json @@ -139,7 +139,8 @@ } } }, - "optional": false + "optional": false, + "variance": null } ], "indexers": [] @@ -321,7 +322,8 @@ "name": "T" } }, - "optional": false + "optional": false, + "variance": null } ], "indexers": [] diff --git a/test/fixtures/flow/typecasts/2/expected.json b/test/fixtures/flow/typecasts/2/expected.json index e460111773..7f2c10a412 100644 --- a/test/fixtures/flow/typecasts/2/expected.json +++ b/test/fixtures/flow/typecasts/2/expected.json @@ -256,7 +256,8 @@ } } }, - "optional": false + "optional": false, + "variance": null }, { "type": "ObjectTypeProperty", @@ -303,7 +304,8 @@ } } }, - "optional": false + "optional": false, + "variance": null } ], "indexers": []