Files
test-repo/tests/flow/generators/class_failure.js
T
Christopher Chedeau 3375cfe605 Move tests around (#454)
* new_tests

* move_all_clobbered_tests

* remove all the tests that no longer exist

* re-run flow tests

* Move all the flow tests to tests/flow and prettier to tests/

* Move prettier tests to their own folders

* Add jsfmt files

* run prettier snapshot tests
2017-01-24 14:35:37 -08:00

21 lines
545 B
JavaScript

// generalization of failure in class.js
class GeneratorExamples<X> {
*infer_stmt() {
var x: boolean = yield 0; // error: number ~> boolean
return "";
}
}
var examples = new GeneratorExamples();
for (var x of examples.infer_stmt()) { (x : string) } // error: number ~> string
var infer_stmt_next = examples.infer_stmt().next(0).value; // error: number ~> boolean
if (typeof infer_stmt_next === "undefined") {
} else if (typeof infer_stmt_next === "number") {
} else {
(infer_stmt_next : boolean) // error: string ~> boolean
}