- 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.
35 lines
374 B
JavaScript
35 lines
374 B
JavaScript
/***
|
|
* unions with embedded intersections
|
|
* @flow
|
|
*/
|
|
|
|
type t1 = {
|
|
p1 : number
|
|
};
|
|
|
|
type t2 = {
|
|
p2: number
|
|
}
|
|
|
|
type t3 = {
|
|
p3 : number
|
|
}
|
|
|
|
type intersected = t1 & t2;
|
|
type union = intersected | t3;
|
|
type union2 = t3 | intersected;
|
|
|
|
const u1 : union = {
|
|
p3 : 3
|
|
};
|
|
|
|
const u2 : union = {
|
|
p1 : 1,
|
|
p2 : 2
|
|
};
|
|
|
|
const u3 : union2 = {
|
|
p1 : 1,
|
|
p2 : 2
|
|
};
|