From e7096280b4e3f378b3ca78e50e6e26e1be5db509 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 23 Oct 2014 16:32:43 -0700 Subject: [PATCH] Added support for tagged template strings, updated baselines. Still need to implement some error recovery and add tests. --- src/compiler/checker.ts | 13 +++++++++ .../diagnosticInformationMap.generated.ts | 1 + src/compiler/diagnosticMessages.json | 4 +++ src/compiler/emitter.ts | 9 ++++++ src/compiler/parser.ts | 28 ++++++++++++++++--- src/compiler/types.ts | 10 ++++++- .../templateStringInModuleName.errors.txt | 12 ++++---- .../templateStringInModuleNameES6.errors.txt | 8 +----- .../templateStringInObjectLiteral.errors.txt | 14 ++++++++-- ...emplateStringInObjectLiteralES6.errors.txt | 9 ++++-- .../templateStringInYieldKeyword.errors.txt | 6 ++-- ...emplateStringWithEmbeddedConditional.types | 5 ++++ ...lateStringWithEmbeddedConditionalES6.types | 5 ++++ ...eStringWithEmbeddedYieldKeyword.errors.txt | 6 ++-- ...ringWithEmbeddedYieldKeywordES6.errors.txt | 7 +---- 15 files changed, 101 insertions(+), 36 deletions(-) create mode 100644 tests/baselines/reference/templateStringWithEmbeddedConditional.types create mode 100644 tests/baselines/reference/templateStringWithEmbeddedConditionalES6.types diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e600d695b65..8430ad2a83b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5422,6 +5422,13 @@ module ts { return getReturnTypeOfSignature(signature); } + function checkTaggedTemplateExpression(node: TaggedTemplateExpression): Type { + // TODO (drosen): Make sure substitutions are assignable to the tag's arguments. + checkExpression(node.tag); + checkExpression(node.template); + return anyType; + } + function checkTypeAssertion(node: TypeAssertion): Type { var exprType = checkExpression(node.operand); var targetType = getTypeFromTypeNode(node.type); @@ -6012,6 +6019,8 @@ module ts { case SyntaxKind.CallExpression: case SyntaxKind.NewExpression: return checkCallExpression(node); + case SyntaxKind.TaggedTemplateExpression: + return checkTaggedTemplateExpression(node); case SyntaxKind.TypeAssertion: return checkTypeAssertion(node); case SyntaxKind.ParenExpression: @@ -7744,6 +7753,7 @@ module ts { case SyntaxKind.IndexedAccess: case SyntaxKind.CallExpression: case SyntaxKind.NewExpression: + case SyntaxKind.TaggedTemplateExpression: case SyntaxKind.TypeAssertion: case SyntaxKind.ParenExpression: case SyntaxKind.PrefixOperator: @@ -8020,6 +8030,9 @@ module ts { case SyntaxKind.CallExpression: case SyntaxKind.NewExpression: return (parent).typeArguments && (parent).typeArguments.indexOf(node) >= 0; + case SyntaxKind.TaggedTemplateExpression: + // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. + return false; } } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index e26cbcf8bb6..22c014186e0 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -121,6 +121,7 @@ module ts { const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: DiagnosticCategory.Error, key: "'const' declarations can only be declared inside a block." }, let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: DiagnosticCategory.Error, key: "'let' declarations can only be declared inside a block." }, Invalid_template_literal_expected: { code: 1158, category: DiagnosticCategory.Error, key: "Invalid template literal; expected '}'" }, + Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1159, category: DiagnosticCategory.Error, key: "Tagged templates are only available when targeting ECMAScript 6 and higher." }, Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 0c89ba66e09..92eaea3dde7 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -475,6 +475,10 @@ "category": "Error", "code": 1158 }, + "Tagged templates are only available when targeting ECMAScript 6 and higher.": { + "category": "Error", + "code": 1159 + }, "Duplicate identifier '{0}'.": { "category": "Error", diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 11bf50c8c34..e8550fbce31 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1064,6 +1064,13 @@ module ts { } } + function emitTaggedTemplateExpression(node: TaggedTemplateExpression): void { + Debug.assert(compilerOptions.target >= ScriptTarget.ES6, "Trying to emit a tagged template in pre-ES6 mode."); + emit(node.tag); + write(" "); + emit(node.template); + } + function emitParenExpression(node: ParenExpression) { if (node.expression.kind === SyntaxKind.TypeAssertion) { var operand = (node.expression).operand; @@ -2197,6 +2204,8 @@ module ts { return emitCallExpression(node); case SyntaxKind.NewExpression: return emitNewExpression(node); + case SyntaxKind.TaggedTemplateExpression: + return emitTaggedTemplateExpression(node); case SyntaxKind.TypeAssertion: return emit((node).operand); case SyntaxKind.ParenExpression: diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 719ce8f0811..5a56c21ef78 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -244,6 +244,9 @@ module ts { return child((node).func) || children((node).typeArguments) || children((node).arguments); + case SyntaxKind.TaggedTemplateExpression: + return child((node).tag) || + child((node).template); case SyntaxKind.TypeAssertion: return child((node).type) || child((node).operand); @@ -470,6 +473,7 @@ module ts { case SyntaxKind.IndexedAccess: case SyntaxKind.CallExpression: case SyntaxKind.NewExpression: + case SyntaxKind.TaggedTemplateExpression: case SyntaxKind.TypeAssertion: case SyntaxKind.ParenExpression: case SyntaxKind.FunctionExpression: @@ -2074,6 +2078,7 @@ module ts { case SyntaxKind.IndexedAccess: case SyntaxKind.NewExpression: case SyntaxKind.CallExpression: + case SyntaxKind.TaggedTemplateExpression: case SyntaxKind.ArrayLiteral: case SyntaxKind.ParenExpression: case SyntaxKind.ObjectLiteral: @@ -2440,7 +2445,7 @@ module ts { function parseCallAndAccess(expr: Expression, inNewExpression: boolean): Expression { while (true) { - var dotStart = scanner.getTokenPos(); + var dotOrBracketStart = scanner.getTokenPos(); if (parseOptional(SyntaxKind.DotToken)) { var propertyAccess = createNode(SyntaxKind.PropertyAccess, expr.pos); // Technically a keyword is valid here as all keywords are identifier names. @@ -2463,7 +2468,7 @@ module ts { // In the first case though, ASI will not take effect because there is not a // line terminator after the keyword. if (scanner.hasPrecedingLineBreak() && scanner.isReservedWord() && lookAhead(() => scanner.isReservedWord())) { - grammarErrorAtPos(dotStart, scanner.getStartPos() - dotStart, Diagnostics.Identifier_expected); + grammarErrorAtPos(dotOrBracketStart, scanner.getStartPos() - dotOrBracketStart, Diagnostics.Identifier_expected); var id = createMissingNode(); } else { @@ -2476,7 +2481,6 @@ module ts { continue; } - var bracketStart = scanner.getTokenPos(); if (parseOptional(SyntaxKind.OpenBracketToken)) { var indexedAccess = createNode(SyntaxKind.IndexedAccess, expr.pos); @@ -2486,7 +2490,7 @@ module ts { // Check for that common pattern and report a better error message. if (inNewExpression && parseOptional(SyntaxKind.CloseBracketToken)) { indexedAccess.index = createMissingNode(); - grammarErrorAtPos(bracketStart, scanner.getStartPos() - bracketStart, Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); + grammarErrorAtPos(dotOrBracketStart, scanner.getStartPos() - dotOrBracketStart, Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); } else { indexedAccess.index = parseExpression(); @@ -2519,6 +2523,22 @@ module ts { expr = finishNode(callExpr); continue; } + + if (token === SyntaxKind.NoSubstitutionTemplateLiteral || token === SyntaxKind.TemplateHead) { + var tagExpression = createNode(SyntaxKind.TaggedTemplateExpression, expr.pos); + tagExpression.tag = expr; + tagExpression.template = token === SyntaxKind.NoSubstitutionTemplateLiteral + ? parseLiteralNode() + : parseTemplateExpression(); + expr = finishNode(tagExpression); + + if (languageVersion < ScriptTarget.ES6) { + grammarErrorOnNode(expr, Diagnostics.Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher); + } + + continue; + } + return expr; } } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 9531f888948..0c5fe20b713 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -169,6 +169,7 @@ module ts { IndexedAccess, CallExpression, NewExpression, + TaggedTemplateExpression, TypeAssertion, ParenExpression, FunctionExpression, @@ -437,6 +438,12 @@ module ts { export interface NewExpression extends CallExpression { } + export interface TaggedTemplateExpression extends Expression { + tag: Expression; + // Either a LiteralExpression of kind NoSubstitutionTemplateLiteral, or a TemplateExpression + template: Expression; + } + export interface TypeAssertion extends Expression { type: TypeNode; operand: Expression; @@ -819,10 +826,11 @@ module ts { Prototype = 0x04000000, // Prototype property (no source representation) UnionProperty = 0x08000000, // Property in union type - BlockScopedVariable = 0x10000000, // A block-scoped variable (let ot const) + BlockScopedVariable = 0x10000000, // A block-scoped variable (let or const) Variable = FunctionScopedVariable | BlockScopedVariable, Value = Variable | Property | EnumMember | Function | Class | Enum | ValueModule | Method | GetAccessor | SetAccessor, + Type = Class | Interface | Enum | TypeLiteral | ObjectLiteral | TypeParameter, Namespace = ValueModule | NamespaceModule, Module = ValueModule | NamespaceModule, diff --git a/tests/baselines/reference/templateStringInModuleName.errors.txt b/tests/baselines/reference/templateStringInModuleName.errors.txt index 4aa06a6232b..fb6188d9d9a 100644 --- a/tests/baselines/reference/templateStringInModuleName.errors.txt +++ b/tests/baselines/reference/templateStringInModuleName.errors.txt @@ -1,8 +1,8 @@ tests/cases/conformance/es6/templates/templateStringInModuleName.ts(1,9): error TS1005: ';' expected. -tests/cases/conformance/es6/templates/templateStringInModuleName.ts(1,16): error TS1005: ';' expected. +tests/cases/conformance/es6/templates/templateStringInModuleName.ts(1,9): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/templateStringInModuleName.ts(1,21): error TS1005: ';' expected. tests/cases/conformance/es6/templates/templateStringInModuleName.ts(4,9): error TS1005: ';' expected. -tests/cases/conformance/es6/templates/templateStringInModuleName.ts(4,16): error TS1005: ';' expected. +tests/cases/conformance/es6/templates/templateStringInModuleName.ts(4,9): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/templateStringInModuleName.ts(4,24): error TS1005: ';' expected. tests/cases/conformance/es6/templates/templateStringInModuleName.ts(1,1): error TS2304: Cannot find name 'declare'. tests/cases/conformance/es6/templates/templateStringInModuleName.ts(1,9): error TS2304: Cannot find name 'module'. @@ -14,8 +14,8 @@ tests/cases/conformance/es6/templates/templateStringInModuleName.ts(4,9): error declare module `M1` { ~~~~~~ !!! error TS1005: ';' expected. - ~~~~ -!!! error TS1005: ';' expected. + ~~~~~~~~~~~ +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~ !!! error TS1005: ';' expected. ~~~~~~~ @@ -27,8 +27,8 @@ tests/cases/conformance/es6/templates/templateStringInModuleName.ts(4,9): error declare module `M${2}` { ~~~~~~ !!! error TS1005: ';' expected. - ~~~~ -!!! error TS1005: ';' expected. + ~~~~~~~~~~~~~~ +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~ !!! error TS1005: ';' expected. ~~~~~~~ diff --git a/tests/baselines/reference/templateStringInModuleNameES6.errors.txt b/tests/baselines/reference/templateStringInModuleNameES6.errors.txt index fa2bed3d474..228fd32357c 100644 --- a/tests/baselines/reference/templateStringInModuleNameES6.errors.txt +++ b/tests/baselines/reference/templateStringInModuleNameES6.errors.txt @@ -1,8 +1,6 @@ tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(1,9): error TS1005: ';' expected. -tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(1,16): error TS1005: ';' expected. tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(1,21): error TS1005: ';' expected. tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(4,9): error TS1005: ';' expected. -tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(4,16): error TS1005: ';' expected. tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(4,24): error TS1005: ';' expected. tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(1,1): error TS2304: Cannot find name 'declare'. tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(1,9): error TS2304: Cannot find name 'module'. @@ -10,11 +8,9 @@ tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(4,1): err tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(4,9): error TS2304: Cannot find name 'module'. -==== tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts (10 errors) ==== +==== tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts (8 errors) ==== declare module `M1` { ~~~~~~ -!!! error TS1005: ';' expected. - ~~~~ !!! error TS1005: ';' expected. ~ !!! error TS1005: ';' expected. @@ -26,8 +22,6 @@ tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(4,9): err declare module `M${2}` { ~~~~~~ -!!! error TS1005: ';' expected. - ~~~~ !!! error TS1005: ';' expected. ~ !!! error TS1005: ';' expected. diff --git a/tests/baselines/reference/templateStringInObjectLiteral.errors.txt b/tests/baselines/reference/templateStringInObjectLiteral.errors.txt index 60fa4f99894..e190ea3a815 100644 --- a/tests/baselines/reference/templateStringInObjectLiteral.errors.txt +++ b/tests/baselines/reference/templateStringInObjectLiteral.errors.txt @@ -1,16 +1,24 @@ +tests/cases/conformance/es6/templates/templateStringInObjectLiteral.ts(1,9): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/templateStringInObjectLiteral.ts(3,5): error TS1136: Property assignment expected. -tests/cases/conformance/es6/templates/templateStringInObjectLiteral.ts(3,8): error TS1005: ';' expected. +tests/cases/conformance/es6/templates/templateStringInObjectLiteral.ts(3,8): error TS1005: ',' expected. +tests/cases/conformance/es6/templates/templateStringInObjectLiteral.ts(3,10): error TS1134: Variable declaration expected. tests/cases/conformance/es6/templates/templateStringInObjectLiteral.ts(4,1): error TS1128: Declaration or statement expected. -==== tests/cases/conformance/es6/templates/templateStringInObjectLiteral.ts (3 errors) ==== +==== tests/cases/conformance/es6/templates/templateStringInObjectLiteral.ts (5 errors) ==== var x = { + ~ a: `abc${ 123 }def`, + ~~~~~~~~~~~~~~~~~~~~~~~~ `b`: 321 + ~~~~~~~ +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~~~ !!! error TS1136: Property assignment expected. ~ -!!! error TS1005: ';' expected. +!!! error TS1005: ',' expected. + ~~~ +!!! error TS1134: Variable declaration expected. } ~ !!! error TS1128: Declaration or statement expected. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringInObjectLiteralES6.errors.txt b/tests/baselines/reference/templateStringInObjectLiteralES6.errors.txt index 6514356aedc..ae21ecd4739 100644 --- a/tests/baselines/reference/templateStringInObjectLiteralES6.errors.txt +++ b/tests/baselines/reference/templateStringInObjectLiteralES6.errors.txt @@ -1,16 +1,19 @@ tests/cases/conformance/es6/templates/templateStringInObjectLiteralES6.ts(3,5): error TS1136: Property assignment expected. -tests/cases/conformance/es6/templates/templateStringInObjectLiteralES6.ts(3,8): error TS1005: ';' expected. +tests/cases/conformance/es6/templates/templateStringInObjectLiteralES6.ts(3,8): error TS1005: ',' expected. +tests/cases/conformance/es6/templates/templateStringInObjectLiteralES6.ts(3,10): error TS1134: Variable declaration expected. tests/cases/conformance/es6/templates/templateStringInObjectLiteralES6.ts(4,1): error TS1128: Declaration or statement expected. -==== tests/cases/conformance/es6/templates/templateStringInObjectLiteralES6.ts (3 errors) ==== +==== tests/cases/conformance/es6/templates/templateStringInObjectLiteralES6.ts (4 errors) ==== var x = { a: `abc${ 123 }def`, `b`: 321 ~~~ !!! error TS1136: Property assignment expected. ~ -!!! error TS1005: ';' expected. +!!! error TS1005: ',' expected. + ~~~ +!!! error TS1134: Variable declaration expected. } ~ !!! error TS1128: Declaration or statement expected. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringInYieldKeyword.errors.txt b/tests/baselines/reference/templateStringInYieldKeyword.errors.txt index 61a9ddf3934..b70af797c5c 100644 --- a/tests/baselines/reference/templateStringInYieldKeyword.errors.txt +++ b/tests/baselines/reference/templateStringInYieldKeyword.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts(1,9): error TS1003: Identifier expected. tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts(1,15): error TS1005: ';' expected. -tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts(3,19): error TS1005: ',' expected. +tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts(3,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts(1,11): error TS2304: Cannot find name 'gen'. tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts(3,13): error TS2304: Cannot find name 'yield'. @@ -15,8 +15,8 @@ tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts(3,13): err !!! error TS2304: Cannot find name 'gen'. // Once this is supported, the inner expression does not need to be parenthesized. var x = yield `abc${ x }def`; - ~~~~~~ -!!! error TS1005: ',' expected. + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~~~~~ !!! error TS2304: Cannot find name 'yield'. } diff --git a/tests/baselines/reference/templateStringWithEmbeddedConditional.types b/tests/baselines/reference/templateStringWithEmbeddedConditional.types new file mode 100644 index 00000000000..de4249792e7 --- /dev/null +++ b/tests/baselines/reference/templateStringWithEmbeddedConditional.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/es6/templates/templateStringWithEmbeddedConditional.ts === +var x = `abc${ true ? false : " " }def`; +>x : string +>true ? false : " " : string | boolean + diff --git a/tests/baselines/reference/templateStringWithEmbeddedConditionalES6.types b/tests/baselines/reference/templateStringWithEmbeddedConditionalES6.types new file mode 100644 index 00000000000..3fa96510f41 --- /dev/null +++ b/tests/baselines/reference/templateStringWithEmbeddedConditionalES6.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/es6/templates/templateStringWithEmbeddedConditionalES6.ts === +var x = `abc${ true ? false : " " }def`; +>x : string +>true ? false : " " : string | boolean + diff --git a/tests/baselines/reference/templateStringWithEmbeddedYieldKeyword.errors.txt b/tests/baselines/reference/templateStringWithEmbeddedYieldKeyword.errors.txt index a040d0cb2f4..b9e803a8a14 100644 --- a/tests/baselines/reference/templateStringWithEmbeddedYieldKeyword.errors.txt +++ b/tests/baselines/reference/templateStringWithEmbeddedYieldKeyword.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts(1,9): error TS1003: Identifier expected. tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts(1,15): error TS1005: ';' expected. tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts(3,26): error TS1158: Invalid template literal; expected '}' -tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts(3,33): error TS1005: ';' expected. +tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts(3,30): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts(5,1): error TS1126: Unexpected end of text. tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts(1,11): error TS2304: Cannot find name 'gen'. tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts(3,20): error TS2304: Cannot find name 'yield'. @@ -20,7 +20,7 @@ tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts( var x = `abc${ yield 10 }def`; ~~ !!! error TS1158: Invalid template literal; expected '}' - ~~ + ~~~~~ ~~~~~ !!! error TS2304: Cannot find name 'yield'. ~~~ @@ -29,6 +29,6 @@ tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeyword.ts( ~ -!!! error TS1005: ';' expected. +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. !!! error TS1126: Unexpected end of text. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringWithEmbeddedYieldKeywordES6.errors.txt b/tests/baselines/reference/templateStringWithEmbeddedYieldKeywordES6.errors.txt index 58dd041e47f..6cae5332517 100644 --- a/tests/baselines/reference/templateStringWithEmbeddedYieldKeywordES6.errors.txt +++ b/tests/baselines/reference/templateStringWithEmbeddedYieldKeywordES6.errors.txt @@ -1,14 +1,13 @@ tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts(1,9): error TS1003: Identifier expected. tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts(1,17): error TS1005: ';' expected. tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts(3,26): error TS1158: Invalid template literal; expected '}' -tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts(3,33): error TS1005: ';' expected. tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts(5,1): error TS1126: Unexpected end of text. tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts(1,11): error TS2304: Cannot find name 'gen'. tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts(3,20): error TS2304: Cannot find name 'yield'. tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts(3,30): error TS2304: Cannot find name 'def'. -==== tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts (8 errors) ==== +==== tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts (7 errors) ==== function* gen() { ~ !!! error TS1003: Identifier expected. @@ -20,15 +19,11 @@ tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6. var x = `abc${ yield 10 }def`; ~~ !!! error TS1158: Invalid template literal; expected '}' - ~~ ~~~~~ !!! error TS2304: Cannot find name 'yield'. ~~~ !!! error TS2304: Cannot find name 'def'. } - ~ -!!! error TS1005: ';' expected. - !!! error TS1126: Unexpected end of text. \ No newline at end of file