From 33fbce1ff76c8c1577f424263fb91fd22f1e1271 Mon Sep 17 00:00:00 2001 From: SaschaNaz Date: Sat, 12 Sep 2015 17:05:12 +0900 Subject: [PATCH 01/28] nodeWillIndentChild from #4609 --- src/services/formatting/formatting.ts | 36 +++++++----------------- src/services/formatting/smartIndenter.ts | 36 +++++++++++++++++------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index fad3ebe6e2b..868683bb6af 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -282,19 +282,19 @@ namespace ts.formatting { */ function getOwnOrInheritedDelta(n: Node, options: FormatCodeOptions, sourceFile: SourceFile): number { let previousLine = Constants.Unknown; - let childKind = SyntaxKind.Unknown; + let child: Node = null; while (n) { let line = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)).line; if (previousLine !== Constants.Unknown && line !== previousLine) { break; } - if (SmartIndenter.shouldIndentChildNode(n.kind, childKind)) { + if (SmartIndenter.shouldIndentChildNode(n, child)) { return options.IndentSize; } previousLine = line; - childKind = n.kind; + child = n; n = n.parent; } return 0; @@ -387,33 +387,17 @@ namespace ts.formatting { let indentation = inheritedIndentation; if (indentation === Constants.Unknown) { - if (isSomeBlock(node.kind)) { - // blocks should be indented in - // - other blocks - // - source file - // - switch\default clauses - if (isSomeBlock(parent.kind) || - parent.kind === SyntaxKind.SourceFile || - parent.kind === SyntaxKind.CaseClause || - parent.kind === SyntaxKind.DefaultClause) { + if (SmartIndenter.shouldInheritParentIndentation(parent, node) || + SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement(parent, node, startLine, sourceFile)) { - indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); - } - else { - indentation = parentDynamicIndentation.getIndentation(); - } + indentation = parentDynamicIndentation.getIndentation(); } else { - if (SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement(parent, node, startLine, sourceFile)) { - indentation = parentDynamicIndentation.getIndentation(); - } - else { - indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); - } + indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); } } - var delta = SmartIndenter.shouldIndentChildNode(node.kind, SyntaxKind.Unknown) ? options.IndentSize : 0; + var delta = SmartIndenter.shouldIndentChildNode(node, null) ? options.IndentSize : 0; if (effectiveParentStartLine === startLine) { // if node is located on the same line with the parent @@ -495,7 +479,7 @@ namespace ts.formatting { getIndentation: () => indentation, getDelta: () => delta, recomputeIndentation: lineAdded => { - if (node.parent && SmartIndenter.shouldIndentChildNode(node.parent.kind, node.kind)) { + if (node.parent && SmartIndenter.shouldIndentChildNode(node.parent, node)) { if (lineAdded) { indentation += options.IndentSize; } @@ -503,7 +487,7 @@ namespace ts.formatting { indentation -= options.IndentSize; } - if (SmartIndenter.shouldIndentChildNode(node.kind, SyntaxKind.Unknown)) { + if (SmartIndenter.shouldIndentChildNode(node, null)) { delta = options.IndentSize; } else { diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index 8355fac03f5..ab23f3da939 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -48,7 +48,7 @@ namespace ts.formatting { let indentationDelta: number; while (current) { - if (positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current.kind, previous ? previous.kind : SyntaxKind.Unknown)) { + if (positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current, previous)) { currentStart = getStartLineAndCharacterForNode(current, sourceFile); if (nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile)) { @@ -133,7 +133,7 @@ namespace ts.formatting { } // increase indentation if parent node wants its content to be indented and parent and child nodes don't start on the same line - if (shouldIndentChildNode(parent.kind, current.kind) && !parentAndChildShareLine) { + if (shouldIndentChildNode(parent, current) && !parentAndChildShareLine) { indentationDelta += options.IndentSize; } @@ -446,11 +446,12 @@ namespace ts.formatting { return false; } - export function shouldIndentChildNode(parent: SyntaxKind, child: SyntaxKind): boolean { - if (nodeContentIsAlwaysIndented(parent)) { - return true; - } - switch (parent) { + /** + * Function returns true when a node with conditional indentation rule will indent certain child node. + */ + function nodeWillIndentChild(parent: TextRangeWithKind, child: TextRangeWithKind, indentByDefault: boolean) { + let childKind = child ? child.kind : SyntaxKind.Unknown; + switch (parent.kind) { case SyntaxKind.DoStatement: case SyntaxKind.WhileStatement: case SyntaxKind.ForInStatement: @@ -464,10 +465,25 @@ namespace ts.formatting { case SyntaxKind.Constructor: case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: - return child !== SyntaxKind.Block; - default: - return false; + return childKind !== SyntaxKind.Block; } + // No explicit rule for selected nodes, so result will follow the default value argument. + return indentByDefault; + } + + export function shouldIndentChildNode(parent: TextRangeWithKind, child: TextRangeWithKind): boolean { + if (nodeContentIsAlwaysIndented(parent.kind)) { + return true; + } + return nodeWillIndentChild(parent, child, false); + } + + /** + * Function returns true if a node should not get additional indentation in its parent node. + */ + export function shouldInheritParentIndentation(parent: TextRangeWithKind, child: TextRangeWithKind): boolean { + // Check if + return !nodeWillIndentChild(parent, child, true); } } } \ No newline at end of file From 07fbf8bfd1358a9048c6af3d2742b0decc461ee4 Mon Sep 17 00:00:00 2001 From: SaschaNaz Date: Sat, 12 Sep 2015 17:31:12 +0900 Subject: [PATCH 02/28] Fix some comments --- src/services/formatting/smartIndenter.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index ab23f3da939..4477ea760bb 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -447,7 +447,7 @@ namespace ts.formatting { } /** - * Function returns true when a node with conditional indentation rule will indent certain child node. + * Function returns true when a node with conditional indentation rule will indent certain child node */ function nodeWillIndentChild(parent: TextRangeWithKind, child: TextRangeWithKind, indentByDefault: boolean) { let childKind = child ? child.kind : SyntaxKind.Unknown; @@ -467,7 +467,7 @@ namespace ts.formatting { case SyntaxKind.SetAccessor: return childKind !== SyntaxKind.Block; } - // No explicit rule for selected nodes, so result will follow the default value argument. + // No explicit rule for selected nodes, so result will follow the default value argument return indentByDefault; } @@ -479,10 +479,11 @@ namespace ts.formatting { } /** - * Function returns true if a node should not get additional indentation in its parent node. + * Function returns true if existing node content indentation should be suppressed for a specific child */ export function shouldInheritParentIndentation(parent: TextRangeWithKind, child: TextRangeWithKind): boolean { - // Check if + // Consider parents without indentation rules can indent their children + // so that they can apply inherited delta value to them return !nodeWillIndentChild(parent, child, true); } } From f2329846cbc52074f9eb0affaecae2e406880dd5 Mon Sep 17 00:00:00 2001 From: SaschaNaz Date: Sun, 13 Sep 2015 04:02:18 +0900 Subject: [PATCH 03/28] apply suppression to tokens --- src/services/formatting/formatting.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 868683bb6af..8a713dc032c 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -387,9 +387,7 @@ namespace ts.formatting { let indentation = inheritedIndentation; if (indentation === Constants.Unknown) { - if (SmartIndenter.shouldInheritParentIndentation(parent, node) || - SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement(parent, node, startLine, sourceFile)) { - + if (SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement(parent, node, startLine, sourceFile)) { indentation = parentDynamicIndentation.getIndentation(); } else { @@ -590,6 +588,10 @@ namespace ts.formatting { return inheritedIndentation; } + if (SmartIndenter.shouldInheritParentIndentation(parent, child)) { + parentDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation, 0); + } + if (isToken(child)) { // if child node is a token, it does not impact indentation, proceed it using parent indentation scope rules let tokenInfo = formattingScanner.readTokenInfo(child); From 46c8af10245751fc51880191a559a1ae27706115 Mon Sep 17 00:00:00 2001 From: SaschaNaz Date: Sun, 13 Sep 2015 07:47:16 +0900 Subject: [PATCH 04/28] make getDelta call suppressor --- src/services/formatting/formatting.ts | 35 +++++++++++++++------------ 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 8a713dc032c..5d4938498e4 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -54,7 +54,7 @@ namespace ts.formatting { * so bar inherits indentation from foo and bar.delta will be 4 * */ - getDelta(): number; + getDelta(child: TextRangeWithKind): number; /** * Formatter calls this function when rule adds or deletes new lines from the text * so indentation scope can adjust values of indentation and delta. @@ -386,15 +386,6 @@ namespace ts.formatting { effectiveParentStartLine: number): Indentation { let indentation = inheritedIndentation; - if (indentation === Constants.Unknown) { - if (SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement(parent, node, startLine, sourceFile)) { - indentation = parentDynamicIndentation.getIndentation(); - } - else { - indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); - } - } - var delta = SmartIndenter.shouldIndentChildNode(node, null) ? options.IndentSize : 0; if (effectiveParentStartLine === startLine) { @@ -404,8 +395,17 @@ namespace ts.formatting { indentation = startLine === lastIndentedLine ? indentationOnLastIndentedLine : parentDynamicIndentation.getIndentation(); - delta = Math.min(options.IndentSize, parentDynamicIndentation.getDelta() + delta); + delta = Math.min(options.IndentSize, parentDynamicIndentation.getDelta(node) + delta); } + else if (indentation === Constants.Unknown) { + if (SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement(parent, node, startLine, sourceFile)) { + indentation = parentDynamicIndentation.getIndentation(); + } + else { + indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(node); + } + } + return { indentation, delta @@ -475,7 +475,14 @@ namespace ts.formatting { } }, getIndentation: () => indentation, - getDelta: () => delta, + getDelta: (child: TextRangeWithKind) => { + if (SmartIndenter.shouldInheritParentIndentation(node, child)) { + return 0; + } + else { + return delta; + } + }, recomputeIndentation: lineAdded => { if (node.parent && SmartIndenter.shouldIndentChildNode(node.parent, node)) { if (lineAdded) { @@ -588,10 +595,6 @@ namespace ts.formatting { return inheritedIndentation; } - if (SmartIndenter.shouldInheritParentIndentation(parent, child)) { - parentDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation, 0); - } - if (isToken(child)) { // if child node is a token, it does not impact indentation, proceed it using parent indentation scope rules let tokenInfo = formattingScanner.readTokenInfo(child); From 4d1c067d752cd165ce2b69545629621033b93e4c Mon Sep 17 00:00:00 2001 From: SaschaNaz Date: Sun, 13 Sep 2015 16:01:32 +0900 Subject: [PATCH 05/28] use undefined instead of null --- src/services/formatting/formatting.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 5d4938498e4..eeebfd1649d 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -282,7 +282,7 @@ namespace ts.formatting { */ function getOwnOrInheritedDelta(n: Node, options: FormatCodeOptions, sourceFile: SourceFile): number { let previousLine = Constants.Unknown; - let child: Node = null; + let child: Node; while (n) { let line = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)).line; if (previousLine !== Constants.Unknown && line !== previousLine) { From b2cfddbe7a30c05ebac112af556974fa16913a9e Mon Sep 17 00:00:00 2001 From: SaschaNaz Date: Sun, 13 Sep 2015 23:42:24 +0900 Subject: [PATCH 06/28] re-fix token indentation --- src/services/formatting/formatting.ts | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index eeebfd1649d..9f300f1db7a 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -60,6 +60,11 @@ namespace ts.formatting { * so indentation scope can adjust values of indentation and delta. */ recomputeIndentation(lineAddedByFormatting: boolean): void; + + /** + * Returns DynamicIndentation object that includes modified delta value for specific child node. + */ + getCopyForSpecificChild(child: Node): DynamicIndentation; } interface Indentation { @@ -475,14 +480,7 @@ namespace ts.formatting { } }, getIndentation: () => indentation, - getDelta: (child: TextRangeWithKind) => { - if (SmartIndenter.shouldInheritParentIndentation(node, child)) { - return 0; - } - else { - return delta; - } - }, + getDelta: (child) => (!delta || SmartIndenter.shouldInheritParentIndentation(node, child)) ? 0 : delta, recomputeIndentation: lineAdded => { if (node.parent && SmartIndenter.shouldIndentChildNode(node.parent, node)) { if (lineAdded) { @@ -500,6 +498,13 @@ namespace ts.formatting { } } }, + getCopyForSpecificChild(child) { + if (!delta) { + // delta value is already 0, so do not copy + return this; + } + return getDynamicIndentation(node, nodeStartLine, indentation, (this).getDelta(child)); + } } } @@ -599,7 +604,7 @@ namespace ts.formatting { // if child node is a token, it does not impact indentation, proceed it using parent indentation scope rules let tokenInfo = formattingScanner.readTokenInfo(child); Debug.assert(tokenInfo.token.end === child.end); - consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation.getCopyForSpecificChild(child)); return inheritedIndentation; } From 3dd7caafbfc0bf2cf15d910c27c585cd8237ae8e Mon Sep 17 00:00:00 2001 From: SaschaNaz Date: Tue, 22 Sep 2015 15:07:44 +0900 Subject: [PATCH 07/28] no null --- src/services/formatting/formatting.ts | 4 ++-- src/services/formatting/smartIndenter.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 9f300f1db7a..412daaa8ab0 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -391,7 +391,7 @@ namespace ts.formatting { effectiveParentStartLine: number): Indentation { let indentation = inheritedIndentation; - var delta = SmartIndenter.shouldIndentChildNode(node, null) ? options.IndentSize : 0; + var delta = SmartIndenter.shouldIndentChildNode(node) ? options.IndentSize : 0; if (effectiveParentStartLine === startLine) { // if node is located on the same line with the parent @@ -490,7 +490,7 @@ namespace ts.formatting { indentation -= options.IndentSize; } - if (SmartIndenter.shouldIndentChildNode(node, null)) { + if (SmartIndenter.shouldIndentChildNode(node)) { delta = options.IndentSize; } else { diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index 4477ea760bb..dfe94b3fdbb 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -471,7 +471,7 @@ namespace ts.formatting { return indentByDefault; } - export function shouldIndentChildNode(parent: TextRangeWithKind, child: TextRangeWithKind): boolean { + export function shouldIndentChildNode(parent: TextRangeWithKind, child?: TextRangeWithKind): boolean { if (nodeContentIsAlwaysIndented(parent.kind)) { return true; } From f9e8d9562d91af7a77454b40d60c28162dac9079 Mon Sep 17 00:00:00 2001 From: SaschaNaz Date: Tue, 22 Sep 2015 16:32:24 +0900 Subject: [PATCH 08/28] slight condition change for getDelta --- src/services/formatting/formatting.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 412daaa8ab0..4995fb34b54 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -480,7 +480,7 @@ namespace ts.formatting { } }, getIndentation: () => indentation, - getDelta: (child) => (!delta || SmartIndenter.shouldInheritParentIndentation(node, child)) ? 0 : delta, + getDelta: (child) => (delta && SmartIndenter.shouldInheritParentIndentation(node, child)) ? 0 : delta, recomputeIndentation: lineAdded => { if (node.parent && SmartIndenter.shouldIndentChildNode(node.parent, node)) { if (lineAdded) { From f53f70d79e2ca35f3b653ee90a0b10152931073b Mon Sep 17 00:00:00 2001 From: SaschaNaz Date: Tue, 29 Sep 2015 16:09:07 +0900 Subject: [PATCH 09/28] getEffectiveDelta --- src/services/formatting/formatting.ts | 76 ++++++++++++--------------- 1 file changed, 34 insertions(+), 42 deletions(-) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 4995fb34b54..0bd2a47bb1e 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -31,8 +31,8 @@ namespace ts.formatting { * the first token in line so it should be indented */ interface DynamicIndentation { - getIndentationForToken(tokenLine: number, tokenKind: SyntaxKind): number; - getIndentationForComment(owningToken: SyntaxKind, tokenIndentation: number): number; + getIndentationForToken(tokenLine: number, tokenKind: SyntaxKind, container: Node): number; + getIndentationForComment(owningToken: SyntaxKind, tokenIndentation: number, container: Node): number; /** * Indentation for open and close tokens of the node if it is block or another node that needs special indentation * ... { @@ -60,11 +60,6 @@ namespace ts.formatting { * so indentation scope can adjust values of indentation and delta. */ recomputeIndentation(lineAddedByFormatting: boolean): void; - - /** - * Returns DynamicIndentation object that includes modified delta value for specific child node. - */ - getCopyForSpecificChild(child: Node): DynamicIndentation; } interface Indentation { @@ -330,7 +325,7 @@ namespace ts.formatting { let lastIndentedLine: number; let indentationOnLastIndentedLine: number; - + let edits: TextChange[] = []; formattingScanner.advance(); @@ -359,12 +354,12 @@ namespace ts.formatting { * If list element is in the range - its indentation will be equal * to inherited indentation from its predecessors. */ - function tryComputeIndentationForListItem(startPos: number, - endPos: number, - parentStartLine: number, - range: TextRange, + function tryComputeIndentationForListItem(startPos: number, + endPos: number, + parentStartLine: number, + range: TextRange, inheritedIndentation: number): number { - + if (rangeOverlapsWithStartEnd(range, startPos, endPos)) { if (inheritedIndentation !== Constants.Unknown) { return inheritedIndentation; @@ -381,7 +376,7 @@ namespace ts.formatting { return Constants.Unknown; } - + function computeIndentation( node: TextRangeWithKind, startLine: number, @@ -397,8 +392,8 @@ namespace ts.formatting { // if node is located on the same line with the parent // - inherit indentation from the parent // - push children if either parent of node itself has non-zero delta - indentation = startLine === lastIndentedLine - ? indentationOnLastIndentedLine + indentation = startLine === lastIndentedLine + ? indentationOnLastIndentedLine : parentDynamicIndentation.getIndentation(); delta = Math.min(options.IndentSize, parentDynamicIndentation.getDelta(node) + delta); } @@ -442,7 +437,7 @@ namespace ts.formatting { function getDynamicIndentation(node: Node, nodeStartLine: number, indentation: number, delta: number): DynamicIndentation { return { - getIndentationForComment: (kind, tokenIndentation) => { + getIndentationForComment: (kind, tokenIndentation, container) => { switch (kind) { // preceding comment to the token that closes the indentation scope inherits the indentation from the scope // .. { @@ -451,11 +446,11 @@ namespace ts.formatting { case SyntaxKind.CloseBraceToken: case SyntaxKind.CloseBracketToken: case SyntaxKind.CloseParenToken: - return indentation + delta; + return indentation + getEffectiveDelta(delta, container); } return tokenIndentation !== Constants.Unknown ? tokenIndentation : indentation; }, - getIndentationForToken: (line, kind) => { + getIndentationForToken: (line, kind, container) => { if (nodeStartLine !== line && node.decorators) { if (kind === getFirstNonDecoratorTokenOfNode(node)) { // if this token is the first token following the list of decorators, we do not need to indent @@ -476,11 +471,11 @@ namespace ts.formatting { return indentation; default: // if token line equals to the line of containing node (this is a first token in the node) - use node indentation - return nodeStartLine !== line ? indentation + delta : indentation; + return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation; } }, getIndentation: () => indentation, - getDelta: (child) => (delta && SmartIndenter.shouldInheritParentIndentation(node, child)) ? 0 : delta, + getDelta: (child) => getEffectiveDelta(delta, child), recomputeIndentation: lineAdded => { if (node.parent && SmartIndenter.shouldIndentChildNode(node.parent, node)) { if (lineAdded) { @@ -497,15 +492,12 @@ namespace ts.formatting { delta = 0; } } - }, - getCopyForSpecificChild(child) { - if (!delta) { - // delta value is already 0, so do not copy - return this; - } - return getDynamicIndentation(node, nodeStartLine, indentation, (this).getDelta(child)); } } + + function getEffectiveDelta(delta: number, child: TextRangeWithKind) { + return SmartIndenter.shouldInheritParentIndentation(node, child) ? 0 : delta; + } } function processNode(node: Node, contextNode: Node, nodeStartLine: number, undecoratedNodeStartLine: number, indentation: number, delta: number) { @@ -580,7 +572,7 @@ namespace ts.formatting { if (!rangeOverlapsWithStartEnd(originalRange, child.pos, child.end)) { return inheritedIndentation; } - + if (child.getFullWidth() === 0) { return inheritedIndentation; } @@ -604,7 +596,7 @@ namespace ts.formatting { // if child node is a token, it does not impact indentation, proceed it using parent indentation scope rules let tokenInfo = formattingScanner.readTokenInfo(child); Debug.assert(tokenInfo.token.end === child.end); - consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation.getCopyForSpecificChild(child)); + consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child); return inheritedIndentation; } @@ -618,8 +610,8 @@ namespace ts.formatting { return inheritedIndentation; } - function processChildNodes(nodes: NodeArray, - parent: Node, + function processChildNodes(nodes: NodeArray, + parent: Node, parentStartLine: number, parentDynamicIndentation: DynamicIndentation): void { @@ -673,7 +665,7 @@ namespace ts.formatting { } } - function consumeTokenAndAdvanceScanner(currentTokenInfo: TokenInfo, parent: Node, dynamicIndentation: DynamicIndentation): void { + function consumeTokenAndAdvanceScanner(currentTokenInfo: TokenInfo, parent: Node, dynamicIndentation: DynamicIndentation, container?: Node): void { Debug.assert(rangeContainsRange(parent, currentTokenInfo.token)); let lastTriviaWasNewLine = formattingScanner.lastTrailingTriviaWasNewLine(); @@ -712,11 +704,11 @@ namespace ts.formatting { if (indentToken) { let tokenIndentation = (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) ? - dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind) : + dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind, container) : Constants.Unknown; if (currentTokenInfo.leadingTrivia) { - let commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind, tokenIndentation); + let commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind, tokenIndentation, container); let indentNextTokenOrTrivia = true; for (let triviaItem of currentTokenInfo.leadingTrivia) { @@ -745,7 +737,7 @@ namespace ts.formatting { // indent token only if is it is in target range and does not overlap with any error ranges if (tokenIndentation !== Constants.Unknown) { insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAdded); - + lastIndentedLine = tokenStart.line; indentationOnLastIndentedLine = tokenIndentation; } @@ -766,12 +758,12 @@ namespace ts.formatting { } } - function processRange(range: TextRangeWithKind, - rangeStart: LineAndCharacter, - parent: Node, - contextNode: Node, + function processRange(range: TextRangeWithKind, + rangeStart: LineAndCharacter, + parent: Node, + contextNode: Node, dynamicIndentation: DynamicIndentation): boolean { - + let rangeHasError = rangeContainsError(range); let lineAdded: boolean; if (!rangeHasError && !previousRangeHasError) { @@ -781,7 +773,7 @@ namespace ts.formatting { trimTrailingWhitespacesForLines(originalStart.line, rangeStart.line); } else { - lineAdded = + lineAdded = processPair(range, rangeStart.line, parent, previousRange, previousRangeStartLine, previousParent, contextNode, dynamicIndentation) } } From 9eb85e21731e5516f45b4e00e0fc0127002ad2c6 Mon Sep 17 00:00:00 2001 From: SaschaNaz Date: Tue, 29 Sep 2015 19:50:42 +0900 Subject: [PATCH 10/28] remove parens --- src/services/formatting/formatting.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 0bd2a47bb1e..7d559f99464 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -475,7 +475,7 @@ namespace ts.formatting { } }, getIndentation: () => indentation, - getDelta: (child) => getEffectiveDelta(delta, child), + getDelta: child => getEffectiveDelta(delta, child), recomputeIndentation: lineAdded => { if (node.parent && SmartIndenter.shouldIndentChildNode(node.parent, node)) { if (lineAdded) { From 32b1ad36ecd2018c61fc42d133e1235517543d61 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Sun, 4 Oct 2015 22:00:57 -0700 Subject: [PATCH 11/28] do not emit exportsStar function if module does not expose any values --- src/compiler/checker.ts | 30 ++++++++++- src/compiler/emitter.ts | 38 +++++++------ src/compiler/types.ts | 2 + .../reference/es6ExportEqualsInterop.js | 1 - .../exportDeclarationInInternalModule.js | 2 +- .../reference/exportStarForValues.js | 17 ++++++ .../reference/exportStarForValues.symbols | 11 ++++ .../reference/exportStarForValues.types | 11 ++++ .../reference/exportStarForValues10.js | 52 ++++++++++++++++++ .../reference/exportStarForValues10.symbols | 16 ++++++ .../reference/exportStarForValues10.types | 18 +++++++ .../reference/exportStarForValues2.js | 25 +++++++++ .../reference/exportStarForValues2.symbols | 16 ++++++ .../reference/exportStarForValues2.types | 18 +++++++ .../reference/exportStarForValues3.js | 45 ++++++++++++++++ .../reference/exportStarForValues3.symbols | 39 ++++++++++++++ .../reference/exportStarForValues3.types | 43 +++++++++++++++ .../reference/exportStarForValues4.js | 29 ++++++++++ .../reference/exportStarForValues4.symbols | 25 +++++++++ .../reference/exportStarForValues4.types | 27 ++++++++++ .../reference/exportStarForValues5.js | 16 ++++++ .../reference/exportStarForValues5.symbols | 11 ++++ .../reference/exportStarForValues5.types | 11 ++++ .../reference/exportStarForValues6.js | 28 ++++++++++ .../reference/exportStarForValues6.symbols | 11 ++++ .../reference/exportStarForValues6.types | 12 +++++ .../reference/exportStarForValues7.js | 29 ++++++++++ .../reference/exportStarForValues7.symbols | 16 ++++++ .../reference/exportStarForValues7.types | 18 +++++++ .../reference/exportStarForValues8.js | 54 +++++++++++++++++++ .../reference/exportStarForValues8.symbols | 39 ++++++++++++++ .../reference/exportStarForValues8.types | 43 +++++++++++++++ .../reference/exportStarForValues9.js | 37 +++++++++++++ .../reference/exportStarForValues9.symbols | 25 +++++++++ .../reference/exportStarForValues9.types | 27 ++++++++++ .../reference/exportStarForValuesInSystem.js | 28 ++++++++++ .../exportStarForValuesInSystem.symbols | 11 ++++ .../exportStarForValuesInSystem.types | 12 +++++ .../reference/moduleElementsInWrongContext.js | 1 - .../moduleElementsInWrongContext2.js | 1 - .../moduleElementsInWrongContext3.js | 1 - tests/cases/compiler/exportStarForValues.ts | 8 +++ tests/cases/compiler/exportStarForValues10.ts | 12 +++++ tests/cases/compiler/exportStarForValues2.ts | 12 +++++ tests/cases/compiler/exportStarForValues3.ts | 24 +++++++++ tests/cases/compiler/exportStarForValues4.ts | 15 ++++++ tests/cases/compiler/exportStarForValues5.ts | 8 +++ tests/cases/compiler/exportStarForValues6.ts | 8 +++ tests/cases/compiler/exportStarForValues7.ts | 12 +++++ tests/cases/compiler/exportStarForValues8.ts | 24 +++++++++ tests/cases/compiler/exportStarForValues9.ts | 15 ++++++ .../compiler/exportStarForValuesInSystem.ts | 8 +++ 52 files changed, 1020 insertions(+), 22 deletions(-) create mode 100644 tests/baselines/reference/exportStarForValues.js create mode 100644 tests/baselines/reference/exportStarForValues.symbols create mode 100644 tests/baselines/reference/exportStarForValues.types create mode 100644 tests/baselines/reference/exportStarForValues10.js create mode 100644 tests/baselines/reference/exportStarForValues10.symbols create mode 100644 tests/baselines/reference/exportStarForValues10.types create mode 100644 tests/baselines/reference/exportStarForValues2.js create mode 100644 tests/baselines/reference/exportStarForValues2.symbols create mode 100644 tests/baselines/reference/exportStarForValues2.types create mode 100644 tests/baselines/reference/exportStarForValues3.js create mode 100644 tests/baselines/reference/exportStarForValues3.symbols create mode 100644 tests/baselines/reference/exportStarForValues3.types create mode 100644 tests/baselines/reference/exportStarForValues4.js create mode 100644 tests/baselines/reference/exportStarForValues4.symbols create mode 100644 tests/baselines/reference/exportStarForValues4.types create mode 100644 tests/baselines/reference/exportStarForValues5.js create mode 100644 tests/baselines/reference/exportStarForValues5.symbols create mode 100644 tests/baselines/reference/exportStarForValues5.types create mode 100644 tests/baselines/reference/exportStarForValues6.js create mode 100644 tests/baselines/reference/exportStarForValues6.symbols create mode 100644 tests/baselines/reference/exportStarForValues6.types create mode 100644 tests/baselines/reference/exportStarForValues7.js create mode 100644 tests/baselines/reference/exportStarForValues7.symbols create mode 100644 tests/baselines/reference/exportStarForValues7.types create mode 100644 tests/baselines/reference/exportStarForValues8.js create mode 100644 tests/baselines/reference/exportStarForValues8.symbols create mode 100644 tests/baselines/reference/exportStarForValues8.types create mode 100644 tests/baselines/reference/exportStarForValues9.js create mode 100644 tests/baselines/reference/exportStarForValues9.symbols create mode 100644 tests/baselines/reference/exportStarForValues9.types create mode 100644 tests/baselines/reference/exportStarForValuesInSystem.js create mode 100644 tests/baselines/reference/exportStarForValuesInSystem.symbols create mode 100644 tests/baselines/reference/exportStarForValuesInSystem.types create mode 100644 tests/cases/compiler/exportStarForValues.ts create mode 100644 tests/cases/compiler/exportStarForValues10.ts create mode 100644 tests/cases/compiler/exportStarForValues2.ts create mode 100644 tests/cases/compiler/exportStarForValues3.ts create mode 100644 tests/cases/compiler/exportStarForValues4.ts create mode 100644 tests/cases/compiler/exportStarForValues5.ts create mode 100644 tests/cases/compiler/exportStarForValues6.ts create mode 100644 tests/cases/compiler/exportStarForValues7.ts create mode 100644 tests/cases/compiler/exportStarForValues8.ts create mode 100644 tests/cases/compiler/exportStarForValues9.ts create mode 100644 tests/cases/compiler/exportStarForValuesInSystem.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 663825f1e84..18e76f46d72 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -14493,6 +14493,33 @@ namespace ts { // Emitter support + function moduleExportsSomeValue(moduleReferenceExpression: Expression): boolean { + let moduleSymbol = resolveExternalModuleName(moduleReferenceExpression.parent, moduleReferenceExpression); + if (!moduleSymbol) { + // module not found - be conservative + return true; + } + + const hasExportAssignment = getExportAssignmentSymbol(moduleSymbol) !== undefined; + moduleSymbol = resolveExternalModuleSymbol(moduleSymbol); + + const symbolLinks = getSymbolLinks(moduleSymbol); + if (symbolLinks.exportsSomeValue == undefined) { + // for export assignments - check if resolved symbol for RHS is itself a value + // otherwise - check if at least one export is value + symbolLinks.exportsSomeValue = hasExportAssignment + ? !!(moduleSymbol.flags & SymbolFlags.Value) + : forEachValue(getExportsOfModule(moduleSymbol), isValue); + } + + return symbolLinks.exportsSomeValue; + + function isValue(s: Symbol): boolean { + s = resolveSymbol(s); + return s && !!(s.flags & SymbolFlags.Value); + } + } + // When resolved as an expression identifier, if the given node references an exported entity, return the declaration // node of the exported entity's container. Otherwise, return undefined. function getReferencedExportContainer(node: Identifier): SourceFile | ModuleDeclaration | EnumDeclaration { @@ -14823,7 +14850,8 @@ namespace ts { getBlockScopedVariableId, getReferencedValueDeclaration, getTypeReferenceSerializationKind, - isOptionalParameter + isOptionalParameter, + moduleExportsSomeValue }; } diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 11942562dcb..bf670bd2c42 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -406,7 +406,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi let externalImports: (ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration)[]; let exportSpecifiers: Map; let exportEquals: ExportAssignment; - let hasExportStars: boolean; + let hasExportStarsToExportValues: boolean; /** Write emitted output to disk */ let writeEmittedFiles = writeJavaScriptFile; @@ -5892,15 +5892,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } else { // export * from "foo" - writeLine(); - write("__export("); - if (modulekind !== ModuleKind.AMD) { - emitRequire(getExternalModuleName(node)); + if (hasExportStarsToExportValues && resolver.moduleExportsSomeValue(node.moduleSpecifier)) { + writeLine(); + write("__export("); + if (modulekind !== ModuleKind.AMD) { + emitRequire(getExternalModuleName(node)); + } + else { + write(generatedName); + } + write(");"); } - else { - write(generatedName); - } - write(");"); } emitEnd(node); } @@ -5988,7 +5990,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi externalImports = []; exportSpecifiers = {}; exportEquals = undefined; - hasExportStars = false; + hasExportStarsToExportValues = false; for (let node of sourceFile.statements) { switch (node.kind) { case SyntaxKind.ImportDeclaration: @@ -6011,8 +6013,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi if ((node).moduleSpecifier) { if (!(node).exportClause) { // export * from "mod" - externalImports.push(node); - hasExportStars = true; + if (resolver.moduleExportsSomeValue((node).moduleSpecifier)) { + externalImports.push(node); + hasExportStarsToExportValues = true; + } } else if (resolver.isValueAliasDeclaration(node)) { // export { x, y } from "mod" where at least one export is a value symbol @@ -6038,7 +6042,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } function emitExportStarHelper() { - if (hasExportStars) { + if (hasExportStarsToExportValues) { writeLine(); write("function __export(m) {"); increaseIndent(); @@ -6110,7 +6114,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi // should always win over entries with similar names that were added via star exports // to support this we store names of local/indirect exported entries in a set. // this set is used to filter names brought by star expors. - if (!hasExportStars) { + if (!hasExportStarsToExportValues) { // local names set is needed only in presence of star exports return undefined; } @@ -6535,6 +6539,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write("});"); } else { + // collectExternalModuleInfo prefilters star exports to keep only ones that export values + // this means that check 'resolver.moduleExportsSomeValue' is redundant and can be omitted here writeLine(); // export * from 'foo' // emit as: @@ -6796,7 +6802,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi externalImports = undefined; exportSpecifiers = undefined; exportEquals = undefined; - hasExportStars = false; + hasExportStarsToExportValues = false; emitEmitHelpers(node); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); @@ -6996,7 +7002,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi externalImports = undefined; exportSpecifiers = undefined; exportEquals = undefined; - hasExportStars = false; + hasExportStarsToExportValues = false; emitEmitHelpers(node); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 5979c4246b1..08dbd22ff7c 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1602,6 +1602,7 @@ namespace ts { getReferencedValueDeclaration(reference: Identifier): Declaration; getTypeReferenceSerializationKind(typeName: EntityName): TypeReferenceSerializationKind; isOptionalParameter(node: ParameterDeclaration): boolean; + moduleExportsSomeValue(moduleReferenceExpression: Expression): boolean; } export const enum SymbolFlags { @@ -1718,6 +1719,7 @@ namespace ts { exportsChecked?: boolean; // True if exports of external module have been checked isNestedRedeclaration?: boolean; // True if symbol is block scoped redeclaration bindingElement?: BindingElement; // Binding element associated with property symbol + exportsSomeValue?: boolean; // true if module exports some value (not just types) } /* @internal */ diff --git a/tests/baselines/reference/es6ExportEqualsInterop.js b/tests/baselines/reference/es6ExportEqualsInterop.js index 747b0b2beb8..3429b71b93c 100644 --- a/tests/baselines/reference/es6ExportEqualsInterop.js +++ b/tests/baselines/reference/es6ExportEqualsInterop.js @@ -289,7 +289,6 @@ exports.a8 = function_module_2.a; var class_module_2 = require("class-module"); exports.a0 = class_module_2.a; // export-star -__export(require("interface")); __export(require("variable")); __export(require("interface-variable")); __export(require("module")); diff --git a/tests/baselines/reference/exportDeclarationInInternalModule.js b/tests/baselines/reference/exportDeclarationInInternalModule.js index 4a1ee9b739f..39c8123a1e7 100644 --- a/tests/baselines/reference/exportDeclarationInInternalModule.js +++ b/tests/baselines/reference/exportDeclarationInInternalModule.js @@ -53,7 +53,7 @@ var Bbb; return SomeType; })(); Bbb.SomeType = SomeType; - __export(require()); // this line causes the nullref + // this line causes the nullref })(Bbb || (Bbb = {})); var a; diff --git a/tests/baselines/reference/exportStarForValues.js b/tests/baselines/reference/exportStarForValues.js new file mode 100644 index 00000000000..bd82373d52a --- /dev/null +++ b/tests/baselines/reference/exportStarForValues.js @@ -0,0 +1,17 @@ +//// [tests/cases/compiler/exportStarForValues.ts] //// + +//// [file1.ts] + +export interface Foo { x } + +//// [file2.ts] +export * from "file1" +var x; + +//// [file1.js] +define(["require", "exports"], function (require, exports) { +}); +//// [file2.js] +define(["require", "exports"], function (require, exports) { + var x; +}); diff --git a/tests/baselines/reference/exportStarForValues.symbols b/tests/baselines/reference/exportStarForValues.symbols new file mode 100644 index 00000000000..6694afecdc6 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues.symbols @@ -0,0 +1,11 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) +>x : Symbol(x, Decl(file1.ts, 1, 22)) + +=== tests/cases/compiler/file2.ts === +export * from "file1" +var x; +>x : Symbol(x, Decl(file2.ts, 1, 3)) + diff --git a/tests/baselines/reference/exportStarForValues.types b/tests/baselines/reference/exportStarForValues.types new file mode 100644 index 00000000000..b326a7e7ff6 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Foo +>x : any + +=== tests/cases/compiler/file2.ts === +export * from "file1" +var x; +>x : any + diff --git a/tests/baselines/reference/exportStarForValues10.js b/tests/baselines/reference/exportStarForValues10.js new file mode 100644 index 00000000000..781316cb8f9 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues10.js @@ -0,0 +1,52 @@ +//// [tests/cases/compiler/exportStarForValues10.ts] //// + +//// [file0.ts] + +export var v = 1; + +//// [file1.ts] +export interface Foo { x } + +//// [file2.ts] +export * from "file0"; +export * from "file1"; +var x = 1; + +//// [file0.js] +System.register([], function(exports_1) { + var v; + return { + setters:[], + execute: function() { + exports_1("v", v = 1); + } + } +}); +//// [file1.js] +System.register([], function(exports_1) { + return { + setters:[], + execute: function() { + } + } +}); +//// [file2.js] +System.register(["file0"], function(exports_1) { + var x; + function exportStar_1(m) { + var exports = {}; + for(var n in m) { + if (n !== "default") exports[n] = m[n]; + } + exports_1(exports); + } + return { + setters:[ + function (file0_1_1) { + exportStar_1(file0_1_1); + }], + execute: function() { + x = 1; + } + } +}); diff --git a/tests/baselines/reference/exportStarForValues10.symbols b/tests/baselines/reference/exportStarForValues10.symbols new file mode 100644 index 00000000000..2de35864d27 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues10.symbols @@ -0,0 +1,16 @@ +=== tests/cases/compiler/file0.ts === + +export var v = 1; +>v : Symbol(v, Decl(file0.ts, 1, 10)) + +=== tests/cases/compiler/file1.ts === +export interface Foo { x } +>Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) +>x : Symbol(x, Decl(file1.ts, 0, 22)) + +=== tests/cases/compiler/file2.ts === +export * from "file0"; +export * from "file1"; +var x = 1; +>x : Symbol(x, Decl(file2.ts, 2, 3)) + diff --git a/tests/baselines/reference/exportStarForValues10.types b/tests/baselines/reference/exportStarForValues10.types new file mode 100644 index 00000000000..370f02318c1 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues10.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/file0.ts === + +export var v = 1; +>v : number +>1 : number + +=== tests/cases/compiler/file1.ts === +export interface Foo { x } +>Foo : Foo +>x : any + +=== tests/cases/compiler/file2.ts === +export * from "file0"; +export * from "file1"; +var x = 1; +>x : number +>1 : number + diff --git a/tests/baselines/reference/exportStarForValues2.js b/tests/baselines/reference/exportStarForValues2.js new file mode 100644 index 00000000000..3d6b24ae433 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues2.js @@ -0,0 +1,25 @@ +//// [tests/cases/compiler/exportStarForValues2.ts] //// + +//// [file1.ts] + +export interface Foo { x } + +//// [file2.ts] +export * from "file1" +var x = 1; + +//// [file3.ts] +export * from "file2" +var x = 1; + +//// [file1.js] +define(["require", "exports"], function (require, exports) { +}); +//// [file2.js] +define(["require", "exports"], function (require, exports) { + var x = 1; +}); +//// [file3.js] +define(["require", "exports"], function (require, exports) { + var x = 1; +}); diff --git a/tests/baselines/reference/exportStarForValues2.symbols b/tests/baselines/reference/exportStarForValues2.symbols new file mode 100644 index 00000000000..0fa739f5431 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues2.symbols @@ -0,0 +1,16 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) +>x : Symbol(x, Decl(file1.ts, 1, 22)) + +=== tests/cases/compiler/file2.ts === +export * from "file1" +var x = 1; +>x : Symbol(x, Decl(file2.ts, 1, 3)) + +=== tests/cases/compiler/file3.ts === +export * from "file2" +var x = 1; +>x : Symbol(x, Decl(file3.ts, 1, 3)) + diff --git a/tests/baselines/reference/exportStarForValues2.types b/tests/baselines/reference/exportStarForValues2.types new file mode 100644 index 00000000000..f1de53bd7cf --- /dev/null +++ b/tests/baselines/reference/exportStarForValues2.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Foo +>x : any + +=== tests/cases/compiler/file2.ts === +export * from "file1" +var x = 1; +>x : number +>1 : number + +=== tests/cases/compiler/file3.ts === +export * from "file2" +var x = 1; +>x : number +>1 : number + diff --git a/tests/baselines/reference/exportStarForValues3.js b/tests/baselines/reference/exportStarForValues3.js new file mode 100644 index 00000000000..c5136e57eef --- /dev/null +++ b/tests/baselines/reference/exportStarForValues3.js @@ -0,0 +1,45 @@ +//// [tests/cases/compiler/exportStarForValues3.ts] //// + +//// [file1.ts] + +export interface Foo { x } + +//// [file2.ts] +export interface A { x } +export * from "file1" +var x = 1; + +//// [file3.ts] +export interface B { x } +export * from "file1" +var x = 1; + +//// [file4.ts] +export interface C { x } +export * from "file2" +export * from "file3" +var x = 1; + +//// [file5.ts] +export * from "file4" +var x = 1; + +//// [file1.js] +define(["require", "exports"], function (require, exports) { +}); +//// [file2.js] +define(["require", "exports"], function (require, exports) { + var x = 1; +}); +//// [file3.js] +define(["require", "exports"], function (require, exports) { + var x = 1; +}); +//// [file4.js] +define(["require", "exports"], function (require, exports) { + var x = 1; +}); +//// [file5.js] +define(["require", "exports"], function (require, exports) { + var x = 1; +}); diff --git a/tests/baselines/reference/exportStarForValues3.symbols b/tests/baselines/reference/exportStarForValues3.symbols new file mode 100644 index 00000000000..a79aeb36588 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues3.symbols @@ -0,0 +1,39 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) +>x : Symbol(x, Decl(file1.ts, 1, 22)) + +=== tests/cases/compiler/file2.ts === +export interface A { x } +>A : Symbol(A, Decl(file2.ts, 0, 0)) +>x : Symbol(x, Decl(file2.ts, 0, 20)) + +export * from "file1" +var x = 1; +>x : Symbol(x, Decl(file2.ts, 2, 3)) + +=== tests/cases/compiler/file3.ts === +export interface B { x } +>B : Symbol(B, Decl(file3.ts, 0, 0)) +>x : Symbol(x, Decl(file3.ts, 0, 20)) + +export * from "file1" +var x = 1; +>x : Symbol(x, Decl(file3.ts, 2, 3)) + +=== tests/cases/compiler/file4.ts === +export interface C { x } +>C : Symbol(C, Decl(file4.ts, 0, 0)) +>x : Symbol(x, Decl(file4.ts, 0, 20)) + +export * from "file2" +export * from "file3" +var x = 1; +>x : Symbol(x, Decl(file4.ts, 3, 3)) + +=== tests/cases/compiler/file5.ts === +export * from "file4" +var x = 1; +>x : Symbol(x, Decl(file5.ts, 1, 3)) + diff --git a/tests/baselines/reference/exportStarForValues3.types b/tests/baselines/reference/exportStarForValues3.types new file mode 100644 index 00000000000..d2ee5ebb1d4 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues3.types @@ -0,0 +1,43 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Foo +>x : any + +=== tests/cases/compiler/file2.ts === +export interface A { x } +>A : A +>x : any + +export * from "file1" +var x = 1; +>x : number +>1 : number + +=== tests/cases/compiler/file3.ts === +export interface B { x } +>B : B +>x : any + +export * from "file1" +var x = 1; +>x : number +>1 : number + +=== tests/cases/compiler/file4.ts === +export interface C { x } +>C : C +>x : any + +export * from "file2" +export * from "file3" +var x = 1; +>x : number +>1 : number + +=== tests/cases/compiler/file5.ts === +export * from "file4" +var x = 1; +>x : number +>1 : number + diff --git a/tests/baselines/reference/exportStarForValues4.js b/tests/baselines/reference/exportStarForValues4.js new file mode 100644 index 00000000000..2e7b84a6c2f --- /dev/null +++ b/tests/baselines/reference/exportStarForValues4.js @@ -0,0 +1,29 @@ +//// [tests/cases/compiler/exportStarForValues4.ts] //// + +//// [file1.ts] + +export interface Foo { x } + +//// [file2.ts] +export interface A { x } +export * from "file1" +export * from "file3" +var x = 1; + +//// [file3.ts] +export interface B { x } +export * from "file2" +var x = 1; + + +//// [file1.js] +define(["require", "exports"], function (require, exports) { +}); +//// [file3.js] +define(["require", "exports"], function (require, exports) { + var x = 1; +}); +//// [file2.js] +define(["require", "exports"], function (require, exports) { + var x = 1; +}); diff --git a/tests/baselines/reference/exportStarForValues4.symbols b/tests/baselines/reference/exportStarForValues4.symbols new file mode 100644 index 00000000000..465d6ed3237 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues4.symbols @@ -0,0 +1,25 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) +>x : Symbol(x, Decl(file1.ts, 1, 22)) + +=== tests/cases/compiler/file2.ts === +export interface A { x } +>A : Symbol(A, Decl(file2.ts, 0, 0)) +>x : Symbol(x, Decl(file2.ts, 0, 20)) + +export * from "file1" +export * from "file3" +var x = 1; +>x : Symbol(x, Decl(file2.ts, 3, 3)) + +=== tests/cases/compiler/file3.ts === +export interface B { x } +>B : Symbol(B, Decl(file3.ts, 0, 0)) +>x : Symbol(x, Decl(file3.ts, 0, 20)) + +export * from "file2" +var x = 1; +>x : Symbol(x, Decl(file3.ts, 2, 3)) + diff --git a/tests/baselines/reference/exportStarForValues4.types b/tests/baselines/reference/exportStarForValues4.types new file mode 100644 index 00000000000..b381f9461e8 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues4.types @@ -0,0 +1,27 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Foo +>x : any + +=== tests/cases/compiler/file2.ts === +export interface A { x } +>A : A +>x : any + +export * from "file1" +export * from "file3" +var x = 1; +>x : number +>1 : number + +=== tests/cases/compiler/file3.ts === +export interface B { x } +>B : B +>x : any + +export * from "file2" +var x = 1; +>x : number +>1 : number + diff --git a/tests/baselines/reference/exportStarForValues5.js b/tests/baselines/reference/exportStarForValues5.js new file mode 100644 index 00000000000..48caf8bdb85 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues5.js @@ -0,0 +1,16 @@ +//// [tests/cases/compiler/exportStarForValues5.ts] //// + +//// [file1.ts] + +export interface Foo { x } + +//// [file2.ts] +export * from "file1" +export var x; + +//// [file1.js] +define(["require", "exports"], function (require, exports) { +}); +//// [file2.js] +define(["require", "exports"], function (require, exports) { +}); diff --git a/tests/baselines/reference/exportStarForValues5.symbols b/tests/baselines/reference/exportStarForValues5.symbols new file mode 100644 index 00000000000..a2950afa73f --- /dev/null +++ b/tests/baselines/reference/exportStarForValues5.symbols @@ -0,0 +1,11 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) +>x : Symbol(x, Decl(file1.ts, 1, 22)) + +=== tests/cases/compiler/file2.ts === +export * from "file1" +export var x; +>x : Symbol(x, Decl(file2.ts, 1, 10)) + diff --git a/tests/baselines/reference/exportStarForValues5.types b/tests/baselines/reference/exportStarForValues5.types new file mode 100644 index 00000000000..9edfc88289a --- /dev/null +++ b/tests/baselines/reference/exportStarForValues5.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Foo +>x : any + +=== tests/cases/compiler/file2.ts === +export * from "file1" +export var x; +>x : any + diff --git a/tests/baselines/reference/exportStarForValues6.js b/tests/baselines/reference/exportStarForValues6.js new file mode 100644 index 00000000000..e393ad3fe7e --- /dev/null +++ b/tests/baselines/reference/exportStarForValues6.js @@ -0,0 +1,28 @@ +//// [tests/cases/compiler/exportStarForValues6.ts] //// + +//// [file1.ts] + +export interface Foo { x } + +//// [file2.ts] +export * from "file1" +export var x = 1; + +//// [file1.js] +System.register([], function(exports_1) { + return { + setters:[], + execute: function() { + } + } +}); +//// [file2.js] +System.register([], function(exports_1) { + var x; + return { + setters:[], + execute: function() { + exports_1("x", x = 1); + } + } +}); diff --git a/tests/baselines/reference/exportStarForValues6.symbols b/tests/baselines/reference/exportStarForValues6.symbols new file mode 100644 index 00000000000..c57baf301dd --- /dev/null +++ b/tests/baselines/reference/exportStarForValues6.symbols @@ -0,0 +1,11 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) +>x : Symbol(x, Decl(file1.ts, 1, 22)) + +=== tests/cases/compiler/file2.ts === +export * from "file1" +export var x = 1; +>x : Symbol(x, Decl(file2.ts, 1, 10)) + diff --git a/tests/baselines/reference/exportStarForValues6.types b/tests/baselines/reference/exportStarForValues6.types new file mode 100644 index 00000000000..4fe38a45d02 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues6.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Foo +>x : any + +=== tests/cases/compiler/file2.ts === +export * from "file1" +export var x = 1; +>x : number +>1 : number + diff --git a/tests/baselines/reference/exportStarForValues7.js b/tests/baselines/reference/exportStarForValues7.js new file mode 100644 index 00000000000..1e249f45906 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues7.js @@ -0,0 +1,29 @@ +//// [tests/cases/compiler/exportStarForValues7.ts] //// + +//// [file1.ts] + +export interface Foo { x } + +//// [file2.ts] +export * from "file1" +export var x = 1; + +//// [file3.ts] +export * from "file2" +export var x = 1; + +//// [file1.js] +define(["require", "exports"], function (require, exports) { +}); +//// [file2.js] +define(["require", "exports"], function (require, exports) { + exports.x = 1; +}); +//// [file3.js] +define(["require", "exports", "file2"], function (require, exports, file2_1) { + function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; + } + __export(file2_1); + exports.x = 1; +}); diff --git a/tests/baselines/reference/exportStarForValues7.symbols b/tests/baselines/reference/exportStarForValues7.symbols new file mode 100644 index 00000000000..b59f2890047 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues7.symbols @@ -0,0 +1,16 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) +>x : Symbol(x, Decl(file1.ts, 1, 22)) + +=== tests/cases/compiler/file2.ts === +export * from "file1" +export var x = 1; +>x : Symbol(x, Decl(file2.ts, 1, 10)) + +=== tests/cases/compiler/file3.ts === +export * from "file2" +export var x = 1; +>x : Symbol(x, Decl(file3.ts, 1, 10)) + diff --git a/tests/baselines/reference/exportStarForValues7.types b/tests/baselines/reference/exportStarForValues7.types new file mode 100644 index 00000000000..d37661320d6 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues7.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Foo +>x : any + +=== tests/cases/compiler/file2.ts === +export * from "file1" +export var x = 1; +>x : number +>1 : number + +=== tests/cases/compiler/file3.ts === +export * from "file2" +export var x = 1; +>x : number +>1 : number + diff --git a/tests/baselines/reference/exportStarForValues8.js b/tests/baselines/reference/exportStarForValues8.js new file mode 100644 index 00000000000..aca678ddd17 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues8.js @@ -0,0 +1,54 @@ +//// [tests/cases/compiler/exportStarForValues8.ts] //// + +//// [file1.ts] + +export interface Foo { x } + +//// [file2.ts] +export interface A { x } +export * from "file1" +export var x = 1; + +//// [file3.ts] +export interface B { x } +export * from "file1" +export var x = 1; + +//// [file4.ts] +export interface C { x } +export * from "file2" +export * from "file3" +export var x = 1; + +//// [file5.ts] +export * from "file4" +export var x = 1; + +//// [file1.js] +define(["require", "exports"], function (require, exports) { +}); +//// [file2.js] +define(["require", "exports"], function (require, exports) { + exports.x = 1; +}); +//// [file3.js] +define(["require", "exports"], function (require, exports) { + exports.x = 1; +}); +//// [file4.js] +define(["require", "exports", "file2", "file3"], function (require, exports, file2_1, file3_1) { + function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; + } + __export(file2_1); + __export(file3_1); + exports.x = 1; +}); +//// [file5.js] +define(["require", "exports", "file4"], function (require, exports, file4_1) { + function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; + } + __export(file4_1); + exports.x = 1; +}); diff --git a/tests/baselines/reference/exportStarForValues8.symbols b/tests/baselines/reference/exportStarForValues8.symbols new file mode 100644 index 00000000000..be958ecabe8 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues8.symbols @@ -0,0 +1,39 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) +>x : Symbol(x, Decl(file1.ts, 1, 22)) + +=== tests/cases/compiler/file2.ts === +export interface A { x } +>A : Symbol(A, Decl(file2.ts, 0, 0)) +>x : Symbol(x, Decl(file2.ts, 0, 20)) + +export * from "file1" +export var x = 1; +>x : Symbol(x, Decl(file2.ts, 2, 10)) + +=== tests/cases/compiler/file3.ts === +export interface B { x } +>B : Symbol(B, Decl(file3.ts, 0, 0)) +>x : Symbol(x, Decl(file3.ts, 0, 20)) + +export * from "file1" +export var x = 1; +>x : Symbol(x, Decl(file3.ts, 2, 10)) + +=== tests/cases/compiler/file4.ts === +export interface C { x } +>C : Symbol(C, Decl(file4.ts, 0, 0)) +>x : Symbol(x, Decl(file4.ts, 0, 20)) + +export * from "file2" +export * from "file3" +export var x = 1; +>x : Symbol(x, Decl(file4.ts, 3, 10)) + +=== tests/cases/compiler/file5.ts === +export * from "file4" +export var x = 1; +>x : Symbol(x, Decl(file5.ts, 1, 10)) + diff --git a/tests/baselines/reference/exportStarForValues8.types b/tests/baselines/reference/exportStarForValues8.types new file mode 100644 index 00000000000..9cc1484eecb --- /dev/null +++ b/tests/baselines/reference/exportStarForValues8.types @@ -0,0 +1,43 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Foo +>x : any + +=== tests/cases/compiler/file2.ts === +export interface A { x } +>A : A +>x : any + +export * from "file1" +export var x = 1; +>x : number +>1 : number + +=== tests/cases/compiler/file3.ts === +export interface B { x } +>B : B +>x : any + +export * from "file1" +export var x = 1; +>x : number +>1 : number + +=== tests/cases/compiler/file4.ts === +export interface C { x } +>C : C +>x : any + +export * from "file2" +export * from "file3" +export var x = 1; +>x : number +>1 : number + +=== tests/cases/compiler/file5.ts === +export * from "file4" +export var x = 1; +>x : number +>1 : number + diff --git a/tests/baselines/reference/exportStarForValues9.js b/tests/baselines/reference/exportStarForValues9.js new file mode 100644 index 00000000000..76758d8a2a0 --- /dev/null +++ b/tests/baselines/reference/exportStarForValues9.js @@ -0,0 +1,37 @@ +//// [tests/cases/compiler/exportStarForValues9.ts] //// + +//// [file1.ts] + +export interface Foo { x } + +//// [file2.ts] +export interface A { x } +export * from "file1" +export * from "file3" +export var x = 1; + +//// [file3.ts] +export interface B { x } +export * from "file2" +export var x = 1; + + +//// [file1.js] +define(["require", "exports"], function (require, exports) { +}); +//// [file3.js] +define(["require", "exports", "file2"], function (require, exports, file2_1) { + function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; + } + __export(file2_1); + exports.x = 1; +}); +//// [file2.js] +define(["require", "exports", "file3"], function (require, exports, file3_1) { + function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; + } + __export(file3_1); + exports.x = 1; +}); diff --git a/tests/baselines/reference/exportStarForValues9.symbols b/tests/baselines/reference/exportStarForValues9.symbols new file mode 100644 index 00000000000..0684c9e7b7c --- /dev/null +++ b/tests/baselines/reference/exportStarForValues9.symbols @@ -0,0 +1,25 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) +>x : Symbol(x, Decl(file1.ts, 1, 22)) + +=== tests/cases/compiler/file2.ts === +export interface A { x } +>A : Symbol(A, Decl(file2.ts, 0, 0)) +>x : Symbol(x, Decl(file2.ts, 0, 20)) + +export * from "file1" +export * from "file3" +export var x = 1; +>x : Symbol(x, Decl(file2.ts, 3, 10)) + +=== tests/cases/compiler/file3.ts === +export interface B { x } +>B : Symbol(B, Decl(file3.ts, 0, 0)) +>x : Symbol(x, Decl(file3.ts, 0, 20)) + +export * from "file2" +export var x = 1; +>x : Symbol(x, Decl(file3.ts, 2, 10)) + diff --git a/tests/baselines/reference/exportStarForValues9.types b/tests/baselines/reference/exportStarForValues9.types new file mode 100644 index 00000000000..3cf250ec50b --- /dev/null +++ b/tests/baselines/reference/exportStarForValues9.types @@ -0,0 +1,27 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Foo +>x : any + +=== tests/cases/compiler/file2.ts === +export interface A { x } +>A : A +>x : any + +export * from "file1" +export * from "file3" +export var x = 1; +>x : number +>1 : number + +=== tests/cases/compiler/file3.ts === +export interface B { x } +>B : B +>x : any + +export * from "file2" +export var x = 1; +>x : number +>1 : number + diff --git a/tests/baselines/reference/exportStarForValuesInSystem.js b/tests/baselines/reference/exportStarForValuesInSystem.js new file mode 100644 index 00000000000..29b839731a8 --- /dev/null +++ b/tests/baselines/reference/exportStarForValuesInSystem.js @@ -0,0 +1,28 @@ +//// [tests/cases/compiler/exportStarForValuesInSystem.ts] //// + +//// [file1.ts] + +export interface Foo { x } + +//// [file2.ts] +export * from "file1" +var x = 1; + +//// [file1.js] +System.register([], function(exports_1) { + return { + setters:[], + execute: function() { + } + } +}); +//// [file2.js] +System.register([], function(exports_1) { + var x; + return { + setters:[], + execute: function() { + x = 1; + } + } +}); diff --git a/tests/baselines/reference/exportStarForValuesInSystem.symbols b/tests/baselines/reference/exportStarForValuesInSystem.symbols new file mode 100644 index 00000000000..c9ef9830c60 --- /dev/null +++ b/tests/baselines/reference/exportStarForValuesInSystem.symbols @@ -0,0 +1,11 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) +>x : Symbol(x, Decl(file1.ts, 1, 22)) + +=== tests/cases/compiler/file2.ts === +export * from "file1" +var x = 1; +>x : Symbol(x, Decl(file2.ts, 1, 3)) + diff --git a/tests/baselines/reference/exportStarForValuesInSystem.types b/tests/baselines/reference/exportStarForValuesInSystem.types new file mode 100644 index 00000000000..36d07741e10 --- /dev/null +++ b/tests/baselines/reference/exportStarForValuesInSystem.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/file1.ts === + +export interface Foo { x } +>Foo : Foo +>x : any + +=== tests/cases/compiler/file2.ts === +export * from "file1" +var x = 1; +>x : number +>1 : number + diff --git a/tests/baselines/reference/moduleElementsInWrongContext.js b/tests/baselines/reference/moduleElementsInWrongContext.js index 635da02bdf2..df4935f9e19 100644 --- a/tests/baselines/reference/moduleElementsInWrongContext.js +++ b/tests/baselines/reference/moduleElementsInWrongContext.js @@ -34,7 +34,6 @@ { var v; function foo() { } - __export(require("ambient")); exports["default"] = v; var C = (function () { function C() { diff --git a/tests/baselines/reference/moduleElementsInWrongContext2.js b/tests/baselines/reference/moduleElementsInWrongContext2.js index fdf1222e549..b923bc7861e 100644 --- a/tests/baselines/reference/moduleElementsInWrongContext2.js +++ b/tests/baselines/reference/moduleElementsInWrongContext2.js @@ -34,7 +34,6 @@ function blah () { function blah() { var v; function foo() { } - __export(require("ambient")); exports["default"] = v; var C = (function () { function C() { diff --git a/tests/baselines/reference/moduleElementsInWrongContext3.js b/tests/baselines/reference/moduleElementsInWrongContext3.js index d464d9d31b1..2fa0b60dce4 100644 --- a/tests/baselines/reference/moduleElementsInWrongContext3.js +++ b/tests/baselines/reference/moduleElementsInWrongContext3.js @@ -37,7 +37,6 @@ var P; { var v; function foo() { } - __export(require("ambient")); P["default"] = v; var C = (function () { function C() { diff --git a/tests/cases/compiler/exportStarForValues.ts b/tests/cases/compiler/exportStarForValues.ts new file mode 100644 index 00000000000..3432548c528 --- /dev/null +++ b/tests/cases/compiler/exportStarForValues.ts @@ -0,0 +1,8 @@ +// @module: amd + +// @filename: file1.ts +export interface Foo { x } + +// @filename: file2.ts +export * from "file1" +var x; \ No newline at end of file diff --git a/tests/cases/compiler/exportStarForValues10.ts b/tests/cases/compiler/exportStarForValues10.ts new file mode 100644 index 00000000000..82cee772b18 --- /dev/null +++ b/tests/cases/compiler/exportStarForValues10.ts @@ -0,0 +1,12 @@ +// @module: system + +// @filename: file0.ts +export var v = 1; + +// @filename: file1.ts +export interface Foo { x } + +// @filename: file2.ts +export * from "file0"; +export * from "file1"; +var x = 1; \ No newline at end of file diff --git a/tests/cases/compiler/exportStarForValues2.ts b/tests/cases/compiler/exportStarForValues2.ts new file mode 100644 index 00000000000..63a880cce0a --- /dev/null +++ b/tests/cases/compiler/exportStarForValues2.ts @@ -0,0 +1,12 @@ +// @module: amd + +// @filename: file1.ts +export interface Foo { x } + +// @filename: file2.ts +export * from "file1" +var x = 1; + +// @filename: file3.ts +export * from "file2" +var x = 1; \ No newline at end of file diff --git a/tests/cases/compiler/exportStarForValues3.ts b/tests/cases/compiler/exportStarForValues3.ts new file mode 100644 index 00000000000..f0c36db0bda --- /dev/null +++ b/tests/cases/compiler/exportStarForValues3.ts @@ -0,0 +1,24 @@ +// @module: amd + +// @filename: file1.ts +export interface Foo { x } + +// @filename: file2.ts +export interface A { x } +export * from "file1" +var x = 1; + +// @filename: file3.ts +export interface B { x } +export * from "file1" +var x = 1; + +// @filename: file4.ts +export interface C { x } +export * from "file2" +export * from "file3" +var x = 1; + +// @filename: file5.ts +export * from "file4" +var x = 1; \ No newline at end of file diff --git a/tests/cases/compiler/exportStarForValues4.ts b/tests/cases/compiler/exportStarForValues4.ts new file mode 100644 index 00000000000..d685ba1c8a3 --- /dev/null +++ b/tests/cases/compiler/exportStarForValues4.ts @@ -0,0 +1,15 @@ +// @module: amd + +// @filename: file1.ts +export interface Foo { x } + +// @filename: file2.ts +export interface A { x } +export * from "file1" +export * from "file3" +var x = 1; + +// @filename: file3.ts +export interface B { x } +export * from "file2" +var x = 1; diff --git a/tests/cases/compiler/exportStarForValues5.ts b/tests/cases/compiler/exportStarForValues5.ts new file mode 100644 index 00000000000..cb716c72002 --- /dev/null +++ b/tests/cases/compiler/exportStarForValues5.ts @@ -0,0 +1,8 @@ +// @module: amd + +// @filename: file1.ts +export interface Foo { x } + +// @filename: file2.ts +export * from "file1" +export var x; \ No newline at end of file diff --git a/tests/cases/compiler/exportStarForValues6.ts b/tests/cases/compiler/exportStarForValues6.ts new file mode 100644 index 00000000000..a623e31f178 --- /dev/null +++ b/tests/cases/compiler/exportStarForValues6.ts @@ -0,0 +1,8 @@ +// @module: system + +// @filename: file1.ts +export interface Foo { x } + +// @filename: file2.ts +export * from "file1" +export var x = 1; \ No newline at end of file diff --git a/tests/cases/compiler/exportStarForValues7.ts b/tests/cases/compiler/exportStarForValues7.ts new file mode 100644 index 00000000000..c1343a44119 --- /dev/null +++ b/tests/cases/compiler/exportStarForValues7.ts @@ -0,0 +1,12 @@ +// @module: amd + +// @filename: file1.ts +export interface Foo { x } + +// @filename: file2.ts +export * from "file1" +export var x = 1; + +// @filename: file3.ts +export * from "file2" +export var x = 1; \ No newline at end of file diff --git a/tests/cases/compiler/exportStarForValues8.ts b/tests/cases/compiler/exportStarForValues8.ts new file mode 100644 index 00000000000..0594f8b0877 --- /dev/null +++ b/tests/cases/compiler/exportStarForValues8.ts @@ -0,0 +1,24 @@ +// @module: amd + +// @filename: file1.ts +export interface Foo { x } + +// @filename: file2.ts +export interface A { x } +export * from "file1" +export var x = 1; + +// @filename: file3.ts +export interface B { x } +export * from "file1" +export var x = 1; + +// @filename: file4.ts +export interface C { x } +export * from "file2" +export * from "file3" +export var x = 1; + +// @filename: file5.ts +export * from "file4" +export var x = 1; \ No newline at end of file diff --git a/tests/cases/compiler/exportStarForValues9.ts b/tests/cases/compiler/exportStarForValues9.ts new file mode 100644 index 00000000000..53ffb1b7954 --- /dev/null +++ b/tests/cases/compiler/exportStarForValues9.ts @@ -0,0 +1,15 @@ +// @module: amd + +// @filename: file1.ts +export interface Foo { x } + +// @filename: file2.ts +export interface A { x } +export * from "file1" +export * from "file3" +export var x = 1; + +// @filename: file3.ts +export interface B { x } +export * from "file2" +export var x = 1; diff --git a/tests/cases/compiler/exportStarForValuesInSystem.ts b/tests/cases/compiler/exportStarForValuesInSystem.ts new file mode 100644 index 00000000000..1f60e8dec6f --- /dev/null +++ b/tests/cases/compiler/exportStarForValuesInSystem.ts @@ -0,0 +1,8 @@ +// @module: system + +// @filename: file1.ts +export interface Foo { x } + +// @filename: file2.ts +export * from "file1" +var x = 1; \ No newline at end of file From 6120f1f3da5ad35973f4d60e0e4c86eb9496d7b0 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Sun, 4 Oct 2015 22:45:08 -0700 Subject: [PATCH 12/28] fix linter issues --- src/compiler/checker.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 18e76f46d72..1cabea864dc 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -14507,8 +14507,8 @@ namespace ts { if (symbolLinks.exportsSomeValue == undefined) { // for export assignments - check if resolved symbol for RHS is itself a value // otherwise - check if at least one export is value - symbolLinks.exportsSomeValue = hasExportAssignment - ? !!(moduleSymbol.flags & SymbolFlags.Value) + symbolLinks.exportsSomeValue = hasExportAssignment + ? !!(moduleSymbol.flags & SymbolFlags.Value) : forEachValue(getExportsOfModule(moduleSymbol), isValue); } @@ -14519,7 +14519,7 @@ namespace ts { return s && !!(s.flags & SymbolFlags.Value); } } - + // When resolved as an expression identifier, if the given node references an exported entity, return the declaration // node of the exported entity's container. Otherwise, return undefined. function getReferencedExportContainer(node: Identifier): SourceFile | ModuleDeclaration | EnumDeclaration { From a531610eb91d6497a26919e8629ac19796b36a72 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Mon, 9 Nov 2015 10:46:50 -0800 Subject: [PATCH 13/28] fix merge issue --- src/compiler/emitter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 4c594da1fa5..49d6236805f 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -580,7 +580,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi externalImports = undefined; exportSpecifiers = undefined; exportEquals = undefined; - hasExportStars = undefined; + hasExportStarsToExportValues = undefined; detachedCommentsInfo = undefined; sourceMapData = undefined; isEs6Module = false; From 04f8c32d32ebcc83d6b862e7e2e15e3e265813e0 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Mon, 7 Dec 2015 11:07:37 -0800 Subject: [PATCH 14/28] Identify JSX closing tags as identifiers so they emit correctly Fixes bug #5955 --- tests/baselines/reference/tsxPreserveEmit1.js | 20 ++++++++++++++++-- .../reference/tsxPreserveEmit1.symbols | 20 ++++++++++++++++-- .../reference/tsxPreserveEmit1.types | 21 +++++++++++++++++-- .../conformance/jsx/tsxPreserveEmit1.tsx | 10 ++++++++- 4 files changed, 64 insertions(+), 7 deletions(-) diff --git a/tests/baselines/reference/tsxPreserveEmit1.js b/tests/baselines/reference/tsxPreserveEmit1.js index 894d0c3d698..7ac6c18ebca 100644 --- a/tests/baselines/reference/tsxPreserveEmit1.js +++ b/tests/baselines/reference/tsxPreserveEmit1.js @@ -22,12 +22,28 @@ import ReactRouter = require('react-router'); import Route = ReactRouter.Route; -var routes = ; +var routes1 = ; + +module M { + export var X: any; +} +module M { + // Should emit 'M.X' in both opening and closing tags + var y = ; +} //// [test.jsx] define(["require", "exports", 'react-router'], function (require, exports, ReactRouter) { "use strict"; var Route = ReactRouter.Route; - var routes = ; + var routes1 = ; + var M; + (function (M) { + })(M || (M = {})); + var M; + (function (M) { + // Should emit 'M.X' in both opening and closing tags + var y = ; + })(M || (M = {})); }); diff --git a/tests/baselines/reference/tsxPreserveEmit1.symbols b/tests/baselines/reference/tsxPreserveEmit1.symbols index 6dcf4d9ac49..53707b86104 100644 --- a/tests/baselines/reference/tsxPreserveEmit1.symbols +++ b/tests/baselines/reference/tsxPreserveEmit1.symbols @@ -11,10 +11,26 @@ import Route = ReactRouter.Route; >ReactRouter : Symbol(ReactRouter, Decl(react.d.ts, 4, 1)) >Route : Symbol(ReactRouter.Route, Decl(react.d.ts, 7, 4)) -var routes = ; ->routes : Symbol(routes, Decl(test.tsx, 6, 3)) +var routes1 = ; +>routes1 : Symbol(routes1, Decl(test.tsx, 6, 3)) >Route : Symbol(Route, Decl(test.tsx, 2, 45)) +module M { +>M : Symbol(M, Decl(test.tsx, 6, 24), Decl(test.tsx, 10, 1)) + + export var X: any; +>X : Symbol(X, Decl(test.tsx, 9, 11)) +} +module M { +>M : Symbol(M, Decl(test.tsx, 6, 24), Decl(test.tsx, 10, 1)) + + // Should emit 'M.X' in both opening and closing tags + var y = ; +>y : Symbol(y, Decl(test.tsx, 13, 4)) +>X : Symbol(X, Decl(test.tsx, 9, 11)) +>X : Symbol(X, Decl(test.tsx, 9, 11)) +} + === tests/cases/conformance/jsx/react.d.ts === declare module 'react' { diff --git a/tests/baselines/reference/tsxPreserveEmit1.types b/tests/baselines/reference/tsxPreserveEmit1.types index ea64e2d2e94..26da75b39e4 100644 --- a/tests/baselines/reference/tsxPreserveEmit1.types +++ b/tests/baselines/reference/tsxPreserveEmit1.types @@ -11,11 +11,28 @@ import Route = ReactRouter.Route; >ReactRouter : typeof ReactRouter >Route : any -var routes = ; ->routes : any +var routes1 = ; +>routes1 : any > : any >Route : any +module M { +>M : typeof M + + export var X: any; +>X : any +} +module M { +>M : typeof M + + // Should emit 'M.X' in both opening and closing tags + var y = ; +>y : any +> : any +>X : any +>X : any +} + === tests/cases/conformance/jsx/react.d.ts === declare module 'react' { diff --git a/tests/cases/conformance/jsx/tsxPreserveEmit1.tsx b/tests/cases/conformance/jsx/tsxPreserveEmit1.tsx index e75a1dbfde2..179a3116b43 100644 --- a/tests/cases/conformance/jsx/tsxPreserveEmit1.tsx +++ b/tests/cases/conformance/jsx/tsxPreserveEmit1.tsx @@ -23,4 +23,12 @@ import ReactRouter = require('react-router'); import Route = ReactRouter.Route; -var routes = ; +var routes1 = ; + +module M { + export var X: any; +} +module M { + // Should emit 'M.X' in both opening and closing tags + var y = ; +} From ff4147af01c1b3fb444dd54736d710d1b9b1f32b Mon Sep 17 00:00:00 2001 From: Dan Corder Date: Mon, 7 Dec 2015 19:46:37 +0000 Subject: [PATCH 15/28] Fix for #5058 - Exclude implemented interface functions from autocompletion suggestions. --- src/services/services.ts | 3 ++- ...etionListImplementingInterfaceFunctions.ts | 26 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/completionListImplementingInterfaceFunctions.ts diff --git a/src/services/services.ts b/src/services/services.ts index 4e0a0265b91..a9dda549ead 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -3751,7 +3751,8 @@ namespace ts { // Ignore omitted expressions for missing members if (m.kind !== SyntaxKind.PropertyAssignment && m.kind !== SyntaxKind.ShorthandPropertyAssignment && - m.kind !== SyntaxKind.BindingElement) { + m.kind !== SyntaxKind.BindingElement && + m.kind !== SyntaxKind.MethodDeclaration) { continue; } diff --git a/tests/cases/fourslash/completionListImplementingInterfaceFunctions.ts b/tests/cases/fourslash/completionListImplementingInterfaceFunctions.ts new file mode 100644 index 00000000000..ef155b315e0 --- /dev/null +++ b/tests/cases/fourslash/completionListImplementingInterfaceFunctions.ts @@ -0,0 +1,26 @@ +/// + +////interface I1 { +//// a(): void; +//// b(): void; +////} +//// +////var imp1: I1 { +//// a() {}, +//// /*0*/ +////} +//// +////interface I2 { +//// a(): void; +//// b(): void; +////} +//// +////var imp2: I2 { +//// a: () => {}, +//// /*1*/ +////} + +goTo.marker("0"); +verify.not.completionListContains("a"); +goTo.marker("1"); +verify.not.completionListContains("a"); From 05c17032a99830036d1c4ab8e28023bf742bcd67 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Mon, 7 Dec 2015 11:57:54 -0800 Subject: [PATCH 16/28] Actually include the fix.... --- src/compiler/emitter.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index dcfce6a2c81..4d14e38df92 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1453,6 +1453,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi case SyntaxKind.ForInStatement: case SyntaxKind.ForOfStatement: case SyntaxKind.IfStatement: + case SyntaxKind.JsxClosingElement: case SyntaxKind.JsxSelfClosingElement: case SyntaxKind.JsxOpeningElement: case SyntaxKind.JsxSpreadAttribute: From c6feaa016a92ff3ef9ba36ea6694a43f04712e2d Mon Sep 17 00:00:00 2001 From: Dan Corder Date: Mon, 7 Dec 2015 22:43:44 +0000 Subject: [PATCH 17/28] Remove unnecessary I2 from test case --- .../completionListImplementingInterfaceFunctions.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tests/cases/fourslash/completionListImplementingInterfaceFunctions.ts b/tests/cases/fourslash/completionListImplementingInterfaceFunctions.ts index ef155b315e0..06a1c24230c 100644 --- a/tests/cases/fourslash/completionListImplementingInterfaceFunctions.ts +++ b/tests/cases/fourslash/completionListImplementingInterfaceFunctions.ts @@ -10,12 +10,7 @@ //// /*0*/ ////} //// -////interface I2 { -//// a(): void; -//// b(): void; -////} -//// -////var imp2: I2 { +////var imp2: I1 { //// a: () => {}, //// /*1*/ ////} From e95ae4f100fea0a6a46ae697d34329861ab50d3e Mon Sep 17 00:00:00 2001 From: yaoyao Date: Tue, 8 Dec 2015 08:56:41 +0800 Subject: [PATCH 18/28] Improve 'Cannot compile modules unless the '--module' flag is provided.' message --- src/compiler/diagnosticMessages.json | 2 +- src/compiler/program.ts | 2 +- tests/baselines/reference/ExportAssignment7.errors.txt | 4 ++-- tests/baselines/reference/ExportAssignment8.errors.txt | 4 ++-- ...ThatMergeEachWithExportedLocalVarsOfTheSameName.errors.txt | 4 ++-- .../reference/ambientDeclarationsExternal.errors.txt | 4 ++-- tests/baselines/reference/circularReference.errors.txt | 4 ++-- .../baselines/reference/classAbstractManyKeywords.errors.txt | 4 ++-- .../classMemberInitializerWithLamdaScoping3.errors.txt | 4 ++-- .../classMemberInitializerWithLamdaScoping4.errors.txt | 4 ++-- .../baselines/reference/duplicateExportAssignments.errors.txt | 4 ++-- tests/baselines/reference/duplicateLocalVariable1.errors.txt | 4 ++-- .../reference/es5ModuleWithoutModuleGenTarget.errors.txt | 4 ++-- tests/baselines/reference/exportAssignDottedName.errors.txt | 4 ++-- .../reference/exportAssignImportedIdentifier.errors.txt | 4 ++-- .../baselines/reference/exportAssignNonIdentifier.errors.txt | 4 ++-- tests/baselines/reference/exportAssignTypes.errors.txt | 4 ++-- tests/baselines/reference/exportDeclaredModule.errors.txt | 4 ++-- tests/baselines/reference/exportNonVisibleType.errors.txt | 4 ++-- .../reference/externalModuleWithoutCompilerFlag1.errors.txt | 4 ++-- tests/baselines/reference/genericArrayExtenstions.errors.txt | 4 ++-- ...portAliasAnExternalModuleInsideAnInternalModule.errors.txt | 4 ++-- .../importDeclRefereingExternalModuleWithNoResolve.errors.txt | 4 ++-- .../reference/importDeclWithDeclareModifier.errors.txt | 4 ++-- .../jsFileCompilationExportAssignmentSyntax.errors.txt | 4 ++-- .../reference/mergedModuleDeclarationCodeGen.errors.txt | 4 ++-- tests/baselines/reference/moduleScoping.errors.txt | 4 ++-- tests/baselines/reference/nonMergedOverloads.errors.txt | 4 ++-- tests/baselines/reference/parser0_004152.errors.txt | 4 ++-- tests/baselines/reference/parser509546.errors.txt | 4 ++-- tests/baselines/reference/parser509546_1.errors.txt | 4 ++-- tests/baselines/reference/parser509546_2.errors.txt | 4 ++-- tests/baselines/reference/parser618973.errors.txt | 4 ++-- tests/baselines/reference/parserArgumentList1.errors.txt | 4 ++-- tests/baselines/reference/parserClass1.errors.txt | 4 ++-- tests/baselines/reference/parserClass2.errors.txt | 4 ++-- tests/baselines/reference/parserEnum1.errors.txt | 4 ++-- tests/baselines/reference/parserEnum2.errors.txt | 4 ++-- tests/baselines/reference/parserEnum3.errors.txt | 4 ++-- tests/baselines/reference/parserEnum4.errors.txt | 4 ++-- tests/baselines/reference/parserExportAssignment1.errors.txt | 4 ++-- tests/baselines/reference/parserExportAssignment2.errors.txt | 4 ++-- tests/baselines/reference/parserExportAssignment3.errors.txt | 4 ++-- tests/baselines/reference/parserExportAssignment4.errors.txt | 4 ++-- tests/baselines/reference/parserExportAssignment7.errors.txt | 4 ++-- tests/baselines/reference/parserExportAssignment8.errors.txt | 4 ++-- .../reference/parserInterfaceDeclaration6.errors.txt | 4 ++-- .../reference/parserInterfaceDeclaration7.errors.txt | 4 ++-- .../reference/parserModifierOnStatementInBlock1.errors.txt | 4 ++-- .../reference/parserModifierOnStatementInBlock3.errors.txt | 4 ++-- tests/baselines/reference/parserModule1.errors.txt | 4 ++-- .../reference/relativePathToDeclarationFile.errors.txt | 4 ++-- tests/baselines/reference/reservedWords2.errors.txt | 4 ++-- tests/baselines/reference/scannerClass2.errors.txt | 4 ++-- tests/baselines/reference/scannerEnum1.errors.txt | 4 ++-- .../reference/thisInInvalidContextsExternalModule.errors.txt | 4 ++-- .../reference/tsxStatelessFunctionComponents2.errors.txt | 4 ++-- tests/baselines/reference/typeofANonExportedType.errors.txt | 4 ++-- tests/baselines/reference/typeofAnExportedType.errors.txt | 4 ++-- tests/cases/fourslash/getJavaScriptSemanticDiagnostics2.ts | 2 +- 60 files changed, 117 insertions(+), 117 deletions(-) diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index e8be600dfd1..331568eae22 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -435,7 +435,7 @@ "category": "Error", "code": 1147 }, - "Cannot compile modules unless the '--module' flag is provided.": { + "Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file.": { "category": "Error", "code": 1148 }, diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 96afd69ea4d..da6f7ab0ee7 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -1234,7 +1234,7 @@ namespace ts { else if (firstExternalModuleSourceFile && languageVersion < ScriptTarget.ES6 && !options.module) { // We cannot use createDiagnosticFromNode because nodes do not have parents yet const span = getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); - programDiagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided)); + programDiagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided_Consider_setting_the_module_compiler_option_in_a_tsconfig_json_file)); } // Cannot specify module gen target of es6 when below es6 diff --git a/tests/baselines/reference/ExportAssignment7.errors.txt b/tests/baselines/reference/ExportAssignment7.errors.txt index 83651e10b8e..fe461785c63 100644 --- a/tests/baselines/reference/ExportAssignment7.errors.txt +++ b/tests/baselines/reference/ExportAssignment7.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/ExportAssignment7.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/ExportAssignment7.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/ExportAssignment7.ts(4,1): error TS2309: An export assignment cannot be used in a module with other exported elements. tests/cases/compiler/ExportAssignment7.ts(4,10): error TS2304: Cannot find name 'B'. @@ -6,7 +6,7 @@ tests/cases/compiler/ExportAssignment7.ts(4,10): error TS2304: Cannot find name ==== tests/cases/compiler/ExportAssignment7.ts (3 errors) ==== export class C { ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. } export = B; diff --git a/tests/baselines/reference/ExportAssignment8.errors.txt b/tests/baselines/reference/ExportAssignment8.errors.txt index d1a285cfe51..22e32c9c7d0 100644 --- a/tests/baselines/reference/ExportAssignment8.errors.txt +++ b/tests/baselines/reference/ExportAssignment8.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/ExportAssignment8.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/ExportAssignment8.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/ExportAssignment8.ts(1,1): error TS2309: An export assignment cannot be used in a module with other exported elements. tests/cases/compiler/ExportAssignment8.ts(1,10): error TS2304: Cannot find name 'B'. @@ -6,7 +6,7 @@ tests/cases/compiler/ExportAssignment8.ts(1,10): error TS2304: Cannot find name ==== tests/cases/compiler/ExportAssignment8.ts (3 errors) ==== export = B; ~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~~~~~~~ !!! error TS2309: An export assignment cannot be used in a module with other exported elements. ~ diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.errors.txt b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.errors.txt index fefdcd8f6f5..e46805a6a2f 100644 --- a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.errors.txt +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/internalModules/DeclarationMerging/part1.ts(1,15): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/internalModules/DeclarationMerging/part1.ts(1,15): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/internalModules/DeclarationMerging/part2.ts(3,24): error TS2304: Cannot find name 'Point'. tests/cases/conformance/internalModules/DeclarationMerging/part2.ts(7,36): error TS2304: Cannot find name 'Point'. tests/cases/conformance/internalModules/DeclarationMerging/part2.ts(7,54): error TS2304: Cannot find name 'Point'. @@ -7,7 +7,7 @@ tests/cases/conformance/internalModules/DeclarationMerging/part2.ts(7,54): error ==== tests/cases/conformance/internalModules/DeclarationMerging/part1.ts (1 errors) ==== export module A { ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. export interface Point { x: number; y: number; diff --git a/tests/baselines/reference/ambientDeclarationsExternal.errors.txt b/tests/baselines/reference/ambientDeclarationsExternal.errors.txt index d05dfe813fd..2a9b1fe4879 100644 --- a/tests/baselines/reference/ambientDeclarationsExternal.errors.txt +++ b/tests/baselines/reference/ambientDeclarationsExternal.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/ambient/consumer.ts(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/ambient/consumer.ts(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/ambient/consumer.ts (1 errors) ==== /// import imp1 = require('equ'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. // Ambient external module members are always exported with or without export keyword when module lacks export assignment diff --git a/tests/baselines/reference/circularReference.errors.txt b/tests/baselines/reference/circularReference.errors.txt index 5e0a6208a1e..9954944ff1f 100644 --- a/tests/baselines/reference/circularReference.errors.txt +++ b/tests/baselines/reference/circularReference.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/externalModules/foo1.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/externalModules/foo1.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/externalModules/foo1.ts(9,12): error TS2339: Property 'x' does not exist on type 'C1'. tests/cases/conformance/externalModules/foo2.ts(8,12): error TS2339: Property 'y' does not exist on type 'C1'. tests/cases/conformance/externalModules/foo2.ts(13,8): error TS2339: Property 'x' does not exist on type 'C1'. @@ -29,7 +29,7 @@ tests/cases/conformance/externalModules/foo2.ts(13,8): error TS2339: Property 'x ==== tests/cases/conformance/externalModules/foo1.ts (2 errors) ==== import foo2 = require('./foo2'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. export module M1 { export class C1 { m1: foo2.M1.C1; diff --git a/tests/baselines/reference/classAbstractManyKeywords.errors.txt b/tests/baselines/reference/classAbstractManyKeywords.errors.txt index b200404eaf0..eec5ac4bc0d 100644 --- a/tests/baselines/reference/classAbstractManyKeywords.errors.txt +++ b/tests/baselines/reference/classAbstractManyKeywords.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractManyKeywords.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractManyKeywords.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractManyKeywords.ts(1,25): error TS1005: ';' expected. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractManyKeywords.ts(3,1): error TS1128: Declaration or statement expected. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractManyKeywords.ts(4,17): error TS1005: '=' expected. @@ -7,7 +7,7 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst ==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractManyKeywords.ts (4 errors) ==== export default abstract class A {} ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~ !!! error TS1005: ';' expected. export abstract class B {} diff --git a/tests/baselines/reference/classMemberInitializerWithLamdaScoping3.errors.txt b/tests/baselines/reference/classMemberInitializerWithLamdaScoping3.errors.txt index 47adb957141..b016952a3aa 100644 --- a/tests/baselines/reference/classMemberInitializerWithLamdaScoping3.errors.txt +++ b/tests/baselines/reference/classMemberInitializerWithLamdaScoping3.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(4,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(4,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(8,21): error TS2301: Initializer of instance member variable 'messageHandler' cannot reference identifier 'field1' declared in the constructor. @@ -11,7 +11,7 @@ tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(8,21): error T }; export class Test1 { ~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. constructor(private field1: string) { } messageHandler = () => { diff --git a/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.errors.txt b/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.errors.txt index 9d1a2dd3418..73fa862e82b 100644 --- a/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.errors.txt +++ b/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/classMemberInitializerWithLamdaScoping3_0.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/classMemberInitializerWithLamdaScoping3_0.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(8,21): error TS2304: Cannot find name 'field1'. ==== tests/cases/compiler/classMemberInitializerWithLamdaScoping3_0.ts (1 errors) ==== export var field1: string; ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts (1 errors) ==== declare var console: { diff --git a/tests/baselines/reference/duplicateExportAssignments.errors.txt b/tests/baselines/reference/duplicateExportAssignments.errors.txt index 47a97f9d8af..a76513133b9 100644 --- a/tests/baselines/reference/duplicateExportAssignments.errors.txt +++ b/tests/baselines/reference/duplicateExportAssignments.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/externalModules/foo1.ts(3,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/externalModules/foo1.ts(3,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/externalModules/foo1.ts(3,1): error TS2300: Duplicate identifier 'export='. tests/cases/conformance/externalModules/foo1.ts(4,1): error TS2300: Duplicate identifier 'export='. tests/cases/conformance/externalModules/foo2.ts(3,1): error TS2300: Duplicate identifier 'export='. @@ -17,7 +17,7 @@ tests/cases/conformance/externalModules/foo5.ts(6,1): error TS2300: Duplicate id var y = 20; export = x; ~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'export='. export = y; diff --git a/tests/baselines/reference/duplicateLocalVariable1.errors.txt b/tests/baselines/reference/duplicateLocalVariable1.errors.txt index bd6d535d88e..0a49c71e29b 100644 --- a/tests/baselines/reference/duplicateLocalVariable1.errors.txt +++ b/tests/baselines/reference/duplicateLocalVariable1.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/duplicateLocalVariable1.ts(2,4): error TS1005: ';' expected. tests/cases/compiler/duplicateLocalVariable1.ts(2,11): error TS1146: Declaration expected. tests/cases/compiler/duplicateLocalVariable1.ts(2,13): error TS2304: Cannot find name 'commonjs'. -tests/cases/compiler/duplicateLocalVariable1.ts(12,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/duplicateLocalVariable1.ts(12,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/duplicateLocalVariable1.ts(187,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'any', but here has type 'number'. @@ -25,7 +25,7 @@ tests/cases/compiler/duplicateLocalVariable1.ts(187,22): error TS2403: Subsequen export class TestCase { ~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. constructor (public name: string, public test: ()=>boolean, public errorMessageRegEx?: string) { } } diff --git a/tests/baselines/reference/es5ModuleWithoutModuleGenTarget.errors.txt b/tests/baselines/reference/es5ModuleWithoutModuleGenTarget.errors.txt index faf27a85206..90f10087194 100644 --- a/tests/baselines/reference/es5ModuleWithoutModuleGenTarget.errors.txt +++ b/tests/baselines/reference/es5ModuleWithoutModuleGenTarget.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/es5ModuleWithoutModuleGenTarget.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/es5ModuleWithoutModuleGenTarget.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/compiler/es5ModuleWithoutModuleGenTarget.ts (1 errors) ==== export class A ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. { constructor () { diff --git a/tests/baselines/reference/exportAssignDottedName.errors.txt b/tests/baselines/reference/exportAssignDottedName.errors.txt index 39a0a2577ee..3ed4f3c888f 100644 --- a/tests/baselines/reference/exportAssignDottedName.errors.txt +++ b/tests/baselines/reference/exportAssignDottedName.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/externalModules/foo1.ts(1,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/externalModules/foo1.ts(1,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/externalModules/foo2.ts (0 errors) ==== @@ -8,7 +8,7 @@ tests/cases/conformance/externalModules/foo1.ts(1,17): error TS1148: Cannot comp ==== tests/cases/conformance/externalModules/foo1.ts (1 errors) ==== export function x(){ ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. return true; } \ No newline at end of file diff --git a/tests/baselines/reference/exportAssignImportedIdentifier.errors.txt b/tests/baselines/reference/exportAssignImportedIdentifier.errors.txt index 753bc567619..167c0baca3d 100644 --- a/tests/baselines/reference/exportAssignImportedIdentifier.errors.txt +++ b/tests/baselines/reference/exportAssignImportedIdentifier.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/externalModules/foo1.ts(1,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/externalModules/foo1.ts(1,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/externalModules/foo3.ts (0 errors) ==== @@ -7,7 +7,7 @@ tests/cases/conformance/externalModules/foo1.ts(1,17): error TS1148: Cannot comp ==== tests/cases/conformance/externalModules/foo1.ts (1 errors) ==== export function x(){ ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. return true; } diff --git a/tests/baselines/reference/exportAssignNonIdentifier.errors.txt b/tests/baselines/reference/exportAssignNonIdentifier.errors.txt index c3d58c9b36f..9e8bfa8d747 100644 --- a/tests/baselines/reference/exportAssignNonIdentifier.errors.txt +++ b/tests/baselines/reference/exportAssignNonIdentifier.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/externalModules/foo1.ts(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/externalModules/foo1.ts(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/externalModules/foo6.ts(1,14): error TS1109: Expression expected. @@ -6,7 +6,7 @@ tests/cases/conformance/externalModules/foo6.ts(1,14): error TS1109: Expression var x = 10; export = typeof x; // Ok ~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/externalModules/foo2.ts (0 errors) ==== export = "sausages"; // Ok diff --git a/tests/baselines/reference/exportAssignTypes.errors.txt b/tests/baselines/reference/exportAssignTypes.errors.txt index ba5538777c5..9d39f48fec8 100644 --- a/tests/baselines/reference/exportAssignTypes.errors.txt +++ b/tests/baselines/reference/exportAssignTypes.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/externalModules/expString.ts(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/externalModules/expString.ts(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/externalModules/consumer.ts (0 errors) ==== @@ -27,7 +27,7 @@ tests/cases/conformance/externalModules/expString.ts(2,1): error TS1148: Cannot var x = "test"; export = x; ~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/externalModules/expNumber.ts (0 errors) ==== var x = 42; diff --git a/tests/baselines/reference/exportDeclaredModule.errors.txt b/tests/baselines/reference/exportDeclaredModule.errors.txt index 47ee543e0c0..c235d4c448f 100644 --- a/tests/baselines/reference/exportDeclaredModule.errors.txt +++ b/tests/baselines/reference/exportDeclaredModule.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/externalModules/foo1.ts(6,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/externalModules/foo1.ts(6,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/externalModules/foo2.ts (0 errors) ==== @@ -12,5 +12,5 @@ tests/cases/conformance/externalModules/foo1.ts(6,1): error TS1148: Cannot compi } export = M1; ~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. \ No newline at end of file diff --git a/tests/baselines/reference/exportNonVisibleType.errors.txt b/tests/baselines/reference/exportNonVisibleType.errors.txt index 04c174b4994..bc4dac4ca58 100644 --- a/tests/baselines/reference/exportNonVisibleType.errors.txt +++ b/tests/baselines/reference/exportNonVisibleType.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/externalModules/foo1.ts(7,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/externalModules/foo1.ts(7,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/externalModules/foo1.ts (1 errors) ==== @@ -10,7 +10,7 @@ tests/cases/conformance/externalModules/foo1.ts(7,1): error TS1148: Cannot compi var x: I1 = {a: "test", b: 42}; export = x; // Should fail, I1 not exported. ~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/externalModules/foo2.ts (0 errors) ==== diff --git a/tests/baselines/reference/externalModuleWithoutCompilerFlag1.errors.txt b/tests/baselines/reference/externalModuleWithoutCompilerFlag1.errors.txt index 64874c767ee..e2ffd4ec372 100644 --- a/tests/baselines/reference/externalModuleWithoutCompilerFlag1.errors.txt +++ b/tests/baselines/reference/externalModuleWithoutCompilerFlag1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/externalModuleWithoutCompilerFlag1.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/externalModuleWithoutCompilerFlag1.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/compiler/externalModuleWithoutCompilerFlag1.ts (1 errors) ==== @@ -6,5 +6,5 @@ tests/cases/compiler/externalModuleWithoutCompilerFlag1.ts(3,17): error TS1148: // Not on line 0 because we want to verify the error is placed in the appropriate location. export module M { ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. } \ No newline at end of file diff --git a/tests/baselines/reference/genericArrayExtenstions.errors.txt b/tests/baselines/reference/genericArrayExtenstions.errors.txt index f3035497910..7b332366fed 100644 --- a/tests/baselines/reference/genericArrayExtenstions.errors.txt +++ b/tests/baselines/reference/genericArrayExtenstions.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/genericArrayExtenstions.ts(1,22): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/genericArrayExtenstions.ts(1,22): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/genericArrayExtenstions.ts(1,22): error TS2420: Class 'ObservableArray' incorrectly implements interface 'T[]'. Property 'length' is missing in type 'ObservableArray'. @@ -6,7 +6,7 @@ tests/cases/compiler/genericArrayExtenstions.ts(1,22): error TS2420: Class 'Obse ==== tests/cases/compiler/genericArrayExtenstions.ts (2 errors) ==== export declare class ObservableArray implements Array { // MS.Entertainment.ObservableArray ~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~~~~~~~~~~~ !!! error TS2420: Class 'ObservableArray' incorrectly implements interface 'T[]'. !!! error TS2420: Property 'length' is missing in type 'ObservableArray'. diff --git a/tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.errors.txt b/tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.errors.txt index d12854648e5..56d1549f853 100644 --- a/tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.errors.txt +++ b/tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule_file0.ts(1,15): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule_file0.ts(1,15): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule_file1.ts (0 errors) ==== @@ -12,7 +12,7 @@ tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule_file0.ts( ==== tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule_file0.ts (1 errors) ==== export module m { ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. export function foo() { } } \ No newline at end of file diff --git a/tests/baselines/reference/importDeclRefereingExternalModuleWithNoResolve.errors.txt b/tests/baselines/reference/importDeclRefereingExternalModuleWithNoResolve.errors.txt index 74f532d0c1e..34cfe02305f 100644 --- a/tests/baselines/reference/importDeclRefereingExternalModuleWithNoResolve.errors.txt +++ b/tests/baselines/reference/importDeclRefereingExternalModuleWithNoResolve.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts(1,20): error TS2307: Cannot find module 'externalModule'. tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts(2,16): error TS2435: Ambient modules cannot be nested in other modules or namespaces. tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts(3,26): error TS2307: Cannot find module 'externalModule'. @@ -7,7 +7,7 @@ tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts(3,26): er ==== tests/cases/compiler/importDeclRefereingExternalModuleWithNoResolve.ts (4 errors) ==== import b = require("externalModule"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~~~~~~~~~~~~ !!! error TS2307: Cannot find module 'externalModule'. declare module "m1" { diff --git a/tests/baselines/reference/importDeclWithDeclareModifier.errors.txt b/tests/baselines/reference/importDeclWithDeclareModifier.errors.txt index 13991aea7f7..9e3d012aeb6 100644 --- a/tests/baselines/reference/importDeclWithDeclareModifier.errors.txt +++ b/tests/baselines/reference/importDeclWithDeclareModifier.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/importDeclWithDeclareModifier.ts(5,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/importDeclWithDeclareModifier.ts(5,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/importDeclWithDeclareModifier.ts(5,9): error TS1029: 'export' modifier must precede 'declare' modifier. tests/cases/compiler/importDeclWithDeclareModifier.ts(5,29): error TS2305: Module 'x' has no exported member 'c'. @@ -10,7 +10,7 @@ tests/cases/compiler/importDeclWithDeclareModifier.ts(5,29): error TS2305: Modul } declare export import a = x.c; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~~ !!! error TS1029: 'export' modifier must precede 'declare' modifier. ~ diff --git a/tests/baselines/reference/jsFileCompilationExportAssignmentSyntax.errors.txt b/tests/baselines/reference/jsFileCompilationExportAssignmentSyntax.errors.txt index 3be5f99823a..7e67c6325e0 100644 --- a/tests/baselines/reference/jsFileCompilationExportAssignmentSyntax.errors.txt +++ b/tests/baselines/reference/jsFileCompilationExportAssignmentSyntax.errors.txt @@ -1,5 +1,5 @@ error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -tests/cases/compiler/a.js(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/a.js(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/a.js(1,1): error TS8003: 'export=' can only be used in a .ts file. @@ -7,6 +7,6 @@ tests/cases/compiler/a.js(1,1): error TS8003: 'export=' can only be used in a .t ==== tests/cases/compiler/a.js (2 errors) ==== export = b; ~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~~~~~~~ !!! error TS8003: 'export=' can only be used in a .ts file. \ No newline at end of file diff --git a/tests/baselines/reference/mergedModuleDeclarationCodeGen.errors.txt b/tests/baselines/reference/mergedModuleDeclarationCodeGen.errors.txt index d9b7fa55d71..a39c1c4d91a 100644 --- a/tests/baselines/reference/mergedModuleDeclarationCodeGen.errors.txt +++ b/tests/baselines/reference/mergedModuleDeclarationCodeGen.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/mergedModuleDeclarationCodeGen.ts(1,15): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/mergedModuleDeclarationCodeGen.ts(1,15): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/compiler/mergedModuleDeclarationCodeGen.ts (1 errors) ==== export module X { ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. export module Y { class A { constructor(Y: any) { diff --git a/tests/baselines/reference/moduleScoping.errors.txt b/tests/baselines/reference/moduleScoping.errors.txt index 21471bc93a5..961715f2e71 100644 --- a/tests/baselines/reference/moduleScoping.errors.txt +++ b/tests/baselines/reference/moduleScoping.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/externalModules/file3.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/externalModules/file3.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/externalModules/file1.ts (0 errors) ==== @@ -11,7 +11,7 @@ tests/cases/conformance/externalModules/file3.ts(1,1): error TS1148: Cannot comp ==== tests/cases/conformance/externalModules/file3.ts (1 errors) ==== export var v3 = true; ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. var v2 = [1,2,3]; // Module scope. Should not appear in global scope ==== tests/cases/conformance/externalModules/file4.ts (0 errors) ==== diff --git a/tests/baselines/reference/nonMergedOverloads.errors.txt b/tests/baselines/reference/nonMergedOverloads.errors.txt index 9a38ebdc3b3..f5fb58247da 100644 --- a/tests/baselines/reference/nonMergedOverloads.errors.txt +++ b/tests/baselines/reference/nonMergedOverloads.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/nonMergedOverloads.ts(1,5): error TS2300: Duplicate identifier 'f'. -tests/cases/compiler/nonMergedOverloads.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/nonMergedOverloads.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/nonMergedOverloads.ts(3,17): error TS2300: Duplicate identifier 'f'. tests/cases/compiler/nonMergedOverloads.ts(4,17): error TS2300: Duplicate identifier 'f'. @@ -11,7 +11,7 @@ tests/cases/compiler/nonMergedOverloads.ts(4,17): error TS2300: Duplicate identi export function f(); ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~ !!! error TS2300: Duplicate identifier 'f'. export function f() { diff --git a/tests/baselines/reference/parser0_004152.errors.txt b/tests/baselines/reference/parser0_004152.errors.txt index 97527418337..85c450ef39f 100644 --- a/tests/baselines/reference/parser0_004152.errors.txt +++ b/tests/baselines/reference/parser0_004152.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,28): error TS2304: Cannot find name 'DisplayPosition'. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,45): error TS1137: Expression or comma expected. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,46): error TS1005: ';' expected. @@ -38,7 +38,7 @@ tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(3,25): error T ==== tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts (35 errors) ==== export class Game { ~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. private position = new DisplayPosition([), 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 0], NoMove, 0); ~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'DisplayPosition'. diff --git a/tests/baselines/reference/parser509546.errors.txt b/tests/baselines/reference/parser509546.errors.txt index 6b98dc2aa30..65e524cb0e7 100644 --- a/tests/baselines/reference/parser509546.errors.txt +++ b/tests/baselines/reference/parser509546.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546.ts (1 errors) ==== export class Logger { ~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. public } \ No newline at end of file diff --git a/tests/baselines/reference/parser509546_1.errors.txt b/tests/baselines/reference/parser509546_1.errors.txt index 5987aadff24..1098adc1463 100644 --- a/tests/baselines/reference/parser509546_1.errors.txt +++ b/tests/baselines/reference/parser509546_1.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_1.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_1.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_1.ts (1 errors) ==== export class Logger { ~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. public } \ No newline at end of file diff --git a/tests/baselines/reference/parser509546_2.errors.txt b/tests/baselines/reference/parser509546_2.errors.txt index 617fec94321..ad551887dda 100644 --- a/tests/baselines/reference/parser509546_2.errors.txt +++ b/tests/baselines/reference/parser509546_2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_2.ts(3,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_2.ts(3,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_2.ts (1 errors) ==== @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509546_2.ts(3,1 export class Logger { ~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. public } \ No newline at end of file diff --git a/tests/baselines/reference/parser618973.errors.txt b/tests/baselines/reference/parser618973.errors.txt index 95e08726661..b76aa15c858 100644 --- a/tests/baselines/reference/parser618973.errors.txt +++ b/tests/baselines/reference/parser618973.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/parser/ecmascript5/RegressionTests/parser618973.ts(1,8): error TS1030: 'export' modifier already seen. -tests/cases/conformance/parser/ecmascript5/RegressionTests/parser618973.ts(1,21): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/RegressionTests/parser618973.ts(1,21): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser618973.ts (2 errors) ==== @@ -7,7 +7,7 @@ tests/cases/conformance/parser/ecmascript5/RegressionTests/parser618973.ts(1,21) ~~~~~~ !!! error TS1030: 'export' modifier already seen. ~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. public Bar() { } } \ No newline at end of file diff --git a/tests/baselines/reference/parserArgumentList1.errors.txt b/tests/baselines/reference/parserArgumentList1.errors.txt index 36d1a0fad37..01575cec0c4 100644 --- a/tests/baselines/reference/parserArgumentList1.errors.txt +++ b/tests/baselines/reference/parserArgumentList1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/parserArgumentList1.ts(1,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/parserArgumentList1.ts(1,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/parserArgumentList1.ts(1,35): error TS2304: Cannot find name 'HTMLElement'. tests/cases/conformance/parser/ecmascript5/parserArgumentList1.ts(2,42): error TS2304: Cannot find name '_classNameRegexp'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/parserArgumentList1.ts(2,42): error T ==== tests/cases/conformance/parser/ecmascript5/parserArgumentList1.ts (3 errors) ==== export function removeClass (node:HTMLElement, className:string) { ~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~~~~~~~ !!! error TS2304: Cannot find name 'HTMLElement'. node.className = node.className.replace(_classNameRegexp(className), function (everything, leftDelimiter, name, rightDelimiter) { diff --git a/tests/baselines/reference/parserClass1.errors.txt b/tests/baselines/reference/parserClass1.errors.txt index da4fc8d870d..03ec87f66a6 100644 --- a/tests/baselines/reference/parserClass1.errors.txt +++ b/tests/baselines/reference/parserClass1.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClass1.ts(1,18): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClass1.ts(1,18): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClass1.ts(1,40): error TS2304: Cannot find name 'ILogger'. ==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClass1.ts (2 errors) ==== export class NullLogger implements ILogger { ~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~~~ !!! error TS2304: Cannot find name 'ILogger'. public information(): boolean { return false; } diff --git a/tests/baselines/reference/parserClass2.errors.txt b/tests/baselines/reference/parserClass2.errors.txt index 39476805e1d..ee67b262fe5 100644 --- a/tests/baselines/reference/parserClass2.errors.txt +++ b/tests/baselines/reference/parserClass2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClass2.ts(3,18): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClass2.ts(3,18): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClass2.ts(3,43): error TS2304: Cannot find name 'ILogger'. tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClass2.ts(4,37): error TS2304: Cannot find name 'ILogger'. tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClass2.ts(5,18): error TS2339: Property '_information' does not exist on type 'LoggerAdapter'. @@ -9,7 +9,7 @@ tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClass2.ts(5,1 export class LoggerAdapter implements ILogger { ~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~~~ !!! error TS2304: Cannot find name 'ILogger'. constructor (public logger: ILogger) { diff --git a/tests/baselines/reference/parserEnum1.errors.txt b/tests/baselines/reference/parserEnum1.errors.txt index ca89c5fc104..dd8cd23fe2c 100644 --- a/tests/baselines/reference/parserEnum1.errors.txt +++ b/tests/baselines/reference/parserEnum1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum1.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum1.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum1.ts (1 errors) ==== @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum1.ts(3,17) export enum SignatureFlags { ~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. None = 0, IsIndexer = 1, IsStringIndexer = 1 << 1, diff --git a/tests/baselines/reference/parserEnum2.errors.txt b/tests/baselines/reference/parserEnum2.errors.txt index f8a841fd9ba..242b624ad88 100644 --- a/tests/baselines/reference/parserEnum2.errors.txt +++ b/tests/baselines/reference/parserEnum2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum2.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum2.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum2.ts (1 errors) ==== @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum2.ts(3,17) export enum SignatureFlags { ~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. None = 0, IsIndexer = 1, IsStringIndexer = 1 << 1, diff --git a/tests/baselines/reference/parserEnum3.errors.txt b/tests/baselines/reference/parserEnum3.errors.txt index 463f338159a..e0b3691dbde 100644 --- a/tests/baselines/reference/parserEnum3.errors.txt +++ b/tests/baselines/reference/parserEnum3.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum3.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum3.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum3.ts (1 errors) ==== @@ -6,5 +6,5 @@ tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum3.ts(3,17) export enum SignatureFlags { ~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. } \ No newline at end of file diff --git a/tests/baselines/reference/parserEnum4.errors.txt b/tests/baselines/reference/parserEnum4.errors.txt index 9f2cd1d1862..9329b484c92 100644 --- a/tests/baselines/reference/parserEnum4.errors.txt +++ b/tests/baselines/reference/parserEnum4.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum4.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum4.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum4.ts(4,9): error TS1132: Enum member expected. @@ -7,7 +7,7 @@ tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum4.ts(4,9): export enum SignatureFlags { ~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. , ~ !!! error TS1132: Enum member expected. diff --git a/tests/baselines/reference/parserExportAssignment1.errors.txt b/tests/baselines/reference/parserExportAssignment1.errors.txt index cd153319f1a..cb989f655ce 100644 --- a/tests/baselines/reference/parserExportAssignment1.errors.txt +++ b/tests/baselines/reference/parserExportAssignment1.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment1.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment1.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment1.ts(1,10): error TS2304: Cannot find name 'foo'. ==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment1.ts (2 errors) ==== export = foo ~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~ !!! error TS2304: Cannot find name 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/parserExportAssignment2.errors.txt b/tests/baselines/reference/parserExportAssignment2.errors.txt index 60eb0c1f43e..7e7fcbd950f 100644 --- a/tests/baselines/reference/parserExportAssignment2.errors.txt +++ b/tests/baselines/reference/parserExportAssignment2.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment2.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment2.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment2.ts(1,10): error TS2304: Cannot find name 'foo'. ==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment2.ts (2 errors) ==== export = foo; ~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~ !!! error TS2304: Cannot find name 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/parserExportAssignment3.errors.txt b/tests/baselines/reference/parserExportAssignment3.errors.txt index b1e94a27469..5e2ff747e2d 100644 --- a/tests/baselines/reference/parserExportAssignment3.errors.txt +++ b/tests/baselines/reference/parserExportAssignment3.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment3.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment3.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment3.ts(1,9): error TS1109: Expression expected. ==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment3.ts (2 errors) ==== export = ~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. !!! error TS1109: Expression expected. \ No newline at end of file diff --git a/tests/baselines/reference/parserExportAssignment4.errors.txt b/tests/baselines/reference/parserExportAssignment4.errors.txt index 93e311bdb23..10830b9b977 100644 --- a/tests/baselines/reference/parserExportAssignment4.errors.txt +++ b/tests/baselines/reference/parserExportAssignment4.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment4.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment4.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment4.ts(1,10): error TS1109: Expression expected. ==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment4.ts (2 errors) ==== export = ; ~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~ !!! error TS1109: Expression expected. \ No newline at end of file diff --git a/tests/baselines/reference/parserExportAssignment7.errors.txt b/tests/baselines/reference/parserExportAssignment7.errors.txt index 7e54f2a4bce..c4ecd785484 100644 --- a/tests/baselines/reference/parserExportAssignment7.errors.txt +++ b/tests/baselines/reference/parserExportAssignment7.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment7.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment7.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment7.ts(4,1): error TS2309: An export assignment cannot be used in a module with other exported elements. tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment7.ts(4,10): error TS2304: Cannot find name 'B'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignm ==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment7.ts (3 errors) ==== export class C { ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. } export = B; diff --git a/tests/baselines/reference/parserExportAssignment8.errors.txt b/tests/baselines/reference/parserExportAssignment8.errors.txt index 71b37c99db7..39ccc32e495 100644 --- a/tests/baselines/reference/parserExportAssignment8.errors.txt +++ b/tests/baselines/reference/parserExportAssignment8.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment8.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment8.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment8.ts(1,1): error TS2309: An export assignment cannot be used in a module with other exported elements. tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment8.ts(1,10): error TS2304: Cannot find name 'B'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignm ==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment8.ts (3 errors) ==== export = B; ~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~~~~~~~ !!! error TS2309: An export assignment cannot be used in a module with other exported elements. ~ diff --git a/tests/baselines/reference/parserInterfaceDeclaration6.errors.txt b/tests/baselines/reference/parserInterfaceDeclaration6.errors.txt index ab6985c5ab1..6820ecdd48c 100644 --- a/tests/baselines/reference/parserInterfaceDeclaration6.errors.txt +++ b/tests/baselines/reference/parserInterfaceDeclaration6.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration6.ts(1,8): error TS1030: 'export' modifier already seen. -tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration6.ts(1,25): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration6.ts(1,25): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration6.ts (2 errors) ==== @@ -7,5 +7,5 @@ tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterface ~~~~~~ !!! error TS1030: 'export' modifier already seen. ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. } \ No newline at end of file diff --git a/tests/baselines/reference/parserInterfaceDeclaration7.errors.txt b/tests/baselines/reference/parserInterfaceDeclaration7.errors.txt index 344a5d9deb8..ecd59ae29e8 100644 --- a/tests/baselines/reference/parserInterfaceDeclaration7.errors.txt +++ b/tests/baselines/reference/parserInterfaceDeclaration7.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration7.ts(1,18): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration7.ts(1,18): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration7.ts (1 errors) ==== export interface I { ~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. } \ No newline at end of file diff --git a/tests/baselines/reference/parserModifierOnStatementInBlock1.errors.txt b/tests/baselines/reference/parserModifierOnStatementInBlock1.errors.txt index 973920e3584..c73c52ddd35 100644 --- a/tests/baselines/reference/parserModifierOnStatementInBlock1.errors.txt +++ b/tests/baselines/reference/parserModifierOnStatementInBlock1.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock1.ts(1,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock1.ts(1,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock1.ts(2,4): error TS1184: Modifiers cannot appear here. ==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock1.ts (2 errors) ==== export function foo() { ~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. export var x = this; ~~~~~~ !!! error TS1184: Modifiers cannot appear here. diff --git a/tests/baselines/reference/parserModifierOnStatementInBlock3.errors.txt b/tests/baselines/reference/parserModifierOnStatementInBlock3.errors.txt index 7a3fb004225..a480a0c4330 100644 --- a/tests/baselines/reference/parserModifierOnStatementInBlock3.errors.txt +++ b/tests/baselines/reference/parserModifierOnStatementInBlock3.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock3.ts(1,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock3.ts(1,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock3.ts(2,4): error TS1184: Modifiers cannot appear here. ==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock3.ts (2 errors) ==== export function foo() { ~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. export function bar() { ~~~~~~ !!! error TS1184: Modifiers cannot appear here. diff --git a/tests/baselines/reference/parserModule1.errors.txt b/tests/baselines/reference/parserModule1.errors.txt index 3a145493dd9..dc5c9c2dd35 100644 --- a/tests/baselines/reference/parserModule1.errors.txt +++ b/tests/baselines/reference/parserModule1.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/ModuleDeclarations/parserModule1.ts(1,19): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/ModuleDeclarations/parserModule1.ts(1,19): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/parser/ecmascript5/ModuleDeclarations/parserModule1.ts (1 errors) ==== export module CompilerDiagnostics { ~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. export var debug = false; export interface IDiagnosticWriter { Alert(output: string): void; diff --git a/tests/baselines/reference/relativePathToDeclarationFile.errors.txt b/tests/baselines/reference/relativePathToDeclarationFile.errors.txt index 041dd5c3a8f..0431c3a5bfa 100644 --- a/tests/baselines/reference/relativePathToDeclarationFile.errors.txt +++ b/tests/baselines/reference/relativePathToDeclarationFile.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/externalModules/test/foo.d.ts(1,23): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/externalModules/test/foo.d.ts(1,23): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/externalModules/test/file1.ts (0 errors) ==== @@ -13,7 +13,7 @@ tests/cases/conformance/externalModules/test/foo.d.ts(1,23): error TS1148: Canno ==== tests/cases/conformance/externalModules/test/foo.d.ts (1 errors) ==== export declare module M2 { ~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. export var x: boolean; } diff --git a/tests/baselines/reference/reservedWords2.errors.txt b/tests/baselines/reference/reservedWords2.errors.txt index d6e2d04073d..fa89df3af7a 100644 --- a/tests/baselines/reference/reservedWords2.errors.txt +++ b/tests/baselines/reference/reservedWords2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/reservedWords2.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/compiler/reservedWords2.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/compiler/reservedWords2.ts(1,8): error TS1109: Expression expected. tests/cases/compiler/reservedWords2.ts(1,14): error TS1005: '(' expected. tests/cases/compiler/reservedWords2.ts(1,16): error TS2304: Cannot find name 'require'. @@ -35,7 +35,7 @@ tests/cases/compiler/reservedWords2.ts(10,6): error TS1003: Identifier expected. ==== tests/cases/compiler/reservedWords2.ts (32 errors) ==== import while = require("dfdf"); ~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~ !!! error TS1109: Expression expected. ~ diff --git a/tests/baselines/reference/scannerClass2.errors.txt b/tests/baselines/reference/scannerClass2.errors.txt index 74b62602dad..d808f6fdd59 100644 --- a/tests/baselines/reference/scannerClass2.errors.txt +++ b/tests/baselines/reference/scannerClass2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/scanner/ecmascript5/scannerClass2.ts(3,18): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/scanner/ecmascript5/scannerClass2.ts(3,18): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/scanner/ecmascript5/scannerClass2.ts(3,43): error TS2304: Cannot find name 'ILogger'. tests/cases/conformance/scanner/ecmascript5/scannerClass2.ts(4,37): error TS2304: Cannot find name 'ILogger'. tests/cases/conformance/scanner/ecmascript5/scannerClass2.ts(5,18): error TS2339: Property '_information' does not exist on type 'LoggerAdapter'. @@ -9,7 +9,7 @@ tests/cases/conformance/scanner/ecmascript5/scannerClass2.ts(5,18): error TS2339 export class LoggerAdapter implements ILogger { ~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ~~~~~~~ !!! error TS2304: Cannot find name 'ILogger'. constructor (public logger: ILogger) { diff --git a/tests/baselines/reference/scannerEnum1.errors.txt b/tests/baselines/reference/scannerEnum1.errors.txt index 64d7508980f..d0bbf16743c 100644 --- a/tests/baselines/reference/scannerEnum1.errors.txt +++ b/tests/baselines/reference/scannerEnum1.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/scanner/ecmascript5/scannerEnum1.ts(1,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/scanner/ecmascript5/scannerEnum1.ts(1,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/scanner/ecmascript5/scannerEnum1.ts (1 errors) ==== export enum CodeGenTarget { ~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ES3 = 0, ES5 = 1, } \ No newline at end of file diff --git a/tests/baselines/reference/thisInInvalidContextsExternalModule.errors.txt b/tests/baselines/reference/thisInInvalidContextsExternalModule.errors.txt index 2aa474d4cdc..a1afdea661b 100644 --- a/tests/baselines/reference/thisInInvalidContextsExternalModule.errors.txt +++ b/tests/baselines/reference/thisInInvalidContextsExternalModule.errors.txt @@ -5,7 +5,7 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalMod tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(38,25): error TS2507: Type 'any' is not a constructor function type. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(44,9): error TS2332: 'this' cannot be referenced in current location. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(45,9): error TS2332: 'this' cannot be referenced in current location. -tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(48,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(48,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. ==== tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts (8 errors) ==== @@ -72,4 +72,4 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalMod export = this; // Should be an error ~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. \ No newline at end of file +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. \ No newline at end of file diff --git a/tests/baselines/reference/tsxStatelessFunctionComponents2.errors.txt b/tests/baselines/reference/tsxStatelessFunctionComponents2.errors.txt index 49f3ab6bac4..cced3116b5e 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponents2.errors.txt +++ b/tests/baselines/reference/tsxStatelessFunctionComponents2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/jsx/file.tsx(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/jsx/file.tsx(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/jsx/file.tsx(20,16): error TS2339: Property 'ref' does not exist on type 'IntrinsicAttributes & { name?: string; }'. tests/cases/conformance/jsx/file.tsx(26,42): error TS2339: Property 'subtr' does not exist on type 'string'. tests/cases/conformance/jsx/file.tsx(28,33): error TS2339: Property 'notARealProperty' does not exist on type 'BigGreeter'. @@ -9,7 +9,7 @@ tests/cases/conformance/jsx/file.tsx(36,26): error TS2339: Property 'propertyNot import React = require('react'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. function Greet(x: {name?: string}) { return
Hello, {x}
; diff --git a/tests/baselines/reference/typeofANonExportedType.errors.txt b/tests/baselines/reference/typeofANonExportedType.errors.txt index 0fb239f6aee..2399938dcfc 100644 --- a/tests/baselines/reference/typeofANonExportedType.errors.txt +++ b/tests/baselines/reference/typeofANonExportedType.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts(20,12): error TS2323: Cannot redeclare exported variable 'r5'. tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts(21,12): error TS2323: Cannot redeclare exported variable 'r5'. tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts(42,12): error TS2502: 'r12' is referenced directly or indirectly in its own type annotation. @@ -8,7 +8,7 @@ tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType var x = 1; export var r1: typeof x; ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. var y = { foo: '' }; export var r2: typeof y; class C { diff --git a/tests/baselines/reference/typeofAnExportedType.errors.txt b/tests/baselines/reference/typeofAnExportedType.errors.txt index 51dd7cf06b6..9740909bd59 100644 --- a/tests/baselines/reference/typeofAnExportedType.errors.txt +++ b/tests/baselines/reference/typeofAnExportedType.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. +tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts(20,12): error TS2323: Cannot redeclare exported variable 'r5'. tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts(21,12): error TS2323: Cannot redeclare exported variable 'r5'. tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts(42,12): error TS2502: 'r12' is referenced directly or indirectly in its own type annotation. @@ -7,7 +7,7 @@ tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.t ==== tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts (4 errors) ==== export var x = 1; ~~~~~~~~~~~~~~~~~ -!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. +!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. export var r1: typeof x; export var y = { foo: '' }; export var r2: typeof y; diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics2.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics2.ts index 58c02dae183..198c39abe42 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics2.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics2.ts @@ -13,7 +13,7 @@ verify.getSemanticDiagnostics(`[ "code": 8003 }, { - "message": "Cannot compile modules unless the '--module' flag is provided.", + "message": "Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file.", "start": 0, "length": 11, "category": "error", From da009c5b2177f97d44d0c615c8585386ec84b384 Mon Sep 17 00:00:00 2001 From: Zhengbo Li Date: Mon, 7 Dec 2015 22:28:02 -0800 Subject: [PATCH 19/28] update lib.d.ts from TSJS repo --- src/lib/dom.generated.d.ts | 26 +++++++++++++++++++++++--- src/lib/webworker.generated.d.ts | 17 ++++++++++++++--- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/src/lib/dom.generated.d.ts b/src/lib/dom.generated.d.ts index 5984505c4cf..0dff2cedc39 100644 --- a/src/lib/dom.generated.d.ts +++ b/src/lib/dom.generated.d.ts @@ -6923,7 +6923,7 @@ interface IDBDatabase extends EventTarget { onerror: (ev: Event) => any; version: string; close(): void; - createObjectStore(name: string, optionalParameters?: any): IDBObjectStore; + createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; deleteObjectStore(name: string): void; transaction(storeNames: any, mode?: string): IDBTransaction; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -6948,10 +6948,11 @@ declare var IDBFactory: { } interface IDBIndex { - keyPath: string; + keyPath: string | string[]; name: string; objectStore: IDBObjectStore; unique: boolean; + multiEntry: boolean; count(key?: any): IDBRequest; get(key: any): IDBRequest; getKey(key: any): IDBRequest; @@ -6988,7 +6989,7 @@ interface IDBObjectStore { add(value: any, key?: any): IDBRequest; clear(): IDBRequest; count(key?: any): IDBRequest; - createIndex(name: string, keyPath: string, optionalParameters?: any): IDBIndex; + createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; delete(key: any): IDBRequest; deleteIndex(indexName: string): void; get(key: any): IDBRequest; @@ -12575,6 +12576,16 @@ interface XMLHttpRequestEventTarget { addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } +interface IDBObjectStoreParameters { + keyPath?: string | string[]; + autoIncrement?: boolean; +} + +interface IDBIndexParameters { + unique?: boolean; + multiEntry?: boolean; +} + interface NodeListOf extends NodeList { length: number; item(index: number): TNode; @@ -12610,6 +12621,15 @@ interface ProgressEventInit extends EventInit { total?: number; } +interface HTMLTemplateElement extends HTMLElement { + content: DocumentFragment; +} + +declare var HTMLTemplateElement: { + prototype: HTMLTemplateElement; + new(): HTMLTemplateElement; +} + declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; interface ErrorEventHandler { diff --git a/src/lib/webworker.generated.d.ts b/src/lib/webworker.generated.d.ts index 8001511a98b..a1d87f79787 100644 --- a/src/lib/webworker.generated.d.ts +++ b/src/lib/webworker.generated.d.ts @@ -311,7 +311,7 @@ interface IDBDatabase extends EventTarget { onerror: (ev: Event) => any; version: string; close(): void; - createObjectStore(name: string, optionalParameters?: any): IDBObjectStore; + createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; deleteObjectStore(name: string): void; transaction(storeNames: any, mode?: string): IDBTransaction; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -336,10 +336,11 @@ declare var IDBFactory: { } interface IDBIndex { - keyPath: string; + keyPath: string | string[]; name: string; objectStore: IDBObjectStore; unique: boolean; + multiEntry: boolean; count(key?: any): IDBRequest; get(key: any): IDBRequest; getKey(key: any): IDBRequest; @@ -376,7 +377,7 @@ interface IDBObjectStore { add(value: any, key?: any): IDBRequest; clear(): IDBRequest; count(key?: any): IDBRequest; - createIndex(name: string, keyPath: string, optionalParameters?: any): IDBIndex; + createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; delete(key: any): IDBRequest; deleteIndex(indexName: string): void; get(key: any): IDBRequest; @@ -892,6 +893,16 @@ interface WorkerUtils extends Object, WindowBase64 { setTimeout(handler: any, timeout?: any, ...args: any[]): number; } +interface IDBObjectStoreParameters { + keyPath?: string | string[]; + autoIncrement?: boolean; +} + +interface IDBIndexParameters { + unique?: boolean; + multiEntry?: boolean; +} + interface BlobPropertyBag { type?: string; endings?: string; From 34b303a9c5caad182f0fafd5b60302333bcd4dce Mon Sep 17 00:00:00 2001 From: SaschaNaz Date: Tue, 8 Dec 2015 21:39:46 +0900 Subject: [PATCH 20/28] directly expose nodeWillIndentChild --- src/services/formatting/formatting.ts | 3 ++- src/services/formatting/smartIndenter.ts | 26 +++++++----------------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index ee47e4fc98e..55adb7b7233 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -496,7 +496,8 @@ namespace ts.formatting { } function getEffectiveDelta(delta: number, child: TextRangeWithKind) { - return SmartIndenter.shouldInheritParentIndentation(node, child) ? 0 : delta; + // Delta value should be zero when the node explicitly prevents indentation of the child node + return SmartIndenter.nodeWillIndentChild(node, child, true) ? delta : 0; } } diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index 83ef1df7144..9ede3691fc0 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -465,11 +465,8 @@ namespace ts.formatting { } return false; } - - /** - * Function returns true when a node with conditional indentation rule will indent certain child node - */ - function nodeWillIndentChild(parent: TextRangeWithKind, child: TextRangeWithKind, indentByDefault: boolean) { + + export function nodeWillIndentChild(parent: TextRangeWithKind, child: TextRangeWithKind, indentByDefault: boolean) { let childKind = child ? child.kind : SyntaxKind.Unknown; switch (parent.kind) { case SyntaxKind.DoStatement: @@ -487,24 +484,15 @@ namespace ts.formatting { case SyntaxKind.SetAccessor: return childKind !== SyntaxKind.Block; } - // No explicit rule for selected nodes, so result will follow the default value argument + // No explicit rule for given nodes so the result will follow the default value argument return indentByDefault; } + /* + Function returns true when the parent node should indent the given child by an explicit rule + */ export function shouldIndentChildNode(parent: TextRangeWithKind, child?: TextRangeWithKind): boolean { - if (nodeContentIsAlwaysIndented(parent.kind)) { - return true; - } - return nodeWillIndentChild(parent, child, false); - } - - /** - * Function returns true if existing node content indentation should be suppressed for a specific child - */ - export function shouldInheritParentIndentation(parent: TextRangeWithKind, child: TextRangeWithKind): boolean { - // Consider parents without indentation rules can indent their children - // so that they can apply inherited delta value to them - return !nodeWillIndentChild(parent, child, true); + return nodeContentIsAlwaysIndented(parent.kind) || nodeWillIndentChild(parent, child, false); } } } From 595f134e8bbfe5bf8ce93387a1a7ec2991ce7f0f Mon Sep 17 00:00:00 2001 From: SaschaNaz Date: Wed, 9 Dec 2015 00:02:10 +0900 Subject: [PATCH 21/28] space around arrow --- src/services/formatting/rules.ts | 14 +++++++------- .../cases/fourslash/formattingFatArrowFunctions.ts | 5 ++++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 12efb774dd3..de4761f57d2 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -123,6 +123,7 @@ namespace ts.formatting { public SpaceAfterModuleName: Rule; // Lambda expressions + public SpaceBeforeArrow: Rule; public SpaceAfterArrow: Rule; // Optional parameters and let args @@ -254,7 +255,7 @@ namespace ts.formatting { // No space before and after indexer this.NoSpaceBeforeOpenBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); - this.NoSpaceAfterCloseBracket = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext ), RuleAction.Delete)); + this.NoSpaceAfterCloseBracket = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), RuleAction.Delete)); // Place a space before open brace in a function declaration this.FunctionOpenBraceLeftTokenRange = Shared.TokenRange.AnyIncludingMultilineComments; @@ -342,6 +343,7 @@ namespace ts.formatting { this.SpaceAfterModuleName = new Rule(RuleDescriptor.create1(SyntaxKind.StringLiteral, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsModuleDeclContext), RuleAction.Space)); // Lambda expressions + this.SpaceBeforeArrow = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.EqualsGreaterThanToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); this.SpaceAfterArrow = new Rule(RuleDescriptor.create3(SyntaxKind.EqualsGreaterThanToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); // Optional parameters and let args @@ -379,8 +381,7 @@ namespace ts.formatting { this.NoSpaceBeforeTemplateMiddleAndTail = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.TemplateMiddle, SyntaxKind.TemplateTail])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); // These rules are higher in priority than user-configurable rules. - this.HighPriorityCommonRules = - [ + this.HighPriorityCommonRules = [ this.IgnoreBeforeComment, this.IgnoreAfterLineComment, this.NoSpaceBeforeColon, this.SpaceAfterColon, this.NoSpaceBeforeQuestionMark, this.SpaceAfterQuestionMarkInConditionalOperator, this.NoSpaceAfterQuestionMark, @@ -411,7 +412,7 @@ namespace ts.formatting { this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, this.SpaceAfterModuleName, - this.SpaceAfterArrow, + this.SpaceBeforeArrow, this.SpaceAfterArrow, this.NoSpaceAfterEllipsis, this.NoSpaceAfterOptionalParameters, this.NoSpaceBetweenEmptyInterfaceBraceBrackets, @@ -427,8 +428,7 @@ namespace ts.formatting { ]; // These rules are lower in priority than user-configurable rules. - this.LowPriorityCommonRules = - [ + this.LowPriorityCommonRules = [ this.NoSpaceBeforeSemicolon, this.SpaceBeforeOpenBraceInControl, this.SpaceBeforeOpenBraceInFunction, this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, this.NoSpaceBeforeComma, @@ -732,7 +732,7 @@ namespace ts.formatting { } static IsStartOfVariableDeclarationList(context: FormattingContext): boolean { - return context.currentTokenParent.kind === SyntaxKind.VariableDeclarationList && + return context.currentTokenParent.kind === SyntaxKind.VariableDeclarationList && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; } diff --git a/tests/cases/fourslash/formattingFatArrowFunctions.ts b/tests/cases/fourslash/formattingFatArrowFunctions.ts index c540c2837e1..d4ce38dbd62 100644 --- a/tests/cases/fourslash/formattingFatArrowFunctions.ts +++ b/tests/cases/fourslash/formattingFatArrowFunctions.ts @@ -4,6 +4,7 @@ //// ( ) => 1 ;/*1*/ //// ( arg ) => 2 ;/*2*/ //// arg => 2 ;/*3*/ +//// arg=>2 ;/*3a*/ //// ( arg = 1 ) => 3 ;/*4*/ //// ( arg ? ) => 4 ;/*5*/ //// ( arg : number ) => 5 ;/*6*/ @@ -118,7 +119,9 @@ verify.currentLineContentIs("() => 1;"); goTo.marker("2"); verify.currentLineContentIs("(arg) => 2;"); goTo.marker("3"); -verify.currentLineContentIs("arg => 2;"); +verify.currentLineContentIs("arg => 2;"); +goTo.marker("3a"); +verify.currentLineContentIs("arg => 2;"); goTo.marker("4"); verify.currentLineContentIs("(arg = 1) => 3;"); goTo.marker("5"); From 51c547428b6ae3534af891610e12518a83bae462 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Tue, 8 Dec 2015 09:53:47 -0800 Subject: [PATCH 22/28] Parse JSX attributes as AssignmentExpressions We should issue an error when parsing `
` as the comma operator is not a legal production in a JSX Expression Fixes (mitigates?) bug #5991 --- src/compiler/parser.ts | 2 +- .../reference/jsxParsingError1.errors.txt | 25 +++++++++++++++++++ tests/baselines/reference/jsxParsingError1.js | 21 ++++++++++++++++ .../conformance/jsx/jsxParsingError1.tsx | 14 +++++++++++ 4 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/jsxParsingError1.errors.txt create mode 100644 tests/baselines/reference/jsxParsingError1.js create mode 100644 tests/cases/conformance/jsx/jsxParsingError1.tsx diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index e4262458d30..a6e1c03db25 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -3639,7 +3639,7 @@ namespace ts { parseExpected(SyntaxKind.OpenBraceToken); if (token !== SyntaxKind.CloseBraceToken) { - node.expression = parseExpression(); + node.expression = parseAssignmentExpressionOrHigher(); } if (inExpressionContext) { parseExpected(SyntaxKind.CloseBraceToken); diff --git a/tests/baselines/reference/jsxParsingError1.errors.txt b/tests/baselines/reference/jsxParsingError1.errors.txt new file mode 100644 index 00000000000..e769947dfa6 --- /dev/null +++ b/tests/baselines/reference/jsxParsingError1.errors.txt @@ -0,0 +1,25 @@ +tests/cases/conformance/jsx/file.tsx(12,36): error TS1005: '}' expected. +tests/cases/conformance/jsx/file.tsx(12,44): error TS1003: Identifier expected. +tests/cases/conformance/jsx/file.tsx(12,46): error TS1161: Unterminated regular expression literal. + + +==== tests/cases/conformance/jsx/file.tsx (3 errors) ==== + + declare module JSX { + interface Element { } + interface IntrinsicElements { + [s: string]: any; + } + } + + // This should be a parse error + const class1 = "foo"; + const class2 = "bar"; + const elem =
; + ~ +!!! error TS1005: '}' expected. + ~ +!!! error TS1003: Identifier expected. + +!!! error TS1161: Unterminated regular expression literal. + \ No newline at end of file diff --git a/tests/baselines/reference/jsxParsingError1.js b/tests/baselines/reference/jsxParsingError1.js new file mode 100644 index 00000000000..14b60afdde8 --- /dev/null +++ b/tests/baselines/reference/jsxParsingError1.js @@ -0,0 +1,21 @@ +//// [file.tsx] + +declare module JSX { + interface Element { } + interface IntrinsicElements { + [s: string]: any; + } +} + +// This should be a parse error +const class1 = "foo"; +const class2 = "bar"; +const elem =
; + + +//// [file.jsx] +// This should be a parse error +var class1 = "foo"; +var class2 = "bar"; +var elem =
; +/>;; diff --git a/tests/cases/conformance/jsx/jsxParsingError1.tsx b/tests/cases/conformance/jsx/jsxParsingError1.tsx new file mode 100644 index 00000000000..2668f04e885 --- /dev/null +++ b/tests/cases/conformance/jsx/jsxParsingError1.tsx @@ -0,0 +1,14 @@ +//@jsx: preserve + +//@filename: file.tsx +declare module JSX { + interface Element { } + interface IntrinsicElements { + [s: string]: any; + } +} + +// This should be a parse error +const class1 = "foo"; +const class2 = "bar"; +const elem =
; From 92d7d1c9536f1b02ae50f2ace609f5c1e627ac16 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Tue, 8 Dec 2015 10:11:29 -0800 Subject: [PATCH 23/28] Disallow modifiers in object literal property assignment Fixes bug #5994 --- src/compiler/checker.ts | 5 ++++ src/compiler/parser.ts | 1 + .../modifiersInObjectLiterals.errors.txt | 24 +++++++++++++++++++ .../reference/modifiersInObjectLiterals.js | 19 +++++++++++++++ .../compiler/modifiersInObjectLiterals.ts | 8 +++++++ 5 files changed, 57 insertions(+) create mode 100644 tests/baselines/reference/modifiersInObjectLiterals.errors.txt create mode 100644 tests/baselines/reference/modifiersInObjectLiterals.js create mode 100644 tests/cases/compiler/modifiersInObjectLiterals.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 30d4818592b..9b694d9084e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -15969,6 +15969,11 @@ namespace ts { return grammarErrorOnNode((prop).equalsToken, Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); } + // Modifiers cannot appear in property assignments + if (prop.modifiers && prop.modifiers.length > 0) { + grammarErrorOnNode(prop.modifiers[0], Diagnostics.Modifiers_cannot_appear_here); + } + // ECMA-262 11.1.5 Object Initialiser // If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true // a.This production is contained in strict code and IsDataDescriptor(previous) is true and diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index e4262458d30..ad108fe4115 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -3981,6 +3981,7 @@ namespace ts { } else { const propertyAssignment = createNode(SyntaxKind.PropertyAssignment, fullStart); + propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; parseExpected(SyntaxKind.ColonToken); diff --git a/tests/baselines/reference/modifiersInObjectLiterals.errors.txt b/tests/baselines/reference/modifiersInObjectLiterals.errors.txt new file mode 100644 index 00000000000..c23a8c3c630 --- /dev/null +++ b/tests/baselines/reference/modifiersInObjectLiterals.errors.txt @@ -0,0 +1,24 @@ +tests/cases/compiler/modifiersInObjectLiterals.ts(2,2): error TS1184: Modifiers cannot appear here. +tests/cases/compiler/modifiersInObjectLiterals.ts(3,2): error TS1184: Modifiers cannot appear here. +tests/cases/compiler/modifiersInObjectLiterals.ts(4,2): error TS1184: Modifiers cannot appear here. +tests/cases/compiler/modifiersInObjectLiterals.ts(5,2): error TS1184: Modifiers cannot appear here. + + +==== tests/cases/compiler/modifiersInObjectLiterals.ts (4 errors) ==== + let data = { + public foo: 'hey', + ~~~~~~ +!!! error TS1184: Modifiers cannot appear here. + private bar: 'nay', + ~~~~~~~ +!!! error TS1184: Modifiers cannot appear here. + protected baz: 'oh my', + ~~~~~~~~~ +!!! error TS1184: Modifiers cannot appear here. + abstract noWay: 'yes' + ~~~~~~~~ +!!! error TS1184: Modifiers cannot appear here. + }; + + data.foo + data.bar + data.baz + data.noWay + \ No newline at end of file diff --git a/tests/baselines/reference/modifiersInObjectLiterals.js b/tests/baselines/reference/modifiersInObjectLiterals.js new file mode 100644 index 00000000000..0a59b13c21e --- /dev/null +++ b/tests/baselines/reference/modifiersInObjectLiterals.js @@ -0,0 +1,19 @@ +//// [modifiersInObjectLiterals.ts] +let data = { + public foo: 'hey', + private bar: 'nay', + protected baz: 'oh my', + abstract noWay: 'yes' +}; + +data.foo + data.bar + data.baz + data.noWay + + +//// [modifiersInObjectLiterals.js] +var data = { + foo: 'hey', + bar: 'nay', + baz: 'oh my', + noWay: 'yes' +}; +data.foo + data.bar + data.baz + data.noWay; diff --git a/tests/cases/compiler/modifiersInObjectLiterals.ts b/tests/cases/compiler/modifiersInObjectLiterals.ts new file mode 100644 index 00000000000..58fa64f82e9 --- /dev/null +++ b/tests/cases/compiler/modifiersInObjectLiterals.ts @@ -0,0 +1,8 @@ +let data = { + public foo: 'hey', + private bar: 'nay', + protected baz: 'oh my', + abstract noWay: 'yes' +}; + +data.foo + data.bar + data.baz + data.noWay From 964fbea9c110faa384edec3f45ea1d5caff8c1a4 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Tue, 8 Dec 2015 10:57:33 -0800 Subject: [PATCH 24/28] Fix up for 'async' --- src/compiler/checker.ts | 11 ++++++++--- .../modifiersInObjectLiterals.errors.txt | 16 ++++++++-------- .../objectLiteralMemberWithModifiers1.errors.txt | 5 ++++- .../objectLiteralMemberWithModifiers2.errors.txt | 5 ++++- .../reference/parserAccessors10.errors.txt | 5 ++++- 5 files changed, 28 insertions(+), 14 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 9b694d9084e..6b25b47d26c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -15970,9 +15970,14 @@ namespace ts { } // Modifiers cannot appear in property assignments - if (prop.modifiers && prop.modifiers.length > 0) { - grammarErrorOnNode(prop.modifiers[0], Diagnostics.Modifiers_cannot_appear_here); - } + forEach(prop.modifiers, mod => { + if (mod.kind !== SyntaxKind.AsyncKeyword) { + grammarErrorOnNode(mod, Diagnostics._0_modifier_cannot_be_used_here, getTextOfNode(mod)); + } + else if (prop.kind !== SyntaxKind.MethodDeclaration) { + grammarErrorOnNode(mod, Diagnostics._0_modifier_cannot_be_used_here, getTextOfNode(mod)); + } + }); // ECMA-262 11.1.5 Object Initialiser // If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true diff --git a/tests/baselines/reference/modifiersInObjectLiterals.errors.txt b/tests/baselines/reference/modifiersInObjectLiterals.errors.txt index c23a8c3c630..25382123390 100644 --- a/tests/baselines/reference/modifiersInObjectLiterals.errors.txt +++ b/tests/baselines/reference/modifiersInObjectLiterals.errors.txt @@ -1,23 +1,23 @@ -tests/cases/compiler/modifiersInObjectLiterals.ts(2,2): error TS1184: Modifiers cannot appear here. -tests/cases/compiler/modifiersInObjectLiterals.ts(3,2): error TS1184: Modifiers cannot appear here. -tests/cases/compiler/modifiersInObjectLiterals.ts(4,2): error TS1184: Modifiers cannot appear here. -tests/cases/compiler/modifiersInObjectLiterals.ts(5,2): error TS1184: Modifiers cannot appear here. +tests/cases/compiler/modifiersInObjectLiterals.ts(2,2): error TS1042: 'public' modifier cannot be used here. +tests/cases/compiler/modifiersInObjectLiterals.ts(3,2): error TS1042: 'private' modifier cannot be used here. +tests/cases/compiler/modifiersInObjectLiterals.ts(4,2): error TS1042: 'protected' modifier cannot be used here. +tests/cases/compiler/modifiersInObjectLiterals.ts(5,2): error TS1042: 'abstract' modifier cannot be used here. ==== tests/cases/compiler/modifiersInObjectLiterals.ts (4 errors) ==== let data = { public foo: 'hey', ~~~~~~ -!!! error TS1184: Modifiers cannot appear here. +!!! error TS1042: 'public' modifier cannot be used here. private bar: 'nay', ~~~~~~~ -!!! error TS1184: Modifiers cannot appear here. +!!! error TS1042: 'private' modifier cannot be used here. protected baz: 'oh my', ~~~~~~~~~ -!!! error TS1184: Modifiers cannot appear here. +!!! error TS1042: 'protected' modifier cannot be used here. abstract noWay: 'yes' ~~~~~~~~ -!!! error TS1184: Modifiers cannot appear here. +!!! error TS1042: 'abstract' modifier cannot be used here. }; data.foo + data.bar + data.baz + data.noWay diff --git a/tests/baselines/reference/objectLiteralMemberWithModifiers1.errors.txt b/tests/baselines/reference/objectLiteralMemberWithModifiers1.errors.txt index 9e739194f54..182eab1b4cf 100644 --- a/tests/baselines/reference/objectLiteralMemberWithModifiers1.errors.txt +++ b/tests/baselines/reference/objectLiteralMemberWithModifiers1.errors.txt @@ -1,7 +1,10 @@ +tests/cases/compiler/objectLiteralMemberWithModifiers1.ts(1,11): error TS1042: 'public' modifier cannot be used here. tests/cases/compiler/objectLiteralMemberWithModifiers1.ts(1,11): error TS1184: Modifiers cannot appear here. -==== tests/cases/compiler/objectLiteralMemberWithModifiers1.ts (1 errors) ==== +==== tests/cases/compiler/objectLiteralMemberWithModifiers1.ts (2 errors) ==== var v = { public foo() { } } ~~~~~~ +!!! error TS1042: 'public' modifier cannot be used here. + ~~~~~~ !!! error TS1184: Modifiers cannot appear here. \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralMemberWithModifiers2.errors.txt b/tests/baselines/reference/objectLiteralMemberWithModifiers2.errors.txt index be2bea5e241..0d1822339b6 100644 --- a/tests/baselines/reference/objectLiteralMemberWithModifiers2.errors.txt +++ b/tests/baselines/reference/objectLiteralMemberWithModifiers2.errors.txt @@ -1,9 +1,12 @@ +tests/cases/compiler/objectLiteralMemberWithModifiers2.ts(1,11): error TS1042: 'public' modifier cannot be used here. tests/cases/compiler/objectLiteralMemberWithModifiers2.ts(1,22): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/objectLiteralMemberWithModifiers2.ts(1,22): error TS2378: A 'get' accessor must return a value. -==== tests/cases/compiler/objectLiteralMemberWithModifiers2.ts (2 errors) ==== +==== tests/cases/compiler/objectLiteralMemberWithModifiers2.ts (3 errors) ==== var v = { public get foo() { } } + ~~~~~~ +!!! error TS1042: 'public' modifier cannot be used here. ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ diff --git a/tests/baselines/reference/parserAccessors10.errors.txt b/tests/baselines/reference/parserAccessors10.errors.txt index d6a2b99eaca..b309b5e3947 100644 --- a/tests/baselines/reference/parserAccessors10.errors.txt +++ b/tests/baselines/reference/parserAccessors10.errors.txt @@ -1,9 +1,12 @@ +tests/cases/conformance/parser/ecmascript5/Accessors/parserAccessors10.ts(2,3): error TS1042: 'public' modifier cannot be used here. tests/cases/conformance/parser/ecmascript5/Accessors/parserAccessors10.ts(2,14): error TS2378: A 'get' accessor must return a value. -==== tests/cases/conformance/parser/ecmascript5/Accessors/parserAccessors10.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Accessors/parserAccessors10.ts (2 errors) ==== var v = { public get foo() { } + ~~~~~~ +!!! error TS1042: 'public' modifier cannot be used here. ~~~ !!! error TS2378: A 'get' accessor must return a value. }; \ No newline at end of file From f3e4befc3efac6ba80c4fa5d2d918a123635edc4 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Tue, 8 Dec 2015 13:28:55 -0800 Subject: [PATCH 25/28] merge with master --- src/compiler/checker.ts | 2 ++ tests/baselines/reference/exportStarForValues.js | 2 ++ tests/baselines/reference/exportStarForValues10.js | 3 +++ tests/baselines/reference/exportStarForValues2.js | 3 +++ tests/baselines/reference/exportStarForValues3.js | 5 +++++ tests/baselines/reference/exportStarForValues4.js | 3 +++ tests/baselines/reference/exportStarForValues5.js | 2 ++ tests/baselines/reference/exportStarForValues6.js | 2 ++ tests/baselines/reference/exportStarForValues7.js | 3 +++ tests/baselines/reference/exportStarForValues8.js | 5 +++++ tests/baselines/reference/exportStarForValues9.js | 3 +++ tests/baselines/reference/exportStarForValuesInSystem.js | 2 ++ 12 files changed, 35 insertions(+) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 50fdd87e31d..777a25a4c12 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -15025,6 +15025,8 @@ namespace ts { } const hasExportAssignment = getExportAssignmentSymbol(moduleSymbol) !== undefined; + // if module has export assignment then 'resolveExternalModuleSymbol' will return resolved symbol for export assignment + // otherwise it will return moduleSymbol itself moduleSymbol = resolveExternalModuleSymbol(moduleSymbol); const symbolLinks = getSymbolLinks(moduleSymbol); diff --git a/tests/baselines/reference/exportStarForValues.js b/tests/baselines/reference/exportStarForValues.js index bd82373d52a..dd432ecc1d3 100644 --- a/tests/baselines/reference/exportStarForValues.js +++ b/tests/baselines/reference/exportStarForValues.js @@ -10,8 +10,10 @@ var x; //// [file1.js] define(["require", "exports"], function (require, exports) { + "use strict"; }); //// [file2.js] define(["require", "exports"], function (require, exports) { + "use strict"; var x; }); diff --git a/tests/baselines/reference/exportStarForValues10.js b/tests/baselines/reference/exportStarForValues10.js index 781316cb8f9..dca5dad9b7a 100644 --- a/tests/baselines/reference/exportStarForValues10.js +++ b/tests/baselines/reference/exportStarForValues10.js @@ -14,6 +14,7 @@ var x = 1; //// [file0.js] System.register([], function(exports_1) { + "use strict"; var v; return { setters:[], @@ -24,6 +25,7 @@ System.register([], function(exports_1) { }); //// [file1.js] System.register([], function(exports_1) { + "use strict"; return { setters:[], execute: function() { @@ -32,6 +34,7 @@ System.register([], function(exports_1) { }); //// [file2.js] System.register(["file0"], function(exports_1) { + "use strict"; var x; function exportStar_1(m) { var exports = {}; diff --git a/tests/baselines/reference/exportStarForValues2.js b/tests/baselines/reference/exportStarForValues2.js index 3d6b24ae433..e45d5bdd3ba 100644 --- a/tests/baselines/reference/exportStarForValues2.js +++ b/tests/baselines/reference/exportStarForValues2.js @@ -14,12 +14,15 @@ var x = 1; //// [file1.js] define(["require", "exports"], function (require, exports) { + "use strict"; }); //// [file2.js] define(["require", "exports"], function (require, exports) { + "use strict"; var x = 1; }); //// [file3.js] define(["require", "exports"], function (require, exports) { + "use strict"; var x = 1; }); diff --git a/tests/baselines/reference/exportStarForValues3.js b/tests/baselines/reference/exportStarForValues3.js index c5136e57eef..9efe5ccf8e5 100644 --- a/tests/baselines/reference/exportStarForValues3.js +++ b/tests/baselines/reference/exportStarForValues3.js @@ -26,20 +26,25 @@ var x = 1; //// [file1.js] define(["require", "exports"], function (require, exports) { + "use strict"; }); //// [file2.js] define(["require", "exports"], function (require, exports) { + "use strict"; var x = 1; }); //// [file3.js] define(["require", "exports"], function (require, exports) { + "use strict"; var x = 1; }); //// [file4.js] define(["require", "exports"], function (require, exports) { + "use strict"; var x = 1; }); //// [file5.js] define(["require", "exports"], function (require, exports) { + "use strict"; var x = 1; }); diff --git a/tests/baselines/reference/exportStarForValues4.js b/tests/baselines/reference/exportStarForValues4.js index 2e7b84a6c2f..34b13bb00f3 100644 --- a/tests/baselines/reference/exportStarForValues4.js +++ b/tests/baselines/reference/exportStarForValues4.js @@ -18,12 +18,15 @@ var x = 1; //// [file1.js] define(["require", "exports"], function (require, exports) { + "use strict"; }); //// [file3.js] define(["require", "exports"], function (require, exports) { + "use strict"; var x = 1; }); //// [file2.js] define(["require", "exports"], function (require, exports) { + "use strict"; var x = 1; }); diff --git a/tests/baselines/reference/exportStarForValues5.js b/tests/baselines/reference/exportStarForValues5.js index 48caf8bdb85..dc4d4c8b68e 100644 --- a/tests/baselines/reference/exportStarForValues5.js +++ b/tests/baselines/reference/exportStarForValues5.js @@ -10,7 +10,9 @@ export var x; //// [file1.js] define(["require", "exports"], function (require, exports) { + "use strict"; }); //// [file2.js] define(["require", "exports"], function (require, exports) { + "use strict"; }); diff --git a/tests/baselines/reference/exportStarForValues6.js b/tests/baselines/reference/exportStarForValues6.js index e393ad3fe7e..69357d87ee0 100644 --- a/tests/baselines/reference/exportStarForValues6.js +++ b/tests/baselines/reference/exportStarForValues6.js @@ -10,6 +10,7 @@ export var x = 1; //// [file1.js] System.register([], function(exports_1) { + "use strict"; return { setters:[], execute: function() { @@ -18,6 +19,7 @@ System.register([], function(exports_1) { }); //// [file2.js] System.register([], function(exports_1) { + "use strict"; var x; return { setters:[], diff --git a/tests/baselines/reference/exportStarForValues7.js b/tests/baselines/reference/exportStarForValues7.js index 1e249f45906..39a152fdc89 100644 --- a/tests/baselines/reference/exportStarForValues7.js +++ b/tests/baselines/reference/exportStarForValues7.js @@ -14,13 +14,16 @@ export var x = 1; //// [file1.js] define(["require", "exports"], function (require, exports) { + "use strict"; }); //// [file2.js] define(["require", "exports"], function (require, exports) { + "use strict"; exports.x = 1; }); //// [file3.js] define(["require", "exports", "file2"], function (require, exports, file2_1) { + "use strict"; function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } diff --git a/tests/baselines/reference/exportStarForValues8.js b/tests/baselines/reference/exportStarForValues8.js index aca678ddd17..f8e7678a40c 100644 --- a/tests/baselines/reference/exportStarForValues8.js +++ b/tests/baselines/reference/exportStarForValues8.js @@ -26,17 +26,21 @@ export var x = 1; //// [file1.js] define(["require", "exports"], function (require, exports) { + "use strict"; }); //// [file2.js] define(["require", "exports"], function (require, exports) { + "use strict"; exports.x = 1; }); //// [file3.js] define(["require", "exports"], function (require, exports) { + "use strict"; exports.x = 1; }); //// [file4.js] define(["require", "exports", "file2", "file3"], function (require, exports, file2_1, file3_1) { + "use strict"; function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } @@ -46,6 +50,7 @@ define(["require", "exports", "file2", "file3"], function (require, exports, fil }); //// [file5.js] define(["require", "exports", "file4"], function (require, exports, file4_1) { + "use strict"; function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } diff --git a/tests/baselines/reference/exportStarForValues9.js b/tests/baselines/reference/exportStarForValues9.js index 76758d8a2a0..e057e4d4027 100644 --- a/tests/baselines/reference/exportStarForValues9.js +++ b/tests/baselines/reference/exportStarForValues9.js @@ -18,9 +18,11 @@ export var x = 1; //// [file1.js] define(["require", "exports"], function (require, exports) { + "use strict"; }); //// [file3.js] define(["require", "exports", "file2"], function (require, exports, file2_1) { + "use strict"; function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } @@ -29,6 +31,7 @@ define(["require", "exports", "file2"], function (require, exports, file2_1) { }); //// [file2.js] define(["require", "exports", "file3"], function (require, exports, file3_1) { + "use strict"; function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } diff --git a/tests/baselines/reference/exportStarForValuesInSystem.js b/tests/baselines/reference/exportStarForValuesInSystem.js index 29b839731a8..a33465f7e2e 100644 --- a/tests/baselines/reference/exportStarForValuesInSystem.js +++ b/tests/baselines/reference/exportStarForValuesInSystem.js @@ -10,6 +10,7 @@ var x = 1; //// [file1.js] System.register([], function(exports_1) { + "use strict"; return { setters:[], execute: function() { @@ -18,6 +19,7 @@ System.register([], function(exports_1) { }); //// [file2.js] System.register([], function(exports_1) { + "use strict"; var x; return { setters:[], From 378e5c39417721f0bb92d984c17130db54ee7bd5 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 8 Dec 2015 13:55:59 -0800 Subject: [PATCH 26/28] Add full path to spec md file in generate-spec target --- Jakefile.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jakefile.js b/Jakefile.js index 398b897097d..beb16d2886f 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -544,7 +544,8 @@ compileFile(word2mdJs, // The generated spec.md; built for the 'generate-spec' task file(specMd, [word2mdJs, specWord], function () { var specWordFullPath = path.resolve(specWord); - var cmd = "cscript //nologo " + word2mdJs + ' "' + specWordFullPath + '" ' + specMd; + var specMDFullPath = path.resolve(specMd); + var cmd = "cscript //nologo " + word2mdJs + ' "' + specWordFullPath + '" ' + '"' + specMDFullPath + '"'; console.log(cmd); child_process.exec(cmd, function () { complete(); From 58427c4d18fe64b849f0ef73945ddbf2e2cb28b1 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Tue, 8 Dec 2015 16:59:52 -0800 Subject: [PATCH 27/28] Use logic for win --- src/compiler/checker.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 6b25b47d26c..53900f90ffa 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -15971,10 +15971,7 @@ namespace ts { // Modifiers cannot appear in property assignments forEach(prop.modifiers, mod => { - if (mod.kind !== SyntaxKind.AsyncKeyword) { - grammarErrorOnNode(mod, Diagnostics._0_modifier_cannot_be_used_here, getTextOfNode(mod)); - } - else if (prop.kind !== SyntaxKind.MethodDeclaration) { + if (mod.kind !== SyntaxKind.AsyncKeyword || prop.kind !== SyntaxKind.MethodDeclaration) { grammarErrorOnNode(mod, Diagnostics._0_modifier_cannot_be_used_here, getTextOfNode(mod)); } }); From d3c98155266cf5257600d3d2df8c31e5df1b66e2 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Tue, 8 Dec 2015 17:37:38 -0800 Subject: [PATCH 28/28] Improve comment --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 53900f90ffa..ceadceab20f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -15969,7 +15969,7 @@ namespace ts { return grammarErrorOnNode((prop).equalsToken, Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); } - // Modifiers cannot appear in property assignments + // Modifiers are never allowed on properties except for 'async' on a method declaration forEach(prop.modifiers, mod => { if (mod.kind !== SyntaxKind.AsyncKeyword || prop.kind !== SyntaxKind.MethodDeclaration) { grammarErrorOnNode(mod, Diagnostics._0_modifier_cannot_be_used_here, getTextOfNode(mod));