- This brings in the flow test suite that contains a ton of JavaScript parsing edge cases - This creates snapshot tests using the pretty printer for all of them - If uncomment `RUN_AST_TESTS` line in `tests/run_specs.js`, it checks ast(pretty_print(x)) == ast(x). Right now, "178 failed, 197 passed, 375 of 377 total". So half of the tests are not passing, most of them are crashes and many of the rest are subtle issues.
22 lines
530 B
JavaScript
22 lines
530 B
JavaScript
// passing a union-like thing into an overload is ok
|
|
// if overload handles each branch of union-like thing
|
|
|
|
// unions
|
|
declare function f(x: string): void;
|
|
declare function f(x: number): void;
|
|
declare var x_f: string | number;
|
|
f(x_f); // ok
|
|
|
|
// maybe
|
|
declare function g(x: null): void;
|
|
declare function g(x: void): void;
|
|
declare function g(x: string): void;
|
|
declare var x_g: ?string;
|
|
g(x_g); // ok
|
|
|
|
// optional
|
|
declare function h(x: void): void;
|
|
declare function h(x: string): void;
|
|
declare var x_h: {p?: string};
|
|
h(x_h.p); // ok
|