- 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
587 B
JavaScript
22 lines
587 B
JavaScript
// @flow
|
|
var num = require('./import');
|
|
function foo(x) { }
|
|
foo(0);
|
|
var a:string = num;
|
|
|
|
function unannotated(x) {
|
|
return x;
|
|
}
|
|
|
|
// test deduping of inferred types
|
|
const nullToUndefined = val => val === null ? undefined : val;
|
|
|
|
function f0(x: ?Object) { return nullToUndefined(x); }
|
|
function f1(x: ?Object) { return nullToUndefined(x); }
|
|
function f2(x: ?string) { return nullToUndefined(x); }
|
|
function f3(x: ?string) { return nullToUndefined(x); }
|
|
|
|
declare var idx: $Facebookism$Idx;
|
|
declare var obj: {a?: {b: ?{c: null | {d: number}}}};
|
|
const idxResult = idx(obj, obj => obj.a.b.c.d);
|