Treat NoSubstitutionTemplateLiteral same as a StringLiteral (#17704)

This commit is contained in:
Andy
2017-08-10 06:53:48 -07:00
committed by GitHub
parent 2c4361aadf
commit 4c824505ad
102 changed files with 170 additions and 158 deletions
+7 -9
View File
@@ -17757,15 +17757,14 @@ namespace ts {
return getBestChoiceType(type1, type2);
}
function checkLiteralExpression(node: Expression): Type {
if (node.kind === SyntaxKind.NumericLiteral) {
checkGrammarNumericLiteral(<NumericLiteral>node);
}
function checkLiteralExpression(node: LiteralExpression | Token<SyntaxKind.TrueKeyword | SyntaxKind.FalseKeyword>): Type {
switch (node.kind) {
case SyntaxKind.NoSubstitutionTemplateLiteral:
case SyntaxKind.StringLiteral:
return getFreshTypeOfLiteralType(getLiteralType((<LiteralExpression>node).text));
return getFreshTypeOfLiteralType(getLiteralType(node.text));
case SyntaxKind.NumericLiteral:
return getFreshTypeOfLiteralType(getLiteralType(+(<LiteralExpression>node).text));
checkGrammarNumericLiteral(<NumericLiteral>node);
return getFreshTypeOfLiteralType(getLiteralType(+node.text));
case SyntaxKind.TrueKeyword:
return trueType;
case SyntaxKind.FalseKeyword:
@@ -17983,15 +17982,14 @@ namespace ts {
return checkSuperExpression(node);
case SyntaxKind.NullKeyword:
return nullWideningType;
case SyntaxKind.NoSubstitutionTemplateLiteral:
case SyntaxKind.StringLiteral:
case SyntaxKind.NumericLiteral:
case SyntaxKind.TrueKeyword:
case SyntaxKind.FalseKeyword:
return checkLiteralExpression(node);
return checkLiteralExpression(node as LiteralExpression);
case SyntaxKind.TemplateExpression:
return checkTemplateExpression(<TemplateExpression>node);
case SyntaxKind.NoSubstitutionTemplateLiteral:
return stringType;
case SyntaxKind.RegularExpressionLiteral:
return globalRegExpType;
case SyntaxKind.ArrayLiteralExpression:
+2 -2
View File
@@ -36,7 +36,7 @@ var d = `Hello ${123} World` as string;
var e = `Hello` as string;
>e : string
>`Hello` as string : string
>`Hello` : string
>`Hello` : "Hello"
var f = 1 + `${1} end of string` as string;
>f : string
@@ -59,5 +59,5 @@ var h = tag `Hello` as string;
>tag `Hello` as string : string
>tag `Hello` : any
>tag : (...x: any[]) => any
>`Hello` : string
>`Hello` : "Hello"
@@ -14,7 +14,7 @@ var x = 10
as `Hello world`; // should not error
>as `Hello world` : any
>as : (...args: any[]) => any
>`Hello world` : string
>`Hello world` : "Hello world"
// Example 2
var y = 20
@@ -46,7 +46,7 @@ var v = {
>true : true
[`hello bye`]() { },
>`hello bye` : string
>`hello bye` : "hello bye"
[`hello ${a} bye`]() { }
>`hello ${a} bye` : string
@@ -46,7 +46,7 @@ var v = {
>true : true
[`hello bye`]() { },
>`hello bye` : string
>`hello bye` : "hello bye"
[`hello ${a} bye`]() { }
>`hello ${a} bye` : string
@@ -55,7 +55,7 @@ var v = {
>0 : 0
set [`hello bye`](v) { },
>`hello bye` : string
>`hello bye` : "hello bye"
>v : any
get [`hello ${a} bye`]() { return 0; }
@@ -55,7 +55,7 @@ var v = {
>0 : 0
set [`hello bye`](v) { },
>`hello bye` : string
>`hello bye` : "hello bye"
>v : any
get [`hello ${a} bye`]() { return 0; }
@@ -45,7 +45,7 @@ class C {
>true : true
[`hello bye`]() { }
>`hello bye` : string
>`hello bye` : "hello bye"
static [`hello ${a} bye`]() { }
>`hello ${a} bye` : string
@@ -45,7 +45,7 @@ class C {
>true : true
[`hello bye`]() { }
>`hello bye` : string
>`hello bye` : "hello bye"
static [`hello ${a} bye`]() { }
>`hello ${a} bye` : string
@@ -54,7 +54,7 @@ class C {
>0 : 0
set [`hello bye`](v) { }
>`hello bye` : string
>`hello bye` : "hello bye"
>v : any
get [`hello ${a} bye`]() { return 0; }
@@ -54,7 +54,7 @@ class C {
>0 : 0
set [`hello bye`](v) { }
>`hello bye` : string
>`hello bye` : "hello bye"
>v : any
get [`hello ${a} bye`]() { return 0; }
@@ -55,7 +55,7 @@ var v = {
>0 : 0
[`hello bye`]: 0,
>`hello bye` : string
>`hello bye` : "hello bye"
>0 : 0
[`hello ${a} bye`]: 0
@@ -55,7 +55,7 @@ var v = {
>0 : 0
[`hello bye`]: 0,
>`hello bye` : string
>`hello bye` : "hello bye"
>0 : 0
[`hello ${a} bye`]: 0
@@ -2,10 +2,10 @@
function foo(a = ``) { }
>foo : (a?: string) => void
>a : string
>`` : string
>`` : ""
function bar(a = ``) {
>bar : (a?: string) => void
>a : string
>`` : string
>`` : ""
}
@@ -1,17 +0,0 @@
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithTemplateStrings01.ts(1,5): error TS2322: Type 'string' is not assignable to type '"ABC"'.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithTemplateStrings01.ts(2,5): error TS2322: Type 'string' is not assignable to type '"DE\nF"'.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithTemplateStrings01.ts(5,5): error TS2322: Type 'string' is not assignable to type '"JK`L"'.
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithTemplateStrings01.ts (3 errors) ====
let ABC: "ABC" = `ABC`;
~~~
!!! error TS2322: Type 'string' is not assignable to type '"ABC"'.
let DE_NEWLINE_F: "DE\nF" = `DE
~~~~~~~~~~~~
!!! error TS2322: Type 'string' is not assignable to type '"DE\nF"'.
F`;
let G_QUOTE_HI: 'G"HI';
let JK_BACKTICK_L: "JK`L" = `JK\`L`;
~~~~~~~~~~~~~
!!! error TS2322: Type 'string' is not assignable to type '"JK`L"'.
@@ -0,0 +1,14 @@
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithTemplateStrings01.ts ===
let ABC: "ABC" = `ABC`;
>ABC : Symbol(ABC, Decl(stringLiteralTypesWithTemplateStrings01.ts, 0, 3))
let DE_NEWLINE_F: "DE\nF" = `DE
>DE_NEWLINE_F : Symbol(DE_NEWLINE_F, Decl(stringLiteralTypesWithTemplateStrings01.ts, 1, 3))
F`;
let G_QUOTE_HI: 'G"HI';
>G_QUOTE_HI : Symbol(G_QUOTE_HI, Decl(stringLiteralTypesWithTemplateStrings01.ts, 3, 3))
let JK_BACKTICK_L: "JK`L" = `JK\`L`;
>JK_BACKTICK_L : Symbol(JK_BACKTICK_L, Decl(stringLiteralTypesWithTemplateStrings01.ts, 4, 3))
@@ -0,0 +1,17 @@
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithTemplateStrings01.ts ===
let ABC: "ABC" = `ABC`;
>ABC : "ABC"
>`ABC` : "ABC"
let DE_NEWLINE_F: "DE\nF" = `DE
>DE_NEWLINE_F : "DE\nF"
>`DEF` : "DE\nF"
F`;
let G_QUOTE_HI: 'G"HI';
>G_QUOTE_HI : "G\"HI"
let JK_BACKTICK_L: "JK`L" = `JK\`L`;
>JK_BACKTICK_L : "JK`L"
>`JK\`L` : "JK`L"
@@ -1,11 +1,11 @@
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithTemplateStrings02.ts(1,5): error TS2322: Type 'string' is not assignable to type '"AB\r\nC"'.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithTemplateStrings02.ts(1,5): error TS2322: Type '"AB\nC"' is not assignable to type '"AB\r\nC"'.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithTemplateStrings02.ts(3,5): error TS2322: Type 'string' is not assignable to type '"DE\nF"'.
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesWithTemplateStrings02.ts (2 errors) ====
let abc: "AB\r\nC" = `AB
~~~
!!! error TS2322: Type 'string' is not assignable to type '"AB\r\nC"'.
!!! error TS2322: Type '"AB\nC"' is not assignable to type '"AB\r\nC"'.
C`;
let de_NEWLINE_f: "DE\nF" = `DE${"\n"}F`;
~~~~~~~~~~~~
@@ -8,5 +8,5 @@ function f(...x: any[]) {
f `0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n`
>f `0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` : void
>f : (...x: any[]) => void
>`0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` : string
>`0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` : "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n"
@@ -8,5 +8,5 @@ function f(...x: any[]) {
f `0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n`
>f `0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` : void
>f : (...x: any[]) => void
>`0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` : string
>`0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` : "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n"
@@ -7,7 +7,7 @@ function f(...args: any[]): void {
f `
>f `\` : void
>f : (...args: any[]) => void
>`\` : string
>`\` : "\n\n"
\
@@ -7,7 +7,7 @@ function f(...args: any[]): void {
f `
>f `\` : void
>f : (...args: any[]) => void
>`\` : string
>`\` : "\n\n"
\
@@ -5,7 +5,7 @@ var f: any;
f `abc`
>f `abc` : any
>f : any
>`abc` : string
>`abc` : "abc"
f `abc${1}def${2}ghi`;
>f `abc${1}def${2}ghi` : any
@@ -21,7 +21,7 @@ f.g.h `abc`
>f : any
>g : any
>h : any
>`abc` : string
>`abc` : "abc"
f.g.h `abc${1}def${2}ghi`;
>f.g.h `abc${1}def${2}ghi` : any
@@ -38,7 +38,7 @@ f `abc`.member
>f `abc`.member : any
>f `abc` : any
>f : any
>`abc` : string
>`abc` : "abc"
>member : any
f `abc${1}def${2}ghi`.member;
@@ -54,7 +54,7 @@ f `abc`["member"];
>f `abc`["member"] : any
>f `abc` : any
>f : any
>`abc` : string
>`abc` : "abc"
>"member" : "member"
f `abc${1}def${2}ghi`["member"];
@@ -72,7 +72,7 @@ f `abc`["member"].someOtherTag `abc${1}def${2}ghi`;
>f `abc`["member"] : any
>f `abc` : any
>f : any
>`abc` : string
>`abc` : "abc"
>"member" : "member"
>someOtherTag : any
>`abc${1}def${2}ghi` : string
@@ -99,7 +99,7 @@ f.thisIsNotATag(`abc`);
>f.thisIsNotATag : any
>f : any
>thisIsNotATag : any
>`abc` : string
>`abc` : "abc"
f.thisIsNotATag(`abc${1}def${2}ghi`);
>f.thisIsNotATag(`abc${1}def${2}ghi`) : any
@@ -5,7 +5,7 @@ var f: any;
f `abc`
>f `abc` : any
>f : any
>`abc` : string
>`abc` : "abc"
f `abc${1}def${2}ghi`;
>f `abc${1}def${2}ghi` : any
@@ -21,7 +21,7 @@ f.g.h `abc`
>f : any
>g : any
>h : any
>`abc` : string
>`abc` : "abc"
f.g.h `abc${1}def${2}ghi`;
>f.g.h `abc${1}def${2}ghi` : any
@@ -38,7 +38,7 @@ f `abc`.member
>f `abc`.member : any
>f `abc` : any
>f : any
>`abc` : string
>`abc` : "abc"
>member : any
f `abc${1}def${2}ghi`.member;
@@ -54,7 +54,7 @@ f `abc`["member"];
>f `abc`["member"] : any
>f `abc` : any
>f : any
>`abc` : string
>`abc` : "abc"
>"member" : "member"
f `abc${1}def${2}ghi`["member"];
@@ -72,7 +72,7 @@ f `abc`["member"].someOtherTag `abc${1}def${2}ghi`;
>f `abc`["member"] : any
>f `abc` : any
>f : any
>`abc` : string
>`abc` : "abc"
>"member" : "member"
>someOtherTag : any
>`abc${1}def${2}ghi` : string
@@ -99,7 +99,7 @@ f.thisIsNotATag(`abc`);
>f.thisIsNotATag : any
>f : any
>thisIsNotATag : any
>`abc` : string
>`abc` : "abc"
f.thisIsNotATag(`abc${1}def${2}ghi`);
>f.thisIsNotATag(`abc${1}def${2}ghi`) : any
@@ -36,7 +36,7 @@ var f: I;
f `abc`
>f `abc` : I
>f : I
>`abc` : string
>`abc` : "abc"
f `abc${1}def${2}ghi`;
>f `abc${1}def${2}ghi` : I
@@ -49,7 +49,7 @@ f `abc`.member
>f `abc`.member : I
>f `abc` : I
>f : I
>`abc` : string
>`abc` : "abc"
>member : I
f `abc${1}def${2}ghi`.member;
@@ -65,7 +65,7 @@ f `abc`["member"];
>f `abc`["member"] : I
>f `abc` : I
>f : I
>`abc` : string
>`abc` : "abc"
>"member" : "member"
f `abc${1}def${2}ghi`["member"];
@@ -83,7 +83,7 @@ f `abc`[0].member `abc${1}def${2}ghi`;
>f `abc`[0] : I
>f `abc` : I
>f : I
>`abc` : string
>`abc` : "abc"
>0 : 0
>member : I
>`abc${1}def${2}ghi` : string
@@ -110,7 +110,7 @@ f.thisIsNotATag(`abc`);
>f.thisIsNotATag : (x: string) => void
>f : I
>thisIsNotATag : (x: string) => void
>`abc` : string
>`abc` : "abc"
f.thisIsNotATag(`abc${1}def${2}ghi`);
>f.thisIsNotATag(`abc${1}def${2}ghi`) : void
@@ -36,7 +36,7 @@ var f: I;
f `abc`
>f `abc` : I
>f : I
>`abc` : string
>`abc` : "abc"
f `abc${1}def${2}ghi`;
>f `abc${1}def${2}ghi` : I
@@ -49,7 +49,7 @@ f `abc`.member
>f `abc`.member : I
>f `abc` : I
>f : I
>`abc` : string
>`abc` : "abc"
>member : I
f `abc${1}def${2}ghi`.member;
@@ -65,7 +65,7 @@ f `abc`["member"];
>f `abc`["member"] : I
>f `abc` : I
>f : I
>`abc` : string
>`abc` : "abc"
>"member" : "member"
f `abc${1}def${2}ghi`["member"];
@@ -83,7 +83,7 @@ f `abc`[0].member `abc${1}def${2}ghi`;
>f `abc`[0] : I
>f `abc` : I
>f : I
>`abc` : string
>`abc` : "abc"
>0 : 0
>member : I
>`abc${1}def${2}ghi` : string
@@ -110,7 +110,7 @@ f.thisIsNotATag(`abc`);
>f.thisIsNotATag : (x: string) => void
>f : I
>thisIsNotATag : (x: string) => void
>`abc` : string
>`abc` : "abc"
f.thisIsNotATag(`abc${1}def${2}ghi`);
>f.thisIsNotATag(`abc${1}def${2}ghi`) : void
@@ -7,5 +7,5 @@ function f(...args: any[]) {
f `\t\n\v\f\r\\`;
>f `\t\n\v\f\r\\` : void
>f : (...args: any[]) => void
>`\t\n\v\f\r\\` : string
>`\t\n\v\f\r\\` : "\t\n\v\f\r\\"
@@ -7,5 +7,5 @@ function f(...args: any[]) {
f `\t\n\v\f\r\\`;
>f `\t\n\v\f\r\\` : void
>f : (...args: any[]) => void
>`\t\n\v\f\r\\` : string
>`\t\n\v\f\r\\` : "\t\n\v\f\r\\"
@@ -6,5 +6,5 @@ var tag: Function;
tag `Hello world!`;
>tag `Hello world!` : any
>tag : Function
>`Hello world!` : string
>`Hello world!` : "Hello world!"
@@ -1,5 +1,5 @@
=== tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes01.ts ===
var x = `\0\x00\u0000 0 00 0000`;
>x : string
>`\0\x00\u0000 0 00 0000` : string
>`\0\x00\u0000 0 00 0000` : "\0\0\0 0 00 0000"
@@ -1,5 +1,5 @@
=== tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes01_ES6.ts ===
var x = `\0\x00\u0000 0 00 0000`;
>x : string
>`\0\x00\u0000 0 00 0000` : string
>`\0\x00\u0000 0 00 0000` : "\0\0\0 0 00 0000"
@@ -1,5 +1,5 @@
=== tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes02.ts ===
var x = `\x19\u0019 19`;
>x : string
>`\x19\u0019 19` : string
>`\x19\u0019 19` : "\u0019\u0019 19"
@@ -1,5 +1,5 @@
=== tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes02_ES6.ts ===
var x = `\x19\u0019 19`;
>x : string
>`\x19\u0019 19` : string
>`\x19\u0019 19` : "\u0019\u0019 19"
@@ -1,5 +1,5 @@
=== tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes03.ts ===
var x = `\x1F\u001f 1F 1f`;
>x : string
>`\x1F\u001f 1F 1f` : string
>`\x1F\u001f 1F 1f` : "\u001F\u001F 1F 1f"
@@ -1,5 +1,5 @@
=== tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes03_ES6.ts ===
var x = `\x1F\u001f 1F 1f`;
>x : string
>`\x1F\u001f 1F 1f` : string
>`\x1F\u001f 1F 1f` : "\u001F\u001F 1F 1f"
@@ -1,5 +1,5 @@
=== tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes04.ts ===
var x = `\x20\u0020 20`;
>x : string
>`\x20\u0020 20` : string
>`\x20\u0020 20` : " 20"
@@ -1,5 +1,5 @@
=== tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes04_ES6.ts ===
var x = `\x20\u0020 20`;
>x : string
>`\x20\u0020 20` : string
>`\x20\u0020 20` : " 20"
@@ -5,13 +5,13 @@ var x = `abc${0}abc` === `abc` ||
>`abc${0}abc` === `abc` : boolean
>`abc${0}abc` : string
>0 : 0
>`abc` : string
>`abc` : "abc"
`abc` !== `abc${0}abc` &&
>`abc` !== `abc${0}abc` && `abc${0}abc` == "abc0abc" && "abc0abc" !== `abc${0}abc` : boolean
>`abc` !== `abc${0}abc` && `abc${0}abc` == "abc0abc" : boolean
>`abc` !== `abc${0}abc` : boolean
>`abc` : string
>`abc` : "abc"
>`abc${0}abc` : string
>0 : 0
@@ -5,13 +5,13 @@ var x = `abc${0}abc` === `abc` ||
>`abc${0}abc` === `abc` : boolean
>`abc${0}abc` : string
>0 : 0
>`abc` : string
>`abc` : "abc"
`abc` !== `abc${0}abc` &&
>`abc` !== `abc${0}abc` && `abc${0}abc` == "abc0abc" && "abc0abc" !== `abc${0}abc` : boolean
>`abc` !== `abc${0}abc` && `abc${0}abc` == "abc0abc" : boolean
>`abc` !== `abc${0}abc` : boolean
>`abc` : string
>`abc` : "abc"
>`abc${0}abc` : string
>0 : 0
@@ -3,5 +3,5 @@
>`abc${0}abc`[`0`] : any
>`abc${0}abc` : string
>0 : 0
>`0` : string
>`0` : "0"
@@ -3,5 +3,5 @@
>`abc${0}abc`[`0`] : any
>`abc${0}abc` : string
>0 : 0
>`0` : string
>`0` : "0"
@@ -4,10 +4,10 @@ switch (`abc${0}abc`) {
>0 : 0
case `abc`:
>`abc` : string
>`abc` : "abc"
case `123`:
>`123` : string
>`123` : "123"
case `abc${0}abc`:
>`abc${0}abc` : string
@@ -4,10 +4,10 @@ switch (`abc${0}abc`) {
>0 : 0
case `abc`:
>`abc` : string
>`abc` : "abc"
case `123`:
>`123` : string
>`123` : "123"
case `abc${0}abc`:
>`abc${0}abc` : string
@@ -1,7 +1,7 @@
=== tests/cases/conformance/es6/templates/templateStringMultiline1.ts ===
// newlines are <CR><LF>
`
>`\` : string
>`\` : "\n"
\
`
@@ -1,7 +1,7 @@
=== tests/cases/conformance/es6/templates/templateStringMultiline1_ES6.ts ===
// newlines are <CR><LF>
`
>`\` : string
>`\` : "\n"
\
`
@@ -1,7 +1,7 @@
=== tests/cases/conformance/es6/templates/templateStringMultiline2.ts ===
// newlines are <LF>
`
>`\` : string
>`\` : "\n"
\
`
@@ -1,7 +1,7 @@
=== tests/cases/conformance/es6/templates/templateStringMultiline2_ES6.ts ===
// newlines are <LF>
`
>`\` : string
>`\` : "\n"
\
`
@@ -1,7 +1,7 @@
=== tests/cases/conformance/es6/templates/templateStringMultiline3.ts ===
// newlines are <CR>
`
>`\` : string
>`\` : "\n"
\
`
@@ -1,7 +1,7 @@
=== tests/cases/conformance/es6/templates/templateStringMultiline3_ES6.ts ===
// newlines are <CR>
`
>`\` : string
>`\` : "\n"
\
`
@@ -1,4 +1,4 @@
=== tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes01.ts ===
`0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n`
>`0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` : string
>`0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` : "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n"
@@ -1,4 +1,4 @@
=== tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes01_ES6.ts ===
`0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n`
>`0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` : string
>`0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` : "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n"
@@ -1,4 +1,4 @@
=== tests/cases/conformance/es6/templates/templateStringTermination1.ts ===
``
>`` : string
>`` : ""
@@ -1,4 +1,4 @@
=== tests/cases/conformance/es6/templates/templateStringTermination1_ES6.ts ===
``
>`` : string
>`` : ""
@@ -1,4 +1,4 @@
=== tests/cases/conformance/es6/templates/templateStringTermination2.ts ===
`\\`
>`\\` : string
>`\\` : "\\"
@@ -1,4 +1,4 @@
=== tests/cases/conformance/es6/templates/templateStringTermination2_ES6.ts ===
`\\`
>`\\` : string
>`\\` : "\\"
@@ -1,4 +1,4 @@
=== tests/cases/conformance/es6/templates/templateStringTermination3.ts ===
`\``
>`\`` : string
>`\`` : "`"
@@ -1,4 +1,4 @@
=== tests/cases/conformance/es6/templates/templateStringTermination3_ES6.ts ===
`\``
>`\`` : string
>`\`` : "`"
@@ -1,4 +1,4 @@
=== tests/cases/conformance/es6/templates/templateStringTermination4.ts ===
`\\\\`
>`\\\\` : string
>`\\\\` : "\\\\"
@@ -1,4 +1,4 @@
=== tests/cases/conformance/es6/templates/templateStringTermination4_ES6.ts ===
`\\\\`
>`\\\\` : string
>`\\\\` : "\\\\"
@@ -1,4 +1,4 @@
=== tests/cases/conformance/es6/templates/templateStringTermination5.ts ===
`\\\\\\`
>`\\\\\\` : string
>`\\\\\\` : "\\\\\\"
@@ -1,4 +1,4 @@
=== tests/cases/conformance/es6/templates/templateStringTermination5_ES6.ts ===
`\\\\\\`
>`\\\\\\` : string
>`\\\\\\` : "\\\\\\"
@@ -1,4 +1,4 @@
=== tests/cases/conformance/es6/templates/templateStringWhitespaceEscapes1.ts ===
`\t\n\v\f\r`;
>`\t\n\v\f\r` : string
>`\t\n\v\f\r` : "\t\n\v\f\r"
@@ -1,4 +1,4 @@
=== tests/cases/conformance/es6/templates/templateStringWhitespaceEscapes1_ES6.ts ===
`\t\n\v\f\r`;
>`\t\n\v\f\r` : string
>`\t\n\v\f\r` : "\t\n\v\f\r"
@@ -1,5 +1,5 @@
=== tests/cases/conformance/es6/templates/templateStringWhitespaceEscapes2.ts ===
// <TAB>, <VT>, <FF>, <SP>, <NBSP>, <BOM>
`\u0009\u000B\u000C\u0020\u00A0\uFEFF`;
>`\u0009\u000B\u000C\u0020\u00A0\uFEFF` : string
>`\u0009\u000B\u000C\u0020\u00A0\uFEFF` : "\t\v\f  "
@@ -1,5 +1,5 @@
=== tests/cases/conformance/es6/templates/templateStringWhitespaceEscapes2_ES6.ts ===
// <TAB>, <VT>, <FF>, <SP>, <NBSP>, <BOM>
`\u0009\u000B\u000C\u0020\u00A0\uFEFF`;
>`\u0009\u000B\u000C\u0020\u00A0\uFEFF` : string
>`\u0009\u000B\u000C\u0020\u00A0\uFEFF` : "\t\v\f  "
@@ -1,17 +1,17 @@
=== tests/cases/conformance/es6/templates/templateStringWithBackslashEscapes01.ts ===
var a = `hello\world`;
>a : string
>`hello\world` : string
>`hello\world` : "helloworld"
var b = `hello\\world`;
>b : string
>`hello\\world` : string
>`hello\\world` : "hello\\world"
var c = `hello\\\world`;
>c : string
>`hello\\\world` : string
>`hello\\\world` : "hello\\world"
var d = `hello\\\\world`;
>d : string
>`hello\\\\world` : string
>`hello\\\\world` : "hello\\\\world"
@@ -1,17 +1,17 @@
=== tests/cases/conformance/es6/templates/templateStringWithBackslashEscapes01_ES6.ts ===
var a = `hello\world`;
>a : string
>`hello\world` : string
>`hello\world` : "helloworld"
var b = `hello\\world`;
>b : string
>`hello\\world` : string
>`hello\\world` : "hello\\world"
var c = `hello\\\world`;
>c : string
>`hello\\\world` : string
>`hello\\\world` : "hello\\world"
var d = `hello\\\\world`;
>d : string
>`hello\\\\world` : string
>`hello\\\\world` : "hello\\\\world"
@@ -1,7 +1,7 @@
=== tests/cases/conformance/es6/templates/templateStringWithEmptyLiteralPortions.ts ===
var a = ``;
>a : string
>`` : string
>`` : ""
var b = `${ 0 }`;
>b : string
@@ -1,7 +1,7 @@
=== tests/cases/conformance/es6/templates/templateStringWithEmptyLiteralPortionsES6.ts ===
var a = ``;
>a : string
>`` : string
>`` : ""
var b = `${ 0 }`;
>b : string
@@ -5,5 +5,5 @@
>`abc${0}abc` : string
>0 : 0
>indexOf : (searchString: string, position?: number) => number
>`abc` : string
>`abc` : "abc"
@@ -5,5 +5,5 @@
>`abc${0}abc` : string
>0 : 0
>indexOf : (searchString: string, position?: number) => number
>`abc` : string
>`abc` : "abc"
@@ -210,7 +210,7 @@ function identifyBeast(beast: Beast) {
log(`pegasus - 4 legs, wings`);
>log(`pegasus - 4 legs, wings`) : void
>log : (s: string) => void
>`pegasus - 4 legs, wings` : string
>`pegasus - 4 legs, wings` : "pegasus - 4 legs, wings"
}
else if (beast.legs === 2) {
>beast.legs === 2 : boolean
@@ -222,7 +222,7 @@ function identifyBeast(beast: Beast) {
log(`bird - 2 legs, wings`);
>log(`bird - 2 legs, wings`) : void
>log : (s: string) => void
>`bird - 2 legs, wings` : string
>`bird - 2 legs, wings` : "bird - 2 legs, wings"
}
else {
log(`unknown - ${beast.legs} legs, wings`);
@@ -257,13 +257,13 @@ function identifyBeast(beast: Beast) {
log(`quetzalcoatl - no legs, wings`)
>log(`quetzalcoatl - no legs, wings`) : void
>log : (s: string) => void
>`quetzalcoatl - no legs, wings` : string
>`quetzalcoatl - no legs, wings` : "quetzalcoatl - no legs, wings"
}
else {
log(`snake - no legs, no wings`)
>log(`snake - no legs, no wings`) : void
>log : (s: string) => void
>`snake - no legs, no wings` : string
>`snake - no legs, no wings` : "snake - no legs, no wings"
}
}
}
@@ -1,5 +1,5 @@
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInTemplates01_ES5.ts ===
var x = `\u{0}`;
>x : string
>`\u{0}` : string
>`\u{0}` : "\0"
@@ -1,5 +1,5 @@
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInTemplates01_ES6.ts ===
var x = `\u{0}`;
>x : string
>`\u{0}` : string
>`\u{0}` : "\0"
@@ -1,5 +1,5 @@
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInTemplates02_ES5.ts ===
var x = `\u{00}`;
>x : string
>`\u{00}` : string
>`\u{00}` : "\0"
@@ -1,5 +1,5 @@
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInTemplates02_ES6.ts ===
var x = `\u{00}`;
>x : string
>`\u{00}` : string
>`\u{00}` : "\0"
@@ -1,5 +1,5 @@
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInTemplates03_ES5.ts ===
var x = `\u{0000}`;
>x : string
>`\u{0000}` : string
>`\u{0000}` : "\0"
@@ -1,5 +1,5 @@
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInTemplates03_ES6.ts ===
var x = `\u{0000}`;
>x : string
>`\u{0000}` : string
>`\u{0000}` : "\0"
@@ -1,5 +1,5 @@
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInTemplates04_ES5.ts ===
var x = `\u{00000000}`;
>x : string
>`\u{00000000}` : string
>`\u{00000000}` : "\0"
@@ -1,5 +1,5 @@
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInTemplates04_ES6.ts ===
var x = `\u{00000000}`;
>x : string
>`\u{00000000}` : string
>`\u{00000000}` : "\0"
@@ -1,5 +1,5 @@
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInTemplates05_ES5.ts ===
var x = `\u{48}\u{65}\u{6c}\u{6c}\u{6f}\u{20}\u{77}\u{6f}\u{72}\u{6c}\u{64}`;
>x : string
>`\u{48}\u{65}\u{6c}\u{6c}\u{6f}\u{20}\u{77}\u{6f}\u{72}\u{6c}\u{64}` : string
>`\u{48}\u{65}\u{6c}\u{6c}\u{6f}\u{20}\u{77}\u{6f}\u{72}\u{6c}\u{64}` : "Hello world"
@@ -1,5 +1,5 @@
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInTemplates05_ES6.ts ===
var x = `\u{48}\u{65}\u{6c}\u{6c}\u{6f}\u{20}\u{77}\u{6f}\u{72}\u{6c}\u{64}`;
>x : string
>`\u{48}\u{65}\u{6c}\u{6c}\u{6f}\u{20}\u{77}\u{6f}\u{72}\u{6c}\u{64}` : string
>`\u{48}\u{65}\u{6c}\u{6c}\u{6f}\u{20}\u{77}\u{6f}\u{72}\u{6c}\u{64}` : "Hello world"
@@ -3,5 +3,5 @@
// 1. Assert: 0 ≤ cp ≤ 0x10FFFF.
var x = `\u{10FFFF}`;
>x : string
>`\u{10FFFF}` : string
>`\u{10FFFF}` : "􏿿"
@@ -3,5 +3,5 @@
// 1. Assert: 0 ≤ cp ≤ 0x10FFFF.
var x = `\u{10FFFF}`;
>x : string
>`\u{10FFFF}` : string
>`\u{10FFFF}` : "􏿿"
@@ -4,5 +4,5 @@
// (FFFF == 65535)
var x = `\u{FFFF}`;
>x : string
>`\u{FFFF}` : string
>`\u{FFFF}` : "￿"
@@ -4,5 +4,5 @@
// (FFFF == 65535)
var x = `\u{FFFF}`;
>x : string
>`\u{FFFF}` : string
>`\u{FFFF}` : "￿"
@@ -4,5 +4,5 @@
// (10000 == 65536)
var x = `\u{10000}`;
>x : string
>`\u{10000}` : string
>`\u{10000}` : "𐀀"
@@ -4,5 +4,5 @@
// (10000 == 65536)
var x = `\u{10000}`;
>x : string
>`\u{10000}` : string
>`\u{10000}` : "𐀀"
@@ -5,5 +5,5 @@
// this is a useful edge-case test.
var x = `\u{D800}`;
>x : string
>`\u{D800}` : string
>`\u{D800}` : ""
@@ -5,5 +5,5 @@
// this is a useful edge-case test.
var x = `\u{D800}`;
>x : string
>`\u{D800}` : string
>`\u{D800}` : ""
@@ -5,5 +5,5 @@
// this is a useful edge-case test.
var x = `\u{DC00}`;
>x : string
>`\u{DC00}` : string
>`\u{DC00}` : ""
@@ -5,5 +5,5 @@
// this is a useful edge-case test.
var x = `\u{DC00}`;
>x : string
>`\u{DC00}` : string
>`\u{DC00}` : ""
@@ -1,5 +1,5 @@
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInTemplates13_ES5.ts ===
var x = `\u{DDDDD}`;
>x : string
>`\u{DDDDD}` : string
>`\u{DDDDD}` : "󝷝"
@@ -1,5 +1,5 @@
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInTemplates13_ES6.ts ===
var x = `\u{DDDDD}`;
>x : string
>`\u{DDDDD}` : string
>`\u{DDDDD}` : "󝷝"
@@ -1,5 +1,5 @@
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInTemplates15_ES5.ts ===
var x = `\u{abcd}\u{ef12}\u{3456}\u{7890}`;
>x : string
>`\u{abcd}\u{ef12}\u{3456}\u{7890}` : string
>`\u{abcd}\u{ef12}\u{3456}\u{7890}` : "ꯍ㑖碐"
@@ -1,5 +1,5 @@
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInTemplates15_ES6.ts ===
var x = `\u{abcd}\u{ef12}\u{3456}\u{7890}`;
>x : string
>`\u{abcd}\u{ef12}\u{3456}\u{7890}` : string
>`\u{abcd}\u{ef12}\u{3456}\u{7890}` : "ꯍ㑖碐"
@@ -1,5 +1,5 @@
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInTemplates16_ES5.ts ===
var x = `\u{ABCD}\u{EF12}\u{3456}\u{7890}`;
>x : string
>`\u{ABCD}\u{EF12}\u{3456}\u{7890}` : string
>`\u{ABCD}\u{EF12}\u{3456}\u{7890}` : "ꯍ㑖碐"
@@ -1,5 +1,5 @@
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInTemplates16_ES6.ts ===
var x = `\u{ABCD}\u{EF12}\u{3456}\u{7890}`;
>x : string
>`\u{ABCD}\u{EF12}\u{3456}\u{7890}` : string
>`\u{ABCD}\u{EF12}\u{3456}\u{7890}` : "ꯍ㑖碐"
@@ -1,5 +1,5 @@
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInTemplates18_ES5.ts ===
var x = `\u{65}\u{65}`;
>x : string
>`\u{65}\u{65}` : string
>`\u{65}\u{65}` : "ee"
@@ -1,5 +1,5 @@
=== tests/cases/conformance/es6/unicodeExtendedEscapes/unicodeExtendedEscapesInTemplates18_ES6.ts ===
var x = `\u{65}\u{65}`;
>x : string
>`\u{65}\u{65}` : string
>`\u{65}\u{65}` : "ee"

Some files were not shown because too many files have changed in this diff Show More