From 0e122b563309622a0fe70739ec773b47ce16204e Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 25 Nov 2014 17:41:49 -0800 Subject: [PATCH 1/5] Keep track of unterminated literal expressions. --- src/compiler/checker.ts | 4 ++-- src/compiler/emitter.ts | 4 ++-- src/compiler/parser.ts | 23 ++++--------------- src/compiler/scanner.ts | 10 ++++++++ src/compiler/types.ts | 1 + src/services/services.ts | 43 ++++++----------------------------- src/services/signatureHelp.ts | 2 +- src/services/utilities.ts | 4 ++-- 8 files changed, 29 insertions(+), 62 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5ee9fa4ab3e..ea4c04e8b84 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5302,7 +5302,7 @@ module ts { var templateExpression = tagExpression.template; var lastSpan = lastOrUndefined(templateExpression.templateSpans); Debug.assert(lastSpan !== undefined); // we should always have at least one span. - callIsIncomplete = lastSpan.literal.kind === SyntaxKind.Missing || isUnterminatedTemplateEnd(lastSpan.literal); + callIsIncomplete = lastSpan.literal.kind === SyntaxKind.Missing || !!lastSpan.literal.isUnterminated; } else { // If the template didn't end in a backtick, or its beginning occurred right prior to EOF, @@ -5310,7 +5310,7 @@ module ts { // so we consider the call to be incomplete. var templateLiteral = tagExpression.template; Debug.assert(templateLiteral.kind === SyntaxKind.NoSubstitutionTemplateLiteral); - callIsIncomplete = isUnterminatedTemplateEnd(templateLiteral); + callIsIncomplete = !!templateLiteral.isUnterminated; } } else { diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 5cdf98aa63e..4595c8cb475 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -715,7 +715,7 @@ module ts { }; } } - + function emitEnumDeclaration(node: EnumDeclaration) { if (resolver.isDeclarationVisible(node)) { emitJsDocComments(node); @@ -3558,7 +3558,7 @@ module ts { return leadingComments; } - + function getLeadingCommentsToEmit(node: Node) { // Emit the leading comments only if the parent's pos doesn't match because parent should take care of emitting these comments if (node.parent.kind === SyntaxKind.SourceFile || node.pos !== node.parent.pos) { diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 8d7bf9e4fe7..c08ba6a7ab5 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -809,25 +809,6 @@ module ts { return SyntaxKind.FirstTriviaToken <= token && token <= SyntaxKind.LastTriviaToken; } - export function isUnterminatedTemplateEnd(node: LiteralExpression) { - Debug.assert(isTemplateLiteralKind(node.kind)); - var sourceText = getSourceFileOfNode(node).text; - - // If we're not at the EOF, we know we must be terminated. - if (node.end !== sourceText.length) { - return false; - } - - // The literal can only be unterminated if it is a template tail or a no-sub template. - if (node.kind !== SyntaxKind.TemplateTail && node.kind !== SyntaxKind.NoSubstitutionTemplateLiteral) { - return false; - } - - // If we didn't end in a backtick, we must still be in the middle of a template. - // If we did, make sure that it's not the *initial* backtick. - return sourceText.charCodeAt(node.end - 1) !== CharacterCodes.backtick || node.text.length === 0; - } - export function isModifier(token: SyntaxKind): boolean { switch (token) { case SyntaxKind.PublicKeyword: @@ -1544,6 +1525,10 @@ module ts { var text = scanner.getTokenValue(); node.text = internName ? internIdentifier(text) : text; + if (scanner.isUnterminated()) { + node.isUnterminated = true; + } + var tokenPos = scanner.getTokenPos(); nextToken(); finishNode(node); diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 4858265932e..f9d23166fee 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -22,6 +22,7 @@ module ts { hasPrecedingLineBreak(): boolean; isIdentifier(): boolean; isReservedWord(): boolean; + isUnterminated(): boolean; reScanGreaterToken(): SyntaxKind; reScanSlashToken(): SyntaxKind; reScanTemplateToken(): SyntaxKind; @@ -470,6 +471,7 @@ module ts { var token: SyntaxKind; var tokenValue: string; var precedingLineBreak: boolean; + var tokenUnterminated: boolean; function error(message: DiagnosticMessage): void { if (onError) { @@ -553,6 +555,7 @@ module ts { while (true) { if (pos >= len) { result += text.substring(start, pos); + tokenUnterminated = true; error(Diagnostics.Unterminated_string_literal); break; } @@ -570,6 +573,7 @@ module ts { } if (isLineBreak(ch)) { result += text.substring(start, pos); + tokenUnterminated = true; error(Diagnostics.Unterminated_string_literal); break; } @@ -593,6 +597,7 @@ module ts { while (true) { if (pos >= len) { contents += text.substring(start, pos); + tokenUnterminated = true; error(Diagnostics.Unterminated_template_literal); resultingToken = startedWithBacktick ? SyntaxKind.NoSubstitutionTemplateLiteral : SyntaxKind.TemplateTail; break; @@ -756,6 +761,7 @@ module ts { function scan(): SyntaxKind { startPos = pos; precedingLineBreak = false; + tokenUnterminated = false; while (true) { tokenPos = pos; if (pos >= len) { @@ -912,6 +918,7 @@ module ts { continue; } else { + tokenUnterminated = !commentClosed; return token = SyntaxKind.MultiLineCommentTrivia; } } @@ -1069,12 +1076,14 @@ module ts { // If we reach the end of a file, or hit a newline, then this is an unterminated // regex. Report error and return what we have so far. if (p >= len) { + tokenUnterminated = true; error(Diagnostics.Unterminated_regular_expression_literal) break; } var ch = text.charCodeAt(p); if (isLineBreak(ch)) { + tokenUnterminated = true; error(Diagnostics.Unterminated_regular_expression_literal) break; } @@ -1167,6 +1176,7 @@ module ts { hasPrecedingLineBreak: () => precedingLineBreak, isIdentifier: () => token === SyntaxKind.Identifier || token > SyntaxKind.LastReservedWord, isReservedWord: () => token >= SyntaxKind.FirstReservedWord && token <= SyntaxKind.LastReservedWord, + isUnterminated: () => tokenUnterminated, reScanGreaterToken, reScanSlashToken, reScanTemplateToken, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 83937c24ed9..3bfd8bc341e 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -467,6 +467,7 @@ module ts { // For a NumericLiteral, the stored value is the toString() representation of the number. For example 1, 1.00, and 1e0 are all stored as just "1". export interface LiteralExpression extends Expression { text: string; + isUnterminated?: boolean; } export interface TemplateExpression extends Expression { diff --git a/src/services/services.ts b/src/services/services.ts index 67e8aba34d2..8ff61b05a7a 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2497,10 +2497,11 @@ module ts { } function isInStringOrRegularExpressionOrTemplateLiteral(previousToken: Node): boolean { - if (previousToken.kind === SyntaxKind.StringLiteral || isTemplateLiteralKind(previousToken.kind)) { + if (previousToken.kind === SyntaxKind.StringLiteral + || previousToken.kind === SyntaxKind.RegularExpressionLiteral + || isTemplateLiteralKind(previousToken.kind)) { // The position has to be either: 1. entirely within the token text, or - // 2. at the end position, and the string literal is not terminated - + // 2. at the end position of an unterminated token. var start = previousToken.getStart(); var end = previousToken.getEnd(); @@ -2508,36 +2509,9 @@ module ts { return true; } else if (position === end) { - var width = end - start; - var text = previousToken.getSourceFile().text; - - // If the token is a single character, or its second-to-last charcter indicates an escape code, - // then we can immediately say that we are in the middle of an unclosed string. - if (width <= 1 || text.charCodeAt(end - 2) === CharacterCodes.backslash) { - return true; - } - - // Now check if the last character is a closing character for the token. - switch (previousToken.kind) { - case SyntaxKind.StringLiteral: - case SyntaxKind.NoSubstitutionTemplateLiteral: - return text.charCodeAt(start) !== text.charCodeAt(end - 1); - - case SyntaxKind.TemplateHead: - case SyntaxKind.TemplateMiddle: - return text.charCodeAt(end - 1) !== CharacterCodes.openBrace - || text.charCodeAt(end - 2) !== CharacterCodes.$; - - case SyntaxKind.TemplateTail: - return text.charCodeAt(end - 1) !== CharacterCodes.backtick; - } - - return false; + return !!(previousToken).isUnterminated; } } - else if (previousToken.kind === SyntaxKind.RegularExpressionLiteral) { - return previousToken.getStart() < position && position < previousToken.getEnd(); - } return false; } @@ -5579,7 +5553,7 @@ module ts { if (token === SyntaxKind.StringLiteral) { // Check to see if we finished up on a multiline string literal. var tokenText = scanner.getTokenText(); - if (tokenText.length > 0 && tokenText.charCodeAt(tokenText.length - 1) === CharacterCodes.backslash) { + if (scanner.isUnterminated()) { var quoteChar = tokenText.charCodeAt(0); result.finalLexState = quoteChar === CharacterCodes.doubleQuote ? EndOfLineState.InDoubleQuoteStringLiteral @@ -5588,10 +5562,7 @@ module ts { } else if (token === SyntaxKind.MultiLineCommentTrivia) { // Check to see if the multiline comment was unclosed. - var tokenText = scanner.getTokenText() - if (!(tokenText.length > 3 && // need to avoid catching '/*/' - tokenText.charCodeAt(tokenText.length - 2) === CharacterCodes.asterisk && - tokenText.charCodeAt(tokenText.length - 1) === CharacterCodes.slash)) { + if (scanner.isUnterminated()) { result.finalLexState = EndOfLineState.InMultiLineCommentTrivia; } } diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index e2b65e3c6e1..4ec0b1dfbc2 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -296,7 +296,7 @@ module ts.SignatureHelp { Debug.assert(templateExpression.kind === SyntaxKind.TemplateExpression); // If we're just after a template tail, don't show signature help. - if (node.kind === SyntaxKind.TemplateTail && position >= node.getEnd() && !isUnterminatedTemplateEnd(node)) { + if (node.kind === SyntaxKind.TemplateTail && position >= node.getEnd() && !(node).isUnterminated) { return undefined; } diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 75bea36bf3a..4a3301312fb 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -322,7 +322,7 @@ module ts { } export function isInsideTemplateLiteral(node: LiteralExpression, position: number) { - return (node.getStart() < position && position < node.getEnd()) - || (isUnterminatedTemplateEnd(node) && position === node.getEnd()); + return isTemplateLiteralKind(node.kind) + && (node.getStart() < position && position < node.getEnd()) || (!!node.isUnterminated && position === node.getEnd()); } } \ No newline at end of file From 86c7def8cc45300c80de1c56f235cf6cbcf9797d Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 26 Nov 2014 13:38:27 -0800 Subject: [PATCH 2/5] tokenUnterminated -> tokenIsUnterminated --- src/compiler/scanner.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index f9d23166fee..36cb50e3658 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -471,7 +471,7 @@ module ts { var token: SyntaxKind; var tokenValue: string; var precedingLineBreak: boolean; - var tokenUnterminated: boolean; + var tokenIsUnterminated: boolean; function error(message: DiagnosticMessage): void { if (onError) { @@ -555,7 +555,7 @@ module ts { while (true) { if (pos >= len) { result += text.substring(start, pos); - tokenUnterminated = true; + tokenIsUnterminated = true; error(Diagnostics.Unterminated_string_literal); break; } @@ -573,7 +573,7 @@ module ts { } if (isLineBreak(ch)) { result += text.substring(start, pos); - tokenUnterminated = true; + tokenIsUnterminated = true; error(Diagnostics.Unterminated_string_literal); break; } @@ -597,7 +597,7 @@ module ts { while (true) { if (pos >= len) { contents += text.substring(start, pos); - tokenUnterminated = true; + tokenIsUnterminated = true; error(Diagnostics.Unterminated_template_literal); resultingToken = startedWithBacktick ? SyntaxKind.NoSubstitutionTemplateLiteral : SyntaxKind.TemplateTail; break; @@ -761,7 +761,7 @@ module ts { function scan(): SyntaxKind { startPos = pos; precedingLineBreak = false; - tokenUnterminated = false; + tokenIsUnterminated = false; while (true) { tokenPos = pos; if (pos >= len) { @@ -918,7 +918,7 @@ module ts { continue; } else { - tokenUnterminated = !commentClosed; + tokenIsUnterminated = !commentClosed; return token = SyntaxKind.MultiLineCommentTrivia; } } @@ -1076,14 +1076,14 @@ module ts { // If we reach the end of a file, or hit a newline, then this is an unterminated // regex. Report error and return what we have so far. if (p >= len) { - tokenUnterminated = true; + tokenIsUnterminated = true; error(Diagnostics.Unterminated_regular_expression_literal) break; } var ch = text.charCodeAt(p); if (isLineBreak(ch)) { - tokenUnterminated = true; + tokenIsUnterminated = true; error(Diagnostics.Unterminated_regular_expression_literal) break; } @@ -1176,7 +1176,7 @@ module ts { hasPrecedingLineBreak: () => precedingLineBreak, isIdentifier: () => token === SyntaxKind.Identifier || token > SyntaxKind.LastReservedWord, isReservedWord: () => token >= SyntaxKind.FirstReservedWord && token <= SyntaxKind.LastReservedWord, - isUnterminated: () => tokenUnterminated, + isUnterminated: () => tokenIsUnterminated, reScanGreaterToken, reScanSlashToken, reScanTemplateToken, From cef50627919cd43775e5ba542ae64b71d172f9a9 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 26 Nov 2014 16:32:30 -0800 Subject: [PATCH 3/5] Fixed issue where classifier didn't check for backslash-newline. --- src/services/services.ts | 19 ++++-- .../completionListInStringLiterals1.ts | 10 ++++ .../completionListInStringLiterals2.ts | 11 ++++ ...signatureHelpTaggedTemplatesIncomplete7.ts | 21 +++++++ ...signatureHelpTaggedTemplatesIncomplete8.ts | 18 ++++++ ...signatureHelpTaggedTemplatesIncomplete9.ts | 18 ++++++ .../cases/unittests/services/colorization.ts | 60 ++++++++++++++++++- 7 files changed, 150 insertions(+), 7 deletions(-) create mode 100644 tests/cases/fourslash/completionListInStringLiterals1.ts create mode 100644 tests/cases/fourslash/completionListInStringLiterals2.ts create mode 100644 tests/cases/fourslash/signatureHelpTaggedTemplatesIncomplete7.ts create mode 100644 tests/cases/fourslash/signatureHelpTaggedTemplatesIncomplete8.ts create mode 100644 tests/cases/fourslash/signatureHelpTaggedTemplatesIncomplete9.ts diff --git a/src/services/services.ts b/src/services/services.ts index 8ff61b05a7a..68177066b86 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -5549,15 +5549,24 @@ module ts { addResult(end - start, classFromKind(token)); if (end >= text.length) { - // We're at the end. if (token === SyntaxKind.StringLiteral) { // Check to see if we finished up on a multiline string literal. var tokenText = scanner.getTokenText(); if (scanner.isUnterminated()) { - var quoteChar = tokenText.charCodeAt(0); - result.finalLexState = quoteChar === CharacterCodes.doubleQuote - ? EndOfLineState.InDoubleQuoteStringLiteral - : EndOfLineState.InSingleQuoteStringLiteral; + var lastCharIndex = tokenText.length - 1; + + var numBackslashes = 0; + while (tokenText.charCodeAt(lastCharIndex - numBackslashes) === CharacterCodes.backslash) { + numBackslashes++; + } + + // If we have an odd number of backslashes, then the multiline string is unclosed + if (numBackslashes & 1) { + var quoteChar = tokenText.charCodeAt(0); + result.finalLexState = quoteChar === CharacterCodes.doubleQuote + ? EndOfLineState.InDoubleQuoteStringLiteral + : EndOfLineState.InSingleQuoteStringLiteral; + } } } else if (token === SyntaxKind.MultiLineCommentTrivia) { diff --git a/tests/cases/fourslash/completionListInStringLiterals1.ts b/tests/cases/fourslash/completionListInStringLiterals1.ts new file mode 100644 index 00000000000..e394e8dfe7c --- /dev/null +++ b/tests/cases/fourslash/completionListInStringLiterals1.ts @@ -0,0 +1,10 @@ +/// + +////"/*1*/ /*2*/\/*3*/ +//// /*4*/ \\/*5*/ + +test.markers().forEach(marker => { + goTo.position(marker.position); + + verify.completionListIsEmpty() +}); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListInStringLiterals2.ts b/tests/cases/fourslash/completionListInStringLiterals2.ts new file mode 100644 index 00000000000..10cb05a4f91 --- /dev/null +++ b/tests/cases/fourslash/completionListInStringLiterals2.ts @@ -0,0 +1,11 @@ +/// + +////"/*1*/ /*2*/\/*3*/ +//// /*4*/ \\\/*5*/ +//// /*6*/ + +test.markers().forEach(marker => { + goTo.position(marker.position); + + verify.completionListIsEmpty() +}); \ No newline at end of file diff --git a/tests/cases/fourslash/signatureHelpTaggedTemplatesIncomplete7.ts b/tests/cases/fourslash/signatureHelpTaggedTemplatesIncomplete7.ts new file mode 100644 index 00000000000..ae322acf0b8 --- /dev/null +++ b/tests/cases/fourslash/signatureHelpTaggedTemplatesIncomplete7.ts @@ -0,0 +1,21 @@ +/// + +//// function f(templateStrings, x, y, z) { return 10; } +//// function g(templateStrings, x, y, z) { return ""; } +//// +//// f ` ${ 123 } /*1*/${ } /*2*/\/*3*/ +//// /*4*/\\/*5*/ +//// /*6*/\\\/*7*/ +//// /*8*/ + +test.markers().forEach(m => { + goTo.position(m.position); + + verify.signatureHelpCountIs(1); + verify.signatureHelpArgumentCountIs(1); + + verify.currentSignatureParameterCountIs(4); + verify.currentSignatureHelpIs('f(templateStrings: any, x: any, y: any, z: any): number'); + verify.currentParameterHelpArgumentNameIs("templateStrings"); + verify.currentParameterSpanIs("templateStrings: any"); +}); \ No newline at end of file diff --git a/tests/cases/fourslash/signatureHelpTaggedTemplatesIncomplete8.ts b/tests/cases/fourslash/signatureHelpTaggedTemplatesIncomplete8.ts new file mode 100644 index 00000000000..86455a65ccd --- /dev/null +++ b/tests/cases/fourslash/signatureHelpTaggedTemplatesIncomplete8.ts @@ -0,0 +1,18 @@ +/// + +//// function f(templateStrings, x, y, z) { return 10; } +//// function g(templateStrings, x, y, z) { return ""; } +//// +//// f `/*1*/\/*2*/`/*3*/ /*4*/ + +test.markers().forEach(m => { + goTo.position(m.position); + + verify.signatureHelpCountIs(1); + verify.signatureHelpArgumentCountIs(1); + + verify.currentSignatureParameterCountIs(4); + verify.currentSignatureHelpIs('f(templateStrings: any, x: any, y: any, z: any): number'); + verify.currentParameterHelpArgumentNameIs("templateStrings"); + verify.currentParameterSpanIs("templateStrings: any"); +}); \ No newline at end of file diff --git a/tests/cases/fourslash/signatureHelpTaggedTemplatesIncomplete9.ts b/tests/cases/fourslash/signatureHelpTaggedTemplatesIncomplete9.ts new file mode 100644 index 00000000000..de42a33b397 --- /dev/null +++ b/tests/cases/fourslash/signatureHelpTaggedTemplatesIncomplete9.ts @@ -0,0 +1,18 @@ +/// + +//// function f(templateStrings, x, y, z) { return 10; } +//// function g(templateStrings, x, y, z) { return ""; } +//// +//// f `/*1*/ \\\/*2*/`/*3*/ /*4*/ + +test.markers().forEach(m => { + goTo.position(m.position); + + verify.signatureHelpCountIs(1); + verify.signatureHelpArgumentCountIs(1); + + verify.currentSignatureParameterCountIs(4); + verify.currentSignatureHelpIs('f(templateStrings: any, x: any, y: any, z: any): number'); + verify.currentParameterHelpArgumentNameIs("templateStrings"); + verify.currentParameterSpanIs("templateStrings: any"); +}); \ No newline at end of file diff --git a/tests/cases/unittests/services/colorization.ts b/tests/cases/unittests/services/colorization.ts index 3031cefb56c..b29f119f944 100644 --- a/tests/cases/unittests/services/colorization.ts +++ b/tests/cases/unittests/services/colorization.ts @@ -130,20 +130,76 @@ describe('Colorization', function () { operator(",")); }); - it("correctly classifies an unterminated multi-line string", function () { + it("correctly classifies a multi-line string with one backslash", function () { test("'line1\\", ts.EndOfLineState.Start, stringLiteral("'line1\\"), finalEndOfLineState(ts.EndOfLineState.InSingleQuoteStringLiteral)); }); - it("correctly classifies the second line of an unterminated multi-line string", function () { + it("correctly classifies a multi-line string with three backslashes", function () { + test("'line1\\\\\\", + ts.EndOfLineState.Start, + stringLiteral("'line1\\\\\\"), + finalEndOfLineState(ts.EndOfLineState.InSingleQuoteStringLiteral)); + }); + + it("correctly classifies an unterminated single-line string with no backslashes", function () { + test("'line1", + ts.EndOfLineState.Start, + stringLiteral("'line1"), + finalEndOfLineState(ts.EndOfLineState.Start)); + }); + + it("correctly classifies an unterminated single-line string with two backslashes", function () { + test("'line1\\\\", + ts.EndOfLineState.Start, + stringLiteral("'line1\\\\"), + finalEndOfLineState(ts.EndOfLineState.Start)); + }); + + it("correctly classifies an unterminated single-line string with four backslashes", function () { + test("'line1\\\\\\\\", + ts.EndOfLineState.Start, + stringLiteral("'line1\\\\\\\\"), + finalEndOfLineState(ts.EndOfLineState.Start)); + }); + + it("correctly classifies the continuing line of a multi-line string ending in one backslash", function () { test("\\", ts.EndOfLineState.InDoubleQuoteStringLiteral, stringLiteral("\\"), finalEndOfLineState(ts.EndOfLineState.InDoubleQuoteStringLiteral)); }); + it("correctly classifies the continuing line of a multi-line string ending in three backslashes", function () { + test("\\", + ts.EndOfLineState.InDoubleQuoteStringLiteral, + stringLiteral("\\"), + finalEndOfLineState(ts.EndOfLineState.InDoubleQuoteStringLiteral)); + }); + + it("correctly classifies the last line of an unterminated multi-line string ending in no backslashes", function () { + test(" ", + ts.EndOfLineState.InDoubleQuoteStringLiteral, + stringLiteral(" "), + finalEndOfLineState(ts.EndOfLineState.Start)); + }); + + it("correctly classifies the last line of an unterminated multi-line string ending in two backslashes", function () { + test("\\\\", + ts.EndOfLineState.InDoubleQuoteStringLiteral, + stringLiteral("\\\\"), + finalEndOfLineState(ts.EndOfLineState.Start)); + }); + + it("correctly classifies the last line of an unterminated multi-line string ending in four backslashes", function () { + test("\\\\\\\\", + ts.EndOfLineState.InDoubleQuoteStringLiteral, + stringLiteral("\\\\\\\\"), + finalEndOfLineState(ts.EndOfLineState.Start)); + }); + it("correctly classifies the last line of a multi-line string", function () { test("'", ts.EndOfLineState.InSingleQuoteStringLiteral, From 0c348d28d54fecce630bf73def64e961f03b266d Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 26 Nov 2014 17:00:44 -0800 Subject: [PATCH 4/5] Confused count with index. --- .../cases/fourslash/signatureHelpTaggedTemplatesIncomplete7.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cases/fourslash/signatureHelpTaggedTemplatesIncomplete7.ts b/tests/cases/fourslash/signatureHelpTaggedTemplatesIncomplete7.ts index ae322acf0b8..a8afe2d9c6d 100644 --- a/tests/cases/fourslash/signatureHelpTaggedTemplatesIncomplete7.ts +++ b/tests/cases/fourslash/signatureHelpTaggedTemplatesIncomplete7.ts @@ -12,7 +12,7 @@ test.markers().forEach(m => { goTo.position(m.position); verify.signatureHelpCountIs(1); - verify.signatureHelpArgumentCountIs(1); + verify.signatureHelpArgumentCountIs(3); verify.currentSignatureParameterCountIs(4); verify.currentSignatureHelpIs('f(templateStrings: any, x: any, y: any, z: any): number'); From ae384470a4ba370e068a356cd65e4195e99d296f Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 26 Nov 2014 17:14:08 -0800 Subject: [PATCH 5/5] Tests for terminated/unterminated template strings. --- tests/baselines/reference/templateStringTermination1.js | 6 ++++++ .../baselines/reference/templateStringTermination1.types | 4 ++++ .../baselines/reference/templateStringTermination1_ES6.js | 5 +++++ .../reference/templateStringTermination1_ES6.types | 3 +++ tests/baselines/reference/templateStringTermination2.js | 6 ++++++ .../baselines/reference/templateStringTermination2.types | 4 ++++ .../baselines/reference/templateStringTermination2_ES6.js | 5 +++++ .../reference/templateStringTermination2_ES6.types | 3 +++ tests/baselines/reference/templateStringTermination3.js | 6 ++++++ .../baselines/reference/templateStringTermination3.types | 4 ++++ .../baselines/reference/templateStringTermination3_ES6.js | 5 +++++ .../reference/templateStringTermination3_ES6.types | 3 +++ tests/baselines/reference/templateStringTermination4.js | 6 ++++++ .../baselines/reference/templateStringTermination4.types | 4 ++++ .../baselines/reference/templateStringTermination4_ES6.js | 5 +++++ .../reference/templateStringTermination4_ES6.types | 3 +++ tests/baselines/reference/templateStringTermination5.js | 6 ++++++ .../baselines/reference/templateStringTermination5.types | 4 ++++ .../baselines/reference/templateStringTermination5_ES6.js | 5 +++++ .../reference/templateStringTermination5_ES6.types | 3 +++ .../reference/templateStringUnterminated1.errors.txt | 8 ++++++++ .../reference/templateStringUnterminated1_ES6.errors.txt | 7 +++++++ .../reference/templateStringUnterminated2.errors.txt | 8 ++++++++ .../reference/templateStringUnterminated2_ES6.errors.txt | 7 +++++++ .../reference/templateStringUnterminated3.errors.txt | 8 ++++++++ .../reference/templateStringUnterminated3_ES6.errors.txt | 7 +++++++ .../reference/templateStringUnterminated4.errors.txt | 8 ++++++++ .../reference/templateStringUnterminated4_ES6.errors.txt | 7 +++++++ .../reference/templateStringUnterminated5.errors.txt | 8 ++++++++ .../reference/templateStringUnterminated5_ES6.errors.txt | 7 +++++++ .../es6/templates/templateStringTermination1.ts | 2 ++ .../es6/templates/templateStringTermination1_ES6.ts | 2 ++ .../es6/templates/templateStringTermination2.ts | 2 ++ .../es6/templates/templateStringTermination2_ES6.ts | 2 ++ .../es6/templates/templateStringTermination3.ts | 2 ++ .../es6/templates/templateStringTermination3_ES6.ts | 2 ++ .../es6/templates/templateStringTermination4.ts | 2 ++ .../es6/templates/templateStringTermination4_ES6.ts | 2 ++ .../es6/templates/templateStringTermination5.ts | 2 ++ .../es6/templates/templateStringTermination5_ES6.ts | 2 ++ .../es6/templates/templateStringUnterminated1.ts | 2 ++ .../es6/templates/templateStringUnterminated1_ES6.ts | 2 ++ .../es6/templates/templateStringUnterminated2.ts | 2 ++ .../es6/templates/templateStringUnterminated2_ES6.ts | 2 ++ .../es6/templates/templateStringUnterminated3.ts | 2 ++ .../es6/templates/templateStringUnterminated3_ES6.ts | 2 ++ .../es6/templates/templateStringUnterminated4.ts | 2 ++ .../es6/templates/templateStringUnterminated4_ES6.ts | 2 ++ .../es6/templates/templateStringUnterminated5.ts | 2 ++ .../es6/templates/templateStringUnterminated5_ES6.ts | 2 ++ 50 files changed, 205 insertions(+) create mode 100644 tests/baselines/reference/templateStringTermination1.js create mode 100644 tests/baselines/reference/templateStringTermination1.types create mode 100644 tests/baselines/reference/templateStringTermination1_ES6.js create mode 100644 tests/baselines/reference/templateStringTermination1_ES6.types create mode 100644 tests/baselines/reference/templateStringTermination2.js create mode 100644 tests/baselines/reference/templateStringTermination2.types create mode 100644 tests/baselines/reference/templateStringTermination2_ES6.js create mode 100644 tests/baselines/reference/templateStringTermination2_ES6.types create mode 100644 tests/baselines/reference/templateStringTermination3.js create mode 100644 tests/baselines/reference/templateStringTermination3.types create mode 100644 tests/baselines/reference/templateStringTermination3_ES6.js create mode 100644 tests/baselines/reference/templateStringTermination3_ES6.types create mode 100644 tests/baselines/reference/templateStringTermination4.js create mode 100644 tests/baselines/reference/templateStringTermination4.types create mode 100644 tests/baselines/reference/templateStringTermination4_ES6.js create mode 100644 tests/baselines/reference/templateStringTermination4_ES6.types create mode 100644 tests/baselines/reference/templateStringTermination5.js create mode 100644 tests/baselines/reference/templateStringTermination5.types create mode 100644 tests/baselines/reference/templateStringTermination5_ES6.js create mode 100644 tests/baselines/reference/templateStringTermination5_ES6.types create mode 100644 tests/baselines/reference/templateStringUnterminated1.errors.txt create mode 100644 tests/baselines/reference/templateStringUnterminated1_ES6.errors.txt create mode 100644 tests/baselines/reference/templateStringUnterminated2.errors.txt create mode 100644 tests/baselines/reference/templateStringUnterminated2_ES6.errors.txt create mode 100644 tests/baselines/reference/templateStringUnterminated3.errors.txt create mode 100644 tests/baselines/reference/templateStringUnterminated3_ES6.errors.txt create mode 100644 tests/baselines/reference/templateStringUnterminated4.errors.txt create mode 100644 tests/baselines/reference/templateStringUnterminated4_ES6.errors.txt create mode 100644 tests/baselines/reference/templateStringUnterminated5.errors.txt create mode 100644 tests/baselines/reference/templateStringUnterminated5_ES6.errors.txt create mode 100644 tests/cases/conformance/es6/templates/templateStringTermination1.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringTermination1_ES6.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringTermination2.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringTermination2_ES6.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringTermination3.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringTermination3_ES6.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringTermination4.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringTermination4_ES6.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringTermination5.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringTermination5_ES6.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringUnterminated1.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringUnterminated1_ES6.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringUnterminated2.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringUnterminated2_ES6.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringUnterminated3.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringUnterminated3_ES6.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringUnterminated4.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringUnterminated4_ES6.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringUnterminated5.ts create mode 100644 tests/cases/conformance/es6/templates/templateStringUnterminated5_ES6.ts diff --git a/tests/baselines/reference/templateStringTermination1.js b/tests/baselines/reference/templateStringTermination1.js new file mode 100644 index 00000000000..2243871f9ae --- /dev/null +++ b/tests/baselines/reference/templateStringTermination1.js @@ -0,0 +1,6 @@ +//// [templateStringTermination1.ts] + +`` + +//// [templateStringTermination1.js] +""; diff --git a/tests/baselines/reference/templateStringTermination1.types b/tests/baselines/reference/templateStringTermination1.types new file mode 100644 index 00000000000..5c3cf73af45 --- /dev/null +++ b/tests/baselines/reference/templateStringTermination1.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/es6/templates/templateStringTermination1.ts === + +No type information for this code.`` +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringTermination1_ES6.js b/tests/baselines/reference/templateStringTermination1_ES6.js new file mode 100644 index 00000000000..4d4dc6a2d9c --- /dev/null +++ b/tests/baselines/reference/templateStringTermination1_ES6.js @@ -0,0 +1,5 @@ +//// [templateStringTermination1_ES6.ts] +`` + +//// [templateStringTermination1_ES6.js] +``; diff --git a/tests/baselines/reference/templateStringTermination1_ES6.types b/tests/baselines/reference/templateStringTermination1_ES6.types new file mode 100644 index 00000000000..b0829b31b67 --- /dev/null +++ b/tests/baselines/reference/templateStringTermination1_ES6.types @@ -0,0 +1,3 @@ +=== tests/cases/conformance/es6/templates/templateStringTermination1_ES6.ts === +`` +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringTermination2.js b/tests/baselines/reference/templateStringTermination2.js new file mode 100644 index 00000000000..de7792482ee --- /dev/null +++ b/tests/baselines/reference/templateStringTermination2.js @@ -0,0 +1,6 @@ +//// [templateStringTermination2.ts] + +`\\` + +//// [templateStringTermination2.js] +"\"; diff --git a/tests/baselines/reference/templateStringTermination2.types b/tests/baselines/reference/templateStringTermination2.types new file mode 100644 index 00000000000..927f257c21f --- /dev/null +++ b/tests/baselines/reference/templateStringTermination2.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/es6/templates/templateStringTermination2.ts === + +No type information for this code.`\\` +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringTermination2_ES6.js b/tests/baselines/reference/templateStringTermination2_ES6.js new file mode 100644 index 00000000000..b2a8459968f --- /dev/null +++ b/tests/baselines/reference/templateStringTermination2_ES6.js @@ -0,0 +1,5 @@ +//// [templateStringTermination2_ES6.ts] +`\\` + +//// [templateStringTermination2_ES6.js] +`\\`; diff --git a/tests/baselines/reference/templateStringTermination2_ES6.types b/tests/baselines/reference/templateStringTermination2_ES6.types new file mode 100644 index 00000000000..21bc0e07a23 --- /dev/null +++ b/tests/baselines/reference/templateStringTermination2_ES6.types @@ -0,0 +1,3 @@ +=== tests/cases/conformance/es6/templates/templateStringTermination2_ES6.ts === +`\\` +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringTermination3.js b/tests/baselines/reference/templateStringTermination3.js new file mode 100644 index 00000000000..1bb2c2ab007 --- /dev/null +++ b/tests/baselines/reference/templateStringTermination3.js @@ -0,0 +1,6 @@ +//// [templateStringTermination3.ts] + +`\`` + +//// [templateStringTermination3.js] +"`"; diff --git a/tests/baselines/reference/templateStringTermination3.types b/tests/baselines/reference/templateStringTermination3.types new file mode 100644 index 00000000000..a59aef6bfea --- /dev/null +++ b/tests/baselines/reference/templateStringTermination3.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/es6/templates/templateStringTermination3.ts === + +No type information for this code.`\`` +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringTermination3_ES6.js b/tests/baselines/reference/templateStringTermination3_ES6.js new file mode 100644 index 00000000000..5c632fe83b3 --- /dev/null +++ b/tests/baselines/reference/templateStringTermination3_ES6.js @@ -0,0 +1,5 @@ +//// [templateStringTermination3_ES6.ts] +`\`` + +//// [templateStringTermination3_ES6.js] +`\``; diff --git a/tests/baselines/reference/templateStringTermination3_ES6.types b/tests/baselines/reference/templateStringTermination3_ES6.types new file mode 100644 index 00000000000..8d0119ee5c7 --- /dev/null +++ b/tests/baselines/reference/templateStringTermination3_ES6.types @@ -0,0 +1,3 @@ +=== tests/cases/conformance/es6/templates/templateStringTermination3_ES6.ts === +`\`` +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringTermination4.js b/tests/baselines/reference/templateStringTermination4.js new file mode 100644 index 00000000000..7ef49703665 --- /dev/null +++ b/tests/baselines/reference/templateStringTermination4.js @@ -0,0 +1,6 @@ +//// [templateStringTermination4.ts] + +`\\\\` + +//// [templateStringTermination4.js] +"\\"; diff --git a/tests/baselines/reference/templateStringTermination4.types b/tests/baselines/reference/templateStringTermination4.types new file mode 100644 index 00000000000..ecf2ad9749f --- /dev/null +++ b/tests/baselines/reference/templateStringTermination4.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/es6/templates/templateStringTermination4.ts === + +No type information for this code.`\\\\` +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringTermination4_ES6.js b/tests/baselines/reference/templateStringTermination4_ES6.js new file mode 100644 index 00000000000..c177f863793 --- /dev/null +++ b/tests/baselines/reference/templateStringTermination4_ES6.js @@ -0,0 +1,5 @@ +//// [templateStringTermination4_ES6.ts] +`\\\\` + +//// [templateStringTermination4_ES6.js] +`\\\\`; diff --git a/tests/baselines/reference/templateStringTermination4_ES6.types b/tests/baselines/reference/templateStringTermination4_ES6.types new file mode 100644 index 00000000000..18f5d6f7bd7 --- /dev/null +++ b/tests/baselines/reference/templateStringTermination4_ES6.types @@ -0,0 +1,3 @@ +=== tests/cases/conformance/es6/templates/templateStringTermination4_ES6.ts === +`\\\\` +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringTermination5.js b/tests/baselines/reference/templateStringTermination5.js new file mode 100644 index 00000000000..af7f1d6a0a6 --- /dev/null +++ b/tests/baselines/reference/templateStringTermination5.js @@ -0,0 +1,6 @@ +//// [templateStringTermination5.ts] + +`\\\\\\` + +//// [templateStringTermination5.js] +"\\\"; diff --git a/tests/baselines/reference/templateStringTermination5.types b/tests/baselines/reference/templateStringTermination5.types new file mode 100644 index 00000000000..8ae94a18038 --- /dev/null +++ b/tests/baselines/reference/templateStringTermination5.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/es6/templates/templateStringTermination5.ts === + +No type information for this code.`\\\\\\` +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringTermination5_ES6.js b/tests/baselines/reference/templateStringTermination5_ES6.js new file mode 100644 index 00000000000..120b72970ae --- /dev/null +++ b/tests/baselines/reference/templateStringTermination5_ES6.js @@ -0,0 +1,5 @@ +//// [templateStringTermination5_ES6.ts] +`\\\\\\` + +//// [templateStringTermination5_ES6.js] +`\\\\\\`; diff --git a/tests/baselines/reference/templateStringTermination5_ES6.types b/tests/baselines/reference/templateStringTermination5_ES6.types new file mode 100644 index 00000000000..c687c51df9f --- /dev/null +++ b/tests/baselines/reference/templateStringTermination5_ES6.types @@ -0,0 +1,3 @@ +=== tests/cases/conformance/es6/templates/templateStringTermination5_ES6.ts === +`\\\\\\` +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringUnterminated1.errors.txt b/tests/baselines/reference/templateStringUnterminated1.errors.txt new file mode 100644 index 00000000000..3353c062448 --- /dev/null +++ b/tests/baselines/reference/templateStringUnterminated1.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/es6/templates/templateStringUnterminated1.ts(2,2): error TS1160: Unterminated template literal. + + +==== tests/cases/conformance/es6/templates/templateStringUnterminated1.ts (1 errors) ==== + + ` + +!!! error TS1160: Unterminated template literal. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringUnterminated1_ES6.errors.txt b/tests/baselines/reference/templateStringUnterminated1_ES6.errors.txt new file mode 100644 index 00000000000..3d55b8aa1ef --- /dev/null +++ b/tests/baselines/reference/templateStringUnterminated1_ES6.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/templates/templateStringUnterminated1_ES6.ts(1,2): error TS1160: Unterminated template literal. + + +==== tests/cases/conformance/es6/templates/templateStringUnterminated1_ES6.ts (1 errors) ==== + ` + +!!! error TS1160: Unterminated template literal. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringUnterminated2.errors.txt b/tests/baselines/reference/templateStringUnterminated2.errors.txt new file mode 100644 index 00000000000..0fd78e097b0 --- /dev/null +++ b/tests/baselines/reference/templateStringUnterminated2.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/es6/templates/templateStringUnterminated2.ts(2,4): error TS1160: Unterminated template literal. + + +==== tests/cases/conformance/es6/templates/templateStringUnterminated2.ts (1 errors) ==== + + `\` + +!!! error TS1160: Unterminated template literal. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringUnterminated2_ES6.errors.txt b/tests/baselines/reference/templateStringUnterminated2_ES6.errors.txt new file mode 100644 index 00000000000..7a5bd9a7789 --- /dev/null +++ b/tests/baselines/reference/templateStringUnterminated2_ES6.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/templates/templateStringUnterminated2_ES6.ts(1,4): error TS1160: Unterminated template literal. + + +==== tests/cases/conformance/es6/templates/templateStringUnterminated2_ES6.ts (1 errors) ==== + `\` + +!!! error TS1160: Unterminated template literal. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringUnterminated3.errors.txt b/tests/baselines/reference/templateStringUnterminated3.errors.txt new file mode 100644 index 00000000000..1b25de284da --- /dev/null +++ b/tests/baselines/reference/templateStringUnterminated3.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/es6/templates/templateStringUnterminated3.ts(2,4): error TS1160: Unterminated template literal. + + +==== tests/cases/conformance/es6/templates/templateStringUnterminated3.ts (1 errors) ==== + + `\\ + +!!! error TS1160: Unterminated template literal. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringUnterminated3_ES6.errors.txt b/tests/baselines/reference/templateStringUnterminated3_ES6.errors.txt new file mode 100644 index 00000000000..e41c0e93622 --- /dev/null +++ b/tests/baselines/reference/templateStringUnterminated3_ES6.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/templates/templateStringUnterminated3_ES6.ts(1,4): error TS1160: Unterminated template literal. + + +==== tests/cases/conformance/es6/templates/templateStringUnterminated3_ES6.ts (1 errors) ==== + `\\ + +!!! error TS1160: Unterminated template literal. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringUnterminated4.errors.txt b/tests/baselines/reference/templateStringUnterminated4.errors.txt new file mode 100644 index 00000000000..8eb41921187 --- /dev/null +++ b/tests/baselines/reference/templateStringUnterminated4.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/es6/templates/templateStringUnterminated4.ts(2,6): error TS1160: Unterminated template literal. + + +==== tests/cases/conformance/es6/templates/templateStringUnterminated4.ts (1 errors) ==== + + `\\\` + +!!! error TS1160: Unterminated template literal. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringUnterminated4_ES6.errors.txt b/tests/baselines/reference/templateStringUnterminated4_ES6.errors.txt new file mode 100644 index 00000000000..a677836b7a4 --- /dev/null +++ b/tests/baselines/reference/templateStringUnterminated4_ES6.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/templates/templateStringUnterminated4_ES6.ts(1,6): error TS1160: Unterminated template literal. + + +==== tests/cases/conformance/es6/templates/templateStringUnterminated4_ES6.ts (1 errors) ==== + `\\\` + +!!! error TS1160: Unterminated template literal. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringUnterminated5.errors.txt b/tests/baselines/reference/templateStringUnterminated5.errors.txt new file mode 100644 index 00000000000..20fd54e8112 --- /dev/null +++ b/tests/baselines/reference/templateStringUnterminated5.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/es6/templates/templateStringUnterminated5.ts(2,8): error TS1160: Unterminated template literal. + + +==== tests/cases/conformance/es6/templates/templateStringUnterminated5.ts (1 errors) ==== + + `\\\\\` + +!!! error TS1160: Unterminated template literal. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringUnterminated5_ES6.errors.txt b/tests/baselines/reference/templateStringUnterminated5_ES6.errors.txt new file mode 100644 index 00000000000..be279696e1d --- /dev/null +++ b/tests/baselines/reference/templateStringUnterminated5_ES6.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/templates/templateStringUnterminated5_ES6.ts(1,8): error TS1160: Unterminated template literal. + + +==== tests/cases/conformance/es6/templates/templateStringUnterminated5_ES6.ts (1 errors) ==== + `\\\\\` + +!!! error TS1160: Unterminated template literal. \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringTermination1.ts b/tests/cases/conformance/es6/templates/templateStringTermination1.ts new file mode 100644 index 00000000000..751a7917073 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringTermination1.ts @@ -0,0 +1,2 @@ + +`` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringTermination1_ES6.ts b/tests/cases/conformance/es6/templates/templateStringTermination1_ES6.ts new file mode 100644 index 00000000000..f6577ea8046 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringTermination1_ES6.ts @@ -0,0 +1,2 @@ +// @target: ES6 +`` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringTermination2.ts b/tests/cases/conformance/es6/templates/templateStringTermination2.ts new file mode 100644 index 00000000000..8125524cac9 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringTermination2.ts @@ -0,0 +1,2 @@ + +`\\` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringTermination2_ES6.ts b/tests/cases/conformance/es6/templates/templateStringTermination2_ES6.ts new file mode 100644 index 00000000000..da00446952b --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringTermination2_ES6.ts @@ -0,0 +1,2 @@ +// @target: ES6 +`\\` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringTermination3.ts b/tests/cases/conformance/es6/templates/templateStringTermination3.ts new file mode 100644 index 00000000000..0e08c4915e3 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringTermination3.ts @@ -0,0 +1,2 @@ + +`\`` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringTermination3_ES6.ts b/tests/cases/conformance/es6/templates/templateStringTermination3_ES6.ts new file mode 100644 index 00000000000..55c4f689a6e --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringTermination3_ES6.ts @@ -0,0 +1,2 @@ +// @target: ES6 +`\`` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringTermination4.ts b/tests/cases/conformance/es6/templates/templateStringTermination4.ts new file mode 100644 index 00000000000..79e622ae6d2 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringTermination4.ts @@ -0,0 +1,2 @@ + +`\\\\` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringTermination4_ES6.ts b/tests/cases/conformance/es6/templates/templateStringTermination4_ES6.ts new file mode 100644 index 00000000000..657d4a6c370 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringTermination4_ES6.ts @@ -0,0 +1,2 @@ +// @target: ES6 +`\\\\` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringTermination5.ts b/tests/cases/conformance/es6/templates/templateStringTermination5.ts new file mode 100644 index 00000000000..f94422a087e --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringTermination5.ts @@ -0,0 +1,2 @@ + +`\\\\\\` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringTermination5_ES6.ts b/tests/cases/conformance/es6/templates/templateStringTermination5_ES6.ts new file mode 100644 index 00000000000..14e66aff84a --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringTermination5_ES6.ts @@ -0,0 +1,2 @@ +// @target: ES6 +`\\\\\\` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringUnterminated1.ts b/tests/cases/conformance/es6/templates/templateStringUnterminated1.ts new file mode 100644 index 00000000000..7165d308229 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringUnterminated1.ts @@ -0,0 +1,2 @@ + +` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringUnterminated1_ES6.ts b/tests/cases/conformance/es6/templates/templateStringUnterminated1_ES6.ts new file mode 100644 index 00000000000..0d96bf6030a --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringUnterminated1_ES6.ts @@ -0,0 +1,2 @@ +// @target: ES6 +` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringUnterminated2.ts b/tests/cases/conformance/es6/templates/templateStringUnterminated2.ts new file mode 100644 index 00000000000..11b2627cada --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringUnterminated2.ts @@ -0,0 +1,2 @@ + +`\` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringUnterminated2_ES6.ts b/tests/cases/conformance/es6/templates/templateStringUnterminated2_ES6.ts new file mode 100644 index 00000000000..6de78a5b15a --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringUnterminated2_ES6.ts @@ -0,0 +1,2 @@ +// @target: ES6 +`\` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringUnterminated3.ts b/tests/cases/conformance/es6/templates/templateStringUnterminated3.ts new file mode 100644 index 00000000000..2f5ae600854 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringUnterminated3.ts @@ -0,0 +1,2 @@ + +`\\ \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringUnterminated3_ES6.ts b/tests/cases/conformance/es6/templates/templateStringUnterminated3_ES6.ts new file mode 100644 index 00000000000..b8430e6a727 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringUnterminated3_ES6.ts @@ -0,0 +1,2 @@ +// @target: ES6 +`\\ \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringUnterminated4.ts b/tests/cases/conformance/es6/templates/templateStringUnterminated4.ts new file mode 100644 index 00000000000..2654b1895c6 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringUnterminated4.ts @@ -0,0 +1,2 @@ + +`\\\` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringUnterminated4_ES6.ts b/tests/cases/conformance/es6/templates/templateStringUnterminated4_ES6.ts new file mode 100644 index 00000000000..4cfc3143c5c --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringUnterminated4_ES6.ts @@ -0,0 +1,2 @@ +// @target: ES6 +`\\\` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringUnterminated5.ts b/tests/cases/conformance/es6/templates/templateStringUnterminated5.ts new file mode 100644 index 00000000000..06574b58523 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringUnterminated5.ts @@ -0,0 +1,2 @@ + +`\\\\\` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringUnterminated5_ES6.ts b/tests/cases/conformance/es6/templates/templateStringUnterminated5_ES6.ts new file mode 100644 index 00000000000..6beeb157278 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringUnterminated5_ES6.ts @@ -0,0 +1,2 @@ +// @target: ES6 +`\\\\\` \ No newline at end of file