Tweak variable declaration printing

master
James Long 2016-12-30 11:56:42 -05:00
parent 73755a686d
commit 6715abca76
232 changed files with 3561 additions and 4507 deletions

View File

@ -798,8 +798,7 @@ function genericPrintNoParens(path, options, print) {
" ", " ",
printed[0], printed[0],
indent(options.tabWidth, indent(options.tabWidth,
join(concat([",", line]), join(concat([",", line]), printed.slice(1)))
printed.slice(1)))
]; ];
// We generally want to terminate all variable declarations with a // We generally want to terminate all variable declarations with a
@ -814,7 +813,7 @@ function genericPrintNoParens(path, options, print) {
parts.push(";"); parts.push(";");
} }
return concat(parts); return multilineGroup(concat(parts));
case "VariableDeclarator": case "VariableDeclarator":
return n.init ? concat([ return n.init ? concat([

View File

@ -20,14 +20,14 @@ export default class {
`; `;
exports[`test B.js 1`] = ` exports[`test B.js 1`] = `
"import A from "./A" "import A from \"./A\"
class B extends A { class B extends A {
p: string; // OK, string ~> any p: string; // OK, string ~> any
} }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// OK, string ~> any // OK, string ~> any
import A from "./A"; import A from \"./A\";
class B extends A { class B extends A {
p: string; p: string;
} }

View File

@ -4,7 +4,7 @@ exports[`test A.js 1`] = `
* @flow * @flow
*/ */
import type T from "T"; import type T from \"T\";
export default class { export default class {
p: T; p: T;
@ -18,7 +18,7 @@ export default class {
* @providesModule A * @providesModule A
* @flow * @flow
*/ */
import type T from "T"; import type T from \"T\";
export default class { export default class {
p: T; p: T;
constructor() { constructor() {
@ -33,7 +33,7 @@ exports[`test B.js 1`] = `
* @flow * @flow
*/ */
import A from "A" import A from \"A\"
class B extends A { class B extends A {
p: string; // OK, string ~> any p: string; // OK, string ~> any
@ -43,7 +43,7 @@ class B extends A {
* @flow * @flow
*/ */
// OK, string ~> any // OK, string ~> any
import A from "A"; import A from \"A\";
class B extends A { class B extends A {
p: string; p: string;
} }

View File

@ -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 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) { function bar1(x: mixed) {
if (any_fun1(x)) { if (any_fun1(x)) {
(x: boolean); (x: boolean);
} }
} }
var any_fun2 = require('./anyexportflowfile'); var any_fun2 = require(\'./anyexportflowfile\');
function bar2(x: mixed) { function bar2(x: mixed) {
if (any_fun2(x)) { if (any_fun2(x)) {
(x: boolean); (x: boolean);
@ -180,13 +180,13 @@ function foo(c: C, x: any): string {
let y = x.y; let y = x.y;
return c.bar(0, y); return c.bar(0, y);
} }
var any_fun1 = require("./nonflowfile"); var any_fun1 = require(\"./nonflowfile\");
function bar1(x: mixed) { function bar1(x: mixed) {
if (any_fun1(x)) { if (any_fun1(x)) {
(x: boolean); (x: boolean);
} }
} }
var any_fun2 = require("./anyexportflowfile"); var any_fun2 = require(\"./anyexportflowfile\");
function bar2(x: mixed) { function bar2(x: mixed) {
if (any_fun2(x)) { if (any_fun2(x)) {
(x: boolean); (x: boolean);

View File

@ -24,7 +24,7 @@ exports[`test test2.js 1`] = `
function filterItems(items: Array<string|number>): Array<string|number> { function filterItems(items: Array<string|number>): Array<string|number> {
return items.map(item => { return items.map(item => {
if (typeof item === 'string') { if (typeof item === \'string\') {
return item.length > 2 ? item : null; return item.length > 2 ? item : null;
} else { } else {
return item*10; return item*10;
@ -32,7 +32,7 @@ function filterItems(items: Array<string|number>): Array<string|number> {
}).filter(Boolean); }).filter(Boolean);
} }
const filteredItems = filterItems(['foo', 'b', 1, 2]); const filteredItems = filterItems([\'foo\', \'b\', 1, 2]);
console.log(filteredItems); console.log(filteredItems);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -40,7 +40,7 @@ console.log(filteredItems);
function filterItems(items: Array<string | number>): Array<string | number> { function filterItems(items: Array<string | number>): Array<string | number> {
return items.map( return items.map(
item => { item => {
if (typeof item === "string") { if (typeof item === \"string\") {
return (item.length > 2 ? item : null); return (item.length > 2 ? item : null);
} else { } else {
return item * 10; return item * 10;
@ -48,7 +48,7 @@ function filterItems(items: Array<string | number>): Array<string | number> {
} }
).filter(Boolean); ).filter(Boolean);
} }
const filteredItems = filterItems([ "foo", "b", 1, 2 ]); const filteredItems = filterItems([ \"foo\", \"b\", 1, 2 ]);
console.log(filteredItems); console.log(filteredItems);
" "
`; `;

View File

@ -5,15 +5,15 @@ var C = [1,2,3];
B.sort((a, b) => a - b); B.sort((a, b) => a - b);
C.sort((a, b) => a - b); C.sort((a, b) => a - b);
var x: Array<string> = ['1', '2']; var x: Array<string> = [\'1\', \'2\'];
var y: Array<string> = ['3', ...x]; var y: Array<string> = [\'3\', ...x];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var A = [ 1, 2, 3 ]; var A = [ 1, 2, 3 ];
var B = [ ...A ]; var B = [ ...A ];
var C = [ 1, 2, 3 ]; var C = [ 1, 2, 3 ];
B.sort((a, b) => a - b); B.sort((a, b) => a - b);
C.sort((a, b) => a - b); C.sort((a, b) => a - b);
var x: Array<string> = [ "1", "2" ]; var x: Array<string> = [ \"1\", \"2\" ];
var y: Array<string> = [ "3", ...x ]; var y: Array<string> = [ \"3\", ...x ];
" "
`; `;

View File

@ -3,23 +3,23 @@ exports[`test array_lib.js 1`] = `
function foo(x:string) { } function foo(x:string) { }
var a = [0]; 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 c: number = a[0];
var d: number = b[0]; var d: number = b[0];
var e:Array<string> = a.reverse(); var e:Array<string> = a.reverse();
var f = [""]; var f = [\"\"];
var g:number = f.map(function () { return 0; })[0]; var g:number = f.map(function () { return 0; })[0];
var h: Array<number> = [1,2,3]; 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 j: Array<number | string> = h.concat(i);
var k: Array<number> = h.concat(h); var k: Array<number> = h.concat(h);
var l: Array<number> = h.concat(1,2,3); var l: Array<number> = h.concat(1,2,3);
var m: Array<number | string> = h.concat('a', 'b', 'c'); var m: Array<number | string> = h.concat(\'a\', \'b\', \'c\');
var n: Array<number> = h.concat('a', 'b', 'c'); // Error var n: Array<number> = h.concat(\'a\', \'b\', \'c\'); // Error
function reduce_test() { function reduce_test() {
/* Adapted from the following source: /* Adapted from the following source:
@ -44,13 +44,13 @@ function reduce_test() {
/* Added later, because the above is insufficient */ /* Added later, because the above is insufficient */
// acc is element type of array when no init is provided // acc is element type of array when no init is provided
[""].reduce((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 [\"\"].reduceRight((acc, str) => acc * str.length); // error, string ~> number
} }
function from_test() { function from_test() {
var a: Array<string> = Array.from([1, 2, 3], function(val, index) { 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) { var b: Array<string> = Array.from([1, 2, 3], function(val) {
return String(val); return String(val);
@ -73,25 +73,25 @@ var a = [ 0 ];
var b = a.map( var b = a.map(
function(x) { function(x) {
foo(x); foo(x);
return "" + x; return \"\" + x;
} }
); );
var c: number = a[0]; var c: number = a[0];
var d: number = b[0]; var d: number = b[0];
var e: Array<string> = a.reverse(); var e: Array<string> = a.reverse();
var f = [ "" ]; var f = [ \"\" ];
var g: number = f.map( var g: number = f.map(
function() { function() {
return 0; return 0;
} }
)[0]; )[0];
var h: Array<number> = [ 1, 2, 3 ]; 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 j: Array<number | string> = h.concat(i);
var k: Array<number> = h.concat(h); var k: Array<number> = h.concat(h);
var l: Array<number> = h.concat(1, 2, 3); var l: Array<number> = h.concat(1, 2, 3);
var m: Array<number | string> = h.concat("a", "b", "c"); var m: Array<number | string> = h.concat(\"a\", \"b\", \"c\");
var n: Array<number> = h.concat("a", "b", "c"); var n: Array<number> = h.concat(\"a\", \"b\", \"c\");
function reduce_test() { function reduce_test() {
[ 0, 1, 2, 3, 4 ].reduce( [ 0, 1, 2, 3, 4 ].reduce(
function(previousValue, currentValue, index, array) { function(previousValue, currentValue, index, array) {
@ -114,14 +114,14 @@ function reduce_test() {
return a.concat(b); return a.concat(b);
} }
); );
[ "" ].reduce((acc, str) => acc * str.length); [ \"\" ].reduce((acc, str) => acc * str.length);
[ "" ].reduceRight((acc, str) => acc * str.length); [ \"\" ].reduceRight((acc, str) => acc * str.length);
} }
function from_test() { function from_test() {
var a: Array<string> = Array.from( var a: Array<string> = Array.from(
[ 1, 2, 3 ], [ 1, 2, 3 ],
function(val, index) { function(val, index) {
return (index % 2 ? "foo" : String(val)); return (index % 2 ? \"foo\" : String(val));
} }
); );
var b: Array<string> = Array.from( var b: Array<string> = Array.from(

View File

@ -6,7 +6,7 @@ function foo(x:string) { }
var a = []; var a = [];
a[0] = 1; a[0] = 1;
a[1] = "..."; a[1] = \"...\";
foo(a[1]); foo(a[1]);
var y; 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}, {x:0, y:0},
{x:0, y:0, a:true}, {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:1},
{x:0, y:0, c:"hey"} {x:0, y:0, c:\"hey\"}
]; ];
module.exports = "arrays"; module.exports = \"arrays\";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* @providesModule Arrays */ /* @providesModule Arrays */
// for literals, composite element type is union of individuals // for literals, composite element type is union of individuals
@ -47,7 +47,7 @@ function foo(x: string) {
} }
var a = [ ]; var a = [ ];
a[0] = 1; a[0] = 1;
a[1] = "..."; a[1] = \"...\";
foo(a[1]); foo(a[1]);
var y; var y;
a.forEach(x => y = x); 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 }, { x: 0, y: 0 },
{ x: 0, y: 0, a: true }, { 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: 1 },
{ x: 0, y: 0, c: "hey" } { x: 0, y: 0, c: \"hey\" }
]; ];
module.exports = "arrays"; module.exports = \"arrays\";
" "
`; `;

View File

@ -9,7 +9,7 @@ var bad = (x: number): string => x; // Error!
var ident = <T>(x: T): T => x; var ident = <T>(x: T): T => x;
(ident(1): number); (ident(1): number);
(ident("hi"): number); // Error (ident(\"hi\"): number); // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** /**
* @flow * @flow
@ -20,7 +20,7 @@ var add = (x: number, y: number): number => x + y;
var bad = (x: number): string => x; var bad = (x: number): string => x;
var ident = <T>(x: T): T => x; var ident = <T>(x: T): T => x;
(ident(1): number); (ident(1): number);
(ident("hi"): number); (ident(\"hi\"): number);
" "
`; `;
@ -31,7 +31,7 @@ exports[`test arrows.js 1`] = `
): Image { ): Image {
var maxPixelWidth = maxWidth; var maxPixelWidth = maxWidth;
//images = images.sort(function (a, b) { return a.width - b.width }); //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) || return images.find(image => image.width >= maxPixelWidth) ||
images[images.length - 1]; images[images.length - 1];
} }
@ -41,7 +41,7 @@ function selectBestEffortImageForWidth(
maxWidth: number, images: Array<Image> maxWidth: number, images: Array<Image>
): Image { ): Image {
var maxPixelWidth = maxWidth; 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) || return images.find(image => image.width >= maxPixelWidth) ||
images[images.length - 1]; images[images.length - 1];
} }

View File

@ -78,7 +78,7 @@ async function* readLines(path) {
} }
async function f() { 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 (line: void); // error: string ~> void
} }
} }
@ -97,7 +97,7 @@ async function* readLines(path) {
} }
} }
async function f() { async function f() {
for await (const line of readLines("/path/to/file")) { for await (const line of readLines(\"/path/to/file\")) {
(line: void); (line: void);
} }
} }
@ -107,13 +107,13 @@ async function f() {
exports[`test return.js 1`] = ` exports[`test return.js 1`] = `
"declare var gen: AsyncGenerator<void,string,void>; "declare var gen: AsyncGenerator<void,string,void>;
// You can pass whatever you like to return, it doesn't need to be related to // You can pass whatever you like to return, it doesn\'t need to be related to
// the AsyncGenerator's return type // the AsyncGenerator\'s return type
gen.return(0).then(result => { gen.return(0).then(result => {
(result.value: void); // error: string | number ~> void (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. // yielding or returning internally.
async function *refuse_return() { async function *refuse_return() {
try { try {
@ -122,16 +122,16 @@ async function *refuse_return() {
return 0; return 0;
} }
} }
refuse_return().return("string").then(result => { refuse_return().return(\"string\").then(result => {
if (result.done) { if (result.done) {
(result.value: string); // error: number | void ~> string (result.value: string); // error: number | void ~> string
} }
}); });
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// You can pass whatever you like to return, it doesn't need to be related to // You can pass whatever you like to return, it doesn\'t need to be related to
// the AsyncGenerator's return type // the AsyncGenerator\'s return type
// error: string | number ~> 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. // yielding or returning internally.
// error: number | void ~> string // error: number | void ~> string
declare var gen: AsyncGenerator<void, string, void>; declare var gen: AsyncGenerator<void, string, void>;
@ -147,7 +147,7 @@ async function* refuse_return() {
return 0; return 0;
} }
} }
refuse_return().return("string").then( refuse_return().return(\"string\").then(
result => { result => {
if (result.done) { if (result.done) {
(result.value: string); (result.value: string);
@ -167,7 +167,7 @@ exports[`test throw.js 1`] = `
} }
(async () => { (async () => {
catch_return().throw("").then(({value}) => { catch_return().throw(\"\").then(({value}) => {
if (value !== undefined) { if (value !== undefined) {
(value: void); // error: number ~> void (value: void); // error: number ~> void
} }
@ -184,7 +184,7 @@ async function *yield_return() {
} }
(async () => { (async () => {
yield_return().throw("").then(({value}) => { yield_return().throw(\"\").then(({value}) => {
if (value !== undefined) { if (value !== undefined) {
(value: void); // error: number ~> void (value: void); // error: number ~> void
} }
@ -201,7 +201,7 @@ async function* catch_return() {
} }
} }
async () => { async () => {
catch_return().throw("").then( catch_return().throw(\"\").then(
({ value }) => { ({ value }) => {
if (value !== undefined) { if (value !== undefined) {
(value: void); (value: void);
@ -218,7 +218,7 @@ async function* yield_return() {
} }
} }
async () => { async () => {
yield_return().throw("").then( yield_return().throw(\"\").then(
({ value }) => { ({ value }) => {
if (value !== undefined) { if (value !== undefined) {
(value: void); (value: void);

View File

@ -4,31 +4,31 @@ exports[`test in.js 1`] = `
let tests = [ let tests = [
// objects on RHS // objects on RHS
function() { function() {
('foo' in {}); (\'foo\' in {});
('foo' in { foo: null }); (\'foo\' in { foo: null });
(0 in {}); (0 in {});
(0 in { "0": null }); (0 in { \"0\": null });
}, },
// arrays on RHS // arrays on RHS
function() { function() {
('foo' in []); (\'foo\' in []);
(0 in []); (0 in []);
('length' in []); (\'length\' in []);
}, },
// primitive classes on RHS // primitive classes on RHS
function() { function() {
('foo' in new String('bar')); (\'foo\' in new String(\'bar\'));
('foo' in new Number(123)); (\'foo\' in new Number(123));
}, },
// primitives on RHS // primitives on RHS
function() { function() {
('foo' in 123); // error (\'foo\' in 123); // error
('foo' in 'bar'); // error (\'foo\' in \'bar\'); // error
('foo' in void 0); // error (\'foo\' in void 0); // error
('foo' in null); // error (\'foo\' in null); // error
}, },
// bogus stuff on LHS // bogus stuff on LHS
@ -42,15 +42,15 @@ let tests = [
// in predicates // in predicates
function() { function() {
if ('foo' in 123) {} // error if (\'foo\' in 123) {} // error
if (!'foo' in {}) {} // error, !'foo' is a boolean if (!\'foo\' in {}) {} // error, !\'foo\' is a boolean
if (!('foo' in {})) {} if (!(\'foo\' in {})) {}
}, },
// annotations on RHS // annotations on RHS
function(x: Object, y: mixed) { function(x: Object, y: mixed) {
('foo' in x); // ok (\'foo\' in x); // ok
('foo' in y); // error (\'foo\' in y); // error
}, },
] ]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -71,31 +71,31 @@ let tests = [
// error // error
// in predicates // in predicates
// error // error
// error, !'foo' is a boolean // error, !\'foo\' is a boolean
// annotations on RHS // annotations on RHS
// ok // ok
// error // error
let tests = [ let tests = [
function() { function() {
"foo" in {}; \"foo\" in {};
"foo" in { foo: null }; \"foo\" in { foo: null };
0 in {}; 0 in {};
0 in { "0": null }; 0 in { \"0\": null };
}, },
function() { function() {
"foo" in [ ]; \"foo\" in [ ];
0 in [ ]; 0 in [ ];
"length" in [ ]; \"length\" in [ ];
}, },
function() { function() {
"foo" in new String("bar"); \"foo\" in new String(\"bar\");
"foo" in new Number(123); \"foo\" in new Number(123);
}, },
function() { function() {
"foo" in 123; \"foo\" in 123;
"foo" in "bar"; \"foo\" in \"bar\";
"foo" in void 0; \"foo\" in void 0;
"foo" in null; \"foo\" in null;
}, },
function() { function() {
null in {}; null in {};
@ -105,19 +105,19 @@ let tests = [
false in [ ]; false in [ ];
}, },
function() { 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) { function(x: Object, y: mixed) {
"foo" in x; \"foo\" in x;
"foo" in y; \"foo\" in y;
} }
]; ];
" "

View File

@ -1,13 +1,13 @@
exports[`test scope.js 1`] = ` exports[`test scope.js 1`] = `
"function foo<X, Y:X>(x:X, y:Y):void { } "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 bar<X:number, Y:X>(x:X, y:Y): number { return y*0; }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function foo<X, Y: X>(x: X, y: Y): void { 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 { function bar<X: number, Y: X>(x: X, y: Y): number {
return y * 0; return y * 0;
} }
@ -33,7 +33,7 @@ class C<T: number> {
} }
function example<T: {x: number}>(o: T): T { o.x = 0; return o; } 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 obj2: {x: number} = example({x: 0});
var c: C<string> = new C; // error, since T = string is incompatible with number 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; o.x = 0;
return o; 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 obj2: { x: number } = example({ x: 0 });
var c: C<string> = new C(); var c: C<string> = new C();
var q: number = c.qux(0); var q: number = c.qux(0);

View File

@ -3,7 +3,7 @@ exports[`test break.js 1`] = `
var x = b ? null: false; var x = b ? null: false;
var z; var z;
while(b) { while(b) {
if (x == null) { z = ""; break; } if (x == null) { z = \"\"; break; }
var y:number = x; // error: boolean !~> number var y:number = x; // error: boolean !~> number
} }
var w:number = z; // 2 errors: ?string !~> number var w:number = z; // 2 errors: ?string !~> number
@ -12,10 +12,10 @@ exports[`test break.js 1`] = `
function bar(b) { function bar(b) {
var x = b ? null: false; var x = b ? null: false;
if (x == null) return; if (x == null) return;
switch ("") { switch (\"\") {
case 0: case 0:
var y:number = x; // error: boolean !~> number var y:number = x; // error: boolean !~> number
x = ""; x = \"\";
case 1: case 1:
var z:number = x; // 2 errors: (boolean | string) !~> number var z:number = x; // 2 errors: (boolean | string) !~> number
break; break;
@ -27,10 +27,10 @@ function bar(b) {
function bar2(b) { function bar2(b) {
var x = b ? null: false; var x = b ? null: false;
if (x == null) return; if (x == null) return;
switch ("") { switch (\"\") {
case 0: { case 0: {
let y:number = x; // error: boolean !~> number let y:number = x; // error: boolean !~> number
x = ""; x = \"\";
} }
case 1: { case 1: {
let z:number = x; // 2 errors: (boolean | string) !~> number let z:number = x; // 2 errors: (boolean | string) !~> number
@ -45,7 +45,7 @@ function qux(b) {
var z = 0; var z = 0;
while(b) { while(b) {
var y:number = z; var y:number = z;
if (b) { z = ""; continue; } // error: string !~> number if (b) { z = \"\"; continue; } // error: string !~> number
z = 0; z = 0;
} }
var w:number = z; // error: string !~> number var w:number = z; // error: string !~> number
@ -54,10 +54,10 @@ function qux(b) {
// same basic test as foo(), but with const. probes the // same basic test as foo(), but with const. probes the
// logic that still uses havoc to do env resets. // logic that still uses havoc to do env resets.
function test_const() { function test_const() {
let st: string = 'abc'; let st: string = \'abc\';
for (let i = 1; i < 100; i++) { for (let i = 1; i < 100; i++) {
const fooRes: ?string = "HEY"; const fooRes: ?string = \"HEY\";
if (!fooRes) { if (!fooRes) {
break; break;
} }
@ -86,7 +86,7 @@ function foo(b) {
var z; var z;
while (b) { while (b) {
if (x == null) { if (x == null) {
z = ""; z = \"\";
break; break;
} }
var y: number = x; var y: number = x;
@ -97,10 +97,10 @@ function bar(b) {
var x = (b ? null : false); var x = (b ? null : false);
if (x == null) if (x == null)
return; return;
switch ("") { switch (\"\") {
case 0: case 0:
var y: number = x; var y: number = x;
x = ""; x = \"\";
case 1: case 1:
var z: number = x; var z: number = x;
break; break;
@ -112,11 +112,11 @@ function bar2(b) {
var x = (b ? null : false); var x = (b ? null : false);
if (x == null) if (x == null)
return; return;
switch ("") { switch (\"\") {
case 0: case 0:
{ {
let y: number = x; let y: number = x;
x = ""; x = \"\";
} }
case 1: case 1:
{ {
@ -132,7 +132,7 @@ function qux(b) {
while (b) { while (b) {
var y: number = z; var y: number = z;
if (b) { if (b) {
z = ""; z = \"\";
continue; continue;
} }
z = 0; z = 0;
@ -140,9 +140,9 @@ function qux(b) {
var w: number = z; var w: number = z;
} }
function test_const() { function test_const() {
let st: string = "abc"; let st: string = \"abc\";
for (let i = 1; i < 100; i++) { for (let i = 1; i < 100; i++) {
const fooRes: ?string = "HEY"; const fooRes: ?string = \"HEY\";
if (!fooRes) { if (!fooRes) {
break; break;
} }

View File

@ -10,10 +10,10 @@ module.exports = o;
`; `;
exports[`test test2.js 1`] = ` exports[`test test2.js 1`] = `
"var o = require('./test'); "var o = require(\'./test\');
(o.foo: string); (o.foo: string);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var o = require("./test"); var o = require(\"./test\");
(o.foo: string); (o.foo: string);
" "
`; `;

View File

@ -5,7 +5,7 @@ exports[`test with_munging.js 1`] = `
class Foo { class Foo {
_method(): string { _method(): string {
return 'this is private'; return \'this is private\';
} }
} }
@ -21,7 +21,7 @@ class Bar extends Foo {
// error // error
class Foo { class Foo {
_method(): string { _method(): string {
return "this is private"; return \"this is private\";
} }
} }
class Bar extends Foo { class Bar extends Foo {
@ -40,7 +40,7 @@ exports[`test without_munging.js 1`] = `
class Foo { class Foo {
_method(): string { _method(): string {
return 'this is not private'; return \'this is not private\';
} }
} }
@ -57,7 +57,7 @@ class Bar extends Foo {
// ok // ok
class Foo { class Foo {
_method(): string { _method(): string {
return "this is not private"; return \"this is not private\";
} }
} }
class Bar extends Foo { class Bar extends Foo {

View File

@ -12,9 +12,9 @@ class B extends A {
static foo(x: string) { } // error? static foo(x: string) { } // error?
static main() { static main() {
B.x = 0; // error B.x = 0; // error
B.x = ""; B.x = \"\";
B.foo(0); // error B.foo(0); // error
B.foo(""); B.foo(\"\");
B.y = 0; // error B.y = 0; // error
B.bar(0); // error B.bar(0); // error
B.qux(0); // error B.qux(0); // error
@ -94,9 +94,9 @@ class B extends A {
} }
static main() { static main() {
B.x = 0; B.x = 0;
B.x = ""; B.x = \"\";
B.foo(0); B.foo(0);
B.foo(""); B.foo(\"\");
B.y = 0; B.y = 0;
B.bar(0); B.bar(0);
B.qux(0); B.qux(0);

View File

@ -14,7 +14,7 @@ module.exports = { A, B };
exports[`test test2.js 1`] = ` exports[`test test2.js 1`] = `
"/* @flow */ "/* @flow */
var I = require("./test.js"); var I = require(\"./test.js\");
class C extends I.A {} class C extends I.A {}
@ -22,7 +22,7 @@ var x: I.A = new C();
var y: I.B = new C(); var y: I.B = new C();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* @flow */ /* @flow */
var I = require("./test.js"); var I = require(\"./test.js\");
class C extends I.A {} class C extends I.A {}
var x: I.A = new C(); var x: I.A = new C();
var y: I.B = new C(); var y: I.B = new C();

View File

@ -15,7 +15,7 @@ module.exports = A;
`; `;
exports[`test B.js 1`] = ` exports[`test B.js 1`] = `
"var A = require('./A'); "var A = require(\'./A\');
class B extends A { } class B extends A { }
@ -25,7 +25,7 @@ let b = new B();
module.exports = B; module.exports = B;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// error, number !~> function // error, number !~> function
var A = require("./A"); var A = require(\"./A\");
class B extends A {} class B extends A {}
let b = new B(); let b = new B();
(b.foo: number); (b.foo: number);
@ -34,7 +34,7 @@ module.exports = B;
`; `;
exports[`test C.js 1`] = ` exports[`test C.js 1`] = `
"var B = require('./B'); "var B = require(\'./B\');
class C extends B { class C extends B {
foo(x:string):void { } foo(x:string):void { }
@ -46,7 +46,7 @@ let c = new C();
module.exports = C; module.exports = C;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// error, number !~> function // error, number !~> function
var B = require("./B"); var B = require(\"./B\");
class C extends B { class C extends B {
foo(x: string): void { foo(x: string): void {
@ -74,9 +74,9 @@ exports[`test class_shapes.js 1`] = `
type Foo = { type Foo = {
a: string; // exists in TestClass a: string; // exists in TestClass
b: string; // doesn't exist b: string; // doesn\'t exist
c?: ?string; // exists in TestClass, optional c?: ?string; // exists in TestClass, optional
d?: number; // doesn't exist d?: number; // doesn\'t exist
} }
class TestClass { class TestClass {
@ -92,8 +92,8 @@ x.c; // ok
x.d; // error, TestClass has no d x.d; // error, TestClass has no d
var y : Foo = x; var y : Foo = x;
y.b; // error, doesn't exist in TestClass y.b; // error, doesn\'t exist in TestClass
y.d; // ok, it's optional y.d; // ok, it\'s optional
class Test2Superclass { class Test2Superclass {
a: number; // conflicts with cast to Foo a: number; // conflicts with cast to Foo
@ -108,15 +108,15 @@ var w : Foo = z;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* @flow */ /* @flow */
// exists in TestClass // exists in TestClass
// doesn't exist // doesn\'t exist
// exists in TestClass, optional // exists in TestClass, optional
/* doesn't exist*/ /* doesn\'t exist*/
// ok // ok
// error, TestClass has no b // error, TestClass has no b
// ok // ok
// error, TestClass has no d // error, TestClass has no d
// error, doesn't exist in TestClass // error, doesn\'t exist in TestClass
// ok, it's optional // ok, it\'s optional
// conflicts with cast to Foo // conflicts with cast to Foo
// conflicts with cast to Foo // 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 bar1: Bar = new Bar() // OK
var bar2: Bar = Bar.factory() // 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. // unexpected failure in the above code.
var B = class Baz { } 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: Foo is a runtime binding in this scope
// OK // OK
// 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. // unexpected failure in the above code.
// error: Baz is not a runtime binding in this scope // error: Baz is not a runtime binding in this scope
// error: Qux is not a type in this scope // error: Qux is not a type in this scope
@ -232,7 +232,7 @@ exports[`test statics.js 1`] = `
class C { class C {
static p: string; static p: string;
} }
C.p = "hi"; C.p = \"hi\";
// Class static fields are compatible with object types // Class static fields are compatible with object types
(C: {p:string}); // ok (C: {p:string}); // ok
@ -249,7 +249,7 @@ declare var o: {p:number};
class C { class C {
static p: string; static p: string;
} }
C.p = "hi"; C.p = \"hi\";
(C: { p: string }); (C: { p: string });
(C: { p: number }); (C: { p: number });
declare var o: { p: number }; declare var o: { p: number };

View File

@ -13,11 +13,11 @@ module.exports = f;
exports[`test Rel.js 1`] = ` exports[`test Rel.js 1`] = `
" "
var f = require('./Abs'); var f = require(\'./Abs\');
f(0); f(0);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var f = require("./Abs"); var f = require(\"./Abs\");
f(0); f(0);
" "
`; `;

View File

@ -1,14 +1,14 @@
exports[`test test.js 1`] = ` exports[`test test.js 1`] = `
"var ColorId = { "var ColorId = {
RED: 'R', RED: \'R\',
GREEN: 'G', GREEN: \'G\',
BLUE: 'B', BLUE: \'B\',
}; };
var ColorNumber = { var ColorNumber = {
RED: 'ff0000', RED: \'ff0000\',
GREEN: '00ff00', GREEN: \'00ff00\',
BLUE: '0000ff', BLUE: \'0000ff\',
}; };
var ColorIdToNumber = { var ColorIdToNumber = {
@ -17,7 +17,7 @@ var ColorIdToNumber = {
[ColorId.BLUE]: ColorNumber.BLUE, [ColorId.BLUE]: ColorNumber.BLUE,
}; };
(ColorIdToNumber[ColorId.RED]: 'ffffff'); // oops (ColorIdToNumber[ColorId.RED]: \'ffffff\'); // oops
ColorIdToNumber.XXX; // oops ColorIdToNumber.XXX; // oops
@ -25,91 +25,91 @@ module.exports = { ColorId, ColorNumber };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// oops // oops
// oops // oops
var ColorId = { RED: "R", GREEN: "G", BLUE: "B" }; var ColorId = { RED: \"R\", GREEN: \"G\", BLUE: \"B\" };
var ColorNumber = { RED: "ff0000", GREEN: "00ff00", BLUE: "0000ff" }; var ColorNumber = { RED: \"ff0000\", GREEN: \"00ff00\", BLUE: \"0000ff\" };
var ColorIdToNumber = { var ColorIdToNumber = {
[ColorId.RED]: ColorNumber.RED, [ColorId.RED]: ColorNumber.RED,
[ColorId.GREEN]: ColorNumber.GREEN, [ColorId.GREEN]: ColorNumber.GREEN,
[ColorId.BLUE]: ColorNumber.BLUE [ColorId.BLUE]: ColorNumber.BLUE
}; };
(ColorIdToNumber[ColorId.RED]: "ffffff"); (ColorIdToNumber[ColorId.RED]: \"ffffff\");
ColorIdToNumber.XXX; ColorIdToNumber.XXX;
module.exports = { ColorId, ColorNumber }; module.exports = { ColorId, ColorNumber };
" "
`; `;
exports[`test test2.js 1`] = ` exports[`test test2.js 1`] = `
"var { ColorId, ColorNumber } = require('./test'); "var { ColorId, ColorNumber } = require(\'./test\');
var ColorIdToNumber = { var ColorIdToNumber = {
[ColorId.RED]: ColorNumber.RED, [ColorId.RED]: ColorNumber.RED,
[ColorId.GREEN]: ColorNumber.GREEN, [ColorId.GREEN]: ColorNumber.GREEN,
[ColorId.BLUE]: ColorNumber.BLUE, [ColorId.BLUE]: ColorNumber.BLUE,
}; };
(ColorIdToNumber[ColorId.GREEN]: 'ffffff'); // oops (ColorIdToNumber[ColorId.GREEN]: \'ffffff\'); // oops
module.exports = ColorIdToNumber; module.exports = ColorIdToNumber;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// oops // oops
var { ColorId, ColorNumber } = require("./test"); var { ColorId, ColorNumber } = require(\"./test\");
var ColorIdToNumber = { var ColorIdToNumber = {
[ColorId.RED]: ColorNumber.RED, [ColorId.RED]: ColorNumber.RED,
[ColorId.GREEN]: ColorNumber.GREEN, [ColorId.GREEN]: ColorNumber.GREEN,
[ColorId.BLUE]: ColorNumber.BLUE [ColorId.BLUE]: ColorNumber.BLUE
}; };
(ColorIdToNumber[ColorId.GREEN]: "ffffff"); (ColorIdToNumber[ColorId.GREEN]: \"ffffff\");
module.exports = ColorIdToNumber; module.exports = ColorIdToNumber;
" "
`; `;
exports[`test test3.js 1`] = ` exports[`test test3.js 1`] = `
"var { ColorId } = require('./test'); "var { ColorId } = require(\'./test\');
var ColorIdToNumber = require('./test2'); var ColorIdToNumber = require(\'./test2\');
(ColorIdToNumber[ColorId.BLUE]: 'ffffff'); // oops (ColorIdToNumber[ColorId.BLUE]: \'ffffff\'); // oops
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// oops // oops
var { ColorId } = require("./test"); var { ColorId } = require(\"./test\");
var ColorIdToNumber = require("./test2"); var ColorIdToNumber = require(\"./test2\");
(ColorIdToNumber[ColorId.BLUE]: "ffffff"); (ColorIdToNumber[ColorId.BLUE]: \"ffffff\");
" "
`; `;
exports[`test test4.js 1`] = ` exports[`test test4.js 1`] = `
"module.exports = 'hello'; "module.exports = \'hello\';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
module.exports = "hello"; module.exports = \"hello\";
" "
`; `;
exports[`test test5.js 1`] = ` exports[`test test5.js 1`] = `
"var hello = require('./test4'); "var hello = require(\'./test4\');
var dummy = require('./test'); var dummy = require(\'./test\');
module.exports = { module.exports = {
...dummy, ...dummy,
[hello]: 'world', [hello]: \'world\',
...dummy, ...dummy,
}; };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var hello = require("./test4"); var hello = require(\"./test4\");
var dummy = require("./test"); var dummy = require(\"./test\");
module.exports = { ...dummy, [hello]: "world", ...dummy }; module.exports = { ...dummy, [hello]: \"world\", ...dummy };
" "
`; `;
exports[`test test6.js 1`] = ` exports[`test test6.js 1`] = `
"var o = require('./test5'); "var o = require(\'./test5\');
(o.hello: 'nothing'); // oops (o.hello: \'nothing\'); // oops
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// oops // oops
var o = require("./test5"); var o = require(\"./test5\");
(o.hello: "nothing"); (o.hello: \"nothing\");
" "
`; `;
exports[`test test7.js 1`] = ` exports[`test test7.js 1`] = `
"var obj = {x: 0, m() { return this.x }} "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 arr = [function() { return this.length }];
var y: string = arr[0](); // error: number ~> string var y: string = arr[0](); // error: number ~> string
@ -122,7 +122,7 @@ var obj = {
return this.x; return this.x;
} }
}; };
var x: string = obj["m"](); var x: string = obj[\"m\"]();
var arr = [ var arr = [
function() { function() {
return this.length; return this.length;

View File

@ -1,7 +1,7 @@
exports[`test no_at_flow.js 1`] = ` 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 // Error: string ~> number
var x: number = "not a number"; var x: number = \"not a number\";
" "
`; `;

View File

@ -1,7 +1,7 @@
exports[`test no_at_flow.js 1`] = ` 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 // No error
var x: number = "not a number"; var x: number = \"not a number\";
" "
`; `;

View File

@ -4,21 +4,21 @@ exports[`test test.js 1`] = `
*/ */
function foo(x) { function foo(x) {
var a: number = 'asdf'; var a: number = \'asdf\';
return x * 10; return x * 10;
} }
// This file should be ignored, so this should not result in an error // This file should be ignored, so this should not result in an error
foo('Hello, world!'); foo(\'Hello, world!\');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* /*
* @flow * @flow
*/ */
// This file should be ignored, so this should not result in an error // This file should be ignored, so this should not result in an error
function foo(x) { function foo(x) {
var a: number = "asdf"; var a: number = \"asdf\";
return x * 10; return x * 10;
} }
foo("Hello, world!"); foo(\"Hello, world!\");
" "
`; `;

View File

@ -2,10 +2,10 @@ exports[`test foo.js 1`] = `
"/* @flow */ "/* @flow */
// No error, this file is ignored // No error, this file is ignored
var x: number = "string"; var x: number = \"string\";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* @flow */ /* @flow */
// No error, this file is ignored // No error, this file is ignored
var x: number = "string"; var x: number = \"string\";
" "
`; `;

View File

@ -1,10 +1,10 @@
exports[`test foo.js 1`] = ` exports[`test foo.js 1`] = `
"/* @flow */ "/* @flow */
var x: number = "string"; // Error string ~> number var x: number = \"string\"; // Error string ~> number
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* @flow */ /* @flow */
// Error string ~> number // Error string ~> number
var x: number = "string"; var x: number = \"string\";
" "
`; `;

View File

@ -1,14 +1,14 @@
exports[`test main.js 1`] = ` exports[`test main.js 1`] = `
"// @flow "// @flow
import {test} from 'testmodule'; import {test} from \'testmodule\';
var a: number = test; var a: number = test;
var b: string = test; // Error: number ~> string var b: string = test; // Error: number ~> string
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
// Error: number ~> string // Error: number ~> string
import { test } from "testmodule"; import { test } from \"testmodule\";
var a: number = test; var a: number = test;
var b: string = test; var b: string = test;
" "

View File

@ -1,12 +1,12 @@
exports[`test test.js 1`] = ` exports[`test test.js 1`] = `
"// @flow "// @flow
import {className} from "./SomeCSSFile.css"; import {className} from \"./SomeCSSFile.css\";
import {doesntExist} from "./SomeCSSFile.css"; // Error: \`doestExist\` isn't an export import {doesntExist} from \"./SomeCSSFile.css\"; // Error: \`doestExist\` isn\'t an export
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
// Error: \`doestExist\` isn't an export // Error: \`doestExist\` isn\'t an export
import { className } from "./SomeCSSFile.css"; import { className } from \"./SomeCSSFile.css\";
import { doesntExist } from "./SomeCSSFile.css"; import { doesntExist } from \"./SomeCSSFile.css\";
" "
`; `;

View File

@ -1,31 +1,31 @@
exports[`test A.js 1`] = ` exports[`test A.js 1`] = `
"/* @flow */ "/* @flow */
var m1 = require('1DoesntExist'); var m1 = require(\'1DoesntExist\');
import {numVal as numVal1} from '1DoesntExist'; import {numVal as numVal1} from \'1DoesntExist\';
var a_1: number = m1.numVal; var a_1: number = m1.numVal;
var a_2: number = numVal1; 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 // This tests that, for haste, the first name_mapper regexp that happens to
// match the given module name string is picked. // match the given module name string is picked.
var m2 = require('2DoesntExist'); // Error var m2 = require(\'2DoesntExist\'); // Error
import {numVal as numVal2} from '3DoesntExist'; // Error import {numVal as numVal2} from \'3DoesntExist\'; // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* @flow */ /* @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 // This tests that, for haste, the first name_mapper regexp that happens to
// match the given module name string is picked. // match the given module name string is picked.
// Error // Error
// Error // Error
var m1 = require("1DoesntExist"); var m1 = require(\"1DoesntExist\");
import { numVal as numVal1 } from "1DoesntExist"; import { numVal as numVal1 } from \"1DoesntExist\";
var a_1: number = m1.numVal; var a_1: number = m1.numVal;
var a_2: number = numVal1; var a_2: number = numVal1;
var m2 = require("2DoesntExist"); var m2 = require(\"2DoesntExist\");
import { numVal as numVal2 } from "3DoesntExist"; import { numVal as numVal2 } from \"3DoesntExist\";
" "
`; `;

View File

@ -1,27 +1,27 @@
exports[`test A.js 1`] = ` exports[`test A.js 1`] = `
"/* @flow */ "/* @flow */
var m1 = require('./1DoesntExist'); var m1 = require(\'./1DoesntExist\');
var a_1: number = m1.numVal; var a_1: number = m1.numVal;
var a_2: string = m1.numVal; // Error: number ~> string var a_2: string = m1.numVal; // Error: number ~> string
import {numVal} from './1DoesntExist'; import {numVal} from \'./1DoesntExist\';
var a_3: number = numVal; var a_3: number = numVal;
var a_4: string = numVal; // Error: number ~> string var a_4: string = numVal; // Error: number ~> string
// This tests that, for node, the first name mapping that both matches *and* // This tests that, for node, the first name mapping that both matches *and*
// results in a valid module filename is picked. // results in a valid module filename is picked.
var m2 = require('./2DoesntExist'); var m2 = require(\'./2DoesntExist\');
var b_1: number = m2.numVal; var b_1: number = m2.numVal;
var b_2: string = m2.numVal; // Error: number ~> string 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_3: number = numVal2;
var b_4: string = numVal2; // Error: number ~> string var b_4: string = numVal2; // Error: number ~> string
// node_modules/Exists/index.js // node_modules/Exists/index.js
var m3 = require('4DoesntExist'); var m3 = require(\'4DoesntExist\');
var c_1: number = m3.numVal; var c_1: number = m3.numVal;
var c_2: string = m3.numVal; // Error: number ~> string 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_3: number = numVal3;
var c_4: string = numVal3; // Error: number ~> string 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 // node_modules/Exists/index.js
// Error: number ~> string // Error: number ~> string
// Error: number ~> string // Error: number ~> string
var m1 = require("./1DoesntExist"); var m1 = require(\"./1DoesntExist\");
var a_1: number = m1.numVal; var a_1: number = m1.numVal;
var a_2: string = m1.numVal; var a_2: string = m1.numVal;
import { numVal } from "./1DoesntExist"; import { numVal } from \"./1DoesntExist\";
var a_3: number = numVal; var a_3: number = numVal;
var a_4: string = numVal; var a_4: string = numVal;
var m2 = require("./2DoesntExist"); var m2 = require(\"./2DoesntExist\");
var b_1: number = m2.numVal; var b_1: number = m2.numVal;
var b_2: string = 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_3: number = numVal2;
var b_4: string = numVal2; var b_4: string = numVal2;
var m3 = require("4DoesntExist"); var m3 = require(\"4DoesntExist\");
var c_1: number = m3.numVal; var c_1: number = m3.numVal;
var c_2: string = 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_3: number = numVal3;
var c_4: string = numVal3; var c_4: string = numVal3;
" "

View File

@ -1,15 +1,15 @@
exports[`test toplevel.js 1`] = ` exports[`test toplevel.js 1`] = `
"// @flow "// @flow
import {name} from "testproj"; import {name} from \"testproj\";
(name: "node_modules/testproj"); (name: \"node_modules/testproj\");
(name: "custom_resolve_dir/testproj"); // Error: Resolve from node_modules first! (name: \"custom_resolve_dir/testproj\"); // Error: Resolve from node_modules first!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
// Error: Resolve from node_modules first! // Error: Resolve from node_modules first!
import { name } from "testproj"; import { name } from \"testproj\";
(name: "node_modules/testproj"); (name: \"node_modules/testproj\");
(name: "custom_resolve_dir/testproj"); (name: \"custom_resolve_dir/testproj\");
" "
`; `;

View File

@ -1,9 +1,9 @@
exports[`test index.js 1`] = ` exports[`test index.js 1`] = `
"// @flow "// @flow
export var name: "otherdir/testproj" = "otherdir/testproj"; export var name: \"otherdir/testproj\" = \"otherdir/testproj\";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
export var name: "otherdir/testproj" = "otherdir/testproj"; export var name: \"otherdir/testproj\" = \"otherdir/testproj\";
" "
`; `;

View File

@ -1,9 +1,9 @@
exports[`test index.js 1`] = ` exports[`test index.js 1`] = `
"// @flow "// @flow
export var name: "otherdir/testproj2" = "otherdir/testproj2"; export var name: \"otherdir/testproj2\" = \"otherdir/testproj2\";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
export var name: "otherdir/testproj2" = "otherdir/testproj2"; export var name: \"otherdir/testproj2\" = \"otherdir/testproj2\";
" "
`; `;

View File

@ -1,15 +1,15 @@
exports[`test sublevel.js 1`] = ` exports[`test sublevel.js 1`] = `
"// @flow "// @flow
import {name} from "testproj2"; import {name} from \"testproj2\";
(name: "node_modules/testproj2"); // Error: Resolve from sibling 'custom_resolve_dir' first! (name: \"node_modules/testproj2\"); // Error: Resolve from sibling \'custom_resolve_dir\' first!
(name: "subdir/custom_resolve_dir/testproj2"); (name: \"subdir/custom_resolve_dir/testproj2\");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
// Error: Resolve from sibling 'custom_resolve_dir' first! // Error: Resolve from sibling \'custom_resolve_dir\' first!
import { name } from "testproj2"; import { name } from \"testproj2\";
(name: "node_modules/testproj2"); (name: \"node_modules/testproj2\");
(name: "subdir/custom_resolve_dir/testproj2"); (name: \"subdir/custom_resolve_dir/testproj2\");
" "
`; `;

View File

@ -1,9 +1,9 @@
exports[`test index.js 1`] = ` exports[`test index.js 1`] = `
"// @flow "// @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 // @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\";
" "
`; `;

View File

@ -12,7 +12,7 @@ class A {
return 1; return 1;
} }
static _sMethod(): string { static _sMethod(): string {
return "some string"; return \"some string\";
} }
} }
A._sProperty = 48; A._sProperty = 48;
@ -23,16 +23,16 @@ class B extends A {
constructor() { constructor() {
super(); super();
this._property1 = "another string"; this._property1 = \"another string\";
} }
_method1(): string { _method1(): string {
return "yet another string"; return \"yet another string\";
} }
static _sMethod(): number { static _sMethod(): number {
return 23; return 23;
} }
} }
B._sProperty = "B._sProperty string"; B._sProperty = \"B._sProperty string\";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* @flow */ /* @flow */
class A { class A {
@ -45,7 +45,7 @@ class A {
return 1; return 1;
} }
static _sMethod(): string { static _sMethod(): string {
return "some string"; return \"some string\";
} }
} }
A._sProperty = 48; A._sProperty = 48;
@ -54,16 +54,16 @@ class B extends A {
static _sProperty: string; static _sProperty: string;
constructor() { constructor() {
super(); super();
this._property1 = "another string"; this._property1 = \"another string\";
} }
_method1(): string { _method1(): string {
return "yet another string"; return \"yet another string\";
} }
static _sMethod(): number { static _sMethod(): number {
return 23; 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`] = ` exports[`test commonjs_import.js 1`] = `
"/* @flow */ "/* @flow */
import {_p} from "./commonjs_export"; import {_p} from \"./commonjs_export\";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* @flow */ /* @flow */
import { _p } from "./commonjs_export"; import { _p } from \"./commonjs_export\";
" "
`; `;

View File

@ -12,7 +12,7 @@ class A {
return 1; return 1;
} }
static _sMethod(): string { static _sMethod(): string {
return "some string"; return \"some string\";
} }
} }
A._sProperty = 48; A._sProperty = 48;
@ -23,16 +23,16 @@ class B extends A {
constructor() { constructor() {
super(); super();
this._property1 = "another string"; this._property1 = \"another string\";
} }
_method1(): string { _method1(): string {
return "yet another string"; return \"yet another string\";
} }
static _sMethod(): number { static _sMethod(): number {
return 23; return 23;
} }
} }
B._sProperty = "B._sProperty string"; B._sProperty = \"B._sProperty string\";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* @flow */ /* @flow */
class A { class A {
@ -45,7 +45,7 @@ class A {
return 1; return 1;
} }
static _sMethod(): string { static _sMethod(): string {
return "some string"; return \"some string\";
} }
} }
A._sProperty = 48; A._sProperty = 48;
@ -54,15 +54,15 @@ class B extends A {
static _sProperty: string; static _sProperty: string;
constructor() { constructor() {
super(); super();
this._property1 = "another string"; this._property1 = \"another string\";
} }
_method1(): string { _method1(): string {
return "yet another string"; return \"yet another string\";
} }
static _sMethod(): number { static _sMethod(): number {
return 23; return 23;
} }
} }
B._sProperty = "B._sProperty string"; B._sProperty = \"B._sProperty string\";
" "
`; `;

View File

@ -15,16 +15,16 @@ exports[`test test.js 1`] = `
*/ */
function cannot_reassign(x: string) { 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 // Note: const params use the same machinery as explicit
// const bindings, which are tested more extensively elsewhere. // 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) { function durable_refi(x: ?number) {
if (x) { 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; }; return () => { var y:number = x; };
} }
} }
@ -46,11 +46,11 @@ function durable_refi(x: ?number) {
// error, const param cannot be reassigned // error, const param cannot be reassigned
// Note: const params use the same machinery as explicit // Note: const params use the same machinery as explicit
// const bindings, which are tested more extensively elsewhere. // 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) { function cannot_reassign(x: string) {
x = "hey"; x = \"hey\";
} }
function durable_refi(x: ?number) { function durable_refi(x: ?number) {
if (x) { if (x) {

View File

@ -5,11 +5,11 @@ exports[`test dummy.js 1`] = `
`; `;
exports[`test test.js 1`] = ` exports[`test test.js 1`] = `
"require('./dummy'); "require(\'./dummy\');
var xxx = 0; var xxx = 0;
xxx xxx
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
require("./dummy"); require(\"./dummy\");
var xxx = 0; var xxx = 0;
xxx; xxx;
" "

View File

@ -5,11 +5,11 @@ exports[`test dummy.js 1`] = `
`; `;
exports[`test test.js 1`] = ` exports[`test test.js 1`] = `
"require('./dummy'); "require(\'./dummy\');
var xxx = 0; var xxx = 0;
xxx xxx
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
require("./dummy"); require(\"./dummy\");
var xxx = 0; var xxx = 0;
xxx; xxx;
" "

View File

@ -2,7 +2,7 @@ exports[`test test.js 1`] = `
"type CovArrayVerbose<X,Y:X> = Array<Y>; "type CovArrayVerbose<X,Y:X> = Array<Y>;
var b: CovArrayVerbose<number,*> = []; var b: CovArrayVerbose<number,*> = [];
var y: CovArrayVerbose<mixed,*> = b; var y: CovArrayVerbose<mixed,*> = b;
y[0] = ""; // error y[0] = \"\"; // error
class NVerbose<E,I:E> { class NVerbose<E,I:E> {
x: CovArrayVerbose<E,I>; x: CovArrayVerbose<E,I>;
@ -22,12 +22,12 @@ var z: CovArray<string> = c; // error
var d: CovArray<number> = []; var d: CovArray<number> = [];
var w: CovArray<mixed> = d; var w: CovArray<mixed> = d;
w[0] = ""; // error w[0] = \"\"; // error
type P<X> = CovArray<X>; type P<X> = CovArray<X>;
var p: P<mixed> = []; var p: P<mixed> = [];
(p[0]: number); // not an error! (p[0]: number); // not an error!
p[0] = ""; // error p[0] = \"\"; // error
class M { class M {
x: CovArray<number>; x: CovArray<number>;
@ -60,12 +60,12 @@ var z: CovArray<string> = c; // error
var d: CovArray<number> = []; var d: CovArray<number> = [];
var w: CovArray<mixed> = d; var w: CovArray<mixed> = d;
w[0] = ""; // error w[0] = \"\"; // error
type P<X> = CovArray<X>; type P<X> = CovArray<X>;
var p: P<mixed> = []; var p: P<mixed> = [];
(p[0]: number); // not an error! (p[0]: number); // not an error!
p[0] = ""; // error p[0] = \"\"; // error
class M { class M {
x: CovArray<number>; x: CovArray<number>;
@ -89,7 +89,7 @@ n.x = [0];
type CovArrayVerbose<X, Y: X> = Array<Y>; type CovArrayVerbose<X, Y: X> = Array<Y>;
var b: CovArrayVerbose<number, *> = [ ]; var b: CovArrayVerbose<number, *> = [ ];
var y: CovArrayVerbose<mixed, *> = b; var y: CovArrayVerbose<mixed, *> = b;
y[0] = ""; y[0] = \"\";
class NVerbose<E, I: E> { class NVerbose<E, I: E> {
x: CovArrayVerbose<E, I>; x: CovArrayVerbose<E, I>;
foo(): CovArrayVerbose<mixed, I> { foo(): CovArrayVerbose<mixed, I> {

View File

@ -1,5 +1,5 @@
exports[`test crash.js 1`] = ` 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 // that we implicitly assume in type-at-pos and coverage implementations. In
// particular, when unchecked it causes a crash with coverage --color. // particular, when unchecked it causes a crash with coverage --color.
@ -11,7 +11,7 @@ declare module bar {
// TODO // 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 // that we implicitly assume in type-at-pos and coverage implementations. In
// particular, when unchecked it causes a crash with coverage --color. // particular, when unchecked it causes a crash with coverage --color.
// TODO // TODO
@ -47,7 +47,7 @@ let x = 0;
`; `;
exports[`test non-termination.js 1`] = ` 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 // that we implicitly assume in type-at-pos and coverage implementations. In
// particular, when unchecked it causes non-termination with coverage --color. // particular, when unchecked it causes non-termination with coverage --color.
@ -62,7 +62,7 @@ declare module bar {
declare class qux { 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 // that we implicitly assume in type-at-pos and coverage implementations. In
// particular, when unchecked it causes non-termination with coverage --color. // particular, when unchecked it causes non-termination with coverage --color.
// TODO // TODO

View File

@ -1,25 +1,25 @@
exports[`test A.js 1`] = ` exports[`test A.js 1`] = `
"var B = require('./B'); "var B = require(\'./B\');
class A extends B { } class A extends B { }
module.exports = A; module.exports = A;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var B = require("./B"); var B = require(\"./B\");
class A extends B {} class A extends B {}
module.exports = A; module.exports = A;
" "
`; `;
exports[`test B.js 1`] = ` exports[`test B.js 1`] = `
"var A = require('./A'); "var A = require(\'./A\');
//class B extends A { } //class B extends A { }
module.exports = B; module.exports = B;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//class B extends A { } //class B extends A { }
var A = require("./A"); var A = require(\"./A\");
module.exports = B; module.exports = B;
" "
`; `;

View File

@ -7,7 +7,7 @@ var y:number = d;
// valid constructors // valid constructors
new Date(); new Date();
new Date(1234567890); new Date(1234567890);
new Date('2015/06/18'); new Date(\'2015/06/18\');
new Date(2015, 6); new Date(2015, 6);
new Date(2015, 6, 18); new Date(2015, 6, 18);
new Date(2015, 6, 18, 11); new Date(2015, 6, 18, 11);
@ -17,16 +17,16 @@ new Date(2015, 6, 18, 11, 55, 42, 999);
// invalid constructors // invalid constructors
new Date({}); new Date({});
new Date(2015, '6'); new Date(2015, \'6\');
new Date(2015, 6, '18'); new Date(2015, 6, \'18\');
new Date(2015, 6, 18, '11'); new Date(2015, 6, 18, \'11\');
new Date(2015, 6, 18, 11, '55'); new Date(2015, 6, 18, 11, \'55\');
new Date(2015, 6, 18, 11, 55, '42'); new Date(2015, 6, 18, 11, 55, \'42\');
new Date(2015, 6, 18, 11, 55, 42, '999'); new Date(2015, 6, 18, 11, 55, 42, \'999\');
// invalid constructors that we incorrectly consider valid // invalid constructors that we incorrectly consider valid
new Date('2015', 6); new Date(\'2015\', 6);
new Date(2015, 6, 18, 11, 55, 42, 999, 'hahaha'); new Date(2015, 6, 18, 11, 55, 42, 999, \'hahaha\');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// valid constructors // valid constructors
// invalid constructors // invalid constructors
@ -36,7 +36,7 @@ var x: string = d.getTime();
var y: number = d; var y: number = d;
new Date(); new Date();
new Date(1234567890); new Date(1234567890);
new Date("2015/06/18"); new Date(\"2015/06/18\");
new Date(2015, 6); new Date(2015, 6);
new Date(2015, 6, 18); new Date(2015, 6, 18);
new Date(2015, 6, 18, 11); 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);
new Date(2015, 6, 18, 11, 55, 42, 999); new Date(2015, 6, 18, 11, 55, 42, 999);
new Date({}); new Date({});
new Date(2015, "6"); new Date(2015, \"6\");
new Date(2015, 6, "18"); new Date(2015, 6, \"18\");
new Date(2015, 6, 18, "11"); new Date(2015, 6, 18, \"11\");
new Date(2015, 6, 18, 11, "55"); new Date(2015, 6, 18, 11, \"55\");
new Date(2015, 6, 18, 11, 55, "42"); new Date(2015, 6, 18, 11, 55, \"42\");
new Date(2015, 6, 18, 11, 55, 42, "999"); new Date(2015, 6, 18, 11, 55, 42, \"999\");
new Date("2015", 6); new Date(\"2015\", 6);
new Date(2015, 6, 18, 11, 55, 42, 999, "hahaha"); new Date(2015, 6, 18, 11, 55, 42, 999, \"hahaha\");
" "
`; `;

View File

@ -4,13 +4,13 @@ exports[`test ExplicitProvidesModuleDifferentName.js 1`] = `
* @flow * @flow
*/ */
module.exports.fun = (): string => "hello there"; module.exports.fun = (): string => \"hello there\";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* /*
* @providesModule ExplicitProvidesModuleDifferentName * @providesModule ExplicitProvidesModuleDifferentName
* @flow * @flow
*/ */
module.exports.fun = (): string => "hello there"; module.exports.fun = (): string => \"hello there\";
" "
`; `;
@ -20,13 +20,13 @@ exports[`test ExplicitProvidesModuleSameName.js 1`] = `
* @flow * @flow
*/ */
module.exports.fun = (): string => "hello there"; module.exports.fun = (): string => \"hello there\";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* /*
* @providesModule ExplicitProvidesModuleSameName * @providesModule ExplicitProvidesModuleSameName
* @flow * @flow
*/ */
module.exports.fun = (): string => "hello there"; module.exports.fun = (): string => \"hello there\";
" "
`; `;
@ -36,13 +36,13 @@ exports[`test ImplicitProvidesModule.js 1`] = `
* @flow * @flow
*/ */
module.exports.fun = (): string => "hello there"; module.exports.fun = (): string => \"hello there\";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* /*
* @providesModule ImplicitProvidesModule * @providesModule ImplicitProvidesModule
* @flow * @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`] = ` exports[`test test.js 1`] = `
"/* @flow */ "/* @flow */
var Implicit = require('ImplicitProvidesModule'); var Implicit = require(\'ImplicitProvidesModule\');
(Implicit.fun(): string); (Implicit.fun(): string);
var ExplicitSameName = require('ExplicitProvidesModuleSameName'); var ExplicitSameName = require(\'ExplicitProvidesModuleSameName\');
(ExplicitSameName.fun(): string); (ExplicitSameName.fun(): string);
var ExplicitDifferentName = require('ExplicitProvidesModuleDifferentName'); var ExplicitDifferentName = require(\'ExplicitProvidesModuleDifferentName\');
(ExplicitDifferentName.fun(): string); (ExplicitDifferentName.fun(): string);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* @flow */ /* @flow */
var Implicit = require("ImplicitProvidesModule"); var Implicit = require(\"ImplicitProvidesModule\");
(Implicit.fun(): string); (Implicit.fun(): string);
var ExplicitSameName = require("ExplicitProvidesModuleSameName"); var ExplicitSameName = require(\"ExplicitProvidesModuleSameName\");
(ExplicitSameName.fun(): string); (ExplicitSameName.fun(): string);
var ExplicitDifferentName = require("ExplicitProvidesModuleDifferentName"); var ExplicitDifferentName = require(\"ExplicitProvidesModuleDifferentName\");
(ExplicitDifferentName.fun(): string); (ExplicitDifferentName.fun(): string);
" "
`; `;

View File

@ -1,6 +1,6 @@
exports[`test min.js 1`] = ` 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\";
" "
`; `;

View File

@ -1,25 +1,25 @@
exports[`test nested_test.js 1`] = ` exports[`test nested_test.js 1`] = `
"/* @flow */ "/* @flow */
var docblock = require('qux/docblock'); var docblock = require(\'qux/docblock\');
var min = require('d3/min.js'); var min = require(\'d3/min.js\');
var corge = require('qux/corge'); 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 // annotations - see node_modules/qux/docblock.js
var unreachable = require('annotation'); var unreachable = require(\'annotation\');
(docblock.fun(): string); (docblock.fun(): string);
(min.fun(): string); (min.fun(): string);
(corge.fun(): string); (corge.fun(): string);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* @flow */ /* @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 // annotations - see node_modules/qux/docblock.js
var docblock = require("qux/docblock"); var docblock = require(\"qux/docblock\");
var min = require("d3/min.js"); var min = require(\"d3/min.js\");
var corge = require("qux/corge"); var corge = require(\"qux/corge\");
var unreachable = require("annotation"); var unreachable = require(\"annotation\");
(docblock.fun(): string); (docblock.fun(): string);
(min.fun(): string); (min.fun(): string);
(corge.fun(): string); (corge.fun(): string);

View File

@ -1,6 +1,6 @@
exports[`test client.js 1`] = ` exports[`test client.js 1`] = `
"var ws = require('../'); "var ws = require(\'../\');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var ws = require("../"); var ws = require(\"../\");
" "
`; `;

View File

@ -76,24 +76,24 @@ exports[`test md5.js 1`] = `
exports[`test test.js 1`] = ` exports[`test test.js 1`] = `
"/* @flow */ "/* @flow */
var Implicit = require('ImplicitProvidesModule'); var Implicit = require(\'ImplicitProvidesModule\');
(Implicit.fun(): boolean); // Error: Either Implementation ~> boolean or Declaration ~> boolean (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 (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 (ExplicitDifferentName.fun(): boolean); // Error: Either Implementation ~> boolean or Declaration ~> boolean
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* @flow */ /* @flow */
// Error: Either Implementation ~> boolean or Declaration ~> boolean // Error: Either Implementation ~> boolean or Declaration ~> boolean
// Error: Either Implementation ~> boolean or Declaration ~> boolean // 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); (Implicit.fun(): boolean);
var ExplicitSameName = require("ExplicitProvidesModuleSameName"); var ExplicitSameName = require(\"ExplicitProvidesModuleSameName\");
(ExplicitSameName.fun(): boolean); (ExplicitSameName.fun(): boolean);
var ExplicitDifferentName = require("ExplicitProvidesModuleDifferentName"); var ExplicitDifferentName = require(\"ExplicitProvidesModuleDifferentName\");
(ExplicitDifferentName.fun(): boolean); (ExplicitDifferentName.fun(): boolean);
" "
`; `;

View File

@ -1,9 +1,9 @@
exports[`test nested_test.js 1`] = ` exports[`test nested_test.js 1`] = `
"/* @flow */ "/* @flow */
var docblock = require('qux/docblock'); var docblock = require(\'qux/docblock\');
var min = require('d3/min.js'); var min = require(\'d3/min.js\');
var corge = require('qux/corge'); var corge = require(\'qux/corge\');
(docblock.fun(): boolean); // Error: Either Implementation ~> boolean or Declaration ~> boolean (docblock.fun(): boolean); // Error: Either Implementation ~> boolean or Declaration ~> boolean
(min.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 // 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 docblock = require(\"qux/docblock\");
var min = require("d3/min.js"); var min = require(\"d3/min.js\");
var corge = require("qux/corge"); var corge = require(\"qux/corge\");
(docblock.fun(): boolean); (docblock.fun(): boolean);
(min.fun(): boolean); (min.fun(): boolean);
(corge.fun(): boolean); (corge.fun(): boolean);

View File

@ -1,6 +1,6 @@
exports[`test client.js 1`] = ` exports[`test client.js 1`] = `
"var ws = require('../'); "var ws = require(\'../\');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var ws = require("../"); var ws = require(\"../\");
" "
`; `;

View File

@ -13,43 +13,43 @@ exports[`test test_absolute.js 1`] = `
"/* @flow */ "/* @flow */
// This will require ./node_modules/B.js.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 (B1.fun(): boolean); // Error either Implementation ~> boolean or Declaration ~> boolean
// This will require ./node_modules/B.js.flow // 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 (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 (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 (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 (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 (F.fun(): boolean); // Error either Implementation ~> boolean or Declaration ~> boolean
// This will require ./node_modules/B.js.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 (B1.fun(): boolean); // Error either Implementation ~> boolean or Declaration ~> boolean
// This will require ./node_modules/B.js.flow // 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 (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 (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 (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 (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 (F.fun(): boolean); // Error either Implementation ~> boolean or Declaration ~> boolean
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* @flow */ /* @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 // 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); (B1.fun(): boolean);
var B2 = require("B.js"); var B2 = require(\"B.js\");
(B2.fun(): boolean); (B2.fun(): boolean);
var C = require("package_with_full_main"); var C = require(\"package_with_full_main\");
(C.fun(): boolean); (C.fun(): boolean);
var D = require("package_with_partial_main"); var D = require(\"package_with_partial_main\");
(D.fun(): boolean); (D.fun(): boolean);
var E = require("package_with_no_package_json"); var E = require(\"package_with_no_package_json\");
(E.fun(): boolean); (E.fun(): boolean);
var F = require("package_with_dir_main"); var F = require(\"package_with_dir_main\");
(F.fun(): boolean); (F.fun(): boolean);
var B1 = require("B"); var B1 = require(\"B\");
(B1.fun(): boolean); (B1.fun(): boolean);
var B2 = require("B.js"); var B2 = require(\"B.js\");
(B2.fun(): boolean); (B2.fun(): boolean);
var C = require("package_with_full_main"); var C = require(\"package_with_full_main\");
(C.fun(): boolean); (C.fun(): boolean);
var D = require("package_with_partial_main"); var D = require(\"package_with_partial_main\");
(D.fun(): boolean); (D.fun(): boolean);
var E = require("package_with_no_package_json"); var E = require(\"package_with_no_package_json\");
(E.fun(): boolean); (E.fun(): boolean);
var F = require("package_with_dir_main"); var F = require(\"package_with_dir_main\");
(F.fun(): boolean); (F.fun(): boolean);
" "
`; `;
exports[`test test_relative.js 1`] = ` exports[`test test_relative.js 1`] = `
"import { foo } from './A'; "import { foo } from \'./A\';
(foo(): boolean); // Error: either Implementation ~> boolean or Definition ~> boolean (foo(): boolean); // Error: either Implementation ~> boolean or Definition ~> 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); (foo(): boolean);
" "
`; `;

View File

@ -1,10 +1,10 @@
exports[`test A.js 1`] = ` exports[`test A.js 1`] = `
"/* @flow */ "/* @flow */
module.exports.fun = (): string => 'hello there!'; module.exports.fun = (): string => \'hello there!\';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* @flow */ /* @flow */
module.exports.fun = (): string => "hello there!"; module.exports.fun = (): string => \"hello there!\";
" "
`; `;
@ -21,23 +21,23 @@ exports[`test test_absolute.js 1`] = `
"/* @flow */ "/* @flow */
// This will require ./node_modules/B.js.flow // This will require ./node_modules/B.js.flow
var B1 = require('B'); var B1 = require(\'B\');
(B1.fun(): string); // Error number ~> string (B1.fun(): string); // Error number ~> string
// This will require ./node_modules/B.js.flow // This will require ./node_modules/B.js.flow
var B2 = require('B.js'); var B2 = require(\'B.js\');
(B2.fun(): string); // Error number ~> string (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 (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 (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 (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 (F.fun(): string); // Error number ~> string
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* @flow */ /* @flow */
@ -49,17 +49,17 @@ var F = require('package_with_dir_main');
// Error number ~> string // Error number ~> string
// Error number ~> string // Error number ~> string
// Error number ~> string // Error number ~> string
var B1 = require("B"); var B1 = require(\"B\");
(B1.fun(): string); (B1.fun(): string);
var B2 = require("B.js"); var B2 = require(\"B.js\");
(B2.fun(): string); (B2.fun(): string);
var C = require("package_with_full_main"); var C = require(\"package_with_full_main\");
(C.fun(): string); (C.fun(): string);
var D = require("package_with_partial_main"); var D = require(\"package_with_partial_main\");
(D.fun(): string); (D.fun(): string);
var E = require("package_with_no_package_json"); var E = require(\"package_with_no_package_json\");
(E.fun(): string); (E.fun(): string);
var F = require("package_with_dir_main"); var F = require(\"package_with_dir_main\");
(F.fun(): string); (F.fun(): string);
" "
`; `;
@ -68,14 +68,14 @@ exports[`test test_relative.js 1`] = `
"/* @flow */ "/* @flow */
// This will require ./A.js.flow // This will require ./A.js.flow
var A1 = require('./A'); var A1 = require(\'./A\');
(A1.fun(): string); // Error number ~> string (A1.fun(): string); // Error number ~> string
// This will require ./A.js.flow // This will require ./A.js.flow
var A2 = require('./A.js'); var A2 = require(\'./A.js\');
(A2.fun(): string); // Error number ~> string (A2.fun(): string); // Error number ~> string
var CJS = require('./CJS.js'); var CJS = require(\'./CJS.js\');
(CJS: string); (CJS: string);
(CJS: number); // Error: string ~> number (CJS: number); // Error: string ~> number
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -85,11 +85,11 @@ var CJS = require('./CJS.js');
// This will require ./A.js.flow // This will require ./A.js.flow
// Error number ~> string // Error number ~> string
// Error: string ~> number // Error: string ~> number
var A1 = require("./A"); var A1 = require(\"./A\");
(A1.fun(): string); (A1.fun(): string);
var A2 = require("./A.js"); var A2 = require(\"./A.js\");
(A2.fun(): string); (A2.fun(): string);
var CJS = require("./CJS.js"); var CJS = require(\"./CJS.js\");
(CJS: string); (CJS: string);
(CJS: number); (CJS: number);
" "

View File

@ -245,13 +245,13 @@ exports[`test ES6_ExportAllFrom_Intermediary1.js 1`] = `
* @flow * @flow
*/ */
declare export * from "ES6_ExportAllFrom_Source1"; declare export * from \"ES6_ExportAllFrom_Source1\";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** /**
* @providesModule ES6_ExportAllFrom_Intermediary1 * @providesModule ES6_ExportAllFrom_Intermediary1
* @flow * @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 * @flow
*/ */
declare export * from "ES6_ExportAllFrom_Source2"; declare export * from \"ES6_ExportAllFrom_Source2\";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** /**
* @providesModule ES6_ExportAllFrom_Intermediary2 * @providesModule ES6_ExportAllFrom_Intermediary2
* @flow * @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`] = ` exports[`test ES6_ExportAllFromMulti.js 1`] = `
"// @flow "// @flow
declare export * from "./ES6_ExportAllFrom_Source1"; declare export * from \"./ES6_ExportAllFrom_Source1\";
declare export * from "./ES6_ExportAllFrom_Source2"; declare export * from \"./ES6_ExportAllFrom_Source2\";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
declare export * from "./ES6_ExportAllFrom_Source1" declare export * from \"./ES6_ExportAllFrom_Source1\"
declare export * from "./ES6_ExportAllFrom_Source2" declare export * from \"./ES6_ExportAllFrom_Source2\"
" "
`; `;
@ -324,13 +324,13 @@ exports[`test ES6_ExportFrom_Intermediary1.js 1`] = `
declare export { declare export {
numberValue1, numberValue1,
numberValue2 as numberValue2_renamed numberValue2 as numberValue2_renamed
} from "ES6_ExportFrom_Source1"; } from \"ES6_ExportFrom_Source1\";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** /**
* @providesModule ES6_ExportFrom_Intermediary1 * @providesModule ES6_ExportFrom_Intermediary1
* @flow * @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 { declare export {
numberValue1, numberValue1,
numberValue2 as numberValue2_renamed2 numberValue2 as numberValue2_renamed2
} from "ES6_ExportFrom_Source2"; } from \"ES6_ExportFrom_Source2\";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** /**
* @providesModule ES6_ExportFrom_Intermediary2 * @providesModule ES6_ExportFrom_Intermediary2
* @flow * @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.numberValue2 = 42;
exports.numberValue3 = 42; exports.numberValue3 = 42;
exports.numberValue4 = 42; exports.numberValue4 = 42;
exports.stringValue = "str"; exports.stringValue = \"str\";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** /**
* @providesModule A * @providesModule A
@ -491,7 +491,7 @@ exports.numberValue1 = 42;
exports.numberValue2 = 42; exports.numberValue2 = 42;
exports.numberValue3 = 42; exports.numberValue3 = 42;
exports.numberValue4 = 42; exports.numberValue4 = 42;
exports.stringValue = "str"; exports.stringValue = \"str\";
" "
`; `;
@ -568,44 +568,44 @@ exports[`test es6modules.js 1`] = `
// ===================== // // ===================== //
// @providesModule // @providesModule
import * as DefaultA from "A"; import * as DefaultA from \"A\";
var a1: number = DefaultA.numberValue1; var a1: number = DefaultA.numberValue1;
var a2: string = DefaultA.numberValue1; // Error: number ~> string var a2: string = DefaultA.numberValue1; // Error: number ~> string
// File path // File path
import * as DefaultB from "./B"; import * as DefaultB from \"./B\";
var b1: number = DefaultB.numberValue; var b1: number = DefaultB.numberValue;
var b2: string = DefaultB.numberValue; // Error: number ~> string var b2: string = DefaultB.numberValue; // Error: number ~> string
// C.js exists, but not as a providesModule // 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 // @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 == // // == 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 c1: number = numberValue1;
var c2: string = numberValue1; // Error: number ~> string 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 d1: number = numVal1;
var d2: string = numVal1; // Error: number ~> string 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 e1: number = CJS_Clobb_Lit.numberValue3;
var e2: string = CJS_Clobb_Lit.numberValue3; // Error: number ~> string 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 f1: number = CJS_Clobb_Lit_NS.numberValue4;
var f2: number = CJS_Clobb_Lit_NS.default.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 f3: string = CJS_Clobb_Lit_NS.numberValue4; // Error: number ~> string
var f4: string = CJS_Clobb_Lit_NS.default.numberValue5; // 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 == // // == 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 // The following import should error because class statics are not turned into
// named exports for now. This avoids complexities with polymorphic static // named exports for now. This avoids complexities with polymorphic static
// members (where the polymophism is defined on the class itself rather than the // members (where the polymophism is defined on the class itself rather than the
// method). // 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();
new CJS_Clobb_Class().doesntExist; // Error: Class has no \`doesntExist\` property new CJS_Clobb_Class().doesntExist; // Error: Class has no \`doesntExist\` property
var h1: number = CJS_Clobb_Class.staticNumber2(); 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 h3: number = new CJS_Clobb_Class().instNumber1();
var h4: string = new CJS_Clobb_Class().instNumber1(); // Error: number ~> string var h4: string = new CJS_Clobb_Class().instNumber1(); // Error: number ~> string
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(); // Error: Namespace object isn't constructable 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 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 i2: number = new CJS_Clobb_Class_NS.default().instNumber2();
var i3: string = new CJS_Clobb_Class_NS.default().instNumber2(); // Error: number ~> string 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 == // // == 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 j1: number = numberValue2;
var j2: string = numberValue2; // Error: number ~> string 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 k1: number = numVal3;
var k2: string = numVal3; // Error: number ~> string 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 l1: number = CJS_Named.numberValue1;
var l2: string = CJS_Named.numberValue1; // Error: number ~> string 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 m1: number = CJS_Named_NS.numberValue4;
var m2: string = CJS_Named_NS.default.numberValue4; // Error: CommonJS_Named has no default export 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 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 == // // == 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 n1: number = ES6_Def_AnonFunc1();
var n2: string = ES6_Def_AnonFunc1(); // Error: number ~> string 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 o1: number = ES6_Def_NamedFunc1();
var o2: string = ES6_Def_NamedFunc1(); // Error: number ~> string 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 q1: number = new ES6_Def_NamedClass1().givesANum();
var q2: string = new ES6_Def_NamedClass1().givesANum(); // Error: number ~> string 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 == // // == 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 r1: number = specifierNumber1_1;
var r2: string = specifierNumber1_1; // Error: number ~> string var r2: string = specifierNumber1_1; // Error: number ~> string
import {specifierNumber2Renamed} from "ES6_Named1"; import {specifierNumber2Renamed} from \"ES6_Named1\";
var s1: number = specifierNumber2Renamed; var s1: number = specifierNumber2Renamed;
var s2: string = specifierNumber2Renamed; // Error: number ~> string 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 t1: number = specifierNumber3Renamed;
var t2: string = specifierNumber3Renamed; // Error: number ~> string var t2: string = specifierNumber3Renamed; // Error: number ~> string
import {groupedSpecifierNumber1, groupedSpecifierNumber2} from "ES6_Named1"; import {groupedSpecifierNumber1, groupedSpecifierNumber2} from \"ES6_Named1\";
var u1: number = groupedSpecifierNumber1; var u1: number = groupedSpecifierNumber1;
var u2: number = groupedSpecifierNumber2; var u2: number = groupedSpecifierNumber2;
var u3: string = groupedSpecifierNumber1; // Error: number ~> string var u3: string = groupedSpecifierNumber1; // Error: number ~> string
var u4: string = groupedSpecifierNumber2; // 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 v1: number = givesANumber();
var v2: string = givesANumber(); // Error: number ~> string var v2: string = givesANumber(); // Error: number ~> string
import {NumberGenerator} from "ES6_Named1"; import {NumberGenerator} from \"ES6_Named1\";
var w1: number = new NumberGenerator().givesANumber(); var w1: number = new NumberGenerator().givesANumber();
var w2: string = new NumberGenerator().givesANumber(); // Error: number ~> string 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 x1: number = varDeclNumber1;
var x2: number = varDeclNumber2; var x2: number = varDeclNumber2;
var x3: string = varDeclNumber1; // Error: number ~> string 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 aa1: number = numberValue4;
var aa2: string = numberValue4; // Error: number ~> string 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 ab1: number = numberValue2_renamed;
var ab2: string = numberValue2_renamed; // Error: number ~> string 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 ac1: number = numberValue5;
var ac2: string = numberValue5; // Error: number ~> string var ac2: string = numberValue5; // Error: number ~> string
@ -743,13 +743,13 @@ var ac2: string = numberValue5; // Error: number ~> string
// == ES6 Default -> CommonJS == // // == 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 ad1: number = ES6_Def_AnonFunc2();
var ad2: string = ES6_Def_AnonFunc2(); // Error: number ~> string 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 ae1: number = ES6_Def_NamedFunc2();
var ae2: string = ES6_Def_NamedFunc2(); // Error: number ~> string 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 ag1: number = new ES6_Def_NamedClass2().givesANum();
var ag2: string = new ES6_Def_NamedClass2().givesANum(); // Error: number ~> string 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 == // // == ES6 Named -> CommonJS == //
///////////////////////////////// /////////////////////////////////
var specifierNumber4 = require("ES6_Named2").specifierNumber4; var specifierNumber4 = require(\"ES6_Named2\").specifierNumber4;
var ah1: number = specifierNumber4; var ah1: number = specifierNumber4;
var ah2: string = specifierNumber4; // Error: number ~> string var ah2: string = specifierNumber4; // Error: number ~> string
var specifierNumber5Renamed = require("ES6_Named2").specifierNumber5Renamed; var specifierNumber5Renamed = require(\"ES6_Named2\").specifierNumber5Renamed;
var ai1: number = specifierNumber5Renamed; var ai1: number = specifierNumber5Renamed;
var ai2: string = specifierNumber5Renamed; // Error: number ~> string var ai2: string = specifierNumber5Renamed; // Error: number ~> string
var groupedSpecifierNumber3 = require("ES6_Named2").groupedSpecifierNumber3; var groupedSpecifierNumber3 = require(\"ES6_Named2\").groupedSpecifierNumber3;
var groupedSpecifierNumber4 = require("ES6_Named2").groupedSpecifierNumber4; var groupedSpecifierNumber4 = require(\"ES6_Named2\").groupedSpecifierNumber4;
var aj1: number = groupedSpecifierNumber3; var aj1: number = groupedSpecifierNumber3;
var aj2: number = groupedSpecifierNumber4; var aj2: number = groupedSpecifierNumber4;
var aj3: string = groupedSpecifierNumber3; // Error: number ~> string var aj3: string = groupedSpecifierNumber3; // Error: number ~> string
var aj4: string = groupedSpecifierNumber4; // 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 ak1: number = givesANumber2();
var ak2: string = givesANumber2(); // Error: number ~> string 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 al1: number = new NumberGenerator2().givesANumber();
var al2: string = new NumberGenerator2().givesANumber(); // Error: number ~> string var al2: string = new NumberGenerator2().givesANumber(); // Error: number ~> string
var varDeclNumber3 = require("ES6_Named2").varDeclNumber3; var varDeclNumber3 = require(\"ES6_Named2\").varDeclNumber3;
var varDeclNumber4 = require("ES6_Named2").varDeclNumber4; var varDeclNumber4 = require(\"ES6_Named2\").varDeclNumber4;
var am1: number = varDeclNumber3; var am1: number = varDeclNumber3;
var am2: number = varDeclNumber4; var am2: number = varDeclNumber4;
var am3: string = varDeclNumber3; // Error: number ~> string 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 ap1: number = numberValue6;
var ap2: string = numberValue6; // Error: number ~> string 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 aq1: number = numberValue2_renamed2;
var aq2: string = numberValue2_renamed2; // Error: number ~> string 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 ar1: number = numberValue7;
var ar2: string = numberValue7; // Error: number ~> string 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== // // == 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 as1: number = defaultNum;
var as2: string = defaultNum; // Error: number ~> string var as2: string = defaultNum; // Error: number ~> string
@ -831,13 +831,13 @@ var as4: number = namedStr; // Error: string ~> number
// == Side-effect only ES6 imports == // // == Side-effect only ES6 imports == //
//////////////////////////////////////// ////////////////////////////////////////
import "./SideEffects"; import \"./SideEffects\";
////////////////////////////////////////////// //////////////////////////////////////////////
// == Suggest export name on likely typo == // // == Suggest export name on likely typo == //
////////////////////////////////////////////// //////////////////////////////////////////////
import specifierNumber1 from "ES6_Named1"; // Error: Did you mean \`import {specifierNumber1} from ...\`? import specifierNumber1 from \"ES6_Named1\"; // Error: Did you mean \`import {specifierNumber1} from ...\`?
import {specifierNumber} from "ES6_Named1"; // Error: Did you mean \`specifierNumber1\`? import {specifierNumber} from \"ES6_Named1\"; // Error: Did you mean \`specifierNumber1\`?
/////////////////////////////////////////////////// ///////////////////////////////////////////////////
// == Multi \`export *\` should combine exports == // // == Multi \`export *\` should combine exports == //
@ -845,7 +845,7 @@ import {specifierNumber} from "ES6_Named1"; // Error: Did you mean \`specifierNu
import { import {
numberValue1 as numberValue8, numberValue1 as numberValue8,
numberValue2 as numberValue9 numberValue2 as numberValue9
} from "./ES6_ExportAllFromMulti"; } from \"./ES6_ExportAllFromMulti\";
var at1: number = numberValue8; var at1: number = numberValue8;
var at2: string = numberValue8; // Error: number ~> string 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: number ~> string
// Error: number ~> string // Error: number ~> string
// Error: doesntExist isn't a property // Error: doesntExist isn\'t a property
// Error: No 'default' property on the exported obj // Error: No \'default\' property on the exported obj
// Error: number ~> string // Error: number ~> string
// Error: number ~> string // Error: number ~> string
// ============================================== // // ============================================== //
@ -888,7 +888,7 @@ var at4: string = numberValue9; // Error: number ~> string
// Error: Class has no \`doesntExist\` property // Error: Class has no \`doesntExist\` property
// Error: number ~> string // Error: number ~> string
// 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: Class statics not copied to Namespace object
// Error: number ~> string // Error: number ~> string
// =================================== // // =================================== //
@ -898,7 +898,7 @@ var at4: string = numberValue9; // Error: number ~> string
// Error: number ~> string // Error: number ~> string
// 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: CommonJS_Named has no default export
// Error: number ~> string // Error: number ~> string
////////////////////////////// //////////////////////////////
@ -927,7 +927,7 @@ var at4: string = numberValue9; // Error: number ~> string
/////////////////////////////////// ///////////////////////////////////
// == ES6 Default -> CommonJS == // // == ES6 Default -> CommonJS == //
/////////////////////////////////// ///////////////////////////////////
// Error: 'doesntExist' isn't an export // Error: \'doesntExist\' isn\'t an export
// Error: number ~> string // Error: number ~> string
// Error: number ~> string // 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
// Error: number ~> string // Error: number ~> string
import * as DefaultA from "A"; import * as DefaultA from \"A\";
var a1: number = DefaultA.numberValue1; var a1: number = DefaultA.numberValue1;
var a2: string = DefaultA.numberValue1; var a2: string = DefaultA.numberValue1;
import * as DefaultB from "./B"; import * as DefaultB from \"./B\";
var b1: number = DefaultB.numberValue; var b1: number = DefaultB.numberValue;
var b2: string = DefaultB.numberValue; var b2: string = DefaultB.numberValue;
import DefaultC from "C"; import DefaultC from \"C\";
import DefaultD from "./D"; import DefaultD from \"./D\";
import { doesntExist1 } from "CommonJS_Clobbering_Lit"; import { doesntExist1 } from \"CommonJS_Clobbering_Lit\";
import { numberValue1 } from "CommonJS_Clobbering_Lit"; import { numberValue1 } from \"CommonJS_Clobbering_Lit\";
var c1: number = numberValue1; var c1: number = numberValue1;
var c2: string = 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 d1: number = numVal1;
var d2: string = 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 e1: number = CJS_Clobb_Lit.numberValue3;
var e2: string = CJS_Clobb_Lit.numberValue3; var e2: string = CJS_Clobb_Lit.numberValue3;
CJS_Clobb_Lit.doesntExist; 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 f1: number = CJS_Clobb_Lit_NS.numberValue4;
var f2: number = CJS_Clobb_Lit_NS.default.numberValue4; var f2: number = CJS_Clobb_Lit_NS.default.numberValue4;
CJS_Clobb_Lit_NS.default.default; CJS_Clobb_Lit_NS.default.default;
var f3: string = CJS_Clobb_Lit_NS.numberValue4; var f3: string = CJS_Clobb_Lit_NS.numberValue4;
var f4: string = CJS_Clobb_Lit_NS.default.numberValue5; var f4: string = CJS_Clobb_Lit_NS.default.numberValue5;
import { doesntExist2 } from "CommonJS_Clobbering_Class"; import { doesntExist2 } from \"CommonJS_Clobbering_Class\";
import { staticNumber1, baseProp, childProp } from "CommonJS_Clobbering_Class"; import { staticNumber1, baseProp, childProp } from \"CommonJS_Clobbering_Class\";
import CJS_Clobb_Class from "CommonJS_Clobbering_Class"; import CJS_Clobb_Class from \"CommonJS_Clobbering_Class\";
new CJS_Clobb_Class(); new CJS_Clobb_Class();
new CJS_Clobb_Class().doesntExist; new CJS_Clobb_Class().doesntExist;
var h1: number = CJS_Clobb_Class.staticNumber2(); var h1: number = CJS_Clobb_Class.staticNumber2();
var h2: string = CJS_Clobb_Class.staticNumber2(); var h2: string = CJS_Clobb_Class.staticNumber2();
var h3: number = new CJS_Clobb_Class().instNumber1(); var h3: number = new CJS_Clobb_Class().instNumber1();
var h4: string = 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(); new CJS_Clobb_Class_NS();
var i1: number = CJS_Clobb_Class_NS.staticNumber3(); var i1: number = CJS_Clobb_Class_NS.staticNumber3();
var i2: number = new CJS_Clobb_Class_NS.default().instNumber2(); var i2: number = new CJS_Clobb_Class_NS.default().instNumber2();
var i3: string = new CJS_Clobb_Class_NS.default().instNumber2(); var i3: string = new CJS_Clobb_Class_NS.default().instNumber2();
import { doesntExist3 } from "CommonJS_Named"; import { doesntExist3 } from \"CommonJS_Named\";
import { numberValue2 } from "CommonJS_Named"; import { numberValue2 } from \"CommonJS_Named\";
var j1: number = numberValue2; var j1: number = numberValue2;
var j2: string = numberValue2; var j2: string = numberValue2;
import { numberValue3 as numVal3 } from "CommonJS_Named"; import { numberValue3 as numVal3 } from \"CommonJS_Named\";
var k1: number = numVal3; var k1: number = numVal3;
var k2: string = 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 l1: number = CJS_Named.numberValue1;
var l2: string = CJS_Named.numberValue1; var l2: string = CJS_Named.numberValue1;
CJS_Named.doesntExist; 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 m1: number = CJS_Named_NS.numberValue4;
var m2: string = CJS_Named_NS.default.numberValue4; var m2: string = CJS_Named_NS.default.numberValue4;
var m3: string = CJS_Named_NS.numberValue4; var m3: string = CJS_Named_NS.numberValue4;
import { doesntExist4 } from "ES6_Default_AnonFunction1"; import { doesntExist4 } from \"ES6_Default_AnonFunction1\";
import ES6_Def_AnonFunc1 from "ES6_Default_AnonFunction1"; import ES6_Def_AnonFunc1 from \"ES6_Default_AnonFunction1\";
var n1: number = ES6_Def_AnonFunc1(); var n1: number = ES6_Def_AnonFunc1();
var n2: string = 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 o1: number = ES6_Def_NamedFunc1();
var o2: string = 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 q1: number = new ES6_Def_NamedClass1().givesANum();
var q2: string = new ES6_Def_NamedClass1().givesANum(); var q2: string = new ES6_Def_NamedClass1().givesANum();
import doesntExist5 from "ES6_Named1"; import doesntExist5 from \"ES6_Named1\";
import { specifierNumber1 as specifierNumber1_1 } from "ES6_Named1"; import { specifierNumber1 as specifierNumber1_1 } from \"ES6_Named1\";
var r1: number = specifierNumber1_1; var r1: number = specifierNumber1_1;
var r2: string = specifierNumber1_1; var r2: string = specifierNumber1_1;
import { specifierNumber2Renamed } from "ES6_Named1"; import { specifierNumber2Renamed } from \"ES6_Named1\";
var s1: number = specifierNumber2Renamed; var s1: number = specifierNumber2Renamed;
var s2: string = specifierNumber2Renamed; var s2: string = specifierNumber2Renamed;
import { specifierNumber3 as specifierNumber3Renamed } from "ES6_Named1"; import { specifierNumber3 as specifierNumber3Renamed } from \"ES6_Named1\";
var t1: number = specifierNumber3Renamed; var t1: number = specifierNumber3Renamed;
var t2: string = specifierNumber3Renamed; var t2: string = specifierNumber3Renamed;
import { groupedSpecifierNumber1, groupedSpecifierNumber2 } from "ES6_Named1"; import { groupedSpecifierNumber1, groupedSpecifierNumber2 } from \"ES6_Named1\";
var u1: number = groupedSpecifierNumber1; var u1: number = groupedSpecifierNumber1;
var u2: number = groupedSpecifierNumber2; var u2: number = groupedSpecifierNumber2;
var u3: string = groupedSpecifierNumber1; var u3: string = groupedSpecifierNumber1;
var u4: string = groupedSpecifierNumber2; var u4: string = groupedSpecifierNumber2;
import { givesANumber } from "ES6_Named1"; import { givesANumber } from \"ES6_Named1\";
var v1: number = givesANumber(); var v1: number = givesANumber();
var v2: string = givesANumber(); var v2: string = givesANumber();
import { NumberGenerator } from "ES6_Named1"; import { NumberGenerator } from \"ES6_Named1\";
var w1: number = new NumberGenerator().givesANumber(); var w1: number = new NumberGenerator().givesANumber();
var w2: string = 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 x1: number = varDeclNumber1;
var x2: number = varDeclNumber2; var x2: number = varDeclNumber2;
var x3: string = varDeclNumber1; var x3: string = varDeclNumber1;
var x4: string = varDeclNumber2; 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 aa1: number = numberValue4;
var aa2: string = 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 ab1: number = numberValue2_renamed;
var ab2: string = 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 ac1: number = numberValue5;
var ac2: string = numberValue5; var ac2: string = numberValue5;
require("ES6_Default_AnonFunction2").doesntExist; require(\"ES6_Default_AnonFunction2\").doesntExist;
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 ad1: number = ES6_Def_AnonFunc2();
var ad2: string = 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 ae1: number = ES6_Def_NamedFunc2();
var ae2: string = 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 ag1: number = new ES6_Def_NamedClass2().givesANum();
var ag2: string = 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 ah1: number = specifierNumber4;
var ah2: string = specifierNumber4; var ah2: string = specifierNumber4;
var specifierNumber5Renamed = require("ES6_Named2").specifierNumber5Renamed; var specifierNumber5Renamed = require(\"ES6_Named2\").specifierNumber5Renamed;
var ai1: number = specifierNumber5Renamed; var ai1: number = specifierNumber5Renamed;
var ai2: string = specifierNumber5Renamed; var ai2: string = specifierNumber5Renamed;
var groupedSpecifierNumber3 = require("ES6_Named2").groupedSpecifierNumber3; var groupedSpecifierNumber3 = require(\"ES6_Named2\").groupedSpecifierNumber3;
var groupedSpecifierNumber4 = require("ES6_Named2").groupedSpecifierNumber4; var groupedSpecifierNumber4 = require(\"ES6_Named2\").groupedSpecifierNumber4;
var aj1: number = groupedSpecifierNumber3; var aj1: number = groupedSpecifierNumber3;
var aj2: number = groupedSpecifierNumber4; var aj2: number = groupedSpecifierNumber4;
var aj3: string = groupedSpecifierNumber3; var aj3: string = groupedSpecifierNumber3;
var aj4: string = groupedSpecifierNumber4; var aj4: string = groupedSpecifierNumber4;
var givesANumber2 = require("ES6_Named2").givesANumber2; var givesANumber2 = require(\"ES6_Named2\").givesANumber2;
var ak1: number = givesANumber2(); var ak1: number = givesANumber2();
var ak2: string = givesANumber2(); var ak2: string = givesANumber2();
var NumberGenerator2 = require("ES6_Named2").NumberGenerator2; var NumberGenerator2 = require(\"ES6_Named2\").NumberGenerator2;
var al1: number = new NumberGenerator2().givesANumber(); var al1: number = new NumberGenerator2().givesANumber();
var al2: string = new NumberGenerator2().givesANumber(); var al2: string = new NumberGenerator2().givesANumber();
var varDeclNumber3 = require("ES6_Named2").varDeclNumber3; var varDeclNumber3 = require(\"ES6_Named2\").varDeclNumber3;
var varDeclNumber4 = require("ES6_Named2").varDeclNumber4; var varDeclNumber4 = require(\"ES6_Named2\").varDeclNumber4;
var am1: number = varDeclNumber3; var am1: number = varDeclNumber3;
var am2: number = varDeclNumber4; var am2: number = varDeclNumber4;
var am3: string = varDeclNumber3; var am3: string = varDeclNumber3;
var am4: string = varDeclNumber4; var am4: string = varDeclNumber4;
var numberValue6 = require("ES6_ExportFrom_Intermediary2").numberValue1; var numberValue6 = require(\"ES6_ExportFrom_Intermediary2\").numberValue1;
var ap1: number = numberValue6; var ap1: number = numberValue6;
var ap2: string = numberValue6; var ap2: string = numberValue6;
var numberValue2_renamed2 = require( var numberValue2_renamed2 = require(
"ES6_ExportFrom_Intermediary2" \"ES6_ExportFrom_Intermediary2\"
).numberValue2_renamed2; ).numberValue2_renamed2;
var aq1: number = numberValue2_renamed2; var aq1: number = numberValue2_renamed2;
var aq2: string = 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 ar1: number = numberValue7;
var ar2: string = 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 as1: number = defaultNum;
var as2: string = defaultNum; var as2: string = defaultNum;
var as3: string = namedStr; var as3: string = namedStr;
var as4: number = namedStr; var as4: number = namedStr;
import "./SideEffects"; import \"./SideEffects\";
import specifierNumber1 from "ES6_Named1"; import specifierNumber1 from \"ES6_Named1\";
import { specifierNumber } from "ES6_Named1"; import { specifierNumber } from \"ES6_Named1\";
import { numberValue1 as numberValue8, numberValue2 as numberValue9 } from "./ES6_ExportAllFromMulti"; import { numberValue1 as numberValue8, numberValue2 as numberValue9 } from \"./ES6_ExportAllFromMulti\";
var at1: number = numberValue8; var at1: number = numberValue8;
var at2: string = numberValue8; var at2: string = numberValue8;
var at3: number = numberValue9; var at3: number = numberValue9;

View File

@ -1,15 +1,15 @@
exports[`test main.js 1`] = ` exports[`test main.js 1`] = `
"// @flow "// @flow
import declare_module_exports from "declare_module_exports"; import declare_module_exports from \"declare_module_exports\";
(declare_module_exports: number); (declare_module_exports: number);
(declare_module_exports: string); // Error: number ~> string (declare_module_exports: string); // Error: number ~> string
// Error: Has no named export "str"! // Error: Has no named export \"str\"!
import {str} from "declare_m_e_with_other_value_declares"; import {str} from \"declare_m_e_with_other_value_declares\";
import type {str2} from "declare_m_e_with_other_type_declares"; import type {str2} from \"declare_m_e_with_other_type_declares\";
("asdf": str2); (\"asdf\": str2);
(42: str2); // Error: number ~> string (42: str2); // Error: number ~> string
/** /**
@ -17,17 +17,17 @@ import type {str2} from "declare_m_e_with_other_type_declares";
* syntaxes will work. * 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: number);
(DEPRECATED__declare_var_exports: string); // Error: number ~> string (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: number);
(declare_m_e_with_declare_var_e: string); // Error: number ~> string (declare_m_e_with_declare_var_e: string); // Error: number ~> string
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
// Error: number ~> string // Error: number ~> string
// Error: Has no named export "str"! // Error: Has no named export \"str\"!
// Error: number ~> string // Error: number ~> string
/** /**
* \`declare var exports\` is deprecated, so we have a grace period where both * \`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
// 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: number);
(declare_module_exports: string); (declare_module_exports: string);
import { str } from "declare_m_e_with_other_value_declares"; import { str } from \"declare_m_e_with_other_value_declares\";
import type { str2 } from "declare_m_e_with_other_type_declares"; import type { str2 } from \"declare_m_e_with_other_type_declares\";
("asdf": str2); (\"asdf\": str2);
(42: 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: number);
(DEPRECATED__declare_var_exports: string); (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: number);
(declare_m_e_with_declare_var_e: string); (declare_m_e_with_declare_var_e: string);
" "

View File

@ -6,21 +6,21 @@ exports[`test import_declare_type.js 1`] = `
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// == Import Declared Type Alias From Declared Module == // // == Import Declared Type Alias From Declared Module == //
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////
import type {baz} from "ModuleAliasFoo"; import type {baz} from \"ModuleAliasFoo\";
import {foo} from "ModuleAliasFoo"; import {foo} from \"ModuleAliasFoo\";
var k1: baz = 42; 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 var k3: toz = foo(k1); // works
import type {toz} from "ModuleAliasFoo"; import type {toz} from \"ModuleAliasFoo\";
var k4: toz = foo(k1); // works var k4: toz = foo(k1); // works
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////
// == Declared Module with exports prop (issue 880) == // // == Declared Module with exports prop (issue 880) == //
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////
import blah from 'foo'; import blah from \'foo\';
import type { Foo, Bar, Id } from 'foo'; import type { Foo, Bar, Id } from \'foo\';
blah(0, 0); blah(0, 0);
@ -28,7 +28,7 @@ blah(0, 0);
(3 : Bar); // error : number ~> A (3 : Bar); // error : number ~> A
("lol" : Id<number>); // error : string ~> number (\"lol\" : Id<number>); // error : string ~> number
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** /**
* @flow * @flow
@ -45,18 +45,18 @@ blah(0, 0);
// error : {toz : number} ~> string // error : {toz : number} ~> string
// error : number ~> A // error : number ~> A
// error : string ~> number // error : string ~> number
import type { baz } from "ModuleAliasFoo"; import type { baz } from \"ModuleAliasFoo\";
import { foo } from "ModuleAliasFoo"; import { foo } from \"ModuleAliasFoo\";
var k1: baz = 42; var k1: baz = 42;
var k2: baz = "shab"; var k2: baz = \"shab\";
var k3: toz = foo(k1); var k3: toz = foo(k1);
import type { toz } from "ModuleAliasFoo"; import type { toz } from \"ModuleAliasFoo\";
var k4: toz = foo(k1); var k4: toz = foo(k1);
import blah from "foo"; import blah from \"foo\";
import type { Foo, Bar, Id } from "foo"; import type { Foo, Bar, Id } from \"foo\";
blah(0, 0); blah(0, 0);
({ toz: 3 }: Foo); ({ toz: 3 }: Foo);
(3: Bar); (3: Bar);
("lol": Id<number>); (\"lol\": Id<number>);
" "
`; `;

View File

@ -43,11 +43,11 @@ module.exports = A;
`; `;
exports[`test B.js 1`] = ` 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 A = require(\"Demo\");
var z = new A("42").getX(); var z = new A(\"42\").getX();
" "
`; `;

View File

@ -1,41 +1,41 @@
exports[`test A.js 1`] = ` exports[`test A.js 1`] = `
"require('./C'); "require(\'./C\');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
require("./C"); require(\"./C\");
" "
`; `;
exports[`test B.js 1`] = ` exports[`test B.js 1`] = `
"require('./C'); "require(\'./C\');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
require("./C"); require(\"./C\");
" "
`; `;
exports[`test C.js 1`] = ` exports[`test C.js 1`] = `
"require('./D'); "require(\'./D\');
require('./E'); require(\'./E\');
require('./F'); require(\'./F\');
require('./G'); require(\'./G\');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
require("./D"); require(\"./D\");
require("./E"); require(\"./E\");
require("./F"); require(\"./F\");
require("./G"); require(\"./G\");
" "
`; `;
exports[`test D.js 1`] = ` exports[`test D.js 1`] = `
"require('./I'); "require(\'./I\');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
require("./I"); require(\"./I\");
" "
`; `;
exports[`test E.js 1`] = ` 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`] = ` 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`] = ` exports[`test I.js 1`] = `
"require('./A'); "require(\'./A\');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
require("./A"); require(\"./A\");
" "
`; `;

View File

@ -2,12 +2,12 @@ exports[`test license_with_flow.js 1`] = `
"/* Copyright example */ "/* Copyright example */
/* @flow */ /* @flow */
("": void); // error (\"\": void); // error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* Copyright example */ /* Copyright example */
/* @flow */ /* @flow */
// error // error
("": void); (\"\": void);
" "
`; `;
@ -94,36 +94,36 @@ exports[`test multiple_providesModule_2.js 1`] = `
`; `;
exports[`test use_strict_with_flow.js 1`] = ` exports[`test use_strict_with_flow.js 1`] = `
""use strict"; "\"use strict\";
/* @flow */ /* @flow */
("": void); // error (\"\": void); // error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* @flow */ /* @flow */
// error // error
"use strict"; \"use strict\";
("": void); (\"\": void);
" "
`; `;
exports[`test with_flow.js 1`] = ` exports[`test with_flow.js 1`] = `
"/* @flow */ "/* @flow */
("": void); // error (\"\": void); // error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* @flow */ /* @flow */
// error // error
("": void); (\"\": void);
" "
`; `;
exports[`test without_flow.js 1`] = ` exports[`test without_flow.js 1`] = `
"/* some other comment */ "/* some other comment */
("": void); // no error (\"\": void); // no error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* some other comment */ /* some other comment */
// no error // no error
("": void); (\"\": void);
" "
`; `;

View File

@ -9,7 +9,7 @@ let tests = [
// moveTo // moveTo
function(ctx: CanvasRenderingContext2D) { 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); ctx.fillRect(0, 0, 200, 100);
}, },
function(ctx: CanvasRenderingContext2D) { function(ctx: CanvasRenderingContext2D) {
ctx.moveTo("0", "1"); ctx.moveTo(\"0\", \"1\");
} }
]; ];
" "
@ -34,8 +34,8 @@ exports[`test CustomEvent.js 1`] = `
let tests = [ let tests = [
// CustomEvent // CustomEvent
function(document: Document) { function(document: Document) {
const event = document.createEvent('CustomEvent'); const event = document.createEvent(\'CustomEvent\');
event.initCustomEvent('butts', true, false, { nice: 42 }); event.initCustomEvent(\'butts\', true, false, { nice: 42 });
} }
]; ];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -43,8 +43,8 @@ let tests = [
// CustomEvent // CustomEvent
let tests = [ let tests = [
function(document: Document) { function(document: Document) {
const event = document.createEvent("CustomEvent"); const event = document.createEvent(\"CustomEvent\");
event.initCustomEvent("butts", true, false, { nice: 42 }); event.initCustomEvent(\"butts\", true, false, { nice: 42 });
} }
]; ];
" "
@ -56,10 +56,10 @@ exports[`test Document.js 1`] = `
let tests = [ let tests = [
// createElement // createElement
function(document: Document) { function(document: Document) {
(document.createElement('canvas'): HTMLCanvasElement); (document.createElement(\'canvas\'): HTMLCanvasElement);
(document.createElement('link'): HTMLLinkElement); (document.createElement(\'link\'): HTMLLinkElement);
(document.createElement('option'): HTMLOptionElement); (document.createElement(\'option\'): HTMLOptionElement);
(document.createElement('select'): HTMLSelectElement); (document.createElement(\'select\'): HTMLSelectElement);
} }
]; ];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -67,10 +67,10 @@ let tests = [
// createElement // createElement
let tests = [ let tests = [
function(document: Document) { function(document: Document) {
(document.createElement("canvas"): HTMLCanvasElement); (document.createElement(\"canvas\"): HTMLCanvasElement);
(document.createElement("link"): HTMLLinkElement); (document.createElement(\"link\"): HTMLLinkElement);
(document.createElement("option"): HTMLOptionElement); (document.createElement(\"option\"): HTMLOptionElement);
(document.createElement("select"): HTMLSelectElement); (document.createElement(\"select\"): HTMLSelectElement);
} }
]; ];
" "
@ -85,13 +85,13 @@ let tests = [
element.scrollIntoView(); element.scrollIntoView();
element.scrollIntoView(false); element.scrollIntoView(false);
element.scrollIntoView({}); element.scrollIntoView({});
element.scrollIntoView({ behavior: 'smooth', block: 'end' }); element.scrollIntoView({ behavior: \'smooth\', block: \'end\' });
element.scrollIntoView({ block: 'end' }); element.scrollIntoView({ block: \'end\' });
element.scrollIntoView({ behavior: 'smooth' }); element.scrollIntoView({ behavior: \'smooth\' });
// fails // fails
element.scrollIntoView({ behavior: 'invalid' }); element.scrollIntoView({ behavior: \'invalid\' });
element.scrollIntoView({ block: 'invalid' }); element.scrollIntoView({ block: \'invalid\' });
element.scrollIntoView(1); element.scrollIntoView(1);
} }
]; ];
@ -104,11 +104,11 @@ let tests = [
element.scrollIntoView(); element.scrollIntoView();
element.scrollIntoView(false); element.scrollIntoView(false);
element.scrollIntoView({}); element.scrollIntoView({});
element.scrollIntoView({ behavior: "smooth", block: "end" }); element.scrollIntoView({ behavior: \"smooth\", block: \"end\" });
element.scrollIntoView({ block: "end" }); element.scrollIntoView({ block: \"end\" });
element.scrollIntoView({ behavior: "smooth" }); element.scrollIntoView({ behavior: \"smooth\" });
element.scrollIntoView({ behavior: "invalid" }); element.scrollIntoView({ behavior: \"invalid\" });
element.scrollIntoView({ block: "invalid" }); element.scrollIntoView({ block: \"invalid\" });
element.scrollIntoView(1); element.scrollIntoView(1);
} }
]; ];
@ -121,7 +121,7 @@ exports[`test HTMLCanvasElement.js 1`] = `
let tests = [ let tests = [
// getContext // getContext
function(el: HTMLCanvasElement) { function(el: HTMLCanvasElement) {
(el.getContext('2d'): ?CanvasRenderingContext2D); (el.getContext(\'2d\'): ?CanvasRenderingContext2D);
} }
]; ];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -129,7 +129,7 @@ let tests = [
// getContext // getContext
let tests = [ let tests = [
function(el: HTMLCanvasElement) { function(el: HTMLCanvasElement) {
(el.getContext("2d"): ?CanvasRenderingContext2D); (el.getContext(\"2d\"): ?CanvasRenderingContext2D);
} }
]; ];
" "
@ -144,13 +144,13 @@ let tests = [
element.scrollIntoView(); element.scrollIntoView();
element.scrollIntoView(false); element.scrollIntoView(false);
element.scrollIntoView({}); element.scrollIntoView({});
element.scrollIntoView({ behavior: 'smooth', block: 'end' }); element.scrollIntoView({ behavior: \'smooth\', block: \'end\' });
element.scrollIntoView({ block: 'end' }); element.scrollIntoView({ block: \'end\' });
element.scrollIntoView({ behavior: 'smooth' }); element.scrollIntoView({ behavior: \'smooth\' });
// fails // fails
element.scrollIntoView({ behavior: 'invalid' }); element.scrollIntoView({ behavior: \'invalid\' });
element.scrollIntoView({ block: 'invalid' }); element.scrollIntoView({ block: \'invalid\' });
element.scrollIntoView(1); element.scrollIntoView(1);
} }
]; ];
@ -163,11 +163,11 @@ let tests = [
element.scrollIntoView(); element.scrollIntoView();
element.scrollIntoView(false); element.scrollIntoView(false);
element.scrollIntoView({}); element.scrollIntoView({});
element.scrollIntoView({ behavior: "smooth", block: "end" }); element.scrollIntoView({ behavior: \"smooth\", block: \"end\" });
element.scrollIntoView({ block: "end" }); element.scrollIntoView({ block: \"end\" });
element.scrollIntoView({ behavior: "smooth" }); element.scrollIntoView({ behavior: \"smooth\" });
element.scrollIntoView({ behavior: "invalid" }); element.scrollIntoView({ behavior: \"invalid\" });
element.scrollIntoView({ block: "invalid" }); element.scrollIntoView({ block: \"invalid\" });
element.scrollIntoView(1); element.scrollIntoView(1);
} }
]; ];
@ -180,11 +180,11 @@ exports[`test HTMLInputElement.js 1`] = `
let tests = [ let tests = [
// setRangeText // setRangeText
function(el: HTMLInputElement) { function(el: HTMLInputElement) {
el.setRangeText('foo'); el.setRangeText(\'foo\');
el.setRangeText('foo', 123); // end is required el.setRangeText(\'foo\', 123); // end is required
el.setRangeText('foo', 123, 234); el.setRangeText(\'foo\', 123, 234);
el.setRangeText('foo', 123, 234, 'select'); el.setRangeText(\'foo\', 123, 234, \'select\');
el.setRangeText('foo', 123, 234, 'bogus'); // invalid value el.setRangeText(\'foo\', 123, 234, \'bogus\'); // invalid value
} }
]; ];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -194,11 +194,11 @@ let tests = [
// invalid value // invalid value
let tests = [ let tests = [
function(el: HTMLInputElement) { function(el: HTMLInputElement) {
el.setRangeText("foo"); el.setRangeText(\"foo\");
el.setRangeText("foo", 123); el.setRangeText(\"foo\", 123);
el.setRangeText("foo", 123, 234); el.setRangeText(\"foo\", 123, 234);
el.setRangeText("foo", 123, 234, "select"); el.setRangeText(\"foo\", 123, 234, \"select\");
el.setRangeText("foo", 123, 234, "bogus"); el.setRangeText(\"foo\", 123, 234, \"bogus\");
} }
]; ];
" "
@ -207,9 +207,9 @@ let tests = [
exports[`test URL.js 1`] = ` exports[`test URL.js 1`] = `
"/* @flow */ "/* @flow */
const a = new URL('http://flowtype.org/'); // correct const a = new URL(\'http://flowtype.org/\'); // correct
const b = new URL('/docs', a); // correct const b = new URL(\'/docs\', a); // correct
const c = new URL('/docs', 'http://flowtype.org/'); // correct const c = new URL(\'/docs\', \'http://flowtype.org/\'); // correct
const d: URLSearchParams = c.searchParams; // correct const d: URLSearchParams = c.searchParams; // correct
const e: string = c.path; // not correct const e: string = c.path; // not correct
@ -244,9 +244,9 @@ const r: string = c.username; // correct
// correct // correct
// correct // correct
// correct // correct
const a = new URL("http://flowtype.org/"); const a = new URL(\"http://flowtype.org/\");
const b = new URL("/docs", a); const b = new URL(\"/docs\", a);
const c = new URL("/docs", "http://flowtype.org/"); const c = new URL(\"/docs\", \"http://flowtype.org/\");
const d: URLSearchParams = c.searchParams; const d: URLSearchParams = c.searchParams;
const e: string = c.path; const e: string = c.path;
const f: string = c.pathname; const f: string = c.pathname;
@ -273,15 +273,15 @@ let tests = [
// attachEvent // attachEvent
function() { function() {
let target = new EventTarget(); let target = new EventTarget();
(target.attachEvent('foo', listener): void); // invalid, may be undefined (target.attachEvent(\'foo\', listener): void); // invalid, may be undefined
(target.attachEvent && target.attachEvent('foo', listener): void); // valid (target.attachEvent && target.attachEvent(\'foo\', listener): void); // valid
}, },
// detachEvent // detachEvent
function() { function() {
let target = new EventTarget(); let target = new EventTarget();
(target.detachEvent('foo', listener): void); // invalid, may be undefined (target.detachEvent(\'foo\', listener): void); // invalid, may be undefined
(target.detachEvent && target.detachEvent('foo', listener): void); // valid (target.detachEvent && target.detachEvent(\'foo\', listener): void); // valid
}, },
function() { function() {
@ -304,13 +304,13 @@ let listener: EventListener = function(event: Event): void {
let tests = [ let tests = [
function() { function() {
let target = new EventTarget(); let target = new EventTarget();
(target.attachEvent("foo", listener): void); (target.attachEvent(\"foo\", listener): void);
(target.attachEvent && target.attachEvent("foo", listener): void); (target.attachEvent && target.attachEvent(\"foo\", listener): void);
}, },
function() { function() {
let target = new EventTarget(); let target = new EventTarget();
(target.detachEvent("foo", listener): void); (target.detachEvent(\"foo\", listener): void);
(target.detachEvent && target.detachEvent("foo", listener): void); (target.detachEvent && target.detachEvent(\"foo\", listener): void);
}, },
function() { function() {
window.onmessage = (event: MessageEvent) => { window.onmessage = (event: MessageEvent) => {
@ -330,7 +330,7 @@ let tests = [
let path = new Path2D(); let path = new Path2D();
(path.arcTo(0, 0, 0, 0, 10): void); // valid (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); // 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(); let path = new Path2D();
(path.arcTo(0, 0, 0, 0, 10): void); (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); (path.arcTo(0, 0, 0, 0, 10, \"20\", 5): void);
} }
]; ];
" "
@ -356,7 +356,7 @@ exports[`test registerElement.js 1`] = `
let tests = [ let tests = [
// should work with Object.create() // should work with Object.create()
function() { function() {
document.registerElement('custom-element', { document.registerElement(\'custom-element\', {
prototype: Object.create(HTMLElement.prototype, { prototype: Object.create(HTMLElement.prototype, {
createdCallback: { value: function createdCallback () { createdCallback: { value: function createdCallback () {
}}, }},
@ -378,7 +378,7 @@ let tests = [
}, },
// or with Object.assign() // or with Object.assign()
function() { function() {
document.registerElement('custom-element', { document.registerElement(\'custom-element\', {
prototype: Object.assign(Object.create(HTMLElement.prototype), { prototype: Object.assign(Object.create(HTMLElement.prototype), {
createdCallback () { createdCallback () {
}, },
@ -398,7 +398,7 @@ let tests = [
}, },
// should complain about invalid callback parameters // should complain about invalid callback parameters
function() { function() {
document.registerElement('custom-element', { document.registerElement(\'custom-element\', {
prototype: { prototype: {
attributeChangedCallback( attributeChangedCallback(
localName: string, localName: string,
@ -419,7 +419,7 @@ let tests = [
let tests = [ let tests = [
function() { function() {
document.registerElement( document.registerElement(
"custom-element", \"custom-element\",
{ {
prototype: Object.create( prototype: Object.create(
HTMLElement.prototype, HTMLElement.prototype,
@ -456,7 +456,7 @@ let tests = [
}, },
function() { function() {
document.registerElement( document.registerElement(
"custom-element", \"custom-element\",
{ {
prototype: Object.assign( prototype: Object.assign(
Object.create(HTMLElement.prototype), Object.create(HTMLElement.prototype),
@ -483,7 +483,7 @@ let tests = [
}, },
function() { function() {
document.registerElement( document.registerElement(
"custom-element", \"custom-element\",
{ {
prototype: { prototype: {
attributeChangedCallback(localName: string, attributeChangedCallback(localName: string,
@ -683,16 +683,16 @@ let tests = [
// NodeFilterInterface // NodeFilterInterface
function() { function() {
document.createNodeIterator(document.body, -1, node => NodeFilter.FILTER_ACCEPT); // valid 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 => 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 document.createNodeIterator(document.body, -1, {}); // invalid
}, },
function() { function() {
document.createTreeWalker(document.body, -1, node => NodeFilter.FILTER_ACCEPT); // valid 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 => 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 document.createTreeWalker(document.body, -1, {}); // invalid
}, },
]; ];
@ -897,7 +897,7 @@ let tests = [
-1, -1,
node => NodeFilter.FILTER_ACCEPT node => NodeFilter.FILTER_ACCEPT
); );
document.createNodeIterator(document.body, -1, node => "accept"); document.createNodeIterator(document.body, -1, node => \"accept\");
document.createNodeIterator( document.createNodeIterator(
document.body, document.body,
-1, -1,
@ -906,7 +906,7 @@ let tests = [
document.createNodeIterator( document.createNodeIterator(
document.body, document.body,
-1, -1,
{ accept: node => "accept" } { accept: node => \"accept\" }
); );
document.createNodeIterator(document.body, -1, {}); document.createNodeIterator(document.body, -1, {});
}, },
@ -916,13 +916,13 @@ let tests = [
-1, -1,
node => NodeFilter.FILTER_ACCEPT node => NodeFilter.FILTER_ACCEPT
); );
document.createTreeWalker(document.body, -1, node => "accept"); document.createTreeWalker(document.body, -1, node => \"accept\");
document.createTreeWalker( document.createTreeWalker(
document.body, document.body,
-1, -1,
{ accept: node => NodeFilter.FILTER_ACCEPT } { 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, {}); document.createTreeWalker(document.body, -1, {});
} }
]; ];

View File

@ -17,7 +17,7 @@ module.exports = num;
exports[`test test.js 1`] = ` exports[`test test.js 1`] = `
"// @flow "// @flow
var num = require('./import'); var num = require(\'./import\');
function foo(x) { } function foo(x) { }
foo(0); foo(0);
var a:string = num; var a:string = num;
@ -40,7 +40,7 @@ const idxResult = idx(obj, obj => obj.a.b.c.d);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
// test deduping of inferred types // test deduping of inferred types
var num = require("./import"); var num = require(\"./import\");
function foo(x) { function foo(x) {
} }

View File

@ -10,7 +10,7 @@ function tag(strings,...values) {
var s2 = tag \`l\${42}r\`; var s2 = tag \`l\${42}r\`;
function tag2(strings,...values) { 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\`; var s3 = tag2 \`la la la\`;
@ -29,7 +29,7 @@ function tag(strings, ...values) {
} }
var s2 = tag\`l\${42}r\`; var s2 = tag\`l\${42}r\`;
function tag2(strings, ...values) { function tag2(strings, ...values) {
return { foo: "" }; return { foo: \"\" };
} }
var s3 = tag2\`la la la\`; var s3 = tag2\`la la la\`;
(s3.foo: number); (s3.foo: number);

View File

@ -6,22 +6,22 @@ function isActive(ad: {state: $Keys<{
ACTIVE: string; ACTIVE: string;
DELETED: string; DELETED: string;
}>}): boolean { }>}): boolean {
return ad.state === 'ACTIVE'; return ad.state === \'ACTIVE\';
}; };
isActive({state: 'PAUSE'}); isActive({state: \'PAUSE\'});
var MyStates = { var MyStates = {
PAUSED: 'PAUSED', PAUSED: \'PAUSED\',
ACTIVE: 'ACTIVE', ACTIVE: \'ACTIVE\',
DELETED: 'DELETED', DELETED: \'DELETED\',
}; };
function isActive2(ad: {state: $Keys<typeof MyStates>}): boolean { function isActive2(ad: {state: $Keys<typeof MyStates>}): boolean {
return ad.state === MyStates.ACTIVE; return ad.state === MyStates.ACTIVE;
}; };
isActive2({state: 'PAUSE'}); isActive2({state: \'PAUSE\'});
type Keys = $Keys<{ x: any, y: any }>; type Keys = $Keys<{ x: any, y: any }>;
type Union = "x" | "y" type Union = \"x\" | \"y\"
function keys2union(s: Keys): Union { return s; } // ok function keys2union(s: Keys): Union { return s; } // ok
function union2keys(s: Union): Keys { 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( function isActive(
ad: { state: $Keys<{ PAUSED: string; ACTIVE: string; DELETED: string }> } ad: { state: $Keys<{ PAUSED: string; ACTIVE: string; DELETED: string }> }
): boolean { ): boolean {
return ad.state === "ACTIVE"; return ad.state === \"ACTIVE\";
} }
isActive({ state: "PAUSE" }); isActive({ state: \"PAUSE\" });
var MyStates = { PAUSED: "PAUSED", ACTIVE: "ACTIVE", DELETED: "DELETED" }; var MyStates = { PAUSED: \"PAUSED\", ACTIVE: \"ACTIVE\", DELETED: \"DELETED\" };
function isActive2(ad: { state: $Keys<typeof MyStates> }): boolean { function isActive2(ad: { state: $Keys<typeof MyStates> }): boolean {
return ad.state === MyStates.ACTIVE; return ad.state === MyStates.ACTIVE;
} }
isActive2({ state: "PAUSE" }); isActive2({ state: \"PAUSE\" });
type Keys = $Keys<{ x: any; y: any }>; type Keys = $Keys<{ x: any; y: any }>;
type Union = "x" | "y"; type Union = \"x\" | \"y\";
function keys2union(s: Keys): Union { function keys2union(s: Keys): Union {
return s; return s;
} }

View File

@ -2,11 +2,11 @@ exports[`test equals.js 1`] = `
"/* @flow */ "/* @flow */
(1 == 1); (1 == 1);
("foo" == "bar"); (\"foo\" == \"bar\");
(1 == null); (1 == null);
(null == 1); (null == 1);
(1 == ""); // error (1 == \"\"); // error
("" == 1); // error (\"\" == 1); // error
var x = (null : ?number); var x = (null : ?number);
(x == 1); (x == 1);
@ -16,11 +16,11 @@ var x = (null : ?number);
// error // error
// error // error
1 == 1; 1 == 1;
"foo" == "bar"; \"foo\" == \"bar\";
1 == null; 1 == null;
null == 1; null == 1;
1 == ""; 1 == \"\";
"" == 1; \"\" == 1;
var x = (null: ?number); var x = (null: ?number);
x == 1; x == 1;
1 == x; 1 == x;

View File

@ -1,7 +1,7 @@
exports[`test errors.js 1`] = ` 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) {
} }
" "

View File

@ -303,11 +303,11 @@ exports[`test ES6_DefaultAndNamed.js 1`] = `
"/* @flow */ "/* @flow */
export default 42; export default 42;
export var str = 'asdf'; export var str = \'asdf\';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* @flow */ /* @flow */
export default 42 export default 42
export var str = "asdf"; export var str = \"asdf\";
" "
`; `;
@ -317,13 +317,13 @@ exports[`test ES6_ExportAllFrom_Intermediary1.js 1`] = `
* @flow * @flow
*/ */
export * from "ES6_ExportAllFrom_Source1"; export * from \"ES6_ExportAllFrom_Source1\";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** /**
* @providesModule ES6_ExportAllFrom_Intermediary1 * @providesModule ES6_ExportAllFrom_Intermediary1
* @flow * @flow
*/ */
export * from "ES6_ExportAllFrom_Source1" export * from \"ES6_ExportAllFrom_Source1\"
" "
`; `;
@ -333,13 +333,13 @@ exports[`test ES6_ExportAllFrom_Intermediary2.js 1`] = `
* @flow * @flow
*/ */
export * from "ES6_ExportAllFrom_Source2"; export * from \"ES6_ExportAllFrom_Source2\";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** /**
* @providesModule ES6_ExportAllFrom_Intermediary2 * @providesModule ES6_ExportAllFrom_Intermediary2
* @flow * @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`] = ` exports[`test ES6_ExportAllFromMulti.js 1`] = `
"// @flow "// @flow
export * from "./ES6_ExportAllFrom_Source1"; export * from \"./ES6_ExportAllFrom_Source1\";
export * from "./ES6_ExportAllFrom_Source2"; export * from \"./ES6_ExportAllFrom_Source2\";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
export * from "./ES6_ExportAllFrom_Source1" export * from \"./ES6_ExportAllFrom_Source1\"
export * from "./ES6_ExportAllFrom_Source2" export * from \"./ES6_ExportAllFrom_Source2\"
" "
`; `;
@ -396,13 +396,13 @@ exports[`test ES6_ExportFrom_Intermediary1.js 1`] = `
export { export {
numberValue1, numberValue1,
numberValue2 as numberValue2_renamed numberValue2 as numberValue2_renamed
} from "ES6_ExportFrom_Source1"; } from \"ES6_ExportFrom_Source1\";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** /**
* @providesModule ES6_ExportFrom_Intermediary1 * @providesModule ES6_ExportFrom_Intermediary1
* @flow * @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 { export {
numberValue1, numberValue1,
numberValue2 as numberValue2_renamed2 numberValue2 as numberValue2_renamed2
} from "ES6_ExportFrom_Source2"; } from \"ES6_ExportFrom_Source2\";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** /**
* @providesModule ES6_ExportFrom_Intermediary2 * @providesModule ES6_ExportFrom_Intermediary2
* @flow * @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.numberValue2 = 42;
exports.numberValue3 = 42; exports.numberValue3 = 42;
exports.numberValue4 = 42; exports.numberValue4 = 42;
exports.stringValue = "str"; exports.stringValue = \"str\";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** /**
* @providesModule A * @providesModule A
@ -585,7 +585,7 @@ exports.numberValue1 = 42;
exports.numberValue2 = 42; exports.numberValue2 = 42;
exports.numberValue3 = 42; exports.numberValue3 = 42;
exports.numberValue4 = 42; exports.numberValue4 = 42;
exports.stringValue = "str"; exports.stringValue = \"str\";
" "
`; `;
@ -662,44 +662,44 @@ exports[`test es6modules.js 1`] = `
// ===================== // // ===================== //
// @providesModule // @providesModule
import * as DefaultA from "A"; import * as DefaultA from \"A\";
var a1: number = DefaultA.numberValue1; var a1: number = DefaultA.numberValue1;
var a2: string = DefaultA.numberValue1; // Error: number ~> string var a2: string = DefaultA.numberValue1; // Error: number ~> string
// File path // File path
import * as DefaultB from "./B"; import * as DefaultB from \"./B\";
var b1: number = DefaultB.numberValue; var b1: number = DefaultB.numberValue;
var b2: string = DefaultB.numberValue; // Error: number ~> string var b2: string = DefaultB.numberValue; // Error: number ~> string
// C.js exists, but not as a providesModule // 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 // @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 == // // == 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 c1: number = numberValue1;
var c2: string = numberValue1; // Error: number ~> string 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 d1: number = numVal1;
var d2: string = numVal1; // Error: number ~> string 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 e1: number = CJS_Clobb_Lit.numberValue3;
var e2: string = CJS_Clobb_Lit.numberValue3; // Error: number ~> string 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 f1: number = CJS_Clobb_Lit_NS.numberValue4;
var f2: number = CJS_Clobb_Lit_NS.default.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 f3: string = CJS_Clobb_Lit_NS.numberValue4; // Error: number ~> string
var f4: string = CJS_Clobb_Lit_NS.default.numberValue5; // 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 == // // == 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 // The following import should error because class statics are not turned into
// named exports for now. This avoids complexities with polymorphic static // named exports for now. This avoids complexities with polymorphic static
// members (where the polymophism is defined on the class itself rather than the // members (where the polymophism is defined on the class itself rather than the
// method). // 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();
new CJS_Clobb_Class().doesntExist; // Error: Class has no \`doesntExist\` property new CJS_Clobb_Class().doesntExist; // Error: Class has no \`doesntExist\` property
var h1: number = CJS_Clobb_Class.staticNumber2(); 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 h3: number = new CJS_Clobb_Class().instNumber1();
var h4: string = new CJS_Clobb_Class().instNumber1(); // Error: number ~> string var h4: string = new CJS_Clobb_Class().instNumber1(); // Error: number ~> string
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(); // Error: Namespace object isn't constructable 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 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 i2: number = new CJS_Clobb_Class_NS.default().instNumber2();
var i3: string = new CJS_Clobb_Class_NS.default().instNumber2(); // Error: number ~> string 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 == // // == 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 j1: number = numberValue2;
var j2: string = numberValue2; // Error: number ~> string 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 k1: number = numVal3;
var k2: string = numVal3; // Error: number ~> string 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 l1: number = CJS_Named.numberValue1;
var l2: string = CJS_Named.numberValue1; // Error: number ~> string 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 m1: number = CJS_Named_NS.numberValue4;
var m2: string = CJS_Named_NS.default.numberValue4; // Error: CommonJS_Named has no default export 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 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 == // // == 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 n1: number = ES6_Def_AnonFunc1();
var n2: string = ES6_Def_AnonFunc1(); // Error: number ~> string 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 o1: number = ES6_Def_NamedFunc1();
var o2: string = ES6_Def_NamedFunc1(); // Error: number ~> string 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 p1: number = new ES6_Def_AnonClass1().givesANum();
var p2: string = new ES6_Def_AnonClass1().givesANum(); // Error: number ~> string 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 q1: number = new ES6_Def_NamedClass1().givesANum();
var q2: string = new ES6_Def_NamedClass1().givesANum(); // Error: number ~> string 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 == // // == 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 r1: number = specifierNumber1_1;
var r2: string = specifierNumber1_1; // Error: number ~> string var r2: string = specifierNumber1_1; // Error: number ~> string
import {specifierNumber2Renamed} from "ES6_Named1"; import {specifierNumber2Renamed} from \"ES6_Named1\";
var s1: number = specifierNumber2Renamed; var s1: number = specifierNumber2Renamed;
var s2: string = specifierNumber2Renamed; // Error: number ~> string 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 t1: number = specifierNumber3Renamed;
var t2: string = specifierNumber3Renamed; // Error: number ~> string var t2: string = specifierNumber3Renamed; // Error: number ~> string
import {groupedSpecifierNumber1, groupedSpecifierNumber2} from "ES6_Named1"; import {groupedSpecifierNumber1, groupedSpecifierNumber2} from \"ES6_Named1\";
var u1: number = groupedSpecifierNumber1; var u1: number = groupedSpecifierNumber1;
var u2: number = groupedSpecifierNumber2; var u2: number = groupedSpecifierNumber2;
var u3: string = groupedSpecifierNumber1; // Error: number ~> string var u3: string = groupedSpecifierNumber1; // Error: number ~> string
var u4: string = groupedSpecifierNumber2; // 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 v1: number = givesANumber();
var v2: string = givesANumber(); // Error: number ~> string var v2: string = givesANumber(); // Error: number ~> string
import {NumberGenerator} from "ES6_Named1"; import {NumberGenerator} from \"ES6_Named1\";
var w1: number = new NumberGenerator().givesANumber(); var w1: number = new NumberGenerator().givesANumber();
var w2: string = new NumberGenerator().givesANumber(); // Error: number ~> string 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 x1: number = varDeclNumber1;
var x2: number = varDeclNumber2; var x2: number = varDeclNumber2;
var x3: string = varDeclNumber1; // Error: number ~> string var x3: string = varDeclNumber1; // Error: number ~> string
var x4: string = varDeclNumber2; // 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 y1: number = destructuredObjNumber;
var y2: string = destructuredObjNumber; // Error: number ~> string var y2: string = destructuredObjNumber; // Error: number ~> string
import {destructuredArrNumber} from "ES6_Named1"; import {destructuredArrNumber} from \"ES6_Named1\";
var z1: number = destructuredArrNumber; var z1: number = destructuredArrNumber;
var z2: string = destructuredArrNumber; // Error: number ~> string 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 aa1: number = numberValue4;
var aa2: string = numberValue4; // Error: number ~> string 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 ab1: number = numberValue2_renamed;
var ab2: string = numberValue2_renamed; // Error: number ~> string 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 ac1: number = numberValue5;
var ac2: string = numberValue5; // Error: number ~> string var ac2: string = numberValue5; // Error: number ~> string
@ -837,21 +837,21 @@ var ac2: string = numberValue5; // Error: number ~> string
// == ES6 Default -> CommonJS == // // == 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 ad1: number = ES6_Def_AnonFunc2();
var ad2: string = ES6_Def_AnonFunc2(); // Error: number ~> string 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 ae1: number = ES6_Def_NamedFunc2();
var ae2: string = ES6_Def_NamedFunc2(); // Error: number ~> string 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 af1: number = new ES6_Def_AnonClass2().givesANum();
var af2: string = new ES6_Def_AnonClass2().givesANum(); // Error: number ~> string 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 ag1: number = new ES6_Def_NamedClass2().givesANum();
var ag2: string = new ES6_Def_NamedClass2().givesANum(); // Error: number ~> string 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 == // // == ES6 Named -> CommonJS == //
///////////////////////////////// /////////////////////////////////
var specifierNumber4 = require("ES6_Named2").specifierNumber4; var specifierNumber4 = require(\"ES6_Named2\").specifierNumber4;
var ah1: number = specifierNumber4; var ah1: number = specifierNumber4;
var ah2: string = specifierNumber4; // Error: number ~> string var ah2: string = specifierNumber4; // Error: number ~> string
var specifierNumber5Renamed = require("ES6_Named2").specifierNumber5Renamed; var specifierNumber5Renamed = require(\"ES6_Named2\").specifierNumber5Renamed;
var ai1: number = specifierNumber5Renamed; var ai1: number = specifierNumber5Renamed;
var ai2: string = specifierNumber5Renamed; // Error: number ~> string var ai2: string = specifierNumber5Renamed; // Error: number ~> string
var groupedSpecifierNumber3 = require("ES6_Named2").groupedSpecifierNumber3; var groupedSpecifierNumber3 = require(\"ES6_Named2\").groupedSpecifierNumber3;
var groupedSpecifierNumber4 = require("ES6_Named2").groupedSpecifierNumber4; var groupedSpecifierNumber4 = require(\"ES6_Named2\").groupedSpecifierNumber4;
var aj1: number = groupedSpecifierNumber3; var aj1: number = groupedSpecifierNumber3;
var aj2: number = groupedSpecifierNumber4; var aj2: number = groupedSpecifierNumber4;
var aj3: string = groupedSpecifierNumber3; // Error: number ~> string var aj3: string = groupedSpecifierNumber3; // Error: number ~> string
var aj4: string = groupedSpecifierNumber4; // 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 ak1: number = givesANumber2();
var ak2: string = givesANumber2(); // Error: number ~> string 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 al1: number = new NumberGenerator2().givesANumber();
var al2: string = new NumberGenerator2().givesANumber(); // Error: number ~> string var al2: string = new NumberGenerator2().givesANumber(); // Error: number ~> string
var varDeclNumber3 = require("ES6_Named2").varDeclNumber3; var varDeclNumber3 = require(\"ES6_Named2\").varDeclNumber3;
var varDeclNumber4 = require("ES6_Named2").varDeclNumber4; var varDeclNumber4 = require(\"ES6_Named2\").varDeclNumber4;
var am1: number = varDeclNumber3; var am1: number = varDeclNumber3;
var am2: number = varDeclNumber4; var am2: number = varDeclNumber4;
var am3: string = varDeclNumber3; // Error: number ~> string var am3: string = varDeclNumber3; // Error: number ~> string
var am4: string = varDeclNumber4; // 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 an1: number = destructuredObjNumber2;
var an2: string = destructuredObjNumber2; // Error: number ~> string var an2: string = destructuredObjNumber2; // Error: number ~> string
var destructuredArrNumber2 = require("ES6_Named2").destructuredArrNumber2; var destructuredArrNumber2 = require(\"ES6_Named2\").destructuredArrNumber2;
var ao1: number = destructuredArrNumber2; var ao1: number = destructuredArrNumber2;
var ao2: string = destructuredArrNumber2; // Error: number ~> string 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 ap1: number = numberValue6;
var ap2: string = numberValue6; // Error: number ~> string 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 aq1: number = numberValue2_renamed2;
var aq2: string = numberValue2_renamed2; // Error: number ~> string 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 ar1: number = numberValue7;
var ar2: string = numberValue7; // Error: number ~> string 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== // // == 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 as1: number = defaultNum;
var as2: string = defaultNum; // Error: number ~> string var as2: string = defaultNum; // Error: number ~> string
@ -925,13 +925,13 @@ var as4: number = namedStr; // Error: string ~> number
// == Side-effect only ES6 imports == // // == Side-effect only ES6 imports == //
//////////////////////////////////////// ////////////////////////////////////////
import "./SideEffects"; import \"./SideEffects\";
////////////////////////////////////////////// //////////////////////////////////////////////
// == Suggest export name on likely typo == // // == Suggest export name on likely typo == //
////////////////////////////////////////////// //////////////////////////////////////////////
import specifierNumber1 from "ES6_Named1"; // Error: Did you mean \`import {specifierNumber1} from ...\`? import specifierNumber1 from \"ES6_Named1\"; // Error: Did you mean \`import {specifierNumber1} from ...\`?
import {specifierNumber} from "ES6_Named1"; // Error: Did you mean \`specifierNumber1\`? import {specifierNumber} from \"ES6_Named1\"; // Error: Did you mean \`specifierNumber1\`?
/////////////////////////////////////////////////// ///////////////////////////////////////////////////
// == Multi \`export *\` should combine exports == // // == Multi \`export *\` should combine exports == //
@ -939,7 +939,7 @@ import {specifierNumber} from "ES6_Named1"; // Error: Did you mean \`specifierNu
import { import {
numberValue1 as numberValue8, numberValue1 as numberValue8,
numberValue2 as numberValue9 numberValue2 as numberValue9
} from "./ES6_ExportAllFromMulti"; } from \"./ES6_ExportAllFromMulti\";
var at1: number = numberValue8; var at1: number = numberValue8;
var at2: string = numberValue8; // Error: number ~> string 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 == // // == 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 */ /* @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: number ~> string
// Error: number ~> string // Error: number ~> string
// Error: doesntExist isn't a property // Error: doesntExist isn\'t a property
// Error: No 'default' property on the exported obj // Error: No \'default\' property on the exported obj
// Error: number ~> string // Error: number ~> string
// 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: Class has no \`doesntExist\` property
// Error: number ~> string // Error: number ~> string
// 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: Class statics not copied to Namespace object
// Error: number ~> string // 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: 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: CommonJS_Named has no default export
// Error: number ~> string // Error: number ~> string
////////////////////////////// //////////////////////////////
@ -1029,7 +1029,7 @@ import {typeAlias} from "./ExportType"; // Error: Cannot vanilla-import a type a
/////////////////////////////////// ///////////////////////////////////
// == ES6 Default -> CommonJS == // // == ES6 Default -> CommonJS == //
/////////////////////////////////// ///////////////////////////////////
// Error: 'doesntExist' isn't an export // Error: \'doesntExist\' isn\'t an export
// Error: number ~> string // Error: number ~> string
// Error: number ~> string // 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 == // // == Vanilla \`import\` cannot import a type-only export == //
///////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////
// Error: Cannot vanilla-import a type alias! // Error: Cannot vanilla-import a type alias!
import * as DefaultA from "A"; import * as DefaultA from \"A\";
var a1: number = DefaultA.numberValue1; var a1: number = DefaultA.numberValue1;
var a2: string = DefaultA.numberValue1; var a2: string = DefaultA.numberValue1;
import * as DefaultB from "./B"; import * as DefaultB from \"./B\";
var b1: number = DefaultB.numberValue; var b1: number = DefaultB.numberValue;
var b2: string = DefaultB.numberValue; var b2: string = DefaultB.numberValue;
import DefaultC from "C"; import DefaultC from \"C\";
import DefaultD from "./D"; import DefaultD from \"./D\";
import { doesntExist1 } from "CommonJS_Clobbering_Lit"; import { doesntExist1 } from \"CommonJS_Clobbering_Lit\";
import { numberValue1 } from "CommonJS_Clobbering_Lit"; import { numberValue1 } from \"CommonJS_Clobbering_Lit\";
var c1: number = numberValue1; var c1: number = numberValue1;
var c2: string = 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 d1: number = numVal1;
var d2: string = 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 e1: number = CJS_Clobb_Lit.numberValue3;
var e2: string = CJS_Clobb_Lit.numberValue3; var e2: string = CJS_Clobb_Lit.numberValue3;
CJS_Clobb_Lit.doesntExist; 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 f1: number = CJS_Clobb_Lit_NS.numberValue4;
var f2: number = CJS_Clobb_Lit_NS.default.numberValue4; var f2: number = CJS_Clobb_Lit_NS.default.numberValue4;
CJS_Clobb_Lit_NS.default.default; CJS_Clobb_Lit_NS.default.default;
var f3: string = CJS_Clobb_Lit_NS.numberValue4; var f3: string = CJS_Clobb_Lit_NS.numberValue4;
var f4: string = CJS_Clobb_Lit_NS.default.numberValue5; var f4: string = CJS_Clobb_Lit_NS.default.numberValue5;
import { doesntExist2 } from "CommonJS_Clobbering_Class"; import { doesntExist2 } from \"CommonJS_Clobbering_Class\";
import { staticNumber1, baseProp, childProp } from "CommonJS_Clobbering_Class"; import { staticNumber1, baseProp, childProp } from \"CommonJS_Clobbering_Class\";
import CJS_Clobb_Class from "CommonJS_Clobbering_Class"; import CJS_Clobb_Class from \"CommonJS_Clobbering_Class\";
new CJS_Clobb_Class(); new CJS_Clobb_Class();
new CJS_Clobb_Class().doesntExist; new CJS_Clobb_Class().doesntExist;
var h1: number = CJS_Clobb_Class.staticNumber2(); var h1: number = CJS_Clobb_Class.staticNumber2();
var h2: string = CJS_Clobb_Class.staticNumber2(); var h2: string = CJS_Clobb_Class.staticNumber2();
var h3: number = new CJS_Clobb_Class().instNumber1(); var h3: number = new CJS_Clobb_Class().instNumber1();
var h4: string = 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(); new CJS_Clobb_Class_NS();
var i1: number = CJS_Clobb_Class_NS.staticNumber3(); var i1: number = CJS_Clobb_Class_NS.staticNumber3();
var i2: number = new CJS_Clobb_Class_NS.default().instNumber2(); var i2: number = new CJS_Clobb_Class_NS.default().instNumber2();
var i3: string = new CJS_Clobb_Class_NS.default().instNumber2(); var i3: string = new CJS_Clobb_Class_NS.default().instNumber2();
import { doesntExist3 } from "CommonJS_Named"; import { doesntExist3 } from \"CommonJS_Named\";
import { numberValue2 } from "CommonJS_Named"; import { numberValue2 } from \"CommonJS_Named\";
var j1: number = numberValue2; var j1: number = numberValue2;
var j2: string = numberValue2; var j2: string = numberValue2;
import { numberValue3 as numVal3 } from "CommonJS_Named"; import { numberValue3 as numVal3 } from \"CommonJS_Named\";
var k1: number = numVal3; var k1: number = numVal3;
var k2: string = 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 l1: number = CJS_Named.numberValue1;
var l2: string = CJS_Named.numberValue1; var l2: string = CJS_Named.numberValue1;
CJS_Named.doesntExist; 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 m1: number = CJS_Named_NS.numberValue4;
var m2: string = CJS_Named_NS.default.numberValue4; var m2: string = CJS_Named_NS.default.numberValue4;
var m3: string = CJS_Named_NS.numberValue4; var m3: string = CJS_Named_NS.numberValue4;
import { doesntExist4 } from "ES6_Default_AnonFunction1"; import { doesntExist4 } from \"ES6_Default_AnonFunction1\";
import ES6_Def_AnonFunc1 from "ES6_Default_AnonFunction1"; import ES6_Def_AnonFunc1 from \"ES6_Default_AnonFunction1\";
var n1: number = ES6_Def_AnonFunc1(); var n1: number = ES6_Def_AnonFunc1();
var n2: string = 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 o1: number = ES6_Def_NamedFunc1();
var o2: string = 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 p1: number = new ES6_Def_AnonClass1().givesANum();
var p2: string = 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 q1: number = new ES6_Def_NamedClass1().givesANum();
var q2: string = new ES6_Def_NamedClass1().givesANum(); var q2: string = new ES6_Def_NamedClass1().givesANum();
import doesntExist5 from "ES6_Named1"; import doesntExist5 from \"ES6_Named1\";
import { specifierNumber1 as specifierNumber1_1 } from "ES6_Named1"; import { specifierNumber1 as specifierNumber1_1 } from \"ES6_Named1\";
var r1: number = specifierNumber1_1; var r1: number = specifierNumber1_1;
var r2: string = specifierNumber1_1; var r2: string = specifierNumber1_1;
import { specifierNumber2Renamed } from "ES6_Named1"; import { specifierNumber2Renamed } from \"ES6_Named1\";
var s1: number = specifierNumber2Renamed; var s1: number = specifierNumber2Renamed;
var s2: string = specifierNumber2Renamed; var s2: string = specifierNumber2Renamed;
import { specifierNumber3 as specifierNumber3Renamed } from "ES6_Named1"; import { specifierNumber3 as specifierNumber3Renamed } from \"ES6_Named1\";
var t1: number = specifierNumber3Renamed; var t1: number = specifierNumber3Renamed;
var t2: string = specifierNumber3Renamed; var t2: string = specifierNumber3Renamed;
import { groupedSpecifierNumber1, groupedSpecifierNumber2 } from "ES6_Named1"; import { groupedSpecifierNumber1, groupedSpecifierNumber2 } from \"ES6_Named1\";
var u1: number = groupedSpecifierNumber1; var u1: number = groupedSpecifierNumber1;
var u2: number = groupedSpecifierNumber2; var u2: number = groupedSpecifierNumber2;
var u3: string = groupedSpecifierNumber1; var u3: string = groupedSpecifierNumber1;
var u4: string = groupedSpecifierNumber2; var u4: string = groupedSpecifierNumber2;
import { givesANumber } from "ES6_Named1"; import { givesANumber } from \"ES6_Named1\";
var v1: number = givesANumber(); var v1: number = givesANumber();
var v2: string = givesANumber(); var v2: string = givesANumber();
import { NumberGenerator } from "ES6_Named1"; import { NumberGenerator } from \"ES6_Named1\";
var w1: number = new NumberGenerator().givesANumber(); var w1: number = new NumberGenerator().givesANumber();
var w2: string = 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 x1: number = varDeclNumber1;
var x2: number = varDeclNumber2; var x2: number = varDeclNumber2;
var x3: string = varDeclNumber1; var x3: string = varDeclNumber1;
var x4: string = varDeclNumber2; var x4: string = varDeclNumber2;
import { destructuredObjNumber } from "ES6_Named1"; import { destructuredObjNumber } from \"ES6_Named1\";
var y1: number = destructuredObjNumber; var y1: number = destructuredObjNumber;
var y2: string = destructuredObjNumber; var y2: string = destructuredObjNumber;
import { destructuredArrNumber } from "ES6_Named1"; import { destructuredArrNumber } from \"ES6_Named1\";
var z1: number = destructuredArrNumber; var z1: number = destructuredArrNumber;
var z2: string = 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 aa1: number = numberValue4;
var aa2: string = 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 ab1: number = numberValue2_renamed;
var ab2: string = 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 ac1: number = numberValue5;
var ac2: string = numberValue5; var ac2: string = numberValue5;
require("ES6_Default_AnonFunction2").doesntExist; require(\"ES6_Default_AnonFunction2\").doesntExist;
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 ad1: number = ES6_Def_AnonFunc2();
var ad2: string = 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 ae1: number = ES6_Def_NamedFunc2();
var ae2: string = 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 af1: number = new ES6_Def_AnonClass2().givesANum();
var af2: string = 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 ag1: number = new ES6_Def_NamedClass2().givesANum();
var ag2: string = 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 ah1: number = specifierNumber4;
var ah2: string = specifierNumber4; var ah2: string = specifierNumber4;
var specifierNumber5Renamed = require("ES6_Named2").specifierNumber5Renamed; var specifierNumber5Renamed = require(\"ES6_Named2\").specifierNumber5Renamed;
var ai1: number = specifierNumber5Renamed; var ai1: number = specifierNumber5Renamed;
var ai2: string = specifierNumber5Renamed; var ai2: string = specifierNumber5Renamed;
var groupedSpecifierNumber3 = require("ES6_Named2").groupedSpecifierNumber3; var groupedSpecifierNumber3 = require(\"ES6_Named2\").groupedSpecifierNumber3;
var groupedSpecifierNumber4 = require("ES6_Named2").groupedSpecifierNumber4; var groupedSpecifierNumber4 = require(\"ES6_Named2\").groupedSpecifierNumber4;
var aj1: number = groupedSpecifierNumber3; var aj1: number = groupedSpecifierNumber3;
var aj2: number = groupedSpecifierNumber4; var aj2: number = groupedSpecifierNumber4;
var aj3: string = groupedSpecifierNumber3; var aj3: string = groupedSpecifierNumber3;
var aj4: string = groupedSpecifierNumber4; var aj4: string = groupedSpecifierNumber4;
var givesANumber2 = require("ES6_Named2").givesANumber2; var givesANumber2 = require(\"ES6_Named2\").givesANumber2;
var ak1: number = givesANumber2(); var ak1: number = givesANumber2();
var ak2: string = givesANumber2(); var ak2: string = givesANumber2();
var NumberGenerator2 = require("ES6_Named2").NumberGenerator2; var NumberGenerator2 = require(\"ES6_Named2\").NumberGenerator2;
var al1: number = new NumberGenerator2().givesANumber(); var al1: number = new NumberGenerator2().givesANumber();
var al2: string = new NumberGenerator2().givesANumber(); var al2: string = new NumberGenerator2().givesANumber();
var varDeclNumber3 = require("ES6_Named2").varDeclNumber3; var varDeclNumber3 = require(\"ES6_Named2\").varDeclNumber3;
var varDeclNumber4 = require("ES6_Named2").varDeclNumber4; var varDeclNumber4 = require(\"ES6_Named2\").varDeclNumber4;
var am1: number = varDeclNumber3; var am1: number = varDeclNumber3;
var am2: number = varDeclNumber4; var am2: number = varDeclNumber4;
var am3: string = varDeclNumber3; var am3: string = varDeclNumber3;
var am4: string = varDeclNumber4; var am4: string = varDeclNumber4;
var destructuredObjNumber2 = require("ES6_Named2").destructuredObjNumber2; var destructuredObjNumber2 = require(\"ES6_Named2\").destructuredObjNumber2;
var an1: number = destructuredObjNumber2; var an1: number = destructuredObjNumber2;
var an2: string = destructuredObjNumber2; var an2: string = destructuredObjNumber2;
var destructuredArrNumber2 = require("ES6_Named2").destructuredArrNumber2; var destructuredArrNumber2 = require(\"ES6_Named2\").destructuredArrNumber2;
var ao1: number = destructuredArrNumber2; var ao1: number = destructuredArrNumber2;
var ao2: string = destructuredArrNumber2; var ao2: string = destructuredArrNumber2;
var numberValue6 = require("ES6_ExportFrom_Intermediary2").numberValue1; var numberValue6 = require(\"ES6_ExportFrom_Intermediary2\").numberValue1;
var ap1: number = numberValue6; var ap1: number = numberValue6;
var ap2: string = numberValue6; var ap2: string = numberValue6;
var numberValue2_renamed2 = require( var numberValue2_renamed2 = require(
"ES6_ExportFrom_Intermediary2" \"ES6_ExportFrom_Intermediary2\"
).numberValue2_renamed2; ).numberValue2_renamed2;
var aq1: number = numberValue2_renamed2; var aq1: number = numberValue2_renamed2;
var aq2: string = 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 ar1: number = numberValue7;
var ar2: string = 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 as1: number = defaultNum;
var as2: string = defaultNum; var as2: string = defaultNum;
var as3: string = namedStr; var as3: string = namedStr;
var as4: number = namedStr; var as4: number = namedStr;
import "./SideEffects"; import \"./SideEffects\";
import specifierNumber1 from "ES6_Named1"; import specifierNumber1 from \"ES6_Named1\";
import { specifierNumber } from "ES6_Named1"; import { specifierNumber } from \"ES6_Named1\";
import { numberValue1 as numberValue8, numberValue2 as numberValue9 } from "./ES6_ExportAllFromMulti"; import { numberValue1 as numberValue8, numberValue2 as numberValue9 } from \"./ES6_ExportAllFromMulti\";
var at1: number = numberValue8; var at1: number = numberValue8;
var at2: string = numberValue8; var at2: string = numberValue8;
var at3: number = numberValue9; var at3: number = numberValue9;
var at4: string = 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 // CommonJS module
import * as DefaultA from "A"; import * as DefaultA from \"A\";
DefaultA.numberValue1 = 123; // Error: DefaultA is frozen DefaultA.numberValue1 = 123; // Error: DefaultA is frozen
// ES6 module // 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 ES6_Named1.varDeclNumber1 = 123; // Error: ES6_Named1 is frozen
// CommonJS module that clobbers module.exports // 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.numberValue1 = 123; // Error: frozen
CommonJS_Star.default.numberValue1 = 123; // ok 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_Clobbering_Lit.numberValue1 = 123; // ok
// CommonJS module that clobbers module.exports with a frozen object // 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.numberValue1 = 123; // Error: frozen
CommonJS_Frozen_Star.default.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 CommonJS_Clobbering_Frozen.numberValue1 = 123; // Error: exports are frozen
@ -1289,19 +1289,19 @@ CommonJS_Clobbering_Frozen.numberValue1 = 123; // Error: exports are frozen
function testRequires() { function testRequires() {
// CommonJS module // CommonJS module
var DefaultA = require("A"); var DefaultA = require(\"A\");
DefaultA.numberValue1 = 123; // ok, not frozen by default DefaultA.numberValue1 = 123; // ok, not frozen by default
// ES6 module // ES6 module
var ES6_Named1 = require("ES6_Named1"); var ES6_Named1 = require(\"ES6_Named1\");
ES6_Named1.numberValue = 123; // error, es6 exports are frozen ES6_Named1.numberValue = 123; // error, es6 exports are frozen
// CommonJS module that clobbers module.exports // 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_Star.numberValue1 = 123; // ok, not frozen by default
// CommonJS module that clobbers module.exports with a frozen object // 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 CommonJS_Frozen_Star.numberValue1 = 123; // Error: frozen
} }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -1332,28 +1332,28 @@ function testRequires() {
// ok, not frozen by default // ok, not frozen by default
// CommonJS module that clobbers module.exports with a frozen object // CommonJS module that clobbers module.exports with a frozen object
// Error: frozen // Error: frozen
import * as DefaultA from "A"; import * as DefaultA from \"A\";
DefaultA.numberValue1 = 123; DefaultA.numberValue1 = 123;
import * as ES6_Named1 from "ES6_Named1"; import * as ES6_Named1 from \"ES6_Named1\";
ES6_Named1.varDeclNumber1 = 123; 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.numberValue1 = 123;
CommonJS_Star.default.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; 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.numberValue1 = 123;
CommonJS_Frozen_Star.default.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; CommonJS_Clobbering_Frozen.numberValue1 = 123;
function testRequires() { function testRequires() {
var DefaultA = require("A"); var DefaultA = require(\"A\");
DefaultA.numberValue1 = 123; DefaultA.numberValue1 = 123;
var ES6_Named1 = require("ES6_Named1"); var ES6_Named1 = require(\"ES6_Named1\");
ES6_Named1.numberValue = 123; ES6_Named1.numberValue = 123;
var CommonJS_Star = require("CommonJS_Clobbering_Lit"); var CommonJS_Star = require(\"CommonJS_Clobbering_Lit\");
CommonJS_Star.numberValue1 = 123; 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; CommonJS_Frozen_Star.numberValue1 = 123;
} }
" "

View File

@ -1,8 +1,8 @@
exports[`test es_declare_module.js 1`] = ` exports[`test es_declare_module.js 1`] = `
"// @flow "// @flow
import {num1, str1} from "CJS_Named"; import {num1, str1} from \"CJS_Named\";
import CJS_Named from "CJS_Named"; import CJS_Named from \"CJS_Named\";
(num1: number); (num1: number);
(num1: string); // Error: number ~> string (num1: string); // Error: number ~> string
(str1: string); (str1: string);
@ -10,36 +10,36 @@ import CJS_Named from "CJS_Named";
(CJS_Named: {num1: number, str1: string}); (CJS_Named: {num1: number, str1: string});
(CJS_Named: number); // Error: Module ~> number (CJS_Named: number); // Error: Module ~> number
import {num2} from "CJS_Clobbered"; // Error: No such export! import {num2} from \"CJS_Clobbered\"; // Error: No such export!
import {numExport} from "CJS_Clobbered"; import {numExport} from \"CJS_Clobbered\";
(numExport: number); (numExport: number);
(numExport: string); // Error: number ~> string (numExport: string); // Error: number ~> string
import type {numType} from "CJS_Clobbered"; import type {numType} from \"CJS_Clobbered\";
(42: numType); (42: numType);
('asdf': numType); // Error: string ~> number (\'asdf\': numType); // Error: string ~> number
import {strHidden} from "ES"; // Error: No such export! import {strHidden} from \"ES\"; // Error: No such export!
import {str3} from "ES"; import {str3} from \"ES\";
(str3: string); (str3: string);
(str3: number); // Error: string ~> number (str3: number); // Error: string ~> number
import {num3} from "ES"; import {num3} from \"ES\";
(num3: number); (num3: number);
(num3: string); // Error: number ~> string (num3: string); // Error: number ~> string
import {C} from "ES"; import {C} from \"ES\";
import type {C as CType} from "ES"; import type {C as CType} from \"ES\";
(new C(): C); (new C(): C);
(42: C); // Error: number ~> C (42: C); // Error: number ~> C
(new C(): CType); (new C(): CType);
(42: CType); // Error: number ~> CType (42: CType); // Error: number ~> CType
import {T} from "ES"; // Error: T is a type import, not a value import {T} from \"ES\"; // Error: T is a type import, not a value
import type {T as T2} from "ES"; import type {T as T2} from \"ES\";
(42: T2); (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 // @flow
// Error: number ~> string // 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: T is a type import, not a value
// Error: string ~> number // Error: string ~> number
// Error: Not an export // Error: Not an export
import { num1, str1 } from "CJS_Named"; import { num1, str1 } from \"CJS_Named\";
import CJS_Named from "CJS_Named"; import CJS_Named from \"CJS_Named\";
(num1: number); (num1: number);
(num1: string); (num1: string);
(str1: string); (str1: string);
(str1: number); (str1: number);
(CJS_Named: { num1: number; str1: string }); (CJS_Named: { num1: number; str1: string });
(CJS_Named: number); (CJS_Named: number);
import { num2 } from "CJS_Clobbered"; import { num2 } from \"CJS_Clobbered\";
import { numExport } from "CJS_Clobbered"; import { numExport } from \"CJS_Clobbered\";
(numExport: number); (numExport: number);
(numExport: string); (numExport: string);
import type { numType } from "CJS_Clobbered"; import type { numType } from \"CJS_Clobbered\";
(42: numType); (42: numType);
("asdf": numType); (\"asdf\": numType);
import { strHidden } from "ES"; import { strHidden } from \"ES\";
import { str3 } from "ES"; import { str3 } from \"ES\";
(str3: string); (str3: string);
(str3: number); (str3: number);
import { num3 } from "ES"; import { num3 } from \"ES\";
(num3: number); (num3: number);
(num3: string); (num3: string);
import { C } from "ES"; import { C } from \"ES\";
import type { C as CType } from "ES"; import type { C as CType } from \"ES\";
(new C(): C); (new C(): C);
(42: C); (42: C);
(new C(): CType); (new C(): CType);
(42: CType); (42: CType);
import { T } from "ES"; import { T } from \"ES\";
import type { T as T2 } from "ES"; import type { T as T2 } from \"ES\";
(42: T2); (42: T2);
("asdf": T2); (\"asdf\": T2);
import { exports as nope } from "ES"; import { exports as nope } from \"ES\";
" "
`; `;

View File

@ -1,27 +1,27 @@
exports[`test P.js 1`] = ` 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`] = ` exports[`test test.js 1`] = `
"var M = require('M'); "var M = require(\'M\');
var N = require('N'); var N = require(\'N\');
N.x = M(N.x); 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); 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); N.z = Q(N.z);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// implementation of P redirects to module M // implementation of P redirects to module M
// declaration of Q redirects to module M // declaration of Q redirects to module M
var M = require("M"); var M = require(\"M\");
var N = require("N"); var N = require(\"N\");
N.x = M(N.x); N.x = M(N.x);
var P = require("./P"); var P = require(\"./P\");
N.y = P(N.y); N.y = P(N.y);
var Q = require("Q"); var Q = require(\"Q\");
N.z = Q(N.z); N.z = Q(N.z);
" "
`; `;

View File

@ -8,7 +8,7 @@ declare module N {
declare var z: number; declare var z: number;
} }
declare module Q { declare module Q {
declare var exports: $Exports<'M'>; declare var exports: $Exports<\'M\'>;
} }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
declare module M { declare module M {
@ -20,7 +20,7 @@ declare module N {
declare var z: number; declare var z: number;
} }
declare module Q { declare module Q {
declare var exports: $Exports<"M">; declare var exports: $Exports<\"M\">;
} }
" "
`; `;

View File

@ -21,30 +21,30 @@ import type {
standaloneType1, standaloneType1,
talias1, talias1,
talias3, talias3,
} from "./types_only"; } from \"./types_only\";
var a: inlinedType1 = 42; var a: inlinedType1 = 42;
var b: inlinedType1 = 'asdf'; // Error: string ~> number var b: inlinedType1 = \'asdf\'; // Error: string ~> number
var c: standaloneType1 = 42; var c: standaloneType1 = 42;
var d: standaloneType1 = 'asdf'; // Error: string ~> number var d: standaloneType1 = \'asdf\'; // Error: string ~> number
var e: talias1 = 42; var e: talias1 = 42;
var f: talias1 = 'asdf'; // Error: string ~> number var f: talias1 = \'asdf\'; // Error: string ~> number
var g: talias3 = 42; 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 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 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} var n: IFoo2 = {prop: 42}; // Error: {prop:number} ~> {prop:string}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* @flow */ /* @flow */
@ -55,22 +55,22 @@ var n: IFoo2 = {prop: 42}; // Error: {prop:number} ~> {prop:string}
// Error: string ~> number // Error: string ~> number
// Error: {prop:string} ~> {prop:number} // Error: {prop:string} ~> {prop:number}
// Error: {prop:number} ~> {prop:string} // 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 a: inlinedType1 = 42;
var b: inlinedType1 = "asdf"; var b: inlinedType1 = \"asdf\";
var c: standaloneType1 = 42; var c: standaloneType1 = 42;
var d: standaloneType1 = "asdf"; var d: standaloneType1 = \"asdf\";
var e: talias1 = 42; var e: talias1 = 42;
var f: talias1 = "asdf"; var f: talias1 = \"asdf\";
var g: talias3 = 42; var g: talias3 = 42;
var h: talias3 = "asdf"; var h: talias3 = \"asdf\";
import type { talias4 } from "./cjs_with_types"; import type { talias4 } from \"./cjs_with_types\";
var i: talias4 = 42; var i: talias4 = 42;
var j: talias4 = "asdf"; var j: talias4 = \"asdf\";
import { IFoo, IFoo2 } from "./types_only"; import { IFoo, IFoo2 } from \"./types_only\";
var k: IFoo = { prop: 42 }; var k: IFoo = { prop: 42 };
var l: IFoo = { prop: "asdf" }; var l: IFoo = { prop: \"asdf\" };
var m: IFoo2 = { prop: "asdf" }; var m: IFoo2 = { prop: \"asdf\" };
var n: IFoo2 = { prop: 42 }; var n: IFoo2 = { prop: 42 };
" "
`; `;
@ -80,7 +80,7 @@ exports[`test types_only.js 1`] = `
export type inlinedType1 = number; export type inlinedType1 = number;
var a: inlinedType1 = 42; var a: inlinedType1 = 42;
var b: inlinedType1 = 'asdf'; // Error: string ~> number var b: inlinedType1 = \'asdf\'; // Error: string ~> number
type standaloneType1 = number; type standaloneType1 = number;
export type {standaloneType1}; export type {standaloneType1};
@ -88,7 +88,7 @@ export type {standaloneType1};
type standaloneType2 = number; type standaloneType2 = number;
export {standaloneType2}; // Error: Missing \`type\` keyword 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 }; export interface IFoo { prop: number };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -97,12 +97,12 @@ export interface IFoo { prop: number };
// Error: Missing \`type\` keyword // Error: Missing \`type\` keyword
export type inlinedType1 = number; export type inlinedType1 = number;
var a: inlinedType1 = 42; var a: inlinedType1 = 42;
var b: inlinedType1 = "asdf"; var b: inlinedType1 = \"asdf\";
type standaloneType1 = number; type standaloneType1 = number;
export { standaloneType1 } export { standaloneType1 }
type standaloneType2 = number; type standaloneType2 = number;
export { standaloneType2 } 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 } export interface IFoo { prop: number }
" "
`; `;

View File

@ -1,8 +1,8 @@
exports[`test foo.js 1`] = ` exports[`test foo.js 1`] = `
"var imp = require('./bar'); "var imp = require(\'./bar\');
imp(1337); imp(1337);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var imp = require("./bar"); var imp = require(\"./bar\");
imp(1337); imp(1337);
" "
`; `;

View File

@ -1,12 +1,12 @@
exports[`test main.js 1`] = ` exports[`test main.js 1`] = `
"// @flow "// @flow
var React = require('react'); var React = require(\'react\');
(<fbt />: React.Element<*>); (<fbt />: React.Element<*>);
(<fbt />: number); // Error: ReactElement ~> number (<fbt />: number); // Error: ReactElement ~> number
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
// Error: ReactElement ~> number // Error: ReactElement ~> number
var React = require("react"); var React = require(\"react\");
(<fbt/>: React.Element<*>); (<fbt/>: React.Element<*>);
(<fbt/>: number); (<fbt/>: number);
" "

View File

@ -22,15 +22,15 @@ let tests = [
result.baz = false; result.baz = false;
(copyProperties( (copyProperties(
result, result,
{ foo: 'a' }, { foo: \'a\' },
{ bar: 123 } { bar: 123 }
): { foo: string, bar: number, baz: boolean }); ): { foo: string, bar: number, baz: boolean });
}, },
// module from lib // module from lib
function() { function() {
const copyProperties = require('copyProperties'); const copyProperties = require(\'copyProperties\');
let x = { foo: 'a' }; let x = { foo: \'a\' };
let y = { bar: 123 }; let y = { bar: 123 };
(copyProperties({}, x, y): { foo: string, bar: number }); (copyProperties({}, x, y): { foo: string, bar: number });
}, },
@ -38,7 +38,7 @@ let tests = [
// too few args // too few args
function(copyProperties: Object$Assign) { function(copyProperties: Object$Assign) {
copyProperties(); copyProperties();
(copyProperties({ foo: 'a' }): { foo: number }); // err, num !~> string (copyProperties({ foo: \'a\' }): { foo: number }); // err, num !~> string
}, },
// passed as a function // passed as a function
@ -63,21 +63,21 @@ let tests = [
function(copyProperties: Object$Assign) { function(copyProperties: Object$Assign) {
let result = {}; let result = {};
result.baz = false; result.baz = false;
(copyProperties(result, { foo: "a" }, { bar: 123 }): { (copyProperties(result, { foo: \"a\" }, { bar: 123 }): {
foo: string; foo: string;
bar: number; bar: number;
baz: boolean baz: boolean
}); });
}, },
function() { function() {
const copyProperties = require("copyProperties"); const copyProperties = require(\"copyProperties\");
let x = { foo: "a" }; let x = { foo: \"a\" };
let y = { bar: 123 }; let y = { bar: 123 };
(copyProperties({}, x, y): { foo: string; bar: number }); (copyProperties({}, x, y): { foo: string; bar: number });
}, },
function(copyProperties: Object$Assign) { function(copyProperties: Object$Assign) {
copyProperties(); copyProperties();
(copyProperties({ foo: "a" }): { foo: number }); (copyProperties({ foo: \"a\" }): { foo: number });
}, },
function(copyProperties: Object$Assign) { function(copyProperties: Object$Assign) {
function x(cb: Function) { function x(cb: Function) {
@ -95,7 +95,7 @@ exports[`test invariant.js 1`] = `
let tests = [ let tests = [
function() { function() {
let x: ?string = null; 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) { function(invariant: Function) {
@ -110,7 +110,7 @@ let tests = [
let tests = [ let tests = [
function() { function() {
let x: ?string = null; let x: ?string = null;
invariant(x, "truthy only"); invariant(x, \"truthy only\");
}, },
function(invariant: Function) { function(invariant: Function) {
let x: ?string = null; let x: ?string = null;
@ -122,25 +122,25 @@ let tests = [
`; `;
exports[`test lib.js 1`] = ` exports[`test lib.js 1`] = `
"declare module "copyProperties" { "declare module \"copyProperties\" {
declare var exports: Object$Assign; declare var exports: Object$Assign;
} }
declare module "mergeInto" { declare module \"mergeInto\" {
declare var exports: $Facebookism$MergeInto; declare var exports: $Facebookism$MergeInto;
} }
declare module "mixin" { declare module \"mixin\" {
declare var exports: $Facebookism$Mixin; declare var exports: $Facebookism$Mixin;
} }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
declare module "copyProperties" { declare module \"copyProperties\" {
declare var exports: Object$Assign; declare var exports: Object$Assign;
} }
declare module "mergeInto" { declare module \"mergeInto\" {
declare var exports: $Facebookism$MergeInto; declare var exports: $Facebookism$MergeInto;
} }
declare module "mixin" { declare module \"mixin\" {
declare var exports: $Facebookism$Mixin; declare var exports: $Facebookism$Mixin;
} }
" "
@ -159,15 +159,15 @@ let tests = [
function(mergeInto: $Facebookism$MergeInto) { function(mergeInto: $Facebookism$MergeInto) {
let result = {}; let result = {};
result.baz = false; result.baz = false;
(mergeInto(result, { foo: 'a' }, { bar: 123 }): void); (mergeInto(result, { foo: \'a\' }, { bar: 123 }): void);
(result: { foo: string, bar: number, baz: boolean }); (result: { foo: string, bar: number, baz: boolean });
}, },
// module from lib // module from lib
function() { function() {
const mergeInto = require('mergeInto'); const mergeInto = require(\'mergeInto\');
let result: { foo?: string, bar?: number, baz: boolean } = { baz: false }; 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 // too few args
@ -196,13 +196,13 @@ let tests = [
function(mergeInto: $Facebookism$MergeInto) { function(mergeInto: $Facebookism$MergeInto) {
let result = {}; let result = {};
result.baz = false; result.baz = false;
(mergeInto(result, { foo: "a" }, { bar: 123 }): void); (mergeInto(result, { foo: \"a\" }, { bar: 123 }): void);
(result: { foo: string; bar: number; baz: boolean }); (result: { foo: string; bar: number; baz: boolean });
}, },
function() { function() {
const mergeInto = require("mergeInto"); const mergeInto = require(\"mergeInto\");
let result: { foo?: string; bar?: number; baz: boolean } = { baz: false }; 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) { function(mergeInto: $Facebookism$MergeInto) {
mergeInto(); mergeInto();
@ -218,22 +218,22 @@ let tests = [
`; `;
exports[`test test.js 1`] = ` exports[`test test.js 1`] = `
"var Bar = require('./Bar'); "var Bar = require(\'./Bar\');
var mixin = require('mixin'); var mixin = require(\'mixin\');
class Foo extends mixin(Bar) { class Foo extends mixin(Bar) {
m() { m() {
var x: string = this.x; var x: string = this.x;
this.y = ""; this.y = \"\";
} }
} }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var Bar = require("./Bar"); var Bar = require(\"./Bar\");
var mixin = require("mixin"); var mixin = require(\"mixin\");
class Foo extends mixin(Bar) { class Foo extends mixin(Bar) {
m() { m() {
var x: string = this.x; var x: string = this.x;
this.y = ""; this.y = \"\";
} }
} }
" "

View File

@ -6,13 +6,13 @@ module.exports = 0;
`; `;
exports[`test test.js 1`] = ` exports[`test test.js 1`] = `
"var x = require('./req'); "var x = require(\'./req\');
(x: string); (x: string);
import x from './req'; import x from \'./req\';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var x = require("./req"); var x = require(\"./req\");
(x: string); (x: string);
import x from "./req"; import x from \"./req\";
" "
`; `;

View File

@ -26,7 +26,7 @@ function mk_factorial() {
var factorial = mk_factorial(); var factorial = mk_factorial();
factorial("..."); factorial(\"...\");
module.exports = {fn: fix}; module.exports = {fn: fix};
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -64,7 +64,7 @@ function mk_factorial() {
); );
} }
var factorial = mk_factorial(); var factorial = mk_factorial();
factorial("..."); factorial(\"...\");
module.exports = { fn: fix }; module.exports = { fn: fix };
" "
`; `;

View File

@ -9,7 +9,7 @@ function foo(x: boolean) {
} }
return; return;
} }
console.log('this is still reachable'); console.log(\'this is still reachable\');
} }
function bar(x: boolean) { function bar(x: boolean) {
@ -17,7 +17,7 @@ function bar(x: boolean) {
for (var ii = 0; ii < max; ii++) { for (var ii = 0; ii < max; ii++) {
return; return;
} }
console.log('this is still reachable'); console.log(\'this is still reachable\');
} }
function baz(x: boolean) { function baz(x: boolean) {
@ -25,7 +25,7 @@ function baz(x: boolean) {
for (var ii = 0; ii < max; ii++) { for (var ii = 0; ii < max; ii++) {
continue; continue;
} }
console.log('this is still reachable'); console.log(\'this is still reachable\');
} }
function bliffl(x: boolean) { function bliffl(x: boolean) {
@ -34,9 +34,9 @@ function bliffl(x: boolean) {
loop2: for (var jj = 0; jj < max; jj++) { loop2: for (var jj = 0; jj < max; jj++) {
break loop1; 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) { function corge(x: boolean) {
@ -44,7 +44,7 @@ function corge(x: boolean) {
for (var ii = 0; ii < max; ii++) { for (var ii = 0; ii < max; ii++) {
break; break;
} }
console.log('this is still reachable'); console.log(\'this is still reachable\');
} }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* @flow */ /* @flow */
@ -56,21 +56,21 @@ function foo(x: boolean) {
} }
return; return;
} }
console.log("this is still reachable"); console.log(\"this is still reachable\");
} }
function bar(x: boolean) { function bar(x: boolean) {
var max = 0; var max = 0;
for (var ii = 0; ii < max; ii++) { for (var ii = 0; ii < max; ii++) {
return; return;
} }
console.log("this is still reachable"); console.log(\"this is still reachable\");
} }
function baz(x: boolean) { function baz(x: boolean) {
var max = 0; var max = 0;
for (var ii = 0; ii < max; ii++) { for (var ii = 0; ii < max; ii++) {
continue; continue;
} }
console.log("this is still reachable"); console.log(\"this is still reachable\");
} }
function bliffl(x: boolean) { function bliffl(x: boolean) {
var max = 10; var max = 10;
@ -80,16 +80,16 @@ for (var ii = 0; ii < max; ii++) {
for (var jj = 0; jj < max; jj++) { for (var jj = 0; jj < max; jj++) {
break loop1; 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) { function corge(x: boolean) {
var max = 0; var max = 0;
for (var ii = 0; ii < max; ii++) { for (var ii = 0; ii < max; ii++) {
break; 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; return;
} }
console.log('this is still reachable'); console.log(\'this is still reachable\');
} }
function bar(x: boolean) { function bar(x: boolean) {
for (var prop in {}) { for (var prop in {}) {
return; return;
} }
console.log('this is still reachable'); console.log(\'this is still reachable\');
} }
function baz(x: boolean) { function baz(x: boolean) {
for (var prop in {}) { for (var prop in {}) {
continue; continue;
} }
console.log('this is still reachable'); console.log(\'this is still reachable\');
} }
function bliffl(x: boolean) { function bliffl(x: boolean) {
@ -126,16 +126,16 @@ function bliffl(x: boolean) {
loop2: for (var prop2 in obj) { loop2: for (var prop2 in obj) {
break loop1; 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) { function corge(x: boolean) {
for (var prop in {}) { for (var prop in {}) {
break; break;
} }
console.log('this is still reachable'); console.log(\'this is still reachable\');
} }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function foo(x: boolean) { function foo(x: boolean) {
@ -146,19 +146,19 @@ function foo(x: boolean) {
} }
return; return;
} }
console.log("this is still reachable"); console.log(\"this is still reachable\");
} }
function bar(x: boolean) { function bar(x: boolean) {
for (var prop in {}) { for (var prop in {}) {
return; return;
} }
console.log("this is still reachable"); console.log(\"this is still reachable\");
} }
function baz(x: boolean) { function baz(x: boolean) {
for (var prop in {}) { for (var prop in {}) {
continue; continue;
} }
console.log("this is still reachable"); console.log(\"this is still reachable\");
} }
function bliffl(x: boolean) { function bliffl(x: boolean) {
var obj = { a: 1, b: 2 }; var obj = { a: 1, b: 2 };
@ -168,15 +168,15 @@ for (var prop1 in obj) {
for (var prop2 in obj) { for (var prop2 in obj) {
break loop1; 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) { function corge(x: boolean) {
for (var prop in {}) { for (var prop in {}) {
break; 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; return;
} }
console.log('this is still reachable'); console.log(\'this is still reachable\');
} }
function bar(x: boolean) { function bar(x: boolean) {
for (var elem of []) { for (var elem of []) {
return; return;
} }
console.log('this is still reachable'); console.log(\'this is still reachable\');
} }
function baz(x: boolean) { function baz(x: boolean) {
for (var elem of []) { for (var elem of []) {
continue; continue;
} }
console.log('this is still reachable'); console.log(\'this is still reachable\');
} }
function bliffl(x: boolean) { function bliffl(x: boolean) {
@ -213,16 +213,16 @@ function bliffl(x: boolean) {
loop2: for (var elem of arr) { loop2: for (var elem of arr) {
break loop1; 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) { function corge(x: boolean) {
for (var elem of []) { for (var elem of []) {
break; break;
} }
console.log('this is still reachable'); console.log(\'this is still reachable\');
} }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function foo(x: boolean) { function foo(x: boolean) {
@ -233,19 +233,19 @@ function foo(x: boolean) {
} }
return; return;
} }
console.log("this is still reachable"); console.log(\"this is still reachable\");
} }
function bar(x: boolean) { function bar(x: boolean) {
for (var elem of [ ]) { for (var elem of [ ]) {
return; return;
} }
console.log("this is still reachable"); console.log(\"this is still reachable\");
} }
function baz(x: boolean) { function baz(x: boolean) {
for (var elem of [ ]) { for (var elem of [ ]) {
continue; continue;
} }
console.log("this is still reachable"); console.log(\"this is still reachable\");
} }
function bliffl(x: boolean) { function bliffl(x: boolean) {
var arr = [ 1, 2, 3 ]; var arr = [ 1, 2, 3 ];
@ -255,15 +255,15 @@ for (var elem of arr) {
for (var elem of arr) { for (var elem of arr) {
break loop1; 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) { function corge(x: boolean) {
for (var elem of [ ]) { for (var elem of [ ]) {
break; break;
} }
console.log("this is still reachable"); console.log(\"this is still reachable\");
} }
" "
`; `;

View File

@ -2,7 +2,7 @@ exports[`test class.js 1`] = `
"class GeneratorExamples { "class GeneratorExamples {
*stmt_yield(): Generator<number, void, void> { *stmt_yield(): Generator<number, void, void> {
yield 0; // ok yield 0; // ok
yield ""; // error: string ~> number yield \"\"; // error: string ~> number
} }
*stmt_next(): Generator<void, void, number> { *stmt_next(): Generator<void, void, number> {
@ -22,18 +22,18 @@ exports[`test class.js 1`] = `
} }
*stmt_return_err(): Generator<void, number, void> { *stmt_return_err(): Generator<void, number, void> {
return ""; // error: string ~> number return \"\"; // error: string ~> number
} }
*infer_stmt() { *infer_stmt() {
var x: boolean = yield 0; // error: number ~> boolean var x: boolean = yield 0; // error: number ~> boolean
return ""; return \"\";
} }
*widen_next() { *widen_next() {
var x = yield 0; var x = yield 0;
if (typeof x === "number") { if (typeof x === \"number\") {
} else if (typeof x === "boolean") { } else if (typeof x === \"boolean\") {
} else { } else {
(x : string) // ok, sherlock (x : string) // ok, sherlock
} }
@ -41,7 +41,7 @@ exports[`test class.js 1`] = `
*widen_yield() { *widen_yield() {
yield 0; yield 0;
yield ""; yield \"\";
yield true; yield true;
} }
@ -54,7 +54,7 @@ exports[`test class.js 1`] = `
*delegate_yield_generator() { *delegate_yield_generator() {
function *inner() { function *inner() {
yield ""; yield \"\";
} }
yield *inner(); yield *inner();
@ -62,7 +62,7 @@ exports[`test class.js 1`] = `
*delegate_return_generator() { *delegate_return_generator() {
function *inner() { function *inner() {
return ""; return \"\";
} }
var x: number = yield *inner(); // error: string ~> number 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 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 var infer_stmt_next = examples.infer_stmt().next(0).value; // error: number ~> boolean
if (typeof infer_stmt_next === "undefined") { if (typeof infer_stmt_next === \"undefined\") {
} else if (typeof infer_stmt_next === "number") { } else if (typeof infer_stmt_next === \"number\") {
} else { } else {
(infer_stmt_next : boolean) // error: string ~> boolean (infer_stmt_next : boolean) // error: string ~> boolean
} }
examples.widen_next().next(0) examples.widen_next().next(0)
examples.widen_next().next("") examples.widen_next().next(\"\")
examples.widen_next().next(true) examples.widen_next().next(true)
for (var x of examples.widen_yield()) { for (var x of examples.widen_yield()) {
if (typeof x === "number") { if (typeof x === \"number\") {
} else if (typeof x === "boolean") { } else if (typeof x === \"boolean\") {
} else { } else {
(x : string) // ok, sherlock (x : string) // ok, sherlock
} }
} }
examples.delegate_next_generator().next(""); examples.delegate_next_generator().next(\"\");
for (var x of examples.delegate_yield_generator()) { for (var x of examples.delegate_yield_generator()) {
(x : number) // error: string ~> number (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([])) { for (var x of examples.delegate_yield_iterable([])) {
(x : string) // error: number ~> string (x : string) // error: number ~> string
@ -151,7 +151,7 @@ for (var x of examples.delegate_yield_iterable([])) {
class GeneratorExamples { class GeneratorExamples {
*stmt_yield(): Generator<number, void, void> { *stmt_yield(): Generator<number, void, void> {
yield 0; yield 0;
yield ""; yield \"\";
} }
*stmt_next(): Generator<void, void, number> { *stmt_next(): Generator<void, void, number> {
var a = yield; var a = yield;
@ -167,18 +167,18 @@ class GeneratorExamples {
return 0; return 0;
} }
*stmt_return_err(): Generator<void, number, void> { *stmt_return_err(): Generator<void, number, void> {
return ""; return \"\";
} }
*infer_stmt() { *infer_stmt() {
var x: boolean = yield 0; var x: boolean = yield 0;
return ""; return \"\";
} }
*widen_next() { *widen_next() {
var x = yield 0; var x = yield 0;
if (typeof x === "number") { if (typeof x === \"number\") {
} else } else
if (typeof x === "boolean") { if (typeof x === \"boolean\") {
} else { } else {
(x: string); (x: string);
@ -186,7 +186,7 @@ class GeneratorExamples {
} }
*widen_yield() { *widen_yield() {
yield 0; yield 0;
yield ""; yield \"\";
yield true; yield true;
} }
*delegate_next_generator() { *delegate_next_generator() {
@ -197,13 +197,13 @@ class GeneratorExamples {
} }
*delegate_yield_generator() { *delegate_yield_generator() {
function* inner() { function* inner() {
yield ""; yield \"\";
} }
yield* inner(); yield* inner();
} }
*delegate_return_generator() { *delegate_return_generator() {
function* inner() { function* inner() {
return ""; return \"\";
} }
var x: number = yield* inner(); var x: number = yield* inner();
} }
@ -231,32 +231,32 @@ for (var x of examples.infer_stmt()) {
(x: string); (x: string);
} }
var infer_stmt_next = examples.infer_stmt().next(0).value; var infer_stmt_next = examples.infer_stmt().next(0).value;
if (typeof infer_stmt_next === "undefined") { if (typeof infer_stmt_next === \"undefined\") {
} else } else
if (typeof infer_stmt_next === "number") { if (typeof infer_stmt_next === \"number\") {
} else { } else {
(infer_stmt_next: boolean); (infer_stmt_next: boolean);
} }
examples.widen_next().next(0); examples.widen_next().next(0);
examples.widen_next().next(""); examples.widen_next().next(\"\");
examples.widen_next().next(true); examples.widen_next().next(true);
for (var x of examples.widen_yield()) { for (var x of examples.widen_yield()) {
if (typeof x === "number") { if (typeof x === \"number\") {
} else } else
if (typeof x === "boolean") { if (typeof x === \"boolean\") {
} else { } else {
(x: string); (x: string);
} }
} }
examples.delegate_next_generator().next(""); examples.delegate_next_generator().next(\"\");
for (var x of examples.delegate_yield_generator()) { for (var x of examples.delegate_yield_generator()) {
(x: number); (x: number);
} }
examples.delegate_next_iterable([ ]).next(""); examples.delegate_next_iterable([ ]).next(\"\");
for (var x of examples.delegate_yield_iterable([ ])) { for (var x of examples.delegate_yield_iterable([ ])) {
(x: string); (x: string);
} }
@ -269,7 +269,7 @@ exports[`test class_failure.js 1`] = `
class GeneratorExamples<X> { class GeneratorExamples<X> {
*infer_stmt() { *infer_stmt() {
var x: boolean = yield 0; // error: number ~> boolean 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 var infer_stmt_next = examples.infer_stmt().next(0).value; // error: number ~> boolean
if (typeof infer_stmt_next === "undefined") { if (typeof infer_stmt_next === \"undefined\") {
} else if (typeof infer_stmt_next === "number") { } else if (typeof infer_stmt_next === \"number\") {
} else { } else {
(infer_stmt_next : boolean) // error: string ~> boolean (infer_stmt_next : boolean) // error: string ~> boolean
} }
@ -293,7 +293,7 @@ if (typeof infer_stmt_next === "undefined") {
class GeneratorExamples<X> { class GeneratorExamples<X> {
*infer_stmt() { *infer_stmt() {
var x: boolean = yield 0; var x: boolean = yield 0;
return ""; return \"\";
} }
} }
var examples = new GeneratorExamples(); var examples = new GeneratorExamples();
@ -301,10 +301,10 @@ for (var x of examples.infer_stmt()) {
(x: string); (x: string);
} }
var infer_stmt_next = examples.infer_stmt().next(0).value; var infer_stmt_next = examples.infer_stmt().next(0).value;
if (typeof infer_stmt_next === "undefined") { if (typeof infer_stmt_next === \"undefined\") {
} else } else
if (typeof infer_stmt_next === "number") { if (typeof infer_stmt_next === \"number\") {
} else { } else {
(infer_stmt_next: boolean); (infer_stmt_next: boolean);
@ -315,7 +315,7 @@ if (typeof infer_stmt_next === "undefined") {
exports[`test generators.js 1`] = ` exports[`test generators.js 1`] = `
"function *stmt_yield(): Generator<number, void, void> { "function *stmt_yield(): Generator<number, void, void> {
yield 0; // ok yield 0; // ok
yield ""; // error: string ~> number yield \"\"; // error: string ~> number
} }
function *stmt_next(): Generator<void, void, 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> { function *stmt_return_err(): Generator<void, number, void> {
return ""; // error: string ~> number return \"\"; // error: string ~> number
} }
function *infer_stmt() { function *infer_stmt() {
var x: boolean = yield 0; var x: boolean = yield 0;
return ""; return \"\";
} }
for (var x of infer_stmt()) { (x : string) } // error: number ~> string for (var x of infer_stmt()) { (x : string) } // error: number ~> string
var infer_stmt_next = infer_stmt().next(0).value; // error: number ~> boolean var infer_stmt_next = infer_stmt().next(0).value; // error: number ~> boolean
if (typeof infer_stmt_next === "undefined") { if (typeof infer_stmt_next === \"undefined\") {
} else if (typeof infer_stmt_next === "number") { } else if (typeof infer_stmt_next === \"number\") {
} else { } else {
(infer_stmt_next : boolean) // error: string ~> boolean (infer_stmt_next : boolean) // error: string ~> boolean
} }
function *widen_next() { function *widen_next() {
var x = yield 0; var x = yield 0;
if (typeof x === "number") { if (typeof x === \"number\") {
} else if (typeof x === "boolean") { } else if (typeof x === \"boolean\") {
} else { } else {
(x : string) // ok, sherlock (x : string) // ok, sherlock
} }
} }
widen_next().next(0) widen_next().next(0)
widen_next().next("") widen_next().next(\"\")
widen_next().next(true) widen_next().next(true)
function *widen_yield() { function *widen_yield() {
yield 0; yield 0;
yield ""; yield \"\";
yield true; yield true;
} }
for (var x of widen_yield()) { for (var x of widen_yield()) {
if (typeof x === "number") { if (typeof x === \"number\") {
} else if (typeof x === "boolean") { } else if (typeof x === \"boolean\") {
} else { } else {
(x : string) // ok, sherlock (x : string) // ok, sherlock
} }
@ -381,11 +381,11 @@ function *delegate_next_generator() {
} }
yield *inner(); yield *inner();
} }
delegate_next_generator().next(""); delegate_next_generator().next(\"\");
function *delegate_yield_generator() { function *delegate_yield_generator() {
function *inner() { function *inner() {
yield ""; yield \"\";
} }
yield *inner(); yield *inner();
@ -396,7 +396,7 @@ for (var x of delegate_yield_generator()) {
function *delegate_return_generator() { function *delegate_return_generator() {
function *inner() { function *inner() {
return ""; return \"\";
} }
var x: number = yield *inner(); // error: string ~> number var x: number = yield *inner(); // error: string ~> number
@ -406,7 +406,7 @@ function *delegate_return_generator() {
function *delegate_next_iterable(xs: Array<number>) { function *delegate_next_iterable(xs: Array<number>) {
yield *xs; 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>) { function *delegate_yield_iterable(xs: Array<number>) {
yield *xs; yield *xs;
@ -435,7 +435,7 @@ function *multiple_return(b) {
if (b) { if (b) {
return 0; return 0;
} else { } else {
return "foo"; return \"foo\";
} }
} }
let multiple_return_result = multiple_return().next(); let multiple_return_result = multiple_return().next();
@ -464,7 +464,7 @@ if (multiple_return_result.done) {
// error: number|string ~> void // error: number|string ~> void
function* stmt_yield(): Generator<number, void, void> { function* stmt_yield(): Generator<number, void, void> {
yield 0; yield 0;
yield ""; yield \"\";
} }
function* stmt_next(): Generator<void, void, number> { function* stmt_next(): Generator<void, void, number> {
var a = yield; var a = yield;
@ -480,48 +480,48 @@ function* stmt_return_ok(): Generator<void, number, void> {
return 0; return 0;
} }
function* stmt_return_err(): Generator<void, number, void> { function* stmt_return_err(): Generator<void, number, void> {
return ""; return \"\";
} }
function* infer_stmt() { function* infer_stmt() {
var x: boolean = yield 0; var x: boolean = yield 0;
return ""; return \"\";
} }
for (var x of infer_stmt()) { for (var x of infer_stmt()) {
(x: string); (x: string);
} }
var infer_stmt_next = infer_stmt().next(0).value; var infer_stmt_next = infer_stmt().next(0).value;
if (typeof infer_stmt_next === "undefined") { if (typeof infer_stmt_next === \"undefined\") {
} else } else
if (typeof infer_stmt_next === "number") { if (typeof infer_stmt_next === \"number\") {
} else { } else {
(infer_stmt_next: boolean); (infer_stmt_next: boolean);
} }
function* widen_next() { function* widen_next() {
var x = yield 0; var x = yield 0;
if (typeof x === "number") { if (typeof x === \"number\") {
} else } else
if (typeof x === "boolean") { if (typeof x === \"boolean\") {
} else { } else {
(x: string); (x: string);
} }
} }
widen_next().next(0); widen_next().next(0);
widen_next().next(""); widen_next().next(\"\");
widen_next().next(true); widen_next().next(true);
function* widen_yield() { function* widen_yield() {
yield 0; yield 0;
yield ""; yield \"\";
yield true; yield true;
} }
for (var x of widen_yield()) { for (var x of widen_yield()) {
if (typeof x === "number") { if (typeof x === \"number\") {
} else } else
if (typeof x === "boolean") { if (typeof x === \"boolean\") {
} else { } else {
(x: string); (x: string);
@ -533,10 +533,10 @@ function* delegate_next_generator() {
} }
yield* inner(); yield* inner();
} }
delegate_next_generator().next(""); delegate_next_generator().next(\"\");
function* delegate_yield_generator() { function* delegate_yield_generator() {
function* inner() { function* inner() {
yield ""; yield \"\";
} }
yield* inner(); yield* inner();
} }
@ -545,14 +545,14 @@ for (var x of delegate_yield_generator()) {
} }
function* delegate_return_generator() { function* delegate_return_generator() {
function* inner() { function* inner() {
return ""; return \"\";
} }
var x: number = yield* inner(); var x: number = yield* inner();
} }
function* delegate_next_iterable(xs: Array<number>) { function* delegate_next_iterable(xs: Array<number>) {
yield* xs; yield* xs;
} }
delegate_next_iterable([ ]).next(""); delegate_next_iterable([ ]).next(\"\");
function* delegate_yield_iterable(xs: Array<number>) { function* delegate_yield_iterable(xs: Array<number>) {
yield* xs; yield* xs;
} }
@ -575,7 +575,7 @@ function* multiple_return(b) {
if (b) { if (b) {
return 0; return 0;
} else { } else {
return "foo"; return \"foo\";
} }
} }
let multiple_return_result = multiple_return().next(); let multiple_return_result = multiple_return().next();
@ -587,13 +587,13 @@ if (multiple_return_result.done) {
exports[`test return.js 1`] = ` exports[`test return.js 1`] = `
"function test1(gen: Generator<void, string, void>) { "function test1(gen: Generator<void, string, void>) {
// You can pass whatever you like to return, it doesn't need to be related to // You can pass whatever you like to return, it doesn\'t need to be related to
// the Generator's return type // the Generator\'s return type
var ret = gen.return(0); var ret = gen.return(0);
(ret.value: void); // error: string | number ~> void (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. // yielding or returning internally.
function *refuse_return() { function *refuse_return() {
try { try {
@ -603,15 +603,15 @@ function *refuse_return() {
} }
} }
var refuse_return_gen = 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) { if (refuse_return_result.done) {
(refuse_return_result.value: string); // error: number | void ~> string (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 // You can pass whatever you like to return, it doesn\'t need to be related to
// the Generator's return type // the Generator\'s return type
// error: string | number ~> 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. // yielding or returning internally.
// error: number | void ~> string // error: number | void ~> string
function test1(gen: Generator<void, string, void>) { function test1(gen: Generator<void, string, void>) {
@ -626,7 +626,7 @@ function* refuse_return() {
} }
} }
var refuse_return_gen = 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) { if (refuse_return_result.done) {
(refuse_return_result.value: string); (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) { if (catch_return_value !== undefined) {
(catch_return_value : string); // error: number ~> string (catch_return_value : string); // error: number ~> string
} }
@ -655,7 +655,7 @@ function *yield_return() {
yield e; yield e;
} }
} }
var yield_return_value = yield_return().throw("").value; var yield_return_value = yield_return().throw(\"\").value;
if (yield_return_value !== undefined) { if (yield_return_value !== undefined) {
(yield_return_value: string); // error: number ~> string (yield_return_value: string); // error: number ~> string
} }
@ -669,7 +669,7 @@ function* catch_return() {
return e; return e;
} }
} }
var catch_return_value = catch_return().throw("").value; var catch_return_value = catch_return().throw(\"\").value;
if (catch_return_value !== undefined) { if (catch_return_value !== undefined) {
(catch_return_value: string); (catch_return_value: string);
} }
@ -681,7 +681,7 @@ function* yield_return() {
yield e; yield e;
} }
} }
var yield_return_value = yield_return().throw("").value; var yield_return_value = yield_return().throw(\"\").value;
if (yield_return_value !== undefined) { if (yield_return_value !== undefined) {
(yield_return_value: string); (yield_return_value: string);
} }

View File

@ -36,12 +36,12 @@ class H<Z> extends G<Array<Z>> {
} }
var h1 = new H(); var h1 = new H();
h1.foo(["..."]); h1.foo([\"...\"]);
var h2:F<Array<Array<Array<number>>>> = h1; var h2:F<Array<Array<Array<number>>>> = h1;
var obj : Object<string, string> = {} // error, arity 0 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; //x:X;
/*return x;*/ /*return x;*/
@ -89,14 +89,14 @@ class H<Z> extends G<Array<Z>> {
} }
} }
var h1 = new H(); var h1 = new H();
h1.foo([ "..." ]); h1.foo([ \"...\" ]);
var h2: F<Array<Array<Array<number>>>> = h1; var h2: F<Array<Array<Array<number>>>> = h1;
var obj: Object<string, string> = {}; var obj: Object<string, string> = {};
var fn: Function<string> = function() { var fn: Function<string> = function() {
return "foo"; return \"foo\";
}; };
var fn: function<string> = function() { var fn: function<string> = function() {
return "foo"; return \"foo\";
}; };
" "
`; `;

View File

@ -1,7 +1,7 @@
exports[`test example.js 1`] = ` exports[`test example.js 1`] = `
"/* @flow */ "/* @flow */
var lib = require('./library'); var lib = require(\'./library\');
function add(a: number, b: number): number { function add(a: number, b: number): number {
return a + b; return a + b;
@ -18,7 +18,7 @@ lib.bar();
/* @flow */ /* @flow */
// t123456 // t123456
// D123456 // D123456
var lib = require("./library"); var lib = require(\"./library\");
function add(a: number, b: number): number { function add(a: number, b: number): number {
return a + b; return a + b;
} }
@ -31,23 +31,23 @@ lib.bar();
exports[`test imports.js 1`] = ` exports[`test imports.js 1`] = `
"// @flow "// @flow
import thing from "./helpers/exports_default.js"; import thing from \"./helpers/exports_default.js\";
thing; thing;
import {foo, bar as baz} from "./helpers/exports_named.js"; import {foo, bar as baz} from \"./helpers/exports_named.js\";
foo; foo;
baz; baz;
import * as things from "./helpers/exports_named.js"; import * as things from \"./helpers/exports_named.js\";
things; things;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
import thing from "./helpers/exports_default.js"; import thing from \"./helpers/exports_default.js\";
thing; thing;
import { foo, bar as baz } from "./helpers/exports_named.js"; import { foo, bar as baz } from \"./helpers/exports_named.js\";
foo; foo;
baz; baz;
import * as things from "./helpers/exports_named.js"; import * as things from \"./helpers/exports_named.js\";
things; things;
" "
`; `;

View File

@ -1,12 +1,12 @@
exports[`test exports_default.js 1`] = ` exports[`test exports_default.js 1`] = `
"// @flow "// @flow
const x = "foo"; const x = \"foo\";
export default x; export default x;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
const x = "foo"; const x = \"foo\";
export default x export default x
" "
`; `;
@ -14,11 +14,11 @@ export default x
exports[`test exports_named.js 1`] = ` exports[`test exports_named.js 1`] = `
"// @flow "// @flow
export const foo = "foo"; export const foo = \"foo\";
export const bar = "bar"; export const bar = \"bar\";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
export const foo = "foo"; export const foo = \"foo\";
export const bar = "bar"; export const bar = \"bar\";
" "
`; `;

View File

@ -1,11 +1,11 @@
exports[`test Parent.js 1`] = ` exports[`test Parent.js 1`] = `
"// @flow "// @flow
var ParentFoo = {foo: 'bar'}; var ParentFoo = {foo: \'bar\'};
module.exports = {ParentFoo}; module.exports = {ParentFoo};
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
var ParentFoo = { foo: "bar" }; var ParentFoo = { foo: \"bar\" };
module.exports = { ParentFoo }; module.exports = { ParentFoo };
" "
`; `;
@ -13,14 +13,14 @@ module.exports = { ParentFoo };
exports[`test main.js 1`] = ` exports[`test main.js 1`] = `
"// @flow "// @flow
var Parent = require('./Parent'); var Parent = require(\'./Parent\');
// Hops through destructuring // Hops through destructuring
let ParentFoo; let ParentFoo;
({ParentFoo} = Parent); ({ParentFoo} = Parent);
ParentFoo; // Points to lval in line above this ParentFoo; // Points to lval in line above this
// Follows assignment on simple/"non-destructuring" patterns // Follows assignment on simple/\"non-destructuring\" patterns
let ParentFoo2; let ParentFoo2;
ParentFoo2 = Parent; ParentFoo2 = Parent;
ParentFoo2; // Points to LHS of line above this ParentFoo2; // Points to LHS of line above this
@ -29,21 +29,21 @@ ParentFoo2; // Points to LHS of line above this
let ParentFoo3 = Parent; let ParentFoo3 = Parent;
ParentFoo3; // Points to LHS of line above this ParentFoo3; // Points to LHS of line above this
// Follows non-destructured property access of \`require('Parent')\` // Follows non-destructured property access of \`require(\'Parent\')\`
let foo = require('./Parent').ParentFoo.foo; let foo = require(\'./Parent\').ParentFoo.foo;
foo; foo;
import type {Foo} from './types'; import type {Foo} from \'./types\';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
// Hops through destructuring // Hops through destructuring
// Points to lval in line above this // 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 // Points to LHS of line above this
// Follows assignment with declaration // Follows assignment with declaration
// Points to LHS of line above this // Points to LHS of line above this
// Follows non-destructured property access of \`require('Parent')\` // Follows non-destructured property access of \`require(\'Parent\')\`
var Parent = require("./Parent"); var Parent = require(\"./Parent\");
let ParentFoo; let ParentFoo;
{ ParentFoo } = Parent; { ParentFoo } = Parent;
ParentFoo; ParentFoo;
@ -52,9 +52,9 @@ ParentFoo2 = Parent;
ParentFoo2; ParentFoo2;
let ParentFoo3 = Parent; let ParentFoo3 = Parent;
ParentFoo3; ParentFoo3;
let foo = require("./Parent").ParentFoo.foo; let foo = require(\"./Parent\").ParentFoo.foo;
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`] = ` exports[`test react.js 1`] = `
"var React = require('react'); "var React = require(\'react\');
class C extends React.Component { class C extends React.Component {
props: { x: string }; props: { x: string };
} }
let msg = "hello"; let msg = \"hello\";
(<C x={msg}/>); (<C x={msg}/>);
(<div id={msg}/>); (<div id={msg}/>);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var React = require("react"); var React = require(\"react\");
class C extends React.Component { class C extends React.Component {
props: { x: string }; props: { x: string };
} }
let msg = "hello"; let msg = \"hello\";
<C x={msg}/>; <C x={msg}/>;
<div id={msg}/>; <div id={msg}/>;
" "

View File

@ -1,5 +1,5 @@
exports[`test jsx.js 1`] = ` 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 $JSXIntrinsic<T> = Class<$React.Component<void,T,mixed>>;
type $JSXIntrinsics = { type $JSXIntrinsics = {
@ -8,7 +8,7 @@ type $JSXIntrinsics = {
}; };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// fake import // fake import
declare var $React: $Exports<"react">; declare var $React: $Exports<\"react\">;
type $JSXIntrinsic<T> = Class<$React.Component<void, T, mixed>>; type $JSXIntrinsic<T> = Class<$React.Component<void, T, mixed>>;
type $JSXIntrinsics = { type $JSXIntrinsics = {
div: $JSXIntrinsic<{ id: string }>; div: $JSXIntrinsic<{ id: string }>;

View File

@ -11,23 +11,23 @@ exports[`test b.js 1`] = `
* @flow * @flow
* @providesModule b * @providesModule b
*/ */
require('./a'); require(\'./a\');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** /**
* @flow * @flow
* @providesModule b * @providesModule b
*/ */
require("./a"); require(\"./a\");
" "
`; `;
exports[`test c.js 1`] = ` exports[`test c.js 1`] = `
"// @flow "// @flow
require('./a.js'); require(\'./a.js\');
require('b'); require(\'b\');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
require("./a.js"); require(\"./a.js\");
require("b"); require(\"b\");
" "
`; `;

View File

@ -24,10 +24,10 @@ class Foo {
get propWithSubtypingGetterAndSetterReordered(): ?number { return 4; } get propWithSubtypingGetterAndSetterReordered(): ?number { return 4; }
get propWithMismatchingGetterAndSetter(): 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; propOverriddenWithGetter: number;
get propOverriddenWithGetter() { return "hello"; } get propOverriddenWithGetter() { return \"hello\"; }
propOverriddenWithSetter: number; propOverriddenWithSetter: number;
set propOverriddenWithSetter(x: string) { } set propOverriddenWithSetter(x: string) { }
@ -47,8 +47,8 @@ foo.goodSetterNoAnnotation = 123;
foo.goodSetterWithAnnotation = 123; foo.goodSetterWithAnnotation = 123;
// TODO: Why does no annotation mean no error? // TODO: Why does no annotation mean no error?
foo.goodSetterNoAnnotation = "hello"; // Error string ~> number foo.goodSetterNoAnnotation = \"hello\"; // Error string ~> number
foo.goodSetterWithAnnotation = "hello"; // Error string ~> number foo.goodSetterWithAnnotation = \"hello\"; // Error string ~> number
var testSubtypingGetterAndSetter: number = foo.propWithSubtypingGetterAndSetter; // Error ?number ~> 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
// 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 // Test getting properties with getters
// Error number ~> string // Error number ~> string
// Error number ~> string // Error number ~> string
@ -111,7 +111,7 @@ class Foo {
} }
propOverriddenWithGetter: number; propOverriddenWithGetter: number;
get propOverriddenWithGetter() { get propOverriddenWithGetter() {
return "hello"; return \"hello\";
} }
propOverriddenWithSetter: number; propOverriddenWithSetter: number;
set propOverriddenWithSetter(x: string) { set propOverriddenWithSetter(x: string) {
@ -125,8 +125,8 @@ var testGetterWithError1: string = foo.goodGetterNoAnnotation;
var testGetterWithError2: string = foo.goodGetterWithAnnotation; var testGetterWithError2: string = foo.goodGetterWithAnnotation;
foo.goodSetterNoAnnotation = 123; foo.goodSetterNoAnnotation = 123;
foo.goodSetterWithAnnotation = 123; foo.goodSetterWithAnnotation = 123;
foo.goodSetterNoAnnotation = "hello"; foo.goodSetterNoAnnotation = \"hello\";
foo.goodSetterWithAnnotation = "hello"; foo.goodSetterWithAnnotation = \"hello\";
var testSubtypingGetterAndSetter: number = foo.propWithSubtypingGetterAndSetter; var testSubtypingGetterAndSetter: number = foo.propWithSubtypingGetterAndSetter;
var testPropOverridenWithGetter: number = foo.propOverriddenWithGetter; var testPropOverridenWithGetter: number = foo.propOverriddenWithGetter;
foo.propOverriddenWithSetter = 123; foo.propOverriddenWithSetter = 123;
@ -181,17 +181,17 @@ var testGetterWithError2: string = obj.goodGetterWithAnnotation; // Error number
obj.goodSetterNoAnnotation = 123; obj.goodSetterNoAnnotation = 123;
obj.goodSetterWithAnnotation = 123; obj.goodSetterWithAnnotation = 123;
obj.goodSetterNoAnnotation = "hello"; // Error string ~> number obj.goodSetterNoAnnotation = \"hello\"; // Error string ~> number
obj.goodSetterWithAnnotation = "hello"; // Error string ~> number obj.goodSetterWithAnnotation = \"hello\"; // Error string ~> number
var testSubtypingGetterAndSetter: number = obj.propWithSubtypingGetterAndSetter; // Error ?number ~> number var testSubtypingGetterAndSetter: number = obj.propWithSubtypingGetterAndSetter; // Error ?number ~> number
// When building this feature, it was tempting to flow the setter into the // 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. // 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 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 = var testExampleOrOrderOfGetterAndSetterReordered: number =
obj.exampleOfOrderOfGetterAndSetterReordered; // Error A ~> B obj.exampleOfOrderOfGetterAndSetterReordered; // Error A ~> B
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -210,9 +210,9 @@ var testExampleOrOrderOfGetterAndSetterReordered: number =
// Error ?number ~> number // Error ?number ~> number
// When building this feature, it was tempting to flow the setter into the // 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. // 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 // 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 // Error A ~> B
var z: number = 123; var z: number = 123;
class A {} class A {}
@ -268,8 +268,8 @@ var testGetterWithError1: string = obj.goodGetterNoAnnotation;
var testGetterWithError2: string = obj.goodGetterWithAnnotation; var testGetterWithError2: string = obj.goodGetterWithAnnotation;
obj.goodSetterNoAnnotation = 123; obj.goodSetterNoAnnotation = 123;
obj.goodSetterWithAnnotation = 123; obj.goodSetterWithAnnotation = 123;
obj.goodSetterNoAnnotation = "hello"; obj.goodSetterNoAnnotation = \"hello\";
obj.goodSetterWithAnnotation = "hello"; obj.goodSetterWithAnnotation = \"hello\";
var testSubtypingGetterAndSetter: number = obj.propWithSubtypingGetterAndSetter; var testSubtypingGetterAndSetter: number = obj.propWithSubtypingGetterAndSetter;
obj.exampleOfOrderOfGetterAndSetter = new C(); obj.exampleOfOrderOfGetterAndSetter = new C();
var testExampleOrOrderOfGetterAndSetterReordered: number = obj.exampleOfOrderOfGetterAndSetterReordered; var testExampleOrOrderOfGetterAndSetterReordered: number = obj.exampleOfOrderOfGetterAndSetterReordered;

View File

@ -1,9 +1,9 @@
exports[`test API.js 1`] = ` exports[`test API.js 1`] = `
"// @flow "// @flow
var OpenGraphObject = require('./models/OpenGraphObject.js'); var OpenGraphObject = require(\'./models/OpenGraphObject.js\');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
var OpenGraphObject = require("./models/OpenGraphObject.js"); var OpenGraphObject = require(\"./models/OpenGraphObject.js\");
" "
`; `;

View File

@ -1,29 +1,29 @@
exports[`test OpenGraphAction.js 1`] = ` exports[`test OpenGraphAction.js 1`] = `
"// @flow "// @flow
var OpenGraphValueContainer = require('./OpenGraphValueContainer.js'); var OpenGraphValueContainer = require(\'./OpenGraphValueContainer.js\');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
var OpenGraphValueContainer = require("./OpenGraphValueContainer.js"); var OpenGraphValueContainer = require(\"./OpenGraphValueContainer.js\");
" "
`; `;
exports[`test OpenGraphObject.js 1`] = ` exports[`test OpenGraphObject.js 1`] = `
"// @flow "// @flow
var OpenGraphValueContainer = require('./OpenGraphValueContainer.js'); var OpenGraphValueContainer = require(\'./OpenGraphValueContainer.js\');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
var OpenGraphValueContainer = require("./OpenGraphValueContainer.js"); var OpenGraphValueContainer = require(\"./OpenGraphValueContainer.js\");
" "
`; `;
exports[`test OpenGraphValueContainer.js 1`] = ` exports[`test OpenGraphValueContainer.js 1`] = `
"// @flow "// @flow
var OpenGraphObject = require('./OpenGraphObject.js'); var OpenGraphObject = require(\'./OpenGraphObject.js\');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
var OpenGraphObject = require("./OpenGraphObject.js"); var OpenGraphObject = require(\"./OpenGraphObject.js\");
" "
`; `;

View File

@ -4,14 +4,14 @@ exports[`test dupe1.js 1`] = `
* @providesModule Dupe * @providesModule Dupe
* @flow * @flow
*/ */
module.exports = "dupe1"; module.exports = \"dupe1\";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** /**
* Dupe provider 1/2 * Dupe provider 1/2
* @providesModule Dupe * @providesModule Dupe
* @flow * @flow
*/ */
module.exports = "dupe1"; module.exports = \"dupe1\";
" "
`; `;
@ -21,14 +21,14 @@ exports[`test dupe2.js 1`] = `
* @providesModule Dupe * @providesModule Dupe
* @flow * @flow
*/ */
module.exports = "dupe2"; module.exports = \"dupe2\";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** /**
* Dupe provider 2/2 * Dupe provider 2/2
* @providesModule Dupe * @providesModule Dupe
* @flow * @flow
*/ */
module.exports = "dupe2"; module.exports = \"dupe2\";
" "
`; `;
@ -37,12 +37,12 @@ exports[`test requires_dupe.js 1`] = `
* depends on doubly-provided module * depends on doubly-provided module
* @flow * @flow
*/ */
var dupe = require('Dupe'); var dupe = require(\'Dupe\');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** /**
* depends on doubly-provided module * depends on doubly-provided module
* @flow * @flow
*/ */
var dupe = require("Dupe"); var dupe = require(\"Dupe\");
" "
`; `;

View File

@ -3,10 +3,10 @@ exports[`test foo.js 1`] = `
/* this require routes to nothing, because /* this require routes to nothing, because
our node_modules/underscore directory our node_modules/underscore directory
has been excluded. If package.json files has been excluded. If package.json files
are being excluded properly, we'll get are being excluded properly, we\'ll get
'Required module not found'. \'Required module not found\'.
*/ */
var _ = require('underscore'); var _ = require(\'underscore\');
function foo(): string { function foo(): string {
return _.foo(); return _.foo();
@ -18,10 +18,10 @@ module.exports = foo;
/* this require routes to nothing, because /* this require routes to nothing, because
our node_modules/underscore directory our node_modules/underscore directory
has been excluded. If package.json files has been excluded. If package.json files
are being excluded properly, we'll get are being excluded properly, we\'ll get
'Required module not found'. \'Required module not found\'.
*/ */
var _ = require("underscore"); var _ = require(\"underscore\");
function foo(): string { function foo(): string {
return _.foo(); return _.foo();
} }

View File

@ -170,8 +170,8 @@ exports[`test import_type.js 1`] = `
// == Importing Class Type (Default Export) == // // == Importing Class Type (Default Export) == //
///////////////////////////////////////////////// /////////////////////////////////////////////////
import type ClassFoo1 from "./ExportDefault_Class"; import type ClassFoo1 from \"./ExportDefault_Class\";
import {foo1Inst} from "./ExportDefault_Class"; import {foo1Inst} from \"./ExportDefault_Class\";
var a1: ClassFoo1 = foo1Inst; var a1: ClassFoo1 = foo1Inst;
var a2: number = foo1Inst; // Error: ClassFoo1 ~> number 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) == // // == Importing Class Type (Named Export) == //
/////////////////////////////////////////////// ///////////////////////////////////////////////
import type {ClassFoo2} from "./ExportNamed_Class"; import type {ClassFoo2} from \"./ExportNamed_Class\";
import {foo2Inst} from "./ExportNamed_Class"; import {foo2Inst} from \"./ExportNamed_Class\";
var b1: ClassFoo2 = foo2Inst; var b1: ClassFoo2 = foo2Inst;
var b2: number = foo2Inst; // Error: ClassFoo2 ~> number 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) == // // == Importing Class Type (CJS Default Export) == //
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
import type ClassFoo3T from "./ExportCJSDefault_Class"; import type ClassFoo3T from \"./ExportCJSDefault_Class\";
import ClassFoo3 from "./ExportCJSDefault_Class"; import ClassFoo3 from \"./ExportCJSDefault_Class\";
var c1: ClassFoo3T = new ClassFoo3(); var c1: ClassFoo3T = new ClassFoo3();
new ClassFoo3T(); // Error: ClassFoo3 is not a value-identifier 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) == // // == Importing Class Type (CJS Named Export) == //
/////////////////////////////////////////////////// ///////////////////////////////////////////////////
import type {ClassFoo4, ClassFoo5} from "./ExportCJSNamed_Class"; import type {ClassFoo4, ClassFoo5} from \"./ExportCJSNamed_Class\";
import {foo4Inst, foo5Inst} from "./ExportCJSNamed_Class"; import {foo4Inst, foo5Inst} from \"./ExportCJSNamed_Class\";
var d1: ClassFoo4 = foo4Inst; var d1: ClassFoo4 = foo4Inst;
var d2: number = foo4Inst; // Error: ClassFoo4 ~> number var d2: number = foo4Inst; // Error: ClassFoo4 ~> number
new ClassFoo4(); // Error: ClassFoo4 is not a value-identifier new ClassFoo4(); // Error: ClassFoo4 is not a value-identifier
// TODO: this errors correctly, but the message is just 'can't resolve name' // 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 var d3: typeof ClassFoo5 = foo5Inst; // Error: Can\'t typeof a type alias
//////////////////////////////////////////// ////////////////////////////////////////////
// == Import Type Alias (Named Export) == // // == Import Type Alias (Named Export) == //
//////////////////////////////////////////// ////////////////////////////////////////////
import type {AliasFoo3} from "./ExportNamed_Alias"; import type {AliasFoo3} from \"./ExportNamed_Alias\";
import {givesAFoo3Obj} from "./ExportNamed_Alias"; import {givesAFoo3Obj} from \"./ExportNamed_Alias\";
var e1: AliasFoo3 = givesAFoo3Obj(); var e1: AliasFoo3 = givesAFoo3Obj();
var e2: number = givesAFoo3Obj(); // Error: AliasFoo3 ~> number 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) == // // == 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 // 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 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 == // // == 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. // // env contexts. //
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
import type ClassFoo6 from "./issue-359"; import type ClassFoo6 from \"./issue-359\";
function foo() { function foo() {
ClassFoo6; // Error: Not a value binding ClassFoo6; // Error: Not a value binding
} }
@ -267,19 +267,19 @@ function foo() {
/////////////////////////////////////////////////// ///////////////////////////////////////////////////
// Error: ClassFoo4 ~> number // Error: ClassFoo4 ~> number
// Error: ClassFoo4 is not a value-identifier // Error: ClassFoo4 is not a value-identifier
// TODO: this errors correctly, but the message is just 'can't resolve name' // TODO: this errors correctly, but the message is just \'can\'t resolve name\'
// Error: Can't typeof a type alias // Error: Can\'t typeof a type alias
//////////////////////////////////////////// ////////////////////////////////////////////
// == Import Type Alias (Named Export) == // // == Import Type Alias (Named Export) == //
//////////////////////////////////////////// ////////////////////////////////////////////
// Error: AliasFoo3 ~> number // Error: AliasFoo3 ~> number
// Error: Can't typeof a type alias // Error: Can\'t typeof a type alias
////////////////////////////////////////////// //////////////////////////////////////////////
// == Import Type Alias (Default Export) == // // == 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 // 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 With Non-Alias Compatible Value == //
/////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
@ -290,33 +290,33 @@ function foo() {
// env contexts. // // env contexts. //
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// Error: Not a value binding // Error: Not a value binding
import type ClassFoo1 from "./ExportDefault_Class"; import type ClassFoo1 from \"./ExportDefault_Class\";
import { foo1Inst } from "./ExportDefault_Class"; import { foo1Inst } from \"./ExportDefault_Class\";
var a1: ClassFoo1 = foo1Inst; var a1: ClassFoo1 = foo1Inst;
var a2: number = foo1Inst; var a2: number = foo1Inst;
new ClassFoo1(); new ClassFoo1();
import type { ClassFoo2 } from "./ExportNamed_Class"; import type { ClassFoo2 } from \"./ExportNamed_Class\";
import { foo2Inst } from "./ExportNamed_Class"; import { foo2Inst } from \"./ExportNamed_Class\";
var b1: ClassFoo2 = foo2Inst; var b1: ClassFoo2 = foo2Inst;
var b2: number = foo2Inst; var b2: number = foo2Inst;
new ClassFoo2(); new ClassFoo2();
import type ClassFoo3T from "./ExportCJSDefault_Class"; import type ClassFoo3T from \"./ExportCJSDefault_Class\";
import ClassFoo3 from "./ExportCJSDefault_Class"; import ClassFoo3 from \"./ExportCJSDefault_Class\";
var c1: ClassFoo3T = new ClassFoo3(); var c1: ClassFoo3T = new ClassFoo3();
new ClassFoo3T(); new ClassFoo3T();
import type { ClassFoo4, ClassFoo5 } from "./ExportCJSNamed_Class"; import type { ClassFoo4, ClassFoo5 } from \"./ExportCJSNamed_Class\";
import { foo4Inst, foo5Inst } from "./ExportCJSNamed_Class"; import { foo4Inst, foo5Inst } from \"./ExportCJSNamed_Class\";
var d1: ClassFoo4 = foo4Inst; var d1: ClassFoo4 = foo4Inst;
var d2: number = foo4Inst; var d2: number = foo4Inst;
new ClassFoo4(); new ClassFoo4();
var d3: typeof ClassFoo5 = foo5Inst; var d3: typeof ClassFoo5 = foo5Inst;
import type { AliasFoo3 } from "./ExportNamed_Alias"; import type { AliasFoo3 } from \"./ExportNamed_Alias\";
import { givesAFoo3Obj } from "./ExportNamed_Alias"; import { givesAFoo3Obj } from \"./ExportNamed_Alias\";
var e1: AliasFoo3 = givesAFoo3Obj(); var e1: AliasFoo3 = givesAFoo3Obj();
var e2: number = givesAFoo3Obj(); var e2: number = givesAFoo3Obj();
var e3: typeof AliasFoo3 = givesAFoo3Obj(); var e3: typeof AliasFoo3 = givesAFoo3Obj();
import type { numValue } from "./ExportsANumber"; import type { numValue } from \"./ExportsANumber\";
import type ClassFoo6 from "./issue-359"; import type ClassFoo6 from \"./issue-359\";
function foo() { function foo() {
ClassFoo6; ClassFoo6;
} }

View File

@ -152,11 +152,11 @@ exports[`test ExportNamed_Multi.js 1`] = `
"// @flow "// @flow
export var num = 42; export var num = 42;
export var str = 'asdf'; export var str = \'asdf\';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
export var num = 42; 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) == // // == Importing Class Typeof (Default Export) == //
/////////////////////////////////////////////////// ///////////////////////////////////////////////////
import typeof ClassFoo1T from "./ExportDefault_Class"; import typeof ClassFoo1T from \"./ExportDefault_Class\";
import ClassFoo1 from "./ExportDefault_Class"; import ClassFoo1 from \"./ExportDefault_Class\";
var a1: ClassFoo1T = ClassFoo1; var a1: ClassFoo1T = ClassFoo1;
var a2: ClassFoo1T = new ClassFoo1(); // Error: ClassFoo1 (inst) ~> ClassFoo1 (class) 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) == // // == Importing Class Typeof (Named Export) == //
///////////////////////////////////////////////// /////////////////////////////////////////////////
import typeof {ClassFoo2 as ClassFoo2T} from "./ExportNamed_Class"; import typeof {ClassFoo2 as ClassFoo2T} from \"./ExportNamed_Class\";
import {ClassFoo2} from "./ExportNamed_Class"; import {ClassFoo2} from \"./ExportNamed_Class\";
var b1: ClassFoo2T = ClassFoo2; var b1: ClassFoo2T = ClassFoo2;
var b2: ClassFoo2T = new ClassFoo2(); // Error: ClassFoo2 (inst) ~> ClassFoo2 (class) 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) == // // == Importing Class Typeof (CJS Default Export) == //
/////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
import typeof ClassFoo3T from "./ExportCJSDefault_Class"; import typeof ClassFoo3T from \"./ExportCJSDefault_Class\";
import ClassFoo3 from "./ExportCJSDefault_Class"; import ClassFoo3 from \"./ExportCJSDefault_Class\";
var c1: ClassFoo3T = ClassFoo3; var c1: ClassFoo3T = ClassFoo3;
var c2: ClassFoo3T = new ClassFoo3(); // Error: ClassFoo3 (inst) ~> ClassFoo3 (class) 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) == // // == Importing Class Typeof (CJS Named Export) == //
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
import typeof {ClassFoo4 as ClassFoo4T} from "./ExportCJSNamed_Class"; import typeof {ClassFoo4 as ClassFoo4T} from \"./ExportCJSNamed_Class\";
import {ClassFoo4} from "./ExportCJSNamed_Class"; import {ClassFoo4} from \"./ExportCJSNamed_Class\";
var d1: ClassFoo4T = ClassFoo4; var d1: ClassFoo4T = ClassFoo4;
var d2: ClassFoo4T = new ClassFoo4(); // Error: ClassFoo4 (inst) ~> ClassFoo4 (class) 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 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) == // // == 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 // 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 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 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 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 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 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 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 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 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 ModuleNamespaceObject == //
/////////////////////////////////////////////// ///////////////////////////////////////////////
import typeof * as ModuleNSObjT from "./ExportNamed_Multi"; import typeof * as ModuleNSObjT from \"./ExportNamed_Multi\";
var j1: ModuleNSObjT = {num: 42, str: 'asdf'}; var j1: ModuleNSObjT = {num: 42, str: \'asdf\'};
var j2: ModuleNSObjT = {num: 42, str: 42}; // Error: number ~> string 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) == // // == Import Typeof Alias (Named Export) == //
////////////////////////////////////////////// //////////////////////////////////////////////
// Error: Can't \`import typeof\` type aliases! // Error: Can\'t \`import typeof\` type aliases!
//////////////////////////////////////////////// ////////////////////////////////////////////////
// == Import Typeof Alias (Default Export) == // // == 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 // 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 With Non-Class Value (Default Export) == //
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
@ -326,39 +326,39 @@ var j2: ModuleNSObjT = {num: 42, str: 42}; // Error: number ~> string
// == Import Typeof ModuleNamespaceObject == // // == Import Typeof ModuleNamespaceObject == //
/////////////////////////////////////////////// ///////////////////////////////////////////////
// Error: number ~> string // Error: number ~> string
import typeof ClassFoo1T from "./ExportDefault_Class"; import typeof ClassFoo1T from \"./ExportDefault_Class\";
import ClassFoo1 from "./ExportDefault_Class"; import ClassFoo1 from \"./ExportDefault_Class\";
var a1: ClassFoo1T = ClassFoo1; var a1: ClassFoo1T = ClassFoo1;
var a2: ClassFoo1T = new ClassFoo1(); var a2: ClassFoo1T = new ClassFoo1();
new ClassFoo1T(); new ClassFoo1T();
import typeof { ClassFoo2 as ClassFoo2T } from "./ExportNamed_Class"; import typeof { ClassFoo2 as ClassFoo2T } from \"./ExportNamed_Class\";
import { ClassFoo2 } from "./ExportNamed_Class"; import { ClassFoo2 } from \"./ExportNamed_Class\";
var b1: ClassFoo2T = ClassFoo2; var b1: ClassFoo2T = ClassFoo2;
var b2: ClassFoo2T = new ClassFoo2(); var b2: ClassFoo2T = new ClassFoo2();
new ClassFoo2T(); new ClassFoo2T();
import typeof ClassFoo3T from "./ExportCJSDefault_Class"; import typeof ClassFoo3T from \"./ExportCJSDefault_Class\";
import ClassFoo3 from "./ExportCJSDefault_Class"; import ClassFoo3 from \"./ExportCJSDefault_Class\";
var c1: ClassFoo3T = ClassFoo3; var c1: ClassFoo3T = ClassFoo3;
var c2: ClassFoo3T = new ClassFoo3(); var c2: ClassFoo3T = new ClassFoo3();
import typeof { ClassFoo4 as ClassFoo4T } from "./ExportCJSNamed_Class"; import typeof { ClassFoo4 as ClassFoo4T } from \"./ExportCJSNamed_Class\";
import { ClassFoo4 } from "./ExportCJSNamed_Class"; import { ClassFoo4 } from \"./ExportCJSNamed_Class\";
var d1: ClassFoo4T = ClassFoo4; var d1: ClassFoo4T = ClassFoo4;
var d2: ClassFoo4T = new ClassFoo4(); var d2: ClassFoo4T = new ClassFoo4();
import typeof { AliasFoo3 } from "./ExportNamed_Alias"; import typeof { AliasFoo3 } from \"./ExportNamed_Alias\";
import typeof num_default from "./ExportDefault_Number"; import typeof num_default from \"./ExportDefault_Number\";
var f1: num_default = 42; var f1: num_default = 42;
var f2: num_default = "asdf"; var f2: num_default = \"asdf\";
import typeof { num as num_named } from "./ExportNamed_Number"; import typeof { num as num_named } from \"./ExportNamed_Number\";
var g1: num_named = 42; var g1: num_named = 42;
var g2: num_named = "asdf"; var g2: num_named = \"asdf\";
import typeof num_cjs_default from "./ExportCJSDefault_Number"; import typeof num_cjs_default from \"./ExportCJSDefault_Number\";
var h1: num_cjs_default = 42; var h1: num_cjs_default = 42;
var h2: num_cjs_default = "asdf"; var h2: num_cjs_default = \"asdf\";
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 i1: num_cjs_named = 42;
var i2: num_cjs_named = "asdf"; var i2: num_cjs_named = \"asdf\";
import typeof * as ModuleNSObjT from "./ExportNamed_Multi"; import typeof * as ModuleNSObjT from \"./ExportNamed_Multi\";
var j1: ModuleNSObjT = { num: 42, str: "asdf" }; var j1: ModuleNSObjT = { num: 42, str: \"asdf\" };
var j2: ModuleNSObjT = { num: 42, str: 42 }; var j2: ModuleNSObjT = { num: 42, str: 42 };
" "
`; `;

View File

@ -1,10 +1,10 @@
exports[`test baz.js 1`] = ` exports[`test baz.js 1`] = `
"/* @flow */ "/* @flow */
var x: number = "not a number" // Error string ~> number var x: number = \"not a number\" // Error string ~> number
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* @flow */ /* @flow */
// Error string ~> number // Error string ~> number
var x: number = "not a number"; var x: number = \"not a number\";
" "
`; `;

View File

@ -11,12 +11,12 @@ exports[`test b.js 1`] = `
@flow @flow
*/ */
var A = require('IncrModuleA'); var A = require(\'IncrModuleA\');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* @providesModule IncrModuleB /* @providesModule IncrModuleB
@flow @flow
*/ */
var A = require("IncrModuleA"); var A = require(\"IncrModuleA\");
" "
`; `;

View File

@ -11,12 +11,12 @@ module.exports = a;
exports[`test b.js 1`] = ` exports[`test b.js 1`] = `
"// @flow "// @flow
var a = require('./a'); var a = require(\'./a\');
var b: number = a; var b: number = a;
module.exports = b; module.exports = b;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
var a = require("./a"); var a = require(\"./a\");
var b: number = a; var b: number = a;
module.exports = b; module.exports = b;
" "
@ -24,12 +24,12 @@ module.exports = b;
exports[`test c.js 1`] = ` exports[`test c.js 1`] = `
"// @flow "// @flow
var b = require('./b'); var b = require(\'./b\');
var c: string = b; var c: string = b;
module.exports = c; module.exports = c;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
var b = require("./b"); var b = require(\"./b\");
var c: string = b; var c: string = b;
module.exports = c; module.exports = c;
" "

View File

@ -1,11 +1,11 @@
exports[`test b.js 1`] = ` exports[`test b.js 1`] = `
"// @flow "// @flow
var a = require('./a'); var a = require(\'./a\');
var b = a; var b = a;
module.exports = b; module.exports = b;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
var a = require("./a"); var a = require(\"./a\");
var b = a; var b = a;
module.exports = b; module.exports = b;
" "

View File

@ -1,11 +1,11 @@
exports[`test b.js 1`] = ` exports[`test b.js 1`] = `
"// @flow "// @flow
var a = require('./a'); var a = require(\'./a\');
var b: number = a; var b: number = a;
module.exports = b; module.exports = b;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
var a = require("./a"); var a = require(\"./a\");
var b: number = a; var b: number = a;
module.exports = b; module.exports = b;
" "

View File

@ -19,8 +19,8 @@ module.exports = A;
exports[`test B.js 1`] = ` exports[`test B.js 1`] = `
"// @flow "// @flow
var A = require ('./A'); var A = require (\'./A\');
import type C from './C'; import type C from \'./C\';
class B extends A { class B extends A {
c: C; c: C;
@ -29,8 +29,8 @@ class B extends A {
module.exports = B; module.exports = B;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
var A = require("./A"); var A = require(\"./A\");
import type C from "./C"; import type C from \"./C\";
class B extends A { class B extends A {
c: C; c: C;
} }
@ -40,8 +40,8 @@ module.exports = B;
exports[`test C.js 1`] = ` exports[`test C.js 1`] = `
"// @flow "// @flow
var A = require ('./A'); var A = require (\'./A\');
import type B from './B'; import type B from \'./B\';
class C extends A { class C extends A {
b: B; b: B;
@ -50,8 +50,8 @@ class C extends A {
module.exports = C; module.exports = C;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
var A = require("./A"); var A = require(\"./A\");
import type B from "./B"; import type B from \"./B\";
class C extends A { class C extends A {
b: B; b: B;
} }

View File

@ -1,21 +1,21 @@
exports[`test B.js 1`] = ` exports[`test B.js 1`] = `
"// @flow "// @flow
var A = require ('./A'); var A = require (\'./A\');
import type C from './C'; import type C from \'./C\';
export type B = string; export type B = string;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
var A = require("./A"); var A = require(\"./A\");
import type C from "./C"; import type C from \"./C\";
export type B = string; export type B = string;
" "
`; `;
exports[`test C.js 1`] = ` exports[`test C.js 1`] = `
"// @flow "// @flow
var A = require ('./A'); var A = require (\'./A\');
import type { B } from './B' import type { B } from \'./B\'
class C extends A { class C extends A {
b: B; b: B;
@ -24,8 +24,8 @@ class C extends A {
module.exports = C; module.exports = C;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
var A = require("./A"); var A = require(\"./A\");
import type { B } from "./B"; import type { B } from \"./B\";
class C extends A { class C extends A {
b: B; b: B;
} }

View File

@ -1,13 +1,13 @@
exports[`test B.js 1`] = ` exports[`test B.js 1`] = `
"// @flow "// @flow
var A = require ('./A'); var A = require (\'./A\');
//import type C from './C'; //import type C from \'./C\';
export type B = string; export type B = string;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
//import type C from './C'; //import type C from \'./C\';
var A = require("./A"); var A = require(\"./A\");
export type B = string; export type B = string;
" "
`; `;

View File

@ -1,14 +1,14 @@
exports[`test B.js 1`] = ` exports[`test B.js 1`] = `
"// @flow "// @flow
var A = require ('./A'); var A = require (\'./A\');
import type C from './C'; import type C from \'./C\';
export type B = string; export type B = string;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
var A = require("./A"); var A = require(\"./A\");
import type C from "./C"; import type C from \"./C\";
export type B = string; export type B = string;
" "
`; `;

View File

@ -11,12 +11,12 @@ module.exports = a;
exports[`test b.js 1`] = ` exports[`test b.js 1`] = `
"// @flow "// @flow
var a = require('./a'); var a = require(\'./a\');
var b: number = a; var b: number = a;
module.exports = b; module.exports = b;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
var a = require("./a"); var a = require(\"./a\");
var b: number = a; var b: number = a;
module.exports = b; module.exports = b;
" "
@ -24,12 +24,12 @@ module.exports = b;
exports[`test c.js 1`] = ` exports[`test c.js 1`] = `
"// @flow "// @flow
var b = require('./b'); var b = require(\'./b\');
var c: string = b; var c: string = b;
module.exports = c; module.exports = c;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow // @flow
var b = require("./b"); var b = require(\"./b\");
var c: string = b; var c: string = b;
module.exports = c; module.exports = c;
" "
@ -41,14 +41,14 @@ exports[`test dupe1.js 1`] = `
* @providesModule Dupe * @providesModule Dupe
* @flow * @flow
*/ */
module.exports = "dupe1"; module.exports = \"dupe1\";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** /**
* Dupe provider 1/2 * Dupe provider 1/2
* @providesModule Dupe * @providesModule Dupe
* @flow * @flow
*/ */
module.exports = "dupe1"; module.exports = \"dupe1\";
" "
`; `;
@ -58,14 +58,14 @@ exports[`test dupe2.js 1`] = `
* @providesModule Dupe * @providesModule Dupe
* @flow * @flow
*/ */
module.exports = "dupe2"; module.exports = \"dupe2\";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** /**
* Dupe provider 2/2 * Dupe provider 2/2
* @providesModule Dupe * @providesModule Dupe
* @flow * @flow
*/ */
module.exports = "dupe2"; module.exports = \"dupe2\";
" "
`; `;
@ -74,13 +74,13 @@ exports[`test requires_dupe.js 1`] = `
* depends on doubly-provided module * depends on doubly-provided module
* @flow * @flow
*/ */
var dupe = require('Dupe'); var dupe = require(\'Dupe\');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** /**
* depends on doubly-provided module * depends on doubly-provided module
* @flow * @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 * depends on an unchecked module, which will be deleted
* @flow * @flow
*/ */
var unchecked = require('Unchecked'); var unchecked = require(\'Unchecked\');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** /**
* depends on an unchecked module, which will be deleted * depends on an unchecked module, which will be deleted
* @flow * @flow
*/ */
var unchecked = require("Unchecked"); var unchecked = require(\"Unchecked\");
" "
`; `;
@ -104,12 +104,12 @@ exports[`test unchecked.js 1`] = `
* Not a flow module. * Not a flow module.
* @providesModule Unchecked * @providesModule Unchecked
*/ */
module.exports = "unchecked"; module.exports = \"unchecked\";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** /**
* Not a flow module. * Not a flow module.
* @providesModule Unchecked * @providesModule Unchecked
*/ */
module.exports = "unchecked"; module.exports = \"unchecked\";
" "
`; `;

View File

@ -2,13 +2,13 @@ exports[`test test.js 1`] = `
"/** "/**
* @flow * @flow
*/ */
var data = require('./data'); var data = require(\'./data\');
var x: number = data.x; var x: number = data.x;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** /**
* @flow * @flow
*/ */
var data = require("./data"); var data = require(\"./data\");
var x: number = data.x; var x: number = data.x;
" "
`; `;

Some files were not shown because too many files have changed in this diff Show More