Update flow to 0.40 (#808)

This fixes the bug with comments swapped between `/*` and `//`

Fixes #755
master
Christopher Chedeau 2017-02-24 15:46:20 -08:00 committed by GitHub
parent b32ace8934
commit 1b9234a8c4
16 changed files with 33 additions and 35 deletions

View File

@ -21,7 +21,7 @@
"babylon": "6.15.0",
"chalk": "1.1.3",
"esutils": "2.0.2",
"flow-parser": "0.38.0",
"flow-parser": "0.40.0",
"get-stdin": "5.0.1",
"glob": "7.1.1",
"jest-validate": "19.0.0",

View File

@ -497,14 +497,14 @@ Observable.of(process)
.takeUntil(throwOnError ? errors.flatMap(Observable.throw) : errors)
.takeUntil(exit);
/* Comments disappear inside of JSX*/
// Comments disappear inside of JSX
<div>
{/* Some comment */}
</div>;
/* Comments in JSX tag are placed in a non optimal way*/
// Comments in JSX tag are placed in a non optimal way
<div
/* comment*/
// comment
/>;
// Comments disappear in empty blocks
@ -1021,7 +1021,7 @@ function c() {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function a() {
return (
/* Comment*/
// Comment
<div />
);
}

View File

@ -115,7 +115,7 @@ type Foo = {
a: string, // exists in TestClass
b: string, // doesn't exist
c?: ?string, // exists in TestClass, optional
d?: number /* doesn't exist*/
d?: number // doesn't exist
};
class TestClass {

View File

@ -44,8 +44,8 @@ interface IFooPrototype {
}
interface IFoo extends IFooPrototype {
static (): void,
x: boolean /* error, should have declared x: number instead*/,
static y: boolean /* error, should have declared static y: number instead*/
x: boolean, // error, should have declared x: number instead
static y: boolean // error, should have declared static y: number instead
}
exports.Foo2 = (Foo: Class<IFoo>);
"

View File

@ -990,7 +990,7 @@ export type BinaryOperator =
| \\"*\\"
| \\"/\\"
| \\"%\\"
| \\"&\\" /* TODO Missing from the Parser API.*/
| \\"&\\" // TODO Missing from the Parser API.
| \\"|\\"
| \\"^\\"
| \\"in\\"

View File

@ -101,7 +101,7 @@ let tests = [
function() {
({}: {
[k1: string]: string,
[k2: number]: number /* error: not supported (yet)*/
[k2: number]: number // error: not supported (yet)
});
}
];

View File

@ -29,7 +29,7 @@ interface Ok {
interface Bad {
[k1: string]: string,
[k2: number]: number /* error: not supported (yet)*/
[k2: number]: number // error: not supported (yet)
}
"
`;

View File

@ -79,12 +79,12 @@ var Div = \\"div\\";
var Bad = \\"bad\\";
var Str: string = \\"str\\";
<Div />; /* This is fine*/
<Bad />; /* This is fine*/
<Div />; // This is fine
<Bad />; // This is fine
<Str />; // This is fine
React.createElement(\\"div\\", {}); // This is fine
React.createElement(\\"bad\\", {}); /* This is fine*/
React.createElement(\\"bad\\", {}); // This is fine
<Div id={42} />; // This is fine
"

View File

@ -30,9 +30,7 @@ class CustomComponent extends React.Component {
}
var a: React.Element<{ prop: string }> = <CustomComponent prop=\\"asdf\\" />;
var b: React.Element<{ prop1: string }> = (
<CustomComponent prop=\\"asdf\\" />
); /* Error: Props<{prop}> ~> Props<{prop1}>*/
var b: React.Element<{ prop1: string }> = <CustomComponent prop=\\"asdf\\" />; // Error: Props<{prop}> ~> Props<{prop1}>
<div id=\\"asdf\\" />;
<div id={42} />; // Error: (\`id\` prop) number ~> string
@ -69,15 +67,15 @@ var Div = \\"div\\";
var Bad = \\"bad\\";
var Str: string = \\"str\\";
<Div />; /* This is fine*/
<Bad />; /* Error: 'bad' not in JSXIntrinsics*/
<Div />; // This is fine
<Bad />; // Error: 'bad' not in JSXIntrinsics
<Str />; // Error: string ~> keys of JSXIntrinsics
React.createElement(\\"div\\", {}); // This is fine
React.createElement(\\"bad\\", {}); // Error: 'bad' not in JSXIntrinsics
React.createElement(Str, {}); /* Error: string ~> keys of JSXIntrinsics*/
React.createElement(Str, {}); // Error: string ~> keys of JSXIntrinsics
/* TODO: Make this an error*/
// TODO: Make this an error
<Div id={42} />; // Not an error but should be eventually
"
`;

View File

@ -175,8 +175,8 @@ var D = React.createClass({
});
<D
namee=\\"foo\\" /* error (as usual)*/
titlee=\\"bar\\" /* OK (error ignored when spread is used)*/
namee=\\"foo\\" // error (as usual)
titlee=\\"bar\\" // OK (error ignored when spread is used)
/>;
"
`;

View File

@ -417,7 +417,7 @@ class HelloMessage extends React.Component {
props: { name: string };
}
<HelloMessage name={007} />; /* number ~/~> string error*/
<HelloMessage name={007} />; // number ~/~> string error
<HelloMessage name=\\"Bond\\" />; // ok
"
`;
@ -785,7 +785,7 @@ class JDiv extends React.Component {
};
}
/* Should be a type error ('id' takes a string, not a number..)*/
// Should be a type error ('id' takes a string, not a number..)
<JDiv id={42} />;
class Example extends React.Component {

View File

@ -173,7 +173,7 @@ class MyReactThing extends React.Component {
}
}
<MyReactThing />; /* works*/
<MyReactThing />; // works
<MyReactThing foo={undefined} />; // also works
"
`;

View File

@ -18,8 +18,8 @@ var Z = 0;
import React from \\"react\\";
function F(props: { foo: string }) {}
<F />; /* error: missing \`foo\`*/
<F foo={0} />; /* error: number ~> string*/
<F />; // error: missing \`foo\`
<F foo={0} />; // error: number ~> string
<F foo=\\"\\" />; // ok
// props subtyping is property-wise covariant

View File

@ -34,10 +34,10 @@ declare class DoublyLinkedList extends LinkedList {
declare module \\"mini-immutable\\" {
declare class Map<K, V> {
set(key: K, value: V): this /* more precise than Map<K,V> (see below)*/
set(key: K, value: V): this // more precise than Map<K,V> (see below)
}
declare class OrderedMap<K, V> extends Map<K, V> {
/* inherits set method returning OrderedMap<K,V> instead of Map<K,V>*/
// inherits set method returning OrderedMap<K,V> instead of Map<K,V>
}
}
"

View File

@ -23,8 +23,8 @@ declare class Baz<T> {
((new Foo).z: number); // error: Qux wins
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
declare class Foo extends Qux<string> {
/* KeyedCollection <: Collection*/
/* ...KeyedIterable*/
// KeyedCollection <: Collection
// ...KeyedIterable
}
declare class Bar<T> extends Baz<T> {
// KeyedIterable <: Iterable

View File

@ -900,9 +900,9 @@ find-up@^2.1.0:
dependencies:
locate-path "^2.0.0"
flow-parser@0.38.0:
version "0.38.0"
resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.38.0.tgz#a631c46170c5b42400d905a75cfc83ce8db29424"
flow-parser@0.40.0:
version "0.40.0"
resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.40.0.tgz#b3444742189093323c4319c4fe9d35391f46bcbc"
dependencies:
ast-types "0.8.18"
colors ">=0.6.2"