diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 237f3ab509ae7..f3e45a85b6a08 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2117,7 +2117,8 @@ module ts { * or equal precedence to the binary '+' operator */ function comparePrecedenceToBinaryPlus(expression: Expression): Comparison { - // All binary expressions have lower precedence than '+' apart from '*', '/', and '%'. + // All binary expressions have lower precedence than '+' apart from '*', '/', and '%' + // which have greater precedence and '-' which has equal precedence. // All unary operators have a higher precedence apart from yield. // Arrow functions and conditionals have a lower precedence, // although we convert the former into regular function expressions in ES5 mode, @@ -2134,6 +2135,7 @@ module ts { case SyntaxKind.PercentToken: return Comparison.GreaterThan; case SyntaxKind.PlusToken: + case SyntaxKind.MinusToken: return Comparison.EqualTo; default: return Comparison.LessThan; diff --git a/tests/baselines/reference/templateStringBinaryOperations.js b/tests/baselines/reference/templateStringBinaryOperations.js new file mode 100644 index 0000000000000..d155ba9eedd95 --- /dev/null +++ b/tests/baselines/reference/templateStringBinaryOperations.js @@ -0,0 +1,103 @@ +//// [templateStringBinaryOperations.ts] +var a = 1 + `${ 3 }`; +var b = 1 + `2${ 3 }`; +var c = 1 + `${ 3 }4`; +var d = 1 + `2${ 3 }4`; +var e = `${ 3 }` + 5; +var f = `2${ 3 }` + 5; +var g = `${ 3 }4` + 5; +var h = `2${ 3 }4` + 5; +var i = 1 + `${ 3 }` + 5; +var j = 1 + `2${ 3 }` + 5; +var k = 1 + `${ 3 }4` + 5; +var l = 1 + `2${ 3 }4` + 5; + +var a2 = 1 + `${ 3 - 4 }`; +var b2 = 1 + `2${ 3 - 4 }`; +var c2 = 1 + `${ 3 - 4 }5`; +var d2 = 1 + `2${ 3 - 4 }5`; +var e2 = `${ 3 - 4 }` + 6; +var f2 = `2${ 3 - 4 }` + 6; +var g2 = `${ 3 - 4 }5` + 6; +var h2 = `2${ 3 - 4 }5` + 6; +var i2 = 1 + `${ 3 - 4 }` + 6; +var j2 = 1 + `2${ 3 - 4 }` + 6; +var k2 = 1 + `${ 3 - 4 }5` + 6; +var l2 = 1 + `2${ 3 - 4 }5` + 6; + +var a3 = 1 + `${ 3 * 4 }`; +var b3 = 1 + `2${ 3 * 4 }`; +var c3 = 1 + `${ 3 * 4 }5`; +var d3 = 1 + `2${ 3 * 4 }5`; +var e3 = `${ 3 * 4 }` + 6; +var f3 = `2${ 3 * 4 }` + 6; +var g3 = `${ 3 * 4 }5` + 6; +var h3 = `2${ 3 * 4 }5` + 6; +var i3 = 1 + `${ 3 * 4 }` + 6; +var j3 = 1 + `2${ 3 * 4 }` + 6; +var k3 = 1 + `${ 3 * 4 }5` + 6; +var l3 = 1 + `2${ 3 * 4 }5` + 6; + +var a4 = 1 + `${ 3 & 4 }`; +var b4 = 1 + `2${ 3 & 4 }`; +var c4 = 1 + `${ 3 & 4 }5`; +var d4 = 1 + `2${ 3 & 4 }5`; +var e4 = `${ 3 & 4 }` + 6; +var f4 = `2${ 3 & 4 }` + 6; +var g4 = `${ 3 & 4 }5` + 6; +var h4 = `2${ 3 & 4 }5` + 6; +var i4 = 1 + `${ 3 & 4 }` + 6; +var j4 = 1 + `2${ 3 & 4 }` + 6; +var k4 = 1 + `${ 3 & 4 }5` + 6; +var l4 = 1 + `2${ 3 & 4 }5` + 6; + + +//// [templateStringBinaryOperations.js] +var a = 1 + ("" + 3); +var b = 1 + ("2" + 3); +var c = 1 + ("" + 3 + "4"); +var d = 1 + ("2" + 3 + "4"); +var e = ("" + 3) + 5; +var f = ("2" + 3) + 5; +var g = ("" + 3 + "4") + 5; +var h = ("2" + 3 + "4") + 5; +var i = 1 + ("" + 3) + 5; +var j = 1 + ("2" + 3) + 5; +var k = 1 + ("" + 3 + "4") + 5; +var l = 1 + ("2" + 3 + "4") + 5; +var a2 = 1 + ("" + (3 - 4)); +var b2 = 1 + ("2" + (3 - 4)); +var c2 = 1 + ("" + (3 - 4) + "5"); +var d2 = 1 + ("2" + (3 - 4) + "5"); +var e2 = ("" + (3 - 4)) + 6; +var f2 = ("2" + (3 - 4)) + 6; +var g2 = ("" + (3 - 4) + "5") + 6; +var h2 = ("2" + (3 - 4) + "5") + 6; +var i2 = 1 + ("" + (3 - 4)) + 6; +var j2 = 1 + ("2" + (3 - 4)) + 6; +var k2 = 1 + ("" + (3 - 4) + "5") + 6; +var l2 = 1 + ("2" + (3 - 4) + "5") + 6; +var a3 = 1 + ("" + 3 * 4); +var b3 = 1 + ("2" + 3 * 4); +var c3 = 1 + ("" + 3 * 4 + "5"); +var d3 = 1 + ("2" + 3 * 4 + "5"); +var e3 = ("" + 3 * 4) + 6; +var f3 = ("2" + 3 * 4) + 6; +var g3 = ("" + 3 * 4 + "5") + 6; +var h3 = ("2" + 3 * 4 + "5") + 6; +var i3 = 1 + ("" + 3 * 4) + 6; +var j3 = 1 + ("2" + 3 * 4) + 6; +var k3 = 1 + ("" + 3 * 4 + "5") + 6; +var l3 = 1 + ("2" + 3 * 4 + "5") + 6; +var a4 = 1 + ("" + (3 & 4)); +var b4 = 1 + ("2" + (3 & 4)); +var c4 = 1 + ("" + (3 & 4) + "5"); +var d4 = 1 + ("2" + (3 & 4) + "5"); +var e4 = ("" + (3 & 4)) + 6; +var f4 = ("2" + (3 & 4)) + 6; +var g4 = ("" + (3 & 4) + "5") + 6; +var h4 = ("2" + (3 & 4) + "5") + 6; +var i4 = 1 + ("" + (3 & 4)) + 6; +var j4 = 1 + ("2" + (3 & 4)) + 6; +var k4 = 1 + ("" + (3 & 4) + "5") + 6; +var l4 = 1 + ("2" + (3 & 4) + "5") + 6; diff --git a/tests/baselines/reference/templateStringBinaryOperations.types b/tests/baselines/reference/templateStringBinaryOperations.types new file mode 100644 index 0000000000000..094c82f367890 --- /dev/null +++ b/tests/baselines/reference/templateStringBinaryOperations.types @@ -0,0 +1,245 @@ +=== tests/cases/conformance/es6/templates/templateStringBinaryOperations.ts === +var a = 1 + `${ 3 }`; +>a : string +>1 + `${ 3 }` : string + +var b = 1 + `2${ 3 }`; +>b : string +>1 + `2${ 3 }` : string + +var c = 1 + `${ 3 }4`; +>c : string +>1 + `${ 3 }4` : string + +var d = 1 + `2${ 3 }4`; +>d : string +>1 + `2${ 3 }4` : string + +var e = `${ 3 }` + 5; +>e : string +>`${ 3 }` + 5 : string + +var f = `2${ 3 }` + 5; +>f : string +>`2${ 3 }` + 5 : string + +var g = `${ 3 }4` + 5; +>g : string +>`${ 3 }4` + 5 : string + +var h = `2${ 3 }4` + 5; +>h : string +>`2${ 3 }4` + 5 : string + +var i = 1 + `${ 3 }` + 5; +>i : string +>1 + `${ 3 }` + 5 : string +>1 + `${ 3 }` : string + +var j = 1 + `2${ 3 }` + 5; +>j : string +>1 + `2${ 3 }` + 5 : string +>1 + `2${ 3 }` : string + +var k = 1 + `${ 3 }4` + 5; +>k : string +>1 + `${ 3 }4` + 5 : string +>1 + `${ 3 }4` : string + +var l = 1 + `2${ 3 }4` + 5; +>l : string +>1 + `2${ 3 }4` + 5 : string +>1 + `2${ 3 }4` : string + +var a2 = 1 + `${ 3 - 4 }`; +>a2 : string +>1 + `${ 3 - 4 }` : string +>3 - 4 : number + +var b2 = 1 + `2${ 3 - 4 }`; +>b2 : string +>1 + `2${ 3 - 4 }` : string +>3 - 4 : number + +var c2 = 1 + `${ 3 - 4 }5`; +>c2 : string +>1 + `${ 3 - 4 }5` : string +>3 - 4 : number + +var d2 = 1 + `2${ 3 - 4 }5`; +>d2 : string +>1 + `2${ 3 - 4 }5` : string +>3 - 4 : number + +var e2 = `${ 3 - 4 }` + 6; +>e2 : string +>`${ 3 - 4 }` + 6 : string +>3 - 4 : number + +var f2 = `2${ 3 - 4 }` + 6; +>f2 : string +>`2${ 3 - 4 }` + 6 : string +>3 - 4 : number + +var g2 = `${ 3 - 4 }5` + 6; +>g2 : string +>`${ 3 - 4 }5` + 6 : string +>3 - 4 : number + +var h2 = `2${ 3 - 4 }5` + 6; +>h2 : string +>`2${ 3 - 4 }5` + 6 : string +>3 - 4 : number + +var i2 = 1 + `${ 3 - 4 }` + 6; +>i2 : string +>1 + `${ 3 - 4 }` + 6 : string +>1 + `${ 3 - 4 }` : string +>3 - 4 : number + +var j2 = 1 + `2${ 3 - 4 }` + 6; +>j2 : string +>1 + `2${ 3 - 4 }` + 6 : string +>1 + `2${ 3 - 4 }` : string +>3 - 4 : number + +var k2 = 1 + `${ 3 - 4 }5` + 6; +>k2 : string +>1 + `${ 3 - 4 }5` + 6 : string +>1 + `${ 3 - 4 }5` : string +>3 - 4 : number + +var l2 = 1 + `2${ 3 - 4 }5` + 6; +>l2 : string +>1 + `2${ 3 - 4 }5` + 6 : string +>1 + `2${ 3 - 4 }5` : string +>3 - 4 : number + +var a3 = 1 + `${ 3 * 4 }`; +>a3 : string +>1 + `${ 3 * 4 }` : string +>3 * 4 : number + +var b3 = 1 + `2${ 3 * 4 }`; +>b3 : string +>1 + `2${ 3 * 4 }` : string +>3 * 4 : number + +var c3 = 1 + `${ 3 * 4 }5`; +>c3 : string +>1 + `${ 3 * 4 }5` : string +>3 * 4 : number + +var d3 = 1 + `2${ 3 * 4 }5`; +>d3 : string +>1 + `2${ 3 * 4 }5` : string +>3 * 4 : number + +var e3 = `${ 3 * 4 }` + 6; +>e3 : string +>`${ 3 * 4 }` + 6 : string +>3 * 4 : number + +var f3 = `2${ 3 * 4 }` + 6; +>f3 : string +>`2${ 3 * 4 }` + 6 : string +>3 * 4 : number + +var g3 = `${ 3 * 4 }5` + 6; +>g3 : string +>`${ 3 * 4 }5` + 6 : string +>3 * 4 : number + +var h3 = `2${ 3 * 4 }5` + 6; +>h3 : string +>`2${ 3 * 4 }5` + 6 : string +>3 * 4 : number + +var i3 = 1 + `${ 3 * 4 }` + 6; +>i3 : string +>1 + `${ 3 * 4 }` + 6 : string +>1 + `${ 3 * 4 }` : string +>3 * 4 : number + +var j3 = 1 + `2${ 3 * 4 }` + 6; +>j3 : string +>1 + `2${ 3 * 4 }` + 6 : string +>1 + `2${ 3 * 4 }` : string +>3 * 4 : number + +var k3 = 1 + `${ 3 * 4 }5` + 6; +>k3 : string +>1 + `${ 3 * 4 }5` + 6 : string +>1 + `${ 3 * 4 }5` : string +>3 * 4 : number + +var l3 = 1 + `2${ 3 * 4 }5` + 6; +>l3 : string +>1 + `2${ 3 * 4 }5` + 6 : string +>1 + `2${ 3 * 4 }5` : string +>3 * 4 : number + +var a4 = 1 + `${ 3 & 4 }`; +>a4 : string +>1 + `${ 3 & 4 }` : string +>3 & 4 : number + +var b4 = 1 + `2${ 3 & 4 }`; +>b4 : string +>1 + `2${ 3 & 4 }` : string +>3 & 4 : number + +var c4 = 1 + `${ 3 & 4 }5`; +>c4 : string +>1 + `${ 3 & 4 }5` : string +>3 & 4 : number + +var d4 = 1 + `2${ 3 & 4 }5`; +>d4 : string +>1 + `2${ 3 & 4 }5` : string +>3 & 4 : number + +var e4 = `${ 3 & 4 }` + 6; +>e4 : string +>`${ 3 & 4 }` + 6 : string +>3 & 4 : number + +var f4 = `2${ 3 & 4 }` + 6; +>f4 : string +>`2${ 3 & 4 }` + 6 : string +>3 & 4 : number + +var g4 = `${ 3 & 4 }5` + 6; +>g4 : string +>`${ 3 & 4 }5` + 6 : string +>3 & 4 : number + +var h4 = `2${ 3 & 4 }5` + 6; +>h4 : string +>`2${ 3 & 4 }5` + 6 : string +>3 & 4 : number + +var i4 = 1 + `${ 3 & 4 }` + 6; +>i4 : string +>1 + `${ 3 & 4 }` + 6 : string +>1 + `${ 3 & 4 }` : string +>3 & 4 : number + +var j4 = 1 + `2${ 3 & 4 }` + 6; +>j4 : string +>1 + `2${ 3 & 4 }` + 6 : string +>1 + `2${ 3 & 4 }` : string +>3 & 4 : number + +var k4 = 1 + `${ 3 & 4 }5` + 6; +>k4 : string +>1 + `${ 3 & 4 }5` + 6 : string +>1 + `${ 3 & 4 }5` : string +>3 & 4 : number + +var l4 = 1 + `2${ 3 & 4 }5` + 6; +>l4 : string +>1 + `2${ 3 & 4 }5` + 6 : string +>1 + `2${ 3 & 4 }5` : string +>3 & 4 : number + diff --git a/tests/baselines/reference/templateStringBinaryOperationsES6.js b/tests/baselines/reference/templateStringBinaryOperationsES6.js new file mode 100644 index 0000000000000..8dcdd8a2aa704 --- /dev/null +++ b/tests/baselines/reference/templateStringBinaryOperationsES6.js @@ -0,0 +1,103 @@ +//// [templateStringBinaryOperationsES6.ts] +var a = 1 + `${ 3 }`; +var b = 1 + `2${ 3 }`; +var c = 1 + `${ 3 }4`; +var d = 1 + `2${ 3 }4`; +var e = `${ 3 }` + 5; +var f = `2${ 3 }` + 5; +var g = `${ 3 }4` + 5; +var h = `2${ 3 }4` + 5; +var i = 1 + `${ 3 }` + 5; +var j = 1 + `2${ 3 }` + 5; +var k = 1 + `${ 3 }4` + 5; +var l = 1 + `2${ 3 }4` + 5; + +var a2 = 1 + `${ 3 - 4 }`; +var b2 = 1 + `2${ 3 - 4 }`; +var c2 = 1 + `${ 3 - 4 }5`; +var d2 = 1 + `2${ 3 - 4 }5`; +var e2 = `${ 3 - 4 }` + 6; +var f2 = `2${ 3 - 4 }` + 6; +var g2 = `${ 3 - 4 }5` + 6; +var h2 = `2${ 3 - 4 }5` + 6; +var i2 = 1 + `${ 3 - 4 }` + 6; +var j2 = 1 + `2${ 3 - 4 }` + 6; +var k2 = 1 + `${ 3 - 4 }5` + 6; +var l2 = 1 + `2${ 3 - 4 }5` + 6; + +var a3 = 1 + `${ 3 * 4 }`; +var b3 = 1 + `2${ 3 * 4 }`; +var c3 = 1 + `${ 3 * 4 }5`; +var d3 = 1 + `2${ 3 * 4 }5`; +var e3 = `${ 3 * 4 }` + 6; +var f3 = `2${ 3 * 4 }` + 6; +var g3 = `${ 3 * 4 }5` + 6; +var h3 = `2${ 3 * 4 }5` + 6; +var i3 = 1 + `${ 3 * 4 }` + 6; +var j3 = 1 + `2${ 3 * 4 }` + 6; +var k3 = 1 + `${ 3 * 4 }5` + 6; +var l3 = 1 + `2${ 3 * 4 }5` + 6; + +var a4 = 1 + `${ 3 & 4 }`; +var b4 = 1 + `2${ 3 & 4 }`; +var c4 = 1 + `${ 3 & 4 }5`; +var d4 = 1 + `2${ 3 & 4 }5`; +var e4 = `${ 3 & 4 }` + 6; +var f4 = `2${ 3 & 4 }` + 6; +var g4 = `${ 3 & 4 }5` + 6; +var h4 = `2${ 3 & 4 }5` + 6; +var i4 = 1 + `${ 3 & 4 }` + 6; +var j4 = 1 + `2${ 3 & 4 }` + 6; +var k4 = 1 + `${ 3 & 4 }5` + 6; +var l4 = 1 + `2${ 3 & 4 }5` + 6; + + +//// [templateStringBinaryOperationsES6.js] +var a = 1 + `${3}`; +var b = 1 + `2${3}`; +var c = 1 + `${3}4`; +var d = 1 + `2${3}4`; +var e = `${3}` + 5; +var f = `2${3}` + 5; +var g = `${3}4` + 5; +var h = `2${3}4` + 5; +var i = 1 + `${3}` + 5; +var j = 1 + `2${3}` + 5; +var k = 1 + `${3}4` + 5; +var l = 1 + `2${3}4` + 5; +var a2 = 1 + `${3 - 4}`; +var b2 = 1 + `2${3 - 4}`; +var c2 = 1 + `${3 - 4}5`; +var d2 = 1 + `2${3 - 4}5`; +var e2 = `${3 - 4}` + 6; +var f2 = `2${3 - 4}` + 6; +var g2 = `${3 - 4}5` + 6; +var h2 = `2${3 - 4}5` + 6; +var i2 = 1 + `${3 - 4}` + 6; +var j2 = 1 + `2${3 - 4}` + 6; +var k2 = 1 + `${3 - 4}5` + 6; +var l2 = 1 + `2${3 - 4}5` + 6; +var a3 = 1 + `${3 * 4}`; +var b3 = 1 + `2${3 * 4}`; +var c3 = 1 + `${3 * 4}5`; +var d3 = 1 + `2${3 * 4}5`; +var e3 = `${3 * 4}` + 6; +var f3 = `2${3 * 4}` + 6; +var g3 = `${3 * 4}5` + 6; +var h3 = `2${3 * 4}5` + 6; +var i3 = 1 + `${3 * 4}` + 6; +var j3 = 1 + `2${3 * 4}` + 6; +var k3 = 1 + `${3 * 4}5` + 6; +var l3 = 1 + `2${3 * 4}5` + 6; +var a4 = 1 + `${3 & 4}`; +var b4 = 1 + `2${3 & 4}`; +var c4 = 1 + `${3 & 4}5`; +var d4 = 1 + `2${3 & 4}5`; +var e4 = `${3 & 4}` + 6; +var f4 = `2${3 & 4}` + 6; +var g4 = `${3 & 4}5` + 6; +var h4 = `2${3 & 4}5` + 6; +var i4 = 1 + `${3 & 4}` + 6; +var j4 = 1 + `2${3 & 4}` + 6; +var k4 = 1 + `${3 & 4}5` + 6; +var l4 = 1 + `2${3 & 4}5` + 6; diff --git a/tests/baselines/reference/templateStringBinaryOperationsES6.types b/tests/baselines/reference/templateStringBinaryOperationsES6.types new file mode 100644 index 0000000000000..a79885904e2e9 --- /dev/null +++ b/tests/baselines/reference/templateStringBinaryOperationsES6.types @@ -0,0 +1,245 @@ +=== tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6.ts === +var a = 1 + `${ 3 }`; +>a : string +>1 + `${ 3 }` : string + +var b = 1 + `2${ 3 }`; +>b : string +>1 + `2${ 3 }` : string + +var c = 1 + `${ 3 }4`; +>c : string +>1 + `${ 3 }4` : string + +var d = 1 + `2${ 3 }4`; +>d : string +>1 + `2${ 3 }4` : string + +var e = `${ 3 }` + 5; +>e : string +>`${ 3 }` + 5 : string + +var f = `2${ 3 }` + 5; +>f : string +>`2${ 3 }` + 5 : string + +var g = `${ 3 }4` + 5; +>g : string +>`${ 3 }4` + 5 : string + +var h = `2${ 3 }4` + 5; +>h : string +>`2${ 3 }4` + 5 : string + +var i = 1 + `${ 3 }` + 5; +>i : string +>1 + `${ 3 }` + 5 : string +>1 + `${ 3 }` : string + +var j = 1 + `2${ 3 }` + 5; +>j : string +>1 + `2${ 3 }` + 5 : string +>1 + `2${ 3 }` : string + +var k = 1 + `${ 3 }4` + 5; +>k : string +>1 + `${ 3 }4` + 5 : string +>1 + `${ 3 }4` : string + +var l = 1 + `2${ 3 }4` + 5; +>l : string +>1 + `2${ 3 }4` + 5 : string +>1 + `2${ 3 }4` : string + +var a2 = 1 + `${ 3 - 4 }`; +>a2 : string +>1 + `${ 3 - 4 }` : string +>3 - 4 : number + +var b2 = 1 + `2${ 3 - 4 }`; +>b2 : string +>1 + `2${ 3 - 4 }` : string +>3 - 4 : number + +var c2 = 1 + `${ 3 - 4 }5`; +>c2 : string +>1 + `${ 3 - 4 }5` : string +>3 - 4 : number + +var d2 = 1 + `2${ 3 - 4 }5`; +>d2 : string +>1 + `2${ 3 - 4 }5` : string +>3 - 4 : number + +var e2 = `${ 3 - 4 }` + 6; +>e2 : string +>`${ 3 - 4 }` + 6 : string +>3 - 4 : number + +var f2 = `2${ 3 - 4 }` + 6; +>f2 : string +>`2${ 3 - 4 }` + 6 : string +>3 - 4 : number + +var g2 = `${ 3 - 4 }5` + 6; +>g2 : string +>`${ 3 - 4 }5` + 6 : string +>3 - 4 : number + +var h2 = `2${ 3 - 4 }5` + 6; +>h2 : string +>`2${ 3 - 4 }5` + 6 : string +>3 - 4 : number + +var i2 = 1 + `${ 3 - 4 }` + 6; +>i2 : string +>1 + `${ 3 - 4 }` + 6 : string +>1 + `${ 3 - 4 }` : string +>3 - 4 : number + +var j2 = 1 + `2${ 3 - 4 }` + 6; +>j2 : string +>1 + `2${ 3 - 4 }` + 6 : string +>1 + `2${ 3 - 4 }` : string +>3 - 4 : number + +var k2 = 1 + `${ 3 - 4 }5` + 6; +>k2 : string +>1 + `${ 3 - 4 }5` + 6 : string +>1 + `${ 3 - 4 }5` : string +>3 - 4 : number + +var l2 = 1 + `2${ 3 - 4 }5` + 6; +>l2 : string +>1 + `2${ 3 - 4 }5` + 6 : string +>1 + `2${ 3 - 4 }5` : string +>3 - 4 : number + +var a3 = 1 + `${ 3 * 4 }`; +>a3 : string +>1 + `${ 3 * 4 }` : string +>3 * 4 : number + +var b3 = 1 + `2${ 3 * 4 }`; +>b3 : string +>1 + `2${ 3 * 4 }` : string +>3 * 4 : number + +var c3 = 1 + `${ 3 * 4 }5`; +>c3 : string +>1 + `${ 3 * 4 }5` : string +>3 * 4 : number + +var d3 = 1 + `2${ 3 * 4 }5`; +>d3 : string +>1 + `2${ 3 * 4 }5` : string +>3 * 4 : number + +var e3 = `${ 3 * 4 }` + 6; +>e3 : string +>`${ 3 * 4 }` + 6 : string +>3 * 4 : number + +var f3 = `2${ 3 * 4 }` + 6; +>f3 : string +>`2${ 3 * 4 }` + 6 : string +>3 * 4 : number + +var g3 = `${ 3 * 4 }5` + 6; +>g3 : string +>`${ 3 * 4 }5` + 6 : string +>3 * 4 : number + +var h3 = `2${ 3 * 4 }5` + 6; +>h3 : string +>`2${ 3 * 4 }5` + 6 : string +>3 * 4 : number + +var i3 = 1 + `${ 3 * 4 }` + 6; +>i3 : string +>1 + `${ 3 * 4 }` + 6 : string +>1 + `${ 3 * 4 }` : string +>3 * 4 : number + +var j3 = 1 + `2${ 3 * 4 }` + 6; +>j3 : string +>1 + `2${ 3 * 4 }` + 6 : string +>1 + `2${ 3 * 4 }` : string +>3 * 4 : number + +var k3 = 1 + `${ 3 * 4 }5` + 6; +>k3 : string +>1 + `${ 3 * 4 }5` + 6 : string +>1 + `${ 3 * 4 }5` : string +>3 * 4 : number + +var l3 = 1 + `2${ 3 * 4 }5` + 6; +>l3 : string +>1 + `2${ 3 * 4 }5` + 6 : string +>1 + `2${ 3 * 4 }5` : string +>3 * 4 : number + +var a4 = 1 + `${ 3 & 4 }`; +>a4 : string +>1 + `${ 3 & 4 }` : string +>3 & 4 : number + +var b4 = 1 + `2${ 3 & 4 }`; +>b4 : string +>1 + `2${ 3 & 4 }` : string +>3 & 4 : number + +var c4 = 1 + `${ 3 & 4 }5`; +>c4 : string +>1 + `${ 3 & 4 }5` : string +>3 & 4 : number + +var d4 = 1 + `2${ 3 & 4 }5`; +>d4 : string +>1 + `2${ 3 & 4 }5` : string +>3 & 4 : number + +var e4 = `${ 3 & 4 }` + 6; +>e4 : string +>`${ 3 & 4 }` + 6 : string +>3 & 4 : number + +var f4 = `2${ 3 & 4 }` + 6; +>f4 : string +>`2${ 3 & 4 }` + 6 : string +>3 & 4 : number + +var g4 = `${ 3 & 4 }5` + 6; +>g4 : string +>`${ 3 & 4 }5` + 6 : string +>3 & 4 : number + +var h4 = `2${ 3 & 4 }5` + 6; +>h4 : string +>`2${ 3 & 4 }5` + 6 : string +>3 & 4 : number + +var i4 = 1 + `${ 3 & 4 }` + 6; +>i4 : string +>1 + `${ 3 & 4 }` + 6 : string +>1 + `${ 3 & 4 }` : string +>3 & 4 : number + +var j4 = 1 + `2${ 3 & 4 }` + 6; +>j4 : string +>1 + `2${ 3 & 4 }` + 6 : string +>1 + `2${ 3 & 4 }` : string +>3 & 4 : number + +var k4 = 1 + `${ 3 & 4 }5` + 6; +>k4 : string +>1 + `${ 3 & 4 }5` + 6 : string +>1 + `${ 3 & 4 }5` : string +>3 & 4 : number + +var l4 = 1 + `2${ 3 & 4 }5` + 6; +>l4 : string +>1 + `2${ 3 & 4 }5` + 6 : string +>1 + `2${ 3 & 4 }5` : string +>3 & 4 : number + diff --git a/tests/baselines/reference/templateStringBinaryOperationsES6Invalid.errors.txt b/tests/baselines/reference/templateStringBinaryOperationsES6Invalid.errors.txt new file mode 100644 index 0000000000000..261eb6bd55860 --- /dev/null +++ b/tests/baselines/reference/templateStringBinaryOperationsES6Invalid.errors.txt @@ -0,0 +1,399 @@ +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(1,13): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(2,13): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(3,13): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(4,13): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(5,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(6,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(7,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(8,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(10,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(11,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(12,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(13,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(14,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(15,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(16,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(17,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(19,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(20,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(21,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(22,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(23,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(24,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(25,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(26,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(28,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(29,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(30,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(31,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(32,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(33,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(34,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(35,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(37,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(38,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(39,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(40,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(41,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(42,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(43,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(44,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(46,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(47,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(48,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(49,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(50,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(51,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(52,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(53,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(55,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(56,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(57,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(58,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(59,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(60,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(61,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(62,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(64,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(65,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(66,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(67,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(68,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(69,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(70,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(71,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(73,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(74,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(75,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(76,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(77,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(78,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(79,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(80,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(82,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(83,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(84,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(85,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(86,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(87,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(88,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(89,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(91,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(92,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(93,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(94,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(95,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(96,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(97,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(98,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(100,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(101,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(102,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(103,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(104,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(105,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(106,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts(107,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + +==== tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts (96 errors) ==== + var a = 1 - `${ 3 }`; + ~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var b = 1 - `2${ 3 }`; + ~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var c = 1 - `${ 3 }4`; + ~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var d = 1 - `2${ 3 }4`; + ~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var e = `${ 3 }` - 5; + ~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var f = `2${ 3 }` - 5; + ~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var g = `${ 3 }4` - 5; + ~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var h = `2${ 3 }4` - 5; + ~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + var a2 = 1 * `${ 3 }`; + ~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var b2 = 1 * `2${ 3 }`; + ~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var c2 = 1 * `${ 3 }4`; + ~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var d2 = 1 * `2${ 3 }4`; + ~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var e2 = `${ 3 }` * 5; + ~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var f2 = `2${ 3 }` * 5; + ~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var g2 = `${ 3 }4` * 5; + ~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var h2 = `2${ 3 }4` * 5; + ~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + var a3 = 1 & `${ 3 }`; + ~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var b3 = 1 & `2${ 3 }`; + ~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var c3 = 1 & `${ 3 }4`; + ~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var d3 = 1 & `2${ 3 }4`; + ~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var e3 = `${ 3 }` & 5; + ~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var f3 = `2${ 3 }` & 5; + ~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var g3 = `${ 3 }4` & 5; + ~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var h3 = `2${ 3 }4` & 5; + ~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + var a4 = 1 - `${ 3 - 4 }`; + ~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var b4 = 1 - `2${ 3 - 4 }`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var c4 = 1 - `${ 3 - 4 }5`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var d4 = 1 - `2${ 3 - 4 }5`; + ~~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var e4 = `${ 3 - 4 }` - 6; + ~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var f4 = `2${ 3 - 4 }` - 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var g4 = `${ 3 - 4 }5` - 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var h4 = `2${ 3 - 4 }5` - 6; + ~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + var a5 = 1 - `${ 3 * 4 }`; + ~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var b5 = 1 - `2${ 3 * 4 }`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var c5 = 1 - `${ 3 * 4 }5`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var d5 = 1 - `2${ 3 * 4 }5`; + ~~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var e5 = `${ 3 * 4 }` - 6; + ~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var f5 = `2${ 3 * 4 }` - 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var g5 = `${ 3 * 4 }5` - 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var h5 = `2${ 3 * 4 }5` - 6; + ~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + var a6 = 1 - `${ 3 & 4 }`; + ~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var b6 = 1 - `2${ 3 & 4 }`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var c6 = 1 - `${ 3 & 4 }5`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var d6 = 1 - `2${ 3 & 4 }5`; + ~~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var e6 = `${ 3 & 4 }` - 6; + ~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var f6 = `2${ 3 & 4 }` - 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var g6 = `${ 3 & 4 }5` - 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var h6 = `2${ 3 & 4 }5` - 6; + ~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + var a7 = 1 * `${ 3 - 4 }`; + ~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var b7 = 1 * `2${ 3 - 4 }`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var c7 = 1 * `${ 3 - 4 }5`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var d7 = 1 * `2${ 3 - 4 }5`; + ~~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var e7 = `${ 3 - 4 }` * 6; + ~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var f7 = `2${ 3 - 4 }` * 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var g7 = `${ 3 - 4 }5` * 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var h7 = `2${ 3 - 4 }5` * 6; + ~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + var a8 = 1 * `${ 3 * 4 }`; + ~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var b8 = 1 * `2${ 3 * 4 }`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var c8 = 1 * `${ 3 * 4 }5`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var d8 = 1 * `2${ 3 * 4 }5`; + ~~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var e8 = `${ 3 * 4 }` * 6; + ~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var f8 = `2${ 3 * 4 }` * 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var g8 = `${ 3 * 4 }5` * 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var h8 = `2${ 3 * 4 }5` * 6; + ~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + var a9 = 1 * `${ 3 & 4 }`; + ~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var b9 = 1 * `2${ 3 & 4 }`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var c9 = 1 * `${ 3 & 4 }5`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var d9 = 1 * `2${ 3 & 4 }5`; + ~~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var e9 = `${ 3 & 4 }` * 6; + ~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var f9 = `2${ 3 & 4 }` * 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var g9 = `${ 3 & 4 }5` * 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var h9 = `2${ 3 & 4 }5` * 6; + ~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + var aa = 1 & `${ 3 - 4 }`; + ~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var ba = 1 & `2${ 3 - 4 }`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var ca = 1 & `${ 3 - 4 }5`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var da = 1 & `2${ 3 - 4 }5`; + ~~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var ea = `${ 3 - 4 }` & 6; + ~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var fa = `2${ 3 - 4 }` & 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var ga = `${ 3 - 4 }5` & 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var ha = `2${ 3 - 4 }5` & 6; + ~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + var ab = 1 & `${ 3 * 4 }`; + ~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var bb = 1 & `2${ 3 * 4 }`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var cb = 1 & `${ 3 * 4 }5`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var db = 1 & `2${ 3 * 4 }5`; + ~~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var eb = `${ 3 * 4 }` & 6; + ~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var fb = `2${ 3 * 4 }` & 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var gb = `${ 3 * 4 }5` & 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var hb = `2${ 3 * 4 }5` & 6; + ~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + var ac = 1 & `${ 3 & 4 }`; + ~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var bc = 1 & `2${ 3 & 4 }`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var cc = 1 & `${ 3 & 4 }5`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var dc = 1 & `2${ 3 & 4 }5`; + ~~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var ec = `${ 3 & 4 }` & 6; + ~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var fc = `2${ 3 & 4 }` & 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var gc = `${ 3 & 4 }5` & 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var hc = `2${ 3 & 4 }5` & 6; + ~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + \ No newline at end of file diff --git a/tests/baselines/reference/templateStringBinaryOperationsES6Invalid.js b/tests/baselines/reference/templateStringBinaryOperationsES6Invalid.js new file mode 100644 index 0000000000000..4408fd1ffe9c1 --- /dev/null +++ b/tests/baselines/reference/templateStringBinaryOperationsES6Invalid.js @@ -0,0 +1,207 @@ +//// [templateStringBinaryOperationsES6Invalid.ts] +var a = 1 - `${ 3 }`; +var b = 1 - `2${ 3 }`; +var c = 1 - `${ 3 }4`; +var d = 1 - `2${ 3 }4`; +var e = `${ 3 }` - 5; +var f = `2${ 3 }` - 5; +var g = `${ 3 }4` - 5; +var h = `2${ 3 }4` - 5; + +var a2 = 1 * `${ 3 }`; +var b2 = 1 * `2${ 3 }`; +var c2 = 1 * `${ 3 }4`; +var d2 = 1 * `2${ 3 }4`; +var e2 = `${ 3 }` * 5; +var f2 = `2${ 3 }` * 5; +var g2 = `${ 3 }4` * 5; +var h2 = `2${ 3 }4` * 5; + +var a3 = 1 & `${ 3 }`; +var b3 = 1 & `2${ 3 }`; +var c3 = 1 & `${ 3 }4`; +var d3 = 1 & `2${ 3 }4`; +var e3 = `${ 3 }` & 5; +var f3 = `2${ 3 }` & 5; +var g3 = `${ 3 }4` & 5; +var h3 = `2${ 3 }4` & 5; + +var a4 = 1 - `${ 3 - 4 }`; +var b4 = 1 - `2${ 3 - 4 }`; +var c4 = 1 - `${ 3 - 4 }5`; +var d4 = 1 - `2${ 3 - 4 }5`; +var e4 = `${ 3 - 4 }` - 6; +var f4 = `2${ 3 - 4 }` - 6; +var g4 = `${ 3 - 4 }5` - 6; +var h4 = `2${ 3 - 4 }5` - 6; + +var a5 = 1 - `${ 3 * 4 }`; +var b5 = 1 - `2${ 3 * 4 }`; +var c5 = 1 - `${ 3 * 4 }5`; +var d5 = 1 - `2${ 3 * 4 }5`; +var e5 = `${ 3 * 4 }` - 6; +var f5 = `2${ 3 * 4 }` - 6; +var g5 = `${ 3 * 4 }5` - 6; +var h5 = `2${ 3 * 4 }5` - 6; + +var a6 = 1 - `${ 3 & 4 }`; +var b6 = 1 - `2${ 3 & 4 }`; +var c6 = 1 - `${ 3 & 4 }5`; +var d6 = 1 - `2${ 3 & 4 }5`; +var e6 = `${ 3 & 4 }` - 6; +var f6 = `2${ 3 & 4 }` - 6; +var g6 = `${ 3 & 4 }5` - 6; +var h6 = `2${ 3 & 4 }5` - 6; + +var a7 = 1 * `${ 3 - 4 }`; +var b7 = 1 * `2${ 3 - 4 }`; +var c7 = 1 * `${ 3 - 4 }5`; +var d7 = 1 * `2${ 3 - 4 }5`; +var e7 = `${ 3 - 4 }` * 6; +var f7 = `2${ 3 - 4 }` * 6; +var g7 = `${ 3 - 4 }5` * 6; +var h7 = `2${ 3 - 4 }5` * 6; + +var a8 = 1 * `${ 3 * 4 }`; +var b8 = 1 * `2${ 3 * 4 }`; +var c8 = 1 * `${ 3 * 4 }5`; +var d8 = 1 * `2${ 3 * 4 }5`; +var e8 = `${ 3 * 4 }` * 6; +var f8 = `2${ 3 * 4 }` * 6; +var g8 = `${ 3 * 4 }5` * 6; +var h8 = `2${ 3 * 4 }5` * 6; + +var a9 = 1 * `${ 3 & 4 }`; +var b9 = 1 * `2${ 3 & 4 }`; +var c9 = 1 * `${ 3 & 4 }5`; +var d9 = 1 * `2${ 3 & 4 }5`; +var e9 = `${ 3 & 4 }` * 6; +var f9 = `2${ 3 & 4 }` * 6; +var g9 = `${ 3 & 4 }5` * 6; +var h9 = `2${ 3 & 4 }5` * 6; + +var aa = 1 & `${ 3 - 4 }`; +var ba = 1 & `2${ 3 - 4 }`; +var ca = 1 & `${ 3 - 4 }5`; +var da = 1 & `2${ 3 - 4 }5`; +var ea = `${ 3 - 4 }` & 6; +var fa = `2${ 3 - 4 }` & 6; +var ga = `${ 3 - 4 }5` & 6; +var ha = `2${ 3 - 4 }5` & 6; + +var ab = 1 & `${ 3 * 4 }`; +var bb = 1 & `2${ 3 * 4 }`; +var cb = 1 & `${ 3 * 4 }5`; +var db = 1 & `2${ 3 * 4 }5`; +var eb = `${ 3 * 4 }` & 6; +var fb = `2${ 3 * 4 }` & 6; +var gb = `${ 3 * 4 }5` & 6; +var hb = `2${ 3 * 4 }5` & 6; + +var ac = 1 & `${ 3 & 4 }`; +var bc = 1 & `2${ 3 & 4 }`; +var cc = 1 & `${ 3 & 4 }5`; +var dc = 1 & `2${ 3 & 4 }5`; +var ec = `${ 3 & 4 }` & 6; +var fc = `2${ 3 & 4 }` & 6; +var gc = `${ 3 & 4 }5` & 6; +var hc = `2${ 3 & 4 }5` & 6; + + +//// [templateStringBinaryOperationsES6Invalid.js] +var a = 1 - `${3}`; +var b = 1 - `2${3}`; +var c = 1 - `${3}4`; +var d = 1 - `2${3}4`; +var e = `${3}` - 5; +var f = `2${3}` - 5; +var g = `${3}4` - 5; +var h = `2${3}4` - 5; +var a2 = 1 * `${3}`; +var b2 = 1 * `2${3}`; +var c2 = 1 * `${3}4`; +var d2 = 1 * `2${3}4`; +var e2 = `${3}` * 5; +var f2 = `2${3}` * 5; +var g2 = `${3}4` * 5; +var h2 = `2${3}4` * 5; +var a3 = 1 & `${3}`; +var b3 = 1 & `2${3}`; +var c3 = 1 & `${3}4`; +var d3 = 1 & `2${3}4`; +var e3 = `${3}` & 5; +var f3 = `2${3}` & 5; +var g3 = `${3}4` & 5; +var h3 = `2${3}4` & 5; +var a4 = 1 - `${3 - 4}`; +var b4 = 1 - `2${3 - 4}`; +var c4 = 1 - `${3 - 4}5`; +var d4 = 1 - `2${3 - 4}5`; +var e4 = `${3 - 4}` - 6; +var f4 = `2${3 - 4}` - 6; +var g4 = `${3 - 4}5` - 6; +var h4 = `2${3 - 4}5` - 6; +var a5 = 1 - `${3 * 4}`; +var b5 = 1 - `2${3 * 4}`; +var c5 = 1 - `${3 * 4}5`; +var d5 = 1 - `2${3 * 4}5`; +var e5 = `${3 * 4}` - 6; +var f5 = `2${3 * 4}` - 6; +var g5 = `${3 * 4}5` - 6; +var h5 = `2${3 * 4}5` - 6; +var a6 = 1 - `${3 & 4}`; +var b6 = 1 - `2${3 & 4}`; +var c6 = 1 - `${3 & 4}5`; +var d6 = 1 - `2${3 & 4}5`; +var e6 = `${3 & 4}` - 6; +var f6 = `2${3 & 4}` - 6; +var g6 = `${3 & 4}5` - 6; +var h6 = `2${3 & 4}5` - 6; +var a7 = 1 * `${3 - 4}`; +var b7 = 1 * `2${3 - 4}`; +var c7 = 1 * `${3 - 4}5`; +var d7 = 1 * `2${3 - 4}5`; +var e7 = `${3 - 4}` * 6; +var f7 = `2${3 - 4}` * 6; +var g7 = `${3 - 4}5` * 6; +var h7 = `2${3 - 4}5` * 6; +var a8 = 1 * `${3 * 4}`; +var b8 = 1 * `2${3 * 4}`; +var c8 = 1 * `${3 * 4}5`; +var d8 = 1 * `2${3 * 4}5`; +var e8 = `${3 * 4}` * 6; +var f8 = `2${3 * 4}` * 6; +var g8 = `${3 * 4}5` * 6; +var h8 = `2${3 * 4}5` * 6; +var a9 = 1 * `${3 & 4}`; +var b9 = 1 * `2${3 & 4}`; +var c9 = 1 * `${3 & 4}5`; +var d9 = 1 * `2${3 & 4}5`; +var e9 = `${3 & 4}` * 6; +var f9 = `2${3 & 4}` * 6; +var g9 = `${3 & 4}5` * 6; +var h9 = `2${3 & 4}5` * 6; +var aa = 1 & `${3 - 4}`; +var ba = 1 & `2${3 - 4}`; +var ca = 1 & `${3 - 4}5`; +var da = 1 & `2${3 - 4}5`; +var ea = `${3 - 4}` & 6; +var fa = `2${3 - 4}` & 6; +var ga = `${3 - 4}5` & 6; +var ha = `2${3 - 4}5` & 6; +var ab = 1 & `${3 * 4}`; +var bb = 1 & `2${3 * 4}`; +var cb = 1 & `${3 * 4}5`; +var db = 1 & `2${3 * 4}5`; +var eb = `${3 * 4}` & 6; +var fb = `2${3 * 4}` & 6; +var gb = `${3 * 4}5` & 6; +var hb = `2${3 * 4}5` & 6; +var ac = 1 & `${3 & 4}`; +var bc = 1 & `2${3 & 4}`; +var cc = 1 & `${3 & 4}5`; +var dc = 1 & `2${3 & 4}5`; +var ec = `${3 & 4}` & 6; +var fc = `2${3 & 4}` & 6; +var gc = `${3 & 4}5` & 6; +var hc = `2${3 & 4}5` & 6; diff --git a/tests/baselines/reference/templateStringBinaryOperationsInvalid.errors.txt b/tests/baselines/reference/templateStringBinaryOperationsInvalid.errors.txt new file mode 100644 index 0000000000000..8a6a9719a570f --- /dev/null +++ b/tests/baselines/reference/templateStringBinaryOperationsInvalid.errors.txt @@ -0,0 +1,399 @@ +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(1,13): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(2,13): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(3,13): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(4,13): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(5,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(6,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(7,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(8,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(10,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(11,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(12,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(13,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(14,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(15,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(16,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(17,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(19,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(20,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(21,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(22,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(23,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(24,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(25,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(26,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(28,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(29,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(30,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(31,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(32,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(33,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(34,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(35,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(37,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(38,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(39,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(40,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(41,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(42,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(43,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(44,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(46,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(47,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(48,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(49,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(50,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(51,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(52,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(53,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(55,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(56,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(57,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(58,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(59,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(60,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(61,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(62,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(64,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(65,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(66,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(67,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(68,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(69,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(70,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(71,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(73,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(74,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(75,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(76,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(77,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(78,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(79,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(80,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(82,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(83,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(84,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(85,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(86,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(87,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(88,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(89,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(91,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(92,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(93,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(94,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(95,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(96,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(97,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(98,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(100,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(101,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(102,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(103,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(104,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(105,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(106,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts(107,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + +==== tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts (96 errors) ==== + var a = 1 - `${ 3 }`; + ~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var b = 1 - `2${ 3 }`; + ~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var c = 1 - `${ 3 }4`; + ~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var d = 1 - `2${ 3 }4`; + ~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var e = `${ 3 }` - 5; + ~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var f = `2${ 3 }` - 5; + ~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var g = `${ 3 }4` - 5; + ~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var h = `2${ 3 }4` - 5; + ~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + var a2 = 1 * `${ 3 }`; + ~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var b2 = 1 * `2${ 3 }`; + ~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var c2 = 1 * `${ 3 }4`; + ~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var d2 = 1 * `2${ 3 }4`; + ~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var e2 = `${ 3 }` * 5; + ~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var f2 = `2${ 3 }` * 5; + ~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var g2 = `${ 3 }4` * 5; + ~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var h2 = `2${ 3 }4` * 5; + ~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + var a3 = 1 & `${ 3 }`; + ~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var b3 = 1 & `2${ 3 }`; + ~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var c3 = 1 & `${ 3 }4`; + ~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var d3 = 1 & `2${ 3 }4`; + ~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var e3 = `${ 3 }` & 5; + ~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var f3 = `2${ 3 }` & 5; + ~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var g3 = `${ 3 }4` & 5; + ~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var h3 = `2${ 3 }4` & 5; + ~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + var a4 = 1 - `${ 3 - 4 }`; + ~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var b4 = 1 - `2${ 3 - 4 }`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var c4 = 1 - `${ 3 - 4 }5`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var d4 = 1 - `2${ 3 - 4 }5`; + ~~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var e4 = `${ 3 - 4 }` - 6; + ~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var f4 = `2${ 3 - 4 }` - 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var g4 = `${ 3 - 4 }5` - 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var h4 = `2${ 3 - 4 }5` - 6; + ~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + var a5 = 1 - `${ 3 * 4 }`; + ~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var b5 = 1 - `2${ 3 * 4 }`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var c5 = 1 - `${ 3 * 4 }5`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var d5 = 1 - `2${ 3 * 4 }5`; + ~~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var e5 = `${ 3 * 4 }` - 6; + ~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var f5 = `2${ 3 * 4 }` - 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var g5 = `${ 3 * 4 }5` - 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var h5 = `2${ 3 * 4 }5` - 6; + ~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + var a6 = 1 - `${ 3 & 4 }`; + ~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var b6 = 1 - `2${ 3 & 4 }`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var c6 = 1 - `${ 3 & 4 }5`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var d6 = 1 - `2${ 3 & 4 }5`; + ~~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var e6 = `${ 3 & 4 }` - 6; + ~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var f6 = `2${ 3 & 4 }` - 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var g6 = `${ 3 & 4 }5` - 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var h6 = `2${ 3 & 4 }5` - 6; + ~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + var a7 = 1 * `${ 3 - 4 }`; + ~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var b7 = 1 * `2${ 3 - 4 }`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var c7 = 1 * `${ 3 - 4 }5`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var d7 = 1 * `2${ 3 - 4 }5`; + ~~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var e7 = `${ 3 - 4 }` * 6; + ~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var f7 = `2${ 3 - 4 }` * 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var g7 = `${ 3 - 4 }5` * 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var h7 = `2${ 3 - 4 }5` * 6; + ~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + var a8 = 1 * `${ 3 * 4 }`; + ~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var b8 = 1 * `2${ 3 * 4 }`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var c8 = 1 * `${ 3 * 4 }5`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var d8 = 1 * `2${ 3 * 4 }5`; + ~~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var e8 = `${ 3 * 4 }` * 6; + ~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var f8 = `2${ 3 * 4 }` * 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var g8 = `${ 3 * 4 }5` * 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var h8 = `2${ 3 * 4 }5` * 6; + ~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + var a9 = 1 * `${ 3 & 4 }`; + ~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var b9 = 1 * `2${ 3 & 4 }`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var c9 = 1 * `${ 3 & 4 }5`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var d9 = 1 * `2${ 3 & 4 }5`; + ~~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var e9 = `${ 3 & 4 }` * 6; + ~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var f9 = `2${ 3 & 4 }` * 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var g9 = `${ 3 & 4 }5` * 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var h9 = `2${ 3 & 4 }5` * 6; + ~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + var aa = 1 & `${ 3 - 4 }`; + ~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var ba = 1 & `2${ 3 - 4 }`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var ca = 1 & `${ 3 - 4 }5`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var da = 1 & `2${ 3 - 4 }5`; + ~~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var ea = `${ 3 - 4 }` & 6; + ~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var fa = `2${ 3 - 4 }` & 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var ga = `${ 3 - 4 }5` & 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var ha = `2${ 3 - 4 }5` & 6; + ~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + var ab = 1 & `${ 3 * 4 }`; + ~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var bb = 1 & `2${ 3 * 4 }`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var cb = 1 & `${ 3 * 4 }5`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var db = 1 & `2${ 3 * 4 }5`; + ~~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var eb = `${ 3 * 4 }` & 6; + ~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var fb = `2${ 3 * 4 }` & 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var gb = `${ 3 * 4 }5` & 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var hb = `2${ 3 * 4 }5` & 6; + ~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + var ac = 1 & `${ 3 & 4 }`; + ~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var bc = 1 & `2${ 3 & 4 }`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var cc = 1 & `${ 3 & 4 }5`; + ~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var dc = 1 & `2${ 3 & 4 }5`; + ~~~~~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var ec = `${ 3 & 4 }` & 6; + ~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var fc = `2${ 3 & 4 }` & 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var gc = `${ 3 & 4 }5` & 6; + ~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var hc = `2${ 3 & 4 }5` & 6; + ~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + \ No newline at end of file diff --git a/tests/baselines/reference/templateStringBinaryOperationsInvalid.js b/tests/baselines/reference/templateStringBinaryOperationsInvalid.js new file mode 100644 index 0000000000000..1edf1d3a56395 --- /dev/null +++ b/tests/baselines/reference/templateStringBinaryOperationsInvalid.js @@ -0,0 +1,207 @@ +//// [templateStringBinaryOperationsInvalid.ts] +var a = 1 - `${ 3 }`; +var b = 1 - `2${ 3 }`; +var c = 1 - `${ 3 }4`; +var d = 1 - `2${ 3 }4`; +var e = `${ 3 }` - 5; +var f = `2${ 3 }` - 5; +var g = `${ 3 }4` - 5; +var h = `2${ 3 }4` - 5; + +var a2 = 1 * `${ 3 }`; +var b2 = 1 * `2${ 3 }`; +var c2 = 1 * `${ 3 }4`; +var d2 = 1 * `2${ 3 }4`; +var e2 = `${ 3 }` * 5; +var f2 = `2${ 3 }` * 5; +var g2 = `${ 3 }4` * 5; +var h2 = `2${ 3 }4` * 5; + +var a3 = 1 & `${ 3 }`; +var b3 = 1 & `2${ 3 }`; +var c3 = 1 & `${ 3 }4`; +var d3 = 1 & `2${ 3 }4`; +var e3 = `${ 3 }` & 5; +var f3 = `2${ 3 }` & 5; +var g3 = `${ 3 }4` & 5; +var h3 = `2${ 3 }4` & 5; + +var a4 = 1 - `${ 3 - 4 }`; +var b4 = 1 - `2${ 3 - 4 }`; +var c4 = 1 - `${ 3 - 4 }5`; +var d4 = 1 - `2${ 3 - 4 }5`; +var e4 = `${ 3 - 4 }` - 6; +var f4 = `2${ 3 - 4 }` - 6; +var g4 = `${ 3 - 4 }5` - 6; +var h4 = `2${ 3 - 4 }5` - 6; + +var a5 = 1 - `${ 3 * 4 }`; +var b5 = 1 - `2${ 3 * 4 }`; +var c5 = 1 - `${ 3 * 4 }5`; +var d5 = 1 - `2${ 3 * 4 }5`; +var e5 = `${ 3 * 4 }` - 6; +var f5 = `2${ 3 * 4 }` - 6; +var g5 = `${ 3 * 4 }5` - 6; +var h5 = `2${ 3 * 4 }5` - 6; + +var a6 = 1 - `${ 3 & 4 }`; +var b6 = 1 - `2${ 3 & 4 }`; +var c6 = 1 - `${ 3 & 4 }5`; +var d6 = 1 - `2${ 3 & 4 }5`; +var e6 = `${ 3 & 4 }` - 6; +var f6 = `2${ 3 & 4 }` - 6; +var g6 = `${ 3 & 4 }5` - 6; +var h6 = `2${ 3 & 4 }5` - 6; + +var a7 = 1 * `${ 3 - 4 }`; +var b7 = 1 * `2${ 3 - 4 }`; +var c7 = 1 * `${ 3 - 4 }5`; +var d7 = 1 * `2${ 3 - 4 }5`; +var e7 = `${ 3 - 4 }` * 6; +var f7 = `2${ 3 - 4 }` * 6; +var g7 = `${ 3 - 4 }5` * 6; +var h7 = `2${ 3 - 4 }5` * 6; + +var a8 = 1 * `${ 3 * 4 }`; +var b8 = 1 * `2${ 3 * 4 }`; +var c8 = 1 * `${ 3 * 4 }5`; +var d8 = 1 * `2${ 3 * 4 }5`; +var e8 = `${ 3 * 4 }` * 6; +var f8 = `2${ 3 * 4 }` * 6; +var g8 = `${ 3 * 4 }5` * 6; +var h8 = `2${ 3 * 4 }5` * 6; + +var a9 = 1 * `${ 3 & 4 }`; +var b9 = 1 * `2${ 3 & 4 }`; +var c9 = 1 * `${ 3 & 4 }5`; +var d9 = 1 * `2${ 3 & 4 }5`; +var e9 = `${ 3 & 4 }` * 6; +var f9 = `2${ 3 & 4 }` * 6; +var g9 = `${ 3 & 4 }5` * 6; +var h9 = `2${ 3 & 4 }5` * 6; + +var aa = 1 & `${ 3 - 4 }`; +var ba = 1 & `2${ 3 - 4 }`; +var ca = 1 & `${ 3 - 4 }5`; +var da = 1 & `2${ 3 - 4 }5`; +var ea = `${ 3 - 4 }` & 6; +var fa = `2${ 3 - 4 }` & 6; +var ga = `${ 3 - 4 }5` & 6; +var ha = `2${ 3 - 4 }5` & 6; + +var ab = 1 & `${ 3 * 4 }`; +var bb = 1 & `2${ 3 * 4 }`; +var cb = 1 & `${ 3 * 4 }5`; +var db = 1 & `2${ 3 * 4 }5`; +var eb = `${ 3 * 4 }` & 6; +var fb = `2${ 3 * 4 }` & 6; +var gb = `${ 3 * 4 }5` & 6; +var hb = `2${ 3 * 4 }5` & 6; + +var ac = 1 & `${ 3 & 4 }`; +var bc = 1 & `2${ 3 & 4 }`; +var cc = 1 & `${ 3 & 4 }5`; +var dc = 1 & `2${ 3 & 4 }5`; +var ec = `${ 3 & 4 }` & 6; +var fc = `2${ 3 & 4 }` & 6; +var gc = `${ 3 & 4 }5` & 6; +var hc = `2${ 3 & 4 }5` & 6; + + +//// [templateStringBinaryOperationsInvalid.js] +var a = 1 - ("" + 3); +var b = 1 - ("2" + 3); +var c = 1 - ("" + 3 + "4"); +var d = 1 - ("2" + 3 + "4"); +var e = ("" + 3) - 5; +var f = ("2" + 3) - 5; +var g = ("" + 3 + "4") - 5; +var h = ("2" + 3 + "4") - 5; +var a2 = 1 * ("" + 3); +var b2 = 1 * ("2" + 3); +var c2 = 1 * ("" + 3 + "4"); +var d2 = 1 * ("2" + 3 + "4"); +var e2 = ("" + 3) * 5; +var f2 = ("2" + 3) * 5; +var g2 = ("" + 3 + "4") * 5; +var h2 = ("2" + 3 + "4") * 5; +var a3 = 1 & "" + 3; +var b3 = 1 & "2" + 3; +var c3 = 1 & "" + 3 + "4"; +var d3 = 1 & "2" + 3 + "4"; +var e3 = "" + 3 & 5; +var f3 = "2" + 3 & 5; +var g3 = "" + 3 + "4" & 5; +var h3 = "2" + 3 + "4" & 5; +var a4 = 1 - ("" + (3 - 4)); +var b4 = 1 - ("2" + (3 - 4)); +var c4 = 1 - ("" + (3 - 4) + "5"); +var d4 = 1 - ("2" + (3 - 4) + "5"); +var e4 = ("" + (3 - 4)) - 6; +var f4 = ("2" + (3 - 4)) - 6; +var g4 = ("" + (3 - 4) + "5") - 6; +var h4 = ("2" + (3 - 4) + "5") - 6; +var a5 = 1 - ("" + 3 * 4); +var b5 = 1 - ("2" + 3 * 4); +var c5 = 1 - ("" + 3 * 4 + "5"); +var d5 = 1 - ("2" + 3 * 4 + "5"); +var e5 = ("" + 3 * 4) - 6; +var f5 = ("2" + 3 * 4) - 6; +var g5 = ("" + 3 * 4 + "5") - 6; +var h5 = ("2" + 3 * 4 + "5") - 6; +var a6 = 1 - ("" + (3 & 4)); +var b6 = 1 - ("2" + (3 & 4)); +var c6 = 1 - ("" + (3 & 4) + "5"); +var d6 = 1 - ("2" + (3 & 4) + "5"); +var e6 = ("" + (3 & 4)) - 6; +var f6 = ("2" + (3 & 4)) - 6; +var g6 = ("" + (3 & 4) + "5") - 6; +var h6 = ("2" + (3 & 4) + "5") - 6; +var a7 = 1 * ("" + (3 - 4)); +var b7 = 1 * ("2" + (3 - 4)); +var c7 = 1 * ("" + (3 - 4) + "5"); +var d7 = 1 * ("2" + (3 - 4) + "5"); +var e7 = ("" + (3 - 4)) * 6; +var f7 = ("2" + (3 - 4)) * 6; +var g7 = ("" + (3 - 4) + "5") * 6; +var h7 = ("2" + (3 - 4) + "5") * 6; +var a8 = 1 * ("" + 3 * 4); +var b8 = 1 * ("2" + 3 * 4); +var c8 = 1 * ("" + 3 * 4 + "5"); +var d8 = 1 * ("2" + 3 * 4 + "5"); +var e8 = ("" + 3 * 4) * 6; +var f8 = ("2" + 3 * 4) * 6; +var g8 = ("" + 3 * 4 + "5") * 6; +var h8 = ("2" + 3 * 4 + "5") * 6; +var a9 = 1 * ("" + (3 & 4)); +var b9 = 1 * ("2" + (3 & 4)); +var c9 = 1 * ("" + (3 & 4) + "5"); +var d9 = 1 * ("2" + (3 & 4) + "5"); +var e9 = ("" + (3 & 4)) * 6; +var f9 = ("2" + (3 & 4)) * 6; +var g9 = ("" + (3 & 4) + "5") * 6; +var h9 = ("2" + (3 & 4) + "5") * 6; +var aa = 1 & "" + (3 - 4); +var ba = 1 & "2" + (3 - 4); +var ca = 1 & "" + (3 - 4) + "5"; +var da = 1 & "2" + (3 - 4) + "5"; +var ea = "" + (3 - 4) & 6; +var fa = "2" + (3 - 4) & 6; +var ga = "" + (3 - 4) + "5" & 6; +var ha = "2" + (3 - 4) + "5" & 6; +var ab = 1 & "" + 3 * 4; +var bb = 1 & "2" + 3 * 4; +var cb = 1 & "" + 3 * 4 + "5"; +var db = 1 & "2" + 3 * 4 + "5"; +var eb = "" + 3 * 4 & 6; +var fb = "2" + 3 * 4 & 6; +var gb = "" + 3 * 4 + "5" & 6; +var hb = "2" + 3 * 4 + "5" & 6; +var ac = 1 & "" + (3 & 4); +var bc = 1 & "2" + (3 & 4); +var cc = 1 & "" + (3 & 4) + "5"; +var dc = 1 & "2" + (3 & 4) + "5"; +var ec = "" + (3 & 4) & 6; +var fc = "2" + (3 & 4) & 6; +var gc = "" + (3 & 4) + "5" & 6; +var hc = "2" + (3 & 4) + "5" & 6; diff --git a/tests/baselines/reference/templateStringInBinaryAddition.js b/tests/baselines/reference/templateStringInBinaryAddition.js deleted file mode 100644 index 0e1f728005ca1..0000000000000 --- a/tests/baselines/reference/templateStringInBinaryAddition.js +++ /dev/null @@ -1,5 +0,0 @@ -//// [templateStringInBinaryAddition.ts] -var x = 10 + `abc${ 10 }def`; - -//// [templateStringInBinaryAddition.js] -var x = 10 + ("abc" + 10 + "def"); diff --git a/tests/baselines/reference/templateStringInBinaryAddition.types b/tests/baselines/reference/templateStringInBinaryAddition.types deleted file mode 100644 index f722ff696f490..0000000000000 --- a/tests/baselines/reference/templateStringInBinaryAddition.types +++ /dev/null @@ -1,5 +0,0 @@ -=== tests/cases/conformance/es6/templates/templateStringInBinaryAddition.ts === -var x = 10 + `abc${ 10 }def`; ->x : string ->10 + `abc${ 10 }def` : string - diff --git a/tests/baselines/reference/templateStringInBinaryAdditionES6.js b/tests/baselines/reference/templateStringInBinaryAdditionES6.js deleted file mode 100644 index 7a40d4cc54fa6..0000000000000 --- a/tests/baselines/reference/templateStringInBinaryAdditionES6.js +++ /dev/null @@ -1,5 +0,0 @@ -//// [templateStringInBinaryAdditionES6.ts] -var x = 10 + `abc${ 10 }def`; - -//// [templateStringInBinaryAdditionES6.js] -var x = 10 + `abc${10}def`; diff --git a/tests/baselines/reference/templateStringInBinaryAdditionES6.types b/tests/baselines/reference/templateStringInBinaryAdditionES6.types deleted file mode 100644 index b421d7dc70ec9..0000000000000 --- a/tests/baselines/reference/templateStringInBinaryAdditionES6.types +++ /dev/null @@ -1,5 +0,0 @@ -=== tests/cases/conformance/es6/templates/templateStringInBinaryAdditionES6.ts === -var x = 10 + `abc${ 10 }def`; ->x : string ->10 + `abc${ 10 }def` : string - diff --git a/tests/cases/conformance/es6/templates/templateStringBinaryOperations.ts b/tests/cases/conformance/es6/templates/templateStringBinaryOperations.ts new file mode 100644 index 0000000000000..28313595f9911 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringBinaryOperations.ts @@ -0,0 +1,51 @@ +var a = 1 + `${ 3 }`; +var b = 1 + `2${ 3 }`; +var c = 1 + `${ 3 }4`; +var d = 1 + `2${ 3 }4`; +var e = `${ 3 }` + 5; +var f = `2${ 3 }` + 5; +var g = `${ 3 }4` + 5; +var h = `2${ 3 }4` + 5; +var i = 1 + `${ 3 }` + 5; +var j = 1 + `2${ 3 }` + 5; +var k = 1 + `${ 3 }4` + 5; +var l = 1 + `2${ 3 }4` + 5; + +var a2 = 1 + `${ 3 - 4 }`; +var b2 = 1 + `2${ 3 - 4 }`; +var c2 = 1 + `${ 3 - 4 }5`; +var d2 = 1 + `2${ 3 - 4 }5`; +var e2 = `${ 3 - 4 }` + 6; +var f2 = `2${ 3 - 4 }` + 6; +var g2 = `${ 3 - 4 }5` + 6; +var h2 = `2${ 3 - 4 }5` + 6; +var i2 = 1 + `${ 3 - 4 }` + 6; +var j2 = 1 + `2${ 3 - 4 }` + 6; +var k2 = 1 + `${ 3 - 4 }5` + 6; +var l2 = 1 + `2${ 3 - 4 }5` + 6; + +var a3 = 1 + `${ 3 * 4 }`; +var b3 = 1 + `2${ 3 * 4 }`; +var c3 = 1 + `${ 3 * 4 }5`; +var d3 = 1 + `2${ 3 * 4 }5`; +var e3 = `${ 3 * 4 }` + 6; +var f3 = `2${ 3 * 4 }` + 6; +var g3 = `${ 3 * 4 }5` + 6; +var h3 = `2${ 3 * 4 }5` + 6; +var i3 = 1 + `${ 3 * 4 }` + 6; +var j3 = 1 + `2${ 3 * 4 }` + 6; +var k3 = 1 + `${ 3 * 4 }5` + 6; +var l3 = 1 + `2${ 3 * 4 }5` + 6; + +var a4 = 1 + `${ 3 & 4 }`; +var b4 = 1 + `2${ 3 & 4 }`; +var c4 = 1 + `${ 3 & 4 }5`; +var d4 = 1 + `2${ 3 & 4 }5`; +var e4 = `${ 3 & 4 }` + 6; +var f4 = `2${ 3 & 4 }` + 6; +var g4 = `${ 3 & 4 }5` + 6; +var h4 = `2${ 3 & 4 }5` + 6; +var i4 = 1 + `${ 3 & 4 }` + 6; +var j4 = 1 + `2${ 3 & 4 }` + 6; +var k4 = 1 + `${ 3 & 4 }5` + 6; +var l4 = 1 + `2${ 3 & 4 }5` + 6; diff --git a/tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6.ts b/tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6.ts new file mode 100644 index 0000000000000..d734c9b4cb90a --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6.ts @@ -0,0 +1,52 @@ +// @target: ES6 +var a = 1 + `${ 3 }`; +var b = 1 + `2${ 3 }`; +var c = 1 + `${ 3 }4`; +var d = 1 + `2${ 3 }4`; +var e = `${ 3 }` + 5; +var f = `2${ 3 }` + 5; +var g = `${ 3 }4` + 5; +var h = `2${ 3 }4` + 5; +var i = 1 + `${ 3 }` + 5; +var j = 1 + `2${ 3 }` + 5; +var k = 1 + `${ 3 }4` + 5; +var l = 1 + `2${ 3 }4` + 5; + +var a2 = 1 + `${ 3 - 4 }`; +var b2 = 1 + `2${ 3 - 4 }`; +var c2 = 1 + `${ 3 - 4 }5`; +var d2 = 1 + `2${ 3 - 4 }5`; +var e2 = `${ 3 - 4 }` + 6; +var f2 = `2${ 3 - 4 }` + 6; +var g2 = `${ 3 - 4 }5` + 6; +var h2 = `2${ 3 - 4 }5` + 6; +var i2 = 1 + `${ 3 - 4 }` + 6; +var j2 = 1 + `2${ 3 - 4 }` + 6; +var k2 = 1 + `${ 3 - 4 }5` + 6; +var l2 = 1 + `2${ 3 - 4 }5` + 6; + +var a3 = 1 + `${ 3 * 4 }`; +var b3 = 1 + `2${ 3 * 4 }`; +var c3 = 1 + `${ 3 * 4 }5`; +var d3 = 1 + `2${ 3 * 4 }5`; +var e3 = `${ 3 * 4 }` + 6; +var f3 = `2${ 3 * 4 }` + 6; +var g3 = `${ 3 * 4 }5` + 6; +var h3 = `2${ 3 * 4 }5` + 6; +var i3 = 1 + `${ 3 * 4 }` + 6; +var j3 = 1 + `2${ 3 * 4 }` + 6; +var k3 = 1 + `${ 3 * 4 }5` + 6; +var l3 = 1 + `2${ 3 * 4 }5` + 6; + +var a4 = 1 + `${ 3 & 4 }`; +var b4 = 1 + `2${ 3 & 4 }`; +var c4 = 1 + `${ 3 & 4 }5`; +var d4 = 1 + `2${ 3 & 4 }5`; +var e4 = `${ 3 & 4 }` + 6; +var f4 = `2${ 3 & 4 }` + 6; +var g4 = `${ 3 & 4 }5` + 6; +var h4 = `2${ 3 & 4 }5` + 6; +var i4 = 1 + `${ 3 & 4 }` + 6; +var j4 = 1 + `2${ 3 & 4 }` + 6; +var k4 = 1 + `${ 3 & 4 }5` + 6; +var l4 = 1 + `2${ 3 & 4 }5` + 6; diff --git a/tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts b/tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts new file mode 100644 index 0000000000000..0bfa84e05a5e6 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringBinaryOperationsES6Invalid.ts @@ -0,0 +1,108 @@ +// @target: ES6 +var a = 1 - `${ 3 }`; +var b = 1 - `2${ 3 }`; +var c = 1 - `${ 3 }4`; +var d = 1 - `2${ 3 }4`; +var e = `${ 3 }` - 5; +var f = `2${ 3 }` - 5; +var g = `${ 3 }4` - 5; +var h = `2${ 3 }4` - 5; + +var a2 = 1 * `${ 3 }`; +var b2 = 1 * `2${ 3 }`; +var c2 = 1 * `${ 3 }4`; +var d2 = 1 * `2${ 3 }4`; +var e2 = `${ 3 }` * 5; +var f2 = `2${ 3 }` * 5; +var g2 = `${ 3 }4` * 5; +var h2 = `2${ 3 }4` * 5; + +var a3 = 1 & `${ 3 }`; +var b3 = 1 & `2${ 3 }`; +var c3 = 1 & `${ 3 }4`; +var d3 = 1 & `2${ 3 }4`; +var e3 = `${ 3 }` & 5; +var f3 = `2${ 3 }` & 5; +var g3 = `${ 3 }4` & 5; +var h3 = `2${ 3 }4` & 5; + +var a4 = 1 - `${ 3 - 4 }`; +var b4 = 1 - `2${ 3 - 4 }`; +var c4 = 1 - `${ 3 - 4 }5`; +var d4 = 1 - `2${ 3 - 4 }5`; +var e4 = `${ 3 - 4 }` - 6; +var f4 = `2${ 3 - 4 }` - 6; +var g4 = `${ 3 - 4 }5` - 6; +var h4 = `2${ 3 - 4 }5` - 6; + +var a5 = 1 - `${ 3 * 4 }`; +var b5 = 1 - `2${ 3 * 4 }`; +var c5 = 1 - `${ 3 * 4 }5`; +var d5 = 1 - `2${ 3 * 4 }5`; +var e5 = `${ 3 * 4 }` - 6; +var f5 = `2${ 3 * 4 }` - 6; +var g5 = `${ 3 * 4 }5` - 6; +var h5 = `2${ 3 * 4 }5` - 6; + +var a6 = 1 - `${ 3 & 4 }`; +var b6 = 1 - `2${ 3 & 4 }`; +var c6 = 1 - `${ 3 & 4 }5`; +var d6 = 1 - `2${ 3 & 4 }5`; +var e6 = `${ 3 & 4 }` - 6; +var f6 = `2${ 3 & 4 }` - 6; +var g6 = `${ 3 & 4 }5` - 6; +var h6 = `2${ 3 & 4 }5` - 6; + +var a7 = 1 * `${ 3 - 4 }`; +var b7 = 1 * `2${ 3 - 4 }`; +var c7 = 1 * `${ 3 - 4 }5`; +var d7 = 1 * `2${ 3 - 4 }5`; +var e7 = `${ 3 - 4 }` * 6; +var f7 = `2${ 3 - 4 }` * 6; +var g7 = `${ 3 - 4 }5` * 6; +var h7 = `2${ 3 - 4 }5` * 6; + +var a8 = 1 * `${ 3 * 4 }`; +var b8 = 1 * `2${ 3 * 4 }`; +var c8 = 1 * `${ 3 * 4 }5`; +var d8 = 1 * `2${ 3 * 4 }5`; +var e8 = `${ 3 * 4 }` * 6; +var f8 = `2${ 3 * 4 }` * 6; +var g8 = `${ 3 * 4 }5` * 6; +var h8 = `2${ 3 * 4 }5` * 6; + +var a9 = 1 * `${ 3 & 4 }`; +var b9 = 1 * `2${ 3 & 4 }`; +var c9 = 1 * `${ 3 & 4 }5`; +var d9 = 1 * `2${ 3 & 4 }5`; +var e9 = `${ 3 & 4 }` * 6; +var f9 = `2${ 3 & 4 }` * 6; +var g9 = `${ 3 & 4 }5` * 6; +var h9 = `2${ 3 & 4 }5` * 6; + +var aa = 1 & `${ 3 - 4 }`; +var ba = 1 & `2${ 3 - 4 }`; +var ca = 1 & `${ 3 - 4 }5`; +var da = 1 & `2${ 3 - 4 }5`; +var ea = `${ 3 - 4 }` & 6; +var fa = `2${ 3 - 4 }` & 6; +var ga = `${ 3 - 4 }5` & 6; +var ha = `2${ 3 - 4 }5` & 6; + +var ab = 1 & `${ 3 * 4 }`; +var bb = 1 & `2${ 3 * 4 }`; +var cb = 1 & `${ 3 * 4 }5`; +var db = 1 & `2${ 3 * 4 }5`; +var eb = `${ 3 * 4 }` & 6; +var fb = `2${ 3 * 4 }` & 6; +var gb = `${ 3 * 4 }5` & 6; +var hb = `2${ 3 * 4 }5` & 6; + +var ac = 1 & `${ 3 & 4 }`; +var bc = 1 & `2${ 3 & 4 }`; +var cc = 1 & `${ 3 & 4 }5`; +var dc = 1 & `2${ 3 & 4 }5`; +var ec = `${ 3 & 4 }` & 6; +var fc = `2${ 3 & 4 }` & 6; +var gc = `${ 3 & 4 }5` & 6; +var hc = `2${ 3 & 4 }5` & 6; diff --git a/tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts b/tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts new file mode 100644 index 0000000000000..8770edcbd3766 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringBinaryOperationsInvalid.ts @@ -0,0 +1,107 @@ +var a = 1 - `${ 3 }`; +var b = 1 - `2${ 3 }`; +var c = 1 - `${ 3 }4`; +var d = 1 - `2${ 3 }4`; +var e = `${ 3 }` - 5; +var f = `2${ 3 }` - 5; +var g = `${ 3 }4` - 5; +var h = `2${ 3 }4` - 5; + +var a2 = 1 * `${ 3 }`; +var b2 = 1 * `2${ 3 }`; +var c2 = 1 * `${ 3 }4`; +var d2 = 1 * `2${ 3 }4`; +var e2 = `${ 3 }` * 5; +var f2 = `2${ 3 }` * 5; +var g2 = `${ 3 }4` * 5; +var h2 = `2${ 3 }4` * 5; + +var a3 = 1 & `${ 3 }`; +var b3 = 1 & `2${ 3 }`; +var c3 = 1 & `${ 3 }4`; +var d3 = 1 & `2${ 3 }4`; +var e3 = `${ 3 }` & 5; +var f3 = `2${ 3 }` & 5; +var g3 = `${ 3 }4` & 5; +var h3 = `2${ 3 }4` & 5; + +var a4 = 1 - `${ 3 - 4 }`; +var b4 = 1 - `2${ 3 - 4 }`; +var c4 = 1 - `${ 3 - 4 }5`; +var d4 = 1 - `2${ 3 - 4 }5`; +var e4 = `${ 3 - 4 }` - 6; +var f4 = `2${ 3 - 4 }` - 6; +var g4 = `${ 3 - 4 }5` - 6; +var h4 = `2${ 3 - 4 }5` - 6; + +var a5 = 1 - `${ 3 * 4 }`; +var b5 = 1 - `2${ 3 * 4 }`; +var c5 = 1 - `${ 3 * 4 }5`; +var d5 = 1 - `2${ 3 * 4 }5`; +var e5 = `${ 3 * 4 }` - 6; +var f5 = `2${ 3 * 4 }` - 6; +var g5 = `${ 3 * 4 }5` - 6; +var h5 = `2${ 3 * 4 }5` - 6; + +var a6 = 1 - `${ 3 & 4 }`; +var b6 = 1 - `2${ 3 & 4 }`; +var c6 = 1 - `${ 3 & 4 }5`; +var d6 = 1 - `2${ 3 & 4 }5`; +var e6 = `${ 3 & 4 }` - 6; +var f6 = `2${ 3 & 4 }` - 6; +var g6 = `${ 3 & 4 }5` - 6; +var h6 = `2${ 3 & 4 }5` - 6; + +var a7 = 1 * `${ 3 - 4 }`; +var b7 = 1 * `2${ 3 - 4 }`; +var c7 = 1 * `${ 3 - 4 }5`; +var d7 = 1 * `2${ 3 - 4 }5`; +var e7 = `${ 3 - 4 }` * 6; +var f7 = `2${ 3 - 4 }` * 6; +var g7 = `${ 3 - 4 }5` * 6; +var h7 = `2${ 3 - 4 }5` * 6; + +var a8 = 1 * `${ 3 * 4 }`; +var b8 = 1 * `2${ 3 * 4 }`; +var c8 = 1 * `${ 3 * 4 }5`; +var d8 = 1 * `2${ 3 * 4 }5`; +var e8 = `${ 3 * 4 }` * 6; +var f8 = `2${ 3 * 4 }` * 6; +var g8 = `${ 3 * 4 }5` * 6; +var h8 = `2${ 3 * 4 }5` * 6; + +var a9 = 1 * `${ 3 & 4 }`; +var b9 = 1 * `2${ 3 & 4 }`; +var c9 = 1 * `${ 3 & 4 }5`; +var d9 = 1 * `2${ 3 & 4 }5`; +var e9 = `${ 3 & 4 }` * 6; +var f9 = `2${ 3 & 4 }` * 6; +var g9 = `${ 3 & 4 }5` * 6; +var h9 = `2${ 3 & 4 }5` * 6; + +var aa = 1 & `${ 3 - 4 }`; +var ba = 1 & `2${ 3 - 4 }`; +var ca = 1 & `${ 3 - 4 }5`; +var da = 1 & `2${ 3 - 4 }5`; +var ea = `${ 3 - 4 }` & 6; +var fa = `2${ 3 - 4 }` & 6; +var ga = `${ 3 - 4 }5` & 6; +var ha = `2${ 3 - 4 }5` & 6; + +var ab = 1 & `${ 3 * 4 }`; +var bb = 1 & `2${ 3 * 4 }`; +var cb = 1 & `${ 3 * 4 }5`; +var db = 1 & `2${ 3 * 4 }5`; +var eb = `${ 3 * 4 }` & 6; +var fb = `2${ 3 * 4 }` & 6; +var gb = `${ 3 * 4 }5` & 6; +var hb = `2${ 3 * 4 }5` & 6; + +var ac = 1 & `${ 3 & 4 }`; +var bc = 1 & `2${ 3 & 4 }`; +var cc = 1 & `${ 3 & 4 }5`; +var dc = 1 & `2${ 3 & 4 }5`; +var ec = `${ 3 & 4 }` & 6; +var fc = `2${ 3 & 4 }` & 6; +var gc = `${ 3 & 4 }5` & 6; +var hc = `2${ 3 & 4 }5` & 6; diff --git a/tests/cases/conformance/es6/templates/templateStringInBinaryAddition.ts b/tests/cases/conformance/es6/templates/templateStringInBinaryAddition.ts deleted file mode 100644 index 7f00313ca868c..0000000000000 --- a/tests/cases/conformance/es6/templates/templateStringInBinaryAddition.ts +++ /dev/null @@ -1 +0,0 @@ -var x = 10 + `abc${ 10 }def`; \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringInBinaryAdditionES6.ts b/tests/cases/conformance/es6/templates/templateStringInBinaryAdditionES6.ts deleted file mode 100644 index 5f44e3cb9d47c..0000000000000 --- a/tests/cases/conformance/es6/templates/templateStringInBinaryAdditionES6.ts +++ /dev/null @@ -1,2 +0,0 @@ -// @target: ES6 -var x = 10 + `abc${ 10 }def`; \ No newline at end of file