Files
test-repo/tests/flow/taint/adder.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

32 lines
822 B
JavaScript

// @flow
function f(x : $Tainted<number>, y : $Tainted<number>) {
var z : $Tainted<number> = x + y;
}
function f1(x : $Tainted<number>, y : number) {
var z : $Tainted<number> = x + y;
}
function f2(x : number, y : $Tainted<number>) {
var z : $Tainted<number> = x + y;
}
// This should cause an error.
function f3(x : $Tainted<number>, y : number) {
var z : number = x + y;
}
// This should cause an error.
function f4(x : number, y : $Tainted<number>) {
var z : number = x + y;
}
// This should cause an error.
function f5(x : number, y : $Tainted<number>) {
var z : string = x + y;
}
// This should cause an error.
function f6(x : string, y : $Tainted<number>) {
var z : string = x + y;
}
// This should cause an error.
function f7(x : $Tainted<string>, y : $Tainted<number>) {
var z : string = x + y;
}