// Test backward type propagation // Functions that use typed ops on parameters should have // parameter types inferred and type checks eliminated var sum_ints = function(a, b, c) { return a + b + c } var count_down = function(n) { var i = n var total = 0 while (i > 0) { total = total + i i = i - 1 } return total } var concat_all = function(a, b, c) { return a + b + c } if (sum_ints(1, 2, 3) != 6) { log.error("FAIL sum_ints") } if (count_down(5) != 15) { log.error("FAIL count_down") } if (concat_all("a", "b", "c") != "abc") { log.error("FAIL concat_all") } log.test("backward type tests passed")