Tweak variable declaration printing
parent
73755a686d
commit
6715abca76
|
@ -798,8 +798,7 @@ function genericPrintNoParens(path, options, print) {
|
|||
" ",
|
||||
printed[0],
|
||||
indent(options.tabWidth,
|
||||
join(concat([",", line]),
|
||||
printed.slice(1)))
|
||||
join(concat([",", line]), printed.slice(1)))
|
||||
];
|
||||
|
||||
// We generally want to terminate all variable declarations with a
|
||||
|
@ -814,7 +813,7 @@ function genericPrintNoParens(path, options, print) {
|
|||
parts.push(";");
|
||||
}
|
||||
|
||||
return concat(parts);
|
||||
return multilineGroup(concat(parts));
|
||||
|
||||
case "VariableDeclarator":
|
||||
return n.init ? concat([
|
||||
|
|
|
@ -20,14 +20,14 @@ export default class {
|
|||
`;
|
||||
|
||||
exports[`test B.js 1`] = `
|
||||
"import A from "./A"
|
||||
"import A from \"./A\"
|
||||
|
||||
class B extends A {
|
||||
p: string; // OK, string ~> any
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// OK, string ~> any
|
||||
import A from "./A";
|
||||
import A from \"./A\";
|
||||
class B extends A {
|
||||
p: string;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ exports[`test A.js 1`] = `
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import type T from "T";
|
||||
import type T from \"T\";
|
||||
|
||||
export default class {
|
||||
p: T;
|
||||
|
@ -18,7 +18,7 @@ export default class {
|
|||
* @providesModule A
|
||||
* @flow
|
||||
*/
|
||||
import type T from "T";
|
||||
import type T from \"T\";
|
||||
export default class {
|
||||
p: T;
|
||||
constructor() {
|
||||
|
@ -33,7 +33,7 @@ exports[`test B.js 1`] = `
|
|||
* @flow
|
||||
*/
|
||||
|
||||
import A from "A"
|
||||
import A from \"A\"
|
||||
|
||||
class B extends A {
|
||||
p: string; // OK, string ~> any
|
||||
|
@ -43,7 +43,7 @@ class B extends A {
|
|||
* @flow
|
||||
*/
|
||||
// OK, string ~> any
|
||||
import A from "A";
|
||||
import A from \"A\";
|
||||
class B extends A {
|
||||
p: string;
|
||||
}
|
||||
|
|
|
@ -156,14 +156,14 @@ function foo(c: C, x: any): string {
|
|||
return c.bar(0, y); // should be able to select first case and error
|
||||
}
|
||||
|
||||
var any_fun1 = require('./nonflowfile');
|
||||
var any_fun1 = require(\'./nonflowfile\');
|
||||
function bar1(x: mixed) {
|
||||
if (any_fun1(x)) {
|
||||
(x: boolean);
|
||||
}
|
||||
}
|
||||
|
||||
var any_fun2 = require('./anyexportflowfile');
|
||||
var any_fun2 = require(\'./anyexportflowfile\');
|
||||
function bar2(x: mixed) {
|
||||
if (any_fun2(x)) {
|
||||
(x: boolean);
|
||||
|
@ -180,13 +180,13 @@ function foo(c: C, x: any): string {
|
|||
let y = x.y;
|
||||
return c.bar(0, y);
|
||||
}
|
||||
var any_fun1 = require("./nonflowfile");
|
||||
var any_fun1 = require(\"./nonflowfile\");
|
||||
function bar1(x: mixed) {
|
||||
if (any_fun1(x)) {
|
||||
(x: boolean);
|
||||
}
|
||||
}
|
||||
var any_fun2 = require("./anyexportflowfile");
|
||||
var any_fun2 = require(\"./anyexportflowfile\");
|
||||
function bar2(x: mixed) {
|
||||
if (any_fun2(x)) {
|
||||
(x: boolean);
|
||||
|
|
|
@ -24,7 +24,7 @@ exports[`test test2.js 1`] = `
|
|||
|
||||
function filterItems(items: Array<string|number>): Array<string|number> {
|
||||
return items.map(item => {
|
||||
if (typeof item === 'string') {
|
||||
if (typeof item === \'string\') {
|
||||
return item.length > 2 ? item : null;
|
||||
} else {
|
||||
return item*10;
|
||||
|
@ -32,7 +32,7 @@ function filterItems(items: Array<string|number>): Array<string|number> {
|
|||
}).filter(Boolean);
|
||||
}
|
||||
|
||||
const filteredItems = filterItems(['foo', 'b', 1, 2]);
|
||||
const filteredItems = filterItems([\'foo\', \'b\', 1, 2]);
|
||||
|
||||
console.log(filteredItems);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -40,7 +40,7 @@ console.log(filteredItems);
|
|||
function filterItems(items: Array<string | number>): Array<string | number> {
|
||||
return items.map(
|
||||
item => {
|
||||
if (typeof item === "string") {
|
||||
if (typeof item === \"string\") {
|
||||
return (item.length > 2 ? item : null);
|
||||
} else {
|
||||
return item * 10;
|
||||
|
@ -48,7 +48,7 @@ function filterItems(items: Array<string | number>): Array<string | number> {
|
|||
}
|
||||
).filter(Boolean);
|
||||
}
|
||||
const filteredItems = filterItems([ "foo", "b", 1, 2 ]);
|
||||
const filteredItems = filterItems([ \"foo\", \"b\", 1, 2 ]);
|
||||
console.log(filteredItems);
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -5,15 +5,15 @@ var C = [1,2,3];
|
|||
B.sort((a, b) => a - b);
|
||||
C.sort((a, b) => a - b);
|
||||
|
||||
var x: Array<string> = ['1', '2'];
|
||||
var y: Array<string> = ['3', ...x];
|
||||
var x: Array<string> = [\'1\', \'2\'];
|
||||
var y: Array<string> = [\'3\', ...x];
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
var A = [ 1, 2, 3 ];
|
||||
var B = [ ...A ];
|
||||
var C = [ 1, 2, 3 ];
|
||||
B.sort((a, b) => a - b);
|
||||
C.sort((a, b) => a - b);
|
||||
var x: Array<string> = [ "1", "2" ];
|
||||
var y: Array<string> = [ "3", ...x ];
|
||||
var x: Array<string> = [ \"1\", \"2\" ];
|
||||
var y: Array<string> = [ \"3\", ...x ];
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -3,23 +3,23 @@ exports[`test array_lib.js 1`] = `
|
|||
function foo(x:string) { }
|
||||
|
||||
var a = [0];
|
||||
var b = a.map(function (x) { foo(x); return "" + x; });
|
||||
var b = a.map(function (x) { foo(x); return \"\" + x; });
|
||||
|
||||
var c: number = a[0];
|
||||
var d: number = b[0];
|
||||
|
||||
var e:Array<string> = a.reverse();
|
||||
|
||||
var f = [""];
|
||||
var f = [\"\"];
|
||||
var g:number = f.map(function () { return 0; })[0];
|
||||
|
||||
var h: Array<number> = [1,2,3];
|
||||
var i: Array<string> = ['a', 'b', 'c'];
|
||||
var i: Array<string> = [\'a\', \'b\', \'c\'];
|
||||
var j: Array<number | string> = h.concat(i);
|
||||
var k: Array<number> = h.concat(h);
|
||||
var l: Array<number> = h.concat(1,2,3);
|
||||
var m: Array<number | string> = h.concat('a', 'b', 'c');
|
||||
var n: Array<number> = h.concat('a', 'b', 'c'); // Error
|
||||
var m: Array<number | string> = h.concat(\'a\', \'b\', \'c\');
|
||||
var n: Array<number> = h.concat(\'a\', \'b\', \'c\'); // Error
|
||||
|
||||
function reduce_test() {
|
||||
/* Adapted from the following source:
|
||||
|
@ -44,13 +44,13 @@ function reduce_test() {
|
|||
/* Added later, because the above is insufficient */
|
||||
|
||||
// acc is element type of array when no init is provided
|
||||
[""].reduce((acc, str) => acc * str.length); // error, string ~> number
|
||||
[""].reduceRight((acc, str) => acc * str.length); // error, string ~> number
|
||||
[\"\"].reduce((acc, str) => acc * str.length); // error, string ~> number
|
||||
[\"\"].reduceRight((acc, str) => acc * str.length); // error, string ~> number
|
||||
}
|
||||
|
||||
function from_test() {
|
||||
var a: Array<string> = Array.from([1, 2, 3], function(val, index) {
|
||||
return index % 2 ? "foo" : String(val);
|
||||
return index % 2 ? \"foo\" : String(val);
|
||||
});
|
||||
var b: Array<string> = Array.from([1, 2, 3], function(val) {
|
||||
return String(val);
|
||||
|
@ -73,25 +73,25 @@ var a = [ 0 ];
|
|||
var b = a.map(
|
||||
function(x) {
|
||||
foo(x);
|
||||
return "" + x;
|
||||
return \"\" + x;
|
||||
}
|
||||
);
|
||||
var c: number = a[0];
|
||||
var d: number = b[0];
|
||||
var e: Array<string> = a.reverse();
|
||||
var f = [ "" ];
|
||||
var f = [ \"\" ];
|
||||
var g: number = f.map(
|
||||
function() {
|
||||
return 0;
|
||||
}
|
||||
)[0];
|
||||
var h: Array<number> = [ 1, 2, 3 ];
|
||||
var i: Array<string> = [ "a", "b", "c" ];
|
||||
var i: Array<string> = [ \"a\", \"b\", \"c\" ];
|
||||
var j: Array<number | string> = h.concat(i);
|
||||
var k: Array<number> = h.concat(h);
|
||||
var l: Array<number> = h.concat(1, 2, 3);
|
||||
var m: Array<number | string> = h.concat("a", "b", "c");
|
||||
var n: Array<number> = h.concat("a", "b", "c");
|
||||
var m: Array<number | string> = h.concat(\"a\", \"b\", \"c\");
|
||||
var n: Array<number> = h.concat(\"a\", \"b\", \"c\");
|
||||
function reduce_test() {
|
||||
[ 0, 1, 2, 3, 4 ].reduce(
|
||||
function(previousValue, currentValue, index, array) {
|
||||
|
@ -114,14 +114,14 @@ function reduce_test() {
|
|||
return a.concat(b);
|
||||
}
|
||||
);
|
||||
[ "" ].reduce((acc, str) => acc * str.length);
|
||||
[ "" ].reduceRight((acc, str) => acc * str.length);
|
||||
[ \"\" ].reduce((acc, str) => acc * str.length);
|
||||
[ \"\" ].reduceRight((acc, str) => acc * str.length);
|
||||
}
|
||||
function from_test() {
|
||||
var a: Array<string> = Array.from(
|
||||
[ 1, 2, 3 ],
|
||||
function(val, index) {
|
||||
return (index % 2 ? "foo" : String(val));
|
||||
return (index % 2 ? \"foo\" : String(val));
|
||||
}
|
||||
);
|
||||
var b: Array<string> = Array.from(
|
||||
|
|
|
@ -6,7 +6,7 @@ function foo(x:string) { }
|
|||
|
||||
var a = [];
|
||||
a[0] = 1;
|
||||
a[1] = "...";
|
||||
a[1] = \"...\";
|
||||
|
||||
foo(a[1]);
|
||||
var y;
|
||||
|
@ -32,12 +32,12 @@ var abig2: Array<{x:number; y:number}> = [
|
|||
{x:0, y:0},
|
||||
{x:0, y:0},
|
||||
{x:0, y:0, a:true},
|
||||
{x:0, y:0, b:"hey"},
|
||||
{x:0, y:0, b:\"hey\"},
|
||||
{x:0, y:0, c:1},
|
||||
{x:0, y:0, c:"hey"}
|
||||
{x:0, y:0, c:\"hey\"}
|
||||
];
|
||||
|
||||
module.exports = "arrays";
|
||||
module.exports = \"arrays\";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/* @providesModule Arrays */
|
||||
// for literals, composite element type is union of individuals
|
||||
|
@ -47,7 +47,7 @@ function foo(x: string) {
|
|||
}
|
||||
var a = [ ];
|
||||
a[0] = 1;
|
||||
a[1] = "...";
|
||||
a[1] = \"...\";
|
||||
foo(a[1]);
|
||||
var y;
|
||||
a.forEach(x => y = x);
|
||||
|
@ -68,11 +68,11 @@ var abig2: Array<{ x: number; y: number }> = [
|
|||
{ x: 0, y: 0 },
|
||||
{ x: 0, y: 0 },
|
||||
{ x: 0, y: 0, a: true },
|
||||
{ x: 0, y: 0, b: "hey" },
|
||||
{ x: 0, y: 0, b: \"hey\" },
|
||||
{ x: 0, y: 0, c: 1 },
|
||||
{ x: 0, y: 0, c: "hey" }
|
||||
{ x: 0, y: 0, c: \"hey\" }
|
||||
];
|
||||
module.exports = "arrays";
|
||||
module.exports = \"arrays\";
|
||||
"
|
||||
`;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ var bad = (x: number): string => x; // Error!
|
|||
|
||||
var ident = <T>(x: T): T => x;
|
||||
(ident(1): number);
|
||||
(ident("hi"): number); // Error
|
||||
(ident(\"hi\"): number); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/**
|
||||
* @flow
|
||||
|
@ -20,7 +20,7 @@ var add = (x: number, y: number): number => x + y;
|
|||
var bad = (x: number): string => x;
|
||||
var ident = <T>(x: T): T => x;
|
||||
(ident(1): number);
|
||||
(ident("hi"): number);
|
||||
(ident(\"hi\"): number);
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -31,7 +31,7 @@ exports[`test arrows.js 1`] = `
|
|||
): Image {
|
||||
var maxPixelWidth = maxWidth;
|
||||
//images = images.sort(function (a, b) { return a.width - b.width });
|
||||
images = images.sort((a, b) => (a.width - b.width) + "");
|
||||
images = images.sort((a, b) => (a.width - b.width) + \"\");
|
||||
return images.find(image => image.width >= maxPixelWidth) ||
|
||||
images[images.length - 1];
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ function selectBestEffortImageForWidth(
|
|||
maxWidth: number, images: Array<Image>
|
||||
): Image {
|
||||
var maxPixelWidth = maxWidth;
|
||||
images = images.sort((a, b) => a.width - b.width + "");
|
||||
images = images.sort((a, b) => a.width - b.width + \"\");
|
||||
return images.find(image => image.width >= maxPixelWidth) ||
|
||||
images[images.length - 1];
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ async function* readLines(path) {
|
|||
}
|
||||
|
||||
async function f() {
|
||||
for await (const line of readLines("/path/to/file")) {
|
||||
for await (const line of readLines(\"/path/to/file\")) {
|
||||
(line: void); // error: string ~> void
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ async function* readLines(path) {
|
|||
}
|
||||
}
|
||||
async function f() {
|
||||
for await (const line of readLines("/path/to/file")) {
|
||||
for await (const line of readLines(\"/path/to/file\")) {
|
||||
(line: void);
|
||||
}
|
||||
}
|
||||
|
@ -107,13 +107,13 @@ async function f() {
|
|||
exports[`test return.js 1`] = `
|
||||
"declare var gen: AsyncGenerator<void,string,void>;
|
||||
|
||||
// You can pass whatever you like to return, it doesn't need to be related to
|
||||
// the AsyncGenerator's return type
|
||||
// You can pass whatever you like to return, it doesn\'t need to be related to
|
||||
// the AsyncGenerator\'s return type
|
||||
gen.return(0).then(result => {
|
||||
(result.value: void); // error: string | number ~> void
|
||||
});
|
||||
|
||||
// However, a generator can "refuse" the return by catching an exception and
|
||||
// However, a generator can \"refuse\" the return by catching an exception and
|
||||
// yielding or returning internally.
|
||||
async function *refuse_return() {
|
||||
try {
|
||||
|
@ -122,16 +122,16 @@ async function *refuse_return() {
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
refuse_return().return("string").then(result => {
|
||||
refuse_return().return(\"string\").then(result => {
|
||||
if (result.done) {
|
||||
(result.value: string); // error: number | void ~> string
|
||||
}
|
||||
});
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// You can pass whatever you like to return, it doesn't need to be related to
|
||||
// the AsyncGenerator's return type
|
||||
// You can pass whatever you like to return, it doesn\'t need to be related to
|
||||
// the AsyncGenerator\'s return type
|
||||
// error: string | number ~> void
|
||||
// However, a generator can "refuse" the return by catching an exception and
|
||||
// However, a generator can \"refuse\" the return by catching an exception and
|
||||
// yielding or returning internally.
|
||||
// error: number | void ~> string
|
||||
declare var gen: AsyncGenerator<void, string, void>;
|
||||
|
@ -147,7 +147,7 @@ async function* refuse_return() {
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
refuse_return().return("string").then(
|
||||
refuse_return().return(\"string\").then(
|
||||
result => {
|
||||
if (result.done) {
|
||||
(result.value: string);
|
||||
|
@ -167,7 +167,7 @@ exports[`test throw.js 1`] = `
|
|||
}
|
||||
|
||||
(async () => {
|
||||
catch_return().throw("").then(({value}) => {
|
||||
catch_return().throw(\"\").then(({value}) => {
|
||||
if (value !== undefined) {
|
||||
(value: void); // error: number ~> void
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ async function *yield_return() {
|
|||
}
|
||||
|
||||
(async () => {
|
||||
yield_return().throw("").then(({value}) => {
|
||||
yield_return().throw(\"\").then(({value}) => {
|
||||
if (value !== undefined) {
|
||||
(value: void); // error: number ~> void
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ async function* catch_return() {
|
|||
}
|
||||
}
|
||||
async () => {
|
||||
catch_return().throw("").then(
|
||||
catch_return().throw(\"\").then(
|
||||
({ value }) => {
|
||||
if (value !== undefined) {
|
||||
(value: void);
|
||||
|
@ -218,7 +218,7 @@ async function* yield_return() {
|
|||
}
|
||||
}
|
||||
async () => {
|
||||
yield_return().throw("").then(
|
||||
yield_return().throw(\"\").then(
|
||||
({ value }) => {
|
||||
if (value !== undefined) {
|
||||
(value: void);
|
||||
|
|
|
@ -4,31 +4,31 @@ exports[`test in.js 1`] = `
|
|||
let tests = [
|
||||
// objects on RHS
|
||||
function() {
|
||||
('foo' in {});
|
||||
('foo' in { foo: null });
|
||||
(\'foo\' in {});
|
||||
(\'foo\' in { foo: null });
|
||||
(0 in {});
|
||||
(0 in { "0": null });
|
||||
(0 in { \"0\": null });
|
||||
},
|
||||
|
||||
// arrays on RHS
|
||||
function() {
|
||||
('foo' in []);
|
||||
(\'foo\' in []);
|
||||
(0 in []);
|
||||
('length' in []);
|
||||
(\'length\' in []);
|
||||
},
|
||||
|
||||
// primitive classes on RHS
|
||||
function() {
|
||||
('foo' in new String('bar'));
|
||||
('foo' in new Number(123));
|
||||
(\'foo\' in new String(\'bar\'));
|
||||
(\'foo\' in new Number(123));
|
||||
},
|
||||
|
||||
// primitives on RHS
|
||||
function() {
|
||||
('foo' in 123); // error
|
||||
('foo' in 'bar'); // error
|
||||
('foo' in void 0); // error
|
||||
('foo' in null); // error
|
||||
(\'foo\' in 123); // error
|
||||
(\'foo\' in \'bar\'); // error
|
||||
(\'foo\' in void 0); // error
|
||||
(\'foo\' in null); // error
|
||||
},
|
||||
|
||||
// bogus stuff on LHS
|
||||
|
@ -42,15 +42,15 @@ let tests = [
|
|||
|
||||
// in predicates
|
||||
function() {
|
||||
if ('foo' in 123) {} // error
|
||||
if (!'foo' in {}) {} // error, !'foo' is a boolean
|
||||
if (!('foo' in {})) {}
|
||||
if (\'foo\' in 123) {} // error
|
||||
if (!\'foo\' in {}) {} // error, !\'foo\' is a boolean
|
||||
if (!(\'foo\' in {})) {}
|
||||
},
|
||||
|
||||
// annotations on RHS
|
||||
function(x: Object, y: mixed) {
|
||||
('foo' in x); // ok
|
||||
('foo' in y); // error
|
||||
(\'foo\' in x); // ok
|
||||
(\'foo\' in y); // error
|
||||
},
|
||||
]
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -71,31 +71,31 @@ let tests = [
|
|||
// error
|
||||
// in predicates
|
||||
// error
|
||||
// error, !'foo' is a boolean
|
||||
// error, !\'foo\' is a boolean
|
||||
// annotations on RHS
|
||||
// ok
|
||||
// error
|
||||
let tests = [
|
||||
function() {
|
||||
"foo" in {};
|
||||
"foo" in { foo: null };
|
||||
\"foo\" in {};
|
||||
\"foo\" in { foo: null };
|
||||
0 in {};
|
||||
0 in { "0": null };
|
||||
0 in { \"0\": null };
|
||||
},
|
||||
function() {
|
||||
"foo" in [ ];
|
||||
\"foo\" in [ ];
|
||||
0 in [ ];
|
||||
"length" in [ ];
|
||||
\"length\" in [ ];
|
||||
},
|
||||
function() {
|
||||
"foo" in new String("bar");
|
||||
"foo" in new Number(123);
|
||||
\"foo\" in new String(\"bar\");
|
||||
\"foo\" in new Number(123);
|
||||
},
|
||||
function() {
|
||||
"foo" in 123;
|
||||
"foo" in "bar";
|
||||
"foo" in void 0;
|
||||
"foo" in null;
|
||||
\"foo\" in 123;
|
||||
\"foo\" in \"bar\";
|
||||
\"foo\" in void 0;
|
||||
\"foo\" in null;
|
||||
},
|
||||
function() {
|
||||
null in {};
|
||||
|
@ -105,19 +105,19 @@ let tests = [
|
|||
false in [ ];
|
||||
},
|
||||
function() {
|
||||
if ("foo" in 123) {
|
||||
if (\"foo\" in 123) {
|
||||
|
||||
}
|
||||
if (!"foo" in {}) {
|
||||
if (!\"foo\" in {}) {
|
||||
|
||||
}
|
||||
if (!("foo" in {})) {
|
||||
if (!(\"foo\" in {})) {
|
||||
|
||||
}
|
||||
},
|
||||
function(x: Object, y: mixed) {
|
||||
"foo" in x;
|
||||
"foo" in y;
|
||||
\"foo\" in x;
|
||||
\"foo\" in y;
|
||||
}
|
||||
];
|
||||
"
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
exports[`test scope.js 1`] = `
|
||||
"function foo<X, Y:X>(x:X, y:Y):void { }
|
||||
foo(0, "");
|
||||
foo(0, \"\");
|
||||
|
||||
function bar<X:number, Y:X>(x:X, y:Y): number { return y*0; }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
function foo<X, Y: X>(x: X, y: Y): void {
|
||||
|
||||
}
|
||||
foo(0, "");
|
||||
foo(0, \"\");
|
||||
function bar<X: number, Y: X>(x: X, y: Y): number {
|
||||
return y * 0;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ class C<T: number> {
|
|||
}
|
||||
|
||||
function example<T: {x: number}>(o: T): T { o.x = 0; return o; }
|
||||
var obj1: {x: number; y: string} = example({x: 0, y: ""});
|
||||
var obj1: {x: number; y: string} = example({x: 0, y: \"\"});
|
||||
var obj2: {x: number} = example({x: 0});
|
||||
|
||||
var c: C<string> = new C; // error, since T = string is incompatible with number
|
||||
|
@ -70,7 +70,7 @@ function example<T: { x: number }>(o: T): T {
|
|||
o.x = 0;
|
||||
return o;
|
||||
}
|
||||
var obj1: { x: number; y: string } = example({ x: 0, y: "" });
|
||||
var obj1: { x: number; y: string } = example({ x: 0, y: \"\" });
|
||||
var obj2: { x: number } = example({ x: 0 });
|
||||
var c: C<string> = new C();
|
||||
var q: number = c.qux(0);
|
||||
|
|
|
@ -3,7 +3,7 @@ exports[`test break.js 1`] = `
|
|||
var x = b ? null: false;
|
||||
var z;
|
||||
while(b) {
|
||||
if (x == null) { z = ""; break; }
|
||||
if (x == null) { z = \"\"; break; }
|
||||
var y:number = x; // error: boolean !~> number
|
||||
}
|
||||
var w:number = z; // 2 errors: ?string !~> number
|
||||
|
@ -12,10 +12,10 @@ exports[`test break.js 1`] = `
|
|||
function bar(b) {
|
||||
var x = b ? null: false;
|
||||
if (x == null) return;
|
||||
switch ("") {
|
||||
switch (\"\") {
|
||||
case 0:
|
||||
var y:number = x; // error: boolean !~> number
|
||||
x = "";
|
||||
x = \"\";
|
||||
case 1:
|
||||
var z:number = x; // 2 errors: (boolean | string) !~> number
|
||||
break;
|
||||
|
@ -27,10 +27,10 @@ function bar(b) {
|
|||
function bar2(b) {
|
||||
var x = b ? null: false;
|
||||
if (x == null) return;
|
||||
switch ("") {
|
||||
switch (\"\") {
|
||||
case 0: {
|
||||
let y:number = x; // error: boolean !~> number
|
||||
x = "";
|
||||
x = \"\";
|
||||
}
|
||||
case 1: {
|
||||
let z:number = x; // 2 errors: (boolean | string) !~> number
|
||||
|
@ -45,7 +45,7 @@ function qux(b) {
|
|||
var z = 0;
|
||||
while(b) {
|
||||
var y:number = z;
|
||||
if (b) { z = ""; continue; } // error: string !~> number
|
||||
if (b) { z = \"\"; continue; } // error: string !~> number
|
||||
z = 0;
|
||||
}
|
||||
var w:number = z; // error: string !~> number
|
||||
|
@ -54,10 +54,10 @@ function qux(b) {
|
|||
// same basic test as foo(), but with const. probes the
|
||||
// logic that still uses havoc to do env resets.
|
||||
function test_const() {
|
||||
let st: string = 'abc';
|
||||
let st: string = \'abc\';
|
||||
|
||||
for (let i = 1; i < 100; i++) {
|
||||
const fooRes: ?string = "HEY";
|
||||
const fooRes: ?string = \"HEY\";
|
||||
if (!fooRes) {
|
||||
break;
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ function foo(b) {
|
|||
var z;
|
||||
while (b) {
|
||||
if (x == null) {
|
||||
z = "";
|
||||
z = \"\";
|
||||
break;
|
||||
}
|
||||
var y: number = x;
|
||||
|
@ -97,10 +97,10 @@ function bar(b) {
|
|||
var x = (b ? null : false);
|
||||
if (x == null)
|
||||
return;
|
||||
switch ("") {
|
||||
switch (\"\") {
|
||||
case 0:
|
||||
var y: number = x;
|
||||
x = "";
|
||||
x = \"\";
|
||||
case 1:
|
||||
var z: number = x;
|
||||
break;
|
||||
|
@ -112,11 +112,11 @@ function bar2(b) {
|
|||
var x = (b ? null : false);
|
||||
if (x == null)
|
||||
return;
|
||||
switch ("") {
|
||||
switch (\"\") {
|
||||
case 0:
|
||||
{
|
||||
let y: number = x;
|
||||
x = "";
|
||||
x = \"\";
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
|
@ -132,7 +132,7 @@ function qux(b) {
|
|||
while (b) {
|
||||
var y: number = z;
|
||||
if (b) {
|
||||
z = "";
|
||||
z = \"\";
|
||||
continue;
|
||||
}
|
||||
z = 0;
|
||||
|
@ -140,9 +140,9 @@ function qux(b) {
|
|||
var w: number = z;
|
||||
}
|
||||
function test_const() {
|
||||
let st: string = "abc";
|
||||
let st: string = \"abc\";
|
||||
for (let i = 1; i < 100; i++) {
|
||||
const fooRes: ?string = "HEY";
|
||||
const fooRes: ?string = \"HEY\";
|
||||
if (!fooRes) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -10,10 +10,10 @@ module.exports = o;
|
|||
`;
|
||||
|
||||
exports[`test test2.js 1`] = `
|
||||
"var o = require('./test');
|
||||
"var o = require(\'./test\');
|
||||
(o.foo: string);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
var o = require("./test");
|
||||
var o = require(\"./test\");
|
||||
(o.foo: string);
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -5,7 +5,7 @@ exports[`test with_munging.js 1`] = `
|
|||
|
||||
class Foo {
|
||||
_method(): string {
|
||||
return 'this is private';
|
||||
return \'this is private\';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ class Bar extends Foo {
|
|||
// error
|
||||
class Foo {
|
||||
_method(): string {
|
||||
return "this is private";
|
||||
return \"this is private\";
|
||||
}
|
||||
}
|
||||
class Bar extends Foo {
|
||||
|
@ -40,7 +40,7 @@ exports[`test without_munging.js 1`] = `
|
|||
|
||||
class Foo {
|
||||
_method(): string {
|
||||
return 'this is not private';
|
||||
return \'this is not private\';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ class Bar extends Foo {
|
|||
// ok
|
||||
class Foo {
|
||||
_method(): string {
|
||||
return "this is not private";
|
||||
return \"this is not private\";
|
||||
}
|
||||
}
|
||||
class Bar extends Foo {
|
||||
|
|
|
@ -12,9 +12,9 @@ class B extends A {
|
|||
static foo(x: string) { } // error?
|
||||
static main() {
|
||||
B.x = 0; // error
|
||||
B.x = "";
|
||||
B.x = \"\";
|
||||
B.foo(0); // error
|
||||
B.foo("");
|
||||
B.foo(\"\");
|
||||
B.y = 0; // error
|
||||
B.bar(0); // error
|
||||
B.qux(0); // error
|
||||
|
@ -94,9 +94,9 @@ class B extends A {
|
|||
}
|
||||
static main() {
|
||||
B.x = 0;
|
||||
B.x = "";
|
||||
B.x = \"\";
|
||||
B.foo(0);
|
||||
B.foo("");
|
||||
B.foo(\"\");
|
||||
B.y = 0;
|
||||
B.bar(0);
|
||||
B.qux(0);
|
||||
|
|
|
@ -14,7 +14,7 @@ module.exports = { A, B };
|
|||
|
||||
exports[`test test2.js 1`] = `
|
||||
"/* @flow */
|
||||
var I = require("./test.js");
|
||||
var I = require(\"./test.js\");
|
||||
|
||||
class C extends I.A {}
|
||||
|
||||
|
@ -22,7 +22,7 @@ var x: I.A = new C();
|
|||
var y: I.B = new C();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/* @flow */
|
||||
var I = require("./test.js");
|
||||
var I = require(\"./test.js\");
|
||||
class C extends I.A {}
|
||||
var x: I.A = new C();
|
||||
var y: I.B = new C();
|
||||
|
|
|
@ -15,7 +15,7 @@ module.exports = A;
|
|||
`;
|
||||
|
||||
exports[`test B.js 1`] = `
|
||||
"var A = require('./A');
|
||||
"var A = require(\'./A\');
|
||||
|
||||
class B extends A { }
|
||||
|
||||
|
@ -25,7 +25,7 @@ let b = new B();
|
|||
module.exports = B;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// error, number !~> function
|
||||
var A = require("./A");
|
||||
var A = require(\"./A\");
|
||||
class B extends A {}
|
||||
let b = new B();
|
||||
(b.foo: number);
|
||||
|
@ -34,7 +34,7 @@ module.exports = B;
|
|||
`;
|
||||
|
||||
exports[`test C.js 1`] = `
|
||||
"var B = require('./B');
|
||||
"var B = require(\'./B\');
|
||||
|
||||
class C extends B {
|
||||
foo(x:string):void { }
|
||||
|
@ -46,7 +46,7 @@ let c = new C();
|
|||
module.exports = C;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// error, number !~> function
|
||||
var B = require("./B");
|
||||
var B = require(\"./B\");
|
||||
class C extends B {
|
||||
foo(x: string): void {
|
||||
|
||||
|
@ -74,9 +74,9 @@ exports[`test class_shapes.js 1`] = `
|
|||
|
||||
type Foo = {
|
||||
a: string; // exists in TestClass
|
||||
b: string; // doesn't exist
|
||||
b: string; // doesn\'t exist
|
||||
c?: ?string; // exists in TestClass, optional
|
||||
d?: number; // doesn't exist
|
||||
d?: number; // doesn\'t exist
|
||||
}
|
||||
|
||||
class TestClass {
|
||||
|
@ -92,8 +92,8 @@ x.c; // ok
|
|||
x.d; // error, TestClass has no d
|
||||
|
||||
var y : Foo = x;
|
||||
y.b; // error, doesn't exist in TestClass
|
||||
y.d; // ok, it's optional
|
||||
y.b; // error, doesn\'t exist in TestClass
|
||||
y.d; // ok, it\'s optional
|
||||
|
||||
class Test2Superclass {
|
||||
a: number; // conflicts with cast to Foo
|
||||
|
@ -108,15 +108,15 @@ var w : Foo = z;
|
|||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/* @flow */
|
||||
// exists in TestClass
|
||||
// doesn't exist
|
||||
// doesn\'t exist
|
||||
// exists in TestClass, optional
|
||||
/* doesn't exist*/
|
||||
/* doesn\'t exist*/
|
||||
// ok
|
||||
// error, TestClass has no b
|
||||
// ok
|
||||
// error, TestClass has no d
|
||||
// error, doesn't exist in TestClass
|
||||
// ok, it's optional
|
||||
// error, doesn\'t exist in TestClass
|
||||
// ok, it\'s optional
|
||||
// conflicts with cast to Foo
|
||||
// conflicts with cast to Foo
|
||||
// conflicts with cast to Foo
|
||||
|
@ -155,7 +155,7 @@ exports[`test expr.js 1`] = `
|
|||
var bar1: Bar = new Bar() // OK
|
||||
var bar2: Bar = Bar.factory() // OK
|
||||
|
||||
// NB: Don't write expected errors using Foo to avoid error collapse hiding an
|
||||
// NB: Don\'t write expected errors using Foo to avoid error collapse hiding an
|
||||
// unexpected failure in the above code.
|
||||
|
||||
var B = class Baz { }
|
||||
|
@ -181,7 +181,7 @@ var alias2: Alias = _Alias.factory(); // error: bad pun
|
|||
// OK: Foo is a runtime binding in this scope
|
||||
// OK
|
||||
// OK
|
||||
// NB: Don't write expected errors using Foo to avoid error collapse hiding an
|
||||
// NB: Don\'t write expected errors using Foo to avoid error collapse hiding an
|
||||
// unexpected failure in the above code.
|
||||
// error: Baz is not a runtime binding in this scope
|
||||
// error: Qux is not a type in this scope
|
||||
|
@ -232,7 +232,7 @@ exports[`test statics.js 1`] = `
|
|||
class C {
|
||||
static p: string;
|
||||
}
|
||||
C.p = "hi";
|
||||
C.p = \"hi\";
|
||||
|
||||
// Class static fields are compatible with object types
|
||||
(C: {p:string}); // ok
|
||||
|
@ -249,7 +249,7 @@ declare var o: {p:number};
|
|||
class C {
|
||||
static p: string;
|
||||
}
|
||||
C.p = "hi";
|
||||
C.p = \"hi\";
|
||||
(C: { p: string });
|
||||
(C: { p: number });
|
||||
declare var o: { p: number };
|
||||
|
|
|
@ -13,11 +13,11 @@ module.exports = f;
|
|||
|
||||
exports[`test Rel.js 1`] = `
|
||||
"
|
||||
var f = require('./Abs');
|
||||
var f = require(\'./Abs\');
|
||||
|
||||
f(0);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
var f = require("./Abs");
|
||||
var f = require(\"./Abs\");
|
||||
f(0);
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
exports[`test test.js 1`] = `
|
||||
"var ColorId = {
|
||||
RED: 'R',
|
||||
GREEN: 'G',
|
||||
BLUE: 'B',
|
||||
RED: \'R\',
|
||||
GREEN: \'G\',
|
||||
BLUE: \'B\',
|
||||
};
|
||||
|
||||
var ColorNumber = {
|
||||
RED: 'ff0000',
|
||||
GREEN: '00ff00',
|
||||
BLUE: '0000ff',
|
||||
RED: \'ff0000\',
|
||||
GREEN: \'00ff00\',
|
||||
BLUE: \'0000ff\',
|
||||
};
|
||||
|
||||
var ColorIdToNumber = {
|
||||
|
@ -17,7 +17,7 @@ var ColorIdToNumber = {
|
|||
[ColorId.BLUE]: ColorNumber.BLUE,
|
||||
};
|
||||
|
||||
(ColorIdToNumber[ColorId.RED]: 'ffffff'); // oops
|
||||
(ColorIdToNumber[ColorId.RED]: \'ffffff\'); // oops
|
||||
|
||||
ColorIdToNumber.XXX; // oops
|
||||
|
||||
|
@ -25,91 +25,91 @@ module.exports = { ColorId, ColorNumber };
|
|||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// oops
|
||||
// oops
|
||||
var ColorId = { RED: "R", GREEN: "G", BLUE: "B" };
|
||||
var ColorNumber = { RED: "ff0000", GREEN: "00ff00", BLUE: "0000ff" };
|
||||
var ColorId = { RED: \"R\", GREEN: \"G\", BLUE: \"B\" };
|
||||
var ColorNumber = { RED: \"ff0000\", GREEN: \"00ff00\", BLUE: \"0000ff\" };
|
||||
var ColorIdToNumber = {
|
||||
[ColorId.RED]: ColorNumber.RED,
|
||||
[ColorId.GREEN]: ColorNumber.GREEN,
|
||||
[ColorId.BLUE]: ColorNumber.BLUE
|
||||
};
|
||||
(ColorIdToNumber[ColorId.RED]: "ffffff");
|
||||
(ColorIdToNumber[ColorId.RED]: \"ffffff\");
|
||||
ColorIdToNumber.XXX;
|
||||
module.exports = { ColorId, ColorNumber };
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`test test2.js 1`] = `
|
||||
"var { ColorId, ColorNumber } = require('./test');
|
||||
"var { ColorId, ColorNumber } = require(\'./test\');
|
||||
var ColorIdToNumber = {
|
||||
[ColorId.RED]: ColorNumber.RED,
|
||||
[ColorId.GREEN]: ColorNumber.GREEN,
|
||||
[ColorId.BLUE]: ColorNumber.BLUE,
|
||||
};
|
||||
|
||||
(ColorIdToNumber[ColorId.GREEN]: 'ffffff'); // oops
|
||||
(ColorIdToNumber[ColorId.GREEN]: \'ffffff\'); // oops
|
||||
|
||||
module.exports = ColorIdToNumber;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// oops
|
||||
var { ColorId, ColorNumber } = require("./test");
|
||||
var { ColorId, ColorNumber } = require(\"./test\");
|
||||
var ColorIdToNumber = {
|
||||
[ColorId.RED]: ColorNumber.RED,
|
||||
[ColorId.GREEN]: ColorNumber.GREEN,
|
||||
[ColorId.BLUE]: ColorNumber.BLUE
|
||||
};
|
||||
(ColorIdToNumber[ColorId.GREEN]: "ffffff");
|
||||
(ColorIdToNumber[ColorId.GREEN]: \"ffffff\");
|
||||
module.exports = ColorIdToNumber;
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`test test3.js 1`] = `
|
||||
"var { ColorId } = require('./test');
|
||||
var ColorIdToNumber = require('./test2');
|
||||
"var { ColorId } = require(\'./test\');
|
||||
var ColorIdToNumber = require(\'./test2\');
|
||||
|
||||
(ColorIdToNumber[ColorId.BLUE]: 'ffffff'); // oops
|
||||
(ColorIdToNumber[ColorId.BLUE]: \'ffffff\'); // oops
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// oops
|
||||
var { ColorId } = require("./test");
|
||||
var ColorIdToNumber = require("./test2");
|
||||
(ColorIdToNumber[ColorId.BLUE]: "ffffff");
|
||||
var { ColorId } = require(\"./test\");
|
||||
var ColorIdToNumber = require(\"./test2\");
|
||||
(ColorIdToNumber[ColorId.BLUE]: \"ffffff\");
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`test test4.js 1`] = `
|
||||
"module.exports = 'hello';
|
||||
"module.exports = \'hello\';
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
module.exports = "hello";
|
||||
module.exports = \"hello\";
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`test test5.js 1`] = `
|
||||
"var hello = require('./test4');
|
||||
var dummy = require('./test');
|
||||
"var hello = require(\'./test4\');
|
||||
var dummy = require(\'./test\');
|
||||
module.exports = {
|
||||
...dummy,
|
||||
[hello]: 'world',
|
||||
[hello]: \'world\',
|
||||
...dummy,
|
||||
};
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
var hello = require("./test4");
|
||||
var dummy = require("./test");
|
||||
module.exports = { ...dummy, [hello]: "world", ...dummy };
|
||||
var hello = require(\"./test4\");
|
||||
var dummy = require(\"./test\");
|
||||
module.exports = { ...dummy, [hello]: \"world\", ...dummy };
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`test test6.js 1`] = `
|
||||
"var o = require('./test5');
|
||||
(o.hello: 'nothing'); // oops
|
||||
"var o = require(\'./test5\');
|
||||
(o.hello: \'nothing\'); // oops
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// oops
|
||||
var o = require("./test5");
|
||||
(o.hello: "nothing");
|
||||
var o = require(\"./test5\");
|
||||
(o.hello: \"nothing\");
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`test test7.js 1`] = `
|
||||
"var obj = {x: 0, m() { return this.x }}
|
||||
var x: string = obj['m'](); // error, number ~> string
|
||||
var x: string = obj[\'m\'](); // error, number ~> string
|
||||
|
||||
var arr = [function() { return this.length }];
|
||||
var y: string = arr[0](); // error: number ~> string
|
||||
|
@ -122,7 +122,7 @@ var obj = {
|
|||
return this.x;
|
||||
}
|
||||
};
|
||||
var x: string = obj["m"]();
|
||||
var x: string = obj[\"m\"]();
|
||||
var arr = [
|
||||
function() {
|
||||
return this.length;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
exports[`test no_at_flow.js 1`] = `
|
||||
"var x: number = "not a number"; // Error: string ~> number
|
||||
"var x: number = \"not a number\"; // Error: string ~> number
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Error: string ~> number
|
||||
var x: number = "not a number";
|
||||
var x: number = \"not a number\";
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
exports[`test no_at_flow.js 1`] = `
|
||||
"var x: number = "not a number"; // No error
|
||||
"var x: number = \"not a number\"; // No error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// No error
|
||||
var x: number = "not a number";
|
||||
var x: number = \"not a number\";
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -4,21 +4,21 @@ exports[`test test.js 1`] = `
|
|||
*/
|
||||
|
||||
function foo(x) {
|
||||
var a: number = 'asdf';
|
||||
var a: number = \'asdf\';
|
||||
return x * 10;
|
||||
}
|
||||
|
||||
// This file should be ignored, so this should not result in an error
|
||||
foo('Hello, world!');
|
||||
foo(\'Hello, world!\');
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/*
|
||||
* @flow
|
||||
*/
|
||||
// This file should be ignored, so this should not result in an error
|
||||
function foo(x) {
|
||||
var a: number = "asdf";
|
||||
var a: number = \"asdf\";
|
||||
return x * 10;
|
||||
}
|
||||
foo("Hello, world!");
|
||||
foo(\"Hello, world!\");
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -2,10 +2,10 @@ exports[`test foo.js 1`] = `
|
|||
"/* @flow */
|
||||
|
||||
// No error, this file is ignored
|
||||
var x: number = "string";
|
||||
var x: number = \"string\";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/* @flow */
|
||||
// No error, this file is ignored
|
||||
var x: number = "string";
|
||||
var x: number = \"string\";
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
exports[`test foo.js 1`] = `
|
||||
"/* @flow */
|
||||
|
||||
var x: number = "string"; // Error string ~> number
|
||||
var x: number = \"string\"; // Error string ~> number
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/* @flow */
|
||||
// Error string ~> number
|
||||
var x: number = "string";
|
||||
var x: number = \"string\";
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
exports[`test main.js 1`] = `
|
||||
"// @flow
|
||||
|
||||
import {test} from 'testmodule';
|
||||
import {test} from \'testmodule\';
|
||||
|
||||
var a: number = test;
|
||||
var b: string = test; // Error: number ~> string
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
// Error: number ~> string
|
||||
import { test } from "testmodule";
|
||||
import { test } from \"testmodule\";
|
||||
var a: number = test;
|
||||
var b: string = test;
|
||||
"
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
exports[`test test.js 1`] = `
|
||||
"// @flow
|
||||
|
||||
import {className} from "./SomeCSSFile.css";
|
||||
import {doesntExist} from "./SomeCSSFile.css"; // Error: \`doestExist\` isn't an export
|
||||
import {className} from \"./SomeCSSFile.css\";
|
||||
import {doesntExist} from \"./SomeCSSFile.css\"; // Error: \`doestExist\` isn\'t an export
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
// Error: \`doestExist\` isn't an export
|
||||
import { className } from "./SomeCSSFile.css";
|
||||
import { doesntExist } from "./SomeCSSFile.css";
|
||||
// Error: \`doestExist\` isn\'t an export
|
||||
import { className } from \"./SomeCSSFile.css\";
|
||||
import { doesntExist } from \"./SomeCSSFile.css\";
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
exports[`test A.js 1`] = `
|
||||
"/* @flow */
|
||||
|
||||
var m1 = require('1DoesntExist');
|
||||
import {numVal as numVal1} from '1DoesntExist';
|
||||
var m1 = require(\'1DoesntExist\');
|
||||
import {numVal as numVal1} from \'1DoesntExist\';
|
||||
var a_1: number = m1.numVal;
|
||||
var a_2: number = numVal1;
|
||||
|
||||
// Error: 'Exists2' is not a valid module name
|
||||
// Error: \'Exists2\' is not a valid module name
|
||||
//
|
||||
// This tests that, for haste, the first name_mapper regexp that happens to
|
||||
// match the given module name string is picked.
|
||||
var m2 = require('2DoesntExist'); // Error
|
||||
import {numVal as numVal2} from '3DoesntExist'; // Error
|
||||
var m2 = require(\'2DoesntExist\'); // Error
|
||||
import {numVal as numVal2} from \'3DoesntExist\'; // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/* @flow */
|
||||
// Error: 'Exists2' is not a valid module name
|
||||
// Error: \'Exists2\' is not a valid module name
|
||||
//
|
||||
// This tests that, for haste, the first name_mapper regexp that happens to
|
||||
// match the given module name string is picked.
|
||||
// Error
|
||||
// Error
|
||||
var m1 = require("1DoesntExist");
|
||||
import { numVal as numVal1 } from "1DoesntExist";
|
||||
var m1 = require(\"1DoesntExist\");
|
||||
import { numVal as numVal1 } from \"1DoesntExist\";
|
||||
var a_1: number = m1.numVal;
|
||||
var a_2: number = numVal1;
|
||||
var m2 = require("2DoesntExist");
|
||||
import { numVal as numVal2 } from "3DoesntExist";
|
||||
var m2 = require(\"2DoesntExist\");
|
||||
import { numVal as numVal2 } from \"3DoesntExist\";
|
||||
"
|
||||
`;
|
||||
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
exports[`test A.js 1`] = `
|
||||
"/* @flow */
|
||||
|
||||
var m1 = require('./1DoesntExist');
|
||||
var m1 = require(\'./1DoesntExist\');
|
||||
var a_1: number = m1.numVal;
|
||||
var a_2: string = m1.numVal; // Error: number ~> string
|
||||
import {numVal} from './1DoesntExist';
|
||||
import {numVal} from \'./1DoesntExist\';
|
||||
var a_3: number = numVal;
|
||||
var a_4: string = numVal; // Error: number ~> string
|
||||
|
||||
// This tests that, for node, the first name mapping that both matches *and*
|
||||
// results in a valid module filename is picked.
|
||||
var m2 = require('./2DoesntExist');
|
||||
var m2 = require(\'./2DoesntExist\');
|
||||
var b_1: number = m2.numVal;
|
||||
var b_2: string = m2.numVal; // Error: number ~> string
|
||||
import {numVal as numVal2} from './3DoesntExist';
|
||||
import {numVal as numVal2} from \'./3DoesntExist\';
|
||||
var b_3: number = numVal2;
|
||||
var b_4: string = numVal2; // Error: number ~> string
|
||||
|
||||
// node_modules/Exists/index.js
|
||||
var m3 = require('4DoesntExist');
|
||||
var m3 = require(\'4DoesntExist\');
|
||||
var c_1: number = m3.numVal;
|
||||
var c_2: string = m3.numVal; // Error: number ~> string
|
||||
import {numVal as numVal3} from '5DoesntExist';
|
||||
import {numVal as numVal3} from \'5DoesntExist\';
|
||||
var c_3: number = numVal3;
|
||||
var c_4: string = numVal3; // Error: number ~> string
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -35,22 +35,22 @@ var c_4: string = numVal3; // Error: number ~> string
|
|||
// node_modules/Exists/index.js
|
||||
// Error: number ~> string
|
||||
// Error: number ~> string
|
||||
var m1 = require("./1DoesntExist");
|
||||
var m1 = require(\"./1DoesntExist\");
|
||||
var a_1: number = m1.numVal;
|
||||
var a_2: string = m1.numVal;
|
||||
import { numVal } from "./1DoesntExist";
|
||||
import { numVal } from \"./1DoesntExist\";
|
||||
var a_3: number = numVal;
|
||||
var a_4: string = numVal;
|
||||
var m2 = require("./2DoesntExist");
|
||||
var m2 = require(\"./2DoesntExist\");
|
||||
var b_1: number = m2.numVal;
|
||||
var b_2: string = m2.numVal;
|
||||
import { numVal as numVal2 } from "./3DoesntExist";
|
||||
import { numVal as numVal2 } from \"./3DoesntExist\";
|
||||
var b_3: number = numVal2;
|
||||
var b_4: string = numVal2;
|
||||
var m3 = require("4DoesntExist");
|
||||
var m3 = require(\"4DoesntExist\");
|
||||
var c_1: number = m3.numVal;
|
||||
var c_2: string = m3.numVal;
|
||||
import { numVal as numVal3 } from "5DoesntExist";
|
||||
import { numVal as numVal3 } from \"5DoesntExist\";
|
||||
var c_3: number = numVal3;
|
||||
var c_4: string = numVal3;
|
||||
"
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
exports[`test toplevel.js 1`] = `
|
||||
"// @flow
|
||||
|
||||
import {name} from "testproj";
|
||||
import {name} from \"testproj\";
|
||||
|
||||
(name: "node_modules/testproj");
|
||||
(name: "custom_resolve_dir/testproj"); // Error: Resolve from node_modules first!
|
||||
(name: \"node_modules/testproj\");
|
||||
(name: \"custom_resolve_dir/testproj\"); // Error: Resolve from node_modules first!
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
// Error: Resolve from node_modules first!
|
||||
import { name } from "testproj";
|
||||
(name: "node_modules/testproj");
|
||||
(name: "custom_resolve_dir/testproj");
|
||||
import { name } from \"testproj\";
|
||||
(name: \"node_modules/testproj\");
|
||||
(name: \"custom_resolve_dir/testproj\");
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
exports[`test index.js 1`] = `
|
||||
"// @flow
|
||||
|
||||
export var name: "otherdir/testproj" = "otherdir/testproj";
|
||||
export var name: \"otherdir/testproj\" = \"otherdir/testproj\";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
export var name: "otherdir/testproj" = "otherdir/testproj";
|
||||
export var name: \"otherdir/testproj\" = \"otherdir/testproj\";
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
exports[`test index.js 1`] = `
|
||||
"// @flow
|
||||
|
||||
export var name: "otherdir/testproj2" = "otherdir/testproj2";
|
||||
export var name: \"otherdir/testproj2\" = \"otherdir/testproj2\";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
export var name: "otherdir/testproj2" = "otherdir/testproj2";
|
||||
export var name: \"otherdir/testproj2\" = \"otherdir/testproj2\";
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
exports[`test sublevel.js 1`] = `
|
||||
"// @flow
|
||||
|
||||
import {name} from "testproj2";
|
||||
import {name} from \"testproj2\";
|
||||
|
||||
(name: "node_modules/testproj2"); // Error: Resolve from sibling 'custom_resolve_dir' first!
|
||||
(name: "subdir/custom_resolve_dir/testproj2");
|
||||
(name: \"node_modules/testproj2\"); // Error: Resolve from sibling \'custom_resolve_dir\' first!
|
||||
(name: \"subdir/custom_resolve_dir/testproj2\");
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
// Error: Resolve from sibling 'custom_resolve_dir' first!
|
||||
import { name } from "testproj2";
|
||||
(name: "node_modules/testproj2");
|
||||
(name: "subdir/custom_resolve_dir/testproj2");
|
||||
// Error: Resolve from sibling \'custom_resolve_dir\' first!
|
||||
import { name } from \"testproj2\";
|
||||
(name: \"node_modules/testproj2\");
|
||||
(name: \"subdir/custom_resolve_dir/testproj2\");
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
exports[`test index.js 1`] = `
|
||||
"// @flow
|
||||
|
||||
export var name: "subdir/custom_resolve_dir/testproj2" = "subdir/custom_resolve_dir/testproj2";
|
||||
export var name: \"subdir/custom_resolve_dir/testproj2\" = \"subdir/custom_resolve_dir/testproj2\";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
export var name: "subdir/custom_resolve_dir/testproj2" = "subdir/custom_resolve_dir/testproj2";
|
||||
export var name: \"subdir/custom_resolve_dir/testproj2\" = \"subdir/custom_resolve_dir/testproj2\";
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -12,7 +12,7 @@ class A {
|
|||
return 1;
|
||||
}
|
||||
static _sMethod(): string {
|
||||
return "some string";
|
||||
return \"some string\";
|
||||
}
|
||||
}
|
||||
A._sProperty = 48;
|
||||
|
@ -23,16 +23,16 @@ class B extends A {
|
|||
|
||||
constructor() {
|
||||
super();
|
||||
this._property1 = "another string";
|
||||
this._property1 = \"another string\";
|
||||
}
|
||||
_method1(): string {
|
||||
return "yet another string";
|
||||
return \"yet another string\";
|
||||
}
|
||||
static _sMethod(): number {
|
||||
return 23;
|
||||
}
|
||||
}
|
||||
B._sProperty = "B._sProperty string";
|
||||
B._sProperty = \"B._sProperty string\";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/* @flow */
|
||||
class A {
|
||||
|
@ -45,7 +45,7 @@ class A {
|
|||
return 1;
|
||||
}
|
||||
static _sMethod(): string {
|
||||
return "some string";
|
||||
return \"some string\";
|
||||
}
|
||||
}
|
||||
A._sProperty = 48;
|
||||
|
@ -54,16 +54,16 @@ class B extends A {
|
|||
static _sProperty: string;
|
||||
constructor() {
|
||||
super();
|
||||
this._property1 = "another string";
|
||||
this._property1 = \"another string\";
|
||||
}
|
||||
_method1(): string {
|
||||
return "yet another string";
|
||||
return \"yet another string\";
|
||||
}
|
||||
static _sMethod(): number {
|
||||
return 23;
|
||||
}
|
||||
}
|
||||
B._sProperty = "B._sProperty string";
|
||||
B._sProperty = \"B._sProperty string\";
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -87,9 +87,9 @@ module.exports = new C();
|
|||
exports[`test commonjs_import.js 1`] = `
|
||||
"/* @flow */
|
||||
|
||||
import {_p} from "./commonjs_export";
|
||||
import {_p} from \"./commonjs_export\";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/* @flow */
|
||||
import { _p } from "./commonjs_export";
|
||||
import { _p } from \"./commonjs_export\";
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -12,7 +12,7 @@ class A {
|
|||
return 1;
|
||||
}
|
||||
static _sMethod(): string {
|
||||
return "some string";
|
||||
return \"some string\";
|
||||
}
|
||||
}
|
||||
A._sProperty = 48;
|
||||
|
@ -23,16 +23,16 @@ class B extends A {
|
|||
|
||||
constructor() {
|
||||
super();
|
||||
this._property1 = "another string";
|
||||
this._property1 = \"another string\";
|
||||
}
|
||||
_method1(): string {
|
||||
return "yet another string";
|
||||
return \"yet another string\";
|
||||
}
|
||||
static _sMethod(): number {
|
||||
return 23;
|
||||
}
|
||||
}
|
||||
B._sProperty = "B._sProperty string";
|
||||
B._sProperty = \"B._sProperty string\";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/* @flow */
|
||||
class A {
|
||||
|
@ -45,7 +45,7 @@ class A {
|
|||
return 1;
|
||||
}
|
||||
static _sMethod(): string {
|
||||
return "some string";
|
||||
return \"some string\";
|
||||
}
|
||||
}
|
||||
A._sProperty = 48;
|
||||
|
@ -54,15 +54,15 @@ class B extends A {
|
|||
static _sProperty: string;
|
||||
constructor() {
|
||||
super();
|
||||
this._property1 = "another string";
|
||||
this._property1 = \"another string\";
|
||||
}
|
||||
_method1(): string {
|
||||
return "yet another string";
|
||||
return \"yet another string\";
|
||||
}
|
||||
static _sMethod(): number {
|
||||
return 23;
|
||||
}
|
||||
}
|
||||
B._sProperty = "B._sProperty string";
|
||||
B._sProperty = \"B._sProperty string\";
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -15,16 +15,16 @@ exports[`test test.js 1`] = `
|
|||
*/
|
||||
|
||||
function cannot_reassign(x: string) {
|
||||
x = "hey"; // error, const param cannot be reassigned
|
||||
x = \"hey\"; // error, const param cannot be reassigned
|
||||
}
|
||||
|
||||
// Note: const params use the same machinery as explicit
|
||||
// const bindings, which are tested more extensively elsewhere.
|
||||
// Here we're just making sure the machinery is hooked up.
|
||||
// Here we\'re just making sure the machinery is hooked up.
|
||||
//
|
||||
function durable_refi(x: ?number) {
|
||||
if (x) {
|
||||
// ok: if x is truthy here, it's truthy everywhere
|
||||
// ok: if x is truthy here, it\'s truthy everywhere
|
||||
return () => { var y:number = x; };
|
||||
}
|
||||
}
|
||||
|
@ -46,11 +46,11 @@ function durable_refi(x: ?number) {
|
|||
// error, const param cannot be reassigned
|
||||
// Note: const params use the same machinery as explicit
|
||||
// const bindings, which are tested more extensively elsewhere.
|
||||
// Here we're just making sure the machinery is hooked up.
|
||||
// Here we\'re just making sure the machinery is hooked up.
|
||||
//
|
||||
// ok: if x is truthy here, it's truthy everywhere
|
||||
// ok: if x is truthy here, it\'s truthy everywhere
|
||||
function cannot_reassign(x: string) {
|
||||
x = "hey";
|
||||
x = \"hey\";
|
||||
}
|
||||
function durable_refi(x: ?number) {
|
||||
if (x) {
|
||||
|
|
|
@ -5,11 +5,11 @@ exports[`test dummy.js 1`] = `
|
|||
`;
|
||||
|
||||
exports[`test test.js 1`] = `
|
||||
"require('./dummy');
|
||||
"require(\'./dummy\');
|
||||
var xxx = 0;
|
||||
xxx
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
require("./dummy");
|
||||
require(\"./dummy\");
|
||||
var xxx = 0;
|
||||
xxx;
|
||||
"
|
||||
|
|
|
@ -5,11 +5,11 @@ exports[`test dummy.js 1`] = `
|
|||
`;
|
||||
|
||||
exports[`test test.js 1`] = `
|
||||
"require('./dummy');
|
||||
"require(\'./dummy\');
|
||||
var xxx = 0;
|
||||
xxx
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
require("./dummy");
|
||||
require(\"./dummy\");
|
||||
var xxx = 0;
|
||||
xxx;
|
||||
"
|
||||
|
|
|
@ -2,7 +2,7 @@ exports[`test test.js 1`] = `
|
|||
"type CovArrayVerbose<X,Y:X> = Array<Y>;
|
||||
var b: CovArrayVerbose<number,*> = [];
|
||||
var y: CovArrayVerbose<mixed,*> = b;
|
||||
y[0] = ""; // error
|
||||
y[0] = \"\"; // error
|
||||
|
||||
class NVerbose<E,I:E> {
|
||||
x: CovArrayVerbose<E,I>;
|
||||
|
@ -22,12 +22,12 @@ var z: CovArray<string> = c; // error
|
|||
|
||||
var d: CovArray<number> = [];
|
||||
var w: CovArray<mixed> = d;
|
||||
w[0] = ""; // error
|
||||
w[0] = \"\"; // error
|
||||
|
||||
type P<X> = CovArray<X>;
|
||||
var p: P<mixed> = [];
|
||||
(p[0]: number); // not an error!
|
||||
p[0] = ""; // error
|
||||
p[0] = \"\"; // error
|
||||
|
||||
class M {
|
||||
x: CovArray<number>;
|
||||
|
@ -60,12 +60,12 @@ var z: CovArray<string> = c; // error
|
|||
|
||||
var d: CovArray<number> = [];
|
||||
var w: CovArray<mixed> = d;
|
||||
w[0] = ""; // error
|
||||
w[0] = \"\"; // error
|
||||
|
||||
type P<X> = CovArray<X>;
|
||||
var p: P<mixed> = [];
|
||||
(p[0]: number); // not an error!
|
||||
p[0] = ""; // error
|
||||
p[0] = \"\"; // error
|
||||
|
||||
class M {
|
||||
x: CovArray<number>;
|
||||
|
@ -89,7 +89,7 @@ n.x = [0];
|
|||
type CovArrayVerbose<X, Y: X> = Array<Y>;
|
||||
var b: CovArrayVerbose<number, *> = [ ];
|
||||
var y: CovArrayVerbose<mixed, *> = b;
|
||||
y[0] = "";
|
||||
y[0] = \"\";
|
||||
class NVerbose<E, I: E> {
|
||||
x: CovArrayVerbose<E, I>;
|
||||
foo(): CovArrayVerbose<mixed, I> {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
exports[`test crash.js 1`] = `
|
||||
"// This file triggers a violation of the "disjoint-or-nested ranges invariant"
|
||||
"// This file triggers a violation of the \"disjoint-or-nested ranges invariant\"
|
||||
// that we implicitly assume in type-at-pos and coverage implementations. In
|
||||
// particular, when unchecked it causes a crash with coverage --color.
|
||||
|
||||
|
@ -11,7 +11,7 @@ declare module bar {
|
|||
|
||||
// TODO
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// This file triggers a violation of the "disjoint-or-nested ranges invariant"
|
||||
// This file triggers a violation of the \"disjoint-or-nested ranges invariant\"
|
||||
// that we implicitly assume in type-at-pos and coverage implementations. In
|
||||
// particular, when unchecked it causes a crash with coverage --color.
|
||||
// TODO
|
||||
|
@ -47,7 +47,7 @@ let x = 0;
|
|||
`;
|
||||
|
||||
exports[`test non-termination.js 1`] = `
|
||||
"// This file triggers a violation of the "disjoint-or-nested ranges invariant"
|
||||
"// This file triggers a violation of the \"disjoint-or-nested ranges invariant\"
|
||||
// that we implicitly assume in type-at-pos and coverage implementations. In
|
||||
// particular, when unchecked it causes non-termination with coverage --color.
|
||||
|
||||
|
@ -62,7 +62,7 @@ declare module bar {
|
|||
declare class qux {
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// This file triggers a violation of the "disjoint-or-nested ranges invariant"
|
||||
// This file triggers a violation of the \"disjoint-or-nested ranges invariant\"
|
||||
// that we implicitly assume in type-at-pos and coverage implementations. In
|
||||
// particular, when unchecked it causes non-termination with coverage --color.
|
||||
// TODO
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
exports[`test A.js 1`] = `
|
||||
"var B = require('./B');
|
||||
"var B = require(\'./B\');
|
||||
|
||||
class A extends B { }
|
||||
|
||||
module.exports = A;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
var B = require("./B");
|
||||
var B = require(\"./B\");
|
||||
class A extends B {}
|
||||
module.exports = A;
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`test B.js 1`] = `
|
||||
"var A = require('./A');
|
||||
"var A = require(\'./A\');
|
||||
|
||||
//class B extends A { }
|
||||
|
||||
module.exports = B;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//class B extends A { }
|
||||
var A = require("./A");
|
||||
var A = require(\"./A\");
|
||||
module.exports = B;
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -7,7 +7,7 @@ var y:number = d;
|
|||
// valid constructors
|
||||
new Date();
|
||||
new Date(1234567890);
|
||||
new Date('2015/06/18');
|
||||
new Date(\'2015/06/18\');
|
||||
new Date(2015, 6);
|
||||
new Date(2015, 6, 18);
|
||||
new Date(2015, 6, 18, 11);
|
||||
|
@ -17,16 +17,16 @@ new Date(2015, 6, 18, 11, 55, 42, 999);
|
|||
|
||||
// invalid constructors
|
||||
new Date({});
|
||||
new Date(2015, '6');
|
||||
new Date(2015, 6, '18');
|
||||
new Date(2015, 6, 18, '11');
|
||||
new Date(2015, 6, 18, 11, '55');
|
||||
new Date(2015, 6, 18, 11, 55, '42');
|
||||
new Date(2015, 6, 18, 11, 55, 42, '999');
|
||||
new Date(2015, \'6\');
|
||||
new Date(2015, 6, \'18\');
|
||||
new Date(2015, 6, 18, \'11\');
|
||||
new Date(2015, 6, 18, 11, \'55\');
|
||||
new Date(2015, 6, 18, 11, 55, \'42\');
|
||||
new Date(2015, 6, 18, 11, 55, 42, \'999\');
|
||||
|
||||
// invalid constructors that we incorrectly consider valid
|
||||
new Date('2015', 6);
|
||||
new Date(2015, 6, 18, 11, 55, 42, 999, 'hahaha');
|
||||
new Date(\'2015\', 6);
|
||||
new Date(2015, 6, 18, 11, 55, 42, 999, \'hahaha\');
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// valid constructors
|
||||
// invalid constructors
|
||||
|
@ -36,7 +36,7 @@ var x: string = d.getTime();
|
|||
var y: number = d;
|
||||
new Date();
|
||||
new Date(1234567890);
|
||||
new Date("2015/06/18");
|
||||
new Date(\"2015/06/18\");
|
||||
new Date(2015, 6);
|
||||
new Date(2015, 6, 18);
|
||||
new Date(2015, 6, 18, 11);
|
||||
|
@ -44,13 +44,13 @@ new Date(2015, 6, 18, 11, 55);
|
|||
new Date(2015, 6, 18, 11, 55, 42);
|
||||
new Date(2015, 6, 18, 11, 55, 42, 999);
|
||||
new Date({});
|
||||
new Date(2015, "6");
|
||||
new Date(2015, 6, "18");
|
||||
new Date(2015, 6, 18, "11");
|
||||
new Date(2015, 6, 18, 11, "55");
|
||||
new Date(2015, 6, 18, 11, 55, "42");
|
||||
new Date(2015, 6, 18, 11, 55, 42, "999");
|
||||
new Date("2015", 6);
|
||||
new Date(2015, 6, 18, 11, 55, 42, 999, "hahaha");
|
||||
new Date(2015, \"6\");
|
||||
new Date(2015, 6, \"18\");
|
||||
new Date(2015, 6, 18, \"11\");
|
||||
new Date(2015, 6, 18, 11, \"55\");
|
||||
new Date(2015, 6, 18, 11, 55, \"42\");
|
||||
new Date(2015, 6, 18, 11, 55, 42, \"999\");
|
||||
new Date(\"2015\", 6);
|
||||
new Date(2015, 6, 18, 11, 55, 42, 999, \"hahaha\");
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -4,13 +4,13 @@ exports[`test ExplicitProvidesModuleDifferentName.js 1`] = `
|
|||
* @flow
|
||||
*/
|
||||
|
||||
module.exports.fun = (): string => "hello there";
|
||||
module.exports.fun = (): string => \"hello there\";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/*
|
||||
* @providesModule ExplicitProvidesModuleDifferentName
|
||||
* @flow
|
||||
*/
|
||||
module.exports.fun = (): string => "hello there";
|
||||
module.exports.fun = (): string => \"hello there\";
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -20,13 +20,13 @@ exports[`test ExplicitProvidesModuleSameName.js 1`] = `
|
|||
* @flow
|
||||
*/
|
||||
|
||||
module.exports.fun = (): string => "hello there";
|
||||
module.exports.fun = (): string => \"hello there\";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/*
|
||||
* @providesModule ExplicitProvidesModuleSameName
|
||||
* @flow
|
||||
*/
|
||||
module.exports.fun = (): string => "hello there";
|
||||
module.exports.fun = (): string => \"hello there\";
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -36,13 +36,13 @@ exports[`test ImplicitProvidesModule.js 1`] = `
|
|||
* @flow
|
||||
*/
|
||||
|
||||
module.exports.fun = (): string => "hello there";
|
||||
module.exports.fun = (): string => \"hello there\";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/*
|
||||
* @providesModule ImplicitProvidesModule
|
||||
* @flow
|
||||
*/
|
||||
module.exports.fun = (): string => "hello there";
|
||||
module.exports.fun = (): string => \"hello there\";
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -57,21 +57,21 @@ exports[`test md5.js 1`] = `
|
|||
exports[`test test.js 1`] = `
|
||||
"/* @flow */
|
||||
|
||||
var Implicit = require('ImplicitProvidesModule');
|
||||
var Implicit = require(\'ImplicitProvidesModule\');
|
||||
(Implicit.fun(): string);
|
||||
|
||||
var ExplicitSameName = require('ExplicitProvidesModuleSameName');
|
||||
var ExplicitSameName = require(\'ExplicitProvidesModuleSameName\');
|
||||
(ExplicitSameName.fun(): string);
|
||||
|
||||
var ExplicitDifferentName = require('ExplicitProvidesModuleDifferentName');
|
||||
var ExplicitDifferentName = require(\'ExplicitProvidesModuleDifferentName\');
|
||||
(ExplicitDifferentName.fun(): string);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/* @flow */
|
||||
var Implicit = require("ImplicitProvidesModule");
|
||||
var Implicit = require(\"ImplicitProvidesModule\");
|
||||
(Implicit.fun(): string);
|
||||
var ExplicitSameName = require("ExplicitProvidesModuleSameName");
|
||||
var ExplicitSameName = require(\"ExplicitProvidesModuleSameName\");
|
||||
(ExplicitSameName.fun(): string);
|
||||
var ExplicitDifferentName = require("ExplicitProvidesModuleDifferentName");
|
||||
var ExplicitDifferentName = require(\"ExplicitProvidesModuleDifferentName\");
|
||||
(ExplicitDifferentName.fun(): string);
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
exports[`test min.js 1`] = `
|
||||
"module.exports.fun = (): string => "hello there";
|
||||
"module.exports.fun = (): string => \"hello there\";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
module.exports.fun = (): string => "hello there";
|
||||
module.exports.fun = (): string => \"hello there\";
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
exports[`test nested_test.js 1`] = `
|
||||
"/* @flow */
|
||||
|
||||
var docblock = require('qux/docblock');
|
||||
var min = require('d3/min.js');
|
||||
var corge = require('qux/corge');
|
||||
var docblock = require(\'qux/docblock\');
|
||||
var min = require(\'d3/min.js\');
|
||||
var corge = require(\'qux/corge\');
|
||||
|
||||
// make sure we don't pick up non-header @providesModule
|
||||
// make sure we don\'t pick up non-header @providesModule
|
||||
// annotations - see node_modules/qux/docblock.js
|
||||
var unreachable = require('annotation');
|
||||
var unreachable = require(\'annotation\');
|
||||
|
||||
(docblock.fun(): string);
|
||||
(min.fun(): string);
|
||||
(corge.fun(): string);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/* @flow */
|
||||
// make sure we don't pick up non-header @providesModule
|
||||
// make sure we don\'t pick up non-header @providesModule
|
||||
// annotations - see node_modules/qux/docblock.js
|
||||
var docblock = require("qux/docblock");
|
||||
var min = require("d3/min.js");
|
||||
var corge = require("qux/corge");
|
||||
var unreachable = require("annotation");
|
||||
var docblock = require(\"qux/docblock\");
|
||||
var min = require(\"d3/min.js\");
|
||||
var corge = require(\"qux/corge\");
|
||||
var unreachable = require(\"annotation\");
|
||||
(docblock.fun(): string);
|
||||
(min.fun(): string);
|
||||
(corge.fun(): string);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
exports[`test client.js 1`] = `
|
||||
"var ws = require('../');
|
||||
"var ws = require(\'../\');
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
var ws = require("../");
|
||||
var ws = require(\"../\");
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -76,24 +76,24 @@ exports[`test md5.js 1`] = `
|
|||
exports[`test test.js 1`] = `
|
||||
"/* @flow */
|
||||
|
||||
var Implicit = require('ImplicitProvidesModule');
|
||||
var Implicit = require(\'ImplicitProvidesModule\');
|
||||
(Implicit.fun(): boolean); // Error: Either Implementation ~> boolean or Declaration ~> boolean
|
||||
|
||||
var ExplicitSameName = require('ExplicitProvidesModuleSameName');
|
||||
var ExplicitSameName = require(\'ExplicitProvidesModuleSameName\');
|
||||
(ExplicitSameName.fun(): boolean); // Error: Either Implementation ~> boolean or Declaration ~> boolean
|
||||
|
||||
var ExplicitDifferentName = require('ExplicitProvidesModuleDifferentName');
|
||||
var ExplicitDifferentName = require(\'ExplicitProvidesModuleDifferentName\');
|
||||
(ExplicitDifferentName.fun(): boolean); // Error: Either Implementation ~> boolean or Declaration ~> boolean
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/* @flow */
|
||||
// Error: Either Implementation ~> boolean or Declaration ~> boolean
|
||||
// Error: Either Implementation ~> boolean or Declaration ~> boolean
|
||||
// Error: Either Implementation ~> boolean or Declaration ~> boolean
|
||||
var Implicit = require("ImplicitProvidesModule");
|
||||
var Implicit = require(\"ImplicitProvidesModule\");
|
||||
(Implicit.fun(): boolean);
|
||||
var ExplicitSameName = require("ExplicitProvidesModuleSameName");
|
||||
var ExplicitSameName = require(\"ExplicitProvidesModuleSameName\");
|
||||
(ExplicitSameName.fun(): boolean);
|
||||
var ExplicitDifferentName = require("ExplicitProvidesModuleDifferentName");
|
||||
var ExplicitDifferentName = require(\"ExplicitProvidesModuleDifferentName\");
|
||||
(ExplicitDifferentName.fun(): boolean);
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
exports[`test nested_test.js 1`] = `
|
||||
"/* @flow */
|
||||
|
||||
var docblock = require('qux/docblock');
|
||||
var min = require('d3/min.js');
|
||||
var corge = require('qux/corge');
|
||||
var docblock = require(\'qux/docblock\');
|
||||
var min = require(\'d3/min.js\');
|
||||
var corge = require(\'qux/corge\');
|
||||
|
||||
(docblock.fun(): boolean); // Error: Either Implementation ~> boolean or Declaration ~> boolean
|
||||
(min.fun(): boolean); // Error: Either Implementation ~> boolean or Declaration ~> boolean
|
||||
|
@ -13,9 +13,9 @@ var corge = require('qux/corge');
|
|||
// Error: Either Implementation ~> boolean or Declaration ~> boolean
|
||||
// Error: Either Implementation ~> boolean or Declaration ~> boolean
|
||||
// Error: Either Implementation ~> boolean or Declaration ~> boolean
|
||||
var docblock = require("qux/docblock");
|
||||
var min = require("d3/min.js");
|
||||
var corge = require("qux/corge");
|
||||
var docblock = require(\"qux/docblock\");
|
||||
var min = require(\"d3/min.js\");
|
||||
var corge = require(\"qux/corge\");
|
||||
(docblock.fun(): boolean);
|
||||
(min.fun(): boolean);
|
||||
(corge.fun(): boolean);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
exports[`test client.js 1`] = `
|
||||
"var ws = require('../');
|
||||
"var ws = require(\'../\');
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
var ws = require("../");
|
||||
var ws = require(\"../\");
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -13,43 +13,43 @@ exports[`test test_absolute.js 1`] = `
|
|||
"/* @flow */
|
||||
|
||||
// This will require ./node_modules/B.js.flow
|
||||
var B1 = require('B');
|
||||
var B1 = require(\'B\');
|
||||
(B1.fun(): boolean); // Error either Implementation ~> boolean or Declaration ~> boolean
|
||||
|
||||
// This will require ./node_modules/B.js.flow
|
||||
var B2 = require('B.js');
|
||||
var B2 = require(\'B.js\');
|
||||
(B2.fun(): boolean); // Error either Implementation ~> boolean or Declaration ~> boolean
|
||||
|
||||
var C = require('package_with_full_main');
|
||||
var C = require(\'package_with_full_main\');
|
||||
(C.fun(): boolean); // Error either Implementation ~> boolean or Declaration ~> boolean
|
||||
|
||||
var D = require('package_with_partial_main');
|
||||
var D = require(\'package_with_partial_main\');
|
||||
(D.fun(): boolean); // Error either Implementation ~> boolean or Declaration ~> boolean
|
||||
|
||||
var E = require('package_with_no_package_json');
|
||||
var E = require(\'package_with_no_package_json\');
|
||||
(E.fun(): boolean); // Error either Implementation ~> boolean or Declaration ~> boolean
|
||||
|
||||
var F = require('package_with_dir_main');
|
||||
var F = require(\'package_with_dir_main\');
|
||||
(F.fun(): boolean); // Error either Implementation ~> boolean or Declaration ~> boolean
|
||||
|
||||
// This will require ./node_modules/B.js.flow
|
||||
var B1 = require('B');
|
||||
var B1 = require(\'B\');
|
||||
(B1.fun(): boolean); // Error either Implementation ~> boolean or Declaration ~> boolean
|
||||
|
||||
// This will require ./node_modules/B.js.flow
|
||||
var B2 = require('B.js');
|
||||
var B2 = require(\'B.js\');
|
||||
(B2.fun(): boolean); // Error either Implementation ~> boolean or Declaration ~> boolean
|
||||
|
||||
var C = require('package_with_full_main');
|
||||
var C = require(\'package_with_full_main\');
|
||||
(C.fun(): boolean); // Error either Implementation ~> boolean or Declaration ~> boolean
|
||||
|
||||
var D = require('package_with_partial_main');
|
||||
var D = require(\'package_with_partial_main\');
|
||||
(D.fun(): boolean); // Error either Implementation ~> boolean or Declaration ~> boolean
|
||||
|
||||
var E = require('package_with_no_package_json');
|
||||
var E = require(\'package_with_no_package_json\');
|
||||
(E.fun(): boolean); // Error either Implementation ~> boolean or Declaration ~> boolean
|
||||
|
||||
var F = require('package_with_dir_main');
|
||||
var F = require(\'package_with_dir_main\');
|
||||
(F.fun(): boolean); // Error either Implementation ~> boolean or Declaration ~> boolean
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/* @flow */
|
||||
|
@ -69,40 +69,40 @@ var F = require('package_with_dir_main');
|
|||
// Error either Implementation ~> boolean or Declaration ~> boolean
|
||||
// Error either Implementation ~> boolean or Declaration ~> boolean
|
||||
// Error either Implementation ~> boolean or Declaration ~> boolean
|
||||
var B1 = require("B");
|
||||
var B1 = require(\"B\");
|
||||
(B1.fun(): boolean);
|
||||
var B2 = require("B.js");
|
||||
var B2 = require(\"B.js\");
|
||||
(B2.fun(): boolean);
|
||||
var C = require("package_with_full_main");
|
||||
var C = require(\"package_with_full_main\");
|
||||
(C.fun(): boolean);
|
||||
var D = require("package_with_partial_main");
|
||||
var D = require(\"package_with_partial_main\");
|
||||
(D.fun(): boolean);
|
||||
var E = require("package_with_no_package_json");
|
||||
var E = require(\"package_with_no_package_json\");
|
||||
(E.fun(): boolean);
|
||||
var F = require("package_with_dir_main");
|
||||
var F = require(\"package_with_dir_main\");
|
||||
(F.fun(): boolean);
|
||||
var B1 = require("B");
|
||||
var B1 = require(\"B\");
|
||||
(B1.fun(): boolean);
|
||||
var B2 = require("B.js");
|
||||
var B2 = require(\"B.js\");
|
||||
(B2.fun(): boolean);
|
||||
var C = require("package_with_full_main");
|
||||
var C = require(\"package_with_full_main\");
|
||||
(C.fun(): boolean);
|
||||
var D = require("package_with_partial_main");
|
||||
var D = require(\"package_with_partial_main\");
|
||||
(D.fun(): boolean);
|
||||
var E = require("package_with_no_package_json");
|
||||
var E = require(\"package_with_no_package_json\");
|
||||
(E.fun(): boolean);
|
||||
var F = require("package_with_dir_main");
|
||||
var F = require(\"package_with_dir_main\");
|
||||
(F.fun(): boolean);
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`test test_relative.js 1`] = `
|
||||
"import { foo } from './A';
|
||||
"import { foo } from \'./A\';
|
||||
|
||||
(foo(): boolean); // Error: either Implementation ~> boolean or Definition ~> boolean
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Error: either Implementation ~> boolean or Definition ~> boolean
|
||||
import { foo } from "./A";
|
||||
import { foo } from \"./A\";
|
||||
(foo(): boolean);
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
exports[`test A.js 1`] = `
|
||||
"/* @flow */
|
||||
|
||||
module.exports.fun = (): string => 'hello there!';
|
||||
module.exports.fun = (): string => \'hello there!\';
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/* @flow */
|
||||
module.exports.fun = (): string => "hello there!";
|
||||
module.exports.fun = (): string => \"hello there!\";
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -21,23 +21,23 @@ exports[`test test_absolute.js 1`] = `
|
|||
"/* @flow */
|
||||
|
||||
// This will require ./node_modules/B.js.flow
|
||||
var B1 = require('B');
|
||||
var B1 = require(\'B\');
|
||||
(B1.fun(): string); // Error number ~> string
|
||||
|
||||
// This will require ./node_modules/B.js.flow
|
||||
var B2 = require('B.js');
|
||||
var B2 = require(\'B.js\');
|
||||
(B2.fun(): string); // Error number ~> string
|
||||
|
||||
var C = require('package_with_full_main');
|
||||
var C = require(\'package_with_full_main\');
|
||||
(C.fun(): string); // Error number ~> string
|
||||
|
||||
var D = require('package_with_partial_main');
|
||||
var D = require(\'package_with_partial_main\');
|
||||
(D.fun(): string); // Error number ~> string
|
||||
|
||||
var E = require('package_with_no_package_json');
|
||||
var E = require(\'package_with_no_package_json\');
|
||||
(E.fun(): string); // Error number ~> string
|
||||
|
||||
var F = require('package_with_dir_main');
|
||||
var F = require(\'package_with_dir_main\');
|
||||
(F.fun(): string); // Error number ~> string
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/* @flow */
|
||||
|
@ -49,17 +49,17 @@ var F = require('package_with_dir_main');
|
|||
// Error number ~> string
|
||||
// Error number ~> string
|
||||
// Error number ~> string
|
||||
var B1 = require("B");
|
||||
var B1 = require(\"B\");
|
||||
(B1.fun(): string);
|
||||
var B2 = require("B.js");
|
||||
var B2 = require(\"B.js\");
|
||||
(B2.fun(): string);
|
||||
var C = require("package_with_full_main");
|
||||
var C = require(\"package_with_full_main\");
|
||||
(C.fun(): string);
|
||||
var D = require("package_with_partial_main");
|
||||
var D = require(\"package_with_partial_main\");
|
||||
(D.fun(): string);
|
||||
var E = require("package_with_no_package_json");
|
||||
var E = require(\"package_with_no_package_json\");
|
||||
(E.fun(): string);
|
||||
var F = require("package_with_dir_main");
|
||||
var F = require(\"package_with_dir_main\");
|
||||
(F.fun(): string);
|
||||
"
|
||||
`;
|
||||
|
@ -68,14 +68,14 @@ exports[`test test_relative.js 1`] = `
|
|||
"/* @flow */
|
||||
|
||||
// This will require ./A.js.flow
|
||||
var A1 = require('./A');
|
||||
var A1 = require(\'./A\');
|
||||
(A1.fun(): string); // Error number ~> string
|
||||
|
||||
// This will require ./A.js.flow
|
||||
var A2 = require('./A.js');
|
||||
var A2 = require(\'./A.js\');
|
||||
(A2.fun(): string); // Error number ~> string
|
||||
|
||||
var CJS = require('./CJS.js');
|
||||
var CJS = require(\'./CJS.js\');
|
||||
(CJS: string);
|
||||
(CJS: number); // Error: string ~> number
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -85,11 +85,11 @@ var CJS = require('./CJS.js');
|
|||
// This will require ./A.js.flow
|
||||
// Error number ~> string
|
||||
// Error: string ~> number
|
||||
var A1 = require("./A");
|
||||
var A1 = require(\"./A\");
|
||||
(A1.fun(): string);
|
||||
var A2 = require("./A.js");
|
||||
var A2 = require(\"./A.js\");
|
||||
(A2.fun(): string);
|
||||
var CJS = require("./CJS.js");
|
||||
var CJS = require(\"./CJS.js\");
|
||||
(CJS: string);
|
||||
(CJS: number);
|
||||
"
|
||||
|
|
|
@ -245,13 +245,13 @@ exports[`test ES6_ExportAllFrom_Intermediary1.js 1`] = `
|
|||
* @flow
|
||||
*/
|
||||
|
||||
declare export * from "ES6_ExportAllFrom_Source1";
|
||||
declare export * from \"ES6_ExportAllFrom_Source1\";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/**
|
||||
* @providesModule ES6_ExportAllFrom_Intermediary1
|
||||
* @flow
|
||||
*/
|
||||
declare export * from "ES6_ExportAllFrom_Source1"
|
||||
declare export * from \"ES6_ExportAllFrom_Source1\"
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -261,13 +261,13 @@ exports[`test ES6_ExportAllFrom_Intermediary2.js 1`] = `
|
|||
* @flow
|
||||
*/
|
||||
|
||||
declare export * from "ES6_ExportAllFrom_Source2";
|
||||
declare export * from \"ES6_ExportAllFrom_Source2\";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/**
|
||||
* @providesModule ES6_ExportAllFrom_Intermediary2
|
||||
* @flow
|
||||
*/
|
||||
declare export * from "ES6_ExportAllFrom_Source2"
|
||||
declare export * from \"ES6_ExportAllFrom_Source2\"
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -306,12 +306,12 @@ declare export var numberValue2: number;
|
|||
exports[`test ES6_ExportAllFromMulti.js 1`] = `
|
||||
"// @flow
|
||||
|
||||
declare export * from "./ES6_ExportAllFrom_Source1";
|
||||
declare export * from "./ES6_ExportAllFrom_Source2";
|
||||
declare export * from \"./ES6_ExportAllFrom_Source1\";
|
||||
declare export * from \"./ES6_ExportAllFrom_Source2\";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
declare export * from "./ES6_ExportAllFrom_Source1"
|
||||
declare export * from "./ES6_ExportAllFrom_Source2"
|
||||
declare export * from \"./ES6_ExportAllFrom_Source1\"
|
||||
declare export * from \"./ES6_ExportAllFrom_Source2\"
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -324,13 +324,13 @@ exports[`test ES6_ExportFrom_Intermediary1.js 1`] = `
|
|||
declare export {
|
||||
numberValue1,
|
||||
numberValue2 as numberValue2_renamed
|
||||
} from "ES6_ExportFrom_Source1";
|
||||
} from \"ES6_ExportFrom_Source1\";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/**
|
||||
* @providesModule ES6_ExportFrom_Intermediary1
|
||||
* @flow
|
||||
*/
|
||||
declare export { numberValue1, numberValue2 as numberValue2_renamed } from "ES6_ExportFrom_Source1"
|
||||
declare export { numberValue1, numberValue2 as numberValue2_renamed } from \"ES6_ExportFrom_Source1\"
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -343,13 +343,13 @@ exports[`test ES6_ExportFrom_Intermediary2.js 1`] = `
|
|||
declare export {
|
||||
numberValue1,
|
||||
numberValue2 as numberValue2_renamed2
|
||||
} from "ES6_ExportFrom_Source2";
|
||||
} from \"ES6_ExportFrom_Source2\";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/**
|
||||
* @providesModule ES6_ExportFrom_Intermediary2
|
||||
* @flow
|
||||
*/
|
||||
declare export { numberValue1, numberValue2 as numberValue2_renamed2 } from "ES6_ExportFrom_Source2"
|
||||
declare export { numberValue1, numberValue2 as numberValue2_renamed2 } from \"ES6_ExportFrom_Source2\"
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -481,7 +481,7 @@ exports.numberValue1 = 42;
|
|||
exports.numberValue2 = 42;
|
||||
exports.numberValue3 = 42;
|
||||
exports.numberValue4 = 42;
|
||||
exports.stringValue = "str";
|
||||
exports.stringValue = \"str\";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/**
|
||||
* @providesModule A
|
||||
|
@ -491,7 +491,7 @@ exports.numberValue1 = 42;
|
|||
exports.numberValue2 = 42;
|
||||
exports.numberValue3 = 42;
|
||||
exports.numberValue4 = 42;
|
||||
exports.stringValue = "str";
|
||||
exports.stringValue = \"str\";
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -568,44 +568,44 @@ exports[`test es6modules.js 1`] = `
|
|||
// ===================== //
|
||||
|
||||
// @providesModule
|
||||
import * as DefaultA from "A";
|
||||
import * as DefaultA from \"A\";
|
||||
var a1: number = DefaultA.numberValue1;
|
||||
var a2: string = DefaultA.numberValue1; // Error: number ~> string
|
||||
|
||||
// File path
|
||||
import * as DefaultB from "./B";
|
||||
import * as DefaultB from \"./B\";
|
||||
var b1: number = DefaultB.numberValue;
|
||||
var b2: string = DefaultB.numberValue; // Error: number ~> string
|
||||
|
||||
// C.js exists, but not as a providesModule
|
||||
import DefaultC from "C"; // Error: No such module
|
||||
import DefaultC from \"C\"; // Error: No such module
|
||||
|
||||
// @providesModule D exists, but not as a filename
|
||||
import DefaultD from "./D"; // Error: No such module
|
||||
import DefaultD from \"./D\"; // Error: No such module
|
||||
|
||||
// ================================================ //
|
||||
// == CommonJS Clobbering Literal Exports -> ES6 == //
|
||||
// ================================================ //
|
||||
|
||||
import {doesntExist1} from "CommonJS_Clobbering_Lit"; // Error: Not an exported binding
|
||||
import {doesntExist1} from \"CommonJS_Clobbering_Lit\"; // Error: Not an exported binding
|
||||
|
||||
import {numberValue1} from "CommonJS_Clobbering_Lit";
|
||||
import {numberValue1} from \"CommonJS_Clobbering_Lit\";
|
||||
var c1: number = numberValue1;
|
||||
var c2: string = numberValue1; // Error: number ~> string
|
||||
|
||||
import {numberValue2 as numVal1} from "CommonJS_Clobbering_Lit";
|
||||
import {numberValue2 as numVal1} from \"CommonJS_Clobbering_Lit\";
|
||||
var d1: number = numVal1;
|
||||
var d2: string = numVal1; // Error: number ~> string
|
||||
|
||||
import CJS_Clobb_Lit from "CommonJS_Clobbering_Lit";
|
||||
import CJS_Clobb_Lit from \"CommonJS_Clobbering_Lit\";
|
||||
var e1: number = CJS_Clobb_Lit.numberValue3;
|
||||
var e2: string = CJS_Clobb_Lit.numberValue3; // Error: number ~> string
|
||||
CJS_Clobb_Lit.doesntExist; // Error: doesntExist isn't a property
|
||||
CJS_Clobb_Lit.doesntExist; // Error: doesntExist isn\'t a property
|
||||
|
||||
import * as CJS_Clobb_Lit_NS from "CommonJS_Clobbering_Lit";
|
||||
import * as CJS_Clobb_Lit_NS from \"CommonJS_Clobbering_Lit\";
|
||||
var f1: number = CJS_Clobb_Lit_NS.numberValue4;
|
||||
var f2: number = CJS_Clobb_Lit_NS.default.numberValue4;
|
||||
CJS_Clobb_Lit_NS.default.default; // Error: No 'default' property on the exported obj
|
||||
CJS_Clobb_Lit_NS.default.default; // Error: No \'default\' property on the exported obj
|
||||
var f3: string = CJS_Clobb_Lit_NS.numberValue4; // Error: number ~> string
|
||||
var f4: string = CJS_Clobb_Lit_NS.default.numberValue5; // Error: number ~> string
|
||||
|
||||
|
@ -613,15 +613,15 @@ var f4: string = CJS_Clobb_Lit_NS.default.numberValue5; // Error: number ~> stri
|
|||
// == CommonJS Clobbering Class Exports -> ES6 == //
|
||||
// ============================================== //
|
||||
|
||||
import {doesntExist2} from "CommonJS_Clobbering_Class"; // Error: Not an exported binding
|
||||
import {doesntExist2} from \"CommonJS_Clobbering_Class\"; // Error: Not an exported binding
|
||||
|
||||
// The following import should error because class statics are not turned into
|
||||
// named exports for now. This avoids complexities with polymorphic static
|
||||
// members (where the polymophism is defined on the class itself rather than the
|
||||
// method).
|
||||
import {staticNumber1, baseProp, childProp} from "CommonJS_Clobbering_Class"; // Error
|
||||
import {staticNumber1, baseProp, childProp} from \"CommonJS_Clobbering_Class\"; // Error
|
||||
|
||||
import CJS_Clobb_Class from "CommonJS_Clobbering_Class";
|
||||
import CJS_Clobb_Class from \"CommonJS_Clobbering_Class\";
|
||||
new CJS_Clobb_Class();
|
||||
new CJS_Clobb_Class().doesntExist; // Error: Class has no \`doesntExist\` property
|
||||
var h1: number = CJS_Clobb_Class.staticNumber2();
|
||||
|
@ -629,8 +629,8 @@ var h2: string = CJS_Clobb_Class.staticNumber2(); // Error: number ~> string
|
|||
var h3: number = new CJS_Clobb_Class().instNumber1();
|
||||
var h4: string = new CJS_Clobb_Class().instNumber1(); // Error: number ~> string
|
||||
|
||||
import * as CJS_Clobb_Class_NS from "CommonJS_Clobbering_Class";
|
||||
new CJS_Clobb_Class_NS(); // Error: Namespace object isn't constructable
|
||||
import * as CJS_Clobb_Class_NS from \"CommonJS_Clobbering_Class\";
|
||||
new CJS_Clobb_Class_NS(); // Error: Namespace object isn\'t constructable
|
||||
var i1: number = CJS_Clobb_Class_NS.staticNumber3(); // Error: Class statics not copied to Namespace object
|
||||
var i2: number = new CJS_Clobb_Class_NS.default().instNumber2();
|
||||
var i3: string = new CJS_Clobb_Class_NS.default().instNumber2(); // Error: number ~> string
|
||||
|
@ -639,22 +639,22 @@ var i3: string = new CJS_Clobb_Class_NS.default().instNumber2(); // Error: numbe
|
|||
// == CommonJS Named Exports -> ES6 == //
|
||||
// =================================== //
|
||||
|
||||
import {doesntExist3} from "CommonJS_Named"; // Error: Not an exported binding
|
||||
import {doesntExist3} from \"CommonJS_Named\"; // Error: Not an exported binding
|
||||
|
||||
import {numberValue2} from "CommonJS_Named";
|
||||
import {numberValue2} from \"CommonJS_Named\";
|
||||
var j1: number = numberValue2;
|
||||
var j2: string = numberValue2; // Error: number ~> string
|
||||
|
||||
import {numberValue3 as numVal3} from "CommonJS_Named";
|
||||
import {numberValue3 as numVal3} from \"CommonJS_Named\";
|
||||
var k1: number = numVal3;
|
||||
var k2: string = numVal3; // Error: number ~> string
|
||||
|
||||
import * as CJS_Named from "CommonJS_Named";
|
||||
import * as CJS_Named from \"CommonJS_Named\";
|
||||
var l1: number = CJS_Named.numberValue1;
|
||||
var l2: string = CJS_Named.numberValue1; // Error: number ~> string
|
||||
CJS_Named.doesntExist; // Error: doesntExist isn't a property
|
||||
CJS_Named.doesntExist; // Error: doesntExist isn\'t a property
|
||||
|
||||
import * as CJS_Named_NS from "CommonJS_Named";
|
||||
import * as CJS_Named_NS from \"CommonJS_Named\";
|
||||
var m1: number = CJS_Named_NS.numberValue4;
|
||||
var m2: string = CJS_Named_NS.default.numberValue4; // Error: CommonJS_Named has no default export
|
||||
var m3: string = CJS_Named_NS.numberValue4; // Error: number ~> string
|
||||
|
@ -663,13 +663,13 @@ var m3: string = CJS_Named_NS.numberValue4; // Error: number ~> string
|
|||
// == ES6 Default -> ES6 == //
|
||||
//////////////////////////////
|
||||
|
||||
import {doesntExist4} from "ES6_Default_AnonFunction1"; // Error: Not an exported binding
|
||||
import {doesntExist4} from \"ES6_Default_AnonFunction1\"; // Error: Not an exported binding
|
||||
|
||||
import ES6_Def_AnonFunc1 from "ES6_Default_AnonFunction1";
|
||||
import ES6_Def_AnonFunc1 from \"ES6_Default_AnonFunction1\";
|
||||
var n1: number = ES6_Def_AnonFunc1();
|
||||
var n2: string = ES6_Def_AnonFunc1(); // Error: number ~> string
|
||||
|
||||
import ES6_Def_NamedFunc1 from "ES6_Default_NamedFunction1";
|
||||
import ES6_Def_NamedFunc1 from \"ES6_Default_NamedFunction1\";
|
||||
var o1: number = ES6_Def_NamedFunc1();
|
||||
var o2: string = ES6_Def_NamedFunc1(); // Error: number ~> string
|
||||
|
||||
|
@ -677,7 +677,7 @@ var o2: string = ES6_Def_NamedFunc1(); // Error: number ~> string
|
|||
|
||||
|
||||
|
||||
import ES6_Def_NamedClass1 from "ES6_Default_NamedClass1";
|
||||
import ES6_Def_NamedClass1 from \"ES6_Default_NamedClass1\";
|
||||
var q1: number = new ES6_Def_NamedClass1().givesANum();
|
||||
var q2: string = new ES6_Def_NamedClass1().givesANum(); // Error: number ~> string
|
||||
|
||||
|
@ -685,35 +685,35 @@ var q2: string = new ES6_Def_NamedClass1().givesANum(); // Error: number ~> stri
|
|||
// == ES6 Named -> ES6 == //
|
||||
////////////////////////////
|
||||
|
||||
import doesntExist5 from "ES6_Named1"; // Error: Not an exported binding
|
||||
import doesntExist5 from \"ES6_Named1\"; // Error: Not an exported binding
|
||||
|
||||
import {specifierNumber1 as specifierNumber1_1} from "ES6_Named1";
|
||||
import {specifierNumber1 as specifierNumber1_1} from \"ES6_Named1\";
|
||||
var r1: number = specifierNumber1_1;
|
||||
var r2: string = specifierNumber1_1; // Error: number ~> string
|
||||
|
||||
import {specifierNumber2Renamed} from "ES6_Named1";
|
||||
import {specifierNumber2Renamed} from \"ES6_Named1\";
|
||||
var s1: number = specifierNumber2Renamed;
|
||||
var s2: string = specifierNumber2Renamed; // Error: number ~> string
|
||||
|
||||
import {specifierNumber3 as specifierNumber3Renamed} from "ES6_Named1";
|
||||
import {specifierNumber3 as specifierNumber3Renamed} from \"ES6_Named1\";
|
||||
var t1: number = specifierNumber3Renamed;
|
||||
var t2: string = specifierNumber3Renamed; // Error: number ~> string
|
||||
|
||||
import {groupedSpecifierNumber1, groupedSpecifierNumber2} from "ES6_Named1";
|
||||
import {groupedSpecifierNumber1, groupedSpecifierNumber2} from \"ES6_Named1\";
|
||||
var u1: number = groupedSpecifierNumber1;
|
||||
var u2: number = groupedSpecifierNumber2;
|
||||
var u3: string = groupedSpecifierNumber1; // Error: number ~> string
|
||||
var u4: string = groupedSpecifierNumber2; // Error: number ~> string
|
||||
|
||||
import {givesANumber} from "ES6_Named1";
|
||||
import {givesANumber} from \"ES6_Named1\";
|
||||
var v1: number = givesANumber();
|
||||
var v2: string = givesANumber(); // Error: number ~> string
|
||||
|
||||
import {NumberGenerator} from "ES6_Named1";
|
||||
import {NumberGenerator} from \"ES6_Named1\";
|
||||
var w1: number = new NumberGenerator().givesANumber();
|
||||
var w2: string = new NumberGenerator().givesANumber(); // Error: number ~> string
|
||||
|
||||
import {varDeclNumber1, varDeclNumber2} from "ES6_Named1";
|
||||
import {varDeclNumber1, varDeclNumber2} from \"ES6_Named1\";
|
||||
var x1: number = varDeclNumber1;
|
||||
var x2: number = varDeclNumber2;
|
||||
var x3: string = varDeclNumber1; // Error: number ~> string
|
||||
|
@ -727,15 +727,15 @@ var x4: string = varDeclNumber2; // Error: number ~> string
|
|||
|
||||
|
||||
|
||||
import {numberValue1 as numberValue4} from "ES6_ExportFrom_Intermediary1";
|
||||
import {numberValue1 as numberValue4} from \"ES6_ExportFrom_Intermediary1\";
|
||||
var aa1: number = numberValue4;
|
||||
var aa2: string = numberValue4; // Error: number ~> string
|
||||
|
||||
import {numberValue2_renamed} from "ES6_ExportFrom_Intermediary1";
|
||||
import {numberValue2_renamed} from \"ES6_ExportFrom_Intermediary1\";
|
||||
var ab1: number = numberValue2_renamed;
|
||||
var ab2: string = numberValue2_renamed; // Error: number ~> string
|
||||
|
||||
import {numberValue1 as numberValue5} from "ES6_ExportAllFrom_Intermediary1";
|
||||
import {numberValue1 as numberValue5} from \"ES6_ExportAllFrom_Intermediary1\";
|
||||
var ac1: number = numberValue5;
|
||||
var ac2: string = numberValue5; // Error: number ~> string
|
||||
|
||||
|
@ -743,13 +743,13 @@ var ac2: string = numberValue5; // Error: number ~> string
|
|||
// == ES6 Default -> CommonJS == //
|
||||
///////////////////////////////////
|
||||
|
||||
require('ES6_Default_AnonFunction2').doesntExist; // Error: 'doesntExist' isn't an export
|
||||
require(\'ES6_Default_AnonFunction2\').doesntExist; // Error: \'doesntExist\' isn\'t an export
|
||||
|
||||
var ES6_Def_AnonFunc2 = require("ES6_Default_AnonFunction2").default;
|
||||
var ES6_Def_AnonFunc2 = require(\"ES6_Default_AnonFunction2\").default;
|
||||
var ad1: number = ES6_Def_AnonFunc2();
|
||||
var ad2: string = ES6_Def_AnonFunc2(); // Error: number ~> string
|
||||
|
||||
var ES6_Def_NamedFunc2 = require("ES6_Default_NamedFunction2").default;
|
||||
var ES6_Def_NamedFunc2 = require(\"ES6_Default_NamedFunction2\").default;
|
||||
var ae1: number = ES6_Def_NamedFunc2();
|
||||
var ae2: string = ES6_Def_NamedFunc2(); // Error: number ~> string
|
||||
|
||||
|
@ -757,7 +757,7 @@ var ae2: string = ES6_Def_NamedFunc2(); // Error: number ~> string
|
|||
|
||||
|
||||
|
||||
var ES6_Def_NamedClass2 = require("ES6_Default_NamedClass2").default;
|
||||
var ES6_Def_NamedClass2 = require(\"ES6_Default_NamedClass2\").default;
|
||||
var ag1: number = new ES6_Def_NamedClass2().givesANum();
|
||||
var ag2: string = new ES6_Def_NamedClass2().givesANum(); // Error: number ~> string
|
||||
|
||||
|
@ -765,31 +765,31 @@ var ag2: string = new ES6_Def_NamedClass2().givesANum(); // Error: number ~> str
|
|||
// == ES6 Named -> CommonJS == //
|
||||
/////////////////////////////////
|
||||
|
||||
var specifierNumber4 = require("ES6_Named2").specifierNumber4;
|
||||
var specifierNumber4 = require(\"ES6_Named2\").specifierNumber4;
|
||||
var ah1: number = specifierNumber4;
|
||||
var ah2: string = specifierNumber4; // Error: number ~> string
|
||||
|
||||
var specifierNumber5Renamed = require("ES6_Named2").specifierNumber5Renamed;
|
||||
var specifierNumber5Renamed = require(\"ES6_Named2\").specifierNumber5Renamed;
|
||||
var ai1: number = specifierNumber5Renamed;
|
||||
var ai2: string = specifierNumber5Renamed; // Error: number ~> string
|
||||
|
||||
var groupedSpecifierNumber3 = require("ES6_Named2").groupedSpecifierNumber3;
|
||||
var groupedSpecifierNumber4 = require("ES6_Named2").groupedSpecifierNumber4;
|
||||
var groupedSpecifierNumber3 = require(\"ES6_Named2\").groupedSpecifierNumber3;
|
||||
var groupedSpecifierNumber4 = require(\"ES6_Named2\").groupedSpecifierNumber4;
|
||||
var aj1: number = groupedSpecifierNumber3;
|
||||
var aj2: number = groupedSpecifierNumber4;
|
||||
var aj3: string = groupedSpecifierNumber3; // Error: number ~> string
|
||||
var aj4: string = groupedSpecifierNumber4; // Error: number ~> string
|
||||
|
||||
var givesANumber2 = require("ES6_Named2").givesANumber2;
|
||||
var givesANumber2 = require(\"ES6_Named2\").givesANumber2;
|
||||
var ak1: number = givesANumber2();
|
||||
var ak2: string = givesANumber2(); // Error: number ~> string
|
||||
|
||||
var NumberGenerator2 = require("ES6_Named2").NumberGenerator2;
|
||||
var NumberGenerator2 = require(\"ES6_Named2\").NumberGenerator2;
|
||||
var al1: number = new NumberGenerator2().givesANumber();
|
||||
var al2: string = new NumberGenerator2().givesANumber(); // Error: number ~> string
|
||||
|
||||
var varDeclNumber3 = require("ES6_Named2").varDeclNumber3;
|
||||
var varDeclNumber4 = require("ES6_Named2").varDeclNumber4;
|
||||
var varDeclNumber3 = require(\"ES6_Named2\").varDeclNumber3;
|
||||
var varDeclNumber4 = require(\"ES6_Named2\").varDeclNumber4;
|
||||
var am1: number = varDeclNumber3;
|
||||
var am2: number = varDeclNumber4;
|
||||
var am3: string = varDeclNumber3; // Error: number ~> string
|
||||
|
@ -803,15 +803,15 @@ var am4: string = varDeclNumber4; // Error: number ~> string
|
|||
|
||||
|
||||
|
||||
var numberValue6 = require("ES6_ExportFrom_Intermediary2").numberValue1;
|
||||
var numberValue6 = require(\"ES6_ExportFrom_Intermediary2\").numberValue1;
|
||||
var ap1: number = numberValue6;
|
||||
var ap2: string = numberValue6; // Error: number ~> string
|
||||
|
||||
var numberValue2_renamed2 = require("ES6_ExportFrom_Intermediary2").numberValue2_renamed2;
|
||||
var numberValue2_renamed2 = require(\"ES6_ExportFrom_Intermediary2\").numberValue2_renamed2;
|
||||
var aq1: number = numberValue2_renamed2;
|
||||
var aq2: string = numberValue2_renamed2; // Error: number ~> string
|
||||
|
||||
var numberValue7 = require("ES6_ExportAllFrom_Intermediary2").numberValue2;
|
||||
var numberValue7 = require(\"ES6_ExportAllFrom_Intermediary2\").numberValue2;
|
||||
var ar1: number = numberValue7;
|
||||
var ar2: string = numberValue7; // Error: number ~> string
|
||||
|
||||
|
@ -819,7 +819,7 @@ var ar2: string = numberValue7; // Error: number ~> string
|
|||
// == ES6 Default+Named -> ES6 import Default+Named== //
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
import defaultNum, {str as namedStr} from "./ES6_DefaultAndNamed";
|
||||
import defaultNum, {str as namedStr} from \"./ES6_DefaultAndNamed\";
|
||||
|
||||
var as1: number = defaultNum;
|
||||
var as2: string = defaultNum; // Error: number ~> string
|
||||
|
@ -831,13 +831,13 @@ var as4: number = namedStr; // Error: string ~> number
|
|||
// == Side-effect only ES6 imports == //
|
||||
////////////////////////////////////////
|
||||
|
||||
import "./SideEffects";
|
||||
import \"./SideEffects\";
|
||||
|
||||
//////////////////////////////////////////////
|
||||
// == Suggest export name on likely typo == //
|
||||
//////////////////////////////////////////////
|
||||
import specifierNumber1 from "ES6_Named1"; // Error: Did you mean \`import {specifierNumber1} from ...\`?
|
||||
import {specifierNumber} from "ES6_Named1"; // Error: Did you mean \`specifierNumber1\`?
|
||||
import specifierNumber1 from \"ES6_Named1\"; // Error: Did you mean \`import {specifierNumber1} from ...\`?
|
||||
import {specifierNumber} from \"ES6_Named1\"; // Error: Did you mean \`specifierNumber1\`?
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
// == Multi \`export *\` should combine exports == //
|
||||
|
@ -845,7 +845,7 @@ import {specifierNumber} from "ES6_Named1"; // Error: Did you mean \`specifierNu
|
|||
import {
|
||||
numberValue1 as numberValue8,
|
||||
numberValue2 as numberValue9
|
||||
} from "./ES6_ExportAllFromMulti";
|
||||
} from \"./ES6_ExportAllFromMulti\";
|
||||
|
||||
var at1: number = numberValue8;
|
||||
var at2: string = numberValue8; // Error: number ~> string
|
||||
|
@ -872,8 +872,8 @@ var at4: string = numberValue9; // Error: number ~> string
|
|||
// Error: number ~> string
|
||||
// Error: number ~> string
|
||||
// Error: number ~> string
|
||||
// Error: doesntExist isn't a property
|
||||
// Error: No 'default' property on the exported obj
|
||||
// Error: doesntExist isn\'t a property
|
||||
// Error: No \'default\' property on the exported obj
|
||||
// Error: number ~> string
|
||||
// Error: number ~> string
|
||||
// ============================================== //
|
||||
|
@ -888,7 +888,7 @@ var at4: string = numberValue9; // Error: number ~> string
|
|||
// Error: Class has no \`doesntExist\` property
|
||||
// Error: number ~> string
|
||||
// Error: number ~> string
|
||||
// Error: Namespace object isn't constructable
|
||||
// Error: Namespace object isn\'t constructable
|
||||
// Error: Class statics not copied to Namespace object
|
||||
// Error: number ~> string
|
||||
// =================================== //
|
||||
|
@ -898,7 +898,7 @@ var at4: string = numberValue9; // Error: number ~> string
|
|||
// Error: number ~> string
|
||||
// Error: number ~> string
|
||||
// Error: number ~> string
|
||||
// Error: doesntExist isn't a property
|
||||
// Error: doesntExist isn\'t a property
|
||||
// Error: CommonJS_Named has no default export
|
||||
// Error: number ~> string
|
||||
//////////////////////////////
|
||||
|
@ -927,7 +927,7 @@ var at4: string = numberValue9; // Error: number ~> string
|
|||
///////////////////////////////////
|
||||
// == ES6 Default -> CommonJS == //
|
||||
///////////////////////////////////
|
||||
// Error: 'doesntExist' isn't an export
|
||||
// Error: \'doesntExist\' isn\'t an export
|
||||
// Error: number ~> string
|
||||
// Error: number ~> string
|
||||
// Error: number ~> string
|
||||
|
@ -963,159 +963,159 @@ var at4: string = numberValue9; // Error: number ~> string
|
|||
///////////////////////////////////////////////////
|
||||
// Error: number ~> string
|
||||
// Error: number ~> string
|
||||
import * as DefaultA from "A";
|
||||
import * as DefaultA from \"A\";
|
||||
var a1: number = DefaultA.numberValue1;
|
||||
var a2: string = DefaultA.numberValue1;
|
||||
import * as DefaultB from "./B";
|
||||
import * as DefaultB from \"./B\";
|
||||
var b1: number = DefaultB.numberValue;
|
||||
var b2: string = DefaultB.numberValue;
|
||||
import DefaultC from "C";
|
||||
import DefaultD from "./D";
|
||||
import { doesntExist1 } from "CommonJS_Clobbering_Lit";
|
||||
import { numberValue1 } from "CommonJS_Clobbering_Lit";
|
||||
import DefaultC from \"C\";
|
||||
import DefaultD from \"./D\";
|
||||
import { doesntExist1 } from \"CommonJS_Clobbering_Lit\";
|
||||
import { numberValue1 } from \"CommonJS_Clobbering_Lit\";
|
||||
var c1: number = numberValue1;
|
||||
var c2: string = numberValue1;
|
||||
import { numberValue2 as numVal1 } from "CommonJS_Clobbering_Lit";
|
||||
import { numberValue2 as numVal1 } from \"CommonJS_Clobbering_Lit\";
|
||||
var d1: number = numVal1;
|
||||
var d2: string = numVal1;
|
||||
import CJS_Clobb_Lit from "CommonJS_Clobbering_Lit";
|
||||
import CJS_Clobb_Lit from \"CommonJS_Clobbering_Lit\";
|
||||
var e1: number = CJS_Clobb_Lit.numberValue3;
|
||||
var e2: string = CJS_Clobb_Lit.numberValue3;
|
||||
CJS_Clobb_Lit.doesntExist;
|
||||
import * as CJS_Clobb_Lit_NS from "CommonJS_Clobbering_Lit";
|
||||
import * as CJS_Clobb_Lit_NS from \"CommonJS_Clobbering_Lit\";
|
||||
var f1: number = CJS_Clobb_Lit_NS.numberValue4;
|
||||
var f2: number = CJS_Clobb_Lit_NS.default.numberValue4;
|
||||
CJS_Clobb_Lit_NS.default.default;
|
||||
var f3: string = CJS_Clobb_Lit_NS.numberValue4;
|
||||
var f4: string = CJS_Clobb_Lit_NS.default.numberValue5;
|
||||
import { doesntExist2 } from "CommonJS_Clobbering_Class";
|
||||
import { staticNumber1, baseProp, childProp } from "CommonJS_Clobbering_Class";
|
||||
import CJS_Clobb_Class from "CommonJS_Clobbering_Class";
|
||||
import { doesntExist2 } from \"CommonJS_Clobbering_Class\";
|
||||
import { staticNumber1, baseProp, childProp } from \"CommonJS_Clobbering_Class\";
|
||||
import CJS_Clobb_Class from \"CommonJS_Clobbering_Class\";
|
||||
new CJS_Clobb_Class();
|
||||
new CJS_Clobb_Class().doesntExist;
|
||||
var h1: number = CJS_Clobb_Class.staticNumber2();
|
||||
var h2: string = CJS_Clobb_Class.staticNumber2();
|
||||
var h3: number = new CJS_Clobb_Class().instNumber1();
|
||||
var h4: string = new CJS_Clobb_Class().instNumber1();
|
||||
import * as CJS_Clobb_Class_NS from "CommonJS_Clobbering_Class";
|
||||
import * as CJS_Clobb_Class_NS from \"CommonJS_Clobbering_Class\";
|
||||
new CJS_Clobb_Class_NS();
|
||||
var i1: number = CJS_Clobb_Class_NS.staticNumber3();
|
||||
var i2: number = new CJS_Clobb_Class_NS.default().instNumber2();
|
||||
var i3: string = new CJS_Clobb_Class_NS.default().instNumber2();
|
||||
import { doesntExist3 } from "CommonJS_Named";
|
||||
import { numberValue2 } from "CommonJS_Named";
|
||||
import { doesntExist3 } from \"CommonJS_Named\";
|
||||
import { numberValue2 } from \"CommonJS_Named\";
|
||||
var j1: number = numberValue2;
|
||||
var j2: string = numberValue2;
|
||||
import { numberValue3 as numVal3 } from "CommonJS_Named";
|
||||
import { numberValue3 as numVal3 } from \"CommonJS_Named\";
|
||||
var k1: number = numVal3;
|
||||
var k2: string = numVal3;
|
||||
import * as CJS_Named from "CommonJS_Named";
|
||||
import * as CJS_Named from \"CommonJS_Named\";
|
||||
var l1: number = CJS_Named.numberValue1;
|
||||
var l2: string = CJS_Named.numberValue1;
|
||||
CJS_Named.doesntExist;
|
||||
import * as CJS_Named_NS from "CommonJS_Named";
|
||||
import * as CJS_Named_NS from \"CommonJS_Named\";
|
||||
var m1: number = CJS_Named_NS.numberValue4;
|
||||
var m2: string = CJS_Named_NS.default.numberValue4;
|
||||
var m3: string = CJS_Named_NS.numberValue4;
|
||||
import { doesntExist4 } from "ES6_Default_AnonFunction1";
|
||||
import ES6_Def_AnonFunc1 from "ES6_Default_AnonFunction1";
|
||||
import { doesntExist4 } from \"ES6_Default_AnonFunction1\";
|
||||
import ES6_Def_AnonFunc1 from \"ES6_Default_AnonFunction1\";
|
||||
var n1: number = ES6_Def_AnonFunc1();
|
||||
var n2: string = ES6_Def_AnonFunc1();
|
||||
import ES6_Def_NamedFunc1 from "ES6_Default_NamedFunction1";
|
||||
import ES6_Def_NamedFunc1 from \"ES6_Default_NamedFunction1\";
|
||||
var o1: number = ES6_Def_NamedFunc1();
|
||||
var o2: string = ES6_Def_NamedFunc1();
|
||||
import ES6_Def_NamedClass1 from "ES6_Default_NamedClass1";
|
||||
import ES6_Def_NamedClass1 from \"ES6_Default_NamedClass1\";
|
||||
var q1: number = new ES6_Def_NamedClass1().givesANum();
|
||||
var q2: string = new ES6_Def_NamedClass1().givesANum();
|
||||
import doesntExist5 from "ES6_Named1";
|
||||
import { specifierNumber1 as specifierNumber1_1 } from "ES6_Named1";
|
||||
import doesntExist5 from \"ES6_Named1\";
|
||||
import { specifierNumber1 as specifierNumber1_1 } from \"ES6_Named1\";
|
||||
var r1: number = specifierNumber1_1;
|
||||
var r2: string = specifierNumber1_1;
|
||||
import { specifierNumber2Renamed } from "ES6_Named1";
|
||||
import { specifierNumber2Renamed } from \"ES6_Named1\";
|
||||
var s1: number = specifierNumber2Renamed;
|
||||
var s2: string = specifierNumber2Renamed;
|
||||
import { specifierNumber3 as specifierNumber3Renamed } from "ES6_Named1";
|
||||
import { specifierNumber3 as specifierNumber3Renamed } from \"ES6_Named1\";
|
||||
var t1: number = specifierNumber3Renamed;
|
||||
var t2: string = specifierNumber3Renamed;
|
||||
import { groupedSpecifierNumber1, groupedSpecifierNumber2 } from "ES6_Named1";
|
||||
import { groupedSpecifierNumber1, groupedSpecifierNumber2 } from \"ES6_Named1\";
|
||||
var u1: number = groupedSpecifierNumber1;
|
||||
var u2: number = groupedSpecifierNumber2;
|
||||
var u3: string = groupedSpecifierNumber1;
|
||||
var u4: string = groupedSpecifierNumber2;
|
||||
import { givesANumber } from "ES6_Named1";
|
||||
import { givesANumber } from \"ES6_Named1\";
|
||||
var v1: number = givesANumber();
|
||||
var v2: string = givesANumber();
|
||||
import { NumberGenerator } from "ES6_Named1";
|
||||
import { NumberGenerator } from \"ES6_Named1\";
|
||||
var w1: number = new NumberGenerator().givesANumber();
|
||||
var w2: string = new NumberGenerator().givesANumber();
|
||||
import { varDeclNumber1, varDeclNumber2 } from "ES6_Named1";
|
||||
import { varDeclNumber1, varDeclNumber2 } from \"ES6_Named1\";
|
||||
var x1: number = varDeclNumber1;
|
||||
var x2: number = varDeclNumber2;
|
||||
var x3: string = varDeclNumber1;
|
||||
var x4: string = varDeclNumber2;
|
||||
import { numberValue1 as numberValue4 } from "ES6_ExportFrom_Intermediary1";
|
||||
import { numberValue1 as numberValue4 } from \"ES6_ExportFrom_Intermediary1\";
|
||||
var aa1: number = numberValue4;
|
||||
var aa2: string = numberValue4;
|
||||
import { numberValue2_renamed } from "ES6_ExportFrom_Intermediary1";
|
||||
import { numberValue2_renamed } from \"ES6_ExportFrom_Intermediary1\";
|
||||
var ab1: number = numberValue2_renamed;
|
||||
var ab2: string = numberValue2_renamed;
|
||||
import { numberValue1 as numberValue5 } from "ES6_ExportAllFrom_Intermediary1";
|
||||
import { numberValue1 as numberValue5 } from \"ES6_ExportAllFrom_Intermediary1\";
|
||||
var ac1: number = numberValue5;
|
||||
var ac2: string = numberValue5;
|
||||
require("ES6_Default_AnonFunction2").doesntExist;
|
||||
var ES6_Def_AnonFunc2 = require("ES6_Default_AnonFunction2").default;
|
||||
require(\"ES6_Default_AnonFunction2\").doesntExist;
|
||||
var ES6_Def_AnonFunc2 = require(\"ES6_Default_AnonFunction2\").default;
|
||||
var ad1: number = ES6_Def_AnonFunc2();
|
||||
var ad2: string = ES6_Def_AnonFunc2();
|
||||
var ES6_Def_NamedFunc2 = require("ES6_Default_NamedFunction2").default;
|
||||
var ES6_Def_NamedFunc2 = require(\"ES6_Default_NamedFunction2\").default;
|
||||
var ae1: number = ES6_Def_NamedFunc2();
|
||||
var ae2: string = ES6_Def_NamedFunc2();
|
||||
var ES6_Def_NamedClass2 = require("ES6_Default_NamedClass2").default;
|
||||
var ES6_Def_NamedClass2 = require(\"ES6_Default_NamedClass2\").default;
|
||||
var ag1: number = new ES6_Def_NamedClass2().givesANum();
|
||||
var ag2: string = new ES6_Def_NamedClass2().givesANum();
|
||||
var specifierNumber4 = require("ES6_Named2").specifierNumber4;
|
||||
var specifierNumber4 = require(\"ES6_Named2\").specifierNumber4;
|
||||
var ah1: number = specifierNumber4;
|
||||
var ah2: string = specifierNumber4;
|
||||
var specifierNumber5Renamed = require("ES6_Named2").specifierNumber5Renamed;
|
||||
var specifierNumber5Renamed = require(\"ES6_Named2\").specifierNumber5Renamed;
|
||||
var ai1: number = specifierNumber5Renamed;
|
||||
var ai2: string = specifierNumber5Renamed;
|
||||
var groupedSpecifierNumber3 = require("ES6_Named2").groupedSpecifierNumber3;
|
||||
var groupedSpecifierNumber4 = require("ES6_Named2").groupedSpecifierNumber4;
|
||||
var groupedSpecifierNumber3 = require(\"ES6_Named2\").groupedSpecifierNumber3;
|
||||
var groupedSpecifierNumber4 = require(\"ES6_Named2\").groupedSpecifierNumber4;
|
||||
var aj1: number = groupedSpecifierNumber3;
|
||||
var aj2: number = groupedSpecifierNumber4;
|
||||
var aj3: string = groupedSpecifierNumber3;
|
||||
var aj4: string = groupedSpecifierNumber4;
|
||||
var givesANumber2 = require("ES6_Named2").givesANumber2;
|
||||
var givesANumber2 = require(\"ES6_Named2\").givesANumber2;
|
||||
var ak1: number = givesANumber2();
|
||||
var ak2: string = givesANumber2();
|
||||
var NumberGenerator2 = require("ES6_Named2").NumberGenerator2;
|
||||
var NumberGenerator2 = require(\"ES6_Named2\").NumberGenerator2;
|
||||
var al1: number = new NumberGenerator2().givesANumber();
|
||||
var al2: string = new NumberGenerator2().givesANumber();
|
||||
var varDeclNumber3 = require("ES6_Named2").varDeclNumber3;
|
||||
var varDeclNumber4 = require("ES6_Named2").varDeclNumber4;
|
||||
var varDeclNumber3 = require(\"ES6_Named2\").varDeclNumber3;
|
||||
var varDeclNumber4 = require(\"ES6_Named2\").varDeclNumber4;
|
||||
var am1: number = varDeclNumber3;
|
||||
var am2: number = varDeclNumber4;
|
||||
var am3: string = varDeclNumber3;
|
||||
var am4: string = varDeclNumber4;
|
||||
var numberValue6 = require("ES6_ExportFrom_Intermediary2").numberValue1;
|
||||
var numberValue6 = require(\"ES6_ExportFrom_Intermediary2\").numberValue1;
|
||||
var ap1: number = numberValue6;
|
||||
var ap2: string = numberValue6;
|
||||
var numberValue2_renamed2 = require(
|
||||
"ES6_ExportFrom_Intermediary2"
|
||||
\"ES6_ExportFrom_Intermediary2\"
|
||||
).numberValue2_renamed2;
|
||||
var aq1: number = numberValue2_renamed2;
|
||||
var aq2: string = numberValue2_renamed2;
|
||||
var numberValue7 = require("ES6_ExportAllFrom_Intermediary2").numberValue2;
|
||||
var numberValue7 = require(\"ES6_ExportAllFrom_Intermediary2\").numberValue2;
|
||||
var ar1: number = numberValue7;
|
||||
var ar2: string = numberValue7;
|
||||
import defaultNum, { str as namedStr } from "./ES6_DefaultAndNamed";
|
||||
import defaultNum, { str as namedStr } from \"./ES6_DefaultAndNamed\";
|
||||
var as1: number = defaultNum;
|
||||
var as2: string = defaultNum;
|
||||
var as3: string = namedStr;
|
||||
var as4: number = namedStr;
|
||||
import "./SideEffects";
|
||||
import specifierNumber1 from "ES6_Named1";
|
||||
import { specifierNumber } from "ES6_Named1";
|
||||
import { numberValue1 as numberValue8, numberValue2 as numberValue9 } from "./ES6_ExportAllFromMulti";
|
||||
import \"./SideEffects\";
|
||||
import specifierNumber1 from \"ES6_Named1\";
|
||||
import { specifierNumber } from \"ES6_Named1\";
|
||||
import { numberValue1 as numberValue8, numberValue2 as numberValue9 } from \"./ES6_ExportAllFromMulti\";
|
||||
var at1: number = numberValue8;
|
||||
var at2: string = numberValue8;
|
||||
var at3: number = numberValue9;
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
exports[`test main.js 1`] = `
|
||||
"// @flow
|
||||
|
||||
import declare_module_exports from "declare_module_exports";
|
||||
import declare_module_exports from \"declare_module_exports\";
|
||||
(declare_module_exports: number);
|
||||
(declare_module_exports: string); // Error: number ~> string
|
||||
|
||||
// Error: Has no named export "str"!
|
||||
import {str} from "declare_m_e_with_other_value_declares";
|
||||
// Error: Has no named export \"str\"!
|
||||
import {str} from \"declare_m_e_with_other_value_declares\";
|
||||
|
||||
import type {str2} from "declare_m_e_with_other_type_declares";
|
||||
("asdf": str2);
|
||||
import type {str2} from \"declare_m_e_with_other_type_declares\";
|
||||
(\"asdf\": str2);
|
||||
(42: str2); // Error: number ~> string
|
||||
|
||||
/**
|
||||
|
@ -17,17 +17,17 @@ import type {str2} from "declare_m_e_with_other_type_declares";
|
|||
* syntaxes will work.
|
||||
*/
|
||||
|
||||
import DEPRECATED__declare_var_exports from "DEPRECATED__declare_var_exports";
|
||||
import DEPRECATED__declare_var_exports from \"DEPRECATED__declare_var_exports\";
|
||||
(DEPRECATED__declare_var_exports: number);
|
||||
(DEPRECATED__declare_var_exports: string); // Error: number ~> string
|
||||
|
||||
import declare_m_e_with_declare_var_e from "declare_m_e_with_declare_var_e";
|
||||
import declare_m_e_with_declare_var_e from \"declare_m_e_with_declare_var_e\";
|
||||
(declare_m_e_with_declare_var_e: number);
|
||||
(declare_m_e_with_declare_var_e: string); // Error: number ~> string
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
// Error: number ~> string
|
||||
// Error: Has no named export "str"!
|
||||
// Error: Has no named export \"str\"!
|
||||
// Error: number ~> string
|
||||
/**
|
||||
* \`declare var exports\` is deprecated, so we have a grace period where both
|
||||
|
@ -35,17 +35,17 @@ import declare_m_e_with_declare_var_e from "declare_m_e_with_declare_var_e";
|
|||
*/
|
||||
// Error: number ~> string
|
||||
// Error: number ~> string
|
||||
import declare_module_exports from "declare_module_exports";
|
||||
import declare_module_exports from \"declare_module_exports\";
|
||||
(declare_module_exports: number);
|
||||
(declare_module_exports: string);
|
||||
import { str } from "declare_m_e_with_other_value_declares";
|
||||
import type { str2 } from "declare_m_e_with_other_type_declares";
|
||||
("asdf": str2);
|
||||
import { str } from \"declare_m_e_with_other_value_declares\";
|
||||
import type { str2 } from \"declare_m_e_with_other_type_declares\";
|
||||
(\"asdf\": str2);
|
||||
(42: str2);
|
||||
import DEPRECATED__declare_var_exports from "DEPRECATED__declare_var_exports";
|
||||
import DEPRECATED__declare_var_exports from \"DEPRECATED__declare_var_exports\";
|
||||
(DEPRECATED__declare_var_exports: number);
|
||||
(DEPRECATED__declare_var_exports: string);
|
||||
import declare_m_e_with_declare_var_e from "declare_m_e_with_declare_var_e";
|
||||
import declare_m_e_with_declare_var_e from \"declare_m_e_with_declare_var_e\";
|
||||
(declare_m_e_with_declare_var_e: number);
|
||||
(declare_m_e_with_declare_var_e: string);
|
||||
"
|
||||
|
|
|
@ -6,21 +6,21 @@ exports[`test import_declare_type.js 1`] = `
|
|||
////////////////////////////////////////////////////////////
|
||||
// == Import Declared Type Alias From Declared Module == //
|
||||
//////////////////////////////////////////////////////////
|
||||
import type {baz} from "ModuleAliasFoo";
|
||||
import {foo} from "ModuleAliasFoo";
|
||||
import type {baz} from \"ModuleAliasFoo\";
|
||||
import {foo} from \"ModuleAliasFoo\";
|
||||
var k1: baz = 42;
|
||||
var k2: baz = "shab"; // Error: string to int
|
||||
var k2: baz = \"shab\"; // Error: string to int
|
||||
var k3: toz = foo(k1); // works
|
||||
|
||||
import type {toz} from "ModuleAliasFoo";
|
||||
import type {toz} from \"ModuleAliasFoo\";
|
||||
var k4: toz = foo(k1); // works
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
// == Declared Module with exports prop (issue 880) == //
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
import blah from 'foo';
|
||||
import type { Foo, Bar, Id } from 'foo';
|
||||
import blah from \'foo\';
|
||||
import type { Foo, Bar, Id } from \'foo\';
|
||||
|
||||
blah(0, 0);
|
||||
|
||||
|
@ -28,7 +28,7 @@ blah(0, 0);
|
|||
|
||||
(3 : Bar); // error : number ~> A
|
||||
|
||||
("lol" : Id<number>); // error : string ~> number
|
||||
(\"lol\" : Id<number>); // error : string ~> number
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/**
|
||||
* @flow
|
||||
|
@ -45,18 +45,18 @@ blah(0, 0);
|
|||
// error : {toz : number} ~> string
|
||||
// error : number ~> A
|
||||
// error : string ~> number
|
||||
import type { baz } from "ModuleAliasFoo";
|
||||
import { foo } from "ModuleAliasFoo";
|
||||
import type { baz } from \"ModuleAliasFoo\";
|
||||
import { foo } from \"ModuleAliasFoo\";
|
||||
var k1: baz = 42;
|
||||
var k2: baz = "shab";
|
||||
var k2: baz = \"shab\";
|
||||
var k3: toz = foo(k1);
|
||||
import type { toz } from "ModuleAliasFoo";
|
||||
import type { toz } from \"ModuleAliasFoo\";
|
||||
var k4: toz = foo(k1);
|
||||
import blah from "foo";
|
||||
import type { Foo, Bar, Id } from "foo";
|
||||
import blah from \"foo\";
|
||||
import type { Foo, Bar, Id } from \"foo\";
|
||||
blah(0, 0);
|
||||
({ toz: 3 }: Foo);
|
||||
(3: Bar);
|
||||
("lol": Id<number>);
|
||||
(\"lol\": Id<number>);
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -43,11 +43,11 @@ module.exports = A;
|
|||
`;
|
||||
|
||||
exports[`test B.js 1`] = `
|
||||
"var A = require('Demo');
|
||||
"var A = require(\'Demo\');
|
||||
|
||||
var z = new A("42").getX();
|
||||
var z = new A(\"42\").getX();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
var A = require("Demo");
|
||||
var z = new A("42").getX();
|
||||
var A = require(\"Demo\");
|
||||
var z = new A(\"42\").getX();
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -1,41 +1,41 @@
|
|||
exports[`test A.js 1`] = `
|
||||
"require('./C');
|
||||
"require(\'./C\');
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
require("./C");
|
||||
require(\"./C\");
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`test B.js 1`] = `
|
||||
"require('./C');
|
||||
"require(\'./C\');
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
require("./C");
|
||||
require(\"./C\");
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`test C.js 1`] = `
|
||||
"require('./D');
|
||||
require('./E');
|
||||
require('./F');
|
||||
require('./G');
|
||||
"require(\'./D\');
|
||||
require(\'./E\');
|
||||
require(\'./F\');
|
||||
require(\'./G\');
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
require("./D");
|
||||
require("./E");
|
||||
require("./F");
|
||||
require("./G");
|
||||
require(\"./D\");
|
||||
require(\"./E\");
|
||||
require(\"./F\");
|
||||
require(\"./G\");
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`test D.js 1`] = `
|
||||
"require('./I');
|
||||
"require(\'./I\');
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
require("./I");
|
||||
require(\"./I\");
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`test E.js 1`] = `
|
||||
"require('./I');
|
||||
"require(\'./I\');
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
require("./I");
|
||||
require(\"./I\");
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -48,9 +48,9 @@ exports[`test F.js 1`] = `
|
|||
`;
|
||||
|
||||
exports[`test G.js 1`] = `
|
||||
"require('./H');
|
||||
"require(\'./H\');
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
require("./H");
|
||||
require(\"./H\");
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -63,8 +63,8 @@ exports[`test H.js 1`] = `
|
|||
`;
|
||||
|
||||
exports[`test I.js 1`] = `
|
||||
"require('./A');
|
||||
"require(\'./A\');
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
require("./A");
|
||||
require(\"./A\");
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -2,12 +2,12 @@ exports[`test license_with_flow.js 1`] = `
|
|||
"/* Copyright example */
|
||||
/* @flow */
|
||||
|
||||
("": void); // error
|
||||
(\"\": void); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/* Copyright example */
|
||||
/* @flow */
|
||||
// error
|
||||
("": void);
|
||||
(\"\": void);
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -94,36 +94,36 @@ exports[`test multiple_providesModule_2.js 1`] = `
|
|||
`;
|
||||
|
||||
exports[`test use_strict_with_flow.js 1`] = `
|
||||
""use strict";
|
||||
"\"use strict\";
|
||||
/* @flow */
|
||||
|
||||
("": void); // error
|
||||
(\"\": void); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/* @flow */
|
||||
// error
|
||||
"use strict";
|
||||
("": void);
|
||||
\"use strict\";
|
||||
(\"\": void);
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`test with_flow.js 1`] = `
|
||||
"/* @flow */
|
||||
|
||||
("": void); // error
|
||||
(\"\": void); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/* @flow */
|
||||
// error
|
||||
("": void);
|
||||
(\"\": void);
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`test without_flow.js 1`] = `
|
||||
"/* some other comment */
|
||||
|
||||
("": void); // no error
|
||||
(\"\": void); // no error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/* some other comment */
|
||||
// no error
|
||||
("": void);
|
||||
(\"\": void);
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -9,7 +9,7 @@ let tests = [
|
|||
|
||||
// moveTo
|
||||
function(ctx: CanvasRenderingContext2D) {
|
||||
ctx.moveTo('0', '1'); // error: should be numbers
|
||||
ctx.moveTo(\'0\', \'1\'); // error: should be numbers
|
||||
},
|
||||
];
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -22,7 +22,7 @@ let tests = [
|
|||
ctx.fillRect(0, 0, 200, 100);
|
||||
},
|
||||
function(ctx: CanvasRenderingContext2D) {
|
||||
ctx.moveTo("0", "1");
|
||||
ctx.moveTo(\"0\", \"1\");
|
||||
}
|
||||
];
|
||||
"
|
||||
|
@ -34,8 +34,8 @@ exports[`test CustomEvent.js 1`] = `
|
|||
let tests = [
|
||||
// CustomEvent
|
||||
function(document: Document) {
|
||||
const event = document.createEvent('CustomEvent');
|
||||
event.initCustomEvent('butts', true, false, { nice: 42 });
|
||||
const event = document.createEvent(\'CustomEvent\');
|
||||
event.initCustomEvent(\'butts\', true, false, { nice: 42 });
|
||||
}
|
||||
];
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -43,8 +43,8 @@ let tests = [
|
|||
// CustomEvent
|
||||
let tests = [
|
||||
function(document: Document) {
|
||||
const event = document.createEvent("CustomEvent");
|
||||
event.initCustomEvent("butts", true, false, { nice: 42 });
|
||||
const event = document.createEvent(\"CustomEvent\");
|
||||
event.initCustomEvent(\"butts\", true, false, { nice: 42 });
|
||||
}
|
||||
];
|
||||
"
|
||||
|
@ -56,10 +56,10 @@ exports[`test Document.js 1`] = `
|
|||
let tests = [
|
||||
// createElement
|
||||
function(document: Document) {
|
||||
(document.createElement('canvas'): HTMLCanvasElement);
|
||||
(document.createElement('link'): HTMLLinkElement);
|
||||
(document.createElement('option'): HTMLOptionElement);
|
||||
(document.createElement('select'): HTMLSelectElement);
|
||||
(document.createElement(\'canvas\'): HTMLCanvasElement);
|
||||
(document.createElement(\'link\'): HTMLLinkElement);
|
||||
(document.createElement(\'option\'): HTMLOptionElement);
|
||||
(document.createElement(\'select\'): HTMLSelectElement);
|
||||
}
|
||||
];
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -67,10 +67,10 @@ let tests = [
|
|||
// createElement
|
||||
let tests = [
|
||||
function(document: Document) {
|
||||
(document.createElement("canvas"): HTMLCanvasElement);
|
||||
(document.createElement("link"): HTMLLinkElement);
|
||||
(document.createElement("option"): HTMLOptionElement);
|
||||
(document.createElement("select"): HTMLSelectElement);
|
||||
(document.createElement(\"canvas\"): HTMLCanvasElement);
|
||||
(document.createElement(\"link\"): HTMLLinkElement);
|
||||
(document.createElement(\"option\"): HTMLOptionElement);
|
||||
(document.createElement(\"select\"): HTMLSelectElement);
|
||||
}
|
||||
];
|
||||
"
|
||||
|
@ -85,13 +85,13 @@ let tests = [
|
|||
element.scrollIntoView();
|
||||
element.scrollIntoView(false);
|
||||
element.scrollIntoView({});
|
||||
element.scrollIntoView({ behavior: 'smooth', block: 'end' });
|
||||
element.scrollIntoView({ block: 'end' });
|
||||
element.scrollIntoView({ behavior: 'smooth' });
|
||||
element.scrollIntoView({ behavior: \'smooth\', block: \'end\' });
|
||||
element.scrollIntoView({ block: \'end\' });
|
||||
element.scrollIntoView({ behavior: \'smooth\' });
|
||||
|
||||
// fails
|
||||
element.scrollIntoView({ behavior: 'invalid' });
|
||||
element.scrollIntoView({ block: 'invalid' });
|
||||
element.scrollIntoView({ behavior: \'invalid\' });
|
||||
element.scrollIntoView({ block: \'invalid\' });
|
||||
element.scrollIntoView(1);
|
||||
}
|
||||
];
|
||||
|
@ -104,11 +104,11 @@ let tests = [
|
|||
element.scrollIntoView();
|
||||
element.scrollIntoView(false);
|
||||
element.scrollIntoView({});
|
||||
element.scrollIntoView({ behavior: "smooth", block: "end" });
|
||||
element.scrollIntoView({ block: "end" });
|
||||
element.scrollIntoView({ behavior: "smooth" });
|
||||
element.scrollIntoView({ behavior: "invalid" });
|
||||
element.scrollIntoView({ block: "invalid" });
|
||||
element.scrollIntoView({ behavior: \"smooth\", block: \"end\" });
|
||||
element.scrollIntoView({ block: \"end\" });
|
||||
element.scrollIntoView({ behavior: \"smooth\" });
|
||||
element.scrollIntoView({ behavior: \"invalid\" });
|
||||
element.scrollIntoView({ block: \"invalid\" });
|
||||
element.scrollIntoView(1);
|
||||
}
|
||||
];
|
||||
|
@ -121,7 +121,7 @@ exports[`test HTMLCanvasElement.js 1`] = `
|
|||
let tests = [
|
||||
// getContext
|
||||
function(el: HTMLCanvasElement) {
|
||||
(el.getContext('2d'): ?CanvasRenderingContext2D);
|
||||
(el.getContext(\'2d\'): ?CanvasRenderingContext2D);
|
||||
}
|
||||
];
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -129,7 +129,7 @@ let tests = [
|
|||
// getContext
|
||||
let tests = [
|
||||
function(el: HTMLCanvasElement) {
|
||||
(el.getContext("2d"): ?CanvasRenderingContext2D);
|
||||
(el.getContext(\"2d\"): ?CanvasRenderingContext2D);
|
||||
}
|
||||
];
|
||||
"
|
||||
|
@ -144,13 +144,13 @@ let tests = [
|
|||
element.scrollIntoView();
|
||||
element.scrollIntoView(false);
|
||||
element.scrollIntoView({});
|
||||
element.scrollIntoView({ behavior: 'smooth', block: 'end' });
|
||||
element.scrollIntoView({ block: 'end' });
|
||||
element.scrollIntoView({ behavior: 'smooth' });
|
||||
element.scrollIntoView({ behavior: \'smooth\', block: \'end\' });
|
||||
element.scrollIntoView({ block: \'end\' });
|
||||
element.scrollIntoView({ behavior: \'smooth\' });
|
||||
|
||||
// fails
|
||||
element.scrollIntoView({ behavior: 'invalid' });
|
||||
element.scrollIntoView({ block: 'invalid' });
|
||||
element.scrollIntoView({ behavior: \'invalid\' });
|
||||
element.scrollIntoView({ block: \'invalid\' });
|
||||
element.scrollIntoView(1);
|
||||
}
|
||||
];
|
||||
|
@ -163,11 +163,11 @@ let tests = [
|
|||
element.scrollIntoView();
|
||||
element.scrollIntoView(false);
|
||||
element.scrollIntoView({});
|
||||
element.scrollIntoView({ behavior: "smooth", block: "end" });
|
||||
element.scrollIntoView({ block: "end" });
|
||||
element.scrollIntoView({ behavior: "smooth" });
|
||||
element.scrollIntoView({ behavior: "invalid" });
|
||||
element.scrollIntoView({ block: "invalid" });
|
||||
element.scrollIntoView({ behavior: \"smooth\", block: \"end\" });
|
||||
element.scrollIntoView({ block: \"end\" });
|
||||
element.scrollIntoView({ behavior: \"smooth\" });
|
||||
element.scrollIntoView({ behavior: \"invalid\" });
|
||||
element.scrollIntoView({ block: \"invalid\" });
|
||||
element.scrollIntoView(1);
|
||||
}
|
||||
];
|
||||
|
@ -180,11 +180,11 @@ exports[`test HTMLInputElement.js 1`] = `
|
|||
let tests = [
|
||||
// setRangeText
|
||||
function(el: HTMLInputElement) {
|
||||
el.setRangeText('foo');
|
||||
el.setRangeText('foo', 123); // end is required
|
||||
el.setRangeText('foo', 123, 234);
|
||||
el.setRangeText('foo', 123, 234, 'select');
|
||||
el.setRangeText('foo', 123, 234, 'bogus'); // invalid value
|
||||
el.setRangeText(\'foo\');
|
||||
el.setRangeText(\'foo\', 123); // end is required
|
||||
el.setRangeText(\'foo\', 123, 234);
|
||||
el.setRangeText(\'foo\', 123, 234, \'select\');
|
||||
el.setRangeText(\'foo\', 123, 234, \'bogus\'); // invalid value
|
||||
}
|
||||
];
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -194,11 +194,11 @@ let tests = [
|
|||
// invalid value
|
||||
let tests = [
|
||||
function(el: HTMLInputElement) {
|
||||
el.setRangeText("foo");
|
||||
el.setRangeText("foo", 123);
|
||||
el.setRangeText("foo", 123, 234);
|
||||
el.setRangeText("foo", 123, 234, "select");
|
||||
el.setRangeText("foo", 123, 234, "bogus");
|
||||
el.setRangeText(\"foo\");
|
||||
el.setRangeText(\"foo\", 123);
|
||||
el.setRangeText(\"foo\", 123, 234);
|
||||
el.setRangeText(\"foo\", 123, 234, \"select\");
|
||||
el.setRangeText(\"foo\", 123, 234, \"bogus\");
|
||||
}
|
||||
];
|
||||
"
|
||||
|
@ -207,9 +207,9 @@ let tests = [
|
|||
exports[`test URL.js 1`] = `
|
||||
"/* @flow */
|
||||
|
||||
const a = new URL('http://flowtype.org/'); // correct
|
||||
const b = new URL('/docs', a); // correct
|
||||
const c = new URL('/docs', 'http://flowtype.org/'); // correct
|
||||
const a = new URL(\'http://flowtype.org/\'); // correct
|
||||
const b = new URL(\'/docs\', a); // correct
|
||||
const c = new URL(\'/docs\', \'http://flowtype.org/\'); // correct
|
||||
|
||||
const d: URLSearchParams = c.searchParams; // correct
|
||||
const e: string = c.path; // not correct
|
||||
|
@ -244,9 +244,9 @@ const r: string = c.username; // correct
|
|||
// correct
|
||||
// correct
|
||||
// correct
|
||||
const a = new URL("http://flowtype.org/");
|
||||
const b = new URL("/docs", a);
|
||||
const c = new URL("/docs", "http://flowtype.org/");
|
||||
const a = new URL(\"http://flowtype.org/\");
|
||||
const b = new URL(\"/docs\", a);
|
||||
const c = new URL(\"/docs\", \"http://flowtype.org/\");
|
||||
const d: URLSearchParams = c.searchParams;
|
||||
const e: string = c.path;
|
||||
const f: string = c.pathname;
|
||||
|
@ -273,15 +273,15 @@ let tests = [
|
|||
// attachEvent
|
||||
function() {
|
||||
let target = new EventTarget();
|
||||
(target.attachEvent('foo', listener): void); // invalid, may be undefined
|
||||
(target.attachEvent && target.attachEvent('foo', listener): void); // valid
|
||||
(target.attachEvent(\'foo\', listener): void); // invalid, may be undefined
|
||||
(target.attachEvent && target.attachEvent(\'foo\', listener): void); // valid
|
||||
},
|
||||
|
||||
// detachEvent
|
||||
function() {
|
||||
let target = new EventTarget();
|
||||
(target.detachEvent('foo', listener): void); // invalid, may be undefined
|
||||
(target.detachEvent && target.detachEvent('foo', listener): void); // valid
|
||||
(target.detachEvent(\'foo\', listener): void); // invalid, may be undefined
|
||||
(target.detachEvent && target.detachEvent(\'foo\', listener): void); // valid
|
||||
},
|
||||
|
||||
function() {
|
||||
|
@ -304,13 +304,13 @@ let listener: EventListener = function(event: Event): void {
|
|||
let tests = [
|
||||
function() {
|
||||
let target = new EventTarget();
|
||||
(target.attachEvent("foo", listener): void);
|
||||
(target.attachEvent && target.attachEvent("foo", listener): void);
|
||||
(target.attachEvent(\"foo\", listener): void);
|
||||
(target.attachEvent && target.attachEvent(\"foo\", listener): void);
|
||||
},
|
||||
function() {
|
||||
let target = new EventTarget();
|
||||
(target.detachEvent("foo", listener): void);
|
||||
(target.detachEvent && target.detachEvent("foo", listener): void);
|
||||
(target.detachEvent(\"foo\", listener): void);
|
||||
(target.detachEvent && target.detachEvent(\"foo\", listener): void);
|
||||
},
|
||||
function() {
|
||||
window.onmessage = (event: MessageEvent) => {
|
||||
|
@ -330,7 +330,7 @@ let tests = [
|
|||
let path = new Path2D();
|
||||
(path.arcTo(0, 0, 0, 0, 10): void); // valid
|
||||
(path.arcTo(0, 0, 0, 0, 10, 20, 5): void); // valid
|
||||
(path.arcTo(0, 0, 0, 0, 10, '20', 5): void); // invalid
|
||||
(path.arcTo(0, 0, 0, 0, 10, \'20\', 5): void); // invalid
|
||||
},
|
||||
];
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -344,7 +344,7 @@ let tests = [
|
|||
let path = new Path2D();
|
||||
(path.arcTo(0, 0, 0, 0, 10): void);
|
||||
(path.arcTo(0, 0, 0, 0, 10, 20, 5): void);
|
||||
(path.arcTo(0, 0, 0, 0, 10, "20", 5): void);
|
||||
(path.arcTo(0, 0, 0, 0, 10, \"20\", 5): void);
|
||||
}
|
||||
];
|
||||
"
|
||||
|
@ -356,7 +356,7 @@ exports[`test registerElement.js 1`] = `
|
|||
let tests = [
|
||||
// should work with Object.create()
|
||||
function() {
|
||||
document.registerElement('custom-element', {
|
||||
document.registerElement(\'custom-element\', {
|
||||
prototype: Object.create(HTMLElement.prototype, {
|
||||
createdCallback: { value: function createdCallback () {
|
||||
}},
|
||||
|
@ -378,7 +378,7 @@ let tests = [
|
|||
},
|
||||
// or with Object.assign()
|
||||
function() {
|
||||
document.registerElement('custom-element', {
|
||||
document.registerElement(\'custom-element\', {
|
||||
prototype: Object.assign(Object.create(HTMLElement.prototype), {
|
||||
createdCallback () {
|
||||
},
|
||||
|
@ -398,7 +398,7 @@ let tests = [
|
|||
},
|
||||
// should complain about invalid callback parameters
|
||||
function() {
|
||||
document.registerElement('custom-element', {
|
||||
document.registerElement(\'custom-element\', {
|
||||
prototype: {
|
||||
attributeChangedCallback(
|
||||
localName: string,
|
||||
|
@ -419,7 +419,7 @@ let tests = [
|
|||
let tests = [
|
||||
function() {
|
||||
document.registerElement(
|
||||
"custom-element",
|
||||
\"custom-element\",
|
||||
{
|
||||
prototype: Object.create(
|
||||
HTMLElement.prototype,
|
||||
|
@ -456,7 +456,7 @@ let tests = [
|
|||
},
|
||||
function() {
|
||||
document.registerElement(
|
||||
"custom-element",
|
||||
\"custom-element\",
|
||||
{
|
||||
prototype: Object.assign(
|
||||
Object.create(HTMLElement.prototype),
|
||||
|
@ -483,7 +483,7 @@ let tests = [
|
|||
},
|
||||
function() {
|
||||
document.registerElement(
|
||||
"custom-element",
|
||||
\"custom-element\",
|
||||
{
|
||||
prototype: {
|
||||
attributeChangedCallback(localName: string,
|
||||
|
@ -683,16 +683,16 @@ let tests = [
|
|||
// NodeFilterInterface
|
||||
function() {
|
||||
document.createNodeIterator(document.body, -1, node => NodeFilter.FILTER_ACCEPT); // valid
|
||||
document.createNodeIterator(document.body, -1, node => 'accept'); // invalid
|
||||
document.createNodeIterator(document.body, -1, node => \'accept\'); // invalid
|
||||
document.createNodeIterator(document.body, -1, { accept: node => NodeFilter.FILTER_ACCEPT }); // valid
|
||||
document.createNodeIterator(document.body, -1, { accept: node => 'accept' }); // invalid
|
||||
document.createNodeIterator(document.body, -1, { accept: node => \'accept\' }); // invalid
|
||||
document.createNodeIterator(document.body, -1, {}); // invalid
|
||||
},
|
||||
function() {
|
||||
document.createTreeWalker(document.body, -1, node => NodeFilter.FILTER_ACCEPT); // valid
|
||||
document.createTreeWalker(document.body, -1, node => 'accept'); // invalid
|
||||
document.createTreeWalker(document.body, -1, node => \'accept\'); // invalid
|
||||
document.createTreeWalker(document.body, -1, { accept: node => NodeFilter.FILTER_ACCEPT }); // valid
|
||||
document.createTreeWalker(document.body, -1, { accept: node => 'accept' }); // invalid
|
||||
document.createTreeWalker(document.body, -1, { accept: node => \'accept\' }); // invalid
|
||||
document.createTreeWalker(document.body, -1, {}); // invalid
|
||||
},
|
||||
];
|
||||
|
@ -897,7 +897,7 @@ let tests = [
|
|||
-1,
|
||||
node => NodeFilter.FILTER_ACCEPT
|
||||
);
|
||||
document.createNodeIterator(document.body, -1, node => "accept");
|
||||
document.createNodeIterator(document.body, -1, node => \"accept\");
|
||||
document.createNodeIterator(
|
||||
document.body,
|
||||
-1,
|
||||
|
@ -906,7 +906,7 @@ let tests = [
|
|||
document.createNodeIterator(
|
||||
document.body,
|
||||
-1,
|
||||
{ accept: node => "accept" }
|
||||
{ accept: node => \"accept\" }
|
||||
);
|
||||
document.createNodeIterator(document.body, -1, {});
|
||||
},
|
||||
|
@ -916,13 +916,13 @@ let tests = [
|
|||
-1,
|
||||
node => NodeFilter.FILTER_ACCEPT
|
||||
);
|
||||
document.createTreeWalker(document.body, -1, node => "accept");
|
||||
document.createTreeWalker(document.body, -1, node => \"accept\");
|
||||
document.createTreeWalker(
|
||||
document.body,
|
||||
-1,
|
||||
{ accept: node => NodeFilter.FILTER_ACCEPT }
|
||||
);
|
||||
document.createTreeWalker(document.body, -1, { accept: node => "accept" });
|
||||
document.createTreeWalker(document.body, -1, { accept: node => \"accept\" });
|
||||
document.createTreeWalker(document.body, -1, {});
|
||||
}
|
||||
];
|
||||
|
|
|
@ -17,7 +17,7 @@ module.exports = num;
|
|||
|
||||
exports[`test test.js 1`] = `
|
||||
"// @flow
|
||||
var num = require('./import');
|
||||
var num = require(\'./import\');
|
||||
function foo(x) { }
|
||||
foo(0);
|
||||
var a:string = num;
|
||||
|
@ -40,7 +40,7 @@ const idxResult = idx(obj, obj => obj.a.b.c.d);
|
|||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
// test deduping of inferred types
|
||||
var num = require("./import");
|
||||
var num = require(\"./import\");
|
||||
function foo(x) {
|
||||
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ function tag(strings,...values) {
|
|||
var s2 = tag \`l\${42}r\`;
|
||||
|
||||
function tag2(strings,...values) {
|
||||
return { foo: "" }; // ok: tagged templates can return whatever
|
||||
return { foo: \"\" }; // ok: tagged templates can return whatever
|
||||
}
|
||||
|
||||
var s3 = tag2 \`la la la\`;
|
||||
|
@ -29,7 +29,7 @@ function tag(strings, ...values) {
|
|||
}
|
||||
var s2 = tag\`l\${42}r\`;
|
||||
function tag2(strings, ...values) {
|
||||
return { foo: "" };
|
||||
return { foo: \"\" };
|
||||
}
|
||||
var s3 = tag2\`la la la\`;
|
||||
(s3.foo: number);
|
||||
|
|
|
@ -6,22 +6,22 @@ function isActive(ad: {state: $Keys<{
|
|||
ACTIVE: string;
|
||||
DELETED: string;
|
||||
}>}): boolean {
|
||||
return ad.state === 'ACTIVE';
|
||||
return ad.state === \'ACTIVE\';
|
||||
};
|
||||
isActive({state: 'PAUSE'});
|
||||
isActive({state: \'PAUSE\'});
|
||||
|
||||
var MyStates = {
|
||||
PAUSED: 'PAUSED',
|
||||
ACTIVE: 'ACTIVE',
|
||||
DELETED: 'DELETED',
|
||||
PAUSED: \'PAUSED\',
|
||||
ACTIVE: \'ACTIVE\',
|
||||
DELETED: \'DELETED\',
|
||||
};
|
||||
function isActive2(ad: {state: $Keys<typeof MyStates>}): boolean {
|
||||
return ad.state === MyStates.ACTIVE;
|
||||
};
|
||||
isActive2({state: 'PAUSE'});
|
||||
isActive2({state: \'PAUSE\'});
|
||||
|
||||
type Keys = $Keys<{ x: any, y: any }>;
|
||||
type Union = "x" | "y"
|
||||
type Union = \"x\" | \"y\"
|
||||
|
||||
function keys2union(s: Keys): Union { return s; } // ok
|
||||
function union2keys(s: Union): Keys { return s; } // ok
|
||||
|
@ -32,16 +32,16 @@ function union2keys(s: Union): Keys { return s; } // ok
|
|||
function isActive(
|
||||
ad: { state: $Keys<{ PAUSED: string; ACTIVE: string; DELETED: string }> }
|
||||
): boolean {
|
||||
return ad.state === "ACTIVE";
|
||||
return ad.state === \"ACTIVE\";
|
||||
}
|
||||
isActive({ state: "PAUSE" });
|
||||
var MyStates = { PAUSED: "PAUSED", ACTIVE: "ACTIVE", DELETED: "DELETED" };
|
||||
isActive({ state: \"PAUSE\" });
|
||||
var MyStates = { PAUSED: \"PAUSED\", ACTIVE: \"ACTIVE\", DELETED: \"DELETED\" };
|
||||
function isActive2(ad: { state: $Keys<typeof MyStates> }): boolean {
|
||||
return ad.state === MyStates.ACTIVE;
|
||||
}
|
||||
isActive2({ state: "PAUSE" });
|
||||
isActive2({ state: \"PAUSE\" });
|
||||
type Keys = $Keys<{ x: any; y: any }>;
|
||||
type Union = "x" | "y";
|
||||
type Union = \"x\" | \"y\";
|
||||
function keys2union(s: Keys): Union {
|
||||
return s;
|
||||
}
|
||||
|
|
|
@ -2,11 +2,11 @@ exports[`test equals.js 1`] = `
|
|||
"/* @flow */
|
||||
|
||||
(1 == 1);
|
||||
("foo" == "bar");
|
||||
(\"foo\" == \"bar\");
|
||||
(1 == null);
|
||||
(null == 1);
|
||||
(1 == ""); // error
|
||||
("" == 1); // error
|
||||
(1 == \"\"); // error
|
||||
(\"\" == 1); // error
|
||||
|
||||
var x = (null : ?number);
|
||||
(x == 1);
|
||||
|
@ -16,11 +16,11 @@ var x = (null : ?number);
|
|||
// error
|
||||
// error
|
||||
1 == 1;
|
||||
"foo" == "bar";
|
||||
\"foo\" == \"bar\";
|
||||
1 == null;
|
||||
null == 1;
|
||||
1 == "";
|
||||
"" == 1;
|
||||
1 == \"\";
|
||||
\"\" == 1;
|
||||
var x = (null: ?number);
|
||||
x == 1;
|
||||
1 == x;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
exports[`test errors.js 1`] = `
|
||||
"if (typeof define === 'function' && define.amd) { }
|
||||
"if (typeof define === \'function\' && define.amd) { }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
if (typeof define === "function" && define.amd) {
|
||||
if (typeof define === \"function\" && define.amd) {
|
||||
|
||||
}
|
||||
"
|
||||
|
|
|
@ -303,11 +303,11 @@ exports[`test ES6_DefaultAndNamed.js 1`] = `
|
|||
"/* @flow */
|
||||
|
||||
export default 42;
|
||||
export var str = 'asdf';
|
||||
export var str = \'asdf\';
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/* @flow */
|
||||
export default 42
|
||||
export var str = "asdf";
|
||||
export var str = \"asdf\";
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -317,13 +317,13 @@ exports[`test ES6_ExportAllFrom_Intermediary1.js 1`] = `
|
|||
* @flow
|
||||
*/
|
||||
|
||||
export * from "ES6_ExportAllFrom_Source1";
|
||||
export * from \"ES6_ExportAllFrom_Source1\";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/**
|
||||
* @providesModule ES6_ExportAllFrom_Intermediary1
|
||||
* @flow
|
||||
*/
|
||||
export * from "ES6_ExportAllFrom_Source1"
|
||||
export * from \"ES6_ExportAllFrom_Source1\"
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -333,13 +333,13 @@ exports[`test ES6_ExportAllFrom_Intermediary2.js 1`] = `
|
|||
* @flow
|
||||
*/
|
||||
|
||||
export * from "ES6_ExportAllFrom_Source2";
|
||||
export * from \"ES6_ExportAllFrom_Source2\";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/**
|
||||
* @providesModule ES6_ExportAllFrom_Intermediary2
|
||||
* @flow
|
||||
*/
|
||||
export * from "ES6_ExportAllFrom_Source2"
|
||||
export * from \"ES6_ExportAllFrom_Source2\"
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -378,12 +378,12 @@ export var numberValue2 = 1;
|
|||
exports[`test ES6_ExportAllFromMulti.js 1`] = `
|
||||
"// @flow
|
||||
|
||||
export * from "./ES6_ExportAllFrom_Source1";
|
||||
export * from "./ES6_ExportAllFrom_Source2";
|
||||
export * from \"./ES6_ExportAllFrom_Source1\";
|
||||
export * from \"./ES6_ExportAllFrom_Source2\";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
export * from "./ES6_ExportAllFrom_Source1"
|
||||
export * from "./ES6_ExportAllFrom_Source2"
|
||||
export * from \"./ES6_ExportAllFrom_Source1\"
|
||||
export * from \"./ES6_ExportAllFrom_Source2\"
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -396,13 +396,13 @@ exports[`test ES6_ExportFrom_Intermediary1.js 1`] = `
|
|||
export {
|
||||
numberValue1,
|
||||
numberValue2 as numberValue2_renamed
|
||||
} from "ES6_ExportFrom_Source1";
|
||||
} from \"ES6_ExportFrom_Source1\";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/**
|
||||
* @providesModule ES6_ExportFrom_Intermediary1
|
||||
* @flow
|
||||
*/
|
||||
export { numberValue1, numberValue2 as numberValue2_renamed } from "ES6_ExportFrom_Source1"
|
||||
export { numberValue1, numberValue2 as numberValue2_renamed } from \"ES6_ExportFrom_Source1\"
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -415,13 +415,13 @@ exports[`test ES6_ExportFrom_Intermediary2.js 1`] = `
|
|||
export {
|
||||
numberValue1,
|
||||
numberValue2 as numberValue2_renamed2
|
||||
} from "ES6_ExportFrom_Source2";
|
||||
} from \"ES6_ExportFrom_Source2\";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/**
|
||||
* @providesModule ES6_ExportFrom_Intermediary2
|
||||
* @flow
|
||||
*/
|
||||
export { numberValue1, numberValue2 as numberValue2_renamed2 } from "ES6_ExportFrom_Source2"
|
||||
export { numberValue1, numberValue2 as numberValue2_renamed2 } from \"ES6_ExportFrom_Source2\"
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -575,7 +575,7 @@ exports.numberValue1 = 42;
|
|||
exports.numberValue2 = 42;
|
||||
exports.numberValue3 = 42;
|
||||
exports.numberValue4 = 42;
|
||||
exports.stringValue = "str";
|
||||
exports.stringValue = \"str\";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/**
|
||||
* @providesModule A
|
||||
|
@ -585,7 +585,7 @@ exports.numberValue1 = 42;
|
|||
exports.numberValue2 = 42;
|
||||
exports.numberValue3 = 42;
|
||||
exports.numberValue4 = 42;
|
||||
exports.stringValue = "str";
|
||||
exports.stringValue = \"str\";
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -662,44 +662,44 @@ exports[`test es6modules.js 1`] = `
|
|||
// ===================== //
|
||||
|
||||
// @providesModule
|
||||
import * as DefaultA from "A";
|
||||
import * as DefaultA from \"A\";
|
||||
var a1: number = DefaultA.numberValue1;
|
||||
var a2: string = DefaultA.numberValue1; // Error: number ~> string
|
||||
|
||||
// File path
|
||||
import * as DefaultB from "./B";
|
||||
import * as DefaultB from \"./B\";
|
||||
var b1: number = DefaultB.numberValue;
|
||||
var b2: string = DefaultB.numberValue; // Error: number ~> string
|
||||
|
||||
// C.js exists, but not as a providesModule
|
||||
import DefaultC from "C"; // Error: No such module
|
||||
import DefaultC from \"C\"; // Error: No such module
|
||||
|
||||
// @providesModule D exists, but not as a filename
|
||||
import DefaultD from "./D"; // Error: No such module
|
||||
import DefaultD from \"./D\"; // Error: No such module
|
||||
|
||||
// ================================================ //
|
||||
// == CommonJS Clobbering Literal Exports -> ES6 == //
|
||||
// ================================================ //
|
||||
|
||||
import {doesntExist1} from "CommonJS_Clobbering_Lit"; // Error: Not an exported binding
|
||||
import {doesntExist1} from \"CommonJS_Clobbering_Lit\"; // Error: Not an exported binding
|
||||
|
||||
import {numberValue1} from "CommonJS_Clobbering_Lit";
|
||||
import {numberValue1} from \"CommonJS_Clobbering_Lit\";
|
||||
var c1: number = numberValue1;
|
||||
var c2: string = numberValue1; // Error: number ~> string
|
||||
|
||||
import {numberValue2 as numVal1} from "CommonJS_Clobbering_Lit";
|
||||
import {numberValue2 as numVal1} from \"CommonJS_Clobbering_Lit\";
|
||||
var d1: number = numVal1;
|
||||
var d2: string = numVal1; // Error: number ~> string
|
||||
|
||||
import CJS_Clobb_Lit from "CommonJS_Clobbering_Lit";
|
||||
import CJS_Clobb_Lit from \"CommonJS_Clobbering_Lit\";
|
||||
var e1: number = CJS_Clobb_Lit.numberValue3;
|
||||
var e2: string = CJS_Clobb_Lit.numberValue3; // Error: number ~> string
|
||||
CJS_Clobb_Lit.doesntExist; // Error: doesntExist isn't a property
|
||||
CJS_Clobb_Lit.doesntExist; // Error: doesntExist isn\'t a property
|
||||
|
||||
import * as CJS_Clobb_Lit_NS from "CommonJS_Clobbering_Lit";
|
||||
import * as CJS_Clobb_Lit_NS from \"CommonJS_Clobbering_Lit\";
|
||||
var f1: number = CJS_Clobb_Lit_NS.numberValue4;
|
||||
var f2: number = CJS_Clobb_Lit_NS.default.numberValue4;
|
||||
CJS_Clobb_Lit_NS.default.default; // Error: No 'default' property on the exported obj
|
||||
CJS_Clobb_Lit_NS.default.default; // Error: No \'default\' property on the exported obj
|
||||
var f3: string = CJS_Clobb_Lit_NS.numberValue4; // Error: number ~> string
|
||||
var f4: string = CJS_Clobb_Lit_NS.default.numberValue5; // Error: number ~> string
|
||||
|
||||
|
@ -707,15 +707,15 @@ var f4: string = CJS_Clobb_Lit_NS.default.numberValue5; // Error: number ~> stri
|
|||
// == CommonJS Clobbering Class Exports -> ES6 == //
|
||||
// ============================================== //
|
||||
|
||||
import {doesntExist2} from "CommonJS_Clobbering_Class"; // Error: Not an exported binding
|
||||
import {doesntExist2} from \"CommonJS_Clobbering_Class\"; // Error: Not an exported binding
|
||||
|
||||
// The following import should error because class statics are not turned into
|
||||
// named exports for now. This avoids complexities with polymorphic static
|
||||
// members (where the polymophism is defined on the class itself rather than the
|
||||
// method).
|
||||
import {staticNumber1, baseProp, childProp} from "CommonJS_Clobbering_Class"; // Error
|
||||
import {staticNumber1, baseProp, childProp} from \"CommonJS_Clobbering_Class\"; // Error
|
||||
|
||||
import CJS_Clobb_Class from "CommonJS_Clobbering_Class";
|
||||
import CJS_Clobb_Class from \"CommonJS_Clobbering_Class\";
|
||||
new CJS_Clobb_Class();
|
||||
new CJS_Clobb_Class().doesntExist; // Error: Class has no \`doesntExist\` property
|
||||
var h1: number = CJS_Clobb_Class.staticNumber2();
|
||||
|
@ -723,8 +723,8 @@ var h2: string = CJS_Clobb_Class.staticNumber2(); // Error: number ~> string
|
|||
var h3: number = new CJS_Clobb_Class().instNumber1();
|
||||
var h4: string = new CJS_Clobb_Class().instNumber1(); // Error: number ~> string
|
||||
|
||||
import * as CJS_Clobb_Class_NS from "CommonJS_Clobbering_Class";
|
||||
new CJS_Clobb_Class_NS(); // Error: Namespace object isn't constructable
|
||||
import * as CJS_Clobb_Class_NS from \"CommonJS_Clobbering_Class\";
|
||||
new CJS_Clobb_Class_NS(); // Error: Namespace object isn\'t constructable
|
||||
var i1: number = CJS_Clobb_Class_NS.staticNumber3(); // Error: Class statics not copied to Namespace object
|
||||
var i2: number = new CJS_Clobb_Class_NS.default().instNumber2();
|
||||
var i3: string = new CJS_Clobb_Class_NS.default().instNumber2(); // Error: number ~> string
|
||||
|
@ -733,22 +733,22 @@ var i3: string = new CJS_Clobb_Class_NS.default().instNumber2(); // Error: numbe
|
|||
// == CommonJS Named Exports -> ES6 == //
|
||||
// =================================== //
|
||||
|
||||
import {doesntExist3} from "CommonJS_Named"; // Error: Not an exported binding
|
||||
import {doesntExist3} from \"CommonJS_Named\"; // Error: Not an exported binding
|
||||
|
||||
import {numberValue2} from "CommonJS_Named";
|
||||
import {numberValue2} from \"CommonJS_Named\";
|
||||
var j1: number = numberValue2;
|
||||
var j2: string = numberValue2; // Error: number ~> string
|
||||
|
||||
import {numberValue3 as numVal3} from "CommonJS_Named";
|
||||
import {numberValue3 as numVal3} from \"CommonJS_Named\";
|
||||
var k1: number = numVal3;
|
||||
var k2: string = numVal3; // Error: number ~> string
|
||||
|
||||
import * as CJS_Named from "CommonJS_Named";
|
||||
import * as CJS_Named from \"CommonJS_Named\";
|
||||
var l1: number = CJS_Named.numberValue1;
|
||||
var l2: string = CJS_Named.numberValue1; // Error: number ~> string
|
||||
CJS_Named.doesntExist; // Error: doesntExist isn't a property
|
||||
CJS_Named.doesntExist; // Error: doesntExist isn\'t a property
|
||||
|
||||
import * as CJS_Named_NS from "CommonJS_Named";
|
||||
import * as CJS_Named_NS from \"CommonJS_Named\";
|
||||
var m1: number = CJS_Named_NS.numberValue4;
|
||||
var m2: string = CJS_Named_NS.default.numberValue4; // Error: CommonJS_Named has no default export
|
||||
var m3: string = CJS_Named_NS.numberValue4; // Error: number ~> string
|
||||
|
@ -757,21 +757,21 @@ var m3: string = CJS_Named_NS.numberValue4; // Error: number ~> string
|
|||
// == ES6 Default -> ES6 == //
|
||||
//////////////////////////////
|
||||
|
||||
import {doesntExist4} from "ES6_Default_AnonFunction1"; // Error: Not an exported binding
|
||||
import {doesntExist4} from \"ES6_Default_AnonFunction1\"; // Error: Not an exported binding
|
||||
|
||||
import ES6_Def_AnonFunc1 from "ES6_Default_AnonFunction1";
|
||||
import ES6_Def_AnonFunc1 from \"ES6_Default_AnonFunction1\";
|
||||
var n1: number = ES6_Def_AnonFunc1();
|
||||
var n2: string = ES6_Def_AnonFunc1(); // Error: number ~> string
|
||||
|
||||
import ES6_Def_NamedFunc1 from "ES6_Default_NamedFunction1";
|
||||
import ES6_Def_NamedFunc1 from \"ES6_Default_NamedFunction1\";
|
||||
var o1: number = ES6_Def_NamedFunc1();
|
||||
var o2: string = ES6_Def_NamedFunc1(); // Error: number ~> string
|
||||
|
||||
import ES6_Def_AnonClass1 from "ES6_Default_AnonClass1";
|
||||
import ES6_Def_AnonClass1 from \"ES6_Default_AnonClass1\";
|
||||
var p1: number = new ES6_Def_AnonClass1().givesANum();
|
||||
var p2: string = new ES6_Def_AnonClass1().givesANum(); // Error: number ~> string
|
||||
|
||||
import ES6_Def_NamedClass1 from "ES6_Default_NamedClass1";
|
||||
import ES6_Def_NamedClass1 from \"ES6_Default_NamedClass1\";
|
||||
var q1: number = new ES6_Def_NamedClass1().givesANum();
|
||||
var q2: string = new ES6_Def_NamedClass1().givesANum(); // Error: number ~> string
|
||||
|
||||
|
@ -779,57 +779,57 @@ var q2: string = new ES6_Def_NamedClass1().givesANum(); // Error: number ~> stri
|
|||
// == ES6 Named -> ES6 == //
|
||||
////////////////////////////
|
||||
|
||||
import doesntExist5 from "ES6_Named1"; // Error: Not an exported binding
|
||||
import doesntExist5 from \"ES6_Named1\"; // Error: Not an exported binding
|
||||
|
||||
import {specifierNumber1 as specifierNumber1_1} from "ES6_Named1";
|
||||
import {specifierNumber1 as specifierNumber1_1} from \"ES6_Named1\";
|
||||
var r1: number = specifierNumber1_1;
|
||||
var r2: string = specifierNumber1_1; // Error: number ~> string
|
||||
|
||||
import {specifierNumber2Renamed} from "ES6_Named1";
|
||||
import {specifierNumber2Renamed} from \"ES6_Named1\";
|
||||
var s1: number = specifierNumber2Renamed;
|
||||
var s2: string = specifierNumber2Renamed; // Error: number ~> string
|
||||
|
||||
import {specifierNumber3 as specifierNumber3Renamed} from "ES6_Named1";
|
||||
import {specifierNumber3 as specifierNumber3Renamed} from \"ES6_Named1\";
|
||||
var t1: number = specifierNumber3Renamed;
|
||||
var t2: string = specifierNumber3Renamed; // Error: number ~> string
|
||||
|
||||
import {groupedSpecifierNumber1, groupedSpecifierNumber2} from "ES6_Named1";
|
||||
import {groupedSpecifierNumber1, groupedSpecifierNumber2} from \"ES6_Named1\";
|
||||
var u1: number = groupedSpecifierNumber1;
|
||||
var u2: number = groupedSpecifierNumber2;
|
||||
var u3: string = groupedSpecifierNumber1; // Error: number ~> string
|
||||
var u4: string = groupedSpecifierNumber2; // Error: number ~> string
|
||||
|
||||
import {givesANumber} from "ES6_Named1";
|
||||
import {givesANumber} from \"ES6_Named1\";
|
||||
var v1: number = givesANumber();
|
||||
var v2: string = givesANumber(); // Error: number ~> string
|
||||
|
||||
import {NumberGenerator} from "ES6_Named1";
|
||||
import {NumberGenerator} from \"ES6_Named1\";
|
||||
var w1: number = new NumberGenerator().givesANumber();
|
||||
var w2: string = new NumberGenerator().givesANumber(); // Error: number ~> string
|
||||
|
||||
import {varDeclNumber1, varDeclNumber2} from "ES6_Named1";
|
||||
import {varDeclNumber1, varDeclNumber2} from \"ES6_Named1\";
|
||||
var x1: number = varDeclNumber1;
|
||||
var x2: number = varDeclNumber2;
|
||||
var x3: string = varDeclNumber1; // Error: number ~> string
|
||||
var x4: string = varDeclNumber2; // Error: number ~> string
|
||||
|
||||
import {destructuredObjNumber} from "ES6_Named1";
|
||||
import {destructuredObjNumber} from \"ES6_Named1\";
|
||||
var y1: number = destructuredObjNumber;
|
||||
var y2: string = destructuredObjNumber; // Error: number ~> string
|
||||
|
||||
import {destructuredArrNumber} from "ES6_Named1";
|
||||
import {destructuredArrNumber} from \"ES6_Named1\";
|
||||
var z1: number = destructuredArrNumber;
|
||||
var z2: string = destructuredArrNumber; // Error: number ~> string
|
||||
|
||||
import {numberValue1 as numberValue4} from "ES6_ExportFrom_Intermediary1";
|
||||
import {numberValue1 as numberValue4} from \"ES6_ExportFrom_Intermediary1\";
|
||||
var aa1: number = numberValue4;
|
||||
var aa2: string = numberValue4; // Error: number ~> string
|
||||
|
||||
import {numberValue2_renamed} from "ES6_ExportFrom_Intermediary1";
|
||||
import {numberValue2_renamed} from \"ES6_ExportFrom_Intermediary1\";
|
||||
var ab1: number = numberValue2_renamed;
|
||||
var ab2: string = numberValue2_renamed; // Error: number ~> string
|
||||
|
||||
import {numberValue1 as numberValue5} from "ES6_ExportAllFrom_Intermediary1";
|
||||
import {numberValue1 as numberValue5} from \"ES6_ExportAllFrom_Intermediary1\";
|
||||
var ac1: number = numberValue5;
|
||||
var ac2: string = numberValue5; // Error: number ~> string
|
||||
|
||||
|
@ -837,21 +837,21 @@ var ac2: string = numberValue5; // Error: number ~> string
|
|||
// == ES6 Default -> CommonJS == //
|
||||
///////////////////////////////////
|
||||
|
||||
require('ES6_Default_AnonFunction2').doesntExist; // Error: 'doesntExist' isn't an export
|
||||
require(\'ES6_Default_AnonFunction2\').doesntExist; // Error: \'doesntExist\' isn\'t an export
|
||||
|
||||
var ES6_Def_AnonFunc2 = require("ES6_Default_AnonFunction2").default;
|
||||
var ES6_Def_AnonFunc2 = require(\"ES6_Default_AnonFunction2\").default;
|
||||
var ad1: number = ES6_Def_AnonFunc2();
|
||||
var ad2: string = ES6_Def_AnonFunc2(); // Error: number ~> string
|
||||
|
||||
var ES6_Def_NamedFunc2 = require("ES6_Default_NamedFunction2").default;
|
||||
var ES6_Def_NamedFunc2 = require(\"ES6_Default_NamedFunction2\").default;
|
||||
var ae1: number = ES6_Def_NamedFunc2();
|
||||
var ae2: string = ES6_Def_NamedFunc2(); // Error: number ~> string
|
||||
|
||||
var ES6_Def_AnonClass2 = require("ES6_Default_AnonClass2").default;
|
||||
var ES6_Def_AnonClass2 = require(\"ES6_Default_AnonClass2\").default;
|
||||
var af1: number = new ES6_Def_AnonClass2().givesANum();
|
||||
var af2: string = new ES6_Def_AnonClass2().givesANum(); // Error: number ~> string
|
||||
|
||||
var ES6_Def_NamedClass2 = require("ES6_Default_NamedClass2").default;
|
||||
var ES6_Def_NamedClass2 = require(\"ES6_Default_NamedClass2\").default;
|
||||
var ag1: number = new ES6_Def_NamedClass2().givesANum();
|
||||
var ag2: string = new ES6_Def_NamedClass2().givesANum(); // Error: number ~> string
|
||||
|
||||
|
@ -859,53 +859,53 @@ var ag2: string = new ES6_Def_NamedClass2().givesANum(); // Error: number ~> str
|
|||
// == ES6 Named -> CommonJS == //
|
||||
/////////////////////////////////
|
||||
|
||||
var specifierNumber4 = require("ES6_Named2").specifierNumber4;
|
||||
var specifierNumber4 = require(\"ES6_Named2\").specifierNumber4;
|
||||
var ah1: number = specifierNumber4;
|
||||
var ah2: string = specifierNumber4; // Error: number ~> string
|
||||
|
||||
var specifierNumber5Renamed = require("ES6_Named2").specifierNumber5Renamed;
|
||||
var specifierNumber5Renamed = require(\"ES6_Named2\").specifierNumber5Renamed;
|
||||
var ai1: number = specifierNumber5Renamed;
|
||||
var ai2: string = specifierNumber5Renamed; // Error: number ~> string
|
||||
|
||||
var groupedSpecifierNumber3 = require("ES6_Named2").groupedSpecifierNumber3;
|
||||
var groupedSpecifierNumber4 = require("ES6_Named2").groupedSpecifierNumber4;
|
||||
var groupedSpecifierNumber3 = require(\"ES6_Named2\").groupedSpecifierNumber3;
|
||||
var groupedSpecifierNumber4 = require(\"ES6_Named2\").groupedSpecifierNumber4;
|
||||
var aj1: number = groupedSpecifierNumber3;
|
||||
var aj2: number = groupedSpecifierNumber4;
|
||||
var aj3: string = groupedSpecifierNumber3; // Error: number ~> string
|
||||
var aj4: string = groupedSpecifierNumber4; // Error: number ~> string
|
||||
|
||||
var givesANumber2 = require("ES6_Named2").givesANumber2;
|
||||
var givesANumber2 = require(\"ES6_Named2\").givesANumber2;
|
||||
var ak1: number = givesANumber2();
|
||||
var ak2: string = givesANumber2(); // Error: number ~> string
|
||||
|
||||
var NumberGenerator2 = require("ES6_Named2").NumberGenerator2;
|
||||
var NumberGenerator2 = require(\"ES6_Named2\").NumberGenerator2;
|
||||
var al1: number = new NumberGenerator2().givesANumber();
|
||||
var al2: string = new NumberGenerator2().givesANumber(); // Error: number ~> string
|
||||
|
||||
var varDeclNumber3 = require("ES6_Named2").varDeclNumber3;
|
||||
var varDeclNumber4 = require("ES6_Named2").varDeclNumber4;
|
||||
var varDeclNumber3 = require(\"ES6_Named2\").varDeclNumber3;
|
||||
var varDeclNumber4 = require(\"ES6_Named2\").varDeclNumber4;
|
||||
var am1: number = varDeclNumber3;
|
||||
var am2: number = varDeclNumber4;
|
||||
var am3: string = varDeclNumber3; // Error: number ~> string
|
||||
var am4: string = varDeclNumber4; // Error: number ~> string
|
||||
|
||||
var destructuredObjNumber2 = require("ES6_Named2").destructuredObjNumber2;
|
||||
var destructuredObjNumber2 = require(\"ES6_Named2\").destructuredObjNumber2;
|
||||
var an1: number = destructuredObjNumber2;
|
||||
var an2: string = destructuredObjNumber2; // Error: number ~> string
|
||||
|
||||
var destructuredArrNumber2 = require("ES6_Named2").destructuredArrNumber2;
|
||||
var destructuredArrNumber2 = require(\"ES6_Named2\").destructuredArrNumber2;
|
||||
var ao1: number = destructuredArrNumber2;
|
||||
var ao2: string = destructuredArrNumber2; // Error: number ~> string
|
||||
|
||||
var numberValue6 = require("ES6_ExportFrom_Intermediary2").numberValue1;
|
||||
var numberValue6 = require(\"ES6_ExportFrom_Intermediary2\").numberValue1;
|
||||
var ap1: number = numberValue6;
|
||||
var ap2: string = numberValue6; // Error: number ~> string
|
||||
|
||||
var numberValue2_renamed2 = require("ES6_ExportFrom_Intermediary2").numberValue2_renamed2;
|
||||
var numberValue2_renamed2 = require(\"ES6_ExportFrom_Intermediary2\").numberValue2_renamed2;
|
||||
var aq1: number = numberValue2_renamed2;
|
||||
var aq2: string = numberValue2_renamed2; // Error: number ~> string
|
||||
|
||||
var numberValue7 = require("ES6_ExportAllFrom_Intermediary2").numberValue2;
|
||||
var numberValue7 = require(\"ES6_ExportAllFrom_Intermediary2\").numberValue2;
|
||||
var ar1: number = numberValue7;
|
||||
var ar2: string = numberValue7; // Error: number ~> string
|
||||
|
||||
|
@ -913,7 +913,7 @@ var ar2: string = numberValue7; // Error: number ~> string
|
|||
// == ES6 Default+Named -> ES6 import Default+Named== //
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
import defaultNum, {str as namedStr} from "./ES6_DefaultAndNamed";
|
||||
import defaultNum, {str as namedStr} from \"./ES6_DefaultAndNamed\";
|
||||
|
||||
var as1: number = defaultNum;
|
||||
var as2: string = defaultNum; // Error: number ~> string
|
||||
|
@ -925,13 +925,13 @@ var as4: number = namedStr; // Error: string ~> number
|
|||
// == Side-effect only ES6 imports == //
|
||||
////////////////////////////////////////
|
||||
|
||||
import "./SideEffects";
|
||||
import \"./SideEffects\";
|
||||
|
||||
//////////////////////////////////////////////
|
||||
// == Suggest export name on likely typo == //
|
||||
//////////////////////////////////////////////
|
||||
import specifierNumber1 from "ES6_Named1"; // Error: Did you mean \`import {specifierNumber1} from ...\`?
|
||||
import {specifierNumber} from "ES6_Named1"; // Error: Did you mean \`specifierNumber1\`?
|
||||
import specifierNumber1 from \"ES6_Named1\"; // Error: Did you mean \`import {specifierNumber1} from ...\`?
|
||||
import {specifierNumber} from \"ES6_Named1\"; // Error: Did you mean \`specifierNumber1\`?
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
// == Multi \`export *\` should combine exports == //
|
||||
|
@ -939,7 +939,7 @@ import {specifierNumber} from "ES6_Named1"; // Error: Did you mean \`specifierNu
|
|||
import {
|
||||
numberValue1 as numberValue8,
|
||||
numberValue2 as numberValue9
|
||||
} from "./ES6_ExportAllFromMulti";
|
||||
} from \"./ES6_ExportAllFromMulti\";
|
||||
|
||||
var at1: number = numberValue8;
|
||||
var at2: string = numberValue8; // Error: number ~> string
|
||||
|
@ -950,7 +950,7 @@ var at4: string = numberValue9; // Error: number ~> string
|
|||
/////////////////////////////////////////////////////////////
|
||||
// == Vanilla \`import\` cannot import a type-only export == //
|
||||
/////////////////////////////////////////////////////////////
|
||||
import {typeAlias} from "./ExportType"; // Error: Cannot vanilla-import a type alias!
|
||||
import {typeAlias} from \"./ExportType\"; // Error: Cannot vanilla-import a type alias!
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/* @flow */
|
||||
// ===================== //
|
||||
|
@ -971,8 +971,8 @@ import {typeAlias} from "./ExportType"; // Error: Cannot vanilla-import a type a
|
|||
// Error: number ~> string
|
||||
// Error: number ~> string
|
||||
// Error: number ~> string
|
||||
// Error: doesntExist isn't a property
|
||||
// Error: No 'default' property on the exported obj
|
||||
// Error: doesntExist isn\'t a property
|
||||
// Error: No \'default\' property on the exported obj
|
||||
// Error: number ~> string
|
||||
// Error: number ~> string
|
||||
// ============================================== //
|
||||
|
@ -987,7 +987,7 @@ import {typeAlias} from "./ExportType"; // Error: Cannot vanilla-import a type a
|
|||
// Error: Class has no \`doesntExist\` property
|
||||
// Error: number ~> string
|
||||
// Error: number ~> string
|
||||
// Error: Namespace object isn't constructable
|
||||
// Error: Namespace object isn\'t constructable
|
||||
// Error: Class statics not copied to Namespace object
|
||||
// Error: number ~> string
|
||||
// =================================== //
|
||||
|
@ -997,7 +997,7 @@ import {typeAlias} from "./ExportType"; // Error: Cannot vanilla-import a type a
|
|||
// Error: number ~> string
|
||||
// Error: number ~> string
|
||||
// Error: number ~> string
|
||||
// Error: doesntExist isn't a property
|
||||
// Error: doesntExist isn\'t a property
|
||||
// Error: CommonJS_Named has no default export
|
||||
// Error: number ~> string
|
||||
//////////////////////////////
|
||||
|
@ -1029,7 +1029,7 @@ import {typeAlias} from "./ExportType"; // Error: Cannot vanilla-import a type a
|
|||
///////////////////////////////////
|
||||
// == ES6 Default -> CommonJS == //
|
||||
///////////////////////////////////
|
||||
// Error: 'doesntExist' isn't an export
|
||||
// Error: \'doesntExist\' isn\'t an export
|
||||
// Error: number ~> string
|
||||
// Error: number ~> string
|
||||
// Error: number ~> string
|
||||
|
@ -1072,182 +1072,182 @@ import {typeAlias} from "./ExportType"; // Error: Cannot vanilla-import a type a
|
|||
// == Vanilla \`import\` cannot import a type-only export == //
|
||||
/////////////////////////////////////////////////////////////
|
||||
// Error: Cannot vanilla-import a type alias!
|
||||
import * as DefaultA from "A";
|
||||
import * as DefaultA from \"A\";
|
||||
var a1: number = DefaultA.numberValue1;
|
||||
var a2: string = DefaultA.numberValue1;
|
||||
import * as DefaultB from "./B";
|
||||
import * as DefaultB from \"./B\";
|
||||
var b1: number = DefaultB.numberValue;
|
||||
var b2: string = DefaultB.numberValue;
|
||||
import DefaultC from "C";
|
||||
import DefaultD from "./D";
|
||||
import { doesntExist1 } from "CommonJS_Clobbering_Lit";
|
||||
import { numberValue1 } from "CommonJS_Clobbering_Lit";
|
||||
import DefaultC from \"C\";
|
||||
import DefaultD from \"./D\";
|
||||
import { doesntExist1 } from \"CommonJS_Clobbering_Lit\";
|
||||
import { numberValue1 } from \"CommonJS_Clobbering_Lit\";
|
||||
var c1: number = numberValue1;
|
||||
var c2: string = numberValue1;
|
||||
import { numberValue2 as numVal1 } from "CommonJS_Clobbering_Lit";
|
||||
import { numberValue2 as numVal1 } from \"CommonJS_Clobbering_Lit\";
|
||||
var d1: number = numVal1;
|
||||
var d2: string = numVal1;
|
||||
import CJS_Clobb_Lit from "CommonJS_Clobbering_Lit";
|
||||
import CJS_Clobb_Lit from \"CommonJS_Clobbering_Lit\";
|
||||
var e1: number = CJS_Clobb_Lit.numberValue3;
|
||||
var e2: string = CJS_Clobb_Lit.numberValue3;
|
||||
CJS_Clobb_Lit.doesntExist;
|
||||
import * as CJS_Clobb_Lit_NS from "CommonJS_Clobbering_Lit";
|
||||
import * as CJS_Clobb_Lit_NS from \"CommonJS_Clobbering_Lit\";
|
||||
var f1: number = CJS_Clobb_Lit_NS.numberValue4;
|
||||
var f2: number = CJS_Clobb_Lit_NS.default.numberValue4;
|
||||
CJS_Clobb_Lit_NS.default.default;
|
||||
var f3: string = CJS_Clobb_Lit_NS.numberValue4;
|
||||
var f4: string = CJS_Clobb_Lit_NS.default.numberValue5;
|
||||
import { doesntExist2 } from "CommonJS_Clobbering_Class";
|
||||
import { staticNumber1, baseProp, childProp } from "CommonJS_Clobbering_Class";
|
||||
import CJS_Clobb_Class from "CommonJS_Clobbering_Class";
|
||||
import { doesntExist2 } from \"CommonJS_Clobbering_Class\";
|
||||
import { staticNumber1, baseProp, childProp } from \"CommonJS_Clobbering_Class\";
|
||||
import CJS_Clobb_Class from \"CommonJS_Clobbering_Class\";
|
||||
new CJS_Clobb_Class();
|
||||
new CJS_Clobb_Class().doesntExist;
|
||||
var h1: number = CJS_Clobb_Class.staticNumber2();
|
||||
var h2: string = CJS_Clobb_Class.staticNumber2();
|
||||
var h3: number = new CJS_Clobb_Class().instNumber1();
|
||||
var h4: string = new CJS_Clobb_Class().instNumber1();
|
||||
import * as CJS_Clobb_Class_NS from "CommonJS_Clobbering_Class";
|
||||
import * as CJS_Clobb_Class_NS from \"CommonJS_Clobbering_Class\";
|
||||
new CJS_Clobb_Class_NS();
|
||||
var i1: number = CJS_Clobb_Class_NS.staticNumber3();
|
||||
var i2: number = new CJS_Clobb_Class_NS.default().instNumber2();
|
||||
var i3: string = new CJS_Clobb_Class_NS.default().instNumber2();
|
||||
import { doesntExist3 } from "CommonJS_Named";
|
||||
import { numberValue2 } from "CommonJS_Named";
|
||||
import { doesntExist3 } from \"CommonJS_Named\";
|
||||
import { numberValue2 } from \"CommonJS_Named\";
|
||||
var j1: number = numberValue2;
|
||||
var j2: string = numberValue2;
|
||||
import { numberValue3 as numVal3 } from "CommonJS_Named";
|
||||
import { numberValue3 as numVal3 } from \"CommonJS_Named\";
|
||||
var k1: number = numVal3;
|
||||
var k2: string = numVal3;
|
||||
import * as CJS_Named from "CommonJS_Named";
|
||||
import * as CJS_Named from \"CommonJS_Named\";
|
||||
var l1: number = CJS_Named.numberValue1;
|
||||
var l2: string = CJS_Named.numberValue1;
|
||||
CJS_Named.doesntExist;
|
||||
import * as CJS_Named_NS from "CommonJS_Named";
|
||||
import * as CJS_Named_NS from \"CommonJS_Named\";
|
||||
var m1: number = CJS_Named_NS.numberValue4;
|
||||
var m2: string = CJS_Named_NS.default.numberValue4;
|
||||
var m3: string = CJS_Named_NS.numberValue4;
|
||||
import { doesntExist4 } from "ES6_Default_AnonFunction1";
|
||||
import ES6_Def_AnonFunc1 from "ES6_Default_AnonFunction1";
|
||||
import { doesntExist4 } from \"ES6_Default_AnonFunction1\";
|
||||
import ES6_Def_AnonFunc1 from \"ES6_Default_AnonFunction1\";
|
||||
var n1: number = ES6_Def_AnonFunc1();
|
||||
var n2: string = ES6_Def_AnonFunc1();
|
||||
import ES6_Def_NamedFunc1 from "ES6_Default_NamedFunction1";
|
||||
import ES6_Def_NamedFunc1 from \"ES6_Default_NamedFunction1\";
|
||||
var o1: number = ES6_Def_NamedFunc1();
|
||||
var o2: string = ES6_Def_NamedFunc1();
|
||||
import ES6_Def_AnonClass1 from "ES6_Default_AnonClass1";
|
||||
import ES6_Def_AnonClass1 from \"ES6_Default_AnonClass1\";
|
||||
var p1: number = new ES6_Def_AnonClass1().givesANum();
|
||||
var p2: string = new ES6_Def_AnonClass1().givesANum();
|
||||
import ES6_Def_NamedClass1 from "ES6_Default_NamedClass1";
|
||||
import ES6_Def_NamedClass1 from \"ES6_Default_NamedClass1\";
|
||||
var q1: number = new ES6_Def_NamedClass1().givesANum();
|
||||
var q2: string = new ES6_Def_NamedClass1().givesANum();
|
||||
import doesntExist5 from "ES6_Named1";
|
||||
import { specifierNumber1 as specifierNumber1_1 } from "ES6_Named1";
|
||||
import doesntExist5 from \"ES6_Named1\";
|
||||
import { specifierNumber1 as specifierNumber1_1 } from \"ES6_Named1\";
|
||||
var r1: number = specifierNumber1_1;
|
||||
var r2: string = specifierNumber1_1;
|
||||
import { specifierNumber2Renamed } from "ES6_Named1";
|
||||
import { specifierNumber2Renamed } from \"ES6_Named1\";
|
||||
var s1: number = specifierNumber2Renamed;
|
||||
var s2: string = specifierNumber2Renamed;
|
||||
import { specifierNumber3 as specifierNumber3Renamed } from "ES6_Named1";
|
||||
import { specifierNumber3 as specifierNumber3Renamed } from \"ES6_Named1\";
|
||||
var t1: number = specifierNumber3Renamed;
|
||||
var t2: string = specifierNumber3Renamed;
|
||||
import { groupedSpecifierNumber1, groupedSpecifierNumber2 } from "ES6_Named1";
|
||||
import { groupedSpecifierNumber1, groupedSpecifierNumber2 } from \"ES6_Named1\";
|
||||
var u1: number = groupedSpecifierNumber1;
|
||||
var u2: number = groupedSpecifierNumber2;
|
||||
var u3: string = groupedSpecifierNumber1;
|
||||
var u4: string = groupedSpecifierNumber2;
|
||||
import { givesANumber } from "ES6_Named1";
|
||||
import { givesANumber } from \"ES6_Named1\";
|
||||
var v1: number = givesANumber();
|
||||
var v2: string = givesANumber();
|
||||
import { NumberGenerator } from "ES6_Named1";
|
||||
import { NumberGenerator } from \"ES6_Named1\";
|
||||
var w1: number = new NumberGenerator().givesANumber();
|
||||
var w2: string = new NumberGenerator().givesANumber();
|
||||
import { varDeclNumber1, varDeclNumber2 } from "ES6_Named1";
|
||||
import { varDeclNumber1, varDeclNumber2 } from \"ES6_Named1\";
|
||||
var x1: number = varDeclNumber1;
|
||||
var x2: number = varDeclNumber2;
|
||||
var x3: string = varDeclNumber1;
|
||||
var x4: string = varDeclNumber2;
|
||||
import { destructuredObjNumber } from "ES6_Named1";
|
||||
import { destructuredObjNumber } from \"ES6_Named1\";
|
||||
var y1: number = destructuredObjNumber;
|
||||
var y2: string = destructuredObjNumber;
|
||||
import { destructuredArrNumber } from "ES6_Named1";
|
||||
import { destructuredArrNumber } from \"ES6_Named1\";
|
||||
var z1: number = destructuredArrNumber;
|
||||
var z2: string = destructuredArrNumber;
|
||||
import { numberValue1 as numberValue4 } from "ES6_ExportFrom_Intermediary1";
|
||||
import { numberValue1 as numberValue4 } from \"ES6_ExportFrom_Intermediary1\";
|
||||
var aa1: number = numberValue4;
|
||||
var aa2: string = numberValue4;
|
||||
import { numberValue2_renamed } from "ES6_ExportFrom_Intermediary1";
|
||||
import { numberValue2_renamed } from \"ES6_ExportFrom_Intermediary1\";
|
||||
var ab1: number = numberValue2_renamed;
|
||||
var ab2: string = numberValue2_renamed;
|
||||
import { numberValue1 as numberValue5 } from "ES6_ExportAllFrom_Intermediary1";
|
||||
import { numberValue1 as numberValue5 } from \"ES6_ExportAllFrom_Intermediary1\";
|
||||
var ac1: number = numberValue5;
|
||||
var ac2: string = numberValue5;
|
||||
require("ES6_Default_AnonFunction2").doesntExist;
|
||||
var ES6_Def_AnonFunc2 = require("ES6_Default_AnonFunction2").default;
|
||||
require(\"ES6_Default_AnonFunction2\").doesntExist;
|
||||
var ES6_Def_AnonFunc2 = require(\"ES6_Default_AnonFunction2\").default;
|
||||
var ad1: number = ES6_Def_AnonFunc2();
|
||||
var ad2: string = ES6_Def_AnonFunc2();
|
||||
var ES6_Def_NamedFunc2 = require("ES6_Default_NamedFunction2").default;
|
||||
var ES6_Def_NamedFunc2 = require(\"ES6_Default_NamedFunction2\").default;
|
||||
var ae1: number = ES6_Def_NamedFunc2();
|
||||
var ae2: string = ES6_Def_NamedFunc2();
|
||||
var ES6_Def_AnonClass2 = require("ES6_Default_AnonClass2").default;
|
||||
var ES6_Def_AnonClass2 = require(\"ES6_Default_AnonClass2\").default;
|
||||
var af1: number = new ES6_Def_AnonClass2().givesANum();
|
||||
var af2: string = new ES6_Def_AnonClass2().givesANum();
|
||||
var ES6_Def_NamedClass2 = require("ES6_Default_NamedClass2").default;
|
||||
var ES6_Def_NamedClass2 = require(\"ES6_Default_NamedClass2\").default;
|
||||
var ag1: number = new ES6_Def_NamedClass2().givesANum();
|
||||
var ag2: string = new ES6_Def_NamedClass2().givesANum();
|
||||
var specifierNumber4 = require("ES6_Named2").specifierNumber4;
|
||||
var specifierNumber4 = require(\"ES6_Named2\").specifierNumber4;
|
||||
var ah1: number = specifierNumber4;
|
||||
var ah2: string = specifierNumber4;
|
||||
var specifierNumber5Renamed = require("ES6_Named2").specifierNumber5Renamed;
|
||||
var specifierNumber5Renamed = require(\"ES6_Named2\").specifierNumber5Renamed;
|
||||
var ai1: number = specifierNumber5Renamed;
|
||||
var ai2: string = specifierNumber5Renamed;
|
||||
var groupedSpecifierNumber3 = require("ES6_Named2").groupedSpecifierNumber3;
|
||||
var groupedSpecifierNumber4 = require("ES6_Named2").groupedSpecifierNumber4;
|
||||
var groupedSpecifierNumber3 = require(\"ES6_Named2\").groupedSpecifierNumber3;
|
||||
var groupedSpecifierNumber4 = require(\"ES6_Named2\").groupedSpecifierNumber4;
|
||||
var aj1: number = groupedSpecifierNumber3;
|
||||
var aj2: number = groupedSpecifierNumber4;
|
||||
var aj3: string = groupedSpecifierNumber3;
|
||||
var aj4: string = groupedSpecifierNumber4;
|
||||
var givesANumber2 = require("ES6_Named2").givesANumber2;
|
||||
var givesANumber2 = require(\"ES6_Named2\").givesANumber2;
|
||||
var ak1: number = givesANumber2();
|
||||
var ak2: string = givesANumber2();
|
||||
var NumberGenerator2 = require("ES6_Named2").NumberGenerator2;
|
||||
var NumberGenerator2 = require(\"ES6_Named2\").NumberGenerator2;
|
||||
var al1: number = new NumberGenerator2().givesANumber();
|
||||
var al2: string = new NumberGenerator2().givesANumber();
|
||||
var varDeclNumber3 = require("ES6_Named2").varDeclNumber3;
|
||||
var varDeclNumber4 = require("ES6_Named2").varDeclNumber4;
|
||||
var varDeclNumber3 = require(\"ES6_Named2\").varDeclNumber3;
|
||||
var varDeclNumber4 = require(\"ES6_Named2\").varDeclNumber4;
|
||||
var am1: number = varDeclNumber3;
|
||||
var am2: number = varDeclNumber4;
|
||||
var am3: string = varDeclNumber3;
|
||||
var am4: string = varDeclNumber4;
|
||||
var destructuredObjNumber2 = require("ES6_Named2").destructuredObjNumber2;
|
||||
var destructuredObjNumber2 = require(\"ES6_Named2\").destructuredObjNumber2;
|
||||
var an1: number = destructuredObjNumber2;
|
||||
var an2: string = destructuredObjNumber2;
|
||||
var destructuredArrNumber2 = require("ES6_Named2").destructuredArrNumber2;
|
||||
var destructuredArrNumber2 = require(\"ES6_Named2\").destructuredArrNumber2;
|
||||
var ao1: number = destructuredArrNumber2;
|
||||
var ao2: string = destructuredArrNumber2;
|
||||
var numberValue6 = require("ES6_ExportFrom_Intermediary2").numberValue1;
|
||||
var numberValue6 = require(\"ES6_ExportFrom_Intermediary2\").numberValue1;
|
||||
var ap1: number = numberValue6;
|
||||
var ap2: string = numberValue6;
|
||||
var numberValue2_renamed2 = require(
|
||||
"ES6_ExportFrom_Intermediary2"
|
||||
\"ES6_ExportFrom_Intermediary2\"
|
||||
).numberValue2_renamed2;
|
||||
var aq1: number = numberValue2_renamed2;
|
||||
var aq2: string = numberValue2_renamed2;
|
||||
var numberValue7 = require("ES6_ExportAllFrom_Intermediary2").numberValue2;
|
||||
var numberValue7 = require(\"ES6_ExportAllFrom_Intermediary2\").numberValue2;
|
||||
var ar1: number = numberValue7;
|
||||
var ar2: string = numberValue7;
|
||||
import defaultNum, { str as namedStr } from "./ES6_DefaultAndNamed";
|
||||
import defaultNum, { str as namedStr } from \"./ES6_DefaultAndNamed\";
|
||||
var as1: number = defaultNum;
|
||||
var as2: string = defaultNum;
|
||||
var as3: string = namedStr;
|
||||
var as4: number = namedStr;
|
||||
import "./SideEffects";
|
||||
import specifierNumber1 from "ES6_Named1";
|
||||
import { specifierNumber } from "ES6_Named1";
|
||||
import { numberValue1 as numberValue8, numberValue2 as numberValue9 } from "./ES6_ExportAllFromMulti";
|
||||
import \"./SideEffects\";
|
||||
import specifierNumber1 from \"ES6_Named1\";
|
||||
import { specifierNumber } from \"ES6_Named1\";
|
||||
import { numberValue1 as numberValue8, numberValue2 as numberValue9 } from \"./ES6_ExportAllFromMulti\";
|
||||
var at1: number = numberValue8;
|
||||
var at2: string = numberValue8;
|
||||
var at3: number = numberValue9;
|
||||
var at4: string = numberValue9;
|
||||
import { typeAlias } from "./ExportType";
|
||||
import { typeAlias } from \"./ExportType\";
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -1259,27 +1259,27 @@ exports[`test test_imports_are_frozen.js 1`] = `
|
|||
//
|
||||
|
||||
// CommonJS module
|
||||
import * as DefaultA from "A";
|
||||
import * as DefaultA from \"A\";
|
||||
DefaultA.numberValue1 = 123; // Error: DefaultA is frozen
|
||||
|
||||
// ES6 module
|
||||
import * as ES6_Named1 from "ES6_Named1";
|
||||
import * as ES6_Named1 from \"ES6_Named1\";
|
||||
ES6_Named1.varDeclNumber1 = 123; // Error: ES6_Named1 is frozen
|
||||
|
||||
// CommonJS module that clobbers module.exports
|
||||
import * as CommonJS_Star from "CommonJS_Clobbering_Lit";
|
||||
import * as CommonJS_Star from \"CommonJS_Clobbering_Lit\";
|
||||
CommonJS_Star.numberValue1 = 123; // Error: frozen
|
||||
CommonJS_Star.default.numberValue1 = 123; // ok
|
||||
|
||||
import CommonJS_Clobbering_Lit from "CommonJS_Clobbering_Lit";
|
||||
import CommonJS_Clobbering_Lit from \"CommonJS_Clobbering_Lit\";
|
||||
CommonJS_Clobbering_Lit.numberValue1 = 123; // ok
|
||||
|
||||
// CommonJS module that clobbers module.exports with a frozen object
|
||||
import * as CommonJS_Frozen_Star from "CommonJS_Clobbering_Frozen";
|
||||
import * as CommonJS_Frozen_Star from \"CommonJS_Clobbering_Frozen\";
|
||||
CommonJS_Frozen_Star.numberValue1 = 123; // Error: frozen
|
||||
CommonJS_Frozen_Star.default.numberValue1 = 123; // Error: frozen
|
||||
|
||||
import CommonJS_Clobbering_Frozen from "CommonJS_Clobbering_Frozen";
|
||||
import CommonJS_Clobbering_Frozen from \"CommonJS_Clobbering_Frozen\";
|
||||
CommonJS_Clobbering_Frozen.numberValue1 = 123; // Error: exports are frozen
|
||||
|
||||
|
||||
|
@ -1289,19 +1289,19 @@ CommonJS_Clobbering_Frozen.numberValue1 = 123; // Error: exports are frozen
|
|||
|
||||
function testRequires() {
|
||||
// CommonJS module
|
||||
var DefaultA = require("A");
|
||||
var DefaultA = require(\"A\");
|
||||
DefaultA.numberValue1 = 123; // ok, not frozen by default
|
||||
|
||||
// ES6 module
|
||||
var ES6_Named1 = require("ES6_Named1");
|
||||
var ES6_Named1 = require(\"ES6_Named1\");
|
||||
ES6_Named1.numberValue = 123; // error, es6 exports are frozen
|
||||
|
||||
// CommonJS module that clobbers module.exports
|
||||
var CommonJS_Star = require("CommonJS_Clobbering_Lit");
|
||||
var CommonJS_Star = require(\"CommonJS_Clobbering_Lit\");
|
||||
CommonJS_Star.numberValue1 = 123; // ok, not frozen by default
|
||||
|
||||
// CommonJS module that clobbers module.exports with a frozen object
|
||||
var CommonJS_Frozen_Star = require("CommonJS_Clobbering_Frozen");
|
||||
var CommonJS_Frozen_Star = require(\"CommonJS_Clobbering_Frozen\");
|
||||
CommonJS_Frozen_Star.numberValue1 = 123; // Error: frozen
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -1332,28 +1332,28 @@ function testRequires() {
|
|||
// ok, not frozen by default
|
||||
// CommonJS module that clobbers module.exports with a frozen object
|
||||
// Error: frozen
|
||||
import * as DefaultA from "A";
|
||||
import * as DefaultA from \"A\";
|
||||
DefaultA.numberValue1 = 123;
|
||||
import * as ES6_Named1 from "ES6_Named1";
|
||||
import * as ES6_Named1 from \"ES6_Named1\";
|
||||
ES6_Named1.varDeclNumber1 = 123;
|
||||
import * as CommonJS_Star from "CommonJS_Clobbering_Lit";
|
||||
import * as CommonJS_Star from \"CommonJS_Clobbering_Lit\";
|
||||
CommonJS_Star.numberValue1 = 123;
|
||||
CommonJS_Star.default.numberValue1 = 123;
|
||||
import CommonJS_Clobbering_Lit from "CommonJS_Clobbering_Lit";
|
||||
import CommonJS_Clobbering_Lit from \"CommonJS_Clobbering_Lit\";
|
||||
CommonJS_Clobbering_Lit.numberValue1 = 123;
|
||||
import * as CommonJS_Frozen_Star from "CommonJS_Clobbering_Frozen";
|
||||
import * as CommonJS_Frozen_Star from \"CommonJS_Clobbering_Frozen\";
|
||||
CommonJS_Frozen_Star.numberValue1 = 123;
|
||||
CommonJS_Frozen_Star.default.numberValue1 = 123;
|
||||
import CommonJS_Clobbering_Frozen from "CommonJS_Clobbering_Frozen";
|
||||
import CommonJS_Clobbering_Frozen from \"CommonJS_Clobbering_Frozen\";
|
||||
CommonJS_Clobbering_Frozen.numberValue1 = 123;
|
||||
function testRequires() {
|
||||
var DefaultA = require("A");
|
||||
var DefaultA = require(\"A\");
|
||||
DefaultA.numberValue1 = 123;
|
||||
var ES6_Named1 = require("ES6_Named1");
|
||||
var ES6_Named1 = require(\"ES6_Named1\");
|
||||
ES6_Named1.numberValue = 123;
|
||||
var CommonJS_Star = require("CommonJS_Clobbering_Lit");
|
||||
var CommonJS_Star = require(\"CommonJS_Clobbering_Lit\");
|
||||
CommonJS_Star.numberValue1 = 123;
|
||||
var CommonJS_Frozen_Star = require("CommonJS_Clobbering_Frozen");
|
||||
var CommonJS_Frozen_Star = require(\"CommonJS_Clobbering_Frozen\");
|
||||
CommonJS_Frozen_Star.numberValue1 = 123;
|
||||
}
|
||||
"
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
exports[`test es_declare_module.js 1`] = `
|
||||
"// @flow
|
||||
|
||||
import {num1, str1} from "CJS_Named";
|
||||
import CJS_Named from "CJS_Named";
|
||||
import {num1, str1} from \"CJS_Named\";
|
||||
import CJS_Named from \"CJS_Named\";
|
||||
(num1: number);
|
||||
(num1: string); // Error: number ~> string
|
||||
(str1: string);
|
||||
|
@ -10,36 +10,36 @@ import CJS_Named from "CJS_Named";
|
|||
(CJS_Named: {num1: number, str1: string});
|
||||
(CJS_Named: number); // Error: Module ~> number
|
||||
|
||||
import {num2} from "CJS_Clobbered"; // Error: No such export!
|
||||
import {numExport} from "CJS_Clobbered";
|
||||
import {num2} from \"CJS_Clobbered\"; // Error: No such export!
|
||||
import {numExport} from \"CJS_Clobbered\";
|
||||
(numExport: number);
|
||||
(numExport: string); // Error: number ~> string
|
||||
import type {numType} from "CJS_Clobbered";
|
||||
import type {numType} from \"CJS_Clobbered\";
|
||||
(42: numType);
|
||||
('asdf': numType); // Error: string ~> number
|
||||
(\'asdf\': numType); // Error: string ~> number
|
||||
|
||||
import {strHidden} from "ES"; // Error: No such export!
|
||||
import {str3} from "ES";
|
||||
import {strHidden} from \"ES\"; // Error: No such export!
|
||||
import {str3} from \"ES\";
|
||||
(str3: string);
|
||||
(str3: number); // Error: string ~> number
|
||||
|
||||
import {num3} from "ES";
|
||||
import {num3} from \"ES\";
|
||||
(num3: number);
|
||||
(num3: string); // Error: number ~> string
|
||||
|
||||
import {C} from "ES";
|
||||
import type {C as CType} from "ES";
|
||||
import {C} from \"ES\";
|
||||
import type {C as CType} from \"ES\";
|
||||
(new C(): C);
|
||||
(42: C); // Error: number ~> C
|
||||
(new C(): CType);
|
||||
(42: CType); // Error: number ~> CType
|
||||
|
||||
import {T} from "ES"; // Error: T is a type import, not a value
|
||||
import type {T as T2} from "ES";
|
||||
import {T} from \"ES\"; // Error: T is a type import, not a value
|
||||
import type {T as T2} from \"ES\";
|
||||
(42: T2);
|
||||
('asdf': T2); // Error: string ~> number
|
||||
(\'asdf\': T2); // Error: string ~> number
|
||||
|
||||
import {exports as nope} from "ES"; // Error: Not an export
|
||||
import {exports as nope} from \"ES\"; // Error: Not an export
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
// Error: number ~> string
|
||||
|
@ -56,38 +56,38 @@ import {exports as nope} from "ES"; // Error: Not an export
|
|||
// Error: T is a type import, not a value
|
||||
// Error: string ~> number
|
||||
// Error: Not an export
|
||||
import { num1, str1 } from "CJS_Named";
|
||||
import CJS_Named from "CJS_Named";
|
||||
import { num1, str1 } from \"CJS_Named\";
|
||||
import CJS_Named from \"CJS_Named\";
|
||||
(num1: number);
|
||||
(num1: string);
|
||||
(str1: string);
|
||||
(str1: number);
|
||||
(CJS_Named: { num1: number; str1: string });
|
||||
(CJS_Named: number);
|
||||
import { num2 } from "CJS_Clobbered";
|
||||
import { numExport } from "CJS_Clobbered";
|
||||
import { num2 } from \"CJS_Clobbered\";
|
||||
import { numExport } from \"CJS_Clobbered\";
|
||||
(numExport: number);
|
||||
(numExport: string);
|
||||
import type { numType } from "CJS_Clobbered";
|
||||
import type { numType } from \"CJS_Clobbered\";
|
||||
(42: numType);
|
||||
("asdf": numType);
|
||||
import { strHidden } from "ES";
|
||||
import { str3 } from "ES";
|
||||
(\"asdf\": numType);
|
||||
import { strHidden } from \"ES\";
|
||||
import { str3 } from \"ES\";
|
||||
(str3: string);
|
||||
(str3: number);
|
||||
import { num3 } from "ES";
|
||||
import { num3 } from \"ES\";
|
||||
(num3: number);
|
||||
(num3: string);
|
||||
import { C } from "ES";
|
||||
import type { C as CType } from "ES";
|
||||
import { C } from \"ES\";
|
||||
import type { C as CType } from \"ES\";
|
||||
(new C(): C);
|
||||
(42: C);
|
||||
(new C(): CType);
|
||||
(42: CType);
|
||||
import { T } from "ES";
|
||||
import type { T as T2 } from "ES";
|
||||
import { T } from \"ES\";
|
||||
import type { T as T2 } from \"ES\";
|
||||
(42: T2);
|
||||
("asdf": T2);
|
||||
import { exports as nope } from "ES";
|
||||
(\"asdf\": T2);
|
||||
import { exports as nope } from \"ES\";
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
exports[`test P.js 1`] = `
|
||||
"module.exports = require('M');
|
||||
"module.exports = require(\'M\');
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
module.exports = require("M");
|
||||
module.exports = require(\"M\");
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`test test.js 1`] = `
|
||||
"var M = require('M');
|
||||
var N = require('N');
|
||||
"var M = require(\'M\');
|
||||
var N = require(\'N\');
|
||||
N.x = M(N.x);
|
||||
var P = require('./P'); // implementation of P redirects to module M
|
||||
var P = require(\'./P\'); // implementation of P redirects to module M
|
||||
N.y = P(N.y);
|
||||
var Q = require('Q'); // declaration of Q redirects to module M
|
||||
var Q = require(\'Q\'); // declaration of Q redirects to module M
|
||||
N.z = Q(N.z);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// implementation of P redirects to module M
|
||||
// declaration of Q redirects to module M
|
||||
var M = require("M");
|
||||
var N = require("N");
|
||||
var M = require(\"M\");
|
||||
var N = require(\"N\");
|
||||
N.x = M(N.x);
|
||||
var P = require("./P");
|
||||
var P = require(\"./P\");
|
||||
N.y = P(N.y);
|
||||
var Q = require("Q");
|
||||
var Q = require(\"Q\");
|
||||
N.z = Q(N.z);
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -8,7 +8,7 @@ declare module N {
|
|||
declare var z: number;
|
||||
}
|
||||
declare module Q {
|
||||
declare var exports: $Exports<'M'>;
|
||||
declare var exports: $Exports<\'M\'>;
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
declare module M {
|
||||
|
@ -20,7 +20,7 @@ declare module N {
|
|||
declare var z: number;
|
||||
}
|
||||
declare module Q {
|
||||
declare var exports: $Exports<"M">;
|
||||
declare var exports: $Exports<\"M\">;
|
||||
}
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -21,30 +21,30 @@ import type {
|
|||
standaloneType1,
|
||||
talias1,
|
||||
talias3,
|
||||
} from "./types_only";
|
||||
} from \"./types_only\";
|
||||
|
||||
var a: inlinedType1 = 42;
|
||||
var b: inlinedType1 = 'asdf'; // Error: string ~> number
|
||||
var b: inlinedType1 = \'asdf\'; // Error: string ~> number
|
||||
|
||||
var c: standaloneType1 = 42;
|
||||
var d: standaloneType1 = 'asdf'; // Error: string ~> number
|
||||
var d: standaloneType1 = \'asdf\'; // Error: string ~> number
|
||||
|
||||
var e: talias1 = 42;
|
||||
var f: talias1 = 'asdf'; // Error: string ~> number
|
||||
var f: talias1 = \'asdf\'; // Error: string ~> number
|
||||
|
||||
var g: talias3 = 42;
|
||||
var h: talias3 = 'asdf'; // Error: string ~> number
|
||||
var h: talias3 = \'asdf\'; // Error: string ~> number
|
||||
|
||||
import type {talias4} from "./cjs_with_types";
|
||||
import type {talias4} from \"./cjs_with_types\";
|
||||
var i: talias4 = 42;
|
||||
var j: talias4 = 'asdf'; // Error: string ~> number
|
||||
var j: talias4 = \'asdf\'; // Error: string ~> number
|
||||
|
||||
import {IFoo, IFoo2} from "./types_only";
|
||||
import {IFoo, IFoo2} from \"./types_only\";
|
||||
|
||||
var k: IFoo = {prop: 42};
|
||||
var l: IFoo = {prop: 'asdf'}; // Error: {prop:string} ~> {prop:number}
|
||||
var l: IFoo = {prop: \'asdf\'}; // Error: {prop:string} ~> {prop:number}
|
||||
|
||||
var m: IFoo2 = {prop: 'asdf'};
|
||||
var m: IFoo2 = {prop: \'asdf\'};
|
||||
var n: IFoo2 = {prop: 42}; // Error: {prop:number} ~> {prop:string}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/* @flow */
|
||||
|
@ -55,22 +55,22 @@ var n: IFoo2 = {prop: 42}; // Error: {prop:number} ~> {prop:string}
|
|||
// Error: string ~> number
|
||||
// Error: {prop:string} ~> {prop:number}
|
||||
// Error: {prop:number} ~> {prop:string}
|
||||
import type { inlinedType1, standaloneType1, talias1, talias3 } from "./types_only";
|
||||
import type { inlinedType1, standaloneType1, talias1, talias3 } from \"./types_only\";
|
||||
var a: inlinedType1 = 42;
|
||||
var b: inlinedType1 = "asdf";
|
||||
var b: inlinedType1 = \"asdf\";
|
||||
var c: standaloneType1 = 42;
|
||||
var d: standaloneType1 = "asdf";
|
||||
var d: standaloneType1 = \"asdf\";
|
||||
var e: talias1 = 42;
|
||||
var f: talias1 = "asdf";
|
||||
var f: talias1 = \"asdf\";
|
||||
var g: talias3 = 42;
|
||||
var h: talias3 = "asdf";
|
||||
import type { talias4 } from "./cjs_with_types";
|
||||
var h: talias3 = \"asdf\";
|
||||
import type { talias4 } from \"./cjs_with_types\";
|
||||
var i: talias4 = 42;
|
||||
var j: talias4 = "asdf";
|
||||
import { IFoo, IFoo2 } from "./types_only";
|
||||
var j: talias4 = \"asdf\";
|
||||
import { IFoo, IFoo2 } from \"./types_only\";
|
||||
var k: IFoo = { prop: 42 };
|
||||
var l: IFoo = { prop: "asdf" };
|
||||
var m: IFoo2 = { prop: "asdf" };
|
||||
var l: IFoo = { prop: \"asdf\" };
|
||||
var m: IFoo2 = { prop: \"asdf\" };
|
||||
var n: IFoo2 = { prop: 42 };
|
||||
"
|
||||
`;
|
||||
|
@ -80,7 +80,7 @@ exports[`test types_only.js 1`] = `
|
|||
|
||||
export type inlinedType1 = number;
|
||||
var a: inlinedType1 = 42;
|
||||
var b: inlinedType1 = 'asdf'; // Error: string ~> number
|
||||
var b: inlinedType1 = \'asdf\'; // Error: string ~> number
|
||||
|
||||
type standaloneType1 = number;
|
||||
export type {standaloneType1};
|
||||
|
@ -88,7 +88,7 @@ export type {standaloneType1};
|
|||
type standaloneType2 = number;
|
||||
export {standaloneType2}; // Error: Missing \`type\` keyword
|
||||
|
||||
export type {talias1, talias2 as talias3, IFoo2} from "./types_only2";
|
||||
export type {talias1, talias2 as talias3, IFoo2} from \"./types_only2\";
|
||||
|
||||
export interface IFoo { prop: number };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -97,12 +97,12 @@ export interface IFoo { prop: number };
|
|||
// Error: Missing \`type\` keyword
|
||||
export type inlinedType1 = number;
|
||||
var a: inlinedType1 = 42;
|
||||
var b: inlinedType1 = "asdf";
|
||||
var b: inlinedType1 = \"asdf\";
|
||||
type standaloneType1 = number;
|
||||
export { standaloneType1 }
|
||||
type standaloneType2 = number;
|
||||
export { standaloneType2 }
|
||||
export { talias1, talias2 as talias3, IFoo2 } from "./types_only2"
|
||||
export { talias1, talias2 as talias3, IFoo2 } from \"./types_only2\"
|
||||
export interface IFoo { prop: number }
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
exports[`test foo.js 1`] = `
|
||||
"var imp = require('./bar');
|
||||
"var imp = require(\'./bar\');
|
||||
imp(1337);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
var imp = require("./bar");
|
||||
var imp = require(\"./bar\");
|
||||
imp(1337);
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
exports[`test main.js 1`] = `
|
||||
"// @flow
|
||||
var React = require('react');
|
||||
var React = require(\'react\');
|
||||
(<fbt />: React.Element<*>);
|
||||
(<fbt />: number); // Error: ReactElement ~> number
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
// Error: ReactElement ~> number
|
||||
var React = require("react");
|
||||
var React = require(\"react\");
|
||||
(<fbt/>: React.Element<*>);
|
||||
(<fbt/>: number);
|
||||
"
|
||||
|
|
|
@ -22,15 +22,15 @@ let tests = [
|
|||
result.baz = false;
|
||||
(copyProperties(
|
||||
result,
|
||||
{ foo: 'a' },
|
||||
{ foo: \'a\' },
|
||||
{ bar: 123 }
|
||||
): { foo: string, bar: number, baz: boolean });
|
||||
},
|
||||
|
||||
// module from lib
|
||||
function() {
|
||||
const copyProperties = require('copyProperties');
|
||||
let x = { foo: 'a' };
|
||||
const copyProperties = require(\'copyProperties\');
|
||||
let x = { foo: \'a\' };
|
||||
let y = { bar: 123 };
|
||||
(copyProperties({}, x, y): { foo: string, bar: number });
|
||||
},
|
||||
|
@ -38,7 +38,7 @@ let tests = [
|
|||
// too few args
|
||||
function(copyProperties: Object$Assign) {
|
||||
copyProperties();
|
||||
(copyProperties({ foo: 'a' }): { foo: number }); // err, num !~> string
|
||||
(copyProperties({ foo: \'a\' }): { foo: number }); // err, num !~> string
|
||||
},
|
||||
|
||||
// passed as a function
|
||||
|
@ -63,21 +63,21 @@ let tests = [
|
|||
function(copyProperties: Object$Assign) {
|
||||
let result = {};
|
||||
result.baz = false;
|
||||
(copyProperties(result, { foo: "a" }, { bar: 123 }): {
|
||||
(copyProperties(result, { foo: \"a\" }, { bar: 123 }): {
|
||||
foo: string;
|
||||
bar: number;
|
||||
baz: boolean
|
||||
});
|
||||
},
|
||||
function() {
|
||||
const copyProperties = require("copyProperties");
|
||||
let x = { foo: "a" };
|
||||
const copyProperties = require(\"copyProperties\");
|
||||
let x = { foo: \"a\" };
|
||||
let y = { bar: 123 };
|
||||
(copyProperties({}, x, y): { foo: string; bar: number });
|
||||
},
|
||||
function(copyProperties: Object$Assign) {
|
||||
copyProperties();
|
||||
(copyProperties({ foo: "a" }): { foo: number });
|
||||
(copyProperties({ foo: \"a\" }): { foo: number });
|
||||
},
|
||||
function(copyProperties: Object$Assign) {
|
||||
function x(cb: Function) {
|
||||
|
@ -95,7 +95,7 @@ exports[`test invariant.js 1`] = `
|
|||
let tests = [
|
||||
function() {
|
||||
let x: ?string = null;
|
||||
invariant(x, 'truthy only'); // error, forgot to require invariant
|
||||
invariant(x, \'truthy only\'); // error, forgot to require invariant
|
||||
},
|
||||
|
||||
function(invariant: Function) {
|
||||
|
@ -110,7 +110,7 @@ let tests = [
|
|||
let tests = [
|
||||
function() {
|
||||
let x: ?string = null;
|
||||
invariant(x, "truthy only");
|
||||
invariant(x, \"truthy only\");
|
||||
},
|
||||
function(invariant: Function) {
|
||||
let x: ?string = null;
|
||||
|
@ -122,25 +122,25 @@ let tests = [
|
|||
`;
|
||||
|
||||
exports[`test lib.js 1`] = `
|
||||
"declare module "copyProperties" {
|
||||
"declare module \"copyProperties\" {
|
||||
declare var exports: Object$Assign;
|
||||
}
|
||||
|
||||
declare module "mergeInto" {
|
||||
declare module \"mergeInto\" {
|
||||
declare var exports: $Facebookism$MergeInto;
|
||||
}
|
||||
|
||||
declare module "mixin" {
|
||||
declare module \"mixin\" {
|
||||
declare var exports: $Facebookism$Mixin;
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
declare module "copyProperties" {
|
||||
declare module \"copyProperties\" {
|
||||
declare var exports: Object$Assign;
|
||||
}
|
||||
declare module "mergeInto" {
|
||||
declare module \"mergeInto\" {
|
||||
declare var exports: $Facebookism$MergeInto;
|
||||
}
|
||||
declare module "mixin" {
|
||||
declare module \"mixin\" {
|
||||
declare var exports: $Facebookism$Mixin;
|
||||
}
|
||||
"
|
||||
|
@ -159,15 +159,15 @@ let tests = [
|
|||
function(mergeInto: $Facebookism$MergeInto) {
|
||||
let result = {};
|
||||
result.baz = false;
|
||||
(mergeInto(result, { foo: 'a' }, { bar: 123 }): void);
|
||||
(mergeInto(result, { foo: \'a\' }, { bar: 123 }): void);
|
||||
(result: { foo: string, bar: number, baz: boolean });
|
||||
},
|
||||
|
||||
// module from lib
|
||||
function() {
|
||||
const mergeInto = require('mergeInto');
|
||||
const mergeInto = require(\'mergeInto\');
|
||||
let result: { foo?: string, bar?: number, baz: boolean } = { baz: false };
|
||||
(mergeInto(result, { foo: 'a' }, { bar: 123 }): void);
|
||||
(mergeInto(result, { foo: \'a\' }, { bar: 123 }): void);
|
||||
},
|
||||
|
||||
// too few args
|
||||
|
@ -196,13 +196,13 @@ let tests = [
|
|||
function(mergeInto: $Facebookism$MergeInto) {
|
||||
let result = {};
|
||||
result.baz = false;
|
||||
(mergeInto(result, { foo: "a" }, { bar: 123 }): void);
|
||||
(mergeInto(result, { foo: \"a\" }, { bar: 123 }): void);
|
||||
(result: { foo: string; bar: number; baz: boolean });
|
||||
},
|
||||
function() {
|
||||
const mergeInto = require("mergeInto");
|
||||
const mergeInto = require(\"mergeInto\");
|
||||
let result: { foo?: string; bar?: number; baz: boolean } = { baz: false };
|
||||
(mergeInto(result, { foo: "a" }, { bar: 123 }): void);
|
||||
(mergeInto(result, { foo: \"a\" }, { bar: 123 }): void);
|
||||
},
|
||||
function(mergeInto: $Facebookism$MergeInto) {
|
||||
mergeInto();
|
||||
|
@ -218,22 +218,22 @@ let tests = [
|
|||
`;
|
||||
|
||||
exports[`test test.js 1`] = `
|
||||
"var Bar = require('./Bar');
|
||||
var mixin = require('mixin');
|
||||
"var Bar = require(\'./Bar\');
|
||||
var mixin = require(\'mixin\');
|
||||
|
||||
class Foo extends mixin(Bar) {
|
||||
m() {
|
||||
var x: string = this.x;
|
||||
this.y = "";
|
||||
this.y = \"\";
|
||||
}
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
var Bar = require("./Bar");
|
||||
var mixin = require("mixin");
|
||||
var Bar = require(\"./Bar\");
|
||||
var mixin = require(\"mixin\");
|
||||
class Foo extends mixin(Bar) {
|
||||
m() {
|
||||
var x: string = this.x;
|
||||
this.y = "";
|
||||
this.y = \"\";
|
||||
}
|
||||
}
|
||||
"
|
||||
|
|
|
@ -6,13 +6,13 @@ module.exports = 0;
|
|||
`;
|
||||
|
||||
exports[`test test.js 1`] = `
|
||||
"var x = require('./req');
|
||||
"var x = require(\'./req\');
|
||||
(x: string);
|
||||
|
||||
import x from './req';
|
||||
import x from \'./req\';
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
var x = require("./req");
|
||||
var x = require(\"./req\");
|
||||
(x: string);
|
||||
import x from "./req";
|
||||
import x from \"./req\";
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -26,7 +26,7 @@ function mk_factorial() {
|
|||
|
||||
|
||||
var factorial = mk_factorial();
|
||||
factorial("...");
|
||||
factorial(\"...\");
|
||||
|
||||
module.exports = {fn: fix};
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -64,7 +64,7 @@ function mk_factorial() {
|
|||
);
|
||||
}
|
||||
var factorial = mk_factorial();
|
||||
factorial("...");
|
||||
factorial(\"...\");
|
||||
module.exports = { fn: fix };
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -9,7 +9,7 @@ function foo(x: boolean) {
|
|||
}
|
||||
return;
|
||||
}
|
||||
console.log('this is still reachable');
|
||||
console.log(\'this is still reachable\');
|
||||
}
|
||||
|
||||
function bar(x: boolean) {
|
||||
|
@ -17,7 +17,7 @@ function bar(x: boolean) {
|
|||
for (var ii = 0; ii < max; ii++) {
|
||||
return;
|
||||
}
|
||||
console.log('this is still reachable');
|
||||
console.log(\'this is still reachable\');
|
||||
}
|
||||
|
||||
function baz(x: boolean) {
|
||||
|
@ -25,7 +25,7 @@ function baz(x: boolean) {
|
|||
for (var ii = 0; ii < max; ii++) {
|
||||
continue;
|
||||
}
|
||||
console.log('this is still reachable');
|
||||
console.log(\'this is still reachable\');
|
||||
}
|
||||
|
||||
function bliffl(x: boolean) {
|
||||
|
@ -34,9 +34,9 @@ function bliffl(x: boolean) {
|
|||
loop2: for (var jj = 0; jj < max; jj++) {
|
||||
break loop1;
|
||||
}
|
||||
console.log('this is still reachable');
|
||||
console.log(\'this is still reachable\');
|
||||
}
|
||||
console.log('this is still reachable');
|
||||
console.log(\'this is still reachable\');
|
||||
}
|
||||
|
||||
function corge(x: boolean) {
|
||||
|
@ -44,7 +44,7 @@ function corge(x: boolean) {
|
|||
for (var ii = 0; ii < max; ii++) {
|
||||
break;
|
||||
}
|
||||
console.log('this is still reachable');
|
||||
console.log(\'this is still reachable\');
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/* @flow */
|
||||
|
@ -56,21 +56,21 @@ function foo(x: boolean) {
|
|||
}
|
||||
return;
|
||||
}
|
||||
console.log("this is still reachable");
|
||||
console.log(\"this is still reachable\");
|
||||
}
|
||||
function bar(x: boolean) {
|
||||
var max = 0;
|
||||
for (var ii = 0; ii < max; ii++) {
|
||||
return;
|
||||
}
|
||||
console.log("this is still reachable");
|
||||
console.log(\"this is still reachable\");
|
||||
}
|
||||
function baz(x: boolean) {
|
||||
var max = 0;
|
||||
for (var ii = 0; ii < max; ii++) {
|
||||
continue;
|
||||
}
|
||||
console.log("this is still reachable");
|
||||
console.log(\"this is still reachable\");
|
||||
}
|
||||
function bliffl(x: boolean) {
|
||||
var max = 10;
|
||||
|
@ -80,16 +80,16 @@ for (var ii = 0; ii < max; ii++) {
|
|||
for (var jj = 0; jj < max; jj++) {
|
||||
break loop1;
|
||||
}
|
||||
console.log("this is still reachable");
|
||||
console.log(\"this is still reachable\");
|
||||
}
|
||||
console.log("this is still reachable");
|
||||
console.log(\"this is still reachable\");
|
||||
}
|
||||
function corge(x: boolean) {
|
||||
var max = 0;
|
||||
for (var ii = 0; ii < max; ii++) {
|
||||
break;
|
||||
}
|
||||
console.log("this is still reachable");
|
||||
console.log(\"this is still reachable\");
|
||||
}
|
||||
"
|
||||
`;
|
||||
|
@ -103,21 +103,21 @@ exports[`test abnormal_for_in.js 1`] = `
|
|||
}
|
||||
return;
|
||||
}
|
||||
console.log('this is still reachable');
|
||||
console.log(\'this is still reachable\');
|
||||
}
|
||||
|
||||
function bar(x: boolean) {
|
||||
for (var prop in {}) {
|
||||
return;
|
||||
}
|
||||
console.log('this is still reachable');
|
||||
console.log(\'this is still reachable\');
|
||||
}
|
||||
|
||||
function baz(x: boolean) {
|
||||
for (var prop in {}) {
|
||||
continue;
|
||||
}
|
||||
console.log('this is still reachable');
|
||||
console.log(\'this is still reachable\');
|
||||
}
|
||||
|
||||
function bliffl(x: boolean) {
|
||||
|
@ -126,16 +126,16 @@ function bliffl(x: boolean) {
|
|||
loop2: for (var prop2 in obj) {
|
||||
break loop1;
|
||||
}
|
||||
console.log('this is still reachable');
|
||||
console.log(\'this is still reachable\');
|
||||
}
|
||||
console.log('this is still reachable');
|
||||
console.log(\'this is still reachable\');
|
||||
}
|
||||
|
||||
function corge(x: boolean) {
|
||||
for (var prop in {}) {
|
||||
break;
|
||||
}
|
||||
console.log('this is still reachable');
|
||||
console.log(\'this is still reachable\');
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
function foo(x: boolean) {
|
||||
|
@ -146,19 +146,19 @@ function foo(x: boolean) {
|
|||
}
|
||||
return;
|
||||
}
|
||||
console.log("this is still reachable");
|
||||
console.log(\"this is still reachable\");
|
||||
}
|
||||
function bar(x: boolean) {
|
||||
for (var prop in {}) {
|
||||
return;
|
||||
}
|
||||
console.log("this is still reachable");
|
||||
console.log(\"this is still reachable\");
|
||||
}
|
||||
function baz(x: boolean) {
|
||||
for (var prop in {}) {
|
||||
continue;
|
||||
}
|
||||
console.log("this is still reachable");
|
||||
console.log(\"this is still reachable\");
|
||||
}
|
||||
function bliffl(x: boolean) {
|
||||
var obj = { a: 1, b: 2 };
|
||||
|
@ -168,15 +168,15 @@ for (var prop1 in obj) {
|
|||
for (var prop2 in obj) {
|
||||
break loop1;
|
||||
}
|
||||
console.log("this is still reachable");
|
||||
console.log(\"this is still reachable\");
|
||||
}
|
||||
console.log("this is still reachable");
|
||||
console.log(\"this is still reachable\");
|
||||
}
|
||||
function corge(x: boolean) {
|
||||
for (var prop in {}) {
|
||||
break;
|
||||
}
|
||||
console.log("this is still reachable");
|
||||
console.log(\"this is still reachable\");
|
||||
}
|
||||
"
|
||||
`;
|
||||
|
@ -190,21 +190,21 @@ exports[`test abnormal_for_of.js 1`] = `
|
|||
}
|
||||
return;
|
||||
}
|
||||
console.log('this is still reachable');
|
||||
console.log(\'this is still reachable\');
|
||||
}
|
||||
|
||||
function bar(x: boolean) {
|
||||
for (var elem of []) {
|
||||
return;
|
||||
}
|
||||
console.log('this is still reachable');
|
||||
console.log(\'this is still reachable\');
|
||||
}
|
||||
|
||||
function baz(x: boolean) {
|
||||
for (var elem of []) {
|
||||
continue;
|
||||
}
|
||||
console.log('this is still reachable');
|
||||
console.log(\'this is still reachable\');
|
||||
}
|
||||
|
||||
function bliffl(x: boolean) {
|
||||
|
@ -213,16 +213,16 @@ function bliffl(x: boolean) {
|
|||
loop2: for (var elem of arr) {
|
||||
break loop1;
|
||||
}
|
||||
console.log('this is still reachable');
|
||||
console.log(\'this is still reachable\');
|
||||
}
|
||||
console.log('this is still reachable');
|
||||
console.log(\'this is still reachable\');
|
||||
}
|
||||
|
||||
function corge(x: boolean) {
|
||||
for (var elem of []) {
|
||||
break;
|
||||
}
|
||||
console.log('this is still reachable');
|
||||
console.log(\'this is still reachable\');
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
function foo(x: boolean) {
|
||||
|
@ -233,19 +233,19 @@ function foo(x: boolean) {
|
|||
}
|
||||
return;
|
||||
}
|
||||
console.log("this is still reachable");
|
||||
console.log(\"this is still reachable\");
|
||||
}
|
||||
function bar(x: boolean) {
|
||||
for (var elem of [ ]) {
|
||||
return;
|
||||
}
|
||||
console.log("this is still reachable");
|
||||
console.log(\"this is still reachable\");
|
||||
}
|
||||
function baz(x: boolean) {
|
||||
for (var elem of [ ]) {
|
||||
continue;
|
||||
}
|
||||
console.log("this is still reachable");
|
||||
console.log(\"this is still reachable\");
|
||||
}
|
||||
function bliffl(x: boolean) {
|
||||
var arr = [ 1, 2, 3 ];
|
||||
|
@ -255,15 +255,15 @@ for (var elem of arr) {
|
|||
for (var elem of arr) {
|
||||
break loop1;
|
||||
}
|
||||
console.log("this is still reachable");
|
||||
console.log(\"this is still reachable\");
|
||||
}
|
||||
console.log("this is still reachable");
|
||||
console.log(\"this is still reachable\");
|
||||
}
|
||||
function corge(x: boolean) {
|
||||
for (var elem of [ ]) {
|
||||
break;
|
||||
}
|
||||
console.log("this is still reachable");
|
||||
console.log(\"this is still reachable\");
|
||||
}
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -2,7 +2,7 @@ exports[`test class.js 1`] = `
|
|||
"class GeneratorExamples {
|
||||
*stmt_yield(): Generator<number, void, void> {
|
||||
yield 0; // ok
|
||||
yield ""; // error: string ~> number
|
||||
yield \"\"; // error: string ~> number
|
||||
}
|
||||
|
||||
*stmt_next(): Generator<void, void, number> {
|
||||
|
@ -22,18 +22,18 @@ exports[`test class.js 1`] = `
|
|||
}
|
||||
|
||||
*stmt_return_err(): Generator<void, number, void> {
|
||||
return ""; // error: string ~> number
|
||||
return \"\"; // error: string ~> number
|
||||
}
|
||||
|
||||
*infer_stmt() {
|
||||
var x: boolean = yield 0; // error: number ~> boolean
|
||||
return "";
|
||||
return \"\";
|
||||
}
|
||||
|
||||
*widen_next() {
|
||||
var x = yield 0;
|
||||
if (typeof x === "number") {
|
||||
} else if (typeof x === "boolean") {
|
||||
if (typeof x === \"number\") {
|
||||
} else if (typeof x === \"boolean\") {
|
||||
} else {
|
||||
(x : string) // ok, sherlock
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ exports[`test class.js 1`] = `
|
|||
|
||||
*widen_yield() {
|
||||
yield 0;
|
||||
yield "";
|
||||
yield \"\";
|
||||
yield true;
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ exports[`test class.js 1`] = `
|
|||
|
||||
*delegate_yield_generator() {
|
||||
function *inner() {
|
||||
yield "";
|
||||
yield \"\";
|
||||
}
|
||||
|
||||
yield *inner();
|
||||
|
@ -62,7 +62,7 @@ exports[`test class.js 1`] = `
|
|||
|
||||
*delegate_return_generator() {
|
||||
function *inner() {
|
||||
return "";
|
||||
return \"\";
|
||||
}
|
||||
|
||||
var x: number = yield *inner(); // error: string ~> number
|
||||
|
@ -99,31 +99,31 @@ var examples = new GeneratorExamples();
|
|||
for (var x of examples.infer_stmt()) { (x : string) } // error: number ~> string
|
||||
|
||||
var infer_stmt_next = examples.infer_stmt().next(0).value; // error: number ~> boolean
|
||||
if (typeof infer_stmt_next === "undefined") {
|
||||
} else if (typeof infer_stmt_next === "number") {
|
||||
if (typeof infer_stmt_next === \"undefined\") {
|
||||
} else if (typeof infer_stmt_next === \"number\") {
|
||||
} else {
|
||||
(infer_stmt_next : boolean) // error: string ~> boolean
|
||||
}
|
||||
|
||||
examples.widen_next().next(0)
|
||||
examples.widen_next().next("")
|
||||
examples.widen_next().next(\"\")
|
||||
examples.widen_next().next(true)
|
||||
|
||||
for (var x of examples.widen_yield()) {
|
||||
if (typeof x === "number") {
|
||||
} else if (typeof x === "boolean") {
|
||||
if (typeof x === \"number\") {
|
||||
} else if (typeof x === \"boolean\") {
|
||||
} else {
|
||||
(x : string) // ok, sherlock
|
||||
}
|
||||
}
|
||||
|
||||
examples.delegate_next_generator().next("");
|
||||
examples.delegate_next_generator().next(\"\");
|
||||
|
||||
for (var x of examples.delegate_yield_generator()) {
|
||||
(x : number) // error: string ~> number
|
||||
}
|
||||
|
||||
examples.delegate_next_iterable([]).next(""); // error: Iterator has no next value
|
||||
examples.delegate_next_iterable([]).next(\"\"); // error: Iterator has no next value
|
||||
|
||||
for (var x of examples.delegate_yield_iterable([])) {
|
||||
(x : string) // error: number ~> string
|
||||
|
@ -151,7 +151,7 @@ for (var x of examples.delegate_yield_iterable([])) {
|
|||
class GeneratorExamples {
|
||||
*stmt_yield(): Generator<number, void, void> {
|
||||
yield 0;
|
||||
yield "";
|
||||
yield \"\";
|
||||
}
|
||||
*stmt_next(): Generator<void, void, number> {
|
||||
var a = yield;
|
||||
|
@ -167,18 +167,18 @@ class GeneratorExamples {
|
|||
return 0;
|
||||
}
|
||||
*stmt_return_err(): Generator<void, number, void> {
|
||||
return "";
|
||||
return \"\";
|
||||
}
|
||||
*infer_stmt() {
|
||||
var x: boolean = yield 0;
|
||||
return "";
|
||||
return \"\";
|
||||
}
|
||||
*widen_next() {
|
||||
var x = yield 0;
|
||||
if (typeof x === "number") {
|
||||
if (typeof x === \"number\") {
|
||||
|
||||
} else
|
||||
if (typeof x === "boolean") {
|
||||
if (typeof x === \"boolean\") {
|
||||
|
||||
} else {
|
||||
(x: string);
|
||||
|
@ -186,7 +186,7 @@ class GeneratorExamples {
|
|||
}
|
||||
*widen_yield() {
|
||||
yield 0;
|
||||
yield "";
|
||||
yield \"\";
|
||||
yield true;
|
||||
}
|
||||
*delegate_next_generator() {
|
||||
|
@ -197,13 +197,13 @@ class GeneratorExamples {
|
|||
}
|
||||
*delegate_yield_generator() {
|
||||
function* inner() {
|
||||
yield "";
|
||||
yield \"\";
|
||||
}
|
||||
yield* inner();
|
||||
}
|
||||
*delegate_return_generator() {
|
||||
function* inner() {
|
||||
return "";
|
||||
return \"\";
|
||||
}
|
||||
var x: number = yield* inner();
|
||||
}
|
||||
|
@ -231,32 +231,32 @@ for (var x of examples.infer_stmt()) {
|
|||
(x: string);
|
||||
}
|
||||
var infer_stmt_next = examples.infer_stmt().next(0).value;
|
||||
if (typeof infer_stmt_next === "undefined") {
|
||||
if (typeof infer_stmt_next === \"undefined\") {
|
||||
|
||||
} else
|
||||
if (typeof infer_stmt_next === "number") {
|
||||
if (typeof infer_stmt_next === \"number\") {
|
||||
|
||||
} else {
|
||||
(infer_stmt_next: boolean);
|
||||
}
|
||||
examples.widen_next().next(0);
|
||||
examples.widen_next().next("");
|
||||
examples.widen_next().next(\"\");
|
||||
examples.widen_next().next(true);
|
||||
for (var x of examples.widen_yield()) {
|
||||
if (typeof x === "number") {
|
||||
if (typeof x === \"number\") {
|
||||
|
||||
} else
|
||||
if (typeof x === "boolean") {
|
||||
if (typeof x === \"boolean\") {
|
||||
|
||||
} else {
|
||||
(x: string);
|
||||
}
|
||||
}
|
||||
examples.delegate_next_generator().next("");
|
||||
examples.delegate_next_generator().next(\"\");
|
||||
for (var x of examples.delegate_yield_generator()) {
|
||||
(x: number);
|
||||
}
|
||||
examples.delegate_next_iterable([ ]).next("");
|
||||
examples.delegate_next_iterable([ ]).next(\"\");
|
||||
for (var x of examples.delegate_yield_iterable([ ])) {
|
||||
(x: string);
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ exports[`test class_failure.js 1`] = `
|
|||
class GeneratorExamples<X> {
|
||||
*infer_stmt() {
|
||||
var x: boolean = yield 0; // error: number ~> boolean
|
||||
return "";
|
||||
return \"\";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -279,8 +279,8 @@ for (var x of examples.infer_stmt()) { (x : string) } // error: number ~> string
|
|||
|
||||
var infer_stmt_next = examples.infer_stmt().next(0).value; // error: number ~> boolean
|
||||
|
||||
if (typeof infer_stmt_next === "undefined") {
|
||||
} else if (typeof infer_stmt_next === "number") {
|
||||
if (typeof infer_stmt_next === \"undefined\") {
|
||||
} else if (typeof infer_stmt_next === \"number\") {
|
||||
} else {
|
||||
(infer_stmt_next : boolean) // error: string ~> boolean
|
||||
}
|
||||
|
@ -293,7 +293,7 @@ if (typeof infer_stmt_next === "undefined") {
|
|||
class GeneratorExamples<X> {
|
||||
*infer_stmt() {
|
||||
var x: boolean = yield 0;
|
||||
return "";
|
||||
return \"\";
|
||||
}
|
||||
}
|
||||
var examples = new GeneratorExamples();
|
||||
|
@ -301,10 +301,10 @@ for (var x of examples.infer_stmt()) {
|
|||
(x: string);
|
||||
}
|
||||
var infer_stmt_next = examples.infer_stmt().next(0).value;
|
||||
if (typeof infer_stmt_next === "undefined") {
|
||||
if (typeof infer_stmt_next === \"undefined\") {
|
||||
|
||||
} else
|
||||
if (typeof infer_stmt_next === "number") {
|
||||
if (typeof infer_stmt_next === \"number\") {
|
||||
|
||||
} else {
|
||||
(infer_stmt_next: boolean);
|
||||
|
@ -315,7 +315,7 @@ if (typeof infer_stmt_next === "undefined") {
|
|||
exports[`test generators.js 1`] = `
|
||||
"function *stmt_yield(): Generator<number, void, void> {
|
||||
yield 0; // ok
|
||||
yield ""; // error: string ~> number
|
||||
yield \"\"; // error: string ~> number
|
||||
}
|
||||
|
||||
function *stmt_next(): Generator<void, void, number> {
|
||||
|
@ -335,41 +335,41 @@ function *stmt_return_ok(): Generator<void, number, void> {
|
|||
}
|
||||
|
||||
function *stmt_return_err(): Generator<void, number, void> {
|
||||
return ""; // error: string ~> number
|
||||
return \"\"; // error: string ~> number
|
||||
}
|
||||
|
||||
function *infer_stmt() {
|
||||
var x: boolean = yield 0;
|
||||
return "";
|
||||
return \"\";
|
||||
}
|
||||
for (var x of infer_stmt()) { (x : string) } // error: number ~> string
|
||||
var infer_stmt_next = infer_stmt().next(0).value; // error: number ~> boolean
|
||||
if (typeof infer_stmt_next === "undefined") {
|
||||
} else if (typeof infer_stmt_next === "number") {
|
||||
if (typeof infer_stmt_next === \"undefined\") {
|
||||
} else if (typeof infer_stmt_next === \"number\") {
|
||||
} else {
|
||||
(infer_stmt_next : boolean) // error: string ~> boolean
|
||||
}
|
||||
|
||||
function *widen_next() {
|
||||
var x = yield 0;
|
||||
if (typeof x === "number") {
|
||||
} else if (typeof x === "boolean") {
|
||||
if (typeof x === \"number\") {
|
||||
} else if (typeof x === \"boolean\") {
|
||||
} else {
|
||||
(x : string) // ok, sherlock
|
||||
}
|
||||
}
|
||||
widen_next().next(0)
|
||||
widen_next().next("")
|
||||
widen_next().next(\"\")
|
||||
widen_next().next(true)
|
||||
|
||||
function *widen_yield() {
|
||||
yield 0;
|
||||
yield "";
|
||||
yield \"\";
|
||||
yield true;
|
||||
}
|
||||
for (var x of widen_yield()) {
|
||||
if (typeof x === "number") {
|
||||
} else if (typeof x === "boolean") {
|
||||
if (typeof x === \"number\") {
|
||||
} else if (typeof x === \"boolean\") {
|
||||
} else {
|
||||
(x : string) // ok, sherlock
|
||||
}
|
||||
|
@ -381,11 +381,11 @@ function *delegate_next_generator() {
|
|||
}
|
||||
yield *inner();
|
||||
}
|
||||
delegate_next_generator().next("");
|
||||
delegate_next_generator().next(\"\");
|
||||
|
||||
function *delegate_yield_generator() {
|
||||
function *inner() {
|
||||
yield "";
|
||||
yield \"\";
|
||||
}
|
||||
|
||||
yield *inner();
|
||||
|
@ -396,7 +396,7 @@ for (var x of delegate_yield_generator()) {
|
|||
|
||||
function *delegate_return_generator() {
|
||||
function *inner() {
|
||||
return "";
|
||||
return \"\";
|
||||
}
|
||||
|
||||
var x: number = yield *inner(); // error: string ~> number
|
||||
|
@ -406,7 +406,7 @@ function *delegate_return_generator() {
|
|||
function *delegate_next_iterable(xs: Array<number>) {
|
||||
yield *xs;
|
||||
}
|
||||
delegate_next_iterable([]).next(""); // error: Iterator has no next value
|
||||
delegate_next_iterable([]).next(\"\"); // error: Iterator has no next value
|
||||
|
||||
function *delegate_yield_iterable(xs: Array<number>) {
|
||||
yield *xs;
|
||||
|
@ -435,7 +435,7 @@ function *multiple_return(b) {
|
|||
if (b) {
|
||||
return 0;
|
||||
} else {
|
||||
return "foo";
|
||||
return \"foo\";
|
||||
}
|
||||
}
|
||||
let multiple_return_result = multiple_return().next();
|
||||
|
@ -464,7 +464,7 @@ if (multiple_return_result.done) {
|
|||
// error: number|string ~> void
|
||||
function* stmt_yield(): Generator<number, void, void> {
|
||||
yield 0;
|
||||
yield "";
|
||||
yield \"\";
|
||||
}
|
||||
function* stmt_next(): Generator<void, void, number> {
|
||||
var a = yield;
|
||||
|
@ -480,48 +480,48 @@ function* stmt_return_ok(): Generator<void, number, void> {
|
|||
return 0;
|
||||
}
|
||||
function* stmt_return_err(): Generator<void, number, void> {
|
||||
return "";
|
||||
return \"\";
|
||||
}
|
||||
function* infer_stmt() {
|
||||
var x: boolean = yield 0;
|
||||
return "";
|
||||
return \"\";
|
||||
}
|
||||
for (var x of infer_stmt()) {
|
||||
(x: string);
|
||||
}
|
||||
var infer_stmt_next = infer_stmt().next(0).value;
|
||||
if (typeof infer_stmt_next === "undefined") {
|
||||
if (typeof infer_stmt_next === \"undefined\") {
|
||||
|
||||
} else
|
||||
if (typeof infer_stmt_next === "number") {
|
||||
if (typeof infer_stmt_next === \"number\") {
|
||||
|
||||
} else {
|
||||
(infer_stmt_next: boolean);
|
||||
}
|
||||
function* widen_next() {
|
||||
var x = yield 0;
|
||||
if (typeof x === "number") {
|
||||
if (typeof x === \"number\") {
|
||||
|
||||
} else
|
||||
if (typeof x === "boolean") {
|
||||
if (typeof x === \"boolean\") {
|
||||
|
||||
} else {
|
||||
(x: string);
|
||||
}
|
||||
}
|
||||
widen_next().next(0);
|
||||
widen_next().next("");
|
||||
widen_next().next(\"\");
|
||||
widen_next().next(true);
|
||||
function* widen_yield() {
|
||||
yield 0;
|
||||
yield "";
|
||||
yield \"\";
|
||||
yield true;
|
||||
}
|
||||
for (var x of widen_yield()) {
|
||||
if (typeof x === "number") {
|
||||
if (typeof x === \"number\") {
|
||||
|
||||
} else
|
||||
if (typeof x === "boolean") {
|
||||
if (typeof x === \"boolean\") {
|
||||
|
||||
} else {
|
||||
(x: string);
|
||||
|
@ -533,10 +533,10 @@ function* delegate_next_generator() {
|
|||
}
|
||||
yield* inner();
|
||||
}
|
||||
delegate_next_generator().next("");
|
||||
delegate_next_generator().next(\"\");
|
||||
function* delegate_yield_generator() {
|
||||
function* inner() {
|
||||
yield "";
|
||||
yield \"\";
|
||||
}
|
||||
yield* inner();
|
||||
}
|
||||
|
@ -545,14 +545,14 @@ for (var x of delegate_yield_generator()) {
|
|||
}
|
||||
function* delegate_return_generator() {
|
||||
function* inner() {
|
||||
return "";
|
||||
return \"\";
|
||||
}
|
||||
var x: number = yield* inner();
|
||||
}
|
||||
function* delegate_next_iterable(xs: Array<number>) {
|
||||
yield* xs;
|
||||
}
|
||||
delegate_next_iterable([ ]).next("");
|
||||
delegate_next_iterable([ ]).next(\"\");
|
||||
function* delegate_yield_iterable(xs: Array<number>) {
|
||||
yield* xs;
|
||||
}
|
||||
|
@ -575,7 +575,7 @@ function* multiple_return(b) {
|
|||
if (b) {
|
||||
return 0;
|
||||
} else {
|
||||
return "foo";
|
||||
return \"foo\";
|
||||
}
|
||||
}
|
||||
let multiple_return_result = multiple_return().next();
|
||||
|
@ -587,13 +587,13 @@ if (multiple_return_result.done) {
|
|||
|
||||
exports[`test return.js 1`] = `
|
||||
"function test1(gen: Generator<void, string, void>) {
|
||||
// You can pass whatever you like to return, it doesn't need to be related to
|
||||
// the Generator's return type
|
||||
// You can pass whatever you like to return, it doesn\'t need to be related to
|
||||
// the Generator\'s return type
|
||||
var ret = gen.return(0);
|
||||
(ret.value: void); // error: string | number ~> void
|
||||
}
|
||||
|
||||
// However, a generator can "refuse" the return by catching an exception and
|
||||
// However, a generator can \"refuse\" the return by catching an exception and
|
||||
// yielding or returning internally.
|
||||
function *refuse_return() {
|
||||
try {
|
||||
|
@ -603,15 +603,15 @@ function *refuse_return() {
|
|||
}
|
||||
}
|
||||
var refuse_return_gen = refuse_return();
|
||||
var refuse_return_result = refuse_return_gen.return("string");
|
||||
var refuse_return_result = refuse_return_gen.return(\"string\");
|
||||
if (refuse_return_result.done) {
|
||||
(refuse_return_result.value: string); // error: number | void ~> string
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// You can pass whatever you like to return, it doesn't need to be related to
|
||||
// the Generator's return type
|
||||
// You can pass whatever you like to return, it doesn\'t need to be related to
|
||||
// the Generator\'s return type
|
||||
// error: string | number ~> void
|
||||
// However, a generator can "refuse" the return by catching an exception and
|
||||
// However, a generator can \"refuse\" the return by catching an exception and
|
||||
// yielding or returning internally.
|
||||
// error: number | void ~> string
|
||||
function test1(gen: Generator<void, string, void>) {
|
||||
|
@ -626,7 +626,7 @@ function* refuse_return() {
|
|||
}
|
||||
}
|
||||
var refuse_return_gen = refuse_return();
|
||||
var refuse_return_result = refuse_return_gen.return("string");
|
||||
var refuse_return_result = refuse_return_gen.return(\"string\");
|
||||
if (refuse_return_result.done) {
|
||||
(refuse_return_result.value: string);
|
||||
}
|
||||
|
@ -642,7 +642,7 @@ exports[`test throw.js 1`] = `
|
|||
}
|
||||
}
|
||||
|
||||
var catch_return_value = catch_return().throw("").value;
|
||||
var catch_return_value = catch_return().throw(\"\").value;
|
||||
if (catch_return_value !== undefined) {
|
||||
(catch_return_value : string); // error: number ~> string
|
||||
}
|
||||
|
@ -655,7 +655,7 @@ function *yield_return() {
|
|||
yield e;
|
||||
}
|
||||
}
|
||||
var yield_return_value = yield_return().throw("").value;
|
||||
var yield_return_value = yield_return().throw(\"\").value;
|
||||
if (yield_return_value !== undefined) {
|
||||
(yield_return_value: string); // error: number ~> string
|
||||
}
|
||||
|
@ -669,7 +669,7 @@ function* catch_return() {
|
|||
return e;
|
||||
}
|
||||
}
|
||||
var catch_return_value = catch_return().throw("").value;
|
||||
var catch_return_value = catch_return().throw(\"\").value;
|
||||
if (catch_return_value !== undefined) {
|
||||
(catch_return_value: string);
|
||||
}
|
||||
|
@ -681,7 +681,7 @@ function* yield_return() {
|
|||
yield e;
|
||||
}
|
||||
}
|
||||
var yield_return_value = yield_return().throw("").value;
|
||||
var yield_return_value = yield_return().throw(\"\").value;
|
||||
if (yield_return_value !== undefined) {
|
||||
(yield_return_value: string);
|
||||
}
|
||||
|
|
|
@ -36,12 +36,12 @@ class H<Z> extends G<Array<Z>> {
|
|||
}
|
||||
|
||||
var h1 = new H();
|
||||
h1.foo(["..."]);
|
||||
h1.foo([\"...\"]);
|
||||
var h2:F<Array<Array<Array<number>>>> = h1;
|
||||
|
||||
var obj : Object<string, string> = {} // error, arity 0
|
||||
var fn : Function<string> = function() { return 'foo'; } // error, arity 0
|
||||
var fn : function<string> = function() { return 'foo'; } // error, arity 0
|
||||
var fn : Function<string> = function() { return \'foo\'; } // error, arity 0
|
||||
var fn : function<string> = function() { return \'foo\'; } // error, arity 0
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//x:X;
|
||||
/*return x;*/
|
||||
|
@ -89,14 +89,14 @@ class H<Z> extends G<Array<Z>> {
|
|||
}
|
||||
}
|
||||
var h1 = new H();
|
||||
h1.foo([ "..." ]);
|
||||
h1.foo([ \"...\" ]);
|
||||
var h2: F<Array<Array<Array<number>>>> = h1;
|
||||
var obj: Object<string, string> = {};
|
||||
var fn: Function<string> = function() {
|
||||
return "foo";
|
||||
return \"foo\";
|
||||
};
|
||||
var fn: function<string> = function() {
|
||||
return "foo";
|
||||
return \"foo\";
|
||||
};
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
exports[`test example.js 1`] = `
|
||||
"/* @flow */
|
||||
|
||||
var lib = require('./library');
|
||||
var lib = require(\'./library\');
|
||||
|
||||
function add(a: number, b: number): number {
|
||||
return a + b;
|
||||
|
@ -18,7 +18,7 @@ lib.bar();
|
|||
/* @flow */
|
||||
// t123456
|
||||
// D123456
|
||||
var lib = require("./library");
|
||||
var lib = require(\"./library\");
|
||||
function add(a: number, b: number): number {
|
||||
return a + b;
|
||||
}
|
||||
|
@ -31,23 +31,23 @@ lib.bar();
|
|||
exports[`test imports.js 1`] = `
|
||||
"// @flow
|
||||
|
||||
import thing from "./helpers/exports_default.js";
|
||||
import thing from \"./helpers/exports_default.js\";
|
||||
thing;
|
||||
|
||||
import {foo, bar as baz} from "./helpers/exports_named.js";
|
||||
import {foo, bar as baz} from \"./helpers/exports_named.js\";
|
||||
foo;
|
||||
baz;
|
||||
|
||||
import * as things from "./helpers/exports_named.js";
|
||||
import * as things from \"./helpers/exports_named.js\";
|
||||
things;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
import thing from "./helpers/exports_default.js";
|
||||
import thing from \"./helpers/exports_default.js\";
|
||||
thing;
|
||||
import { foo, bar as baz } from "./helpers/exports_named.js";
|
||||
import { foo, bar as baz } from \"./helpers/exports_named.js\";
|
||||
foo;
|
||||
baz;
|
||||
import * as things from "./helpers/exports_named.js";
|
||||
import * as things from \"./helpers/exports_named.js\";
|
||||
things;
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
exports[`test exports_default.js 1`] = `
|
||||
"// @flow
|
||||
|
||||
const x = "foo";
|
||||
const x = \"foo\";
|
||||
|
||||
export default x;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
const x = "foo";
|
||||
const x = \"foo\";
|
||||
export default x
|
||||
"
|
||||
`;
|
||||
|
@ -14,11 +14,11 @@ export default x
|
|||
exports[`test exports_named.js 1`] = `
|
||||
"// @flow
|
||||
|
||||
export const foo = "foo";
|
||||
export const bar = "bar";
|
||||
export const foo = \"foo\";
|
||||
export const bar = \"bar\";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
export const foo = "foo";
|
||||
export const bar = "bar";
|
||||
export const foo = \"foo\";
|
||||
export const bar = \"bar\";
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
exports[`test Parent.js 1`] = `
|
||||
"// @flow
|
||||
|
||||
var ParentFoo = {foo: 'bar'};
|
||||
var ParentFoo = {foo: \'bar\'};
|
||||
module.exports = {ParentFoo};
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
var ParentFoo = { foo: "bar" };
|
||||
var ParentFoo = { foo: \"bar\" };
|
||||
module.exports = { ParentFoo };
|
||||
"
|
||||
`;
|
||||
|
@ -13,14 +13,14 @@ module.exports = { ParentFoo };
|
|||
exports[`test main.js 1`] = `
|
||||
"// @flow
|
||||
|
||||
var Parent = require('./Parent');
|
||||
var Parent = require(\'./Parent\');
|
||||
|
||||
// Hops through destructuring
|
||||
let ParentFoo;
|
||||
({ParentFoo} = Parent);
|
||||
ParentFoo; // Points to lval in line above this
|
||||
|
||||
// Follows assignment on simple/"non-destructuring" patterns
|
||||
// Follows assignment on simple/\"non-destructuring\" patterns
|
||||
let ParentFoo2;
|
||||
ParentFoo2 = Parent;
|
||||
ParentFoo2; // Points to LHS of line above this
|
||||
|
@ -29,21 +29,21 @@ ParentFoo2; // Points to LHS of line above this
|
|||
let ParentFoo3 = Parent;
|
||||
ParentFoo3; // Points to LHS of line above this
|
||||
|
||||
// Follows non-destructured property access of \`require('Parent')\`
|
||||
let foo = require('./Parent').ParentFoo.foo;
|
||||
// Follows non-destructured property access of \`require(\'Parent\')\`
|
||||
let foo = require(\'./Parent\').ParentFoo.foo;
|
||||
foo;
|
||||
|
||||
import type {Foo} from './types';
|
||||
import type {Foo} from \'./types\';
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
// Hops through destructuring
|
||||
// Points to lval in line above this
|
||||
// Follows assignment on simple/"non-destructuring" patterns
|
||||
// Follows assignment on simple/\"non-destructuring\" patterns
|
||||
// Points to LHS of line above this
|
||||
// Follows assignment with declaration
|
||||
// Points to LHS of line above this
|
||||
// Follows non-destructured property access of \`require('Parent')\`
|
||||
var Parent = require("./Parent");
|
||||
// Follows non-destructured property access of \`require(\'Parent\')\`
|
||||
var Parent = require(\"./Parent\");
|
||||
let ParentFoo;
|
||||
{ ParentFoo } = Parent;
|
||||
ParentFoo;
|
||||
|
@ -52,9 +52,9 @@ ParentFoo2 = Parent;
|
|||
ParentFoo2;
|
||||
let ParentFoo3 = Parent;
|
||||
ParentFoo3;
|
||||
let foo = require("./Parent").ParentFoo.foo;
|
||||
let foo = require(\"./Parent\").ParentFoo.foo;
|
||||
foo;
|
||||
import type { Foo } from "./types";
|
||||
import type { Foo } from \"./types\";
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -92,23 +92,23 @@ class D extends C {
|
|||
`;
|
||||
|
||||
exports[`test react.js 1`] = `
|
||||
"var React = require('react');
|
||||
"var React = require(\'react\');
|
||||
|
||||
class C extends React.Component {
|
||||
props: { x: string };
|
||||
}
|
||||
|
||||
let msg = "hello";
|
||||
let msg = \"hello\";
|
||||
|
||||
(<C x={msg}/>);
|
||||
|
||||
(<div id={msg}/>);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
var React = require("react");
|
||||
var React = require(\"react\");
|
||||
class C extends React.Component {
|
||||
props: { x: string };
|
||||
}
|
||||
let msg = "hello";
|
||||
let msg = \"hello\";
|
||||
<C x={msg}/>;
|
||||
<div id={msg}/>;
|
||||
"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
exports[`test jsx.js 1`] = `
|
||||
"declare var $React: $Exports<'react'>; // fake import
|
||||
"declare var $React: $Exports<\'react\'>; // fake import
|
||||
type $JSXIntrinsic<T> = Class<$React.Component<void,T,mixed>>;
|
||||
|
||||
type $JSXIntrinsics = {
|
||||
|
@ -8,7 +8,7 @@ type $JSXIntrinsics = {
|
|||
};
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// fake import
|
||||
declare var $React: $Exports<"react">;
|
||||
declare var $React: $Exports<\"react\">;
|
||||
type $JSXIntrinsic<T> = Class<$React.Component<void, T, mixed>>;
|
||||
type $JSXIntrinsics = {
|
||||
div: $JSXIntrinsic<{ id: string }>;
|
||||
|
|
|
@ -11,23 +11,23 @@ exports[`test b.js 1`] = `
|
|||
* @flow
|
||||
* @providesModule b
|
||||
*/
|
||||
require('./a');
|
||||
require(\'./a\');
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/**
|
||||
* @flow
|
||||
* @providesModule b
|
||||
*/
|
||||
require("./a");
|
||||
require(\"./a\");
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`test c.js 1`] = `
|
||||
"// @flow
|
||||
require('./a.js');
|
||||
require('b');
|
||||
require(\'./a.js\');
|
||||
require(\'b\');
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
require("./a.js");
|
||||
require("b");
|
||||
require(\"./a.js\");
|
||||
require(\"b\");
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -24,10 +24,10 @@ class Foo {
|
|||
get propWithSubtypingGetterAndSetterReordered(): ?number { return 4; }
|
||||
|
||||
get propWithMismatchingGetterAndSetter(): number { return 4; }
|
||||
set propWithMismatchingGetterAndSetter(x: string) { } // doesn't match getter (OK)
|
||||
set propWithMismatchingGetterAndSetter(x: string) { } // doesn\'t match getter (OK)
|
||||
|
||||
propOverriddenWithGetter: number;
|
||||
get propOverriddenWithGetter() { return "hello"; }
|
||||
get propOverriddenWithGetter() { return \"hello\"; }
|
||||
|
||||
propOverriddenWithSetter: number;
|
||||
set propOverriddenWithSetter(x: string) { }
|
||||
|
@ -47,8 +47,8 @@ foo.goodSetterNoAnnotation = 123;
|
|||
foo.goodSetterWithAnnotation = 123;
|
||||
|
||||
// TODO: Why does no annotation mean no error?
|
||||
foo.goodSetterNoAnnotation = "hello"; // Error string ~> number
|
||||
foo.goodSetterWithAnnotation = "hello"; // Error string ~> number
|
||||
foo.goodSetterNoAnnotation = \"hello\"; // Error string ~> number
|
||||
foo.goodSetterWithAnnotation = \"hello\"; // Error string ~> number
|
||||
|
||||
var testSubtypingGetterAndSetter: number = foo.propWithSubtypingGetterAndSetter; // Error ?number ~> number
|
||||
|
||||
|
@ -60,7 +60,7 @@ foo.propOverriddenWithSetter = 123; // Error number ~> string
|
|||
*/
|
||||
// The getter and setter need not have the same type - no error
|
||||
// The getter and setter need not have the same type - no error
|
||||
// doesn't match getter (OK)
|
||||
// doesn\'t match getter (OK)
|
||||
// Test getting properties with getters
|
||||
// Error number ~> string
|
||||
// Error number ~> string
|
||||
|
@ -111,7 +111,7 @@ class Foo {
|
|||
}
|
||||
propOverriddenWithGetter: number;
|
||||
get propOverriddenWithGetter() {
|
||||
return "hello";
|
||||
return \"hello\";
|
||||
}
|
||||
propOverriddenWithSetter: number;
|
||||
set propOverriddenWithSetter(x: string) {
|
||||
|
@ -125,8 +125,8 @@ var testGetterWithError1: string = foo.goodGetterNoAnnotation;
|
|||
var testGetterWithError2: string = foo.goodGetterWithAnnotation;
|
||||
foo.goodSetterNoAnnotation = 123;
|
||||
foo.goodSetterWithAnnotation = 123;
|
||||
foo.goodSetterNoAnnotation = "hello";
|
||||
foo.goodSetterWithAnnotation = "hello";
|
||||
foo.goodSetterNoAnnotation = \"hello\";
|
||||
foo.goodSetterWithAnnotation = \"hello\";
|
||||
var testSubtypingGetterAndSetter: number = foo.propWithSubtypingGetterAndSetter;
|
||||
var testPropOverridenWithGetter: number = foo.propOverriddenWithGetter;
|
||||
foo.propOverriddenWithSetter = 123;
|
||||
|
@ -181,17 +181,17 @@ var testGetterWithError2: string = obj.goodGetterWithAnnotation; // Error number
|
|||
obj.goodSetterNoAnnotation = 123;
|
||||
obj.goodSetterWithAnnotation = 123;
|
||||
|
||||
obj.goodSetterNoAnnotation = "hello"; // Error string ~> number
|
||||
obj.goodSetterWithAnnotation = "hello"; // Error string ~> number
|
||||
obj.goodSetterNoAnnotation = \"hello\"; // Error string ~> number
|
||||
obj.goodSetterWithAnnotation = \"hello\"; // Error string ~> number
|
||||
|
||||
var testSubtypingGetterAndSetter: number = obj.propWithSubtypingGetterAndSetter; // Error ?number ~> number
|
||||
|
||||
// When building this feature, it was tempting to flow the setter into the
|
||||
// getter and then use either the getter or setter as the type of the property.
|
||||
// This example shows the danger of using the getter's type
|
||||
// This example shows the danger of using the getter\'s type
|
||||
obj.exampleOfOrderOfGetterAndSetter = new C(); // Error C ~> B
|
||||
|
||||
// And this example shows the danger of using the setter's type.
|
||||
// And this example shows the danger of using the setter\'s type.
|
||||
var testExampleOrOrderOfGetterAndSetterReordered: number =
|
||||
obj.exampleOfOrderOfGetterAndSetterReordered; // Error A ~> B
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -210,9 +210,9 @@ var testExampleOrOrderOfGetterAndSetterReordered: number =
|
|||
// Error ?number ~> number
|
||||
// When building this feature, it was tempting to flow the setter into the
|
||||
// getter and then use either the getter or setter as the type of the property.
|
||||
// This example shows the danger of using the getter's type
|
||||
// This example shows the danger of using the getter\'s type
|
||||
// Error C ~> B
|
||||
// And this example shows the danger of using the setter's type.
|
||||
// And this example shows the danger of using the setter\'s type.
|
||||
// Error A ~> B
|
||||
var z: number = 123;
|
||||
class A {}
|
||||
|
@ -268,8 +268,8 @@ var testGetterWithError1: string = obj.goodGetterNoAnnotation;
|
|||
var testGetterWithError2: string = obj.goodGetterWithAnnotation;
|
||||
obj.goodSetterNoAnnotation = 123;
|
||||
obj.goodSetterWithAnnotation = 123;
|
||||
obj.goodSetterNoAnnotation = "hello";
|
||||
obj.goodSetterWithAnnotation = "hello";
|
||||
obj.goodSetterNoAnnotation = \"hello\";
|
||||
obj.goodSetterWithAnnotation = \"hello\";
|
||||
var testSubtypingGetterAndSetter: number = obj.propWithSubtypingGetterAndSetter;
|
||||
obj.exampleOfOrderOfGetterAndSetter = new C();
|
||||
var testExampleOrOrderOfGetterAndSetterReordered: number = obj.exampleOfOrderOfGetterAndSetterReordered;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
exports[`test API.js 1`] = `
|
||||
"// @flow
|
||||
|
||||
var OpenGraphObject = require('./models/OpenGraphObject.js');
|
||||
var OpenGraphObject = require(\'./models/OpenGraphObject.js\');
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
var OpenGraphObject = require("./models/OpenGraphObject.js");
|
||||
var OpenGraphObject = require(\"./models/OpenGraphObject.js\");
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
exports[`test OpenGraphAction.js 1`] = `
|
||||
"// @flow
|
||||
|
||||
var OpenGraphValueContainer = require('./OpenGraphValueContainer.js');
|
||||
var OpenGraphValueContainer = require(\'./OpenGraphValueContainer.js\');
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
var OpenGraphValueContainer = require("./OpenGraphValueContainer.js");
|
||||
var OpenGraphValueContainer = require(\"./OpenGraphValueContainer.js\");
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`test OpenGraphObject.js 1`] = `
|
||||
"// @flow
|
||||
|
||||
var OpenGraphValueContainer = require('./OpenGraphValueContainer.js');
|
||||
var OpenGraphValueContainer = require(\'./OpenGraphValueContainer.js\');
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
var OpenGraphValueContainer = require("./OpenGraphValueContainer.js");
|
||||
var OpenGraphValueContainer = require(\"./OpenGraphValueContainer.js\");
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`test OpenGraphValueContainer.js 1`] = `
|
||||
"// @flow
|
||||
|
||||
var OpenGraphObject = require('./OpenGraphObject.js');
|
||||
var OpenGraphObject = require(\'./OpenGraphObject.js\');
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
var OpenGraphObject = require("./OpenGraphObject.js");
|
||||
var OpenGraphObject = require(\"./OpenGraphObject.js\");
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -4,14 +4,14 @@ exports[`test dupe1.js 1`] = `
|
|||
* @providesModule Dupe
|
||||
* @flow
|
||||
*/
|
||||
module.exports = "dupe1";
|
||||
module.exports = \"dupe1\";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/**
|
||||
* Dupe provider 1/2
|
||||
* @providesModule Dupe
|
||||
* @flow
|
||||
*/
|
||||
module.exports = "dupe1";
|
||||
module.exports = \"dupe1\";
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -21,14 +21,14 @@ exports[`test dupe2.js 1`] = `
|
|||
* @providesModule Dupe
|
||||
* @flow
|
||||
*/
|
||||
module.exports = "dupe2";
|
||||
module.exports = \"dupe2\";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/**
|
||||
* Dupe provider 2/2
|
||||
* @providesModule Dupe
|
||||
* @flow
|
||||
*/
|
||||
module.exports = "dupe2";
|
||||
module.exports = \"dupe2\";
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -37,12 +37,12 @@ exports[`test requires_dupe.js 1`] = `
|
|||
* depends on doubly-provided module
|
||||
* @flow
|
||||
*/
|
||||
var dupe = require('Dupe');
|
||||
var dupe = require(\'Dupe\');
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/**
|
||||
* depends on doubly-provided module
|
||||
* @flow
|
||||
*/
|
||||
var dupe = require("Dupe");
|
||||
var dupe = require(\"Dupe\");
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -3,10 +3,10 @@ exports[`test foo.js 1`] = `
|
|||
/* this require routes to nothing, because
|
||||
our node_modules/underscore directory
|
||||
has been excluded. If package.json files
|
||||
are being excluded properly, we'll get
|
||||
'Required module not found'.
|
||||
are being excluded properly, we\'ll get
|
||||
\'Required module not found\'.
|
||||
*/
|
||||
var _ = require('underscore');
|
||||
var _ = require(\'underscore\');
|
||||
|
||||
function foo(): string {
|
||||
return _.foo();
|
||||
|
@ -18,10 +18,10 @@ module.exports = foo;
|
|||
/* this require routes to nothing, because
|
||||
our node_modules/underscore directory
|
||||
has been excluded. If package.json files
|
||||
are being excluded properly, we'll get
|
||||
'Required module not found'.
|
||||
are being excluded properly, we\'ll get
|
||||
\'Required module not found\'.
|
||||
*/
|
||||
var _ = require("underscore");
|
||||
var _ = require(\"underscore\");
|
||||
function foo(): string {
|
||||
return _.foo();
|
||||
}
|
||||
|
|
|
@ -170,8 +170,8 @@ exports[`test import_type.js 1`] = `
|
|||
// == Importing Class Type (Default Export) == //
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
import type ClassFoo1 from "./ExportDefault_Class";
|
||||
import {foo1Inst} from "./ExportDefault_Class";
|
||||
import type ClassFoo1 from \"./ExportDefault_Class\";
|
||||
import {foo1Inst} from \"./ExportDefault_Class\";
|
||||
|
||||
var a1: ClassFoo1 = foo1Inst;
|
||||
var a2: number = foo1Inst; // Error: ClassFoo1 ~> number
|
||||
|
@ -181,8 +181,8 @@ new ClassFoo1(); // Error: ClassFoo1 is not a value-identifier
|
|||
// == Importing Class Type (Named Export) == //
|
||||
///////////////////////////////////////////////
|
||||
|
||||
import type {ClassFoo2} from "./ExportNamed_Class";
|
||||
import {foo2Inst} from "./ExportNamed_Class";
|
||||
import type {ClassFoo2} from \"./ExportNamed_Class\";
|
||||
import {foo2Inst} from \"./ExportNamed_Class\";
|
||||
|
||||
var b1: ClassFoo2 = foo2Inst;
|
||||
var b2: number = foo2Inst; // Error: ClassFoo2 ~> number
|
||||
|
@ -192,8 +192,8 @@ new ClassFoo2(); // Error: ClassFoo2 is not a value-identifier
|
|||
// == Importing Class Type (CJS Default Export) == //
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
import type ClassFoo3T from "./ExportCJSDefault_Class";
|
||||
import ClassFoo3 from "./ExportCJSDefault_Class";
|
||||
import type ClassFoo3T from \"./ExportCJSDefault_Class\";
|
||||
import ClassFoo3 from \"./ExportCJSDefault_Class\";
|
||||
var c1: ClassFoo3T = new ClassFoo3();
|
||||
new ClassFoo3T(); // Error: ClassFoo3 is not a value-identifier
|
||||
|
||||
|
@ -201,38 +201,38 @@ new ClassFoo3T(); // Error: ClassFoo3 is not a value-identifier
|
|||
// == Importing Class Type (CJS Named Export) == //
|
||||
///////////////////////////////////////////////////
|
||||
|
||||
import type {ClassFoo4, ClassFoo5} from "./ExportCJSNamed_Class";
|
||||
import {foo4Inst, foo5Inst} from "./ExportCJSNamed_Class";
|
||||
import type {ClassFoo4, ClassFoo5} from \"./ExportCJSNamed_Class\";
|
||||
import {foo4Inst, foo5Inst} from \"./ExportCJSNamed_Class\";
|
||||
|
||||
var d1: ClassFoo4 = foo4Inst;
|
||||
var d2: number = foo4Inst; // Error: ClassFoo4 ~> number
|
||||
new ClassFoo4(); // Error: ClassFoo4 is not a value-identifier
|
||||
// TODO: this errors correctly, but the message is just 'can't resolve name'
|
||||
var d3: typeof ClassFoo5 = foo5Inst; // Error: Can't typeof a type alias
|
||||
// TODO: this errors correctly, but the message is just \'can\'t resolve name\'
|
||||
var d3: typeof ClassFoo5 = foo5Inst; // Error: Can\'t typeof a type alias
|
||||
|
||||
////////////////////////////////////////////
|
||||
// == Import Type Alias (Named Export) == //
|
||||
////////////////////////////////////////////
|
||||
|
||||
import type {AliasFoo3} from "./ExportNamed_Alias";
|
||||
import {givesAFoo3Obj} from "./ExportNamed_Alias";
|
||||
import type {AliasFoo3} from \"./ExportNamed_Alias\";
|
||||
import {givesAFoo3Obj} from \"./ExportNamed_Alias\";
|
||||
var e1: AliasFoo3 = givesAFoo3Obj();
|
||||
var e2: number = givesAFoo3Obj(); // Error: AliasFoo3 ~> number
|
||||
var e3: typeof AliasFoo3 = givesAFoo3Obj(); // Error: Can't typeof a type alias
|
||||
var e3: typeof AliasFoo3 = givesAFoo3Obj(); // Error: Can\'t typeof a type alias
|
||||
|
||||
//////////////////////////////////////////////
|
||||
// == Import Type Alias (Default Export) == //
|
||||
//////////////////////////////////////////////
|
||||
|
||||
// TODO: No support for this right now. It's most likely possible, but it's
|
||||
// TODO: No support for this right now. It\'s most likely possible, but it\'s
|
||||
// unclear how useful it is at the moment and it entails a little
|
||||
// more work than named type exports, so I'm punting on it for now.
|
||||
// more work than named type exports, so I\'m punting on it for now.
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
// == Import Type With Non-Alias Compatible Value == //
|
||||
///////////////////////////////////////////////////////
|
||||
|
||||
import type {numValue} from "./ExportsANumber"; // Error: Cannot import-type a number value
|
||||
import type {numValue} from \"./ExportsANumber\"; // Error: Cannot import-type a number value
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// == Regression Test: https://github.com/facebook/flow/issues/359 == //
|
||||
|
@ -240,7 +240,7 @@ import type {numValue} from "./ExportsANumber"; // Error: Cannot import-type a n
|
|||
// env contexts. //
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
import type ClassFoo6 from "./issue-359";
|
||||
import type ClassFoo6 from \"./issue-359\";
|
||||
function foo() {
|
||||
ClassFoo6; // Error: Not a value binding
|
||||
}
|
||||
|
@ -267,19 +267,19 @@ function foo() {
|
|||
///////////////////////////////////////////////////
|
||||
// Error: ClassFoo4 ~> number
|
||||
// Error: ClassFoo4 is not a value-identifier
|
||||
// TODO: this errors correctly, but the message is just 'can't resolve name'
|
||||
// Error: Can't typeof a type alias
|
||||
// TODO: this errors correctly, but the message is just \'can\'t resolve name\'
|
||||
// Error: Can\'t typeof a type alias
|
||||
////////////////////////////////////////////
|
||||
// == Import Type Alias (Named Export) == //
|
||||
////////////////////////////////////////////
|
||||
// Error: AliasFoo3 ~> number
|
||||
// Error: Can't typeof a type alias
|
||||
// Error: Can\'t typeof a type alias
|
||||
//////////////////////////////////////////////
|
||||
// == Import Type Alias (Default Export) == //
|
||||
//////////////////////////////////////////////
|
||||
// TODO: No support for this right now. It's most likely possible, but it's
|
||||
// TODO: No support for this right now. It\'s most likely possible, but it\'s
|
||||
// unclear how useful it is at the moment and it entails a little
|
||||
// more work than named type exports, so I'm punting on it for now.
|
||||
// more work than named type exports, so I\'m punting on it for now.
|
||||
///////////////////////////////////////////////////////
|
||||
// == Import Type With Non-Alias Compatible Value == //
|
||||
///////////////////////////////////////////////////////
|
||||
|
@ -290,33 +290,33 @@ function foo() {
|
|||
// env contexts. //
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Error: Not a value binding
|
||||
import type ClassFoo1 from "./ExportDefault_Class";
|
||||
import { foo1Inst } from "./ExportDefault_Class";
|
||||
import type ClassFoo1 from \"./ExportDefault_Class\";
|
||||
import { foo1Inst } from \"./ExportDefault_Class\";
|
||||
var a1: ClassFoo1 = foo1Inst;
|
||||
var a2: number = foo1Inst;
|
||||
new ClassFoo1();
|
||||
import type { ClassFoo2 } from "./ExportNamed_Class";
|
||||
import { foo2Inst } from "./ExportNamed_Class";
|
||||
import type { ClassFoo2 } from \"./ExportNamed_Class\";
|
||||
import { foo2Inst } from \"./ExportNamed_Class\";
|
||||
var b1: ClassFoo2 = foo2Inst;
|
||||
var b2: number = foo2Inst;
|
||||
new ClassFoo2();
|
||||
import type ClassFoo3T from "./ExportCJSDefault_Class";
|
||||
import ClassFoo3 from "./ExportCJSDefault_Class";
|
||||
import type ClassFoo3T from \"./ExportCJSDefault_Class\";
|
||||
import ClassFoo3 from \"./ExportCJSDefault_Class\";
|
||||
var c1: ClassFoo3T = new ClassFoo3();
|
||||
new ClassFoo3T();
|
||||
import type { ClassFoo4, ClassFoo5 } from "./ExportCJSNamed_Class";
|
||||
import { foo4Inst, foo5Inst } from "./ExportCJSNamed_Class";
|
||||
import type { ClassFoo4, ClassFoo5 } from \"./ExportCJSNamed_Class\";
|
||||
import { foo4Inst, foo5Inst } from \"./ExportCJSNamed_Class\";
|
||||
var d1: ClassFoo4 = foo4Inst;
|
||||
var d2: number = foo4Inst;
|
||||
new ClassFoo4();
|
||||
var d3: typeof ClassFoo5 = foo5Inst;
|
||||
import type { AliasFoo3 } from "./ExportNamed_Alias";
|
||||
import { givesAFoo3Obj } from "./ExportNamed_Alias";
|
||||
import type { AliasFoo3 } from \"./ExportNamed_Alias\";
|
||||
import { givesAFoo3Obj } from \"./ExportNamed_Alias\";
|
||||
var e1: AliasFoo3 = givesAFoo3Obj();
|
||||
var e2: number = givesAFoo3Obj();
|
||||
var e3: typeof AliasFoo3 = givesAFoo3Obj();
|
||||
import type { numValue } from "./ExportsANumber";
|
||||
import type ClassFoo6 from "./issue-359";
|
||||
import type { numValue } from \"./ExportsANumber\";
|
||||
import type ClassFoo6 from \"./issue-359\";
|
||||
function foo() {
|
||||
ClassFoo6;
|
||||
}
|
||||
|
|
|
@ -152,11 +152,11 @@ exports[`test ExportNamed_Multi.js 1`] = `
|
|||
"// @flow
|
||||
|
||||
export var num = 42;
|
||||
export var str = 'asdf';
|
||||
export var str = \'asdf\';
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
export var num = 42;
|
||||
export var str = "asdf";
|
||||
export var str = \"asdf\";
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -179,8 +179,8 @@ exports[`test import_typeof.js 1`] = `
|
|||
// == Importing Class Typeof (Default Export) == //
|
||||
///////////////////////////////////////////////////
|
||||
|
||||
import typeof ClassFoo1T from "./ExportDefault_Class";
|
||||
import ClassFoo1 from "./ExportDefault_Class";
|
||||
import typeof ClassFoo1T from \"./ExportDefault_Class\";
|
||||
import ClassFoo1 from \"./ExportDefault_Class\";
|
||||
|
||||
var a1: ClassFoo1T = ClassFoo1;
|
||||
var a2: ClassFoo1T = new ClassFoo1(); // Error: ClassFoo1 (inst) ~> ClassFoo1 (class)
|
||||
|
@ -190,8 +190,8 @@ new ClassFoo1T(); // Error: ClassFoo1T is not bound to a value
|
|||
// == Importing Class Typeof (Named Export) == //
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
import typeof {ClassFoo2 as ClassFoo2T} from "./ExportNamed_Class";
|
||||
import {ClassFoo2} from "./ExportNamed_Class";
|
||||
import typeof {ClassFoo2 as ClassFoo2T} from \"./ExportNamed_Class\";
|
||||
import {ClassFoo2} from \"./ExportNamed_Class\";
|
||||
|
||||
var b1: ClassFoo2T = ClassFoo2;
|
||||
var b2: ClassFoo2T = new ClassFoo2(); // Error: ClassFoo2 (inst) ~> ClassFoo2 (class)
|
||||
|
@ -201,8 +201,8 @@ new ClassFoo2T(); // Error: ClassFoo2T is not bound to a value
|
|||
// == Importing Class Typeof (CJS Default Export) == //
|
||||
///////////////////////////////////////////////////////
|
||||
|
||||
import typeof ClassFoo3T from "./ExportCJSDefault_Class";
|
||||
import ClassFoo3 from "./ExportCJSDefault_Class";
|
||||
import typeof ClassFoo3T from \"./ExportCJSDefault_Class\";
|
||||
import ClassFoo3 from \"./ExportCJSDefault_Class\";
|
||||
|
||||
var c1: ClassFoo3T = ClassFoo3;
|
||||
var c2: ClassFoo3T = new ClassFoo3(); // Error: ClassFoo3 (inst) ~> ClassFoo3 (class)
|
||||
|
@ -211,8 +211,8 @@ var c2: ClassFoo3T = new ClassFoo3(); // Error: ClassFoo3 (inst) ~> ClassFoo3 (c
|
|||
// == Importing Class Typeof (CJS Named Export) == //
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
import typeof {ClassFoo4 as ClassFoo4T} from "./ExportCJSNamed_Class";
|
||||
import {ClassFoo4} from "./ExportCJSNamed_Class";
|
||||
import typeof {ClassFoo4 as ClassFoo4T} from \"./ExportCJSNamed_Class\";
|
||||
import {ClassFoo4} from \"./ExportCJSNamed_Class\";
|
||||
|
||||
var d1: ClassFoo4T = ClassFoo4;
|
||||
var d2: ClassFoo4T = new ClassFoo4(); // Error: ClassFoo4 (inst) ~> ClassFoo4 (class)
|
||||
|
@ -221,58 +221,58 @@ var d2: ClassFoo4T = new ClassFoo4(); // Error: ClassFoo4 (inst) ~> ClassFoo4 (c
|
|||
// == Import Typeof Alias (Named Export) == //
|
||||
//////////////////////////////////////////////
|
||||
|
||||
import typeof {AliasFoo3} from "./ExportNamed_Alias"; // Error: Can't \`import typeof\` type aliases!
|
||||
import typeof {AliasFoo3} from \"./ExportNamed_Alias\"; // Error: Can\'t \`import typeof\` type aliases!
|
||||
|
||||
////////////////////////////////////////////////
|
||||
// == Import Typeof Alias (Default Export) == //
|
||||
////////////////////////////////////////////////
|
||||
|
||||
// TODO: No support for this right now. It's most likely possible, but it's
|
||||
// TODO: No support for this right now. It\'s most likely possible, but it\'s
|
||||
// unclear how useful it is at the moment and it entails a little
|
||||
// more work than named type exports, so I'm punting on it for now.
|
||||
// more work than named type exports, so I\'m punting on it for now.
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// == Import Typeof With Non-Class Value (Default Export) == //
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
||||
import typeof num_default from "./ExportDefault_Number";
|
||||
import typeof num_default from \"./ExportDefault_Number\";
|
||||
|
||||
var f1: num_default = 42;
|
||||
var f2: num_default = 'asdf'; // Error: string ~> number
|
||||
var f2: num_default = \'asdf\'; // Error: string ~> number
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// == Import Typeof With Non-Class Value (Named Export) == //
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
import typeof {num as num_named} from "./ExportNamed_Number";
|
||||
import typeof {num as num_named} from \"./ExportNamed_Number\";
|
||||
|
||||
var g1: num_named = 42;
|
||||
var g2: num_named = 'asdf'; // Error: string ~> number
|
||||
var g2: num_named = \'asdf\'; // Error: string ~> number
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// == Import Typeof With Non-Class Value (CJS Default Export) == //
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
import typeof num_cjs_default from "./ExportCJSDefault_Number";
|
||||
import typeof num_cjs_default from \"./ExportCJSDefault_Number\";
|
||||
|
||||
var h1: num_cjs_default = 42;
|
||||
var h2: num_cjs_default = 'asdf'; // Error: string ~> number
|
||||
var h2: num_cjs_default = \'asdf\'; // Error: string ~> number
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// == Import Typeof With Non-Class Value (CJS Named Export) == //
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
import typeof {num as num_cjs_named} from "./ExportCJSNamed_Number";
|
||||
import typeof {num as num_cjs_named} from \"./ExportCJSNamed_Number\";
|
||||
|
||||
var i1: num_cjs_named = 42;
|
||||
var i2: num_cjs_named = 'asdf'; // Error: string ~> number
|
||||
var i2: num_cjs_named = \'asdf\'; // Error: string ~> number
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// == Import Typeof ModuleNamespaceObject == //
|
||||
///////////////////////////////////////////////
|
||||
|
||||
import typeof * as ModuleNSObjT from "./ExportNamed_Multi";
|
||||
var j1: ModuleNSObjT = {num: 42, str: 'asdf'};
|
||||
import typeof * as ModuleNSObjT from \"./ExportNamed_Multi\";
|
||||
var j1: ModuleNSObjT = {num: 42, str: \'asdf\'};
|
||||
var j2: ModuleNSObjT = {num: 42, str: 42}; // Error: number ~> string
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/**
|
||||
|
@ -299,13 +299,13 @@ var j2: ModuleNSObjT = {num: 42, str: 42}; // Error: number ~> string
|
|||
//////////////////////////////////////////////
|
||||
// == Import Typeof Alias (Named Export) == //
|
||||
//////////////////////////////////////////////
|
||||
// Error: Can't \`import typeof\` type aliases!
|
||||
// Error: Can\'t \`import typeof\` type aliases!
|
||||
////////////////////////////////////////////////
|
||||
// == Import Typeof Alias (Default Export) == //
|
||||
////////////////////////////////////////////////
|
||||
// TODO: No support for this right now. It's most likely possible, but it's
|
||||
// TODO: No support for this right now. It\'s most likely possible, but it\'s
|
||||
// unclear how useful it is at the moment and it entails a little
|
||||
// more work than named type exports, so I'm punting on it for now.
|
||||
// more work than named type exports, so I\'m punting on it for now.
|
||||
///////////////////////////////////////////////////////////////
|
||||
// == Import Typeof With Non-Class Value (Default Export) == //
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
@ -326,39 +326,39 @@ var j2: ModuleNSObjT = {num: 42, str: 42}; // Error: number ~> string
|
|||
// == Import Typeof ModuleNamespaceObject == //
|
||||
///////////////////////////////////////////////
|
||||
// Error: number ~> string
|
||||
import typeof ClassFoo1T from "./ExportDefault_Class";
|
||||
import ClassFoo1 from "./ExportDefault_Class";
|
||||
import typeof ClassFoo1T from \"./ExportDefault_Class\";
|
||||
import ClassFoo1 from \"./ExportDefault_Class\";
|
||||
var a1: ClassFoo1T = ClassFoo1;
|
||||
var a2: ClassFoo1T = new ClassFoo1();
|
||||
new ClassFoo1T();
|
||||
import typeof { ClassFoo2 as ClassFoo2T } from "./ExportNamed_Class";
|
||||
import { ClassFoo2 } from "./ExportNamed_Class";
|
||||
import typeof { ClassFoo2 as ClassFoo2T } from \"./ExportNamed_Class\";
|
||||
import { ClassFoo2 } from \"./ExportNamed_Class\";
|
||||
var b1: ClassFoo2T = ClassFoo2;
|
||||
var b2: ClassFoo2T = new ClassFoo2();
|
||||
new ClassFoo2T();
|
||||
import typeof ClassFoo3T from "./ExportCJSDefault_Class";
|
||||
import ClassFoo3 from "./ExportCJSDefault_Class";
|
||||
import typeof ClassFoo3T from \"./ExportCJSDefault_Class\";
|
||||
import ClassFoo3 from \"./ExportCJSDefault_Class\";
|
||||
var c1: ClassFoo3T = ClassFoo3;
|
||||
var c2: ClassFoo3T = new ClassFoo3();
|
||||
import typeof { ClassFoo4 as ClassFoo4T } from "./ExportCJSNamed_Class";
|
||||
import { ClassFoo4 } from "./ExportCJSNamed_Class";
|
||||
import typeof { ClassFoo4 as ClassFoo4T } from \"./ExportCJSNamed_Class\";
|
||||
import { ClassFoo4 } from \"./ExportCJSNamed_Class\";
|
||||
var d1: ClassFoo4T = ClassFoo4;
|
||||
var d2: ClassFoo4T = new ClassFoo4();
|
||||
import typeof { AliasFoo3 } from "./ExportNamed_Alias";
|
||||
import typeof num_default from "./ExportDefault_Number";
|
||||
import typeof { AliasFoo3 } from \"./ExportNamed_Alias\";
|
||||
import typeof num_default from \"./ExportDefault_Number\";
|
||||
var f1: num_default = 42;
|
||||
var f2: num_default = "asdf";
|
||||
import typeof { num as num_named } from "./ExportNamed_Number";
|
||||
var f2: num_default = \"asdf\";
|
||||
import typeof { num as num_named } from \"./ExportNamed_Number\";
|
||||
var g1: num_named = 42;
|
||||
var g2: num_named = "asdf";
|
||||
import typeof num_cjs_default from "./ExportCJSDefault_Number";
|
||||
var g2: num_named = \"asdf\";
|
||||
import typeof num_cjs_default from \"./ExportCJSDefault_Number\";
|
||||
var h1: num_cjs_default = 42;
|
||||
var h2: num_cjs_default = "asdf";
|
||||
import typeof { num as num_cjs_named } from "./ExportCJSNamed_Number";
|
||||
var h2: num_cjs_default = \"asdf\";
|
||||
import typeof { num as num_cjs_named } from \"./ExportCJSNamed_Number\";
|
||||
var i1: num_cjs_named = 42;
|
||||
var i2: num_cjs_named = "asdf";
|
||||
import typeof * as ModuleNSObjT from "./ExportNamed_Multi";
|
||||
var j1: ModuleNSObjT = { num: 42, str: "asdf" };
|
||||
var i2: num_cjs_named = \"asdf\";
|
||||
import typeof * as ModuleNSObjT from \"./ExportNamed_Multi\";
|
||||
var j1: ModuleNSObjT = { num: 42, str: \"asdf\" };
|
||||
var j2: ModuleNSObjT = { num: 42, str: 42 };
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
exports[`test baz.js 1`] = `
|
||||
"/* @flow */
|
||||
|
||||
var x: number = "not a number" // Error string ~> number
|
||||
var x: number = \"not a number\" // Error string ~> number
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/* @flow */
|
||||
// Error string ~> number
|
||||
var x: number = "not a number";
|
||||
var x: number = \"not a number\";
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -11,12 +11,12 @@ exports[`test b.js 1`] = `
|
|||
@flow
|
||||
*/
|
||||
|
||||
var A = require('IncrModuleA');
|
||||
var A = require(\'IncrModuleA\');
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/* @providesModule IncrModuleB
|
||||
@flow
|
||||
*/
|
||||
var A = require("IncrModuleA");
|
||||
var A = require(\"IncrModuleA\");
|
||||
"
|
||||
`;
|
||||
|
||||
|
|
|
@ -11,12 +11,12 @@ module.exports = a;
|
|||
|
||||
exports[`test b.js 1`] = `
|
||||
"// @flow
|
||||
var a = require('./a');
|
||||
var a = require(\'./a\');
|
||||
var b: number = a;
|
||||
module.exports = b;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
var a = require("./a");
|
||||
var a = require(\"./a\");
|
||||
var b: number = a;
|
||||
module.exports = b;
|
||||
"
|
||||
|
@ -24,12 +24,12 @@ module.exports = b;
|
|||
|
||||
exports[`test c.js 1`] = `
|
||||
"// @flow
|
||||
var b = require('./b');
|
||||
var b = require(\'./b\');
|
||||
var c: string = b;
|
||||
module.exports = c;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
var b = require("./b");
|
||||
var b = require(\"./b\");
|
||||
var c: string = b;
|
||||
module.exports = c;
|
||||
"
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
exports[`test b.js 1`] = `
|
||||
"// @flow
|
||||
var a = require('./a');
|
||||
var a = require(\'./a\');
|
||||
var b = a;
|
||||
module.exports = b;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
var a = require("./a");
|
||||
var a = require(\"./a\");
|
||||
var b = a;
|
||||
module.exports = b;
|
||||
"
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
exports[`test b.js 1`] = `
|
||||
"// @flow
|
||||
var a = require('./a');
|
||||
var a = require(\'./a\');
|
||||
var b: number = a;
|
||||
module.exports = b;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
var a = require("./a");
|
||||
var a = require(\"./a\");
|
||||
var b: number = a;
|
||||
module.exports = b;
|
||||
"
|
||||
|
|
|
@ -19,8 +19,8 @@ module.exports = A;
|
|||
|
||||
exports[`test B.js 1`] = `
|
||||
"// @flow
|
||||
var A = require ('./A');
|
||||
import type C from './C';
|
||||
var A = require (\'./A\');
|
||||
import type C from \'./C\';
|
||||
|
||||
class B extends A {
|
||||
c: C;
|
||||
|
@ -29,8 +29,8 @@ class B extends A {
|
|||
module.exports = B;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
var A = require("./A");
|
||||
import type C from "./C";
|
||||
var A = require(\"./A\");
|
||||
import type C from \"./C\";
|
||||
class B extends A {
|
||||
c: C;
|
||||
}
|
||||
|
@ -40,8 +40,8 @@ module.exports = B;
|
|||
|
||||
exports[`test C.js 1`] = `
|
||||
"// @flow
|
||||
var A = require ('./A');
|
||||
import type B from './B';
|
||||
var A = require (\'./A\');
|
||||
import type B from \'./B\';
|
||||
|
||||
class C extends A {
|
||||
b: B;
|
||||
|
@ -50,8 +50,8 @@ class C extends A {
|
|||
module.exports = C;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
var A = require("./A");
|
||||
import type B from "./B";
|
||||
var A = require(\"./A\");
|
||||
import type B from \"./B\";
|
||||
class C extends A {
|
||||
b: B;
|
||||
}
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
exports[`test B.js 1`] = `
|
||||
"// @flow
|
||||
var A = require ('./A');
|
||||
import type C from './C';
|
||||
var A = require (\'./A\');
|
||||
import type C from \'./C\';
|
||||
|
||||
export type B = string;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
var A = require("./A");
|
||||
import type C from "./C";
|
||||
var A = require(\"./A\");
|
||||
import type C from \"./C\";
|
||||
export type B = string;
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`test C.js 1`] = `
|
||||
"// @flow
|
||||
var A = require ('./A');
|
||||
import type { B } from './B'
|
||||
var A = require (\'./A\');
|
||||
import type { B } from \'./B\'
|
||||
|
||||
class C extends A {
|
||||
b: B;
|
||||
|
@ -24,8 +24,8 @@ class C extends A {
|
|||
module.exports = C;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
var A = require("./A");
|
||||
import type { B } from "./B";
|
||||
var A = require(\"./A\");
|
||||
import type { B } from \"./B\";
|
||||
class C extends A {
|
||||
b: B;
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
exports[`test B.js 1`] = `
|
||||
"// @flow
|
||||
var A = require ('./A');
|
||||
//import type C from './C';
|
||||
var A = require (\'./A\');
|
||||
//import type C from \'./C\';
|
||||
|
||||
export type B = string;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
//import type C from './C';
|
||||
var A = require("./A");
|
||||
//import type C from \'./C\';
|
||||
var A = require(\"./A\");
|
||||
export type B = string;
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
exports[`test B.js 1`] = `
|
||||
"// @flow
|
||||
var A = require ('./A');
|
||||
import type C from './C';
|
||||
var A = require (\'./A\');
|
||||
import type C from \'./C\';
|
||||
|
||||
|
||||
export type B = string;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
var A = require("./A");
|
||||
import type C from "./C";
|
||||
var A = require(\"./A\");
|
||||
import type C from \"./C\";
|
||||
export type B = string;
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -11,12 +11,12 @@ module.exports = a;
|
|||
|
||||
exports[`test b.js 1`] = `
|
||||
"// @flow
|
||||
var a = require('./a');
|
||||
var a = require(\'./a\');
|
||||
var b: number = a;
|
||||
module.exports = b;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
var a = require("./a");
|
||||
var a = require(\"./a\");
|
||||
var b: number = a;
|
||||
module.exports = b;
|
||||
"
|
||||
|
@ -24,12 +24,12 @@ module.exports = b;
|
|||
|
||||
exports[`test c.js 1`] = `
|
||||
"// @flow
|
||||
var b = require('./b');
|
||||
var b = require(\'./b\');
|
||||
var c: string = b;
|
||||
module.exports = c;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// @flow
|
||||
var b = require("./b");
|
||||
var b = require(\"./b\");
|
||||
var c: string = b;
|
||||
module.exports = c;
|
||||
"
|
||||
|
@ -41,14 +41,14 @@ exports[`test dupe1.js 1`] = `
|
|||
* @providesModule Dupe
|
||||
* @flow
|
||||
*/
|
||||
module.exports = "dupe1";
|
||||
module.exports = \"dupe1\";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/**
|
||||
* Dupe provider 1/2
|
||||
* @providesModule Dupe
|
||||
* @flow
|
||||
*/
|
||||
module.exports = "dupe1";
|
||||
module.exports = \"dupe1\";
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -58,14 +58,14 @@ exports[`test dupe2.js 1`] = `
|
|||
* @providesModule Dupe
|
||||
* @flow
|
||||
*/
|
||||
module.exports = "dupe2";
|
||||
module.exports = \"dupe2\";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/**
|
||||
* Dupe provider 2/2
|
||||
* @providesModule Dupe
|
||||
* @flow
|
||||
*/
|
||||
module.exports = "dupe2";
|
||||
module.exports = \"dupe2\";
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -74,13 +74,13 @@ exports[`test requires_dupe.js 1`] = `
|
|||
* depends on doubly-provided module
|
||||
* @flow
|
||||
*/
|
||||
var dupe = require('Dupe');
|
||||
var dupe = require(\'Dupe\');
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/**
|
||||
* depends on doubly-provided module
|
||||
* @flow
|
||||
*/
|
||||
var dupe = require("Dupe");
|
||||
var dupe = require(\"Dupe\");
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -89,13 +89,13 @@ exports[`test requires_unchecked.js 1`] = `
|
|||
* depends on an unchecked module, which will be deleted
|
||||
* @flow
|
||||
*/
|
||||
var unchecked = require('Unchecked');
|
||||
var unchecked = require(\'Unchecked\');
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/**
|
||||
* depends on an unchecked module, which will be deleted
|
||||
* @flow
|
||||
*/
|
||||
var unchecked = require("Unchecked");
|
||||
var unchecked = require(\"Unchecked\");
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -104,12 +104,12 @@ exports[`test unchecked.js 1`] = `
|
|||
* Not a flow module.
|
||||
* @providesModule Unchecked
|
||||
*/
|
||||
module.exports = "unchecked";
|
||||
module.exports = \"unchecked\";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/**
|
||||
* Not a flow module.
|
||||
* @providesModule Unchecked
|
||||
*/
|
||||
module.exports = "unchecked";
|
||||
module.exports = \"unchecked\";
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -2,13 +2,13 @@ exports[`test test.js 1`] = `
|
|||
"/**
|
||||
* @flow
|
||||
*/
|
||||
var data = require('./data');
|
||||
var data = require(\'./data\');
|
||||
var x: number = data.x;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
/**
|
||||
* @flow
|
||||
*/
|
||||
var data = require("./data");
|
||||
var data = require(\"./data\");
|
||||
var x: number = data.x;
|
||||
"
|
||||
`;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue