mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-10 01:43:59 -05:00
parenthesized exponentiation with template string
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
//// [emitExponentiationOperatorInTempalteString4ES6.ts]
|
||||
|
||||
var t1 = 10;
|
||||
var t2 = 10;
|
||||
var s;
|
||||
|
||||
// With TemplateTail
|
||||
`${t1 ** -t2} world`;
|
||||
`${(-t1) ** t2 - t1} world`;
|
||||
`${(-++t1) ** t2 - t1} world`;
|
||||
`${(-t1++) ** t2 - t1} world`;
|
||||
`${(~t1) ** t2 ** --t1 } world`;
|
||||
`${typeof (t1 ** t2 ** t1) } world`;
|
||||
|
||||
// TempateHead & TemplateTail are empt
|
||||
`${t1 ** -t2} hello world ${t1 ** -t2}`;
|
||||
`${(-t1) ** t2 - t1} hello world ${(-t1) ** t2 - t1}`;
|
||||
`${(-++t1) ** t2 - t1} hello world ${t1 ** (-++t1) **- t1}`;
|
||||
`${(-t1++) ** t2 - t1} hello world ${t2 ** (-t1++) ** - t1}`;
|
||||
`${(~t1) ** t2 ** --t1 } hello world ${(~t1) ** t2 ** --t1 }`;
|
||||
`${typeof (t1 ** t2 ** t1)} hello world ${typeof (t1 ** t2 ** t1)}`;
|
||||
|
||||
// With templateHead
|
||||
`hello ${(-t1) ** t2 - t1}`;
|
||||
`hello ${(-++t1) ** t2 - t1}`;
|
||||
`hello ${(-t1++) ** t2 - t1}`;
|
||||
`hello ${(~t1) ** t2 ** --t1 }`;
|
||||
`hello ${typeof (t1 ** t2 ** t1)}`;
|
||||
|
||||
//// [emitExponentiationOperatorInTempalteString4ES6.js]
|
||||
var t1 = 10;
|
||||
var t2 = 10;
|
||||
var s;
|
||||
// With TemplateTail
|
||||
`${Math.pow(t1, -t2)} world`;
|
||||
`${Math.pow((-t1), t2) - t1} world`;
|
||||
`${Math.pow((-++t1), t2) - t1} world`;
|
||||
`${Math.pow((-t1++), t2) - t1} world`;
|
||||
`${Math.pow((~t1), Math.pow(t2, --t1))} world`;
|
||||
`${typeof (Math.pow(t1, Math.pow(t2, t1)))} world`;
|
||||
// TempateHead & TemplateTail are empt
|
||||
`${Math.pow(t1, -t2)} hello world ${Math.pow(t1, -t2)}`;
|
||||
`${Math.pow((-t1), t2) - t1} hello world ${Math.pow((-t1), t2) - t1}`;
|
||||
`${Math.pow((-++t1), t2) - t1} hello world ${Math.pow(t1, Math.pow((-++t1), -t1))}`;
|
||||
`${Math.pow((-t1++), t2) - t1} hello world ${Math.pow(t2, Math.pow((-t1++), -t1))}`;
|
||||
`${Math.pow((~t1), Math.pow(t2, --t1))} hello world ${Math.pow((~t1), Math.pow(t2, --t1))}`;
|
||||
`${typeof (Math.pow(t1, Math.pow(t2, t1)))} hello world ${typeof (Math.pow(t1, Math.pow(t2, t1)))}`;
|
||||
// With templateHead
|
||||
`hello ${Math.pow((-t1), t2) - t1}`;
|
||||
`hello ${Math.pow((-++t1), t2) - t1}`;
|
||||
`hello ${Math.pow((-t1++), t2) - t1}`;
|
||||
`hello ${Math.pow((~t1), Math.pow(t2, --t1))}`;
|
||||
`hello ${typeof (Math.pow(t1, Math.pow(t2, t1)))}`;
|
||||
@@ -0,0 +1,114 @@
|
||||
=== tests/cases/conformance/es7/exponentiationOperator/emitExponentiationOperatorInTempalteString4ES6.ts ===
|
||||
|
||||
var t1 = 10;
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
|
||||
var t2 = 10;
|
||||
>t2 : Symbol(t2, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 2, 3))
|
||||
|
||||
var s;
|
||||
>s : Symbol(s, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 3, 3))
|
||||
|
||||
// With TemplateTail
|
||||
`${t1 ** -t2} world`;
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
>t2 : Symbol(t2, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 2, 3))
|
||||
|
||||
`${(-t1) ** t2 - t1} world`;
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
>t2 : Symbol(t2, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 2, 3))
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
|
||||
`${(-++t1) ** t2 - t1} world`;
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
>t2 : Symbol(t2, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 2, 3))
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
|
||||
`${(-t1++) ** t2 - t1} world`;
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
>t2 : Symbol(t2, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 2, 3))
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
|
||||
`${(~t1) ** t2 ** --t1 } world`;
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
>t2 : Symbol(t2, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 2, 3))
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
|
||||
`${typeof (t1 ** t2 ** t1) } world`;
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
>t2 : Symbol(t2, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 2, 3))
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
|
||||
// TempateHead & TemplateTail are empt
|
||||
`${t1 ** -t2} hello world ${t1 ** -t2}`;
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
>t2 : Symbol(t2, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 2, 3))
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
>t2 : Symbol(t2, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 2, 3))
|
||||
|
||||
`${(-t1) ** t2 - t1} hello world ${(-t1) ** t2 - t1}`;
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
>t2 : Symbol(t2, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 2, 3))
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
>t2 : Symbol(t2, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 2, 3))
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
|
||||
`${(-++t1) ** t2 - t1} hello world ${t1 ** (-++t1) **- t1}`;
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
>t2 : Symbol(t2, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 2, 3))
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
|
||||
`${(-t1++) ** t2 - t1} hello world ${t2 ** (-t1++) ** - t1}`;
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
>t2 : Symbol(t2, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 2, 3))
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
>t2 : Symbol(t2, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 2, 3))
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
|
||||
`${(~t1) ** t2 ** --t1 } hello world ${(~t1) ** t2 ** --t1 }`;
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
>t2 : Symbol(t2, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 2, 3))
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
>t2 : Symbol(t2, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 2, 3))
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
|
||||
`${typeof (t1 ** t2 ** t1)} hello world ${typeof (t1 ** t2 ** t1)}`;
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
>t2 : Symbol(t2, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 2, 3))
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
>t2 : Symbol(t2, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 2, 3))
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
|
||||
// With templateHead
|
||||
`hello ${(-t1) ** t2 - t1}`;
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
>t2 : Symbol(t2, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 2, 3))
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
|
||||
`hello ${(-++t1) ** t2 - t1}`;
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
>t2 : Symbol(t2, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 2, 3))
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
|
||||
`hello ${(-t1++) ** t2 - t1}`;
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
>t2 : Symbol(t2, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 2, 3))
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
|
||||
`hello ${(~t1) ** t2 ** --t1 }`;
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
>t2 : Symbol(t2, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 2, 3))
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
|
||||
`hello ${typeof (t1 ** t2 ** t1)}`;
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
>t2 : Symbol(t2, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 2, 3))
|
||||
>t1 : Symbol(t1, Decl(emitExponentiationOperatorInTempalteString4ES6.ts, 1, 3))
|
||||
|
||||
@@ -0,0 +1,233 @@
|
||||
=== tests/cases/conformance/es7/exponentiationOperator/emitExponentiationOperatorInTempalteString4ES6.ts ===
|
||||
|
||||
var t1 = 10;
|
||||
>t1 : number
|
||||
>10 : number
|
||||
|
||||
var t2 = 10;
|
||||
>t2 : number
|
||||
>10 : number
|
||||
|
||||
var s;
|
||||
>s : any
|
||||
|
||||
// With TemplateTail
|
||||
`${t1 ** -t2} world`;
|
||||
>`${t1 ** -t2} world` : string
|
||||
>t1 ** -t2 : number
|
||||
>t1 : number
|
||||
>-t2 : number
|
||||
>t2 : number
|
||||
|
||||
`${(-t1) ** t2 - t1} world`;
|
||||
>`${(-t1) ** t2 - t1} world` : string
|
||||
>(-t1) ** t2 - t1 : number
|
||||
>(-t1) ** t2 : number
|
||||
>(-t1) : number
|
||||
>-t1 : number
|
||||
>t1 : number
|
||||
>t2 : number
|
||||
>t1 : number
|
||||
|
||||
`${(-++t1) ** t2 - t1} world`;
|
||||
>`${(-++t1) ** t2 - t1} world` : string
|
||||
>(-++t1) ** t2 - t1 : number
|
||||
>(-++t1) ** t2 : number
|
||||
>(-++t1) : number
|
||||
>-++t1 : number
|
||||
>++t1 : number
|
||||
>t1 : number
|
||||
>t2 : number
|
||||
>t1 : number
|
||||
|
||||
`${(-t1++) ** t2 - t1} world`;
|
||||
>`${(-t1++) ** t2 - t1} world` : string
|
||||
>(-t1++) ** t2 - t1 : number
|
||||
>(-t1++) ** t2 : number
|
||||
>(-t1++) : number
|
||||
>-t1++ : number
|
||||
>t1++ : number
|
||||
>t1 : number
|
||||
>t2 : number
|
||||
>t1 : number
|
||||
|
||||
`${(~t1) ** t2 ** --t1 } world`;
|
||||
>`${(~t1) ** t2 ** --t1 } world` : string
|
||||
>(~t1) ** t2 ** --t1 : number
|
||||
>(~t1) : number
|
||||
>~t1 : number
|
||||
>t1 : number
|
||||
>t2 ** --t1 : number
|
||||
>t2 : number
|
||||
>--t1 : number
|
||||
>t1 : number
|
||||
|
||||
`${typeof (t1 ** t2 ** t1) } world`;
|
||||
>`${typeof (t1 ** t2 ** t1) } world` : string
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
>t2 ** t1 : number
|
||||
>t2 : number
|
||||
>t1 : number
|
||||
|
||||
// TempateHead & TemplateTail are empt
|
||||
`${t1 ** -t2} hello world ${t1 ** -t2}`;
|
||||
>`${t1 ** -t2} hello world ${t1 ** -t2}` : string
|
||||
>t1 ** -t2 : number
|
||||
>t1 : number
|
||||
>-t2 : number
|
||||
>t2 : number
|
||||
>t1 ** -t2 : number
|
||||
>t1 : number
|
||||
>-t2 : number
|
||||
>t2 : number
|
||||
|
||||
`${(-t1) ** t2 - t1} hello world ${(-t1) ** t2 - t1}`;
|
||||
>`${(-t1) ** t2 - t1} hello world ${(-t1) ** t2 - t1}` : string
|
||||
>(-t1) ** t2 - t1 : number
|
||||
>(-t1) ** t2 : number
|
||||
>(-t1) : number
|
||||
>-t1 : number
|
||||
>t1 : number
|
||||
>t2 : number
|
||||
>t1 : number
|
||||
>(-t1) ** t2 - t1 : number
|
||||
>(-t1) ** t2 : number
|
||||
>(-t1) : number
|
||||
>-t1 : number
|
||||
>t1 : number
|
||||
>t2 : number
|
||||
>t1 : number
|
||||
|
||||
`${(-++t1) ** t2 - t1} hello world ${t1 ** (-++t1) **- t1}`;
|
||||
>`${(-++t1) ** t2 - t1} hello world ${t1 ** (-++t1) **- t1}` : string
|
||||
>(-++t1) ** t2 - t1 : number
|
||||
>(-++t1) ** t2 : number
|
||||
>(-++t1) : number
|
||||
>-++t1 : number
|
||||
>++t1 : number
|
||||
>t1 : number
|
||||
>t2 : number
|
||||
>t1 : number
|
||||
>t1 ** (-++t1) **- t1 : number
|
||||
>t1 : number
|
||||
>(-++t1) **- t1 : number
|
||||
>(-++t1) : number
|
||||
>-++t1 : number
|
||||
>++t1 : number
|
||||
>t1 : number
|
||||
>- t1 : number
|
||||
>t1 : number
|
||||
|
||||
`${(-t1++) ** t2 - t1} hello world ${t2 ** (-t1++) ** - t1}`;
|
||||
>`${(-t1++) ** t2 - t1} hello world ${t2 ** (-t1++) ** - t1}` : string
|
||||
>(-t1++) ** t2 - t1 : number
|
||||
>(-t1++) ** t2 : number
|
||||
>(-t1++) : number
|
||||
>-t1++ : number
|
||||
>t1++ : number
|
||||
>t1 : number
|
||||
>t2 : number
|
||||
>t1 : number
|
||||
>t2 ** (-t1++) ** - t1 : number
|
||||
>t2 : number
|
||||
>(-t1++) ** - t1 : number
|
||||
>(-t1++) : number
|
||||
>-t1++ : number
|
||||
>t1++ : number
|
||||
>t1 : number
|
||||
>- t1 : number
|
||||
>t1 : number
|
||||
|
||||
`${(~t1) ** t2 ** --t1 } hello world ${(~t1) ** t2 ** --t1 }`;
|
||||
>`${(~t1) ** t2 ** --t1 } hello world ${(~t1) ** t2 ** --t1 }` : string
|
||||
>(~t1) ** t2 ** --t1 : number
|
||||
>(~t1) : number
|
||||
>~t1 : number
|
||||
>t1 : number
|
||||
>t2 ** --t1 : number
|
||||
>t2 : number
|
||||
>--t1 : number
|
||||
>t1 : number
|
||||
>(~t1) ** t2 ** --t1 : number
|
||||
>(~t1) : number
|
||||
>~t1 : number
|
||||
>t1 : number
|
||||
>t2 ** --t1 : number
|
||||
>t2 : number
|
||||
>--t1 : number
|
||||
>t1 : number
|
||||
|
||||
`${typeof (t1 ** t2 ** t1)} hello world ${typeof (t1 ** t2 ** t1)}`;
|
||||
>`${typeof (t1 ** t2 ** t1)} hello world ${typeof (t1 ** t2 ** t1)}` : string
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
>t2 ** t1 : number
|
||||
>t2 : number
|
||||
>t1 : number
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
>t2 ** t1 : number
|
||||
>t2 : number
|
||||
>t1 : number
|
||||
|
||||
// With templateHead
|
||||
`hello ${(-t1) ** t2 - t1}`;
|
||||
>`hello ${(-t1) ** t2 - t1}` : string
|
||||
>(-t1) ** t2 - t1 : number
|
||||
>(-t1) ** t2 : number
|
||||
>(-t1) : number
|
||||
>-t1 : number
|
||||
>t1 : number
|
||||
>t2 : number
|
||||
>t1 : number
|
||||
|
||||
`hello ${(-++t1) ** t2 - t1}`;
|
||||
>`hello ${(-++t1) ** t2 - t1}` : string
|
||||
>(-++t1) ** t2 - t1 : number
|
||||
>(-++t1) ** t2 : number
|
||||
>(-++t1) : number
|
||||
>-++t1 : number
|
||||
>++t1 : number
|
||||
>t1 : number
|
||||
>t2 : number
|
||||
>t1 : number
|
||||
|
||||
`hello ${(-t1++) ** t2 - t1}`;
|
||||
>`hello ${(-t1++) ** t2 - t1}` : string
|
||||
>(-t1++) ** t2 - t1 : number
|
||||
>(-t1++) ** t2 : number
|
||||
>(-t1++) : number
|
||||
>-t1++ : number
|
||||
>t1++ : number
|
||||
>t1 : number
|
||||
>t2 : number
|
||||
>t1 : number
|
||||
|
||||
`hello ${(~t1) ** t2 ** --t1 }`;
|
||||
>`hello ${(~t1) ** t2 ** --t1 }` : string
|
||||
>(~t1) ** t2 ** --t1 : number
|
||||
>(~t1) : number
|
||||
>~t1 : number
|
||||
>t1 : number
|
||||
>t2 ** --t1 : number
|
||||
>t2 : number
|
||||
>--t1 : number
|
||||
>t1 : number
|
||||
|
||||
`hello ${typeof (t1 ** t2 ** t1)}`;
|
||||
>`hello ${typeof (t1 ** t2 ** t1)}` : string
|
||||
>typeof (t1 ** t2 ** t1) : string
|
||||
>(t1 ** t2 ** t1) : number
|
||||
>t1 ** t2 ** t1 : number
|
||||
>t1 : number
|
||||
>t2 ** t1 : number
|
||||
>t2 : number
|
||||
>t1 : number
|
||||
|
||||
Reference in New Issue
Block a user