From 8e16e1d010cca171c1da63bc285c6bccc50049c3 Mon Sep 17 00:00:00 2001 From: Ivo Gabe de Wolff Date: Fri, 6 Feb 2015 17:02:30 +0100 Subject: [PATCH] Update baselines --- ...ateStringsTypeArgumentInference.errors.txt | 86 +------------------ ...gedTemplateStringsTypeArgumentInference.js | 57 ++++++------ ...tringsWithIncompatibleTypedTags.errors.txt | 38 +------- ...emplateStringsWithIncompatibleTypedTags.js | 19 ++-- ...ithManyCallAndMemberExpressions.errors.txt | 21 ----- ...StringsWithManyCallAndMemberExpressions.js | 3 +- ...ingsWithManyCallAndMemberExpressions.types | 38 ++++++++ ...eStringsWithOverloadResolution1.errors.txt | 20 +---- ...dTemplateStringsWithOverloadResolution1.js | 13 +-- ...eStringsWithOverloadResolution2.errors.txt | 27 ------ ...dTemplateStringsWithOverloadResolution2.js | 5 +- ...mplateStringsWithOverloadResolution2.types | 60 +++++++++++++ ...eStringsWithOverloadResolution3.errors.txt | 68 +-------------- ...dTemplateStringsWithOverloadResolution3.js | 45 +++++----- ...mplateStringsWithTagsTypedAsAny.errors.txt | 64 -------------- ...taggedTemplateStringsWithTagsTypedAsAny.js | 21 ++--- ...gedTemplateStringsWithTagsTypedAsAny.types | 66 ++++++++++++++ ...essionsInSubstitutionExpression.errors.txt | 5 +- ...tionExpressionsInSubstitutionExpression.js | 5 +- ...gedTemplateStringsWithTypedTags.errors.txt | 64 -------------- .../taggedTemplateStringsWithTypedTags.js | 17 ++-- .../taggedTemplateStringsWithTypedTags.types | 82 ++++++++++++++++++ .../reference/templateStringInModuleName.js | 5 +- .../templateStringInObjectLiteral.js | 5 +- .../templateStringInPropertyName1.js | 3 +- .../templateStringInPropertyName2.js | 3 +- .../templateStringInTaggedTemplate.errors.txt | 7 +- .../templateStringInTaggedTemplate.js | 3 +- ...tringsArrayTypeDefinedInES5Mode.errors.txt | 7 +- ...emplateStringsArrayTypeDefinedInES5Mode.js | 3 +- ...ringsArrayTypeNotDefinedES5Mode.errors.txt | 7 +- ...mplateStringsArrayTypeNotDefinedES5Mode.js | 3 +- 32 files changed, 370 insertions(+), 500 deletions(-) delete mode 100644 tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressions.errors.txt create mode 100644 tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressions.types delete mode 100644 tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.errors.txt create mode 100644 tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.types delete mode 100644 tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.errors.txt create mode 100644 tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.types delete mode 100644 tests/baselines/reference/taggedTemplateStringsWithTypedTags.errors.txt create mode 100644 tests/baselines/reference/taggedTemplateStringsWithTypedTags.types diff --git a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.errors.txt b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.errors.txt index 275fdac6ac7..f3706ae8f17 100644 --- a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.errors.txt @@ -1,143 +1,69 @@ -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(5,10): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(9,17): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(13,16): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(16,16): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(20,16): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(23,16): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(27,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(28,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(29,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(33,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(34,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(35,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(39,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(40,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(41,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(45,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(46,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(47,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(51,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(52,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(53,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(57,23): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(58,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(64,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(64,25): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(77,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate '{ x: number; z: Date; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. Property 'z' is missing in type '{ x: number; y: string; }'. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(77,25): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(81,25): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(86,23): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(90,25): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -==== tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts (30 errors) ==== +==== tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts (2 errors) ==== // Generic tag with one parameter function noParams(n: T) { } noParams ``; - ~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic tag with parameter which does not use type parameter function noGenericParams(n: string[]) { } noGenericParams ``; - ~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic tag with multiple type parameters and only one used in parameter type annotation function someGenerics1a(n: T, m: number) { } someGenerics1a `${3}`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. function someGenerics1b(n: string[], m: U) { } someGenerics1b `${3}`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic tag with argument of function type whose parameter is of type parameter type function someGenerics2a(strs: string[], n: (x: T) => void) { } someGenerics2a `${(n: string) => n}`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. function someGenerics2b(strs: string[], n: (x: T, y: U) => void) { } someGenerics2b `${ (n: string, x: number) => n }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic tag with argument of function type whose parameter is not of type parameter type but body/return type uses type parameter function someGenerics3(strs: string[], producer: () => T) { } someGenerics3 `${() => ''}`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. someGenerics3 `${() => undefined}`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. someGenerics3 `${() => 3}`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // 2 parameter generic tag with argument 1 of type parameter type and argument 2 of function type whose parameter is of type parameter type function someGenerics4(strs: string[], n: T, f: (x: U) => void) { } someGenerics4 `${4}${ () => null }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. someGenerics4 `${''}${ () => 3 }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. someGenerics4 `${ null }${ null }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // 2 parameter generic tag with argument 2 of type parameter type and argument 1 of function type whose parameter is of type parameter type function someGenerics5(strs: string[], n: T, f: (x: U) => void) { } someGenerics5 `${ 4 } ${ () => null }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. someGenerics5 `${ '' }${ () => 3 }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. someGenerics5 `${null}${null}`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic tag with multiple arguments of function types that each have parameters of the same generic type function someGenerics6(strs: string[], a: (a: A) => A, b: (b: A) => A, c: (c: A) => A) { } someGenerics6 `${ n => n }${ n => n}${ n => n}`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. someGenerics6 `${ n => n }${ n => n}${ n => n}`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. someGenerics6 `${ (n: number) => n }${ (n: number) => n }${ (n: number) => n }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic tag with multiple arguments of function types that each have parameters of different generic type function someGenerics7(strs: string[], a: (a: A) => A, b: (b: B) => B, c: (c: C) => C) { } someGenerics7 `${ n => n }${ n => n }${ n => n }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. someGenerics7 `${ n => n }${ n => n }${ n => n }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. someGenerics7 `${(n: number) => n}${ (n: string) => n}${ (n: number) => n}`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic tag with argument of generic function type function someGenerics8(strs: string[], n: T): T { return n; } var x = someGenerics8 `${ someGenerics7 }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. x `${null}${null}${null}`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic tag with multiple parameters of generic type passed arguments with no best common type function someGenerics9(strs: string[], a: T, b: T, c: T): T { @@ -147,8 +73,6 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference ~~~~~~~~~~~~~ !!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. !!! error TS2453: Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var a9a: {}; // Generic tag with multiple parameters of generic type passed arguments with multiple best common types @@ -166,27 +90,19 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference !!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. !!! error TS2453: Type argument candidate '{ x: number; z: Date; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. !!! error TS2453: Property 'z' is missing in type '{ x: number; y: string; }'. - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var a9e: {}; // Generic tag with multiple parameters of generic type passed arguments with a single best common type var a9d = someGenerics9 `${ { x: 3 }}${ { x: 6 }}${ { x: 6 } }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var a9d: { x: number; }; // Generic tag with multiple parameters of generic type where one argument is of type 'any' var anyVar: any; var a = someGenerics9 `${ 7 }${ anyVar }${ 4 }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var a: any; // Generic tag with multiple parameters of generic type where one argument is [] and the other is not 'any' var arr = someGenerics9 `${ [] }${ null }${ undefined }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var arr: any[]; \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js index 6f3d4ed803a..04f74aa3752 100644 --- a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js +++ b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js @@ -97,76 +97,77 @@ var arr: any[]; // Generic tag with one parameter function noParams(n) { } -noParams ""; +(_a = [""], _a.raw = [""], noParams(_a)); // Generic tag with parameter which does not use type parameter function noGenericParams(n) { } -noGenericParams ""; +(_b = [""], _b.raw = [""], noGenericParams(_b)); // Generic tag with multiple type parameters and only one used in parameter type annotation function someGenerics1a(n, m) { } -someGenerics1a "" + 3; +(_c = ["", ""], _c.raw = ["", ""], someGenerics1a(_c, 3)); function someGenerics1b(n, m) { } -someGenerics1b "" + 3; +(_d = ["", ""], _d.raw = ["", ""], someGenerics1b(_d, 3)); // Generic tag with argument of function type whose parameter is of type parameter type function someGenerics2a(strs, n) { } -someGenerics2a "" + function (n) { return n; }; +(_e = ["", ""], _e.raw = ["", ""], someGenerics2a(_e, function (n) { return n; })); function someGenerics2b(strs, n) { } -someGenerics2b "" + function (n, x) { return n; }; +(_f = ["", ""], _f.raw = ["", ""], someGenerics2b(_f, function (n, x) { return n; })); // Generic tag with argument of function type whose parameter is not of type parameter type but body/return type uses type parameter function someGenerics3(strs, producer) { } -someGenerics3 "" + function () { return ''; }; -someGenerics3 "" + function () { return undefined; }; -someGenerics3 "" + function () { return 3; }; +(_g = ["", ""], _g.raw = ["", ""], someGenerics3(_g, function () { return ''; })); +(_h = ["", ""], _h.raw = ["", ""], someGenerics3(_h, function () { return undefined; })); +(_j = ["", ""], _j.raw = ["", ""], someGenerics3(_j, function () { return 3; })); // 2 parameter generic tag with argument 1 of type parameter type and argument 2 of function type whose parameter is of type parameter type function someGenerics4(strs, n, f) { } -someGenerics4 "" + 4 + function () { return null; }; -someGenerics4 "" + '' + function () { return 3; }; -someGenerics4 "" + null + null; +(_k = ["", "", ""], _k.raw = ["", "", ""], someGenerics4(_k, 4, function () { return null; })); +(_l = ["", "", ""], _l.raw = ["", "", ""], someGenerics4(_l, '', function () { return 3; })); +(_m = ["", "", ""], _m.raw = ["", "", ""], someGenerics4(_m, null, null)); // 2 parameter generic tag with argument 2 of type parameter type and argument 1 of function type whose parameter is of type parameter type function someGenerics5(strs, n, f) { } -someGenerics5 4 + " " + function () { return null; }; -someGenerics5 "" + '' + function () { return 3; }; -someGenerics5 "" + null + null; +(_n = ["", " ", ""], _n.raw = ["", " ", ""], someGenerics5(_n, 4, function () { return null; })); +(_o = ["", "", ""], _o.raw = ["", "", ""], someGenerics5(_o, '', function () { return 3; })); +(_p = ["", "", ""], _p.raw = ["", "", ""], someGenerics5(_p, null, null)); // Generic tag with multiple arguments of function types that each have parameters of the same generic type function someGenerics6(strs, a, b, c) { } -someGenerics6 "" + function (n) { return n; } + function (n) { return n; } + function (n) { return n; }; -someGenerics6 "" + function (n) { return n; } + function (n) { return n; } + function (n) { return n; }; -someGenerics6 "" + function (n) { return n; } + function (n) { return n; } + function (n) { return n; }; +(_q = ["", "", "", ""], _q.raw = ["", "", "", ""], someGenerics6(_q, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); +(_r = ["", "", "", ""], _r.raw = ["", "", "", ""], someGenerics6(_r, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); +(_s = ["", "", "", ""], _s.raw = ["", "", "", ""], someGenerics6(_s, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); // Generic tag with multiple arguments of function types that each have parameters of different generic type function someGenerics7(strs, a, b, c) { } -someGenerics7 "" + function (n) { return n; } + function (n) { return n; } + function (n) { return n; }; -someGenerics7 "" + function (n) { return n; } + function (n) { return n; } + function (n) { return n; }; -someGenerics7 "" + function (n) { return n; } + function (n) { return n; } + function (n) { return n; }; +(_t = ["", "", "", ""], _t.raw = ["", "", "", ""], someGenerics7(_t, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); +(_u = ["", "", "", ""], _u.raw = ["", "", "", ""], someGenerics7(_u, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); +(_v = ["", "", "", ""], _v.raw = ["", "", "", ""], someGenerics7(_v, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); // Generic tag with argument of generic function type function someGenerics8(strs, n) { return n; } -var x = someGenerics8 "" + someGenerics7; -x "" + null + null + null; +var x = (_w = ["", ""], _w.raw = ["", ""], someGenerics8(_w, someGenerics7)); +(_x = ["", "", "", ""], _x.raw = ["", "", "", ""], x(_x, null, null, null)); // Generic tag with multiple parameters of generic type passed arguments with no best common type function someGenerics9(strs, a, b, c) { return null; } -var a9a = someGenerics9 "" + '' + 0 + []; +var a9a = (_y = ["", "", "", ""], _y.raw = ["", "", "", ""], someGenerics9(_y, '', 0, [])); var a9a; -var a9e = someGenerics9 "" + undefined + { x: 6, z: new Date() } + { x: 6, y: '' }; +var a9e = (_z = ["", "", "", ""], _z.raw = ["", "", "", ""], someGenerics9(_z, undefined, { x: 6, z: new Date() }, { x: 6, y: '' })); var a9e; // Generic tag with multiple parameters of generic type passed arguments with a single best common type -var a9d = someGenerics9 "" + { x: 3 } + { x: 6 } + { x: 6 }; +var a9d = (_0 = ["", "", "", ""], _0.raw = ["", "", "", ""], someGenerics9(_0, { x: 3 }, { x: 6 }, { x: 6 })); var a9d; // Generic tag with multiple parameters of generic type where one argument is of type 'any' var anyVar; -var a = someGenerics9 "" + 7 + anyVar + 4; +var a = (_1 = ["", "", "", ""], _1.raw = ["", "", "", ""], someGenerics9(_1, 7, anyVar, 4)); var a; // Generic tag with multiple parameters of generic type where one argument is [] and the other is not 'any' -var arr = someGenerics9 "" + [] + null + undefined; +var arr = (_2 = ["", "", "", ""], _2.raw = ["", "", "", ""], someGenerics9(_2, [], null, undefined)); var arr; +var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2; diff --git a/tests/baselines/reference/taggedTemplateStringsWithIncompatibleTypedTags.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithIncompatibleTypedTags.errors.txt index 6b389218f65..166769fbbf5 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithIncompatibleTypedTags.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithIncompatibleTypedTags.errors.txt @@ -1,24 +1,12 @@ -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(12,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(14,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(14,9): error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(16,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(18,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(18,9): error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(20,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(22,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(22,9): error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(24,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(24,19): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(24,25): error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(26,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(26,9): error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(26,40): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(28,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(28,50): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(28,57): error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. -==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts (18 errors) ==== +==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts (6 errors) ==== interface I { (stringParts: string[], ...rest: boolean[]): I; g: I; @@ -31,56 +19,32 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTyped var f: I; f `abc` - ~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. f `abc${1}def${2}ghi`; - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. f `abc`.member - ~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. f `abc${1}def${2}ghi`.member; - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. f `abc`["member"]; - ~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. f `abc${1}def${2}ghi`["member"]; - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. f `abc`[0].member `abc${1}def${2}ghi`; - ~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. f `abc${1}def${2}ghi`["member"].member `abc${1}def${2}ghi`; - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. f `abc${ true }def${ true }ghi`["member"].member `abc${ 1 }def${ 2 }ghi`; - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. diff --git a/tests/baselines/reference/taggedTemplateStringsWithIncompatibleTypedTags.js b/tests/baselines/reference/taggedTemplateStringsWithIncompatibleTypedTags.js index c3e145afb2b..9d113793228 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithIncompatibleTypedTags.js +++ b/tests/baselines/reference/taggedTemplateStringsWithIncompatibleTypedTags.js @@ -35,14 +35,15 @@ f.thisIsNotATag(`abc${1}def${2}ghi`); //// [taggedTemplateStringsWithIncompatibleTypedTags.js] var f; -f "abc"; -f "abc" + 1 + "def" + 2 + "ghi"; -f "abc".member; -f "abc" + 1 + "def" + 2 + "ghi".member; -f "abc"["member"]; -f "abc" + 1 + "def" + 2 + "ghi"["member"]; -f "abc"[0].member "abc" + 1 + "def" + 2 + "ghi"; -f "abc" + 1 + "def" + 2 + "ghi"["member"].member "abc" + 1 + "def" + 2 + "ghi"; -f "abc" + true + "def" + true + "ghi"["member"].member "abc" + 1 + "def" + 2 + "ghi"; +(_a = ["abc"], _a.raw = ["abc"], f(_a)); +(_b = ["abc", "def", "ghi"], _b.raw = ["abc", "def", "ghi"], f(_b, 1, 2)); +(_c = ["abc"], _c.raw = ["abc"], f(_c)).member; +(_d = ["abc", "def", "ghi"], _d.raw = ["abc", "def", "ghi"], f(_d, 1, 2)).member; +(_e = ["abc"], _e.raw = ["abc"], f(_e))["member"]; +(_f = ["abc", "def", "ghi"], _f.raw = ["abc", "def", "ghi"], f(_f, 1, 2))["member"]; +(_g = ["abc", "def", "ghi"], _g.raw = ["abc", "def", "ghi"], (_h = ["abc"], _h.raw = ["abc"], f(_h))[0].member(_g, 1, 2)); +(_j = ["abc", "def", "ghi"], _j.raw = ["abc", "def", "ghi"], (_k = ["abc", "def", "ghi"], _k.raw = ["abc", "def", "ghi"], f(_k, 1, 2))["member"].member(_j, 1, 2)); +(_l = ["abc", "def", "ghi"], _l.raw = ["abc", "def", "ghi"], (_m = ["abc", "def", "ghi"], _m.raw = ["abc", "def", "ghi"], f(_m, true, true))["member"].member(_l, 1, 2)); f.thisIsNotATag("abc"); f.thisIsNotATag("abc" + 1 + "def" + 2 + "ghi"); +var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m; diff --git a/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressions.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressions.errors.txt deleted file mode 100644 index 17c0b330dbb..00000000000 --- a/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressions.errors.txt +++ /dev/null @@ -1,21 +0,0 @@ -tests/cases/conformance/es6/templates/taggedTemplateStringsWithManyCallAndMemberExpressions.ts(13,23): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithManyCallAndMemberExpressions.ts (1 errors) ==== - interface I { - (strs: string[], ...subs: number[]): I; - member: { - new (s: string): { - new (n: number): { - new (): boolean; - } - } - }; - } - var f: I; - - var x = new new new f `abc${ 0 }def`.member("hello")(42) === true; - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressions.js b/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressions.js index d507e951721..1814816283b 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressions.js +++ b/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressions.js @@ -17,4 +17,5 @@ var x = new new new f `abc${ 0 }def`.member("hello")(42) === true; //// [taggedTemplateStringsWithManyCallAndMemberExpressions.js] var f; -var x = new new new f "abc" + 0 + "def".member("hello")(42) === true; +var x = new new new (_a = ["abc", "def"], _a.raw = ["abc", "def"], f(_a, 0)).member("hello")(42) === true; +var _a; diff --git a/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressions.types b/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressions.types new file mode 100644 index 00000000000..6fa83bbde3d --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressions.types @@ -0,0 +1,38 @@ +=== tests/cases/conformance/es6/templates/taggedTemplateStringsWithManyCallAndMemberExpressions.ts === +interface I { +>I : I + + (strs: string[], ...subs: number[]): I; +>strs : string[] +>subs : number[] +>I : I + + member: { +>member : new (s: string) => new (n: number) => new () => boolean + + new (s: string): { +>s : string + + new (n: number): { +>n : number + + new (): boolean; + } + } + }; +} +var f: I; +>f : I +>I : I + +var x = new new new f `abc${ 0 }def`.member("hello")(42) === true; +>x : boolean +>new new new f `abc${ 0 }def`.member("hello")(42) === true : boolean +>new new new f `abc${ 0 }def`.member("hello")(42) : boolean +>new new f `abc${ 0 }def`.member("hello")(42) : new () => boolean +>new f `abc${ 0 }def`.member("hello") : new (n: number) => new () => boolean +>f `abc${ 0 }def`.member : new (s: string) => new (n: number) => new () => boolean +>f : I +>member : new (s: string) => new (n: number) => new () => boolean + + diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt index e4c79537ce2..9e450cbb368 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt @@ -1,16 +1,10 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(12,20): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(14,9): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(16,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(17,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(18,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(19,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(19,20): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(20,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(21,9): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(21,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts (10 errors) ==== +==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts (4 errors) ==== function foo(strs: string[]): number; function foo(strs: string[], x: number): string; function foo(strs: string[], x: number, y: number): boolean; @@ -31,25 +25,13 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio !!! error TS2346: Supplied parameters do not match any signature of call target. var u = foo ``; // number - ~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var v = foo `${1}`; // string - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var w = foo `${1}${2}`; // boolean - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var x = foo `${1}${true}`; // boolean (with error) - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~~~~ !!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. var y = foo `${1}${"2"}`; // {} - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var z = foo `${1}${2}${3}`; // any (with error) ~~~~~~~~~~~~~~~~~~ !!! error TS2346: Supplied parameters do not match any signature of call target. - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.js b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.js index 23298e1df13..431447df22e 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.js +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.js @@ -36,9 +36,10 @@ var c = foo([], 1, 2); // boolean var d = foo([], 1, true); // boolean (with error) var e = foo([], 1, "2"); // {} var f = foo([], 1, 2, 3); // any (with error) -var u = foo ""; // number -var v = foo "" + 1; // string -var w = foo "" + 1 + 2; // boolean -var x = foo "" + 1 + true; // boolean (with error) -var y = foo "" + 1 + "2"; // {} -var z = foo "" + 1 + 2 + 3; // any (with error) +var u = (_a = [""], _a.raw = [""], foo(_a)); // number +var v = (_b = ["", ""], _b.raw = ["", ""], foo(_b, 1)); // string +var w = (_c = ["", "", ""], _c.raw = ["", "", ""], foo(_c, 1, 2)); // boolean +var x = (_d = ["", "", ""], _d.raw = ["", "", ""], foo(_d, 1, true)); // boolean (with error) +var y = (_e = ["", "", ""], _e.raw = ["", "", ""], foo(_e, 1, "2")); // {} +var z = (_f = ["", "", "", ""], _f.raw = ["", "", "", ""], foo(_f, 1, 2, 3)); // any (with error) +var _a, _b, _c, _d, _e, _f; diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.errors.txt deleted file mode 100644 index 3bf4af39779..00000000000 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.errors.txt +++ /dev/null @@ -1,27 +0,0 @@ -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution2.ts(8,14): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution2.ts(17,14): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution2.ts (2 errors) ==== - - function foo1(strs: TemplateStringsArray, x: number): string; - function foo1(strs: string[], x: number): number; - function foo1(...stuff: any[]): any { - return undefined; - } - - var a = foo1 `${1}`; // string - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - var b = foo1([], 1); // number - - function foo2(strs: string[], x: number): number; - function foo2(strs: TemplateStringsArray, x: number): string; - function foo2(...stuff: any[]): any { - return undefined; - } - - var c = foo2 `${1}`; // number - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - var d = foo2([], 1); // number \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.js b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.js index 0b1447a3d3f..f12008f9581 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.js +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.js @@ -26,7 +26,7 @@ function foo1() { } return undefined; } -var a = foo1 "" + 1; // string +var a = (_a = ["", ""], _a.raw = ["", ""], foo1(_a, 1)); // string var b = foo1([], 1); // number function foo2() { var stuff = []; @@ -35,5 +35,6 @@ function foo2() { } return undefined; } -var c = foo2 "" + 1; // number +var c = (_b = ["", ""], _b.raw = ["", ""], foo2(_b, 1)); // number var d = foo2([], 1); // number +var _a, _b; diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.types b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.types new file mode 100644 index 00000000000..0863ac3fafc --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.types @@ -0,0 +1,60 @@ +=== tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution2.ts === + +function foo1(strs: TemplateStringsArray, x: number): string; +>foo1 : { (strs: TemplateStringsArray, x: number): string; (strs: string[], x: number): number; } +>strs : TemplateStringsArray +>TemplateStringsArray : TemplateStringsArray +>x : number + +function foo1(strs: string[], x: number): number; +>foo1 : { (strs: TemplateStringsArray, x: number): string; (strs: string[], x: number): number; } +>strs : string[] +>x : number + +function foo1(...stuff: any[]): any { +>foo1 : { (strs: TemplateStringsArray, x: number): string; (strs: string[], x: number): number; } +>stuff : any[] + + return undefined; +>undefined : undefined +} + +var a = foo1 `${1}`; // string +>a : string +>foo1 : { (strs: TemplateStringsArray, x: number): string; (strs: string[], x: number): number; } + +var b = foo1([], 1); // number +>b : number +>foo1([], 1) : number +>foo1 : { (strs: TemplateStringsArray, x: number): string; (strs: string[], x: number): number; } +>[] : undefined[] + +function foo2(strs: string[], x: number): number; +>foo2 : { (strs: string[], x: number): number; (strs: TemplateStringsArray, x: number): string; } +>strs : string[] +>x : number + +function foo2(strs: TemplateStringsArray, x: number): string; +>foo2 : { (strs: string[], x: number): number; (strs: TemplateStringsArray, x: number): string; } +>strs : TemplateStringsArray +>TemplateStringsArray : TemplateStringsArray +>x : number + +function foo2(...stuff: any[]): any { +>foo2 : { (strs: string[], x: number): number; (strs: TemplateStringsArray, x: number): string; } +>stuff : any[] + + return undefined; +>undefined : undefined +} + +var c = foo2 `${1}`; // number +>c : number +>foo2 : { (strs: string[], x: number): number; (strs: TemplateStringsArray, x: number): string; } + +var d = foo2([], 1); // number +>d : number +>foo2([], 1) : number +>foo2 : { (strs: string[], x: number): number; (strs: TemplateStringsArray, x: number): string; } +>[] : undefined[] + diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.errors.txt index c1a6b228b01..0d65c3fd13b 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.errors.txt @@ -1,34 +1,12 @@ -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(7,21): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(10,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(10,9): error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(16,20): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(17,20): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(19,4): error TS2339: Property 'foo' does not exist on type 'Date'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(23,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(26,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(34,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(35,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(36,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(40,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(41,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(42,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(45,1): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(45,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(54,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(55,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(56,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(57,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(60,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(63,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(63,9): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(64,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(64,18): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(70,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(70,18): error TS2339: Property 'toFixed' does not exist on type 'string'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(71,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts (28 errors) ==== +==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts (6 errors) ==== // Ambiguous call picks the first overload in declaration order function fn1(strs: TemplateStringsArray, s: string): string; @@ -36,13 +14,9 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio function fn1() { return null; } var s: string = fn1 `${ undefined }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // No candidate overloads found fn1 `${ {} }`; // Error - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~~ !!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'. @@ -51,11 +25,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio function fn2() { return undefined; } var d1: Date = fn2 `${ 0 }${ undefined }`; // contextually typed - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var d2 = fn2 `${ 0 }${ undefined }`; // any - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. d1.foo(); // error ~~~ @@ -64,13 +34,9 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio // Generic and non-generic overload where generic overload is the only candidate fn2 `${ 0 }${ '' }`; // OK - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic and non-generic overload where non-generic overload is the only candidate fn2 `${ '' }${ 0 }`; // OK - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic overloads with differing arity function fn3(strs: TemplateStringsArray, n: T): string; @@ -79,33 +45,19 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio function fn3() { return null; } var s = fn3 `${ 3 }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var s = fn3 `${'' }${ 3 }${ '' }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var n = fn3 `${ 5 }${ 5 }${ 5 }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var n: number; // Generic overloads with differing arity tagging with arguments matching each overload type parameter count var s = fn3 `${ 4 }` - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var s = fn3 `${ '' }${ '' }${ '' }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var n = fn3 `${ '' }${ '' }${ 3 }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic overloads with differing arity tagging with argument count that doesn't match any overload fn3 ``; // Error ~~~~~~ !!! error TS2346: Supplied parameters do not match any signature of call target. - ~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic overloads with constraints function fn4(strs: TemplateStringsArray, n: T, m: U); @@ -115,32 +67,18 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio // Generic overloads with constraints tagged with types that satisfy the constraints fn4 `${ '' }${ 3 }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. fn4 `${ 3 }${ '' }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. fn4 `${ 3 }${ undefined }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. fn4 `${ '' }${ null }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic overloads with constraints called with type arguments that do not satisfy the constraints fn4 `${ null }${ null }`; // Error - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints fn4 `${ true }${ null }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~~~~ !!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number'. fn4 `${ null }${ true }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~~~~ !!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. @@ -149,12 +87,8 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio function fn5(strs: TemplateStringsArray, f: (n: number) => void): number; function fn5() { return undefined; } fn5 `${ (n) => n.toFixed() }`; // will error; 'n' should have type 'string'. - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~~~~~~~ !!! error TS2339: Property 'toFixed' does not exist on type 'string'. fn5 `${ (n) => n.substr(0) }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js index dc8a08b4fc4..8c7cb986cd7 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js @@ -77,47 +77,48 @@ fn5 `${ (n) => n.substr(0) }`; function fn1() { return null; } -var s = fn1 "" + undefined; +var s = (_a = ["", ""], _a.raw = ["", ""], fn1(_a, undefined)); // No candidate overloads found -fn1 "" + {}; // Error +(_b = ["", ""], _b.raw = ["", ""], fn1(_b, {})); // Error function fn2() { return undefined; } -var d1 = fn2 "" + 0 + undefined; // contextually typed -var d2 = fn2 "" + 0 + undefined; // any +var d1 = (_c = ["", "", ""], _c.raw = ["", "", ""], fn2(_c, 0, undefined)); // contextually typed +var d2 = (_d = ["", "", ""], _d.raw = ["", "", ""], fn2(_d, 0, undefined)); // any d1.foo(); // error d2(); // no error (typed as any) // Generic and non-generic overload where generic overload is the only candidate -fn2 "" + 0 + ''; // OK +(_e = ["", "", ""], _e.raw = ["", "", ""], fn2(_e, 0, '')); // OK // Generic and non-generic overload where non-generic overload is the only candidate -fn2 "" + '' + 0; // OK +(_f = ["", "", ""], _f.raw = ["", "", ""], fn2(_f, '', 0)); // OK function fn3() { return null; } -var s = fn3 "" + 3; -var s = fn3 "" + '' + 3 + ''; -var n = fn3 "" + 5 + 5 + 5; +var s = (_g = ["", ""], _g.raw = ["", ""], fn3(_g, 3)); +var s = (_h = ["", "", "", ""], _h.raw = ["", "", "", ""], fn3(_h, '', 3, '')); +var n = (_j = ["", "", "", ""], _j.raw = ["", "", "", ""], fn3(_j, 5, 5, 5)); var n; // Generic overloads with differing arity tagging with arguments matching each overload type parameter count -var s = fn3 "" + 4; -var s = fn3 "" + '' + '' + ''; -var n = fn3 "" + '' + '' + 3; +var s = (_k = ["", ""], _k.raw = ["", ""], fn3(_k, 4)); +var s = (_l = ["", "", "", ""], _l.raw = ["", "", "", ""], fn3(_l, '', '', '')); +var n = (_m = ["", "", "", ""], _m.raw = ["", "", "", ""], fn3(_m, '', '', 3)); // Generic overloads with differing arity tagging with argument count that doesn't match any overload -fn3 ""; // Error +(_n = [""], _n.raw = [""], fn3(_n)); // Error function fn4() { } // Generic overloads with constraints tagged with types that satisfy the constraints -fn4 "" + '' + 3; -fn4 "" + 3 + ''; -fn4 "" + 3 + undefined; -fn4 "" + '' + null; +(_o = ["", "", ""], _o.raw = ["", "", ""], fn4(_o, '', 3)); +(_p = ["", "", ""], _p.raw = ["", "", ""], fn4(_p, 3, '')); +(_q = ["", "", ""], _q.raw = ["", "", ""], fn4(_q, 3, undefined)); +(_r = ["", "", ""], _r.raw = ["", "", ""], fn4(_r, '', null)); // Generic overloads with constraints called with type arguments that do not satisfy the constraints -fn4 "" + null + null; // Error +(_s = ["", "", ""], _s.raw = ["", "", ""], fn4(_s, null, null)); // Error // Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints -fn4 "" + true + null; -fn4 "" + null + true; +(_t = ["", "", ""], _t.raw = ["", "", ""], fn4(_t, true, null)); +(_u = ["", "", ""], _u.raw = ["", "", ""], fn4(_u, null, true)); function fn5() { return undefined; } -fn5 "" + function (n) { return n.toFixed(); }; // will error; 'n' should have type 'string'. -fn5 "" + function (n) { return n.substr(0); }; +(_v = ["", ""], _v.raw = ["", ""], fn5(_v, function (n) { return n.toFixed(); })); // will error; 'n' should have type 'string'. +(_w = ["", ""], _w.raw = ["", ""], fn5(_w, function (n) { return n.substr(0); })); +var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w; diff --git a/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.errors.txt deleted file mode 100644 index 2557d6cc94a..00000000000 --- a/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.errors.txt +++ /dev/null @@ -1,64 +0,0 @@ -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(3,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(5,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(7,7): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(9,7): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(11,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(13,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(15,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(17,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(19,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(19,32): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(21,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(21,46): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts (12 errors) ==== - var f: any; - - f `abc` - ~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f `abc${1}def${2}ghi`; - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f.g.h `abc` - ~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f.g.h `abc${1}def${2}ghi`; - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f `abc`.member - ~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f `abc${1}def${2}ghi`.member; - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f `abc`["member"]; - ~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f `abc${1}def${2}ghi`["member"]; - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f `abc`["member"].someOtherTag `abc${1}def${2}ghi`; - ~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f `abc${1}def${2}ghi`["member"].someOtherTag `abc${1}def${2}ghi`; - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f.thisIsNotATag(`abc`); - - f.thisIsNotATag(`abc${1}def${2}ghi`); \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.js b/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.js index d5c6b8b31f6..fd83d9d0ba0 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.js +++ b/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.js @@ -27,15 +27,16 @@ f.thisIsNotATag(`abc${1}def${2}ghi`); //// [taggedTemplateStringsWithTagsTypedAsAny.js] var f; -f "abc"; -f "abc" + 1 + "def" + 2 + "ghi"; -f.g.h "abc"; -f.g.h "abc" + 1 + "def" + 2 + "ghi"; -f "abc".member; -f "abc" + 1 + "def" + 2 + "ghi".member; -f "abc"["member"]; -f "abc" + 1 + "def" + 2 + "ghi"["member"]; -f "abc"["member"].someOtherTag "abc" + 1 + "def" + 2 + "ghi"; -f "abc" + 1 + "def" + 2 + "ghi"["member"].someOtherTag "abc" + 1 + "def" + 2 + "ghi"; +(_a = ["abc"], _a.raw = ["abc"], f(_a)); +(_b = ["abc", "def", "ghi"], _b.raw = ["abc", "def", "ghi"], f(_b, 1, 2)); +(_c = ["abc"], _c.raw = ["abc"], f.g.h(_c)); +(_d = ["abc", "def", "ghi"], _d.raw = ["abc", "def", "ghi"], f.g.h(_d, 1, 2)); +(_e = ["abc"], _e.raw = ["abc"], f(_e)).member; +(_f = ["abc", "def", "ghi"], _f.raw = ["abc", "def", "ghi"], f(_f, 1, 2)).member; +(_g = ["abc"], _g.raw = ["abc"], f(_g))["member"]; +(_h = ["abc", "def", "ghi"], _h.raw = ["abc", "def", "ghi"], f(_h, 1, 2))["member"]; +(_j = ["abc", "def", "ghi"], _j.raw = ["abc", "def", "ghi"], (_k = ["abc"], _k.raw = ["abc"], f(_k))["member"].someOtherTag(_j, 1, 2)); +(_l = ["abc", "def", "ghi"], _l.raw = ["abc", "def", "ghi"], (_m = ["abc", "def", "ghi"], _m.raw = ["abc", "def", "ghi"], f(_m, 1, 2))["member"].someOtherTag(_l, 1, 2)); f.thisIsNotATag("abc"); f.thisIsNotATag("abc" + 1 + "def" + 2 + "ghi"); +var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m; diff --git a/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.types b/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.types new file mode 100644 index 00000000000..a9b7c9dfdca --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.types @@ -0,0 +1,66 @@ +=== tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts === +var f: any; +>f : any + +f `abc` +>f : any + +f `abc${1}def${2}ghi`; +>f : any + +f.g.h `abc` +>f.g.h : any +>f.g : any +>f : any +>g : any +>h : any + +f.g.h `abc${1}def${2}ghi`; +>f.g.h : any +>f.g : any +>f : any +>g : any +>h : any + +f `abc`.member +>f `abc`.member : any +>f : any +>member : any + +f `abc${1}def${2}ghi`.member; +>f `abc${1}def${2}ghi`.member : any +>f : any +>member : any + +f `abc`["member"]; +>f `abc`["member"] : any +>f : any + +f `abc${1}def${2}ghi`["member"]; +>f `abc${1}def${2}ghi`["member"] : any +>f : any + +f `abc`["member"].someOtherTag `abc${1}def${2}ghi`; +>f `abc`["member"].someOtherTag : any +>f `abc`["member"] : any +>f : any +>someOtherTag : any + +f `abc${1}def${2}ghi`["member"].someOtherTag `abc${1}def${2}ghi`; +>f `abc${1}def${2}ghi`["member"].someOtherTag : any +>f `abc${1}def${2}ghi`["member"] : any +>f : any +>someOtherTag : any + +f.thisIsNotATag(`abc`); +>f.thisIsNotATag(`abc`) : any +>f.thisIsNotATag : any +>f : any +>thisIsNotATag : any + +f.thisIsNotATag(`abc${1}def${2}ghi`); +>f.thisIsNotATag(`abc${1}def${2}ghi`) : any +>f.thisIsNotATag : any +>f : any +>thisIsNotATag : any + diff --git a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.errors.txt index b38a70ca18b..88bfac23211 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.errors.txt @@ -1,15 +1,12 @@ -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.ts(6,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.ts(6,31): error TS2322: Type 'string' is not assignable to type 'number'. -==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.ts (2 errors) ==== +==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.ts (1 errors) ==== function foo(...rest: any[]) { } foo `${function (x: number) { x = "bad"; } }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~ !!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js index eb46f4b603f..10a8f1f2a12 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js +++ b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js @@ -13,6 +13,7 @@ function foo() { rest[_i - 0] = arguments[_i]; } } -foo "" + function (x) { +(_a = ["", ""], _a.raw = ["", ""], foo(_a, function (x) { x = "bad"; -}; +})); +var _a; diff --git a/tests/baselines/reference/taggedTemplateStringsWithTypedTags.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithTypedTags.errors.txt deleted file mode 100644 index 28050ec96c1..00000000000 --- a/tests/baselines/reference/taggedTemplateStringsWithTypedTags.errors.txt +++ /dev/null @@ -1,64 +0,0 @@ -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(12,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(14,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(16,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(18,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(20,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(22,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(24,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(24,19): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(26,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(26,40): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts (10 errors) ==== - interface I { - (stringParts: string[], ...rest: number[]): I; - g: I; - h: I; - member: I; - thisIsNotATag(x: string): void - [x: number]: I; - } - - var f: I; - - f `abc` - ~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f `abc${1}def${2}ghi`; - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f `abc`.member - ~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f `abc${1}def${2}ghi`.member; - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f `abc`["member"]; - ~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f `abc${1}def${2}ghi`["member"]; - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f `abc`[0].member `abc${1}def${2}ghi`; - ~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f `abc${1}def${2}ghi`["member"].member `abc${1}def${2}ghi`; - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f.thisIsNotATag(`abc`); - - f.thisIsNotATag(`abc${1}def${2}ghi`); - \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateStringsWithTypedTags.js b/tests/baselines/reference/taggedTemplateStringsWithTypedTags.js index c2424a07a47..fcc2cda86dc 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithTypedTags.js +++ b/tests/baselines/reference/taggedTemplateStringsWithTypedTags.js @@ -33,13 +33,14 @@ f.thisIsNotATag(`abc${1}def${2}ghi`); //// [taggedTemplateStringsWithTypedTags.js] var f; -f "abc"; -f "abc" + 1 + "def" + 2 + "ghi"; -f "abc".member; -f "abc" + 1 + "def" + 2 + "ghi".member; -f "abc"["member"]; -f "abc" + 1 + "def" + 2 + "ghi"["member"]; -f "abc"[0].member "abc" + 1 + "def" + 2 + "ghi"; -f "abc" + 1 + "def" + 2 + "ghi"["member"].member "abc" + 1 + "def" + 2 + "ghi"; +(_a = ["abc"], _a.raw = ["abc"], f(_a)); +(_b = ["abc", "def", "ghi"], _b.raw = ["abc", "def", "ghi"], f(_b, 1, 2)); +(_c = ["abc"], _c.raw = ["abc"], f(_c)).member; +(_d = ["abc", "def", "ghi"], _d.raw = ["abc", "def", "ghi"], f(_d, 1, 2)).member; +(_e = ["abc"], _e.raw = ["abc"], f(_e))["member"]; +(_f = ["abc", "def", "ghi"], _f.raw = ["abc", "def", "ghi"], f(_f, 1, 2))["member"]; +(_g = ["abc", "def", "ghi"], _g.raw = ["abc", "def", "ghi"], (_h = ["abc"], _h.raw = ["abc"], f(_h))[0].member(_g, 1, 2)); +(_j = ["abc", "def", "ghi"], _j.raw = ["abc", "def", "ghi"], (_k = ["abc", "def", "ghi"], _k.raw = ["abc", "def", "ghi"], f(_k, 1, 2))["member"].member(_j, 1, 2)); f.thisIsNotATag("abc"); f.thisIsNotATag("abc" + 1 + "def" + 2 + "ghi"); +var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; diff --git a/tests/baselines/reference/taggedTemplateStringsWithTypedTags.types b/tests/baselines/reference/taggedTemplateStringsWithTypedTags.types new file mode 100644 index 00000000000..5c8ba71188b --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsWithTypedTags.types @@ -0,0 +1,82 @@ +=== tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts === +interface I { +>I : I + + (stringParts: string[], ...rest: number[]): I; +>stringParts : string[] +>rest : number[] +>I : I + + g: I; +>g : I +>I : I + + h: I; +>h : I +>I : I + + member: I; +>member : I +>I : I + + thisIsNotATag(x: string): void +>thisIsNotATag : (x: string) => void +>x : string + + [x: number]: I; +>x : number +>I : I +} + +var f: I; +>f : I +>I : I + +f `abc` +>f : I + +f `abc${1}def${2}ghi`; +>f : I + +f `abc`.member +>f `abc`.member : I +>f : I +>member : I + +f `abc${1}def${2}ghi`.member; +>f `abc${1}def${2}ghi`.member : I +>f : I +>member : I + +f `abc`["member"]; +>f `abc`["member"] : I +>f : I + +f `abc${1}def${2}ghi`["member"]; +>f `abc${1}def${2}ghi`["member"] : I +>f : I + +f `abc`[0].member `abc${1}def${2}ghi`; +>f `abc`[0].member : I +>f `abc`[0] : I +>f : I +>member : I + +f `abc${1}def${2}ghi`["member"].member `abc${1}def${2}ghi`; +>f `abc${1}def${2}ghi`["member"].member : I +>f `abc${1}def${2}ghi`["member"] : I +>f : I +>member : I + +f.thisIsNotATag(`abc`); +>f.thisIsNotATag(`abc`) : void +>f.thisIsNotATag : (x: string) => void +>f : I +>thisIsNotATag : (x: string) => void + +f.thisIsNotATag(`abc${1}def${2}ghi`); +>f.thisIsNotATag(`abc${1}def${2}ghi`) : void +>f.thisIsNotATag : (x: string) => void +>f : I +>thisIsNotATag : (x: string) => void + diff --git a/tests/baselines/reference/templateStringInModuleName.js b/tests/baselines/reference/templateStringInModuleName.js index 561f308a3d0..36f619176e4 100644 --- a/tests/baselines/reference/templateStringInModuleName.js +++ b/tests/baselines/reference/templateStringInModuleName.js @@ -7,10 +7,11 @@ declare module `M${2}` { //// [templateStringInModuleName.js] declare; -module "M1"; +(_a = ["M1"], _a.raw = ["M1"], module(_a)); { } declare; -module "M" + 2; +(_b = ["M", ""], _b.raw = ["M", ""], module(_b, 2)); { } +var _a, _b; diff --git a/tests/baselines/reference/templateStringInObjectLiteral.js b/tests/baselines/reference/templateStringInObjectLiteral.js index b026aedf4d3..0381e9a95e7 100644 --- a/tests/baselines/reference/templateStringInObjectLiteral.js +++ b/tests/baselines/reference/templateStringInObjectLiteral.js @@ -5,7 +5,8 @@ var x = { } //// [templateStringInObjectLiteral.js] -var x = { +var x = (_a = ["b"], _a.raw = ["b"], { a: "abc" + 123 + "def" -} "b"; +}(_a)); 321; +var _a; diff --git a/tests/baselines/reference/templateStringInPropertyName1.js b/tests/baselines/reference/templateStringInPropertyName1.js index 5a396398f67..239ba78d827 100644 --- a/tests/baselines/reference/templateStringInPropertyName1.js +++ b/tests/baselines/reference/templateStringInPropertyName1.js @@ -4,5 +4,6 @@ var x = { } //// [templateStringInPropertyName1.js] -var x = {} "a"; +var x = (_a = ["a"], _a.raw = ["a"], {}(_a)); 321; +var _a; diff --git a/tests/baselines/reference/templateStringInPropertyName2.js b/tests/baselines/reference/templateStringInPropertyName2.js index 623f6a69a41..8a71a6e30be 100644 --- a/tests/baselines/reference/templateStringInPropertyName2.js +++ b/tests/baselines/reference/templateStringInPropertyName2.js @@ -4,5 +4,6 @@ var x = { } //// [templateStringInPropertyName2.js] -var x = {} "abc" + 123 + "def" + 456 + "ghi"; +var x = (_a = ["abc", "def", "ghi"], _a.raw = ["abc", "def", "ghi"], {}(_a, 123, 456)); 321; +var _a; diff --git a/tests/baselines/reference/templateStringInTaggedTemplate.errors.txt b/tests/baselines/reference/templateStringInTaggedTemplate.errors.txt index 9106cdb6151..18ce24a0b3b 100644 --- a/tests/baselines/reference/templateStringInTaggedTemplate.errors.txt +++ b/tests/baselines/reference/templateStringInTaggedTemplate.errors.txt @@ -1,10 +1,7 @@ tests/cases/conformance/es6/templates/templateStringInTaggedTemplate.ts(1,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. -tests/cases/conformance/es6/templates/templateStringInTaggedTemplate.ts(1,42): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -==== tests/cases/conformance/es6/templates/templateStringInTaggedTemplate.ts (2 errors) ==== +==== tests/cases/conformance/es6/templates/templateStringInTaggedTemplate.ts (1 errors) ==== `I AM THE ${ `${ `TAG` } ` } PORTION` `I ${ "AM" } THE TEMPLATE PORTION` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. - ~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. \ No newline at end of file +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringInTaggedTemplate.js b/tests/baselines/reference/templateStringInTaggedTemplate.js index c6d98b0f826..61964b06d47 100644 --- a/tests/baselines/reference/templateStringInTaggedTemplate.js +++ b/tests/baselines/reference/templateStringInTaggedTemplate.js @@ -2,4 +2,5 @@ `I AM THE ${ `${ `TAG` } ` } PORTION` `I ${ "AM" } THE TEMPLATE PORTION` //// [templateStringInTaggedTemplate.js] -"I AM THE " + "TAG" + " " + " PORTION" "I " + "AM" + " THE TEMPLATE PORTION"; +(_a = ["I ", " THE TEMPLATE PORTION"], _a.raw = ["I ", " THE TEMPLATE PORTION"], "I AM THE " + "TAG" + " " + " PORTION"(_a, "AM")); +var _a; diff --git a/tests/baselines/reference/templateStringsArrayTypeDefinedInES5Mode.errors.txt b/tests/baselines/reference/templateStringsArrayTypeDefinedInES5Mode.errors.txt index 61b82bcb459..7ac2eff8652 100644 --- a/tests/baselines/reference/templateStringsArrayTypeDefinedInES5Mode.errors.txt +++ b/tests/baselines/reference/templateStringsArrayTypeDefinedInES5Mode.errors.txt @@ -2,10 +2,9 @@ lib.d.ts(515,11): error TS2300: Duplicate identifier 'TemplateStringsArray'. tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(2,7): error TS2300: Duplicate identifier 'TemplateStringsArray'. tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(8,3): error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'TemplateStringsArray'. Property 'raw' is missing in type '{ [x: number]: undefined; }'. -tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(10,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -==== tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts (3 errors) ==== +==== tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts (2 errors) ==== class TemplateStringsArray { ~~~~~~~~~~~~~~~~~~~~ @@ -20,6 +19,4 @@ tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(10,3): error TS !!! error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'TemplateStringsArray'. !!! error TS2345: Property 'raw' is missing in type '{ [x: number]: undefined; }'. - f `abcdef${ 1234 }${ 5678 }ghijkl`; - ~~~~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. \ No newline at end of file + f `abcdef${ 1234 }${ 5678 }ghijkl`; \ No newline at end of file diff --git a/tests/baselines/reference/templateStringsArrayTypeDefinedInES5Mode.js b/tests/baselines/reference/templateStringsArrayTypeDefinedInES5Mode.js index a724943c0f3..5d5f925fe69 100644 --- a/tests/baselines/reference/templateStringsArrayTypeDefinedInES5Mode.js +++ b/tests/baselines/reference/templateStringsArrayTypeDefinedInES5Mode.js @@ -19,4 +19,5 @@ var TemplateStringsArray = (function () { function f(x, y, z) { } f({}, 10, 10); -f "abcdef" + 1234 + 5678 + "ghijkl"; +(_a = ["abcdef", "", "ghijkl"], _a.raw = ["abcdef", "", "ghijkl"], f(_a, 1234, 5678)); +var _a; diff --git a/tests/baselines/reference/templateStringsArrayTypeNotDefinedES5Mode.errors.txt b/tests/baselines/reference/templateStringsArrayTypeNotDefinedES5Mode.errors.txt index b233ad963c7..e8bf38c1048 100644 --- a/tests/baselines/reference/templateStringsArrayTypeNotDefinedES5Mode.errors.txt +++ b/tests/baselines/reference/templateStringsArrayTypeNotDefinedES5Mode.errors.txt @@ -1,9 +1,8 @@ tests/cases/compiler/templateStringsArrayTypeNotDefinedES5Mode.ts(5,3): error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'TemplateStringsArray'. Property 'raw' is missing in type '{ [x: number]: undefined; }'. -tests/cases/compiler/templateStringsArrayTypeNotDefinedES5Mode.ts(7,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -==== tests/cases/compiler/templateStringsArrayTypeNotDefinedES5Mode.ts (2 errors) ==== +==== tests/cases/compiler/templateStringsArrayTypeNotDefinedES5Mode.ts (1 errors) ==== function f(x: TemplateStringsArray, y: number, z: number) { } @@ -13,6 +12,4 @@ tests/cases/compiler/templateStringsArrayTypeNotDefinedES5Mode.ts(7,3): error TS !!! error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'TemplateStringsArray'. !!! error TS2345: Property 'raw' is missing in type '{ [x: number]: undefined; }'. - f `abcdef${ 1234 }${ 5678 }ghijkl`; - ~~~~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. \ No newline at end of file + f `abcdef${ 1234 }${ 5678 }ghijkl`; \ No newline at end of file diff --git a/tests/baselines/reference/templateStringsArrayTypeNotDefinedES5Mode.js b/tests/baselines/reference/templateStringsArrayTypeNotDefinedES5Mode.js index c6cc4ee8408..69d61d79554 100644 --- a/tests/baselines/reference/templateStringsArrayTypeNotDefinedES5Mode.js +++ b/tests/baselines/reference/templateStringsArrayTypeNotDefinedES5Mode.js @@ -11,4 +11,5 @@ f `abcdef${ 1234 }${ 5678 }ghijkl`; function f(x, y, z) { } f({}, 10, 10); -f "abcdef" + 1234 + 5678 + "ghijkl"; +(_a = ["abcdef", "", "ghijkl"], _a.raw = ["abcdef", "", "ghijkl"], f(_a, 1234, 5678)); +var _a;