29 lines
835 B
Text
29 lines
835 B
Text
=== tests/cases/compiler/unaryPlus.ts ===
|
|
// allowed per spec
|
|
var a = +1;
|
|
>a : Symbol(a, Decl(unaryPlus.ts, 1, 3))
|
|
|
|
var b = +(<any>"");
|
|
>b : Symbol(b, Decl(unaryPlus.ts, 2, 3))
|
|
|
|
enum E { some, thing };
|
|
>E : Symbol(E, Decl(unaryPlus.ts, 2, 19))
|
|
>some : Symbol(E.some, Decl(unaryPlus.ts, 3, 8))
|
|
>thing : Symbol(E.thing, Decl(unaryPlus.ts, 3, 14))
|
|
|
|
var c = +E.some;
|
|
>c : Symbol(c, Decl(unaryPlus.ts, 4, 3))
|
|
>E.some : Symbol(E.some, Decl(unaryPlus.ts, 3, 8))
|
|
>E : Symbol(E, Decl(unaryPlus.ts, 2, 19))
|
|
>some : Symbol(E.some, Decl(unaryPlus.ts, 3, 8))
|
|
|
|
// also allowed, used to be errors
|
|
var x = +"3"; //should be valid
|
|
>x : Symbol(x, Decl(unaryPlus.ts, 7, 3))
|
|
|
|
var y = -"3"; // should be valid
|
|
>y : Symbol(y, Decl(unaryPlus.ts, 8, 3))
|
|
|
|
var z = ~"3"; // should be valid
|
|
>z : Symbol(z, Decl(unaryPlus.ts, 9, 3))
|
|
|