2016-12-23 22:31:38 +03:00
|
|
|
function test1(x: number): number {
|
|
|
|
return -x;
|
|
|
|
}
|
|
|
|
|
|
|
|
function test2(x: string): number {
|
|
|
|
return -x;
|
|
|
|
}
|
|
|
|
|
|
|
|
// sanity checks to make sure merging envs doesn't keep creating new NumT's
|
|
|
|
// because of the UnaryMinusT's, causing nontermination
|
|
|
|
function test3(x: number, flip_times: number): number {
|
|
|
|
for (var i = 0; i < flip_times; i++) {
|
|
|
|
x = -x;
|
|
|
|
}
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
function test4(flip_times: number): number {
|
|
|
|
var x = 1;
|
|
|
|
for (var i = 0; i < flip_times; i++) {
|
|
|
|
x = -x;
|
|
|
|
}
|
|
|
|
return x;
|
|
|
|
}
|
2017-01-13 22:01:21 +03:00
|
|
|
|
|
|
|
// parentheses around numeric literal should be preserved
|
|
|
|
function test5(): string {
|
|
|
|
return (100).toString();
|
|
|
|
}
|