- 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.
21 lines
449 B
JavaScript
21 lines
449 B
JavaScript
// @flow
|
|
|
|
class Base {}
|
|
class Middle extends Base {}
|
|
class Child extends Middle {}
|
|
|
|
class C<T: Middle> {
|
|
meth(a: T): T {
|
|
return a;
|
|
}
|
|
}
|
|
|
|
// T is implicitly (bounded by) Middle in constructor call if not provided.
|
|
// Explicit type arg is required in annotation - here a wildcard captures it.
|
|
var a: C<*> = new C();
|
|
|
|
a.meth(new Middle());
|
|
a.meth(new Child());
|
|
a.meth(42); // Error: number ~> Middle
|
|
a.meth(new Base()); // Error: Base ~> Middle
|