=== tests/cases/compiler/castExpressionParentheses.ts === declare var a; >a : Symbol(a, Decl(castExpressionParentheses.ts, 0, 11)) // parentheses should be omitted // literals ({a:0}); >a : Symbol(a, Decl(castExpressionParentheses.ts, 4, 7)) ([1,3,]); ("string"); (23.0); (/regexp/g); (false); (true); (null); // names and dotted names (this); (this.x); ((a).x); >a : Symbol(a, Decl(castExpressionParentheses.ts, 0, 11)) (a); >a : Symbol(a, Decl(castExpressionParentheses.ts, 0, 11)) (a[0]); >a : Symbol(a, Decl(castExpressionParentheses.ts, 0, 11)) (a.b["0"]); >a : Symbol(a, Decl(castExpressionParentheses.ts, 0, 11)) (a()).x; >a : Symbol(a, Decl(castExpressionParentheses.ts, 0, 11)) declare var A; >A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11)) // should keep the parentheses in emit (new A).foo; >A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11)) (typeof A).x; >A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11)) (-A).x; >A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11)) new (A()); >A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11)) (()=> {})(); >Tany : Symbol(Tany, Decl(castExpressionParentheses.ts, 28, 2)) (function foo() { })(); >foo : Symbol(foo, Decl(castExpressionParentheses.ts, 29, 6)) (-A).x; >A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11)) // nested cast, should keep one pair of parenthese ((-A)).x; >A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11)) // nested parenthesized expression, should keep one pair of parenthese ((A)) >A : Symbol(A, Decl(castExpressionParentheses.ts, 21, 11))