Files
test-repo/tests/flow/object-method/test3.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

19 lines
382 B
JavaScript

/* @flow */
function foo() {
this.m();
}
function bar(f: () => void) {
f(); // passing global object as `this`
({ f }).f(); // passing container object as `this`
}
bar(foo); // error, since `this` is used non-trivially in `foo`
function qux(o: { f: () => void }) {
o.f(); // passing o as `this`
}
qux({ f: foo }); // error, since `this` is used non-trivially in `foo`