diff --git a/scripts/VSDevMode.ps1 b/scripts/VSDevMode.ps1 index 21cc1f48ac1..df34c9e7787 100644 --- a/scripts/VSDevMode.ps1 +++ b/scripts/VSDevMode.ps1 @@ -37,12 +37,38 @@ if(!(Test-Path $tsRegKey)){ } if($tsScript -ne ""){ - if(!(Test-Path $tsScript)){ - Throw "Could not locate the TypeScript language service script at ${tsScript}" + $tsScriptServices = "${tsScript}\typescriptServices.js" + $tsScriptlib = "${tsScript}\lib.d.ts" + $tsES6Scriptlib = "${tsScript}\lib.es6.d.ts" + + if(!(Test-Path $tsScriptServices)){ + Throw "Could not locate the TypeScript language service script at ${tsScriptServices}" + } + else { + $path = resolve-path ${tsScriptServices} + Set-ItemProperty -path $tsRegKey -name CustomTypeScriptServicesFileLocation -value "${path}" + Write-Host "Enabled custom TypeScript language service at ${path} for Dev${vsVersion}" + } + + if(!(Test-Path $tsScriptlib)){ + Throw "Could not locate the TypeScript default library at ${tsScriptlib}" + } + else { + $path = resolve-path ${tsScriptlib} + Set-ItemProperty -path $tsRegKey -name CustomDefaultLibraryLocation -value "${path}" + Write-Host "Enabled custom TypeScript default library at ${path} for Dev${vsVersion}" + } + + if(!(Test-Path $tsES6Scriptlib)){ + Throw "Could not locate the TypeScript default ES6 library at ${tsES6Scriptlib}" + } + else { + $path = resolve-path ${tsES6Scriptlib} + Set-ItemProperty -path $tsRegKey -name CustomDefaultES6LibraryLocation -value "${path}" + Write-Host "Enabled custom TypeScript default ES6 library at ${path} for Dev${vsVersion}" } - Set-ItemProperty -path $tsRegKey -name CustomTypeScriptServicesFileLocation -value "${tsScript}" - Write-Host "Enabled custom TypeScript language service at ${tsScript} for Dev${vsVersion}" } + if($enableDevMode){ Set-ItemProperty -path $tsRegKey -name EnableDevMode -value 1 Write-Host "Enabled developer mode for Dev${vsVersion}" diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index c26d3369f3f..9e36fc3e662 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -342,14 +342,7 @@ module ts { } function bindCatchVariableDeclaration(node: CatchClause) { - var symbol = createSymbol(SymbolFlags.FunctionScopedVariable, node.name.text || "__missing"); - addDeclarationToSymbol(symbol, node, SymbolFlags.FunctionScopedVariable); - var saveParent = parent; - var savedBlockScopeContainer = blockScopeContainer; - parent = blockScopeContainer = node; - forEachChild(node, bind); - parent = saveParent; - blockScopeContainer = savedBlockScopeContainer; + bindChildren(node, /*symbolKind:*/ 0, /*isBlockScopeContainer:*/ true); } function bindBlockScopedVariableDeclaration(node: Declaration) { @@ -377,6 +370,7 @@ module ts { function bind(node: Node) { node.parent = parent; + switch (node.kind) { case SyntaxKind.TypeParameter: bindDeclaration(node, SymbolFlags.TypeParameter, SymbolFlags.TypeParameterExcludes, /*isBlockScopeContainer*/ false); @@ -389,7 +383,7 @@ module ts { if (isBindingPattern((node).name)) { bindChildren(node, 0, /*isBlockScopeContainer*/ false); } - else if (getCombinedNodeFlags(node) & NodeFlags.BlockScoped) { + else if (isBlockOrCatchScoped(node)) { bindBlockScopedVariableDeclaration(node); } else { diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 44577350701..35da6cb9f1e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -56,6 +56,7 @@ module ts { isImplementationOfOverload, getAliasedSymbol: resolveImport, getEmitResolver, + getExportsOfExternalModule, }; var undefinedSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "undefined"); @@ -415,13 +416,6 @@ module ts { break loop; } break; - case SyntaxKind.CatchClause: - var id = (location).name; - if (name === id.text) { - result = location.symbol; - break loop; - } - break; } lastLocation = location; location = location.parent; @@ -450,7 +444,8 @@ module ts { } if (result.flags & SymbolFlags.BlockScopedVariable) { // Block-scoped variables cannot be used before their definition - var declaration = forEach(result.declarations, d => getCombinedNodeFlags(d) & NodeFlags.BlockScoped ? d : undefined); + var declaration = forEach(result.declarations, d => isBlockOrCatchScoped(d) ? d : undefined); + Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); if (!isDefinedBefore(declaration, errorLocation)) { error(errorLocation, Diagnostics.Block_scoped_variable_0_used_before_its_declaration, declarationNameToString(declaration.name)); @@ -1997,7 +1992,7 @@ module ts { } // Handle catch clause variables var declaration = symbol.valueDeclaration; - if (declaration.kind === SyntaxKind.CatchClause) { + if (declaration.parent.kind === SyntaxKind.CatchClause) { return links.type = anyType; } // Handle variable, parameter or property @@ -2758,6 +2753,19 @@ module ts { return result; } + function getExportsOfExternalModule(node: ImportDeclaration): Symbol[]{ + if (!node.moduleSpecifier) { + return emptyArray; + } + + var module = resolveExternalModuleName(node, node.moduleSpecifier); + if (!module || !module.exports) { + return emptyArray; + } + + return mapToArray(getExportsOfModule(module)) + } + function getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { @@ -6755,11 +6763,6 @@ module ts { } function checkTaggedTemplateExpression(node: TaggedTemplateExpression): Type { - // Grammar checking - if (languageVersion < ScriptTarget.ES6) { - grammarErrorOnFirstToken(node.template, Diagnostics.Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher); - } - return getReturnTypeOfSignature(getResolvedSignature(node)); } @@ -8927,18 +8930,29 @@ module ts { var catchClause = node.catchClause; if (catchClause) { // Grammar checking - if (catchClause.type) { - var sourceFile = getSourceFileOfNode(node); - var colonStart = skipTrivia(sourceFile.text, catchClause.name.end); - grammarErrorAtPos(sourceFile, colonStart, ":".length, Diagnostics.Catch_clause_parameter_cannot_have_a_type_annotation); + if (catchClause.variableDeclaration) { + if (catchClause.variableDeclaration.name.kind !== SyntaxKind.Identifier) { + grammarErrorOnFirstToken(catchClause.variableDeclaration.name, Diagnostics.Catch_clause_variable_name_must_be_an_identifier); + } + else if (catchClause.variableDeclaration.type) { + grammarErrorOnFirstToken(catchClause.variableDeclaration.type, Diagnostics.Catch_clause_variable_cannot_have_a_type_annotation); + } + else if (catchClause.variableDeclaration.initializer) { + grammarErrorOnFirstToken(catchClause.variableDeclaration.initializer, Diagnostics.Catch_clause_variable_cannot_have_an_initializer); + } + else { + // It is a SyntaxError if a TryStatement with a Catch occurs within strict code and the Identifier of the + // Catch production is eval or arguments + checkGrammarEvalOrArgumentsInStrictMode(node, catchClause.variableDeclaration.name); + } } - // It is a SyntaxError if a TryStatement with a Catch occurs within strict code and the Identifier of the - // Catch production is eval or arguments - checkGrammarEvalOrArgumentsInStrictMode(node, catchClause.name); checkBlock(catchClause.block); } - if (node.finallyBlock) checkBlock(node.finallyBlock); + + if (node.finallyBlock) { + checkBlock(node.finallyBlock); + } } function checkIndexConstraints(type: Type) { @@ -10050,11 +10064,6 @@ module ts { copySymbol(location.symbol, meaning); } break; - case SyntaxKind.CatchClause: - if ((location).name.text) { - copySymbol(location.symbol, meaning); - } - break; } memberFlags = location.flags; location = location.parent; @@ -10191,7 +10200,7 @@ module ts { } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName: EntityName | PropertyAccessExpression): Symbol { - if (isDeclarationOrFunctionExpressionOrCatchVariableName(entityName)) { + if (isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } @@ -10256,7 +10265,7 @@ module ts { return undefined; } - if (isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { + if (isDeclarationName(node)) { // This is a declaration, call getSymbolOfNode return getSymbolOfNode(node.parent); } @@ -10288,11 +10297,12 @@ module ts { case SyntaxKind.StringLiteral: // External module name in an import declaration - if (isExternalModuleImportEqualsDeclaration(node.parent.parent) && - getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) { - var importSymbol = getSymbolOfNode(node.parent.parent); - var moduleType = getTypeOfSymbol(importSymbol); - return moduleType ? moduleType.symbol : undefined; + var moduleName: Expression; + if ((isExternalModuleImportEqualsDeclaration(node.parent.parent) && + getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || + ((node.parent.kind === SyntaxKind.ImportDeclaration || node.parent.kind === SyntaxKind.ExportDeclaration) && + (node.parent).moduleSpecifier === node)) { + return resolveExternalModuleName(node, node); } // Intentional fall-through @@ -10351,7 +10361,7 @@ module ts { return getTypeOfSymbol(symbol); } - if (isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { + if (isDeclarationName(node)) { var symbol = getSymbolInfo(node); return symbol && getTypeOfSymbol(symbol); } @@ -11617,10 +11627,13 @@ module ts { } } - function checkGrammarEvalOrArgumentsInStrictMode(contextNode: Node, identifier: Identifier): boolean { - if (contextNode && (contextNode.parserContextFlags & ParserContextFlags.StrictMode) && isEvalOrArgumentsIdentifier(identifier)) { - var name = declarationNameToString(identifier); - return grammarErrorOnNode(identifier, Diagnostics.Invalid_use_of_0_in_strict_mode, name); + function checkGrammarEvalOrArgumentsInStrictMode(contextNode: Node, name: Node): boolean { + if (name && name.kind === SyntaxKind.Identifier) { + var identifier = name; + if (contextNode && (contextNode.parserContextFlags & ParserContextFlags.StrictMode) && isEvalOrArgumentsIdentifier(identifier)) { + var nameText = declarationNameToString(identifier); + return grammarErrorOnNode(identifier, Diagnostics.Invalid_use_of_0_in_strict_mode, nameText); + } } } diff --git a/src/compiler/core.ts b/src/compiler/core.ts index d527b62005e..e27d3cb5207 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -607,7 +607,7 @@ module ts { } var backslashOrDoubleQuote = /[\"\\]/g; - var escapedCharsRegExp = /[\0-\19\t\v\f\b\0\r\n\u2028\u2029\u0085]/g; + var escapedCharsRegExp = /[\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; var escapedCharsMap: Map = { "\0": "\\0", "\t": "\\t", @@ -624,7 +624,7 @@ module ts { }; /** - * Based heavily on the abstract 'Quote' operation from ECMA-262 (24.3.2.2), + * Based heavily on the abstract 'Quote'/ 'QuoteJSONString' operation from ECMA-262 (24.3.2.2), * but augmented for a few select characters. * Note that this doesn't actually wrap the input in double quotes. */ diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 9169a7bf688..88ae6eda361 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -9,7 +9,6 @@ module ts { Trailing_comma_not_allowed: { code: 1009, category: DiagnosticCategory.Error, key: "Trailing comma not allowed." }, Asterisk_Slash_expected: { code: 1010, category: DiagnosticCategory.Error, key: "'*/' expected." }, Unexpected_token: { code: 1012, category: DiagnosticCategory.Error, key: "Unexpected token." }, - Catch_clause_parameter_cannot_have_a_type_annotation: { code: 1013, category: DiagnosticCategory.Error, key: "Catch clause parameter cannot have a type annotation." }, A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: DiagnosticCategory.Error, key: "A rest parameter must be last in a parameter list." }, Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: DiagnosticCategory.Error, key: "Parameter cannot have question mark and initializer." }, A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: DiagnosticCategory.Error, key: "A required parameter cannot follow an optional parameter." }, @@ -117,7 +116,6 @@ module ts { const_declarations_must_be_initialized: { code: 1155, category: DiagnosticCategory.Error, key: "'const' declarations must be initialized" }, const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: DiagnosticCategory.Error, key: "'const' declarations can only be declared inside a block." }, let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: DiagnosticCategory.Error, key: "'let' declarations can only be declared inside a block." }, - Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1159, category: DiagnosticCategory.Error, key: "Tagged templates are only available when targeting ECMAScript 6 and higher." }, Unterminated_template_literal: { code: 1160, category: DiagnosticCategory.Error, key: "Unterminated template literal." }, Unterminated_regular_expression_literal: { code: 1161, category: DiagnosticCategory.Error, key: "Unterminated regular expression literal." }, An_object_member_cannot_be_declared_optional: { code: 1162, category: DiagnosticCategory.Error, key: "An object member cannot be declared optional." }, @@ -154,6 +152,9 @@ module ts { External_module_0_has_no_default_export_or_export_assignment: { code: 1192, category: DiagnosticCategory.Error, key: "External module '{0}' has no default export or export assignment." }, An_export_declaration_cannot_have_modifiers: { code: 1193, category: DiagnosticCategory.Error, key: "An export declaration cannot have modifiers." }, Export_declarations_are_not_permitted_in_an_internal_module: { code: 1194, category: DiagnosticCategory.Error, key: "Export declarations are not permitted in an internal module." }, + Catch_clause_variable_name_must_be_an_identifier: { code: 1195, category: DiagnosticCategory.Error, key: "Catch clause variable name must be an identifier." }, + Catch_clause_variable_cannot_have_a_type_annotation: { code: 1196, category: DiagnosticCategory.Error, key: "Catch clause variable cannot have a type annotation." }, + Catch_clause_variable_cannot_have_an_initializer: { code: 1197, category: DiagnosticCategory.Error, key: "Catch clause variable cannot have an initializer." }, Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 38a67dc6ed4..e78ae2dad27 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -27,10 +27,6 @@ "category": "Error", "code": 1012 }, - "Catch clause parameter cannot have a type annotation.": { - "category": "Error", - "code": 1013 - }, "A rest parameter must be last in a parameter list.": { "category": "Error", "code": 1014 @@ -459,10 +455,6 @@ "category": "Error", "code": 1157 }, - "Tagged templates are only available when targeting ECMAScript 6 and higher.": { - "category": "Error", - "code": 1159 - }, "Unterminated template literal.": { "category": "Error", "code": 1160 @@ -607,6 +599,18 @@ "category": "Error", "code": 1194 }, + "Catch clause variable name must be an identifier.": { + "category": "Error", + "code": 1195 + }, + "Catch clause variable cannot have a type annotation.": { + "category": "Error", + "code": 1196 + }, + "Catch clause variable cannot have an initializer.": { + "category": "Error", + "code": 1197 + }, "Duplicate identifier '{0}'.": { "category": "Error", @@ -1576,7 +1580,7 @@ "Exported type alias '{0}' has or is using private name '{1}'.": { "category": "Error", "code": 4081 - }, + }, "The current host does not support the '{0}' option.": { "category": "Error", "code": 5001 diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 0671e26b3b0..0b3f2cb4697 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1734,6 +1734,10 @@ module ts { return diagnostics; } + interface SynthesizedNode extends Node { + startsOnNewLine: boolean; + } + // @internal // targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile: SourceFile): EmitResult { @@ -2283,7 +2287,7 @@ module ts { } } - function emitParenthesized(node: Node, parenthesized: boolean) { + function emitParenthesizedIf(node: Node, parenthesized: boolean) { if (parenthesized) { write("("); } @@ -2416,6 +2420,72 @@ module ts { function getTemplateLiteralAsStringLiteral(node: LiteralExpression): string { return '"' + escapeString(node.text) + '"'; } + + function emitDownlevelRawTemplateLiteral(node: LiteralExpression) { + // Find original source text, since we need to emit the raw strings of the tagged template. + // The raw strings contain the (escaped) strings of what the user wrote. + // Examples: `\n` is converted to "\\n", a template string with a newline to "\n". + var text = getSourceTextOfNodeFromSourceFile(currentSourceFile, node); + + // text contains the original source, it will also contain quotes ("`"), dolar signs and braces ("${" and "}"), + // thus we need to remove those characters. + // First template piece starts with "`", others with "}" + // Last template piece ends with "`", others with "${" + var isLast = node.kind === SyntaxKind.NoSubstitutionTemplateLiteral || node.kind === SyntaxKind.TemplateTail; + text = text.substring(1, text.length - (isLast ? 1 : 2)); + + // Newline normalization: + // ES6 Spec 11.8.6.1 - Static Semantics of TV's and TRV's + // and LineTerminatorSequences are normalized to for both TV and TRV. + text = text.replace(/\r\n?/g, "\n"); + text = escapeString(text); + + write('"' + text + '"'); + } + + function emitDownlevelTaggedTemplateArray(node: TaggedTemplateExpression, literalEmitter: (literal: LiteralExpression) => void) { + write("["); + if (node.template.kind === SyntaxKind.NoSubstitutionTemplateLiteral) { + literalEmitter(node.template); + } + else { + literalEmitter((node.template).head); + forEach((node.template).templateSpans, (child) => { + write(", "); + literalEmitter(child.literal); + }); + } + write("]"); + } + + function emitDownlevelTaggedTemplate(node: TaggedTemplateExpression) { + var tempVariable = createAndRecordTempVariable(node); + write("("); + emit(tempVariable); + write(" = "); + emitDownlevelTaggedTemplateArray(node, emit); + write(", "); + + emit(tempVariable); + write(".raw = "); + emitDownlevelTaggedTemplateArray(node, emitDownlevelRawTemplateLiteral); + write(", "); + + emitParenthesizedIf(node.tag, needsParenthesisForPropertyAccessOrInvocation(node.tag)); + write("("); + emit(tempVariable); + + // Now we emit the expressions + if (node.template.kind === SyntaxKind.TemplateExpression) { + forEach((node.template).templateSpans, templateSpan => { + write(", "); + var needsParens = templateSpan.expression.kind === SyntaxKind.BinaryExpression + && (templateSpan.expression).operatorToken.kind === SyntaxKind.CommaToken; + emitParenthesizedIf(templateSpan.expression, needsParens); + }); + } + write("))"); + } function emitTemplateExpression(node: TemplateExpression): void { // In ES6 mode and above, we can simply emit each portion of a template in order, but in @@ -2460,7 +2530,8 @@ module ts { write(" + "); } - emitParenthesized(templateSpan.expression, needsParens); + emitParenthesizedIf(templateSpan.expression, needsParens); + // Only emit if the literal is non-empty. // The binary '+' operator is left-associative, so the first string concatenation // with the head will force the result up to this point to be a string. @@ -2605,8 +2676,6 @@ module ts { return false; case SyntaxKind.LabeledStatement: return (node.parent).label === node; - case SyntaxKind.CatchClause: - return (node.parent).name === node; } } @@ -2690,7 +2759,7 @@ module ts { emit((node).expression); } - function needsParenthesisForPropertyAccess(node: Expression) { + function needsParenthesisForPropertyAccessOrInvocation(node: Expression) { switch (node.kind) { case SyntaxKind.Identifier: case SyntaxKind.ArrayLiteralExpression: @@ -2720,7 +2789,7 @@ module ts { var e = elements[pos]; if (e.kind === SyntaxKind.SpreadElementExpression) { e = (e).expression; - emitParenthesized(e, /*parenthesized*/ group === 0 && needsParenthesisForPropertyAccess(e)); + emitParenthesizedIf(e, /*parenthesized*/ group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); pos++; } else { @@ -2766,14 +2835,19 @@ module ts { } } - function createSynthesizedNode(kind: SyntaxKind): Node { - var node = createNode(kind); + function createSynthesizedNode(kind: SyntaxKind, startsOnNewLine?: boolean): Node { + var node = createNode(kind); node.pos = -1; node.end = -1; + node.startsOnNewLine = startsOnNewLine; return node; } + function isSynthesized(node: Node) { + return node.pos === -1 && node.end === -1; + } + function emitDownlevelObjectLiteralWithComputedProperties(node: ObjectLiteralExpression, firstComputedPropertyIndex: number): void { var parenthesizedObjectLiteral = createDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex); return emit(parenthesizedObjectLiteral); @@ -2807,7 +2881,7 @@ module ts { }); // Finally, return the temp variable. - propertyPatches = createBinaryExpression(propertyPatches, SyntaxKind.CommaToken, tempVar); + propertyPatches = createBinaryExpression(propertyPatches, SyntaxKind.CommaToken, createIdentifier(tempVar.text, /*startsOnNewLine:*/ true)); var result = createParenthesizedExpression(propertyPatches); @@ -2830,7 +2904,7 @@ module ts { var leftHandSide = createMemberAccessForPropertyName(tempVar, property.name); var maybeRightHandSide = tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property); - return maybeRightHandSide && createBinaryExpression(leftHandSide, SyntaxKind.EqualsToken, maybeRightHandSide); + return maybeRightHandSide && createBinaryExpression(leftHandSide, SyntaxKind.EqualsToken, maybeRightHandSide, /*startsOnNewLine:*/ true); } function tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral: ObjectLiteralExpression, property: ObjectLiteralElement) { @@ -2903,8 +2977,8 @@ module ts { return result; } - function createBinaryExpression(left: Expression, operator: SyntaxKind, right: Expression): BinaryExpression { - var result = createSynthesizedNode(SyntaxKind.BinaryExpression); + function createBinaryExpression(left: Expression, operator: SyntaxKind, right: Expression, startsOnNewLine?: boolean): BinaryExpression { + var result = createSynthesizedNode(SyntaxKind.BinaryExpression, startsOnNewLine); result.operatorToken = createSynthesizedNode(operator); result.left = left; result.right = right; @@ -2959,8 +3033,8 @@ module ts { return result; } - function createIdentifier(name: string) { - var result = createSynthesizedNode(SyntaxKind.Identifier); + function createIdentifier(name: string, startsOnNewLine?: boolean) { + var result = createSynthesizedNode(SyntaxKind.Identifier, startsOnNewLine); result.text = name; return result; @@ -3196,9 +3270,14 @@ module ts { } function emitTaggedTemplateExpression(node: TaggedTemplateExpression): void { - emit(node.tag); - write(" "); - emit(node.template); + if (compilerOptions.target >= ScriptTarget.ES6) { + emit(node.tag); + write(" "); + emit(node.template); + } + else { + emitDownlevelTaggedTemplate(node); + } } function emitParenExpression(node: ParenthesizedExpression) { @@ -3299,69 +3378,25 @@ module ts { write(tokenToString(node.operatorToken.kind)); - // We'd like to preserve newlines found in the original binary expression. i.e. if a user has: - // - // Foo() || - // Bar(); - // - // Then we'd like to emit it as such. It seems like we'd only need to check for a newline and - // then just indent and emit. However, that will lead to a problem with deeply nested code. - // i.e. if you have: - // - // Foo() || - // Bar() || - // Baz(); - // - // Then we don't want to emit it as: - // - // Foo() || - // Bar() || - // Baz(); - // - // So we only indent if the right side of the binary expression starts further in on the line - // versus the left. - var operatorEnd = getLineAndCharacterOfPosition(currentSourceFile, node.operatorToken.end); - var rightStart = getLineAndCharacterOfPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.right.pos)); + var shouldPlaceOnNewLine = !isSynthesized(node) && !nodeEndIsOnSameLineAsNodeStart(node.operatorToken, node.right); // Check if the right expression is on a different line versus the operator itself. If so, // we'll emit newline. - var onDifferentLine = operatorEnd.line !== rightStart.line; - if (onDifferentLine) { - // Also, if the right expression starts further in on the line than the left, then we'll indent. - var exprStart = getLineAndCharacterOfPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos)); - var firstCharOfExpr = getFirstNonWhitespaceCharacterIndexOnLine(exprStart.line); - var shouldIndent = rightStart.character > firstCharOfExpr; - - if (shouldIndent) { - increaseIndent(); - } - + if (shouldPlaceOnNewLine || synthesizedNodeStartsOnNewLine(node.right)) { + increaseIndent(); writeLine(); + emit(node.right); + decreaseIndent(); } else { write(" "); - } - - emit(node.right); - - if (shouldIndent) { - decreaseIndent(); + emit(node.right); } } } - function getFirstNonWhitespaceCharacterIndexOnLine(line: number): number { - var lineStart = getLineStarts(currentSourceFile)[line]; - var text = currentSourceFile.text; - - for (var i = lineStart; i < text.length; i++) { - var ch = text.charCodeAt(i); - if (!isWhiteSpace(text.charCodeAt(i)) || isLineBreak(ch)) { - break; - } - } - - return i - lineStart; + function synthesizedNodeStartsOnNewLine(node: Node) { + return isSynthesized(node) && (node).startsOnNewLine; } function emitConditionalExpression(node: ConditionalExpression) { @@ -3418,7 +3453,7 @@ module ts { } function emitExpressionStatement(node: ExpressionStatement) { - emitParenthesized(node.expression, /*parenthesized*/ node.expression.kind === SyntaxKind.ArrowFunction); + emitParenthesizedIf(node.expression, /*parenthesized*/ node.expression.kind === SyntaxKind.ArrowFunction); write(";"); } @@ -3617,8 +3652,8 @@ module ts { var endPos = emitToken(SyntaxKind.CatchKeyword, node.pos); write(" "); emitToken(SyntaxKind.OpenParenToken, endPos); - emit(node.name); - emitToken(SyntaxKind.CloseParenToken, node.name.end); + emit(node.variableDeclaration); + emitToken(SyntaxKind.CloseParenToken, node.variableDeclaration ? node.variableDeclaration.end : endPos); write(" "); emitBlock(node.block); } @@ -4207,58 +4242,21 @@ module ts { } function emitBlockFunctionBody(node: FunctionLikeDeclaration, body: Block) { - // If the body has no statements, and we know there's no code that would cause any - // prologue to be emitted, then just do a simple emit if the empty block. - if (body.statements.length === 0 && !anyParameterHasBindingPatternOrInitializer(node)) { - emitFunctionBodyWithNoStatements(node, body); - } - else { - emitFunctionBodyWithStatements(node, body); - } - } - - function anyParameterHasBindingPatternOrInitializer(func: FunctionLikeDeclaration) { - return forEach(func.parameters, hasBindingPatternOrInitializer); - } - - function hasBindingPatternOrInitializer(parameter: ParameterDeclaration) { - return parameter.initializer || isBindingPattern(parameter.name); - } - - function emitFunctionBodyWithNoStatements(node: FunctionLikeDeclaration, body: Block) { - var singleLine = isSingleLineEmptyBlock(node.body); - - write(" {"); - if (singleLine) { - write(" "); - } - else { - increaseIndent(); - writeLine(); - } - - emitLeadingCommentsOfPosition(body.statements.end); - - if (!singleLine) { - decreaseIndent(); - } - - emitToken(SyntaxKind.CloseBraceToken, body.statements.end); - } - - function emitFunctionBodyWithStatements(node: FunctionLikeDeclaration, body: Block) { write(" {"); scopeEmitStart(node); - var outPos = writer.getTextPos(); + var initialTextPos = writer.getTextPos(); increaseIndent(); emitDetachedComments(body.statements); + + // Emit all the directive prologues (like "use strict"). These have to come before + // any other preamble code we write (like parameter initializers). var startIndex = emitDirectivePrologues(body.statements, /*startWithNewLine*/ true); emitFunctionBodyPreamble(node); decreaseIndent(); - var preambleEmitted = writer.getTextPos() !== outPos; + var preambleEmitted = writer.getTextPos() !== initialTextPos; if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { for (var i = 0, n = body.statements.length; i < n; i++) { diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 9dc8a475527..ff22f857cad 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -222,8 +222,7 @@ module ts { visitNode(cbNode, (node).catchClause) || visitNode(cbNode, (node).finallyBlock); case SyntaxKind.CatchClause: - return visitNode(cbNode, (node).name) || - visitNode(cbNode, (node).type) || + return visitNode(cbNode, (node).variableDeclaration) || visitNode(cbNode, (node).block); case SyntaxKind.ClassDeclaration: return visitNodes(cbNodes, node.modifiers) || @@ -3973,9 +3972,10 @@ module ts { function parseCatchClause(): CatchClause { var result = createNode(SyntaxKind.CatchClause); parseExpected(SyntaxKind.CatchKeyword); - parseExpected(SyntaxKind.OpenParenToken); - result.name = parseIdentifier(); - result.type = parseTypeAnnotation(); + if (parseExpected(SyntaxKind.OpenParenToken)) { + result.variableDeclaration = parseVariableDeclaration(); + } + parseExpected(SyntaxKind.CloseParenToken); result.block = parseBlock(/*ignoreMissingOpenBrace:*/ false, /*checkForStrictMode:*/ false); return finishNode(result); diff --git a/src/compiler/program.ts b/src/compiler/program.ts index b74ef039fd6..88ab2825fd2 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -3,6 +3,7 @@ module ts { /* @internal */ export var emitTime = 0; + /* @internal */ export var ioReadTime = 0; export function createCompilerHost(options: CompilerOptions): CompilerHost { var currentDirectory: string; @@ -19,7 +20,9 @@ module ts { function getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile { try { + var start = new Date().getTime(); var text = sys.readFile(fileName, options.charset); + ioReadTime += new Date().getTime() - start; } catch (e) { if (onError) { @@ -177,10 +180,15 @@ module ts { return { diagnostics: [], sourceMaps: undefined, emitSkipped: true }; } + // Create the emit resolver outside of the "emitTime" tracking code below. That way + // any cost associated with it (like type checking) are appropriate associated with + // the type-checking counter. + var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile); + var start = new Date().getTime(); var emitResult = emitFiles( - getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile), + emitResolver, getEmitHost(writeFileCallback), sourceFile); diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index a3755650aed..57c2298d3d3 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -322,6 +322,7 @@ module ts { } function compile(fileNames: string[], compilerOptions: CompilerOptions, compilerHost: CompilerHost) { + ts.ioReadTime = 0; ts.parseTime = 0; ts.bindTime = 0; ts.checkTime = 0; @@ -330,9 +331,12 @@ module ts { var start = new Date().getTime(); var program = createProgram(fileNames, compilerOptions, compilerHost); + var programTime = new Date().getTime() - start; + var exitStatus = compileProgram(); var end = new Date().getTime() - start; + var compileTime = end - programTime; if (compilerOptions.listFiles) { forEach(program.getSourceFiles(), file => { @@ -353,10 +357,19 @@ module ts { reportStatisticalValue("Memory used", Math.round(memoryUsed / 1000) + "K"); } - reportTimeStatistic("Parse time", ts.parseTime); + // Individual component times. + // Note: we output 'programTime' as parseTime to match the tsc 1.3 behavior. tsc 1.3 + // measured parse time along with read IO as a single counter. We preserve that + // behavior so we can accurately compare times. For actual parse times (in isolation) + // is reported below. + reportTimeStatistic("Parse time", programTime); reportTimeStatistic("Bind time", ts.bindTime); reportTimeStatistic("Check time", ts.checkTime); reportTimeStatistic("Emit time", ts.emitTime); + + reportTimeStatistic("Parse time w/o IO", ts.parseTime); + reportTimeStatistic("IO read", ts.ioReadTime); + reportTimeStatistic("Compile time", compileTime); reportTimeStatistic("Total time", end); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 77eea0c4492..2e923fe8d8c 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -121,7 +121,6 @@ module ts { WithKeyword, // Strict mode reserved words AsKeyword, - FromKeyword, ImplementsKeyword, InterfaceKeyword, LetKeyword, @@ -131,7 +130,7 @@ module ts { PublicKeyword, StaticKeyword, YieldKeyword, - // TypeScript keywords + // Contextual keywords AnyKeyword, BooleanKeyword, ConstructorKeyword, @@ -144,7 +143,9 @@ module ts { StringKeyword, SymbolKeyword, TypeKeyword, + FromKeyword, OfKeyword, // LastKeyword and LastToken + // Parse tree nodes // Names @@ -279,7 +280,7 @@ module ts { FirstPunctuation = OpenBraceToken, LastPunctuation = CaretEqualsToken, FirstToken = Unknown, - LastToken = OfKeyword, + LastToken = LastKeyword, FirstTriviaToken = SingleLineCommentTrivia, LastTriviaToken = ConflictMarkerTrivia, FirstLiteralToken = NumericLiteral, @@ -813,9 +814,8 @@ module ts { finallyBlock?: Block; } - export interface CatchClause extends Declaration { - name: Identifier; - type?: TypeNode; + export interface CatchClause extends Node { + variableDeclaration: VariableDeclaration; block: Block; } @@ -1100,6 +1100,7 @@ module ts { getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; getAliasedSymbol(symbol: Symbol): Symbol; + getExportsOfExternalModule(node: ImportDeclaration): Symbol[]; // Should not be called directly. Should only be accessed through the Program instance. /* @internal */ getDiagnostics(sourceFile?: SourceFile): Diagnostic[]; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index c5bb46aa962..01def791c02 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -192,6 +192,18 @@ module ts { return getBaseFileName(moduleName).replace(/\W/g, "_"); } + export function isBlockOrCatchScoped(declaration: Declaration) { + return (getCombinedNodeFlags(declaration) & NodeFlags.BlockScoped) !== 0 || + isCatchClauseVariableDeclaration(declaration); + } + + export function isCatchClauseVariableDeclaration(declaration: Declaration) { + return declaration && + declaration.kind === SyntaxKind.VariableDeclaration && + declaration.parent && + declaration.parent.kind === SyntaxKind.CatchClause; + } + // Return display name of an identifier // Computed property names will just be emitted as "[]", where is the source // text of the expression in the computed property. @@ -681,31 +693,33 @@ module ts { export function isDeclaration(node: Node): boolean { switch (node.kind) { - case SyntaxKind.TypeParameter: - case SyntaxKind.Parameter: - case SyntaxKind.VariableDeclaration: + case SyntaxKind.ArrowFunction: case SyntaxKind.BindingElement: - case SyntaxKind.PropertyDeclaration: - case SyntaxKind.PropertySignature: - case SyntaxKind.PropertyAssignment: - case SyntaxKind.ShorthandPropertyAssignment: + case SyntaxKind.ClassDeclaration: + case SyntaxKind.Constructor: + case SyntaxKind.EnumDeclaration: case SyntaxKind.EnumMember: + case SyntaxKind.ExportSpecifier: + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.FunctionExpression: + case SyntaxKind.GetAccessor: + case SyntaxKind.ImportClause: + case SyntaxKind.ImportEqualsDeclaration: + case SyntaxKind.ImportSpecifier: + case SyntaxKind.InterfaceDeclaration: case SyntaxKind.MethodDeclaration: case SyntaxKind.MethodSignature: - case SyntaxKind.FunctionDeclaration: - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - case SyntaxKind.Constructor: - case SyntaxKind.ClassDeclaration: - case SyntaxKind.InterfaceDeclaration: - case SyntaxKind.TypeAliasDeclaration: - case SyntaxKind.EnumDeclaration: case SyntaxKind.ModuleDeclaration: - case SyntaxKind.ImportEqualsDeclaration: - case SyntaxKind.ImportClause: - case SyntaxKind.ImportSpecifier: case SyntaxKind.NamespaceImport: - case SyntaxKind.ExportSpecifier: + case SyntaxKind.Parameter: + case SyntaxKind.PropertyAssignment: + case SyntaxKind.PropertyDeclaration: + case SyntaxKind.PropertySignature: + case SyntaxKind.SetAccessor: + case SyntaxKind.ShorthandPropertyAssignment: + case SyntaxKind.TypeAliasDeclaration: + case SyntaxKind.TypeParameter: + case SyntaxKind.VariableDeclaration: return true; } return false; @@ -739,18 +753,20 @@ module ts { } // True if the given identifier, string literal, or number literal is the name of a declaration node - export function isDeclarationOrFunctionExpressionOrCatchVariableName(name: Node): boolean { + export function isDeclarationName(name: Node): boolean { if (name.kind !== SyntaxKind.Identifier && name.kind !== SyntaxKind.StringLiteral && name.kind !== SyntaxKind.NumericLiteral) { return false; } var parent = name.parent; - if (isDeclaration(parent) || parent.kind === SyntaxKind.FunctionExpression) { - return (parent).name === name; + if (parent.kind === SyntaxKind.ImportSpecifier || parent.kind === SyntaxKind.ExportSpecifier) { + if ((parent).propertyName) { + return true; + } } - if (parent.kind === SyntaxKind.CatchClause) { - return (parent).name === name; + if (isDeclaration(parent)) { + return (parent).name === name; } return false; diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index d7eda52ce38..49a1ac4784c 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -101,13 +101,7 @@ module ts.server { } getScriptFileNames() { - var filenames: string[] = []; - for (var filename in this.filenameToScript) { - if (this.filenameToScript[filename] && this.filenameToScript[filename].isOpen) { - filenames.push(filename); - } - } - return filenames; + return this.roots.map(root => root.fileName); } getScriptVersion(filename: string) { @@ -536,15 +530,35 @@ module ts.server { updateProjectStructure() { this.log("updating project structure from ...", "Info"); this.printProjects(); + + // First loop through all open files that are referenced by projects but are not + // project roots. For each referenced file, see if the default project still + // references that file. If so, then just keep the file in the referenced list. + // If not, add the file to an unattached list, to be rechecked later. + + var openFilesReferenced: ScriptInfo[] = []; + var unattachedOpenFiles: ScriptInfo[] = []; + for (var i = 0, len = this.openFilesReferenced.length; i < len; i++) { - var refdFile = this.openFilesReferenced[i]; - refdFile.defaultProject.updateGraph(); - var sourceFile = refdFile.defaultProject.getSourceFile(refdFile); - if (!sourceFile) { - this.openFilesReferenced = copyListRemovingItem(refdFile, this.openFilesReferenced); - this.addOpenFile(refdFile); + var referencedFile = this.openFilesReferenced[i]; + referencedFile.defaultProject.updateGraph(); + var sourceFile = referencedFile.defaultProject.getSourceFile(referencedFile); + if (sourceFile) { + openFilesReferenced.push(referencedFile); + } + else { + unattachedOpenFiles.push(referencedFile); } } + this.openFilesReferenced = openFilesReferenced; + + // Then, loop through all of the open files that are project roots. + // For each root file, note the project that it roots. Then see if + // any other projects newly reference the file. If zero projects + // newly reference the file, keep it as a root. If one or more + // projects newly references the file, remove its project from the + // inferred projects list (since it is no longer a root) and add + // the file to the open, referenced file list. var openFileRoots: ScriptInfo[] = []; for (var i = 0, len = this.openFileRoots.length; i < len; i++) { var rootFile = this.openFileRoots[i]; @@ -555,12 +569,19 @@ module ts.server { openFileRoots.push(rootFile); } else { - // remove project from inferred projects list + // remove project from inferred projects list because root captured this.inferredProjects = copyListRemovingItem(rootedProject, this.inferredProjects); this.openFilesReferenced.push(rootFile); } } this.openFileRoots = openFileRoots; + + // Finally, if we found any open, referenced files that are no longer + // referenced by their default project, treat them as newly opened + // by the editor. + for (var i = 0, len = unattachedOpenFiles.length; i < len; i++) { + this.addOpenFile(unattachedOpenFiles[i]); + } this.printProjects(); } diff --git a/src/server/server.ts b/src/server/server.ts index 2b9040b4df3..c48ba951347 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -206,7 +206,10 @@ module ts.server { } }; - + var ioSession = new IOSession(ts.sys, logger); + process.on('uncaughtException', function(err: Error) { + ioSession.logError(err, "unknown"); + }); // Start listening - new IOSession(ts.sys, logger).listen(); + ioSession.listen(); } \ No newline at end of file diff --git a/src/server/session.ts b/src/server/session.ts index 21238e88992..7e9c6972a1f 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -181,18 +181,29 @@ module ts.server { } semanticCheck(file: string, project: Project) { - var diags = project.compilerService.languageService.getSemanticDiagnostics(file); - if (diags) { - var bakedDiags = diags.map((diag) => formatDiag(file, project, diag)); - this.event({ file: file, diagnostics: bakedDiags }, "semanticDiag"); + try { + var diags = project.compilerService.languageService.getSemanticDiagnostics(file); + + if (diags) { + var bakedDiags = diags.map((diag) => formatDiag(file, project, diag)); + this.event({ file: file, diagnostics: bakedDiags }, "semanticDiag"); + } + } + catch (err) { + this.logError(err, "semantic check"); } } syntacticCheck(file: string, project: Project) { - var diags = project.compilerService.languageService.getSyntacticDiagnostics(file); - if (diags) { - var bakedDiags = diags.map((diag) => formatDiag(file, project, diag)); - this.event({ file: file, diagnostics: bakedDiags }, "syntaxDiag"); + try { + var diags = project.compilerService.languageService.getSyntacticDiagnostics(file); + if (diags) { + var bakedDiags = diags.map((diag) => formatDiag(file, project, diag)); + this.event({ file: file, diagnostics: bakedDiags }, "syntaxDiag"); + } + } + catch (err) { + this.logError(err, "syntactic check"); } } @@ -553,10 +564,7 @@ module ts.server { compilerService.host.editScript(file, start, end, insertString); this.changeSeq++; } - // update project structure on idle commented out - // until we can have the host return only the root files - // from getScriptFileNames() - //this.updateProjectStructure(this.changeSeq, (n) => n == this.changeSeq); + this.updateProjectStructure(this.changeSeq, (n) => n == this.changeSeq); } } diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index a4943705e72..59c4e716890 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -178,7 +178,15 @@ module ts.BreakpointResolver { case SyntaxKind.ImportEqualsDeclaration: // import statement without including semicolon - return textSpan(node,(node).moduleReference); + return textSpan(node, (node).moduleReference); + + case SyntaxKind.ImportDeclaration: + // import statement without including semicolon + return textSpan(node, (node).moduleSpecifier); + + case SyntaxKind.ExportDeclaration: + // import statement without including semicolon + return textSpan(node, (node).moduleSpecifier); case SyntaxKind.ModuleDeclaration: // span on complete module if it is instantiated diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index 593e6163e29..6974f160e10 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -2,6 +2,11 @@ module ts.formatting { export module SmartIndenter { + + const enum Value { + Unknown = -1 + } + export function getIndentation(position: number, sourceFile: SourceFile, options: EditorOptions): number { if (position > sourceFile.text.length) { return 0; // past EOF @@ -29,7 +34,7 @@ module ts.formatting { if (precedingToken.kind === SyntaxKind.CommaToken && precedingToken.parent.kind !== SyntaxKind.BinaryExpression) { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); - if (actualIndentation !== -1) { + if (actualIndentation !== Value.Unknown) { return actualIndentation; } } @@ -57,7 +62,7 @@ module ts.formatting { // check if current node is a list item - if yes, take indentation from it var actualIndentation = getActualIndentationForListItem(current, sourceFile, options); - if (actualIndentation !== -1) { + if (actualIndentation !== Value.Unknown) { return actualIndentation; } @@ -101,7 +106,7 @@ module ts.formatting { if (useActualIndentation) { // check if current node is a list item - if yes, take indentation from it var actualIndentation = getActualIndentationForListItem(current, sourceFile, options); - if (actualIndentation !== -1) { + if (actualIndentation !== Value.Unknown) { return actualIndentation + indentationDelta; } } @@ -113,7 +118,7 @@ module ts.formatting { if (useActualIndentation) { // try to fetch actual indentation for current node from source text var actualIndentation = getActualIndentationForNode(current, parent, currentStart, parentAndChildShareLine, sourceFile, options); - if (actualIndentation !== -1) { + if (actualIndentation !== Value.Unknown) { return actualIndentation + indentationDelta; } } @@ -142,18 +147,22 @@ module ts.formatting { } /* - * Function returns -1 if indentation cannot be determined + * Function returns Value.Unknown if indentation cannot be determined */ function getActualIndentationForListItemBeforeComma(commaToken: Node, sourceFile: SourceFile, options: EditorOptions): number { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it var commaItemInfo = findListItemInfo(commaToken); - Debug.assert(commaItemInfo && commaItemInfo.listItemIndex > 0); - // The item we're interested in is right before the comma - return deriveActualIndentationFromList(commaItemInfo.list.getChildren(), commaItemInfo.listItemIndex - 1, sourceFile, options); + if (commaItemInfo && commaItemInfo.listItemIndex > 0) { + return deriveActualIndentationFromList(commaItemInfo.list.getChildren(), commaItemInfo.listItemIndex - 1, sourceFile, options); + } + else { + // handle broken code gracefully + return Value.Unknown; + } } /* - * Function returns -1 if actual indentation for node should not be used (i.e because node is nested expression) + * Function returns Value.Unknown if actual indentation for node should not be used (i.e because node is nested expression) */ function getActualIndentationForNode(current: Node, parent: Node, @@ -170,7 +179,7 @@ module ts.formatting { (parent.kind === SyntaxKind.SourceFile || !parentAndChildShareLine); if (!useActualIndentation) { - return -1; + return Value.Unknown; } return findColumnForFirstNonWhitespaceCharacterInLine(currentLineAndChar, sourceFile, options); @@ -271,11 +280,11 @@ module ts.formatting { function getActualIndentationForListItem(node: Node, sourceFile: SourceFile, options: EditorOptions): number { var containingList = getContainingList(node, sourceFile); - return containingList ? getActualIndentationFromList(containingList) : -1; + return containingList ? getActualIndentationFromList(containingList) : Value.Unknown; function getActualIndentationFromList(list: Node[]): number { var index = indexOf(list, node); - return index !== -1 ? deriveActualIndentationFromList(list, index, sourceFile, options) : -1; + return index !== -1 ? deriveActualIndentationFromList(list, index, sourceFile, options) : Value.Unknown; } } @@ -298,7 +307,7 @@ module ts.formatting { lineAndCharacter = getStartLineAndCharacterForNode(list[i], sourceFile); } - return -1; + return Value.Unknown; } function findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter: LineAndCharacter, sourceFile: SourceFile, options: EditorOptions): number { diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index e32ac03caef..90c639287ce 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -50,6 +50,38 @@ module ts.NavigationBar { case SyntaxKind.ArrayBindingPattern: forEach((node).elements, visit); break; + + case SyntaxKind.ExportDeclaration: + // Handle named exports case e.g.: + // export {a, b as B} from "mod"; + if ((node).exportClause) { + forEach((node).exportClause.elements, visit); + } + break; + + case SyntaxKind.ImportDeclaration: + var importClause = (node).importClause; + if (importClause) { + // Handle default import case e.g.: + // import d from "mod"; + if (importClause.name) { + childNodes.push(importClause); + } + + // Handle named bindings in imports e.g.: + // import * as NS from "mod"; + // import {a, b as B} from "mod"; + if (importClause.namedBindings) { + if (importClause.namedBindings.kind === SyntaxKind.NamespaceImport) { + childNodes.push(importClause.namedBindings); + } + else { + forEach((importClause.namedBindings).elements, visit); + } + } + } + break; + case SyntaxKind.BindingElement: case SyntaxKind.VariableDeclaration: if (isBindingPattern((node).name)) { @@ -62,7 +94,11 @@ module ts.NavigationBar { case SyntaxKind.InterfaceDeclaration: case SyntaxKind.ModuleDeclaration: case SyntaxKind.FunctionDeclaration: + case SyntaxKind.ImportEqualsDeclaration: + case SyntaxKind.ImportSpecifier: + case SyntaxKind.ExportSpecifier: childNodes.push(node); + break; } } @@ -291,9 +327,16 @@ module ts.NavigationBar { else { return createItem(node, getTextOfNode(name), ts.ScriptElementKind.variableElement); } - + case SyntaxKind.Constructor: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); + + case SyntaxKind.ExportSpecifier: + case SyntaxKind.ImportSpecifier: + case SyntaxKind.ImportEqualsDeclaration: + case SyntaxKind.ImportClause: + case SyntaxKind.NamespaceImport: + return createItem(node, getTextOfNode((node).name), ts.ScriptElementKind.alias); } return undefined; diff --git a/src/services/services.ts b/src/services/services.ts index 2fc154f610f..c13ae22718b 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -802,6 +802,11 @@ module ts { case SyntaxKind.EnumDeclaration: case SyntaxKind.ModuleDeclaration: case SyntaxKind.ImportEqualsDeclaration: + case SyntaxKind.ExportSpecifier: + case SyntaxKind.ImportSpecifier: + case SyntaxKind.ImportEqualsDeclaration: + case SyntaxKind.ImportClause: + case SyntaxKind.NamespaceImport: case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: case SyntaxKind.TypeLiteral: @@ -841,6 +846,37 @@ module ts { case SyntaxKind.PropertySignature: namedDeclarations.push(node); break; + + case SyntaxKind.ExportDeclaration: + // Handle named exports case e.g.: + // export {a, b as B} from "mod"; + if ((node).exportClause) { + forEach((node).exportClause.elements, visit); + } + break; + + case SyntaxKind.ImportDeclaration: + var importClause = (node).importClause; + if (importClause) { + // Handle default import case e.g.: + // import d from "mod"; + if (importClause.name) { + namedDeclarations.push(importClause); + } + + // Handle named bindings in imports e.g.: + // import * as NS from "mod"; + // import {a, b as B} from "mod"; + if (importClause.namedBindings) { + if (importClause.namedBindings.kind === SyntaxKind.NamespaceImport) { + namedDeclarations.push(importClause.namedBindings); + } + else { + forEach((importClause.namedBindings).elements, visit); + } + } + } + break; } }); @@ -2010,6 +2046,12 @@ module ts { case SyntaxKind.TypeParameter: return ScriptElementKind.typeParameterElement; case SyntaxKind.EnumMember: return ScriptElementKind.variableElement; case SyntaxKind.Parameter: return (node.flags & NodeFlags.AccessibilityModifier) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + case SyntaxKind.ImportEqualsDeclaration: + case SyntaxKind.ImportSpecifier: + case SyntaxKind.ImportClause: + case SyntaxKind.ExportSpecifier: + case SyntaxKind.NamespaceImport: + return ScriptElementKind.alias; } return ScriptElementKind.unknown; } @@ -2403,6 +2445,19 @@ module ts { getCompletionEntriesFromSymbols(filteredMembers, activeCompletionSession); } } + else if (getAncestor(previousToken, SyntaxKind.ImportClause)) { + // cursor is in import clause + // try to show exported member for imported module + isMemberCompletion = true; + isNewIdentifierLocation = true; + if (showCompletionsInImportsClause(previousToken)) { + var importDeclaration = getAncestor(previousToken, SyntaxKind.ImportDeclaration); + Debug.assert(importDeclaration !== undefined); + var exports = typeInfoResolver.getExportsOfExternalModule(importDeclaration); + var filteredExports = filterModuleExports(exports, importDeclaration); + getCompletionEntriesFromSymbols(filteredExports, activeCompletionSession); + } + } else { // Get scope members isMemberCompletion = false; @@ -2453,6 +2508,18 @@ module ts { return result; } + function showCompletionsInImportsClause(node: Node): boolean { + if (node) { + // import {| + // import {a,| + if (node.kind === SyntaxKind.OpenBraceToken || node.kind === SyntaxKind.CommaToken) { + return node.parent.kind === SyntaxKind.NamedImports; + } + } + + return false; + } + function isNewIdentifierDefinitionLocation(previousToken: Node): boolean { if (previousToken) { var containingNodeKind = previousToken.parent.kind; @@ -2664,6 +2731,28 @@ module ts { return false; } + function filterModuleExports(exports: Symbol[], importDeclaration: ImportDeclaration): Symbol[] { + var exisingImports: Map = {}; + + if (!importDeclaration.importClause) { + return exports; + } + + if (importDeclaration.importClause.namedBindings && + importDeclaration.importClause.namedBindings.kind === SyntaxKind.NamedImports) { + + forEach((importDeclaration.importClause.namedBindings).elements, el => { + var name = el.propertyName || el.name; + exisingImports[name.text] = true; + }); + } + + if (isEmpty(exisingImports)) { + return exports; + } + return filter(exports, e => !lookUp(exisingImports, e.name)); + } + function filterContextualMembersList(contextualMemberSymbols: Symbol[], existingMembers: Declaration[]): Symbol[] { if (!existingMembers || existingMembers.length === 0) { return contextualMemberSymbols; @@ -3245,6 +3334,17 @@ module ts { return undefined; } + // If this is an alias, and the request came at the declaration location + // get the aliased symbol instead. This allows for goto def on an import e.g. + // import {A, B} from "mod"; + // to jump to the implementation directelly. + if (symbol.flags & SymbolFlags.Import) { + var declaration = symbol.declarations[0]; + if (node.kind === SyntaxKind.Identifier && node.parent === declaration) { + symbol = typeInfoResolver.getAliasedSymbol(symbol); + } + } + var result: DefinitionInfo[] = []; // Because name in short-hand property assignment has two different meanings: property name and property value, @@ -3975,7 +4075,7 @@ module ts { var searchMeaning = getIntersectingMeaningFromDeclarations(getMeaningFromLocation(node), declarations); // Get the text to search for, we need to normalize it as external module names will have quote - var declaredName = getDeclaredName(symbol); + var declaredName = getDeclaredName(symbol, node); // Try to get the smallest valid scope that we can limit our search to; // otherwise we'll need to search globally (i.e. include each file). @@ -3992,7 +4092,7 @@ module ts { getReferencesInNode(sourceFiles[0], symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result); } else { - var internedName = getInternedName(symbol, declarations) + var internedName = getInternedName(symbol, node, declarations) forEach(sourceFiles, sourceFile => { cancellationToken.throwIfCancellationRequested(); @@ -4012,13 +4112,51 @@ module ts { return result; - function getDeclaredName(symbol: Symbol) { + function isImportOrExportSpecifierName(location: Node): boolean { + return location.parent && + (location.parent.kind === SyntaxKind.ImportSpecifier || location.parent.kind === SyntaxKind.ExportSpecifier) && + (location.parent).propertyName === location; + } + + function isImportOrExportSpecifierImportSymbol(symbol: Symbol) { + return (symbol.flags & SymbolFlags.Import) && forEach(symbol.declarations, declaration => { + return declaration.kind === SyntaxKind.ImportSpecifier || declaration.kind === SyntaxKind.ExportSpecifier; + }); + } + + function getDeclaredName(symbol: Symbol, location: Node) { + // Special case for function expressions, whose names are solely local to their bodies. + var functionExpression = forEach(symbol.declarations, d => d.kind === SyntaxKind.FunctionExpression ? d : undefined); + + // When a name gets interned into a SourceFile's 'identifiers' Map, + // its name is escaped and stored in the same way its symbol name/identifier + // name should be stored. Function expressions, however, are a special case, + // because despite sometimes having a name, the binder unconditionally binds them + // to a symbol with the name "__function". + if (functionExpression && functionExpression.name) { + var name = functionExpression.name.text; + } + + // If this is an export or import specifier it could have been renamed using the as syntax. + // if so we want to search for whatever under the cursor, the symbol is pointing to the alias (name) + // so check for the propertyName. + if (isImportOrExportSpecifierName(location)) { + return location.getText(); + } + var name = typeInfoResolver.symbolToString(symbol); return stripQuotes(name); } - function getInternedName(symbol: Symbol, declarations: Declaration[]): string { + function getInternedName(symbol: Symbol, location: Node, declarations: Declaration[]): string { + // If this is an export or import specifier it could have been renamed using the as syntax. + // if so we want to search for whatever under the cursor, the symbol is pointing to the alias (name) + // so check for the propertyName. + if (isImportOrExportSpecifierName(location)) { + return location.getText(); + } + // Special case for function expressions, whose names are solely local to their bodies. var functionExpression = forEach(declarations, d => d.kind === SyntaxKind.FunctionExpression ? d : undefined); @@ -4047,16 +4185,22 @@ module ts { function getSymbolScope(symbol: Symbol): Node { // If this is private property or method, the scope is the containing class - if (symbol.getFlags() && (SymbolFlags.Property | SymbolFlags.Method)) { + if (symbol.flags & (SymbolFlags.Property | SymbolFlags.Method)) { var privateDeclaration = forEach(symbol.getDeclarations(), d => (d.flags & NodeFlags.Private) ? d : undefined); if (privateDeclaration) { return getAncestor(privateDeclaration, SyntaxKind.ClassDeclaration); } } + // If the symbol is an import we would like to find it if we are looking for what it imports. + // So consider it visibile outside its declaration scope. + if (symbol.flags & SymbolFlags.Import) { + return undefined; + } + // if this symbol is visible from its parent container, e.g. exported, then bail out // if symbol correspond to the union property - bail out - if (symbol.parent || (symbol.getFlags() & SymbolFlags.UnionProperty)) { + if (symbol.parent || (symbol.flags & SymbolFlags.UnionProperty)) { return undefined; } @@ -4411,6 +4555,11 @@ module ts { // The search set contains at least the current symbol var result = [symbol]; + // If the symbol is an alias, add what it alaises to the list + if (isImportOrExportSpecifierImportSymbol(symbol)) { + result.push(typeInfoResolver.getAliasedSymbol(symbol)); + } + // If the location is in a context sensitive location (i.e. in an object literal) try // to get a contextual type for it, and add the property symbol from the contextual // type to the search set @@ -4487,6 +4636,13 @@ module ts { return true; } + // If the reference symbol is an alias, check if what it is aliasing is one of the search + // symbols. + if (isImportOrExportSpecifierImportSymbol(referenceSymbol) && + searchSymbols.indexOf(typeInfoResolver.getAliasedSymbol(referenceSymbol)) >= 0) { + return true; + } + // If the reference location is in an object literal, try to get the contextual type for the // object literal, lookup the property symbol in the contextual type, and use this symbol to // compare to our searchSymbol @@ -4600,7 +4756,7 @@ module ts { /** A node is considered a writeAccess iff it is a name of a declaration or a target of an assignment */ function isWriteAccess(node: Node): boolean { - if (node.kind === SyntaxKind.Identifier && isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { + if (node.kind === SyntaxKind.Identifier && isDeclarationName(node)) { return true; } @@ -4694,13 +4850,21 @@ module ts { return SemanticMeaning.Namespace; } + case SyntaxKind.NamedImports: + case SyntaxKind.ImportSpecifier: case SyntaxKind.ImportEqualsDeclaration: + case SyntaxKind.ImportDeclaration: + case SyntaxKind.ExportAssignment: + case SyntaxKind.ExportDeclaration: return SemanticMeaning.Value | SemanticMeaning.Type | SemanticMeaning.Namespace; // An external module can be a Value case SyntaxKind.SourceFile: return SemanticMeaning.Namespace | SemanticMeaning.Value; } + + return SemanticMeaning.Value | SemanticMeaning.Type | SemanticMeaning.Namespace; + Debug.fail("Unknown declaration type"); } @@ -4754,7 +4918,7 @@ module ts { else if (isInRightSideOfImport(node)) { return getMeaningFromRightHandSideOfImportEquals(node); } - else if (isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { + else if (isDeclarationName(node)) { return getMeaningFromDeclaration(node.parent); } else if (isTypeReference(node)) { diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index d8e29de01a6..452fa63b1a6 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -161,28 +161,28 @@ declare module "typescript" { WhileKeyword = 99, WithKeyword = 100, AsKeyword = 101, - FromKeyword = 102, - ImplementsKeyword = 103, - InterfaceKeyword = 104, - LetKeyword = 105, - PackageKeyword = 106, - PrivateKeyword = 107, - ProtectedKeyword = 108, - PublicKeyword = 109, - StaticKeyword = 110, - YieldKeyword = 111, - AnyKeyword = 112, - BooleanKeyword = 113, - ConstructorKeyword = 114, - DeclareKeyword = 115, - GetKeyword = 116, - ModuleKeyword = 117, - RequireKeyword = 118, - NumberKeyword = 119, - SetKeyword = 120, - StringKeyword = 121, - SymbolKeyword = 122, - TypeKeyword = 123, + ImplementsKeyword = 102, + InterfaceKeyword = 103, + LetKeyword = 104, + PackageKeyword = 105, + PrivateKeyword = 106, + ProtectedKeyword = 107, + PublicKeyword = 108, + StaticKeyword = 109, + YieldKeyword = 110, + AnyKeyword = 111, + BooleanKeyword = 112, + ConstructorKeyword = 113, + DeclareKeyword = 114, + GetKeyword = 115, + ModuleKeyword = 116, + RequireKeyword = 117, + NumberKeyword = 118, + SetKeyword = 119, + StringKeyword = 120, + SymbolKeyword = 121, + TypeKeyword = 122, + FromKeyword = 123, OfKeyword = 124, QualifiedName = 125, ComputedPropertyName = 126, @@ -288,8 +288,8 @@ declare module "typescript" { LastReservedWord = 100, FirstKeyword = 65, LastKeyword = 124, - FirstFutureReservedWord = 103, - LastFutureReservedWord = 111, + FirstFutureReservedWord = 102, + LastFutureReservedWord = 110, FirstTypeNode = 139, LastTypeNode = 147, FirstPunctuation = 14, @@ -673,9 +673,8 @@ declare module "typescript" { catchClause?: CatchClause; finallyBlock?: Block; } - interface CatchClause extends Declaration { - name: Identifier; - type?: TypeNode; + interface CatchClause extends Node { + variableDeclaration: VariableDeclaration; block: Block; } interface ModuleElement extends Node { @@ -869,6 +868,7 @@ declare module "typescript" { getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; getAliasedSymbol(symbol: Symbol): Symbol; + getExportsOfExternalModule(node: ImportDeclaration): Symbol[]; } interface SymbolDisplayBuilder { buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index b3d5a3a0762..6da568bc132 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -501,72 +501,72 @@ declare module "typescript" { AsKeyword = 101, >AsKeyword : SyntaxKind - FromKeyword = 102, ->FromKeyword : SyntaxKind - - ImplementsKeyword = 103, + ImplementsKeyword = 102, >ImplementsKeyword : SyntaxKind - InterfaceKeyword = 104, + InterfaceKeyword = 103, >InterfaceKeyword : SyntaxKind - LetKeyword = 105, + LetKeyword = 104, >LetKeyword : SyntaxKind - PackageKeyword = 106, + PackageKeyword = 105, >PackageKeyword : SyntaxKind - PrivateKeyword = 107, + PrivateKeyword = 106, >PrivateKeyword : SyntaxKind - ProtectedKeyword = 108, + ProtectedKeyword = 107, >ProtectedKeyword : SyntaxKind - PublicKeyword = 109, + PublicKeyword = 108, >PublicKeyword : SyntaxKind - StaticKeyword = 110, + StaticKeyword = 109, >StaticKeyword : SyntaxKind - YieldKeyword = 111, + YieldKeyword = 110, >YieldKeyword : SyntaxKind - AnyKeyword = 112, + AnyKeyword = 111, >AnyKeyword : SyntaxKind - BooleanKeyword = 113, + BooleanKeyword = 112, >BooleanKeyword : SyntaxKind - ConstructorKeyword = 114, + ConstructorKeyword = 113, >ConstructorKeyword : SyntaxKind - DeclareKeyword = 115, + DeclareKeyword = 114, >DeclareKeyword : SyntaxKind - GetKeyword = 116, + GetKeyword = 115, >GetKeyword : SyntaxKind - ModuleKeyword = 117, + ModuleKeyword = 116, >ModuleKeyword : SyntaxKind - RequireKeyword = 118, + RequireKeyword = 117, >RequireKeyword : SyntaxKind - NumberKeyword = 119, + NumberKeyword = 118, >NumberKeyword : SyntaxKind - SetKeyword = 120, + SetKeyword = 119, >SetKeyword : SyntaxKind - StringKeyword = 121, + StringKeyword = 120, >StringKeyword : SyntaxKind - SymbolKeyword = 122, + SymbolKeyword = 121, >SymbolKeyword : SyntaxKind - TypeKeyword = 123, + TypeKeyword = 122, >TypeKeyword : SyntaxKind + FromKeyword = 123, +>FromKeyword : SyntaxKind + OfKeyword = 124, >OfKeyword : SyntaxKind @@ -882,10 +882,10 @@ declare module "typescript" { LastKeyword = 124, >LastKeyword : SyntaxKind - FirstFutureReservedWord = 103, + FirstFutureReservedWord = 102, >FirstFutureReservedWord : SyntaxKind - LastFutureReservedWord = 111, + LastFutureReservedWord = 110, >LastFutureReservedWord : SyntaxKind FirstTypeNode = 139, @@ -2030,17 +2030,13 @@ declare module "typescript" { >finallyBlock : Block >Block : Block } - interface CatchClause extends Declaration { + interface CatchClause extends Node { >CatchClause : CatchClause ->Declaration : Declaration +>Node : Node - name: Identifier; ->name : Identifier ->Identifier : Identifier - - type?: TypeNode; ->type : TypeNode ->TypeNode : TypeNode + variableDeclaration: VariableDeclaration; +>variableDeclaration : VariableDeclaration +>VariableDeclaration : VariableDeclaration block: Block; >block : Block @@ -2718,6 +2714,12 @@ declare module "typescript" { >getAliasedSymbol : (symbol: Symbol) => Symbol >symbol : Symbol >Symbol : Symbol +>Symbol : Symbol + + getExportsOfExternalModule(node: ImportDeclaration): Symbol[]; +>getExportsOfExternalModule : (node: ImportDeclaration) => Symbol[] +>node : ImportDeclaration +>ImportDeclaration : ImportDeclaration >Symbol : Symbol } interface SymbolDisplayBuilder { diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index aa2e869c242..d8279b02efa 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -192,28 +192,28 @@ declare module "typescript" { WhileKeyword = 99, WithKeyword = 100, AsKeyword = 101, - FromKeyword = 102, - ImplementsKeyword = 103, - InterfaceKeyword = 104, - LetKeyword = 105, - PackageKeyword = 106, - PrivateKeyword = 107, - ProtectedKeyword = 108, - PublicKeyword = 109, - StaticKeyword = 110, - YieldKeyword = 111, - AnyKeyword = 112, - BooleanKeyword = 113, - ConstructorKeyword = 114, - DeclareKeyword = 115, - GetKeyword = 116, - ModuleKeyword = 117, - RequireKeyword = 118, - NumberKeyword = 119, - SetKeyword = 120, - StringKeyword = 121, - SymbolKeyword = 122, - TypeKeyword = 123, + ImplementsKeyword = 102, + InterfaceKeyword = 103, + LetKeyword = 104, + PackageKeyword = 105, + PrivateKeyword = 106, + ProtectedKeyword = 107, + PublicKeyword = 108, + StaticKeyword = 109, + YieldKeyword = 110, + AnyKeyword = 111, + BooleanKeyword = 112, + ConstructorKeyword = 113, + DeclareKeyword = 114, + GetKeyword = 115, + ModuleKeyword = 116, + RequireKeyword = 117, + NumberKeyword = 118, + SetKeyword = 119, + StringKeyword = 120, + SymbolKeyword = 121, + TypeKeyword = 122, + FromKeyword = 123, OfKeyword = 124, QualifiedName = 125, ComputedPropertyName = 126, @@ -319,8 +319,8 @@ declare module "typescript" { LastReservedWord = 100, FirstKeyword = 65, LastKeyword = 124, - FirstFutureReservedWord = 103, - LastFutureReservedWord = 111, + FirstFutureReservedWord = 102, + LastFutureReservedWord = 110, FirstTypeNode = 139, LastTypeNode = 147, FirstPunctuation = 14, @@ -704,9 +704,8 @@ declare module "typescript" { catchClause?: CatchClause; finallyBlock?: Block; } - interface CatchClause extends Declaration { - name: Identifier; - type?: TypeNode; + interface CatchClause extends Node { + variableDeclaration: VariableDeclaration; block: Block; } interface ModuleElement extends Node { @@ -900,6 +899,7 @@ declare module "typescript" { getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; getAliasedSymbol(symbol: Symbol): Symbol; + getExportsOfExternalModule(node: ImportDeclaration): Symbol[]; } interface SymbolDisplayBuilder { buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index e0c7331381c..12064132646 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -647,72 +647,72 @@ declare module "typescript" { AsKeyword = 101, >AsKeyword : SyntaxKind - FromKeyword = 102, ->FromKeyword : SyntaxKind - - ImplementsKeyword = 103, + ImplementsKeyword = 102, >ImplementsKeyword : SyntaxKind - InterfaceKeyword = 104, + InterfaceKeyword = 103, >InterfaceKeyword : SyntaxKind - LetKeyword = 105, + LetKeyword = 104, >LetKeyword : SyntaxKind - PackageKeyword = 106, + PackageKeyword = 105, >PackageKeyword : SyntaxKind - PrivateKeyword = 107, + PrivateKeyword = 106, >PrivateKeyword : SyntaxKind - ProtectedKeyword = 108, + ProtectedKeyword = 107, >ProtectedKeyword : SyntaxKind - PublicKeyword = 109, + PublicKeyword = 108, >PublicKeyword : SyntaxKind - StaticKeyword = 110, + StaticKeyword = 109, >StaticKeyword : SyntaxKind - YieldKeyword = 111, + YieldKeyword = 110, >YieldKeyword : SyntaxKind - AnyKeyword = 112, + AnyKeyword = 111, >AnyKeyword : SyntaxKind - BooleanKeyword = 113, + BooleanKeyword = 112, >BooleanKeyword : SyntaxKind - ConstructorKeyword = 114, + ConstructorKeyword = 113, >ConstructorKeyword : SyntaxKind - DeclareKeyword = 115, + DeclareKeyword = 114, >DeclareKeyword : SyntaxKind - GetKeyword = 116, + GetKeyword = 115, >GetKeyword : SyntaxKind - ModuleKeyword = 117, + ModuleKeyword = 116, >ModuleKeyword : SyntaxKind - RequireKeyword = 118, + RequireKeyword = 117, >RequireKeyword : SyntaxKind - NumberKeyword = 119, + NumberKeyword = 118, >NumberKeyword : SyntaxKind - SetKeyword = 120, + SetKeyword = 119, >SetKeyword : SyntaxKind - StringKeyword = 121, + StringKeyword = 120, >StringKeyword : SyntaxKind - SymbolKeyword = 122, + SymbolKeyword = 121, >SymbolKeyword : SyntaxKind - TypeKeyword = 123, + TypeKeyword = 122, >TypeKeyword : SyntaxKind + FromKeyword = 123, +>FromKeyword : SyntaxKind + OfKeyword = 124, >OfKeyword : SyntaxKind @@ -1028,10 +1028,10 @@ declare module "typescript" { LastKeyword = 124, >LastKeyword : SyntaxKind - FirstFutureReservedWord = 103, + FirstFutureReservedWord = 102, >FirstFutureReservedWord : SyntaxKind - LastFutureReservedWord = 111, + LastFutureReservedWord = 110, >LastFutureReservedWord : SyntaxKind FirstTypeNode = 139, @@ -2176,17 +2176,13 @@ declare module "typescript" { >finallyBlock : Block >Block : Block } - interface CatchClause extends Declaration { + interface CatchClause extends Node { >CatchClause : CatchClause ->Declaration : Declaration +>Node : Node - name: Identifier; ->name : Identifier ->Identifier : Identifier - - type?: TypeNode; ->type : TypeNode ->TypeNode : TypeNode + variableDeclaration: VariableDeclaration; +>variableDeclaration : VariableDeclaration +>VariableDeclaration : VariableDeclaration block: Block; >block : Block @@ -2864,6 +2860,12 @@ declare module "typescript" { >getAliasedSymbol : (symbol: Symbol) => Symbol >symbol : Symbol >Symbol : Symbol +>Symbol : Symbol + + getExportsOfExternalModule(node: ImportDeclaration): Symbol[]; +>getExportsOfExternalModule : (node: ImportDeclaration) => Symbol[] +>node : ImportDeclaration +>ImportDeclaration : ImportDeclaration >Symbol : Symbol } interface SymbolDisplayBuilder { diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index 219500e0591..4b993e7213d 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -193,28 +193,28 @@ declare module "typescript" { WhileKeyword = 99, WithKeyword = 100, AsKeyword = 101, - FromKeyword = 102, - ImplementsKeyword = 103, - InterfaceKeyword = 104, - LetKeyword = 105, - PackageKeyword = 106, - PrivateKeyword = 107, - ProtectedKeyword = 108, - PublicKeyword = 109, - StaticKeyword = 110, - YieldKeyword = 111, - AnyKeyword = 112, - BooleanKeyword = 113, - ConstructorKeyword = 114, - DeclareKeyword = 115, - GetKeyword = 116, - ModuleKeyword = 117, - RequireKeyword = 118, - NumberKeyword = 119, - SetKeyword = 120, - StringKeyword = 121, - SymbolKeyword = 122, - TypeKeyword = 123, + ImplementsKeyword = 102, + InterfaceKeyword = 103, + LetKeyword = 104, + PackageKeyword = 105, + PrivateKeyword = 106, + ProtectedKeyword = 107, + PublicKeyword = 108, + StaticKeyword = 109, + YieldKeyword = 110, + AnyKeyword = 111, + BooleanKeyword = 112, + ConstructorKeyword = 113, + DeclareKeyword = 114, + GetKeyword = 115, + ModuleKeyword = 116, + RequireKeyword = 117, + NumberKeyword = 118, + SetKeyword = 119, + StringKeyword = 120, + SymbolKeyword = 121, + TypeKeyword = 122, + FromKeyword = 123, OfKeyword = 124, QualifiedName = 125, ComputedPropertyName = 126, @@ -320,8 +320,8 @@ declare module "typescript" { LastReservedWord = 100, FirstKeyword = 65, LastKeyword = 124, - FirstFutureReservedWord = 103, - LastFutureReservedWord = 111, + FirstFutureReservedWord = 102, + LastFutureReservedWord = 110, FirstTypeNode = 139, LastTypeNode = 147, FirstPunctuation = 14, @@ -705,9 +705,8 @@ declare module "typescript" { catchClause?: CatchClause; finallyBlock?: Block; } - interface CatchClause extends Declaration { - name: Identifier; - type?: TypeNode; + interface CatchClause extends Node { + variableDeclaration: VariableDeclaration; block: Block; } interface ModuleElement extends Node { @@ -901,6 +900,7 @@ declare module "typescript" { getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; getAliasedSymbol(symbol: Symbol): Symbol; + getExportsOfExternalModule(node: ImportDeclaration): Symbol[]; } interface SymbolDisplayBuilder { buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index ed16bc21372..9368e5438fc 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -597,72 +597,72 @@ declare module "typescript" { AsKeyword = 101, >AsKeyword : SyntaxKind - FromKeyword = 102, ->FromKeyword : SyntaxKind - - ImplementsKeyword = 103, + ImplementsKeyword = 102, >ImplementsKeyword : SyntaxKind - InterfaceKeyword = 104, + InterfaceKeyword = 103, >InterfaceKeyword : SyntaxKind - LetKeyword = 105, + LetKeyword = 104, >LetKeyword : SyntaxKind - PackageKeyword = 106, + PackageKeyword = 105, >PackageKeyword : SyntaxKind - PrivateKeyword = 107, + PrivateKeyword = 106, >PrivateKeyword : SyntaxKind - ProtectedKeyword = 108, + ProtectedKeyword = 107, >ProtectedKeyword : SyntaxKind - PublicKeyword = 109, + PublicKeyword = 108, >PublicKeyword : SyntaxKind - StaticKeyword = 110, + StaticKeyword = 109, >StaticKeyword : SyntaxKind - YieldKeyword = 111, + YieldKeyword = 110, >YieldKeyword : SyntaxKind - AnyKeyword = 112, + AnyKeyword = 111, >AnyKeyword : SyntaxKind - BooleanKeyword = 113, + BooleanKeyword = 112, >BooleanKeyword : SyntaxKind - ConstructorKeyword = 114, + ConstructorKeyword = 113, >ConstructorKeyword : SyntaxKind - DeclareKeyword = 115, + DeclareKeyword = 114, >DeclareKeyword : SyntaxKind - GetKeyword = 116, + GetKeyword = 115, >GetKeyword : SyntaxKind - ModuleKeyword = 117, + ModuleKeyword = 116, >ModuleKeyword : SyntaxKind - RequireKeyword = 118, + RequireKeyword = 117, >RequireKeyword : SyntaxKind - NumberKeyword = 119, + NumberKeyword = 118, >NumberKeyword : SyntaxKind - SetKeyword = 120, + SetKeyword = 119, >SetKeyword : SyntaxKind - StringKeyword = 121, + StringKeyword = 120, >StringKeyword : SyntaxKind - SymbolKeyword = 122, + SymbolKeyword = 121, >SymbolKeyword : SyntaxKind - TypeKeyword = 123, + TypeKeyword = 122, >TypeKeyword : SyntaxKind + FromKeyword = 123, +>FromKeyword : SyntaxKind + OfKeyword = 124, >OfKeyword : SyntaxKind @@ -978,10 +978,10 @@ declare module "typescript" { LastKeyword = 124, >LastKeyword : SyntaxKind - FirstFutureReservedWord = 103, + FirstFutureReservedWord = 102, >FirstFutureReservedWord : SyntaxKind - LastFutureReservedWord = 111, + LastFutureReservedWord = 110, >LastFutureReservedWord : SyntaxKind FirstTypeNode = 139, @@ -2126,17 +2126,13 @@ declare module "typescript" { >finallyBlock : Block >Block : Block } - interface CatchClause extends Declaration { + interface CatchClause extends Node { >CatchClause : CatchClause ->Declaration : Declaration +>Node : Node - name: Identifier; ->name : Identifier ->Identifier : Identifier - - type?: TypeNode; ->type : TypeNode ->TypeNode : TypeNode + variableDeclaration: VariableDeclaration; +>variableDeclaration : VariableDeclaration +>VariableDeclaration : VariableDeclaration block: Block; >block : Block @@ -2814,6 +2810,12 @@ declare module "typescript" { >getAliasedSymbol : (symbol: Symbol) => Symbol >symbol : Symbol >Symbol : Symbol +>Symbol : Symbol + + getExportsOfExternalModule(node: ImportDeclaration): Symbol[]; +>getExportsOfExternalModule : (node: ImportDeclaration) => Symbol[] +>node : ImportDeclaration +>ImportDeclaration : ImportDeclaration >Symbol : Symbol } interface SymbolDisplayBuilder { diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index 0e534c6471f..21c65b2f7bc 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -230,28 +230,28 @@ declare module "typescript" { WhileKeyword = 99, WithKeyword = 100, AsKeyword = 101, - FromKeyword = 102, - ImplementsKeyword = 103, - InterfaceKeyword = 104, - LetKeyword = 105, - PackageKeyword = 106, - PrivateKeyword = 107, - ProtectedKeyword = 108, - PublicKeyword = 109, - StaticKeyword = 110, - YieldKeyword = 111, - AnyKeyword = 112, - BooleanKeyword = 113, - ConstructorKeyword = 114, - DeclareKeyword = 115, - GetKeyword = 116, - ModuleKeyword = 117, - RequireKeyword = 118, - NumberKeyword = 119, - SetKeyword = 120, - StringKeyword = 121, - SymbolKeyword = 122, - TypeKeyword = 123, + ImplementsKeyword = 102, + InterfaceKeyword = 103, + LetKeyword = 104, + PackageKeyword = 105, + PrivateKeyword = 106, + ProtectedKeyword = 107, + PublicKeyword = 108, + StaticKeyword = 109, + YieldKeyword = 110, + AnyKeyword = 111, + BooleanKeyword = 112, + ConstructorKeyword = 113, + DeclareKeyword = 114, + GetKeyword = 115, + ModuleKeyword = 116, + RequireKeyword = 117, + NumberKeyword = 118, + SetKeyword = 119, + StringKeyword = 120, + SymbolKeyword = 121, + TypeKeyword = 122, + FromKeyword = 123, OfKeyword = 124, QualifiedName = 125, ComputedPropertyName = 126, @@ -357,8 +357,8 @@ declare module "typescript" { LastReservedWord = 100, FirstKeyword = 65, LastKeyword = 124, - FirstFutureReservedWord = 103, - LastFutureReservedWord = 111, + FirstFutureReservedWord = 102, + LastFutureReservedWord = 110, FirstTypeNode = 139, LastTypeNode = 147, FirstPunctuation = 14, @@ -742,9 +742,8 @@ declare module "typescript" { catchClause?: CatchClause; finallyBlock?: Block; } - interface CatchClause extends Declaration { - name: Identifier; - type?: TypeNode; + interface CatchClause extends Node { + variableDeclaration: VariableDeclaration; block: Block; } interface ModuleElement extends Node { @@ -938,6 +937,7 @@ declare module "typescript" { getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; getAliasedSymbol(symbol: Symbol): Symbol; + getExportsOfExternalModule(node: ImportDeclaration): Symbol[]; } interface SymbolDisplayBuilder { buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index e86397511cf..b97882f80e9 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -770,72 +770,72 @@ declare module "typescript" { AsKeyword = 101, >AsKeyword : SyntaxKind - FromKeyword = 102, ->FromKeyword : SyntaxKind - - ImplementsKeyword = 103, + ImplementsKeyword = 102, >ImplementsKeyword : SyntaxKind - InterfaceKeyword = 104, + InterfaceKeyword = 103, >InterfaceKeyword : SyntaxKind - LetKeyword = 105, + LetKeyword = 104, >LetKeyword : SyntaxKind - PackageKeyword = 106, + PackageKeyword = 105, >PackageKeyword : SyntaxKind - PrivateKeyword = 107, + PrivateKeyword = 106, >PrivateKeyword : SyntaxKind - ProtectedKeyword = 108, + ProtectedKeyword = 107, >ProtectedKeyword : SyntaxKind - PublicKeyword = 109, + PublicKeyword = 108, >PublicKeyword : SyntaxKind - StaticKeyword = 110, + StaticKeyword = 109, >StaticKeyword : SyntaxKind - YieldKeyword = 111, + YieldKeyword = 110, >YieldKeyword : SyntaxKind - AnyKeyword = 112, + AnyKeyword = 111, >AnyKeyword : SyntaxKind - BooleanKeyword = 113, + BooleanKeyword = 112, >BooleanKeyword : SyntaxKind - ConstructorKeyword = 114, + ConstructorKeyword = 113, >ConstructorKeyword : SyntaxKind - DeclareKeyword = 115, + DeclareKeyword = 114, >DeclareKeyword : SyntaxKind - GetKeyword = 116, + GetKeyword = 115, >GetKeyword : SyntaxKind - ModuleKeyword = 117, + ModuleKeyword = 116, >ModuleKeyword : SyntaxKind - RequireKeyword = 118, + RequireKeyword = 117, >RequireKeyword : SyntaxKind - NumberKeyword = 119, + NumberKeyword = 118, >NumberKeyword : SyntaxKind - SetKeyword = 120, + SetKeyword = 119, >SetKeyword : SyntaxKind - StringKeyword = 121, + StringKeyword = 120, >StringKeyword : SyntaxKind - SymbolKeyword = 122, + SymbolKeyword = 121, >SymbolKeyword : SyntaxKind - TypeKeyword = 123, + TypeKeyword = 122, >TypeKeyword : SyntaxKind + FromKeyword = 123, +>FromKeyword : SyntaxKind + OfKeyword = 124, >OfKeyword : SyntaxKind @@ -1151,10 +1151,10 @@ declare module "typescript" { LastKeyword = 124, >LastKeyword : SyntaxKind - FirstFutureReservedWord = 103, + FirstFutureReservedWord = 102, >FirstFutureReservedWord : SyntaxKind - LastFutureReservedWord = 111, + LastFutureReservedWord = 110, >LastFutureReservedWord : SyntaxKind FirstTypeNode = 139, @@ -2299,17 +2299,13 @@ declare module "typescript" { >finallyBlock : Block >Block : Block } - interface CatchClause extends Declaration { + interface CatchClause extends Node { >CatchClause : CatchClause ->Declaration : Declaration +>Node : Node - name: Identifier; ->name : Identifier ->Identifier : Identifier - - type?: TypeNode; ->type : TypeNode ->TypeNode : TypeNode + variableDeclaration: VariableDeclaration; +>variableDeclaration : VariableDeclaration +>VariableDeclaration : VariableDeclaration block: Block; >block : Block @@ -2987,6 +2983,12 @@ declare module "typescript" { >getAliasedSymbol : (symbol: Symbol) => Symbol >symbol : Symbol >Symbol : Symbol +>Symbol : Symbol + + getExportsOfExternalModule(node: ImportDeclaration): Symbol[]; +>getExportsOfExternalModule : (node: ImportDeclaration) => Symbol[] +>node : ImportDeclaration +>ImportDeclaration : ImportDeclaration >Symbol : Symbol } interface SymbolDisplayBuilder { diff --git a/tests/baselines/reference/ES5SymbolProperty1.js b/tests/baselines/reference/ES5SymbolProperty1.js index e977df7dc6b..ab3f420c95c 100644 --- a/tests/baselines/reference/ES5SymbolProperty1.js +++ b/tests/baselines/reference/ES5SymbolProperty1.js @@ -12,8 +12,8 @@ obj[Symbol.foo]; //// [ES5SymbolProperty1.js] var Symbol; -var obj = (_a = {}, _a[Symbol.foo] = -0, -_a); +var obj = (_a = {}, + _a[Symbol.foo] = 0, + _a); obj[Symbol.foo]; var _a; diff --git a/tests/baselines/reference/FunctionDeclaration8_es6.js b/tests/baselines/reference/FunctionDeclaration8_es6.js index 3f6d2499cef..62692997a91 100644 --- a/tests/baselines/reference/FunctionDeclaration8_es6.js +++ b/tests/baselines/reference/FunctionDeclaration8_es6.js @@ -2,7 +2,7 @@ var v = { [yield]: foo } //// [FunctionDeclaration8_es6.js] -var v = (_a = {}, _a[yield] = -foo, -_a); +var v = (_a = {}, + _a[yield] = foo, + _a); var _a; diff --git a/tests/baselines/reference/FunctionDeclaration9_es6.js b/tests/baselines/reference/FunctionDeclaration9_es6.js index 04c946a96eb..c63cf5bb458 100644 --- a/tests/baselines/reference/FunctionDeclaration9_es6.js +++ b/tests/baselines/reference/FunctionDeclaration9_es6.js @@ -5,8 +5,8 @@ function * foo() { //// [FunctionDeclaration9_es6.js] function foo() { - var v = (_a = {}, _a[] = - foo, - _a); + var v = (_a = {}, + _a[] = foo, + _a); var _a; } diff --git a/tests/baselines/reference/FunctionPropertyAssignments5_es6.js b/tests/baselines/reference/FunctionPropertyAssignments5_es6.js index 0b786632bdf..51e5d0000e4 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments5_es6.js +++ b/tests/baselines/reference/FunctionPropertyAssignments5_es6.js @@ -2,6 +2,7 @@ var v = { *[foo()]() { } } //// [FunctionPropertyAssignments5_es6.js] -var v = (_a = {}, _a[foo()] = function () { }, -_a); +var v = (_a = {}, + _a[foo()] = function () { }, + _a); var _a; diff --git a/tests/baselines/reference/accessorWithRestParam.js b/tests/baselines/reference/accessorWithRestParam.js index a0b7e849e51..9feafe1904d 100644 --- a/tests/baselines/reference/accessorWithRestParam.js +++ b/tests/baselines/reference/accessorWithRestParam.js @@ -10,12 +10,22 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "X", { - set: function () { }, + set: function () { + var v = []; + for (var _i = 0; _i < arguments.length; _i++) { + v[_i - 0] = arguments[_i]; + } + }, enumerable: true, configurable: true }); Object.defineProperty(C, "X", { - set: function () { }, + set: function () { + var v2 = []; + for (var _i = 0; _i < arguments.length; _i++) { + v2[_i - 0] = arguments[_i]; + } + }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/arrayLiteralInNonVarArgParameter.js b/tests/baselines/reference/arrayLiteralInNonVarArgParameter.js index 9edf545f8b4..57cba07d6bf 100644 --- a/tests/baselines/reference/arrayLiteralInNonVarArgParameter.js +++ b/tests/baselines/reference/arrayLiteralInNonVarArgParameter.js @@ -5,5 +5,10 @@ panic([], 'one', 'two'); //// [arrayLiteralInNonVarArgParameter.js] -function panic(val) { } +function panic(val) { + var opt = []; + for (var _i = 1; _i < arguments.length; _i++) { + opt[_i - 1] = arguments[_i]; + } +} panic([], 'one', 'two'); diff --git a/tests/baselines/reference/asiArith.js b/tests/baselines/reference/asiArith.js index ac739bbd767..8e957aae332 100644 --- a/tests/baselines/reference/asiArith.js +++ b/tests/baselines/reference/asiArith.js @@ -38,8 +38,8 @@ y var x = 1; var y = 1; var z = x + -+ +y; + + +y; var a = 1; var b = 1; var c = x - -- -y; + - -y; diff --git a/tests/baselines/reference/baseTypeAfterDerivedType.js b/tests/baselines/reference/baseTypeAfterDerivedType.js index 65b73a17542..c64239ac0c8 100644 --- a/tests/baselines/reference/baseTypeAfterDerivedType.js +++ b/tests/baselines/reference/baseTypeAfterDerivedType.js @@ -20,6 +20,11 @@ interface Base2 { var Derived2 = (function () { function Derived2() { } - Derived2.prototype.method = function () { }; + Derived2.prototype.method = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i - 0] = arguments[_i]; + } + }; return Derived2; })(); diff --git a/tests/baselines/reference/bpSpan_exports.baseline b/tests/baselines/reference/bpSpan_exports.baseline new file mode 100644 index 00000000000..1b09fb75a2f --- /dev/null +++ b/tests/baselines/reference/bpSpan_exports.baseline @@ -0,0 +1,17 @@ + +1 >export * from "a"; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 18) SpanInfo: {"start":0,"length":17} + >export * from "a" + >:=> (line 1, col 0) to (line 1, col 17) +-------------------------------- +2 >export {a as A} from "a"; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (19 to 44) SpanInfo: {"start":19,"length":24} + >export {a as A} from "a" + >:=> (line 2, col 0) to (line 2, col 24) +-------------------------------- +3 >export import e = require("a"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (45 to 75) SpanInfo: {"start":45,"length":30} + >export import e = require("a") + >:=> (line 3, col 0) to (line 3, col 30) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_imports.baseline b/tests/baselines/reference/bpSpan_imports.baseline new file mode 100644 index 00000000000..c59f9faf904 --- /dev/null +++ b/tests/baselines/reference/bpSpan_imports.baseline @@ -0,0 +1,35 @@ + +1 >import * as NS from "a"; + + ~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 24) SpanInfo: {"start":0,"length":23} + >import * as NS from "a" + >:=> (line 1, col 0) to (line 1, col 23) +-------------------------------- +2 >import {a as A} from "a"; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (25 to 50) SpanInfo: {"start":25,"length":24} + >import {a as A} from "a" + >:=> (line 2, col 0) to (line 2, col 24) +-------------------------------- +3 > import d from "a"; + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (51 to 70) SpanInfo: {"start":52,"length":17} + >import d from "a" + >:=> (line 3, col 1) to (line 3, col 18) +-------------------------------- +4 >import d2, {c, d as D} from "a"; + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (71 to 103) SpanInfo: {"start":71,"length":31} + >import d2, {c, d as D} from "a" + >:=> (line 4, col 0) to (line 4, col 31) +-------------------------------- +5 >import "a"; + + ~~~~~~~~~~~~ => Pos: (104 to 115) SpanInfo: {"start":104,"length":10} + >import "a" + >:=> (line 5, col 0) to (line 5, col 10) +-------------------------------- +6 >import e = require("a"); + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (116 to 139) SpanInfo: {"start":116,"length":23} + >import e = require("a") + >:=> (line 6, col 0) to (line 6, col 23) \ No newline at end of file diff --git a/tests/baselines/reference/bpSpan_stmts.baseline b/tests/baselines/reference/bpSpan_stmts.baseline index a81559ee9a5..7f6bf21b40b 100644 --- a/tests/baselines/reference/bpSpan_stmts.baseline +++ b/tests/baselines/reference/bpSpan_stmts.baseline @@ -217,7 +217,15 @@ >:=> (line 28, col 8) to (line 28, col 22) 29 > } catch (e) { - ~~~~~~~~~~~~~ => Pos: (416 to 428) SpanInfo: {"start":437,"length":15} + ~~~~~~~~ => Pos: (416 to 423) SpanInfo: {"start":437,"length":15} + >if (obj.z < 10) + >:=> (line 30, col 8) to (line 30, col 23) +29 > } catch (e) { + + ~ => Pos: (424 to 424) SpanInfo: undefined +29 > } catch (e) { + + ~~~~ => Pos: (425 to 428) SpanInfo: {"start":437,"length":15} >if (obj.z < 10) >:=> (line 30, col 8) to (line 30, col 23) -------------------------------- @@ -286,7 +294,15 @@ >:=> (line 37, col 8) to (line 37, col 25) 38 > } catch (e1) { - ~~~~~~~~~~~~~~ => Pos: (581 to 594) SpanInfo: {"start":603,"length":10} + ~~~~~~~~ => Pos: (581 to 588) SpanInfo: {"start":603,"length":10} + >var b = e1 + >:=> (line 39, col 8) to (line 39, col 18) +38 > } catch (e1) { + + ~~ => Pos: (589 to 590) SpanInfo: undefined +38 > } catch (e1) { + + ~~~~ => Pos: (591 to 594) SpanInfo: {"start":603,"length":10} >var b = e1 >:=> (line 39, col 8) to (line 39, col 18) -------------------------------- diff --git a/tests/baselines/reference/bpSpan_tryCatchFinally.baseline b/tests/baselines/reference/bpSpan_tryCatchFinally.baseline index 5a9e569f403..e5465b8812c 100644 --- a/tests/baselines/reference/bpSpan_tryCatchFinally.baseline +++ b/tests/baselines/reference/bpSpan_tryCatchFinally.baseline @@ -24,7 +24,15 @@ >:=> (line 3, col 4) to (line 3, col 13) 4 >} catch (e) { - ~~~~~~~~~~~~~ => Pos: (34 to 46) SpanInfo: {"start":51,"length":9} + ~~~~~~~~ => Pos: (34 to 41) SpanInfo: {"start":51,"length":9} + >x = x - 1 + >:=> (line 5, col 4) to (line 5, col 13) +4 >} catch (e) { + + ~ => Pos: (42 to 42) SpanInfo: undefined +4 >} catch (e) { + + ~~~~ => Pos: (43 to 46) SpanInfo: {"start":51,"length":9} >x = x - 1 >:=> (line 5, col 4) to (line 5, col 13) -------------------------------- @@ -94,7 +102,15 @@ -------------------------------- 14 >catch (e) - ~~~~~~~~~~ => Pos: (138 to 147) SpanInfo: {"start":154,"length":9} + ~~~~~~~ => Pos: (138 to 144) SpanInfo: {"start":154,"length":9} + >x = x - 1 + >:=> (line 16, col 4) to (line 16, col 13) +14 >catch (e) + + ~ => Pos: (145 to 145) SpanInfo: undefined +14 >catch (e) + + ~~ => Pos: (146 to 147) SpanInfo: {"start":154,"length":9} >x = x - 1 >:=> (line 16, col 4) to (line 16, col 13) -------------------------------- diff --git a/tests/baselines/reference/callWithSpread.js b/tests/baselines/reference/callWithSpread.js index e9f7a7a3288..d676c0f2a33 100644 --- a/tests/baselines/reference/callWithSpread.js +++ b/tests/baselines/reference/callWithSpread.js @@ -61,6 +61,10 @@ var __extends = this.__extends || function (d, b) { d.prototype = new __(); }; function foo(x, y) { + var z = []; + for (var _i = 2; _i < arguments.length; _i++) { + z[_i - 2] = arguments[_i]; + } } var a; var z; @@ -89,6 +93,10 @@ var C = (function () { this.foo.apply(this, [x, y].concat(z)); } C.prototype.foo = function (x, y) { + var z = []; + for (var _i = 2; _i < arguments.length; _i++) { + z[_i - 2] = arguments[_i]; + } }; return C; })(); diff --git a/tests/baselines/reference/catchClauseWithBindingPattern1.errors.txt b/tests/baselines/reference/catchClauseWithBindingPattern1.errors.txt new file mode 100644 index 00000000000..0b7482850e5 --- /dev/null +++ b/tests/baselines/reference/catchClauseWithBindingPattern1.errors.txt @@ -0,0 +1,10 @@ +tests/cases/compiler/catchClauseWithBindingPattern1.ts(3,8): error TS1195: Catch clause variable name must be an identifier. + + +==== tests/cases/compiler/catchClauseWithBindingPattern1.ts (1 errors) ==== + try { + } + catch ({a}) { + ~ +!!! error TS1195: Catch clause variable name must be an identifier. + } \ No newline at end of file diff --git a/tests/baselines/reference/catchClauseWithBindingPattern1.js b/tests/baselines/reference/catchClauseWithBindingPattern1.js new file mode 100644 index 00000000000..bbdc259946c --- /dev/null +++ b/tests/baselines/reference/catchClauseWithBindingPattern1.js @@ -0,0 +1,11 @@ +//// [catchClauseWithBindingPattern1.ts] +try { +} +catch ({a}) { +} + +//// [catchClauseWithBindingPattern1.js] +try { +} +catch (a = (void 0).a) { +} diff --git a/tests/baselines/reference/catchClauseWithInitializer1.errors.txt b/tests/baselines/reference/catchClauseWithInitializer1.errors.txt new file mode 100644 index 00000000000..b13644f4d83 --- /dev/null +++ b/tests/baselines/reference/catchClauseWithInitializer1.errors.txt @@ -0,0 +1,10 @@ +tests/cases/compiler/catchClauseWithInitializer1.ts(3,12): error TS1197: Catch clause variable cannot have an initializer. + + +==== tests/cases/compiler/catchClauseWithInitializer1.ts (1 errors) ==== + try { + } + catch (e = 1) { + ~ +!!! error TS1197: Catch clause variable cannot have an initializer. + } \ No newline at end of file diff --git a/tests/baselines/reference/catchClauseWithInitializer1.js b/tests/baselines/reference/catchClauseWithInitializer1.js new file mode 100644 index 00000000000..5cb89a567f1 --- /dev/null +++ b/tests/baselines/reference/catchClauseWithInitializer1.js @@ -0,0 +1,11 @@ +//// [catchClauseWithInitializer1.ts] +try { +} +catch (e = 1) { +} + +//// [catchClauseWithInitializer1.js] +try { +} +catch (e = 1) { +} diff --git a/tests/baselines/reference/catchClauseWithTypeAnnotation.errors.txt b/tests/baselines/reference/catchClauseWithTypeAnnotation.errors.txt index d3eea6619b6..5bc7339d2fc 100644 --- a/tests/baselines/reference/catchClauseWithTypeAnnotation.errors.txt +++ b/tests/baselines/reference/catchClauseWithTypeAnnotation.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/catchClauseWithTypeAnnotation.ts(2,11): error TS1013: Catch clause parameter cannot have a type annotation. +tests/cases/compiler/catchClauseWithTypeAnnotation.ts(2,13): error TS1196: Catch clause variable cannot have a type annotation. ==== tests/cases/compiler/catchClauseWithTypeAnnotation.ts (1 errors) ==== try { } catch (e: any) { - ~ -!!! error TS1013: Catch clause parameter cannot have a type annotation. + ~~~ +!!! error TS1196: Catch clause variable cannot have a type annotation. } \ No newline at end of file diff --git a/tests/baselines/reference/collisionRestParameterFunction.js b/tests/baselines/reference/collisionRestParameterFunction.js index 9ae266dad41..8660e8f5db0 100644 --- a/tests/baselines/reference/collisionRestParameterFunction.js +++ b/tests/baselines/reference/collisionRestParameterFunction.js @@ -56,6 +56,10 @@ function f3NoError() { var _i = 10; // no error } function f4(_i) { + var rest = []; + for (var _a = 1; _a < arguments.length; _a++) { + rest[_a - 1] = arguments[_a]; + } } function f4NoError(_i) { } diff --git a/tests/baselines/reference/collisionRestParameterFunctionExpressions.js b/tests/baselines/reference/collisionRestParameterFunctionExpressions.js index f45619ddb71..22709b087eb 100644 --- a/tests/baselines/reference/collisionRestParameterFunctionExpressions.js +++ b/tests/baselines/reference/collisionRestParameterFunctionExpressions.js @@ -47,6 +47,10 @@ function foo() { var _i = 10; // no error } function f4(_i) { + var rest = []; + for (var _a = 1; _a < arguments.length; _a++) { + rest[_a - 1] = arguments[_a]; + } } function f4NoError(_i) { } diff --git a/tests/baselines/reference/computedPropertyNames10_ES5.js b/tests/baselines/reference/computedPropertyNames10_ES5.js index ececb28b8cc..302f9355be8 100644 --- a/tests/baselines/reference/computedPropertyNames10_ES5.js +++ b/tests/baselines/reference/computedPropertyNames10_ES5.js @@ -20,6 +20,17 @@ var v = { var s; var n; var a; -var v = (_a = {}, _a[s] = function () { }, _a[n] = function () { }, _a[s + s] = function () { }, _a[s + n] = function () { }, _a[+s] = function () { }, _a[""] = function () { }, _a[0] = function () { }, _a[a] = function () { }, _a[true] = function () { }, _a["hello bye"] = function () { }, _a["hello " + a + " bye"] = function () { }, -_a); +var v = (_a = {}, + _a[s] = function () { }, + _a[n] = function () { }, + _a[s + s] = function () { }, + _a[s + n] = function () { }, + _a[+s] = function () { }, + _a[""] = function () { }, + _a[0] = function () { }, + _a[a] = function () { }, + _a[true] = function () { }, + _a["hello bye"] = function () { }, + _a["hello " + a + " bye"] = function () { }, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames11_ES5.js b/tests/baselines/reference/computedPropertyNames11_ES5.js index d8450deb765..69902003342 100644 --- a/tests/baselines/reference/computedPropertyNames11_ES5.js +++ b/tests/baselines/reference/computedPropertyNames11_ES5.js @@ -20,6 +20,17 @@ var v = { var s; var n; var a; -var v = (_a = {}, _a[s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[s + s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[s + n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[+s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[""] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[0] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[a] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[true] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a["hello bye"] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a["hello " + a + " bye"] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), -_a); +var v = (_a = {}, + _a[s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), + _a[n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), + _a[s + s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), + _a[s + n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), + _a[+s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), + _a[""] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), + _a[0] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), + _a[a] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), + _a[true] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), + _a["hello bye"] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), + _a["hello " + a + " bye"] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames18_ES5.js b/tests/baselines/reference/computedPropertyNames18_ES5.js index 0ccc0fb4e00..a62af506531 100644 --- a/tests/baselines/reference/computedPropertyNames18_ES5.js +++ b/tests/baselines/reference/computedPropertyNames18_ES5.js @@ -7,8 +7,8 @@ function foo() { //// [computedPropertyNames18_ES5.js] function foo() { - var obj = (_a = {}, _a[this.bar] = - 0, - _a); + var obj = (_a = {}, + _a[this.bar] = 0, + _a); var _a; } diff --git a/tests/baselines/reference/computedPropertyNames19_ES5.js b/tests/baselines/reference/computedPropertyNames19_ES5.js index a18cb7b95c3..bda3e01bbed 100644 --- a/tests/baselines/reference/computedPropertyNames19_ES5.js +++ b/tests/baselines/reference/computedPropertyNames19_ES5.js @@ -8,8 +8,8 @@ module M { //// [computedPropertyNames19_ES5.js] var M; (function (M) { - var obj = (_a = {}, _a[this.bar] = - 0, - _a); + var obj = (_a = {}, + _a[this.bar] = 0, + _a); var _a; })(M || (M = {})); diff --git a/tests/baselines/reference/computedPropertyNames1_ES5.js b/tests/baselines/reference/computedPropertyNames1_ES5.js index 36a7fd6052d..37e06616c2f 100644 --- a/tests/baselines/reference/computedPropertyNames1_ES5.js +++ b/tests/baselines/reference/computedPropertyNames1_ES5.js @@ -5,6 +5,8 @@ var v = { } //// [computedPropertyNames1_ES5.js] -var v = (_a = {}, _a[0 + 1] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[0 + 1] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), -_a); +var v = (_a = {}, + _a[0 + 1] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), + _a[0 + 1] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames20_ES5.js b/tests/baselines/reference/computedPropertyNames20_ES5.js index 21af64d7e41..1eec0a7bcdb 100644 --- a/tests/baselines/reference/computedPropertyNames20_ES5.js +++ b/tests/baselines/reference/computedPropertyNames20_ES5.js @@ -4,7 +4,7 @@ var obj = { } //// [computedPropertyNames20_ES5.js] -var obj = (_a = {}, _a[this.bar] = -0, -_a); +var obj = (_a = {}, + _a[this.bar] = 0, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames22_ES5.js b/tests/baselines/reference/computedPropertyNames22_ES5.js index e3e685aa54b..df12193250b 100644 --- a/tests/baselines/reference/computedPropertyNames22_ES5.js +++ b/tests/baselines/reference/computedPropertyNames22_ES5.js @@ -13,8 +13,9 @@ var C = (function () { function C() { } C.prototype.bar = function () { - var obj = (_a = {}, _a[this.bar()] = function () { }, - _a); + var obj = (_a = {}, + _a[this.bar()] = function () { }, + _a); return 0; var _a; }; diff --git a/tests/baselines/reference/computedPropertyNames23_ES5.js b/tests/baselines/reference/computedPropertyNames23_ES5.js index 7b5a5a101a5..9e02999738c 100644 --- a/tests/baselines/reference/computedPropertyNames23_ES5.js +++ b/tests/baselines/reference/computedPropertyNames23_ES5.js @@ -15,9 +15,9 @@ var C = (function () { C.prototype.bar = function () { return 0; }; - C.prototype[(_a = {}, _a[this.bar()] = - 1, - _a)[0]] = function () { }; + C.prototype[(_a = {}, + _a[this.bar()] = 1, + _a)[0]] = function () { }; return C; })(); var _a; diff --git a/tests/baselines/reference/computedPropertyNames25_ES5.js b/tests/baselines/reference/computedPropertyNames25_ES5.js index bd2212b72b3..f8196dd1307 100644 --- a/tests/baselines/reference/computedPropertyNames25_ES5.js +++ b/tests/baselines/reference/computedPropertyNames25_ES5.js @@ -34,8 +34,9 @@ var C = (function (_super) { _super.apply(this, arguments); } C.prototype.foo = function () { - var obj = (_a = {}, _a[_super.prototype.bar.call(this)] = function () { }, - _a); + var obj = (_a = {}, + _a[_super.prototype.bar.call(this)] = function () { }, + _a); return 0; var _a; }; diff --git a/tests/baselines/reference/computedPropertyNames26_ES5.js b/tests/baselines/reference/computedPropertyNames26_ES5.js index 5df2f6dc1b6..037bd8786e6 100644 --- a/tests/baselines/reference/computedPropertyNames26_ES5.js +++ b/tests/baselines/reference/computedPropertyNames26_ES5.js @@ -34,9 +34,9 @@ var C = (function (_super) { } // Gets emitted as super, not _super, which is consistent with // use of super in static properties initializers. - C.prototype[(_a = {}, _a[super.bar.call(this)] = - 1, - _a)[0]] = function () { }; + C.prototype[(_a = {}, + _a[super.bar.call(this)] = 1, + _a)[0]] = function () { }; return C; })(Base); var _a; diff --git a/tests/baselines/reference/computedPropertyNames28_ES5.js b/tests/baselines/reference/computedPropertyNames28_ES5.js index 7e548d4d6d3..b88cb0dfaf9 100644 --- a/tests/baselines/reference/computedPropertyNames28_ES5.js +++ b/tests/baselines/reference/computedPropertyNames28_ES5.js @@ -26,8 +26,9 @@ var C = (function (_super) { __extends(C, _super); function C() { _super.call(this); - var obj = (_a = {}, _a[(_super.call(this), "prop")] = function () { }, - _a); + var obj = (_a = {}, + _a[(_super.call(this), "prop")] = function () { }, + _a); var _a; } return C; diff --git a/tests/baselines/reference/computedPropertyNames29_ES5.js b/tests/baselines/reference/computedPropertyNames29_ES5.js index 27c7cd97988..022c930ab67 100644 --- a/tests/baselines/reference/computedPropertyNames29_ES5.js +++ b/tests/baselines/reference/computedPropertyNames29_ES5.js @@ -17,8 +17,9 @@ var C = (function () { C.prototype.bar = function () { var _this = this; (function () { - var obj = (_a = {}, _a[_this.bar()] = function () { }, - _a); + var obj = (_a = {}, + _a[_this.bar()] = function () { }, + _a); var _a; }); return 0; diff --git a/tests/baselines/reference/computedPropertyNames30_ES5.js b/tests/baselines/reference/computedPropertyNames30_ES5.js index 505b149f62d..fd63a192d07 100644 --- a/tests/baselines/reference/computedPropertyNames30_ES5.js +++ b/tests/baselines/reference/computedPropertyNames30_ES5.js @@ -32,8 +32,9 @@ var C = (function (_super) { function C() { _super.call(this); (function () { - var obj = (_a = {}, _a[(_super.call(this), "prop")] = function () { }, - _a); + var obj = (_a = {}, + _a[(_super.call(this), "prop")] = function () { }, + _a); var _a; }); } diff --git a/tests/baselines/reference/computedPropertyNames31_ES5.js b/tests/baselines/reference/computedPropertyNames31_ES5.js index 0c8cbac455f..8a3c1a3f6c5 100644 --- a/tests/baselines/reference/computedPropertyNames31_ES5.js +++ b/tests/baselines/reference/computedPropertyNames31_ES5.js @@ -38,8 +38,9 @@ var C = (function (_super) { C.prototype.foo = function () { var _this = this; (function () { - var obj = (_a = {}, _a[_super.prototype.bar.call(_this)] = function () { }, - _a); + var obj = (_a = {}, + _a[_super.prototype.bar.call(_this)] = function () { }, + _a); var _a; }); return 0; diff --git a/tests/baselines/reference/computedPropertyNames33_ES5.js b/tests/baselines/reference/computedPropertyNames33_ES5.js index 84df68fcc10..3d7c70a9256 100644 --- a/tests/baselines/reference/computedPropertyNames33_ES5.js +++ b/tests/baselines/reference/computedPropertyNames33_ES5.js @@ -15,8 +15,9 @@ var C = (function () { function C() { } C.prototype.bar = function () { - var obj = (_a = {}, _a[foo()] = function () { }, - _a); + var obj = (_a = {}, + _a[foo()] = function () { }, + _a); return 0; var _a; }; diff --git a/tests/baselines/reference/computedPropertyNames34_ES5.js b/tests/baselines/reference/computedPropertyNames34_ES5.js index 9e1de33be7c..fd46b144fa5 100644 --- a/tests/baselines/reference/computedPropertyNames34_ES5.js +++ b/tests/baselines/reference/computedPropertyNames34_ES5.js @@ -15,8 +15,9 @@ var C = (function () { function C() { } C.bar = function () { - var obj = (_a = {}, _a[foo()] = function () { }, - _a); + var obj = (_a = {}, + _a[foo()] = function () { }, + _a); return 0; var _a; }; diff --git a/tests/baselines/reference/computedPropertyNames46_ES5.js b/tests/baselines/reference/computedPropertyNames46_ES5.js index 3e4329b8a20..815f5769f3b 100644 --- a/tests/baselines/reference/computedPropertyNames46_ES5.js +++ b/tests/baselines/reference/computedPropertyNames46_ES5.js @@ -4,7 +4,7 @@ var o = { }; //// [computedPropertyNames46_ES5.js] -var o = (_a = {}, _a["" || 0] = -0, -_a); +var o = (_a = {}, + _a["" || 0] = 0, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames47_ES5.js b/tests/baselines/reference/computedPropertyNames47_ES5.js index 7874a25976f..7d839e16ffb 100644 --- a/tests/baselines/reference/computedPropertyNames47_ES5.js +++ b/tests/baselines/reference/computedPropertyNames47_ES5.js @@ -14,7 +14,7 @@ var E2; (function (E2) { E2[E2["x"] = 0] = "x"; })(E2 || (E2 = {})); -var o = (_a = {}, _a[0 /* x */ || 0 /* x */] = -0, -_a); +var o = (_a = {}, + _a[0 /* x */ || 0 /* x */] = 0, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames48_ES5.js b/tests/baselines/reference/computedPropertyNames48_ES5.js index f3f9941aeae..c5ca0d5b241 100644 --- a/tests/baselines/reference/computedPropertyNames48_ES5.js +++ b/tests/baselines/reference/computedPropertyNames48_ES5.js @@ -23,13 +23,13 @@ var E; E[E["x"] = 0] = "x"; })(E || (E = {})); var a; -extractIndexer((_a = {}, _a[a] = -"", -_a)); // Should return string -extractIndexer((_b = {}, _b[0 /* x */] = -"", -_b)); // Should return string -extractIndexer((_c = {}, _c["" || 0] = -"", -_c)); // Should return any (widened form of undefined) +extractIndexer((_a = {}, + _a[a] = "", + _a)); // Should return string +extractIndexer((_b = {}, + _b[0 /* x */] = "", + _b)); // Should return string +extractIndexer((_c = {}, + _c["" || 0] = "", + _c)); // Should return any (widened form of undefined) var _a, _b, _c; diff --git a/tests/baselines/reference/computedPropertyNames49_ES5.js b/tests/baselines/reference/computedPropertyNames49_ES5.js index a64d9431a9a..5f952c6f3f1 100644 --- a/tests/baselines/reference/computedPropertyNames49_ES5.js +++ b/tests/baselines/reference/computedPropertyNames49_ES5.js @@ -28,19 +28,23 @@ var x = { //// [computedPropertyNames49_ES5.js] var x = (_a = { p1: 10 -}, _a.p1 = -10, _a[1 + 1] = Object.defineProperty({ get: function () { - throw 10; - }, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () { - return 10; - }, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ set: function () { - // just throw - throw 10; - }, enumerable: true, configurable: true }), _a.foo = Object.defineProperty({ get: function () { - if (1 == 1) { +}, + _a.p1 = 10, + _a[1 + 1] = Object.defineProperty({ get: function () { + throw 10; + }, enumerable: true, configurable: true }), + _a[1 + 1] = Object.defineProperty({ get: function () { return 10; - } - }, enumerable: true, configurable: true }), _a.p2 = -20, -_a); + }, enumerable: true, configurable: true }), + _a[1 + 1] = Object.defineProperty({ set: function () { + // just throw + throw 10; + }, enumerable: true, configurable: true }), + _a.foo = Object.defineProperty({ get: function () { + if (1 == 1) { + return 10; + } + }, enumerable: true, configurable: true }), + _a.p2 = 20, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames4_ES5.js b/tests/baselines/reference/computedPropertyNames4_ES5.js index 255b14eb970..ac0fa8ec937 100644 --- a/tests/baselines/reference/computedPropertyNames4_ES5.js +++ b/tests/baselines/reference/computedPropertyNames4_ES5.js @@ -20,17 +20,17 @@ var v = { var s; var n; var a; -var v = (_a = {}, _a[s] = -0, _a[n] = -n, _a[s + s] = -1, _a[s + n] = -2, _a[+s] = -s, _a[""] = -0, _a[0] = -0, _a[a] = -1, _a[true] = -0, _a["hello bye"] = -0, _a["hello " + a + " bye"] = -0, -_a); +var v = (_a = {}, + _a[s] = 0, + _a[n] = n, + _a[s + s] = 1, + _a[s + n] = 2, + _a[+s] = s, + _a[""] = 0, + _a[0] = 0, + _a[a] = 1, + _a[true] = 0, + _a["hello bye"] = 0, + _a["hello " + a + " bye"] = 0, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames50_ES5.js b/tests/baselines/reference/computedPropertyNames50_ES5.js index a0703eeac05..32502d80e0a 100644 --- a/tests/baselines/reference/computedPropertyNames50_ES5.js +++ b/tests/baselines/reference/computedPropertyNames50_ES5.js @@ -33,19 +33,23 @@ var x = (_a = { return 10; } } -}, _a.p1 = -10, _a.foo = Object.defineProperty({ get: function () { - if (1 == 1) { +}, + _a.p1 = 10, + _a.foo = Object.defineProperty({ get: function () { + if (1 == 1) { + return 10; + } + }, enumerable: true, configurable: true }), + _a[1 + 1] = Object.defineProperty({ get: function () { + throw 10; + }, enumerable: true, configurable: true }), + _a[1 + 1] = Object.defineProperty({ set: function () { + // just throw + throw 10; + }, enumerable: true, configurable: true }), + _a[1 + 1] = Object.defineProperty({ get: function () { return 10; - } - }, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () { - throw 10; - }, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ set: function () { - // just throw - throw 10; - }, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () { - return 10; - }, enumerable: true, configurable: true }), _a.p2 = -20, -_a); + }, enumerable: true, configurable: true }), + _a.p2 = 20, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames5_ES5.js b/tests/baselines/reference/computedPropertyNames5_ES5.js index 722c0f3a74d..3367faa2c20 100644 --- a/tests/baselines/reference/computedPropertyNames5_ES5.js +++ b/tests/baselines/reference/computedPropertyNames5_ES5.js @@ -11,12 +11,12 @@ var v = { //// [computedPropertyNames5_ES5.js] var b; -var v = (_a = {}, _a[b] = -0, _a[true] = -1, _a[[]] = -0, _a[{}] = -0, _a[undefined] = -undefined, _a[null] = -null, -_a); +var v = (_a = {}, + _a[b] = 0, + _a[true] = 1, + _a[[]] = 0, + _a[{}] = 0, + _a[undefined] = undefined, + _a[null] = null, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames6_ES5.js b/tests/baselines/reference/computedPropertyNames6_ES5.js index 4e3ed1b2e9f..29d035bfcbf 100644 --- a/tests/baselines/reference/computedPropertyNames6_ES5.js +++ b/tests/baselines/reference/computedPropertyNames6_ES5.js @@ -12,9 +12,9 @@ var v = { var p1; var p2; var p3; -var v = (_a = {}, _a[p1] = -0, _a[p2] = -1, _a[p3] = -2, -_a); +var v = (_a = {}, + _a[p1] = 0, + _a[p2] = 1, + _a[p3] = 2, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames7_ES5.js b/tests/baselines/reference/computedPropertyNames7_ES5.js index 3e1bcc1151c..9c23dcab20d 100644 --- a/tests/baselines/reference/computedPropertyNames7_ES5.js +++ b/tests/baselines/reference/computedPropertyNames7_ES5.js @@ -11,7 +11,7 @@ var E; (function (E) { E[E["member"] = 0] = "member"; })(E || (E = {})); -var v = (_a = {}, _a[0 /* member */] = -0, -_a); +var v = (_a = {}, + _a[0 /* member */] = 0, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames8_ES5.js b/tests/baselines/reference/computedPropertyNames8_ES5.js index 4db9ed2ec13..82d262c7e4e 100644 --- a/tests/baselines/reference/computedPropertyNames8_ES5.js +++ b/tests/baselines/reference/computedPropertyNames8_ES5.js @@ -12,9 +12,9 @@ function f() { function f() { var t; var u; - var v = (_a = {}, _a[t] = - 0, _a[u] = - 1, - _a); + var v = (_a = {}, + _a[t] = 0, + _a[u] = 1, + _a); var _a; } diff --git a/tests/baselines/reference/computedPropertyNames9_ES5.js b/tests/baselines/reference/computedPropertyNames9_ES5.js index a7c4a74d5ec..b1ac6c9e3b6 100644 --- a/tests/baselines/reference/computedPropertyNames9_ES5.js +++ b/tests/baselines/reference/computedPropertyNames9_ES5.js @@ -12,9 +12,9 @@ var v = { //// [computedPropertyNames9_ES5.js] function f(x) { } -var v = (_a = {}, _a[f("")] = -0, _a[f(0)] = -0, _a[f(true)] = -0, -_a); +var v = (_a = {}, + _a[f("")] = 0, + _a[f(0)] = 0, + _a[f(true)] = 0, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js index 5ea05124674..d8a33951d4a 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js @@ -9,8 +9,8 @@ var o: I = { } //// [computedPropertyNamesContextualType10_ES5.js] -var o = (_a = {}, _a[+"foo"] = -"", _a[+"bar"] = -0, -_a); +var o = (_a = {}, + _a[+"foo"] = "", + _a[+"bar"] = 0, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js index a7994495411..1ee88351154 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js @@ -10,7 +10,8 @@ var o: I = { } //// [computedPropertyNamesContextualType1_ES5.js] -var o = (_a = {}, _a["" + 0] = function (y) { return y.length; }, _a["" + 1] = -function (y) { return y.length; }, -_a); +var o = (_a = {}, + _a["" + 0] = function (y) { return y.length; }, + _a["" + 1] = function (y) { return y.length; }, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js index 0c6b80bbabb..6be09e4bef3 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js @@ -10,7 +10,8 @@ var o: I = { } //// [computedPropertyNamesContextualType2_ES5.js] -var o = (_a = {}, _a[+"foo"] = function (y) { return y.length; }, _a[+"bar"] = -function (y) { return y.length; }, -_a); +var o = (_a = {}, + _a[+"foo"] = function (y) { return y.length; }, + _a[+"bar"] = function (y) { return y.length; }, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js index 4336808c558..b510cda2916 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js @@ -9,7 +9,8 @@ var o: I = { } //// [computedPropertyNamesContextualType3_ES5.js] -var o = (_a = {}, _a[+"foo"] = function (y) { return y.length; }, _a[+"bar"] = -function (y) { return y.length; }, -_a); +var o = (_a = {}, + _a[+"foo"] = function (y) { return y.length; }, + _a[+"bar"] = function (y) { return y.length; }, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js index b813da30496..0c319a526f4 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js @@ -10,8 +10,8 @@ var o: I = { } //// [computedPropertyNamesContextualType4_ES5.js] -var o = (_a = {}, _a["" + "foo"] = -"", _a["" + "bar"] = -0, -_a); +var o = (_a = {}, + _a["" + "foo"] = "", + _a["" + "bar"] = 0, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js index f75389de3e9..51d78be59d4 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js @@ -10,8 +10,8 @@ var o: I = { } //// [computedPropertyNamesContextualType5_ES5.js] -var o = (_a = {}, _a[+"foo"] = -"", _a[+"bar"] = -0, -_a); +var o = (_a = {}, + _a[+"foo"] = "", + _a[+"bar"] = 0, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js index bc724320d14..f50231e3f0f 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js @@ -17,11 +17,11 @@ foo({ foo((_a = { p: "", 0: function () { } -}, _a.p = -"", _a[0] = -function () { }, _a["hi" + "bye"] = -true, _a[0 + 1] = -0, _a[+"hi"] = -[0], -_a)); +}, + _a.p = "", + _a[0] = function () { }, + _a["hi" + "bye"] = true, + _a[0 + 1] = 0, + _a[+"hi"] = [0], + _a)); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js index 8d2386a1d14..e1c567c62d9 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js @@ -17,11 +17,11 @@ foo({ foo((_a = { p: "", 0: function () { } -}, _a.p = -"", _a[0] = -function () { }, _a["hi" + "bye"] = -true, _a[0 + 1] = -0, _a[+"hi"] = -[0], -_a)); +}, + _a.p = "", + _a[0] = function () { }, + _a["hi" + "bye"] = true, + _a[0 + 1] = 0, + _a[+"hi"] = [0], + _a)); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js index 626f3d1a8e2..24f6218864c 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js @@ -10,8 +10,8 @@ var o: I = { } //// [computedPropertyNamesContextualType8_ES5.js] -var o = (_a = {}, _a["" + "foo"] = -"", _a["" + "bar"] = -0, -_a); +var o = (_a = {}, + _a["" + "foo"] = "", + _a["" + "bar"] = 0, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js index c28db4ded97..340802da2af 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js @@ -10,8 +10,8 @@ var o: I = { } //// [computedPropertyNamesContextualType9_ES5.js] -var o = (_a = {}, _a[+"foo"] = -"", _a[+"bar"] = -0, -_a); +var o = (_a = {}, + _a[+"foo"] = "", + _a[+"bar"] = 0, + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js index a0666f166d4..58c3133e6ee 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js @@ -7,9 +7,12 @@ var v = { } //// [computedPropertyNamesDeclarationEmit5_ES5.js] -var v = (_a = {}, _a["" + ""] = -0, _a["" + ""] = function () { }, _a["" + ""] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a["" + ""] = Object.defineProperty({ set: function (x) { }, enumerable: true, configurable: true }), -_a); +var v = (_a = {}, + _a["" + ""] = 0, + _a["" + ""] = function () { }, + _a["" + ""] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), + _a["" + ""] = Object.defineProperty({ set: function (x) { }, enumerable: true, configurable: true }), + _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js index c5af22ef398..972aaf9b52f 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js @@ -6,9 +6,10 @@ var v = { } //// [computedPropertyNamesSourceMap2_ES5.js] -var v = (_a = {}, _a["hello"] = function () { - debugger; -}, -_a); +var v = (_a = {}, + _a["hello"] = function () { + debugger; + }, + _a); var _a; //# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map index 82a729df957..c450a844d5a 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map @@ -1,2 +1,2 @@ //// [computedPropertyNamesSourceMap2_ES5.js.map] -{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,AADA,CACA,EAAA,GADA,EAAA,EACA,EAAA,CACK,OAAO,CAFA,GAAA;IAGA,QAAQ,CAAC;AACb,CAAC,AAJA;AACA,EAAA,AADA,CAKA,CAAA;IAJD,EAAA"} \ No newline at end of file +{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,AADA,CACA,EAAA,GADA,EAAA;IACA,EAAA,CACK,OAAO,CAFA,GAAA;QAGA,QAAQ,CAAC;IACb,CAAC,AAJA;IAAA,EAAA,CAKA,CAAA;IAJD,EAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt index 33a3a2b4c2c..8e5b2aac877 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt @@ -8,7 +8,7 @@ sources: computedPropertyNamesSourceMap2_ES5.ts emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.js sourceFile:computedPropertyNamesSourceMap2_ES5.ts ------------------------------------------------------------------- ->>>var v = (_a = {}, _a["hello"] = function () { +>>>var v = (_a = {}, 1 > 2 >^^^^ 3 > ^ @@ -18,12 +18,7 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts 7 > ^^ 8 > ^^^ 9 > ^^ -10> ^^ -11> ^^ -12> ^ -13> ^^^^^^^ -14> ^ -15> ^^^ +10> ^^^^^^^^^^^^^^^^-> 1 > 2 >var 3 > v @@ -43,25 +38,6 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts 9 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found 9 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 15) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 17) Source(0, NaN) + SourceIndex(0) nameIndex (-1) 9 > -10> !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column -10> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 15) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 19) Source(1, 1) + SourceIndex(0) nameIndex (-1) -10> -11> !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found -11> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 17) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 21) Source(1, 1) + SourceIndex(0) nameIndex (-1) -11> -12> !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column -12> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 17) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 22) Source(2, 6) + SourceIndex(0) nameIndex (-1) -12> var v = { - > [ -13> !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -13> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 19) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 29) Source(2, 13) + SourceIndex(0) nameIndex (-1) -13> "hello" -14> !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -14> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 21) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 30) Source(0, NaN) + SourceIndex(0) nameIndex (-1) -14> -15> !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -15> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 22) Source(2, 14) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 33) Source(0, NaN) + SourceIndex(0) nameIndex (-1) -15> 1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) 2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) 3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) @@ -71,90 +47,111 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts 7 >Emitted(1, 12) Source(1, 1) + SourceIndex(0) 8 >Emitted(1, 15) Source(0, NaN) + SourceIndex(0) 9 >Emitted(1, 17) Source(0, NaN) + SourceIndex(0) -10>Emitted(1, 19) Source(1, 1) + SourceIndex(0) -11>Emitted(1, 21) Source(1, 1) + SourceIndex(0) -12>Emitted(1, 22) Source(2, 6) + SourceIndex(0) -13>Emitted(1, 29) Source(2, 13) + SourceIndex(0) -14>Emitted(1, 30) Source(0, NaN) + SourceIndex(0) -15>Emitted(1, 33) Source(0, NaN) + SourceIndex(0) --- ->>> debugger; -1 >^^^^ -2 > ^^^^^^^^ -3 > ^ -1 >!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 29) Source(2, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 5) Source(3, 9) + SourceIndex(0) nameIndex (-1) -1 > -2 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found -2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 30) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 13) Source(3, 17) + SourceIndex(0) nameIndex (-1) -2 > debugger -3 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column -3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 30) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 14) Source(3, 18) + SourceIndex(0) nameIndex (-1) -3 > ; -1 >Emitted(2, 5) Source(3, 9) + SourceIndex(0) -2 >Emitted(2, 13) Source(3, 17) + SourceIndex(0) -3 >Emitted(2, 14) Source(3, 18) + SourceIndex(0) ---- ->>>}, -1 > -2 >^ -3 > -4 > ^^^^-> -1 >!!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found -1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 33) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 1) Source(4, 5) + SourceIndex(0) nameIndex (-1) -1 > - > -2 >!!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column -2 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 33) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 2) Source(4, 6) + SourceIndex(0) nameIndex (-1) -2 >} -3 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 5) Source(3, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 2) Source(0, NaN) + SourceIndex(0) nameIndex (-1) -3 > -1 >Emitted(3, 1) Source(4, 5) + SourceIndex(0) -2 >Emitted(3, 2) Source(4, 6) + SourceIndex(0) -3 >Emitted(3, 2) Source(0, NaN) + SourceIndex(0) ---- ->>>_a); -1-> -2 >^^ -3 > -4 > ^ -5 > ^ -6 > ^^^^-> -1->!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -1->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 13) Source(3, 29) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 1) Source(1, 1) + SourceIndex(0) nameIndex (-1) -1-> -2 >!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -2 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 14) Source(3, 30) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 3) Source(1, 1) + SourceIndex(0) nameIndex (-1) -2 > -3 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 1) Source(4, 17) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 3) Source(0, NaN) + SourceIndex(0) nameIndex (-1) -3 > -4 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -4 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(4, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 4) Source(5, 2) + SourceIndex(0) nameIndex (-1) -4 > -5 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found -5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 5) Source(5, 2) + SourceIndex(0) nameIndex (-1) -5 > -1->Emitted(4, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(4, 3) Source(1, 1) + SourceIndex(0) -3 >Emitted(4, 3) Source(0, NaN) + SourceIndex(0) -4 >Emitted(4, 4) Source(5, 2) + SourceIndex(0) -5 >Emitted(4, 5) Source(5, 2) + SourceIndex(0) ---- ->>>var _a; +>>> _a["hello"] = function () { 1->^^^^ 2 > ^^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^ +4 > ^^^^^^^ +5 > ^ +6 > ^^^ 1->!!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column -1->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 5) Source(1, 1) + SourceIndex(0) nameIndex (-1) +1->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 15) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 5) Source(1, 1) + SourceIndex(0) nameIndex (-1) +1-> +2 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 17) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 7) Source(1, 1) + SourceIndex(0) nameIndex (-1) +2 > +3 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 17) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 8) Source(2, 6) + SourceIndex(0) nameIndex (-1) +3 > var v = { + > [ +4 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +4 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 5) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 15) Source(2, 13) + SourceIndex(0) nameIndex (-1) +4 > "hello" +5 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 7) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 16) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +5 > +6 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +6 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 8) Source(2, 14) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 19) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +6 > +1->Emitted(2, 5) Source(1, 1) + SourceIndex(0) +2 >Emitted(2, 7) Source(1, 1) + SourceIndex(0) +3 >Emitted(2, 8) Source(2, 6) + SourceIndex(0) +4 >Emitted(2, 15) Source(2, 13) + SourceIndex(0) +5 >Emitted(2, 16) Source(0, NaN) + SourceIndex(0) +6 >Emitted(2, 19) Source(0, NaN) + SourceIndex(0) +--- +>>> debugger; +1 >^^^^^^^^ +2 > ^^^^^^^^ +3 > ^ +1 >!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 15) Source(2, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 9) Source(3, 9) + SourceIndex(0) nameIndex (-1) +1 > +2 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 16) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 17) Source(3, 17) + SourceIndex(0) nameIndex (-1) +2 > debugger +3 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 16) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 18) Source(3, 18) + SourceIndex(0) nameIndex (-1) +3 > ; +1 >Emitted(3, 9) Source(3, 9) + SourceIndex(0) +2 >Emitted(3, 17) Source(3, 17) + SourceIndex(0) +3 >Emitted(3, 18) Source(3, 18) + SourceIndex(0) +--- +>>> }, +1 >^^^^ +2 > ^ +3 > +4 > ^^^^-> +1 >!!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 19) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 5) Source(4, 5) + SourceIndex(0) nameIndex (-1) +1 > + > +2 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 19) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 6) Source(4, 6) + SourceIndex(0) nameIndex (-1) +2 > } +3 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 9) Source(3, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 6) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +3 > +1 >Emitted(4, 5) Source(4, 5) + SourceIndex(0) +2 >Emitted(4, 6) Source(4, 6) + SourceIndex(0) +3 >Emitted(4, 6) Source(0, NaN) + SourceIndex(0) +--- +>>> _a); +1->^^^^ +2 > ^^ +3 > ^ +4 > ^ +1->!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +1->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 17) Source(3, 29) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 5) Source(0, NaN) + SourceIndex(0) nameIndex (-1) 1-> 2 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(4, 1) Source(1, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 7) Source(1, 1) + SourceIndex(0) nameIndex (-1) +2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 18) Source(3, 30) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 7) Source(0, NaN) + SourceIndex(0) nameIndex (-1) 2 > -1->Emitted(5, 5) Source(1, 1) + SourceIndex(0) -2 >Emitted(5, 7) Source(1, 1) + SourceIndex(0) +3 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(4, 5) Source(4, 17) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 8) Source(5, 2) + SourceIndex(0) nameIndex (-1) +3 > +4 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +4 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(4, 6) Source(4, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 9) Source(5, 2) + SourceIndex(0) nameIndex (-1) +4 > +1->Emitted(5, 5) Source(0, NaN) + SourceIndex(0) +2 >Emitted(5, 7) Source(0, NaN) + SourceIndex(0) +3 >Emitted(5, 8) Source(5, 2) + SourceIndex(0) +4 >Emitted(5, 9) Source(5, 2) + SourceIndex(0) +--- +>>>var _a; +1 >^^^^ +2 > ^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 >!!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(4, 6) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(6, 5) Source(1, 1) + SourceIndex(0) nameIndex (-1) +1 > +2 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(4, 6) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(6, 7) Source(1, 1) + SourceIndex(0) nameIndex (-1) +2 > +1 >Emitted(6, 5) Source(1, 1) + SourceIndex(0) +2 >Emitted(6, 7) Source(1, 1) + SourceIndex(0) --- !!!! **** There are more source map entries in the sourceMap's mapping than what was encoded -!!!! **** Remaining decoded string: ,EAAA,AADA,CAKA,CAAA;IAJD,EAAA +!!!! **** Remaining decoded string: ;IAAA,EAAA,CAKA,CAAA;IAJD,EAAA >>>//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js index cd31308311b..ac77cc177b8 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js @@ -315,7 +315,7 @@ var TypeScriptAllInOne; if (retValue === void 0) { retValue = != 0; } return 1; ^ - retValue; + retValue; bfs.TYPES(); if (retValue != 0) { return 1 && @@ -543,7 +543,7 @@ while () rest: string[]; { & - public; + public; DefaultValue(value ? : string = "Hello"); { } } diff --git a/tests/baselines/reference/contextualTyping.js.map b/tests/baselines/reference/contextualTyping.js.map index 7cb571ee5af..df52fd930cb 100644 --- a/tests/baselines/reference/contextualTyping.js.map +++ b/tests/baselines/reference/contextualTyping.js.map @@ -1,2 +1,2 @@ //// [contextualTyping.js.map] -{"version":3,"file":"contextualTyping.js","sourceRoot":"","sources":["contextualTyping.ts"],"names":["C1T5","C1T5.constructor","C2T5","C4T5","C4T5.constructor","C5T5","C11t5","C11t5.constructor","EF1","Point"],"mappings":"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"} \ No newline at end of file +{"version":3,"file":"contextualTyping.js","sourceRoot":"","sources":["contextualTyping.ts"],"names":["C1T5","C1T5.constructor","C2T5","C4T5","C4T5.constructor","C5T5","c9t5","C11t5","C11t5.constructor","EF1","Point"],"mappings":"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"} \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping.sourcemap.txt b/tests/baselines/reference/contextualTyping.sourcemap.txt index 9dc9c4b3ee6..45b93e3ce97 100644 --- a/tests/baselines/reference/contextualTyping.sourcemap.txt +++ b/tests/baselines/reference/contextualTyping.sourcemap.txt @@ -2210,8 +2210,8 @@ sourceFile:contextualTyping.ts 2 >Emitted(87, 14) Source(146, 14) + SourceIndex(0) 3 >Emitted(87, 15) Source(146, 15) + SourceIndex(0) 4 >Emitted(87, 16) Source(146, 37) + SourceIndex(0) -5 >Emitted(87, 20) Source(146, 40) + SourceIndex(0) -6 >Emitted(87, 21) Source(146, 41) + SourceIndex(0) +5 >Emitted(87, 20) Source(146, 40) + SourceIndex(0) name (c9t5) +6 >Emitted(87, 21) Source(146, 41) + SourceIndex(0) name (c9t5) --- >>>; 1 > diff --git a/tests/baselines/reference/declFileRestParametersOfFunctionAndFunctionType.js b/tests/baselines/reference/declFileRestParametersOfFunctionAndFunctionType.js index 0150c3f9d42..563551d67a8 100644 --- a/tests/baselines/reference/declFileRestParametersOfFunctionAndFunctionType.js +++ b/tests/baselines/reference/declFileRestParametersOfFunctionAndFunctionType.js @@ -11,7 +11,12 @@ var f6 = () => { return [10]; } //// [declFileRestParametersOfFunctionAndFunctionType.js] -function f1() { } +function f1() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i - 0] = arguments[_i]; + } +} function f2(x) { } function f3(x) { } function f4() { } diff --git a/tests/baselines/reference/duplicateLocalVariable1.js b/tests/baselines/reference/duplicateLocalVariable1.js index e77a38c5be8..62e291f28c0 100644 --- a/tests/baselines/reference/duplicateLocalVariable1.js +++ b/tests/baselines/reference/duplicateLocalVariable1.js @@ -431,7 +431,7 @@ exports.tests = (function () { })); testRunner.addTest(new TestCase("Check binary file doesn't match", function () { return (!FileManager.FileBuffer.isTextFile("C:\\somedir\\app.exe") && - !FileManager.FileBuffer.isTextFile("C:\\somedir\\my lib.dll")); + !FileManager.FileBuffer.isTextFile("C:\\somedir\\my lib.dll")); })); // Command-line parameter tests testRunner.addTest(new TestCase("Check App defaults", function () { diff --git a/tests/baselines/reference/emitArrowFunction.js b/tests/baselines/reference/emitArrowFunction.js index 455972f781b..7e2617045a8 100644 --- a/tests/baselines/reference/emitArrowFunction.js +++ b/tests/baselines/reference/emitArrowFunction.js @@ -10,7 +10,12 @@ foo(() => { return false; }); //// [emitArrowFunction.js] var f1 = function () { }; var f2 = function (x, y) { }; -var f3 = function (x, y) { }; +var f3 = function (x, y) { + var rest = []; + for (var _i = 2; _i < arguments.length; _i++) { + rest[_i - 2] = arguments[_i]; + } +}; var f4 = function (x, y, z) { if (z === void 0) { z = 10; } }; diff --git a/tests/baselines/reference/emitRestParametersFunction.js b/tests/baselines/reference/emitRestParametersFunction.js index 4ee4ff06df9..01116f2ac92 100644 --- a/tests/baselines/reference/emitRestParametersFunction.js +++ b/tests/baselines/reference/emitRestParametersFunction.js @@ -3,5 +3,15 @@ function bar(...rest) { } function foo(x: number, y: string, ...rest) { } //// [emitRestParametersFunction.js] -function bar() { } -function foo(x, y) { } +function bar() { + var rest = []; + for (var _i = 0; _i < arguments.length; _i++) { + rest[_i - 0] = arguments[_i]; + } +} +function foo(x, y) { + var rest = []; + for (var _i = 2; _i < arguments.length; _i++) { + rest[_i - 2] = arguments[_i]; + } +} diff --git a/tests/baselines/reference/emitRestParametersFunctionExpression.js b/tests/baselines/reference/emitRestParametersFunctionExpression.js index 6229c1e8d64..da87cc79f2d 100644 --- a/tests/baselines/reference/emitRestParametersFunctionExpression.js +++ b/tests/baselines/reference/emitRestParametersFunctionExpression.js @@ -6,7 +6,27 @@ var funcExp3 = (function (...rest) { })() //// [emitRestParametersFunctionExpression.js] -var funcExp = function () { }; -var funcExp1 = function (X) { }; -var funcExp2 = function () { }; -var funcExp3 = (function () { })(); +var funcExp = function () { + var rest = []; + for (var _i = 0; _i < arguments.length; _i++) { + rest[_i - 0] = arguments[_i]; + } +}; +var funcExp1 = function (X) { + var rest = []; + for (var _i = 1; _i < arguments.length; _i++) { + rest[_i - 1] = arguments[_i]; + } +}; +var funcExp2 = function () { + var rest = []; + for (var _i = 0; _i < arguments.length; _i++) { + rest[_i - 0] = arguments[_i]; + } +}; +var funcExp3 = (function () { + var rest = []; + for (var _i = 0; _i < arguments.length; _i++) { + rest[_i - 0] = arguments[_i]; + } +})(); diff --git a/tests/baselines/reference/emitRestParametersFunctionProperty.js b/tests/baselines/reference/emitRestParametersFunctionProperty.js index eec67fb880a..4fd60a9269d 100644 --- a/tests/baselines/reference/emitRestParametersFunctionProperty.js +++ b/tests/baselines/reference/emitRestParametersFunctionProperty.js @@ -10,5 +10,10 @@ var obj2 = { //// [emitRestParametersFunctionProperty.js] var obj; var obj2 = { - func: function () { } + func: function () { + var rest = []; + for (var _i = 0; _i < arguments.length; _i++) { + rest[_i - 0] = arguments[_i]; + } + } }; diff --git a/tests/baselines/reference/emitRestParametersMethod.js b/tests/baselines/reference/emitRestParametersMethod.js index 4e4c62dc47b..5ceb6d768f8 100644 --- a/tests/baselines/reference/emitRestParametersMethod.js +++ b/tests/baselines/reference/emitRestParametersMethod.js @@ -21,8 +21,18 @@ var C = (function () { rest[_i - 1] = arguments[_i]; } } - C.prototype.bar = function () { }; - C.prototype.foo = function (x) { }; + C.prototype.bar = function () { + var rest = []; + for (var _i = 0; _i < arguments.length; _i++) { + rest[_i - 0] = arguments[_i]; + } + }; + C.prototype.foo = function (x) { + var rest = []; + for (var _i = 1; _i < arguments.length; _i++) { + rest[_i - 1] = arguments[_i]; + } + }; return C; })(); var D = (function () { @@ -32,7 +42,17 @@ var D = (function () { rest[_i - 0] = arguments[_i]; } } - D.prototype.bar = function () { }; - D.prototype.foo = function (x) { }; + D.prototype.bar = function () { + var rest = []; + for (var _i = 0; _i < arguments.length; _i++) { + rest[_i - 0] = arguments[_i]; + } + }; + D.prototype.foo = function (x) { + var rest = []; + for (var _i = 1; _i < arguments.length; _i++) { + rest[_i - 1] = arguments[_i]; + } + }; return D; })(); diff --git a/tests/baselines/reference/es6ClassTest2.js b/tests/baselines/reference/es6ClassTest2.js index fb0349c9044..f23be04fd17 100644 --- a/tests/baselines/reference/es6ClassTest2.js +++ b/tests/baselines/reference/es6ClassTest2.js @@ -240,7 +240,12 @@ var SplatMonster = (function () { args[_i - 0] = arguments[_i]; } } - SplatMonster.prototype.roar = function (name) { }; + SplatMonster.prototype.roar = function (name) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + }; return SplatMonster; })(); function foo() { return true; } diff --git a/tests/baselines/reference/es6ImportNamedImport.types b/tests/baselines/reference/es6ImportNamedImport.types index 80a7fccbd28..49771928f11 100644 --- a/tests/baselines/reference/es6ImportNamedImport.types +++ b/tests/baselines/reference/es6ImportNamedImport.types @@ -36,7 +36,7 @@ var xxxx = a; >a : number import { a as b } from "es6ImportNamedImport_0"; ->a : unknown +>a : number >b : number var xxxx = b; @@ -45,7 +45,7 @@ var xxxx = b; import { x, a as y } from "es6ImportNamedImport_0"; >x : number ->a : unknown +>a : number >y : number var xxxx = x; @@ -57,7 +57,7 @@ var xxxx = y; >y : number import { x as z, } from "es6ImportNamedImport_0"; ->x : unknown +>x : number >z : number var xxxx = z; @@ -84,9 +84,9 @@ var xxxx = x1; >x1 : number import { a1 as a11, x1 as x11 } from "es6ImportNamedImport_0"; ->a1 : unknown +>a1 : number >a11 : number ->x1 : unknown +>x1 : number >x11 : number var xxxx = a11; diff --git a/tests/baselines/reference/es6ImportNamedImportInEs5.types b/tests/baselines/reference/es6ImportNamedImportInEs5.types index 217b6e3b178..012caca48cf 100644 --- a/tests/baselines/reference/es6ImportNamedImportInEs5.types +++ b/tests/baselines/reference/es6ImportNamedImportInEs5.types @@ -36,7 +36,7 @@ var xxxx = a; >a : number import { a as b } from "es6ImportNamedImportInEs5_0"; ->a : unknown +>a : number >b : number var xxxx = b; @@ -45,7 +45,7 @@ var xxxx = b; import { x, a as y } from "es6ImportNamedImportInEs5_0"; >x : number ->a : unknown +>a : number >y : number var xxxx = x; @@ -57,7 +57,7 @@ var xxxx = y; >y : number import { x as z, } from "es6ImportNamedImportInEs5_0"; ->x : unknown +>x : number >z : number var xxxx = z; @@ -84,9 +84,9 @@ var xxxx = x1; >x1 : number import { a1 as a11, x1 as x11 } from "es6ImportNamedImportInEs5_0"; ->a1 : unknown +>a1 : number >a11 : number ->x1 : unknown +>x1 : number >x11 : number var xxxx = a11; diff --git a/tests/baselines/reference/fatarrowfunctionsErrors.js b/tests/baselines/reference/fatarrowfunctionsErrors.js index 7b7a8f30f05..2ac20f1966a 100644 --- a/tests/baselines/reference/fatarrowfunctionsErrors.js +++ b/tests/baselines/reference/fatarrowfunctionsErrors.js @@ -33,4 +33,9 @@ false ? (function () { return null; }) : null; var x1 = function () { }; var x2 = function (a) { }; var x3 = function (a) { }; -var x4 = function () { }; +var x4 = function () { + var a = []; + for (var _i = 0; _i < arguments.length; _i++) { + a[_i - 0] = arguments[_i]; + } +}; diff --git a/tests/baselines/reference/fatarrowfunctionsOptionalArgs.js b/tests/baselines/reference/fatarrowfunctionsOptionalArgs.js index 9052b894337..e6e43f8bbf4 100644 --- a/tests/baselines/reference/fatarrowfunctionsOptionalArgs.js +++ b/tests/baselines/reference/fatarrowfunctionsOptionalArgs.js @@ -351,7 +351,12 @@ false ? null : function () { return 108; }); // Function Parameters -function foo() { } +function foo() { + var arg = []; + for (var _i = 0; _i < arguments.length; _i++) { + arg[_i - 0] = arguments[_i]; + } +} foo(function (a) { return 110; }, (function (a) { return 111; }), function (a) { return 112; }, function (a) { return 113; }, function (a, b) { return 114; }, function (a) { return 115; }, function (a) { diff --git a/tests/baselines/reference/fromAsIdentifier1.js b/tests/baselines/reference/fromAsIdentifier1.js new file mode 100644 index 00000000000..54054e9f3e8 --- /dev/null +++ b/tests/baselines/reference/fromAsIdentifier1.js @@ -0,0 +1,5 @@ +//// [fromAsIdentifier1.ts] +var from; + +//// [fromAsIdentifier1.js] +var from; diff --git a/tests/baselines/reference/fromAsIdentifier1.types b/tests/baselines/reference/fromAsIdentifier1.types new file mode 100644 index 00000000000..988a80f3337 --- /dev/null +++ b/tests/baselines/reference/fromAsIdentifier1.types @@ -0,0 +1,4 @@ +=== tests/cases/compiler/fromAsIdentifier1.ts === +var from; +>from : any + diff --git a/tests/baselines/reference/fromAsIdentifier2.js b/tests/baselines/reference/fromAsIdentifier2.js new file mode 100644 index 00000000000..efdbdb3c57d --- /dev/null +++ b/tests/baselines/reference/fromAsIdentifier2.js @@ -0,0 +1,7 @@ +//// [fromAsIdentifier2.ts] +"use strict"; +var from; + +//// [fromAsIdentifier2.js] +"use strict"; +var from; diff --git a/tests/baselines/reference/fromAsIdentifier2.types b/tests/baselines/reference/fromAsIdentifier2.types new file mode 100644 index 00000000000..5faf9ec6f6c --- /dev/null +++ b/tests/baselines/reference/fromAsIdentifier2.types @@ -0,0 +1,5 @@ +=== tests/cases/compiler/fromAsIdentifier2.ts === +"use strict"; +var from; +>from : any + diff --git a/tests/baselines/reference/functionCall10.js b/tests/baselines/reference/functionCall10.js index 299d73ee24a..9d5cb33a56a 100644 --- a/tests/baselines/reference/functionCall10.js +++ b/tests/baselines/reference/functionCall10.js @@ -7,7 +7,12 @@ foo(1, 'bar'); //// [functionCall10.js] -function foo() { } +function foo() { + var a = []; + for (var _i = 0; _i < arguments.length; _i++) { + a[_i - 0] = arguments[_i]; + } +} ; foo(0, 1); foo('foo'); diff --git a/tests/baselines/reference/functionCall13.js b/tests/baselines/reference/functionCall13.js index a66ecafc8b4..ce57f43215e 100644 --- a/tests/baselines/reference/functionCall13.js +++ b/tests/baselines/reference/functionCall13.js @@ -8,7 +8,12 @@ foo('foo', 1, 3); //// [functionCall13.js] -function foo(a) { } +function foo(a) { + var b = []; + for (var _i = 1; _i < arguments.length; _i++) { + b[_i - 1] = arguments[_i]; + } +} foo('foo', 1); foo('foo'); foo(); diff --git a/tests/baselines/reference/functionCall14.js b/tests/baselines/reference/functionCall14.js index f3af9f65436..47447f46db5 100644 --- a/tests/baselines/reference/functionCall14.js +++ b/tests/baselines/reference/functionCall14.js @@ -8,7 +8,12 @@ foo('foo', 1, 3); //// [functionCall14.js] -function foo(a) { } +function foo(a) { + var b = []; + for (var _i = 1; _i < arguments.length; _i++) { + b[_i - 1] = arguments[_i]; + } +} foo('foo', 1); foo('foo'); foo(); diff --git a/tests/baselines/reference/functionCall15.js b/tests/baselines/reference/functionCall15.js index baef02be27d..28fa4c917c8 100644 --- a/tests/baselines/reference/functionCall15.js +++ b/tests/baselines/reference/functionCall15.js @@ -2,4 +2,9 @@ function foo(a?:string, b?:number, ...b:number[]){} //// [functionCall15.js] -function foo(a, b) { } +function foo(a, b) { + var b = []; + for (var _i = 2; _i < arguments.length; _i++) { + b[_i - 2] = arguments[_i]; + } +} diff --git a/tests/baselines/reference/functionCall16.js b/tests/baselines/reference/functionCall16.js index d9b416581a7..187572a9a7e 100644 --- a/tests/baselines/reference/functionCall16.js +++ b/tests/baselines/reference/functionCall16.js @@ -9,7 +9,12 @@ foo('foo', 'bar', 3); //// [functionCall16.js] -function foo(a, b) { } +function foo(a, b) { + var c = []; + for (var _i = 2; _i < arguments.length; _i++) { + c[_i - 2] = arguments[_i]; + } +} foo('foo', 1); foo('foo'); foo('foo', 'bar'); diff --git a/tests/baselines/reference/functionCall17.js b/tests/baselines/reference/functionCall17.js index 62495358210..73f7fd6070b 100644 --- a/tests/baselines/reference/functionCall17.js +++ b/tests/baselines/reference/functionCall17.js @@ -9,7 +9,12 @@ foo('foo', 'bar', 3, 4); //// [functionCall17.js] -function foo(a, b, c) { } +function foo(a, b, c) { + var d = []; + for (var _i = 3; _i < arguments.length; _i++) { + d[_i - 3] = arguments[_i]; + } +} foo('foo', 1); foo('foo'); foo(); diff --git a/tests/baselines/reference/implicitAnyDeclareFunctionWithoutFormalType.js b/tests/baselines/reference/implicitAnyDeclareFunctionWithoutFormalType.js index 4dce5ba1816..c13479daff3 100644 --- a/tests/baselines/reference/implicitAnyDeclareFunctionWithoutFormalType.js +++ b/tests/baselines/reference/implicitAnyDeclareFunctionWithoutFormalType.js @@ -19,7 +19,12 @@ function bar(x, y) { } ; // error at "y"; no error at "x" function func2(a, b, c) { } ; // error at "a,b,c" -function func3() { } +function func3() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i - 0] = arguments[_i]; + } +} ; // error at "args" function func4(z, w) { if (z === void 0) { z = null; } diff --git a/tests/baselines/reference/inferTypeArgumentsInSignatureWithRestParameters.js b/tests/baselines/reference/inferTypeArgumentsInSignatureWithRestParameters.js index de0c107e561..97fefc0571c 100644 --- a/tests/baselines/reference/inferTypeArgumentsInSignatureWithRestParameters.js +++ b/tests/baselines/reference/inferTypeArgumentsInSignatureWithRestParameters.js @@ -12,9 +12,24 @@ i(a); // OK //// [inferTypeArgumentsInSignatureWithRestParameters.js] -function f(array) { } -function g(array) { } -function h(nonarray) { } +function f(array) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } +} +function g(array) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } +} +function h(nonarray) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } +} function i(array, opt) { } var a = [1, 2, 3, 4, 5]; f(a); // OK diff --git a/tests/baselines/reference/invalidTryStatements.errors.txt b/tests/baselines/reference/invalidTryStatements.errors.txt index 4dacdb8f4b6..a2f8a7bac0c 100644 --- a/tests/baselines/reference/invalidTryStatements.errors.txt +++ b/tests/baselines/reference/invalidTryStatements.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/statements/tryStatements/invalidTryStatements.ts(8,21): error TS1013: Catch clause parameter cannot have a type annotation. -tests/cases/conformance/statements/tryStatements/invalidTryStatements.ts(9,21): error TS1013: Catch clause parameter cannot have a type annotation. -tests/cases/conformance/statements/tryStatements/invalidTryStatements.ts(10,21): error TS1013: Catch clause parameter cannot have a type annotation. +tests/cases/conformance/statements/tryStatements/invalidTryStatements.ts(8,23): error TS1196: Catch clause variable cannot have a type annotation. +tests/cases/conformance/statements/tryStatements/invalidTryStatements.ts(9,23): error TS1196: Catch clause variable cannot have a type annotation. +tests/cases/conformance/statements/tryStatements/invalidTryStatements.ts(10,23): error TS1196: Catch clause variable cannot have a type annotation. ==== tests/cases/conformance/statements/tryStatements/invalidTryStatements.ts (3 errors) ==== @@ -12,14 +12,14 @@ tests/cases/conformance/statements/tryStatements/invalidTryStatements.ts(10,21): // no type annotation allowed try { } catch (z: any) { } - ~ -!!! error TS1013: Catch clause parameter cannot have a type annotation. + ~~~ +!!! error TS1196: Catch clause variable cannot have a type annotation. try { } catch (a: number) { } - ~ -!!! error TS1013: Catch clause parameter cannot have a type annotation. + ~~~~~~ +!!! error TS1196: Catch clause variable cannot have a type annotation. try { } catch (y: string) { } - ~ -!!! error TS1013: Catch clause parameter cannot have a type annotation. + ~~~~~~ +!!! error TS1196: Catch clause variable cannot have a type annotation. } \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyParametersInBareFunctions.js b/tests/baselines/reference/noImplicitAnyParametersInBareFunctions.js index bfa7f4b868f..8efe32d3140 100644 --- a/tests/baselines/reference/noImplicitAnyParametersInBareFunctions.js +++ b/tests/baselines/reference/noImplicitAnyParametersInBareFunctions.js @@ -56,9 +56,19 @@ function f4(x, y, z) { } // Implicit-'any' errors for x, and z. function f5(x, y, z) { } // Implicit-'any[]' error for r. -function f6() { } +function f6() { + var r = []; + for (var _i = 0; _i < arguments.length; _i++) { + r[_i - 0] = arguments[_i]; + } +} // Implicit-'any'/'any[]' errors for x, r. -function f7(x) { } +function f7(x) { + var r = []; + for (var _i = 1; _i < arguments.length; _i++) { + r[_i - 1] = arguments[_i]; + } +} function f8(x3, y3) { } // No implicit-'any' errors. var f9 = function () { return ""; }; diff --git a/tests/baselines/reference/noImplicitAnyParametersInClass.js b/tests/baselines/reference/noImplicitAnyParametersInClass.js index 089680781b5..0873935b600 100644 --- a/tests/baselines/reference/noImplicitAnyParametersInClass.js +++ b/tests/baselines/reference/noImplicitAnyParametersInClass.js @@ -155,9 +155,19 @@ var C = (function () { // Implicit-'any' errors for x, and z. C.prototype.pub_f5 = function (x, y, z) { }; // Implicit-'any[]' errors for r. - C.prototype.pub_f6 = function () { }; + C.prototype.pub_f6 = function () { + var r = []; + for (var _i = 0; _i < arguments.length; _i++) { + r[_i - 0] = arguments[_i]; + } + }; // Implicit-'any'/'any[]' errors for x, r. - C.prototype.pub_f7 = function (x) { }; + C.prototype.pub_f7 = function (x) { + var r = []; + for (var _i = 1; _i < arguments.length; _i++) { + r[_i - 1] = arguments[_i]; + } + }; C.prototype.pub_f8 = function (x3, y3) { }; /////////////////////////////////////////// // No implicit-'any' errors. @@ -171,9 +181,19 @@ var C = (function () { // Implicit-'any' errors for x, and z. C.prototype.priv_f5 = function (x, y, z) { }; // Implicit-'any[]' errors for r. - C.prototype.priv_f6 = function () { }; + C.prototype.priv_f6 = function () { + var r = []; + for (var _i = 0; _i < arguments.length; _i++) { + r[_i - 0] = arguments[_i]; + } + }; // Implicit-'any'/'any[]' errors for x, r. - C.prototype.priv_f7 = function (x) { }; + C.prototype.priv_f7 = function (x) { + var r = []; + for (var _i = 1; _i < arguments.length; _i++) { + r[_i - 1] = arguments[_i]; + } + }; C.prototype.priv_f8 = function (x3, y3) { }; return C; })(); diff --git a/tests/baselines/reference/noImplicitAnyParametersInModule.js b/tests/baselines/reference/noImplicitAnyParametersInModule.js index 7c31ccb8013..e7f30205559 100644 --- a/tests/baselines/reference/noImplicitAnyParametersInModule.js +++ b/tests/baselines/reference/noImplicitAnyParametersInModule.js @@ -60,9 +60,19 @@ var M; // Implicit-'any' errors for x and z. function m_f5(x, y, z) { } // Implicit-'any[]' error for r. - function m_f6() { } + function m_f6() { + var r = []; + for (var _i = 0; _i < arguments.length; _i++) { + r[_i - 0] = arguments[_i]; + } + } // Implicit-'any'/'any[]' errors for x and r. - function m_f7(x) { } + function m_f7(x) { + var r = []; + for (var _i = 1; _i < arguments.length; _i++) { + r[_i - 1] = arguments[_i]; + } + } function m_f8(x3, y3) { } // No implicit-'any' errors. var m_f9 = function () { return ""; }; diff --git a/tests/baselines/reference/optionalBindingParametersInOverloads1.js b/tests/baselines/reference/optionalBindingParametersInOverloads1.js index af83404c2c8..3658efa72c6 100644 --- a/tests/baselines/reference/optionalBindingParametersInOverloads1.js +++ b/tests/baselines/reference/optionalBindingParametersInOverloads1.js @@ -11,6 +11,10 @@ foo([false, 0, ""]); //// [optionalBindingParametersInOverloads1.js] function foo() { + var rest = []; + for (var _i = 0; _i < arguments.length; _i++) { + rest[_i - 0] = arguments[_i]; + } } foo(["", 0, false]); foo([false, 0, ""]); diff --git a/tests/baselines/reference/optionalBindingParametersInOverloads2.js b/tests/baselines/reference/optionalBindingParametersInOverloads2.js index f32fb1bfbf4..1ddfdae4f07 100644 --- a/tests/baselines/reference/optionalBindingParametersInOverloads2.js +++ b/tests/baselines/reference/optionalBindingParametersInOverloads2.js @@ -11,6 +11,10 @@ foo({ x: false, y: 0, z: "" }); //// [optionalBindingParametersInOverloads2.js] function foo() { + var rest = []; + for (var _i = 0; _i < arguments.length; _i++) { + rest[_i - 0] = arguments[_i]; + } } foo({ x: "", y: 0, z: false }); foo({ x: false, y: 0, z: "" }); diff --git a/tests/baselines/reference/out-flag.js.map b/tests/baselines/reference/out-flag.js.map index 795d564b2c0..9247af9d5d4 100644 --- a/tests/baselines/reference/out-flag.js.map +++ b/tests/baselines/reference/out-flag.js.map @@ -1,2 +1,2 @@ //// [out-flag.js.map] -{"version":3,"file":"out-flag.js","sourceRoot":"","sources":["out-flag.ts"],"names":["MyClass","MyClass.constructor","MyClass.Count"],"mappings":"AAAA,eAAe;AAGf,AADA,oBAAoB;IACd,OAAO;IAAbA,SAAMA,OAAOA;IAYbC,CAACA;IAVGD,uBAAuBA;IAChBA,uBAAKA,GAAZA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IAEMF,0BAAQA,GAAfA,UAAgBA,KAAaA;QAEzBA,EAAEA;IACNA,CAACA;IACLA,cAACA;AAADA,CAACA,AAZD,IAYC"} \ No newline at end of file +{"version":3,"file":"out-flag.js","sourceRoot":"","sources":["out-flag.ts"],"names":["MyClass","MyClass.constructor","MyClass.Count","MyClass.SetCount"],"mappings":"AAAA,eAAe;AAGf,AADA,oBAAoB;IACd,OAAO;IAAbA,SAAMA,OAAOA;IAYbC,CAACA;IAVGD,uBAAuBA;IAChBA,uBAAKA,GAAZA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IAEMF,0BAAQA,GAAfA,UAAgBA,KAAaA;QAEzBG,EAAEA;IACNA,CAACA;IACLH,cAACA;AAADA,CAACA,AAZD,IAYC"} \ No newline at end of file diff --git a/tests/baselines/reference/out-flag.sourcemap.txt b/tests/baselines/reference/out-flag.sourcemap.txt index b54f7f8d0a1..c0289140552 100644 --- a/tests/baselines/reference/out-flag.sourcemap.txt +++ b/tests/baselines/reference/out-flag.sourcemap.txt @@ -150,8 +150,8 @@ sourceFile:out-flag.ts > { > 2 > // -1 >Emitted(11, 9) Source(14, 9) + SourceIndex(0) name (MyClass) -2 >Emitted(11, 11) Source(14, 11) + SourceIndex(0) name (MyClass) +1 >Emitted(11, 9) Source(14, 9) + SourceIndex(0) name (MyClass.SetCount) +2 >Emitted(11, 11) Source(14, 11) + SourceIndex(0) name (MyClass.SetCount) --- >>> }; 1 >^^^^ @@ -160,8 +160,8 @@ sourceFile:out-flag.ts 1 > > 2 > } -1 >Emitted(12, 5) Source(15, 5) + SourceIndex(0) name (MyClass) -2 >Emitted(12, 6) Source(15, 6) + SourceIndex(0) name (MyClass) +1 >Emitted(12, 5) Source(15, 5) + SourceIndex(0) name (MyClass.SetCount) +2 >Emitted(12, 6) Source(15, 6) + SourceIndex(0) name (MyClass.SetCount) --- >>> return MyClass; 1->^^^^ diff --git a/tests/baselines/reference/parserCatchClauseWithTypeAnnotation1.errors.txt b/tests/baselines/reference/parserCatchClauseWithTypeAnnotation1.errors.txt index 73b97ac5573..a1f1d1fd6c7 100644 --- a/tests/baselines/reference/parserCatchClauseWithTypeAnnotation1.errors.txt +++ b/tests/baselines/reference/parserCatchClauseWithTypeAnnotation1.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/CatchClauses/parserCatchClauseWithTypeAnnotation1.ts(2,11): error TS1013: Catch clause parameter cannot have a type annotation. +tests/cases/conformance/parser/ecmascript5/CatchClauses/parserCatchClauseWithTypeAnnotation1.ts(2,13): error TS1196: Catch clause variable cannot have a type annotation. ==== tests/cases/conformance/parser/ecmascript5/CatchClauses/parserCatchClauseWithTypeAnnotation1.ts (1 errors) ==== try { } catch (e: Error) { - ~ -!!! error TS1013: Catch clause parameter cannot have a type annotation. + ~~~~~ +!!! error TS1196: Catch clause variable cannot have a type annotation. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName2.js b/tests/baselines/reference/parserES5ComputedPropertyName2.js index 2b39e305e07..d8a5bb45fac 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName2.js +++ b/tests/baselines/reference/parserES5ComputedPropertyName2.js @@ -2,7 +2,7 @@ var v = { [e]: 1 }; //// [parserES5ComputedPropertyName2.js] -var v = (_a = {}, _a[e] = -1, -_a); +var v = (_a = {}, + _a[e] = 1, + _a); var _a; diff --git a/tests/baselines/reference/parserES5ComputedPropertyName3.js b/tests/baselines/reference/parserES5ComputedPropertyName3.js index 3247b0251f1..26067467953 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName3.js +++ b/tests/baselines/reference/parserES5ComputedPropertyName3.js @@ -2,6 +2,7 @@ var v = { [e]() { } }; //// [parserES5ComputedPropertyName3.js] -var v = (_a = {}, _a[e] = function () { }, -_a); +var v = (_a = {}, + _a[e] = function () { }, + _a); var _a; diff --git a/tests/baselines/reference/parserES5ComputedPropertyName4.js b/tests/baselines/reference/parserES5ComputedPropertyName4.js index 436f967e8de..378624af08b 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName4.js +++ b/tests/baselines/reference/parserES5ComputedPropertyName4.js @@ -2,6 +2,7 @@ var v = { get [e]() { } }; //// [parserES5ComputedPropertyName4.js] -var v = (_a = {}, _a[e] = Object.defineProperty({ get: function () { }, enumerable: true, configurable: true }), -_a); +var v = (_a = {}, + _a[e] = Object.defineProperty({ get: function () { }, enumerable: true, configurable: true }), + _a); var _a; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity10.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity10.js index 766c95632ab..a558407de43 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity10.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity10.js @@ -6,4 +6,4 @@ //// [parserGreaterThanTokenAmbiguity10.js] 1 >>> -2; + 2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity15.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity15.js index 8675365d9ea..83f2cda2364 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity15.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity15.js @@ -6,4 +6,4 @@ //// [parserGreaterThanTokenAmbiguity15.js] 1 >>= -2; + 2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity20.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity20.js index e190e94e9f9..9ac06e9644f 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity20.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity20.js @@ -6,4 +6,4 @@ //// [parserGreaterThanTokenAmbiguity20.js] 1 >>>= -2; + 2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity5.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity5.js index 59d13d5c9d3..cde18d5c63d 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity5.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity5.js @@ -6,4 +6,4 @@ //// [parserGreaterThanTokenAmbiguity5.js] 1 >> -2; + 2; diff --git a/tests/baselines/reference/parserMemberAccessorDeclaration18.js b/tests/baselines/reference/parserMemberAccessorDeclaration18.js index ee47bd6edd9..9483a1f2daf 100644 --- a/tests/baselines/reference/parserMemberAccessorDeclaration18.js +++ b/tests/baselines/reference/parserMemberAccessorDeclaration18.js @@ -8,7 +8,12 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "Foo", { - set: function () { }, + set: function () { + var a = []; + for (var _i = 0; _i < arguments.length; _i++) { + a[_i - 0] = arguments[_i]; + } + }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/parserParameterList9.js b/tests/baselines/reference/parserParameterList9.js index 4eff1ad8f73..965b92a7ef6 100644 --- a/tests/baselines/reference/parserParameterList9.js +++ b/tests/baselines/reference/parserParameterList9.js @@ -7,6 +7,11 @@ class C { var C = (function () { function C() { } - C.prototype.foo = function () { }; + C.prototype.foo = function () { + var bar = []; + for (var _i = 0; _i < arguments.length; _i++) { + bar[_i - 0] = arguments[_i]; + } + }; return C; })(); diff --git a/tests/baselines/reference/parserRealSource14.js b/tests/baselines/reference/parserRealSource14.js index 540296e6973..8deae79f5e2 100644 --- a/tests/baselines/reference/parserRealSource14.js +++ b/tests/baselines/reference/parserRealSource14.js @@ -999,8 +999,8 @@ var TypeScript; // 0123 // If "position == 3", the caret is at the "right" of the "r" character, which should be considered valid var inclusive = hasFlag(options, 1 /* EdgeInclusive */) || - cur.nodeType === TypeScript.NodeType.Name || - pos === script.limChar; // Special "EOF" case + cur.nodeType === TypeScript.NodeType.Name || + pos === script.limChar; // Special "EOF" case var minChar = cur.minChar; var limChar = cur.limChar + (inclusive ? 1 : 0); if (pos >= minChar && pos < limChar) { diff --git a/tests/baselines/reference/privateIndexer2.js b/tests/baselines/reference/privateIndexer2.js index 5a36a9eae18..a90e03a5bc2 100644 --- a/tests/baselines/reference/privateIndexer2.js +++ b/tests/baselines/reference/privateIndexer2.js @@ -11,9 +11,9 @@ var y: { //// [privateIndexer2.js] // private indexers not allowed -var x = (_a = {}, _a[x] = -string, _a.string = -, -_a); +var x = (_a = {}, + _a[x] = string, + _a.string = , + _a); var y; var _a; diff --git a/tests/baselines/reference/properties.js.map b/tests/baselines/reference/properties.js.map index e59b82653b6..d47694825ec 100644 --- a/tests/baselines/reference/properties.js.map +++ b/tests/baselines/reference/properties.js.map @@ -1,2 +1,2 @@ //// [properties.js.map] -{"version":3,"file":"properties.js","sourceRoot":"","sources":["properties.ts"],"names":["MyClass","MyClass.constructor","MyClass.Count"],"mappings":"AACA,IAAM,OAAO;IAAbA,SAAMA,OAAOA;IAWbC,CAACA;IATGD,sBAAWA,0BAAKA;aAAhBA;YAEIE,MAAMA,CAACA,EAAEA,CAACA;QACdA,CAACA;aAEDF,UAAiBA,KAAaA;YAE1BA,EAAEA;QACNA,CAACA;;;OALAA;IAMLA,cAACA;AAADA,CAACA,AAXD,IAWC"} \ No newline at end of file +{"version":3,"file":"properties.js","sourceRoot":"","sources":["properties.ts"],"names":["MyClass","MyClass.constructor","MyClass.Count"],"mappings":"AACA,IAAM,OAAO;IAAbA,SAAMA,OAAOA;IAWbC,CAACA;IATGD,sBAAWA,0BAAKA;aAAhBA;YAEIE,MAAMA,CAACA,EAAEA,CAACA;QACdA,CAACA;aAEDF,UAAiBA,KAAaA;YAE1BE,EAAEA;QACNA,CAACA;;;OALAF;IAMLA,cAACA;AAADA,CAACA,AAXD,IAWC"} \ No newline at end of file diff --git a/tests/baselines/reference/properties.sourcemap.txt b/tests/baselines/reference/properties.sourcemap.txt index ac124f60230..7ef028e33c0 100644 --- a/tests/baselines/reference/properties.sourcemap.txt +++ b/tests/baselines/reference/properties.sourcemap.txt @@ -118,8 +118,8 @@ sourceFile:properties.ts > { > 2 > // -1 >Emitted(9, 13) Source(11, 9) + SourceIndex(0) name (MyClass) -2 >Emitted(9, 15) Source(11, 11) + SourceIndex(0) name (MyClass) +1 >Emitted(9, 13) Source(11, 9) + SourceIndex(0) name (MyClass.Count) +2 >Emitted(9, 15) Source(11, 11) + SourceIndex(0) name (MyClass.Count) --- >>> }, 1 >^^^^^^^^ @@ -128,8 +128,8 @@ sourceFile:properties.ts 1 > > 2 > } -1 >Emitted(10, 9) Source(12, 5) + SourceIndex(0) name (MyClass) -2 >Emitted(10, 10) Source(12, 6) + SourceIndex(0) name (MyClass) +1 >Emitted(10, 9) Source(12, 5) + SourceIndex(0) name (MyClass.Count) +2 >Emitted(10, 10) Source(12, 6) + SourceIndex(0) name (MyClass.Count) --- >>> enumerable: true, >>> configurable: true diff --git a/tests/baselines/reference/recursiveClassReferenceTest.js.map b/tests/baselines/reference/recursiveClassReferenceTest.js.map index 0faf03690d3..a2c623e2cf5 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.js.map +++ b/tests/baselines/reference/recursiveClassReferenceTest.js.map @@ -1,2 +1,2 @@ //// [recursiveClassReferenceTest.js.map] -{"version":3,"file":"recursiveClassReferenceTest.js","sourceRoot":"","sources":["recursiveClassReferenceTest.ts"],"names":["Sample","Sample.Actions","Sample.Actions.Thing","Sample.Actions.Thing.Find","Sample.Actions.Thing.Find.StartFindAction","Sample.Actions.Thing.Find.StartFindAction.constructor","Sample.Actions.Thing.Find.StartFindAction.getId","Sample.Actions.Thing.Find.StartFindAction.run","Sample.Thing","Sample.Thing.Widgets","Sample.Thing.Widgets.FindWidget","Sample.Thing.Widgets.FindWidget.constructor","Sample.Thing.Widgets.FindWidget.gar","Sample.Thing.Widgets.FindWidget.getDomNode","AbstractMode","AbstractMode.constructor","AbstractMode.getInitialState","Sample.Thing.Languages","Sample.Thing.Languages.PlainText","Sample.Thing.Languages.PlainText.State","Sample.Thing.Languages.PlainText.State.constructor","Sample.Thing.Languages.PlainText.State.clone","Sample.Thing.Languages.PlainText.State.equals","Sample.Thing.Languages.PlainText.State.getMode","Sample.Thing.Languages.PlainText.Mode","Sample.Thing.Languages.PlainText.Mode.constructor","Sample.Thing.Languages.PlainText.Mode.getInitialState"],"mappings":"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"} \ No newline at end of file +{"version":3,"file":"recursiveClassReferenceTest.js","sourceRoot":"","sources":["recursiveClassReferenceTest.ts"],"names":["Sample","Sample.Actions","Sample.Actions.Thing","Sample.Actions.Thing.Find","Sample.Actions.Thing.Find.StartFindAction","Sample.Actions.Thing.Find.StartFindAction.constructor","Sample.Actions.Thing.Find.StartFindAction.getId","Sample.Actions.Thing.Find.StartFindAction.run","Sample.Thing","Sample.Thing.Widgets","Sample.Thing.Widgets.FindWidget","Sample.Thing.Widgets.FindWidget.constructor","Sample.Thing.Widgets.FindWidget.gar","Sample.Thing.Widgets.FindWidget.getDomNode","Sample.Thing.Widgets.FindWidget.destroy","AbstractMode","AbstractMode.constructor","AbstractMode.getInitialState","Sample.Thing.Languages","Sample.Thing.Languages.PlainText","Sample.Thing.Languages.PlainText.State","Sample.Thing.Languages.PlainText.State.constructor","Sample.Thing.Languages.PlainText.State.clone","Sample.Thing.Languages.PlainText.State.equals","Sample.Thing.Languages.PlainText.State.getMode","Sample.Thing.Languages.PlainText.Mode","Sample.Thing.Languages.PlainText.Mode.constructor","Sample.Thing.Languages.PlainText.Mode.getInitialState"],"mappings":"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"} \ No newline at end of file diff --git a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt index be632f2f517..8e4f3be36ff 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt +++ b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt @@ -975,8 +975,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1 >Emitted(51, 17) Source(61, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -2 >Emitted(51, 18) Source(61, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +1 >Emitted(51, 17) Source(61, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.destroy) +2 >Emitted(51, 18) Source(61, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.destroy) --- >>> return FindWidget; 1->^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/restArgMissingName.js b/tests/baselines/reference/restArgMissingName.js index bbd3641478e..b87800c7dac 100644 --- a/tests/baselines/reference/restArgMissingName.js +++ b/tests/baselines/reference/restArgMissingName.js @@ -3,4 +3,9 @@ function sum (...) {} //// [restArgMissingName.js] -function sum() { } +function sum() { + var = []; + for (var _i = 0; _i < arguments.length; _i++) { + [_i - 0] = arguments[_i]; + } +} diff --git a/tests/baselines/reference/restParamAsOptional.js b/tests/baselines/reference/restParamAsOptional.js index 8b0a1329680..59aea1cc9c4 100644 --- a/tests/baselines/reference/restParamAsOptional.js +++ b/tests/baselines/reference/restParamAsOptional.js @@ -3,7 +3,12 @@ function f(...x?) { } function f2(...x = []) { } //// [restParamAsOptional.js] -function f() { } +function f() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +} function f2() { if (x === void 0) { x = []; } var x = []; diff --git a/tests/baselines/reference/restParameterAssignmentCompatibility.js b/tests/baselines/reference/restParameterAssignmentCompatibility.js index cdfc257db41..62c0204c749 100644 --- a/tests/baselines/reference/restParameterAssignmentCompatibility.js +++ b/tests/baselines/reference/restParameterAssignmentCompatibility.js @@ -31,6 +31,10 @@ var T = (function () { function T() { } T.prototype.m = function () { + var p3 = []; + for (var _i = 0; _i < arguments.length; _i++) { + p3[_i - 0] = arguments[_i]; + } }; return T; })(); diff --git a/tests/baselines/reference/restParameterWithoutAnnotationIsAnyArray.js b/tests/baselines/reference/restParameterWithoutAnnotationIsAnyArray.js index 30547f3f637..c800c628c9c 100644 --- a/tests/baselines/reference/restParameterWithoutAnnotationIsAnyArray.js +++ b/tests/baselines/reference/restParameterWithoutAnnotationIsAnyArray.js @@ -28,18 +28,53 @@ var b = { //// [restParameterWithoutAnnotationIsAnyArray.js] // Rest parameters without type annotations are 'any', errors only for the functions with 2 rest params -function foo() { } -var f = function foo() { }; -var f2 = function (x) { }; +function foo() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +} +var f = function foo() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +}; +var f2 = function (x) { + var y = []; + for (var _i = 1; _i < arguments.length; _i++) { + y[_i - 1] = arguments[_i]; + } +}; var C = (function () { function C() { } - C.prototype.foo = function () { }; + C.prototype.foo = function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + }; return C; })(); var a; var b = { - foo: function () { }, - a: function foo(x) { }, - b: function () { } + foo: function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + }, + a: function foo(x) { + var y = []; + for (var _i = 1; _i < arguments.length; _i++) { + y[_i - 1] = arguments[_i]; + } + }, + b: function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + } }; diff --git a/tests/baselines/reference/restParameters.js b/tests/baselines/reference/restParameters.js index f71401d2f18..2e5b7bb4c92 100644 --- a/tests/baselines/reference/restParameters.js +++ b/tests/baselines/reference/restParameters.js @@ -8,7 +8,27 @@ function f20(a:string, b?:string, ...c:number[]){} function f21(a:string, b?:string, c?:number, ...d:number[]){} //// [restParameters.js] -function f18(a) { } -function f19(a, b) { } -function f20(a, b) { } -function f21(a, b, c) { } +function f18(a) { + var b = []; + for (var _i = 1; _i < arguments.length; _i++) { + b[_i - 1] = arguments[_i]; + } +} +function f19(a, b) { + var c = []; + for (var _i = 2; _i < arguments.length; _i++) { + c[_i - 2] = arguments[_i]; + } +} +function f20(a, b) { + var c = []; + for (var _i = 2; _i < arguments.length; _i++) { + c[_i - 2] = arguments[_i]; + } +} +function f21(a, b, c) { + var d = []; + for (var _i = 3; _i < arguments.length; _i++) { + d[_i - 3] = arguments[_i]; + } +} diff --git a/tests/baselines/reference/restParametersOfNonArrayTypes.js b/tests/baselines/reference/restParametersOfNonArrayTypes.js index b1b2d7d2fb2..f6f6a8af44d 100644 --- a/tests/baselines/reference/restParametersOfNonArrayTypes.js +++ b/tests/baselines/reference/restParametersOfNonArrayTypes.js @@ -27,18 +27,53 @@ var b = { //// [restParametersOfNonArrayTypes.js] // Rest parameters must be an array type if they have a type annotation, so all these are errors -function foo() { } -var f = function foo() { }; -var f2 = function (x) { }; +function foo() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +} +var f = function foo() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +}; +var f2 = function (x) { + var y = []; + for (var _i = 1; _i < arguments.length; _i++) { + y[_i - 1] = arguments[_i]; + } +}; var C = (function () { function C() { } - C.prototype.foo = function () { }; + C.prototype.foo = function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + }; return C; })(); var a; var b = { - foo: function () { }, - a: function foo(x) { }, - b: function () { } + foo: function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + }, + a: function foo(x) { + var y = []; + for (var _i = 1; _i < arguments.length; _i++) { + y[_i - 1] = arguments[_i]; + } + }, + b: function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + } }; diff --git a/tests/baselines/reference/restParametersOfNonArrayTypes2.js b/tests/baselines/reference/restParametersOfNonArrayTypes2.js index c6ad1f2ce25..73d0ddaeef2 100644 --- a/tests/baselines/reference/restParametersOfNonArrayTypes2.js +++ b/tests/baselines/reference/restParametersOfNonArrayTypes2.js @@ -59,33 +59,103 @@ var b2 = { //// [restParametersOfNonArrayTypes2.js] // Rest parameters must be an array type if they have a type annotation, // user defined subtypes of array do not count, all of these are errors -function foo() { } -var f = function foo() { }; -var f2 = function (x) { }; +function foo() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +} +var f = function foo() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +}; +var f2 = function (x) { + var y = []; + for (var _i = 1; _i < arguments.length; _i++) { + y[_i - 1] = arguments[_i]; + } +}; var C = (function () { function C() { } - C.prototype.foo = function () { }; + C.prototype.foo = function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + }; return C; })(); var a; var b = { - foo: function () { }, - a: function foo(x) { }, - b: function () { } + foo: function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + }, + a: function foo(x) { + var y = []; + for (var _i = 1; _i < arguments.length; _i++) { + y[_i - 1] = arguments[_i]; + } + }, + b: function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + } +}; +function foo2() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +} +var f3 = function foo() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +}; +var f4 = function (x) { + var y = []; + for (var _i = 1; _i < arguments.length; _i++) { + y[_i - 1] = arguments[_i]; + } }; -function foo2() { } -var f3 = function foo() { }; -var f4 = function (x) { }; var C2 = (function () { function C2() { } - C2.prototype.foo = function () { }; + C2.prototype.foo = function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + }; return C2; })(); var a2; var b2 = { - foo: function () { }, - a: function foo(x) { }, - b: function () { } + foo: function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + }, + a: function foo(x) { + var y = []; + for (var _i = 1; _i < arguments.length; _i++) { + y[_i - 1] = arguments[_i]; + } + }, + b: function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + } }; diff --git a/tests/baselines/reference/restParametersWithArrayTypeAnnotations.js b/tests/baselines/reference/restParametersWithArrayTypeAnnotations.js index a199edea2c6..c7d1dee9295 100644 --- a/tests/baselines/reference/restParametersWithArrayTypeAnnotations.js +++ b/tests/baselines/reference/restParametersWithArrayTypeAnnotations.js @@ -54,33 +54,103 @@ var b2 = { //// [restParametersWithArrayTypeAnnotations.js] // Rest parameters must be an array type if they have a type annotation, errors only for the functions with 2 rest params -function foo() { } -var f = function foo() { }; -var f2 = function (x) { }; +function foo() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +} +var f = function foo() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +}; +var f2 = function (x) { + var y = []; + for (var _i = 1; _i < arguments.length; _i++) { + y[_i - 1] = arguments[_i]; + } +}; var C = (function () { function C() { } - C.prototype.foo = function () { }; + C.prototype.foo = function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + }; return C; })(); var a; var b = { - foo: function () { }, - a: function foo(x) { }, - b: function () { } + foo: function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + }, + a: function foo(x) { + var y = []; + for (var _i = 1; _i < arguments.length; _i++) { + y[_i - 1] = arguments[_i]; + } + }, + b: function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + } +}; +function foo2() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +} +var f3 = function foo() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +}; +var f4 = function (x) { + var y = []; + for (var _i = 1; _i < arguments.length; _i++) { + y[_i - 1] = arguments[_i]; + } }; -function foo2() { } -var f3 = function foo() { }; -var f4 = function (x) { }; var C2 = (function () { function C2() { } - C2.prototype.foo = function () { }; + C2.prototype.foo = function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + }; return C2; })(); var a2; var b2 = { - foo: function () { }, - a: function foo(x) { }, - b: function () { } + foo: function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + }, + a: function foo(x) { + var y = []; + for (var _i = 1; _i < arguments.length; _i++) { + y[_i - 1] = arguments[_i]; + } + }, + b: function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + } }; diff --git a/tests/baselines/reference/restParamsWithNonRestParams.js b/tests/baselines/reference/restParamsWithNonRestParams.js index b58870f1346..6b0caa72394 100644 --- a/tests/baselines/reference/restParamsWithNonRestParams.js +++ b/tests/baselines/reference/restParamsWithNonRestParams.js @@ -7,9 +7,24 @@ function foo3(a?:string, ...b:number[]){} foo3(); // error but shouldn't be //// [restParamsWithNonRestParams.js] -function foo() { } +function foo() { + var b = []; + for (var _i = 0; _i < arguments.length; _i++) { + b[_i - 0] = arguments[_i]; + } +} foo(); // ok -function foo2(a) { } +function foo2(a) { + var b = []; + for (var _i = 1; _i < arguments.length; _i++) { + b[_i - 1] = arguments[_i]; + } +} foo2(); // should be an error -function foo3(a) { } +function foo3(a) { + var b = []; + for (var _i = 1; _i < arguments.length; _i++) { + b[_i - 1] = arguments[_i]; + } +} foo3(); // error but shouldn't be diff --git a/tests/baselines/reference/sourceMap-FileWithComments.js.map b/tests/baselines/reference/sourceMap-FileWithComments.js.map index 914d81cee83..28d4566efc7 100644 --- a/tests/baselines/reference/sourceMap-FileWithComments.js.map +++ b/tests/baselines/reference/sourceMap-FileWithComments.js.map @@ -1,2 +1,2 @@ //// [sourceMap-FileWithComments.js.map] -{"version":3,"file":"sourceMap-FileWithComments.js","sourceRoot":"","sources":["sourceMap-FileWithComments.ts"],"names":["Shapes","Shapes.Point","Shapes.Point.constructor","Shapes.Point.getDist"],"mappings":"AAOA,AADA,SAAS;AACT,IAAO,MAAM,CAwBZ;AAxBD,WAAO,MAAM,EAAC,CAAC;IAGXA,AADAA,QAAQA;QACKA,KAAKA;QACdC,cAAcA;QACdA,SAFSA,KAAKA,CAEKA,CAASA,EAASA,CAASA;YAA3BC,MAACA,GAADA,CAACA,CAAQA;YAASA,MAACA,GAADA,CAACA,CAAQA;QAAIA,CAACA;QAEnDD,kBAAkBA;QAClBA,uBAAOA,GAAPA,cAAYE,MAAMA,CAACA,IAAIA,CAACA,IAAIA,CAACA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,CAACA,CAACA,CAACA,CAACA;QAElEF,gBAAgBA;QACTA,YAAMA,GAAGA,IAAIA,KAAKA,CAACA,CAACA,EAAEA,CAACA,CAACA,CAACA;QACpCA,YAACA;IAADA,CAACA,AATDD,IASCA;IATYA,YAAKA,GAALA,KASZA,CAAAA;IAGDA,AADAA,+BAA+BA;QAC3BA,CAACA,GAAGA,EAAEA,CAACA;IAEXA,SAAgBA,GAAGA;IACnBA,CAACA;IADeA,UAAGA,GAAHA,GACfA,CAAAA;IAKDA,AAHAA;;MAEEA;QACEA,CAACA,GAAGA,EAAEA,CAACA;AACfA,CAACA,EAxBM,MAAM,KAAN,MAAM,QAwBZ;AAGD,AADA,qBAAqB;IACjB,CAAC,GAAW,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACvC,IAAI,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC"} \ No newline at end of file +{"version":3,"file":"sourceMap-FileWithComments.js","sourceRoot":"","sources":["sourceMap-FileWithComments.ts"],"names":["Shapes","Shapes.Point","Shapes.Point.constructor","Shapes.Point.getDist","Shapes.foo"],"mappings":"AAOA,AADA,SAAS;AACT,IAAO,MAAM,CAwBZ;AAxBD,WAAO,MAAM,EAAC,CAAC;IAGXA,AADAA,QAAQA;QACKA,KAAKA;QACdC,cAAcA;QACdA,SAFSA,KAAKA,CAEKA,CAASA,EAASA,CAASA;YAA3BC,MAACA,GAADA,CAACA,CAAQA;YAASA,MAACA,GAADA,CAACA,CAAQA;QAAIA,CAACA;QAEnDD,kBAAkBA;QAClBA,uBAAOA,GAAPA,cAAYE,MAAMA,CAACA,IAAIA,CAACA,IAAIA,CAACA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,CAACA,CAACA,CAACA,CAACA;QAElEF,gBAAgBA;QACTA,YAAMA,GAAGA,IAAIA,KAAKA,CAACA,CAACA,EAAEA,CAACA,CAACA,CAACA;QACpCA,YAACA;IAADA,CAACA,AATDD,IASCA;IATYA,YAAKA,GAALA,KASZA,CAAAA;IAGDA,AADAA,+BAA+BA;QAC3BA,CAACA,GAAGA,EAAEA,CAACA;IAEXA,SAAgBA,GAAGA;IACnBI,CAACA;IADeJ,UAAGA,GAAHA,GACfA,CAAAA;IAKDA,AAHAA;;MAEEA;QACEA,CAACA,GAAGA,EAAEA,CAACA;AACfA,CAACA,EAxBM,MAAM,KAAN,MAAM,QAwBZ;AAGD,AADA,qBAAqB;IACjB,CAAC,GAAW,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACvC,IAAI,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt b/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt index 74975cdc583..c0e46430688 100644 --- a/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt +++ b/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt @@ -450,8 +450,8 @@ sourceFile:sourceMap-FileWithComments.ts 1 >() { > 2 > } -1 >Emitted(21, 5) Source(26, 5) + SourceIndex(0) name (Shapes) -2 >Emitted(21, 6) Source(26, 6) + SourceIndex(0) name (Shapes) +1 >Emitted(21, 5) Source(26, 5) + SourceIndex(0) name (Shapes.foo) +2 >Emitted(21, 6) Source(26, 6) + SourceIndex(0) name (Shapes.foo) --- >>> Shapes.foo = foo; 1->^^^^ diff --git a/tests/baselines/reference/sourceMapValidationFunctionPropertyAssignment.js.map b/tests/baselines/reference/sourceMapValidationFunctionPropertyAssignment.js.map index 4f11f33d322..81066a66bad 100644 --- a/tests/baselines/reference/sourceMapValidationFunctionPropertyAssignment.js.map +++ b/tests/baselines/reference/sourceMapValidationFunctionPropertyAssignment.js.map @@ -1,2 +1,2 @@ //// [sourceMapValidationFunctionPropertyAssignment.js.map] -{"version":3,"file":"sourceMapValidationFunctionPropertyAssignment.js","sourceRoot":"","sources":["sourceMapValidationFunctionPropertyAssignment.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,EAAE,CAAC,gBAAK,CAAC,EAAE,CAAC"} \ No newline at end of file +{"version":3,"file":"sourceMapValidationFunctionPropertyAssignment.js","sourceRoot":"","sources":["sourceMapValidationFunctionPropertyAssignment.ts"],"names":["n"],"mappings":"AAAA,IAAI,CAAC,GAAG,EAAE,CAAC,gBAAKA,CAACA,EAAE,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationFunctionPropertyAssignment.sourcemap.txt b/tests/baselines/reference/sourceMapValidationFunctionPropertyAssignment.sourcemap.txt index a1a44c4ffb4..52a8bfe688c 100644 --- a/tests/baselines/reference/sourceMapValidationFunctionPropertyAssignment.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationFunctionPropertyAssignment.sourcemap.txt @@ -36,8 +36,8 @@ sourceFile:sourceMapValidationFunctionPropertyAssignment.ts 4 >Emitted(1, 9) Source(1, 9) + SourceIndex(0) 5 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) 6 >Emitted(1, 12) Source(1, 12) + SourceIndex(0) -7 >Emitted(1, 28) Source(1, 17) + SourceIndex(0) -8 >Emitted(1, 29) Source(1, 18) + SourceIndex(0) +7 >Emitted(1, 28) Source(1, 17) + SourceIndex(0) name (n) +8 >Emitted(1, 29) Source(1, 18) + SourceIndex(0) name (n) 9 >Emitted(1, 31) Source(1, 20) + SourceIndex(0) 10>Emitted(1, 32) Source(1, 21) + SourceIndex(0) --- diff --git a/tests/baselines/reference/taggedTemplateStringsHexadecimalEscapes.js b/tests/baselines/reference/taggedTemplateStringsHexadecimalEscapes.js new file mode 100644 index 00000000000..e4482ded0c2 --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsHexadecimalEscapes.js @@ -0,0 +1,15 @@ +//// [taggedTemplateStringsHexadecimalEscapes.ts] +function f(...args: any[]) { +} + +f `\x0D${ "Interrupted CRLF" }\x0A`; + +//// [taggedTemplateStringsHexadecimalEscapes.js] +function f() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i - 0] = arguments[_i]; + } +} +(_a = ["\r", "\n"], _a.raw = ["\\x0D", "\\x0A"], f(_a, "Interrupted CRLF")); +var _a; diff --git a/tests/baselines/reference/taggedTemplateStringsHexadecimalEscapes.types b/tests/baselines/reference/taggedTemplateStringsHexadecimalEscapes.types new file mode 100644 index 00000000000..37f583efd59 --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsHexadecimalEscapes.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/taggedTemplateStringsHexadecimalEscapes.ts === +function f(...args: any[]) { +>f : (...args: any[]) => void +>args : any[] +} + +f `\x0D${ "Interrupted CRLF" }\x0A`; +>f : (...args: any[]) => void + diff --git a/tests/baselines/reference/taggedTemplateStringsHexadecimalEscapesES6.js b/tests/baselines/reference/taggedTemplateStringsHexadecimalEscapesES6.js new file mode 100644 index 00000000000..31a0358973f --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsHexadecimalEscapesES6.js @@ -0,0 +1,10 @@ +//// [taggedTemplateStringsHexadecimalEscapesES6.ts] +function f(...args: any[]) { +} + +f `\x0D${ "Interrupted CRLF" }\x0A`; + +//// [taggedTemplateStringsHexadecimalEscapesES6.js] +function f(...args) { +} +f `\x0D${"Interrupted CRLF"}\x0A`; diff --git a/tests/baselines/reference/taggedTemplateStringsHexadecimalEscapesES6.types b/tests/baselines/reference/taggedTemplateStringsHexadecimalEscapesES6.types new file mode 100644 index 00000000000..b96c0664e2f --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsHexadecimalEscapesES6.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/taggedTemplateStringsHexadecimalEscapesES6.ts === +function f(...args: any[]) { +>f : (...args: any[]) => void +>args : any[] +} + +f `\x0D${ "Interrupted CRLF" }\x0A`; +>f : (...args: any[]) => void + diff --git a/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.js b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.js new file mode 100644 index 00000000000..9450e939f2f --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.js @@ -0,0 +1,18 @@ +//// [taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.ts] + + +function f(...x: any[]) { + +} + +f `0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` + +//// [taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.js] +function f() { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } +} +(_a = ["0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n"], _a.raw = ["0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n"], f(_a)); +var _a; diff --git a/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.types b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.types new file mode 100644 index 00000000000..db793591222 --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.types @@ -0,0 +1,12 @@ +=== tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.ts === + + +function f(...x: any[]) { +>f : (...x: any[]) => void +>x : any[] + +} + +f `0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` +>f : (...x: any[]) => void + diff --git a/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6.js b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6.js new file mode 100644 index 00000000000..a3c6806b1d3 --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6.js @@ -0,0 +1,12 @@ +//// [taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6.ts] + +function f(...x: any[]) { + +} + +f `0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` + +//// [taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6.js] +function f(...x) { +} +f `0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n`; diff --git a/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6.types b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6.types new file mode 100644 index 00000000000..e1e63197c90 --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6.types @@ -0,0 +1,11 @@ +=== tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6.ts === + +function f(...x: any[]) { +>f : (...x: any[]) => void +>x : any[] + +} + +f `0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` +>f : (...x: any[]) => void + diff --git a/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.js b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.js new file mode 100644 index 00000000000..ca192ef98d3 --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.js @@ -0,0 +1,7 @@ +//// [taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.ts] + + +`0${ " " }1${ " " }2${ " " }3${ " " }4${ " " }5${ " " }6${ " " }7${ " " }8${ " " }9${ " " }10${ " " }11${ " " }12${ " " }13${ " " }14${ " " }15${ " " }16${ " " }17${ " " }18${ " " }19${ " " }20${ " " }2028${ " " }2029${ " " }0085${ " " }t${ " " }v${ " " }f${ " " }b${ " " }r${ " " }n` + +//// [taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.js] +"0" + " " + "1" + " " + "2" + " " + "3" + " " + "4" + " " + "5" + " " + "6" + " " + "7" + " " + "8" + " " + "9" + " " + "10" + " " + "11" + " " + "12" + " " + "13" + " " + "14" + " " + "15" + " " + "16" + " " + "17" + " " + "18" + " " + "19" + " " + "20" + " " + "2028" + " " + "2029" + " " + "0085" + " " + "t" + " " + "v" + " " + "f" + " " + "b" + " " + "r" + " " + "n"; diff --git a/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.types b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.types new file mode 100644 index 00000000000..3ee1a72f8e2 --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.ts === + +No type information for this code. +No type information for this code.`0${ " " }1${ " " }2${ " " }3${ " " }4${ " " }5${ " " }6${ " " }7${ " " }8${ " " }9${ " " }10${ " " }11${ " " }12${ " " }13${ " " }14${ " " }15${ " " }16${ " " }17${ " " }18${ " " }19${ " " }20${ " " }2028${ " " }2029${ " " }0085${ " " }t${ " " }v${ " " }f${ " " }b${ " " }r${ " " }n` +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6.js b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6.js new file mode 100644 index 00000000000..46eb5e90cd9 --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6.js @@ -0,0 +1,12 @@ +//// [taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6.ts] + +function f(...x: any[]) { + +} + +f `0${ " " }1${ " " }2${ " " }3${ " " }4${ " " }5${ " " }6${ " " }7${ " " }8${ " " }9${ " " }10${ " " }11${ " " }12${ " " }13${ " " }14${ " " }15${ " " }16${ " " }17${ " " }18${ " " }19${ " " }20${ " " }2028${ " " }2029${ " " }0085${ " " }t${ " " }v${ " " }f${ " " }b${ " " }r${ " " }n` + +//// [taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6.js] +function f(...x) { +} +f `0${" "}1${" "}2${" "}3${" "}4${" "}5${" "}6${" "}7${" "}8${" "}9${" "}10${" "}11${" "}12${" "}13${" "}14${" "}15${" "}16${" "}17${" "}18${" "}19${" "}20${" "}2028${" "}2029${" "}0085${" "}t${" "}v${" "}f${" "}b${" "}r${" "}n`; diff --git a/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6.types b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6.types new file mode 100644 index 00000000000..727aa7daeb0 --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6.types @@ -0,0 +1,11 @@ +=== tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6.ts === + +function f(...x: any[]) { +>f : (...x: any[]) => void +>x : any[] + +} + +f `0${ " " }1${ " " }2${ " " }3${ " " }4${ " " }5${ " " }6${ " " }7${ " " }8${ " " }9${ " " }10${ " " }11${ " " }12${ " " }13${ " " }14${ " " }15${ " " }16${ " " }17${ " " }18${ " " }19${ " " }20${ " " }2028${ " " }2029${ " " }0085${ " " }t${ " " }v${ " " }f${ " " }b${ " " }r${ " " }n` +>f : (...x: any[]) => void + diff --git a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.errors.txt b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.errors.txt index 275fdac6ac7..f3706ae8f17 100644 --- a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.errors.txt @@ -1,143 +1,69 @@ -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(5,10): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(9,17): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(13,16): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(16,16): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(20,16): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(23,16): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(27,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(28,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(29,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(33,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(34,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(35,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(39,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(40,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(41,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(45,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(46,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(47,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(51,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(52,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(53,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(57,23): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(58,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(64,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(64,25): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(77,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate '{ x: number; z: Date; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. Property 'z' is missing in type '{ x: number; y: string; }'. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(77,25): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(81,25): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(86,23): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(90,25): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -==== tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts (30 errors) ==== +==== tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts (2 errors) ==== // Generic tag with one parameter function noParams(n: T) { } noParams ``; - ~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic tag with parameter which does not use type parameter function noGenericParams(n: string[]) { } noGenericParams ``; - ~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic tag with multiple type parameters and only one used in parameter type annotation function someGenerics1a(n: T, m: number) { } someGenerics1a `${3}`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. function someGenerics1b(n: string[], m: U) { } someGenerics1b `${3}`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic tag with argument of function type whose parameter is of type parameter type function someGenerics2a(strs: string[], n: (x: T) => void) { } someGenerics2a `${(n: string) => n}`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. function someGenerics2b(strs: string[], n: (x: T, y: U) => void) { } someGenerics2b `${ (n: string, x: number) => n }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic tag with argument of function type whose parameter is not of type parameter type but body/return type uses type parameter function someGenerics3(strs: string[], producer: () => T) { } someGenerics3 `${() => ''}`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. someGenerics3 `${() => undefined}`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. someGenerics3 `${() => 3}`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // 2 parameter generic tag with argument 1 of type parameter type and argument 2 of function type whose parameter is of type parameter type function someGenerics4(strs: string[], n: T, f: (x: U) => void) { } someGenerics4 `${4}${ () => null }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. someGenerics4 `${''}${ () => 3 }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. someGenerics4 `${ null }${ null }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // 2 parameter generic tag with argument 2 of type parameter type and argument 1 of function type whose parameter is of type parameter type function someGenerics5(strs: string[], n: T, f: (x: U) => void) { } someGenerics5 `${ 4 } ${ () => null }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. someGenerics5 `${ '' }${ () => 3 }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. someGenerics5 `${null}${null}`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic tag with multiple arguments of function types that each have parameters of the same generic type function someGenerics6(strs: string[], a: (a: A) => A, b: (b: A) => A, c: (c: A) => A) { } someGenerics6 `${ n => n }${ n => n}${ n => n}`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. someGenerics6 `${ n => n }${ n => n}${ n => n}`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. someGenerics6 `${ (n: number) => n }${ (n: number) => n }${ (n: number) => n }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic tag with multiple arguments of function types that each have parameters of different generic type function someGenerics7(strs: string[], a: (a: A) => A, b: (b: B) => B, c: (c: C) => C) { } someGenerics7 `${ n => n }${ n => n }${ n => n }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. someGenerics7 `${ n => n }${ n => n }${ n => n }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. someGenerics7 `${(n: number) => n}${ (n: string) => n}${ (n: number) => n}`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic tag with argument of generic function type function someGenerics8(strs: string[], n: T): T { return n; } var x = someGenerics8 `${ someGenerics7 }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. x `${null}${null}${null}`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic tag with multiple parameters of generic type passed arguments with no best common type function someGenerics9(strs: string[], a: T, b: T, c: T): T { @@ -147,8 +73,6 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference ~~~~~~~~~~~~~ !!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. !!! error TS2453: Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var a9a: {}; // Generic tag with multiple parameters of generic type passed arguments with multiple best common types @@ -166,27 +90,19 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference !!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. !!! error TS2453: Type argument candidate '{ x: number; z: Date; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. !!! error TS2453: Property 'z' is missing in type '{ x: number; y: string; }'. - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var a9e: {}; // Generic tag with multiple parameters of generic type passed arguments with a single best common type var a9d = someGenerics9 `${ { x: 3 }}${ { x: 6 }}${ { x: 6 } }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var a9d: { x: number; }; // Generic tag with multiple parameters of generic type where one argument is of type 'any' var anyVar: any; var a = someGenerics9 `${ 7 }${ anyVar }${ 4 }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var a: any; // Generic tag with multiple parameters of generic type where one argument is [] and the other is not 'any' var arr = someGenerics9 `${ [] }${ null }${ undefined }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var arr: any[]; \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js index bbcd6637964..9d3531c2667 100644 --- a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js +++ b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js @@ -96,64 +96,65 @@ var arr: any[]; //// [taggedTemplateStringsTypeArgumentInference.js] // Generic tag with one parameter function noParams(n) { } -noParams ""; +(_a = [""], _a.raw = [""], noParams(_a)); // Generic tag with parameter which does not use type parameter function noGenericParams(n) { } -noGenericParams ""; +(_b = [""], _b.raw = [""], noGenericParams(_b)); // Generic tag with multiple type parameters and only one used in parameter type annotation function someGenerics1a(n, m) { } -someGenerics1a "" + 3; +(_c = ["", ""], _c.raw = ["", ""], someGenerics1a(_c, 3)); function someGenerics1b(n, m) { } -someGenerics1b "" + 3; +(_d = ["", ""], _d.raw = ["", ""], someGenerics1b(_d, 3)); // Generic tag with argument of function type whose parameter is of type parameter type function someGenerics2a(strs, n) { } -someGenerics2a "" + function (n) { return n; }; +(_e = ["", ""], _e.raw = ["", ""], someGenerics2a(_e, function (n) { return n; })); function someGenerics2b(strs, n) { } -someGenerics2b "" + function (n, x) { return n; }; +(_f = ["", ""], _f.raw = ["", ""], someGenerics2b(_f, function (n, x) { return n; })); // Generic tag with argument of function type whose parameter is not of type parameter type but body/return type uses type parameter function someGenerics3(strs, producer) { } -someGenerics3 "" + function () { return ''; }; -someGenerics3 "" + function () { return undefined; }; -someGenerics3 "" + function () { return 3; }; +(_g = ["", ""], _g.raw = ["", ""], someGenerics3(_g, function () { return ''; })); +(_h = ["", ""], _h.raw = ["", ""], someGenerics3(_h, function () { return undefined; })); +(_j = ["", ""], _j.raw = ["", ""], someGenerics3(_j, function () { return 3; })); // 2 parameter generic tag with argument 1 of type parameter type and argument 2 of function type whose parameter is of type parameter type function someGenerics4(strs, n, f) { } -someGenerics4 "" + 4 + function () { return null; }; -someGenerics4 "" + '' + function () { return 3; }; -someGenerics4 "" + null + null; +(_k = ["", "", ""], _k.raw = ["", "", ""], someGenerics4(_k, 4, function () { return null; })); +(_l = ["", "", ""], _l.raw = ["", "", ""], someGenerics4(_l, '', function () { return 3; })); +(_m = ["", "", ""], _m.raw = ["", "", ""], someGenerics4(_m, null, null)); // 2 parameter generic tag with argument 2 of type parameter type and argument 1 of function type whose parameter is of type parameter type function someGenerics5(strs, n, f) { } -someGenerics5 4 + " " + function () { return null; }; -someGenerics5 "" + '' + function () { return 3; }; -someGenerics5 "" + null + null; +(_n = ["", " ", ""], _n.raw = ["", " ", ""], someGenerics5(_n, 4, function () { return null; })); +(_o = ["", "", ""], _o.raw = ["", "", ""], someGenerics5(_o, '', function () { return 3; })); +(_p = ["", "", ""], _p.raw = ["", "", ""], someGenerics5(_p, null, null)); // Generic tag with multiple arguments of function types that each have parameters of the same generic type function someGenerics6(strs, a, b, c) { } -someGenerics6 "" + function (n) { return n; } + function (n) { return n; } + function (n) { return n; }; -someGenerics6 "" + function (n) { return n; } + function (n) { return n; } + function (n) { return n; }; -someGenerics6 "" + function (n) { return n; } + function (n) { return n; } + function (n) { return n; }; +(_q = ["", "", "", ""], _q.raw = ["", "", "", ""], someGenerics6(_q, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); +(_r = ["", "", "", ""], _r.raw = ["", "", "", ""], someGenerics6(_r, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); +(_s = ["", "", "", ""], _s.raw = ["", "", "", ""], someGenerics6(_s, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); // Generic tag with multiple arguments of function types that each have parameters of different generic type function someGenerics7(strs, a, b, c) { } -someGenerics7 "" + function (n) { return n; } + function (n) { return n; } + function (n) { return n; }; -someGenerics7 "" + function (n) { return n; } + function (n) { return n; } + function (n) { return n; }; -someGenerics7 "" + function (n) { return n; } + function (n) { return n; } + function (n) { return n; }; +(_t = ["", "", "", ""], _t.raw = ["", "", "", ""], someGenerics7(_t, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); +(_u = ["", "", "", ""], _u.raw = ["", "", "", ""], someGenerics7(_u, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); +(_v = ["", "", "", ""], _v.raw = ["", "", "", ""], someGenerics7(_v, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); // Generic tag with argument of generic function type function someGenerics8(strs, n) { return n; } -var x = someGenerics8 "" + someGenerics7; -x "" + null + null + null; +var x = (_w = ["", ""], _w.raw = ["", ""], someGenerics8(_w, someGenerics7)); +(_x = ["", "", "", ""], _x.raw = ["", "", "", ""], x(_x, null, null, null)); // Generic tag with multiple parameters of generic type passed arguments with no best common type function someGenerics9(strs, a, b, c) { return null; } -var a9a = someGenerics9 "" + '' + 0 + []; +var a9a = (_y = ["", "", "", ""], _y.raw = ["", "", "", ""], someGenerics9(_y, '', 0, [])); var a9a; -var a9e = someGenerics9 "" + undefined + { x: 6, z: new Date() } + { x: 6, y: '' }; +var a9e = (_z = ["", "", "", ""], _z.raw = ["", "", "", ""], someGenerics9(_z, undefined, { x: 6, z: new Date() }, { x: 6, y: '' })); var a9e; // Generic tag with multiple parameters of generic type passed arguments with a single best common type -var a9d = someGenerics9 "" + { x: 3 } + { x: 6 } + { x: 6 }; +var a9d = (_0 = ["", "", "", ""], _0.raw = ["", "", "", ""], someGenerics9(_0, { x: 3 }, { x: 6 }, { x: 6 })); var a9d; // Generic tag with multiple parameters of generic type where one argument is of type 'any' var anyVar; -var a = someGenerics9 "" + 7 + anyVar + 4; +var a = (_1 = ["", "", "", ""], _1.raw = ["", "", "", ""], someGenerics9(_1, 7, anyVar, 4)); var a; // Generic tag with multiple parameters of generic type where one argument is [] and the other is not 'any' -var arr = someGenerics9 "" + [] + null + undefined; +var arr = (_2 = ["", "", "", ""], _2.raw = ["", "", "", ""], someGenerics9(_2, [], null, undefined)); var arr; +var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2; diff --git a/tests/baselines/reference/taggedTemplateStringsWithIncompatibleTypedTags.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithIncompatibleTypedTags.errors.txt index 6b389218f65..166769fbbf5 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithIncompatibleTypedTags.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithIncompatibleTypedTags.errors.txt @@ -1,24 +1,12 @@ -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(12,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(14,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(14,9): error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(16,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(18,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(18,9): error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(20,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(22,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(22,9): error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(24,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(24,19): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(24,25): error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(26,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(26,9): error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(26,40): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(28,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(28,50): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts(28,57): error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. -==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts (18 errors) ==== +==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts (6 errors) ==== interface I { (stringParts: string[], ...rest: boolean[]): I; g: I; @@ -31,56 +19,32 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithIncompatibleTyped var f: I; f `abc` - ~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. f `abc${1}def${2}ghi`; - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. f `abc`.member - ~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. f `abc${1}def${2}ghi`.member; - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. f `abc`["member"]; - ~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. f `abc${1}def${2}ghi`["member"]; - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. f `abc`[0].member `abc${1}def${2}ghi`; - ~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. f `abc${1}def${2}ghi`["member"].member `abc${1}def${2}ghi`; - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. f `abc${ true }def${ true }ghi`["member"].member `abc${ 1 }def${ 2 }ghi`; - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'. diff --git a/tests/baselines/reference/taggedTemplateStringsWithIncompatibleTypedTags.js b/tests/baselines/reference/taggedTemplateStringsWithIncompatibleTypedTags.js index c3e145afb2b..9d113793228 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithIncompatibleTypedTags.js +++ b/tests/baselines/reference/taggedTemplateStringsWithIncompatibleTypedTags.js @@ -35,14 +35,15 @@ f.thisIsNotATag(`abc${1}def${2}ghi`); //// [taggedTemplateStringsWithIncompatibleTypedTags.js] var f; -f "abc"; -f "abc" + 1 + "def" + 2 + "ghi"; -f "abc".member; -f "abc" + 1 + "def" + 2 + "ghi".member; -f "abc"["member"]; -f "abc" + 1 + "def" + 2 + "ghi"["member"]; -f "abc"[0].member "abc" + 1 + "def" + 2 + "ghi"; -f "abc" + 1 + "def" + 2 + "ghi"["member"].member "abc" + 1 + "def" + 2 + "ghi"; -f "abc" + true + "def" + true + "ghi"["member"].member "abc" + 1 + "def" + 2 + "ghi"; +(_a = ["abc"], _a.raw = ["abc"], f(_a)); +(_b = ["abc", "def", "ghi"], _b.raw = ["abc", "def", "ghi"], f(_b, 1, 2)); +(_c = ["abc"], _c.raw = ["abc"], f(_c)).member; +(_d = ["abc", "def", "ghi"], _d.raw = ["abc", "def", "ghi"], f(_d, 1, 2)).member; +(_e = ["abc"], _e.raw = ["abc"], f(_e))["member"]; +(_f = ["abc", "def", "ghi"], _f.raw = ["abc", "def", "ghi"], f(_f, 1, 2))["member"]; +(_g = ["abc", "def", "ghi"], _g.raw = ["abc", "def", "ghi"], (_h = ["abc"], _h.raw = ["abc"], f(_h))[0].member(_g, 1, 2)); +(_j = ["abc", "def", "ghi"], _j.raw = ["abc", "def", "ghi"], (_k = ["abc", "def", "ghi"], _k.raw = ["abc", "def", "ghi"], f(_k, 1, 2))["member"].member(_j, 1, 2)); +(_l = ["abc", "def", "ghi"], _l.raw = ["abc", "def", "ghi"], (_m = ["abc", "def", "ghi"], _m.raw = ["abc", "def", "ghi"], f(_m, true, true))["member"].member(_l, 1, 2)); f.thisIsNotATag("abc"); f.thisIsNotATag("abc" + 1 + "def" + 2 + "ghi"); +var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m; diff --git a/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressions.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressions.errors.txt deleted file mode 100644 index 17c0b330dbb..00000000000 --- a/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressions.errors.txt +++ /dev/null @@ -1,21 +0,0 @@ -tests/cases/conformance/es6/templates/taggedTemplateStringsWithManyCallAndMemberExpressions.ts(13,23): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithManyCallAndMemberExpressions.ts (1 errors) ==== - interface I { - (strs: string[], ...subs: number[]): I; - member: { - new (s: string): { - new (n: number): { - new (): boolean; - } - } - }; - } - var f: I; - - var x = new new new f `abc${ 0 }def`.member("hello")(42) === true; - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressions.js b/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressions.js index d507e951721..1814816283b 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressions.js +++ b/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressions.js @@ -17,4 +17,5 @@ var x = new new new f `abc${ 0 }def`.member("hello")(42) === true; //// [taggedTemplateStringsWithManyCallAndMemberExpressions.js] var f; -var x = new new new f "abc" + 0 + "def".member("hello")(42) === true; +var x = new new new (_a = ["abc", "def"], _a.raw = ["abc", "def"], f(_a, 0)).member("hello")(42) === true; +var _a; diff --git a/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressions.types b/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressions.types new file mode 100644 index 00000000000..6fa83bbde3d --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsWithManyCallAndMemberExpressions.types @@ -0,0 +1,38 @@ +=== tests/cases/conformance/es6/templates/taggedTemplateStringsWithManyCallAndMemberExpressions.ts === +interface I { +>I : I + + (strs: string[], ...subs: number[]): I; +>strs : string[] +>subs : number[] +>I : I + + member: { +>member : new (s: string) => new (n: number) => new () => boolean + + new (s: string): { +>s : string + + new (n: number): { +>n : number + + new (): boolean; + } + } + }; +} +var f: I; +>f : I +>I : I + +var x = new new new f `abc${ 0 }def`.member("hello")(42) === true; +>x : boolean +>new new new f `abc${ 0 }def`.member("hello")(42) === true : boolean +>new new new f `abc${ 0 }def`.member("hello")(42) : boolean +>new new f `abc${ 0 }def`.member("hello")(42) : new () => boolean +>new f `abc${ 0 }def`.member("hello") : new (n: number) => new () => boolean +>f `abc${ 0 }def`.member : new (s: string) => new (n: number) => new () => boolean +>f : I +>member : new (s: string) => new (n: number) => new () => boolean + + diff --git a/tests/baselines/reference/taggedTemplateStringsWithMultilineTemplate.js b/tests/baselines/reference/taggedTemplateStringsWithMultilineTemplate.js new file mode 100644 index 00000000000..cee9d1efce4 --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsWithMultilineTemplate.js @@ -0,0 +1,18 @@ +//// [taggedTemplateStringsWithMultilineTemplate.ts] +function f(...args: any[]): void { +} + +f ` +\ + +`; + +//// [taggedTemplateStringsWithMultilineTemplate.js] +function f() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i - 0] = arguments[_i]; + } +} +(_a = ["\n\n"], _a.raw = ["\n\\\n\n"], f(_a)); +var _a; diff --git a/tests/baselines/reference/taggedTemplateStringsWithMultilineTemplate.types b/tests/baselines/reference/taggedTemplateStringsWithMultilineTemplate.types new file mode 100644 index 00000000000..ec687ac0fae --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsWithMultilineTemplate.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/taggedTemplateStringsWithMultilineTemplate.ts === +function f(...args: any[]): void { +>f : (...args: any[]) => void +>args : any[] +} + +f ` +>f : (...args: any[]) => void + +\ + +`; diff --git a/tests/baselines/reference/taggedTemplateStringsWithMultilineTemplateES6.js b/tests/baselines/reference/taggedTemplateStringsWithMultilineTemplateES6.js new file mode 100644 index 00000000000..f1d0fb896da --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsWithMultilineTemplateES6.js @@ -0,0 +1,16 @@ +//// [taggedTemplateStringsWithMultilineTemplateES6.ts] +function f(...args: any[]): void { +} + +f ` +\ + +`; + +//// [taggedTemplateStringsWithMultilineTemplateES6.js] +function f(...args) { +} +f ` +\ + +`; diff --git a/tests/baselines/reference/taggedTemplateStringsWithMultilineTemplateES6.types b/tests/baselines/reference/taggedTemplateStringsWithMultilineTemplateES6.types new file mode 100644 index 00000000000..7047f7194c3 --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsWithMultilineTemplateES6.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/taggedTemplateStringsWithMultilineTemplateES6.ts === +function f(...args: any[]): void { +>f : (...args: any[]) => void +>args : any[] +} + +f ` +>f : (...args: any[]) => void + +\ + +`; diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt index e4c79537ce2..9e450cbb368 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt @@ -1,16 +1,10 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(12,20): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(14,9): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(16,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(17,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(18,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(19,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(19,20): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(20,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(21,9): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(21,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts (10 errors) ==== +==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts (4 errors) ==== function foo(strs: string[]): number; function foo(strs: string[], x: number): string; function foo(strs: string[], x: number, y: number): boolean; @@ -31,25 +25,13 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio !!! error TS2346: Supplied parameters do not match any signature of call target. var u = foo ``; // number - ~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var v = foo `${1}`; // string - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var w = foo `${1}${2}`; // boolean - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var x = foo `${1}${true}`; // boolean (with error) - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~~~~ !!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. var y = foo `${1}${"2"}`; // {} - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var z = foo `${1}${2}${3}`; // any (with error) ~~~~~~~~~~~~~~~~~~ !!! error TS2346: Supplied parameters do not match any signature of call target. - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.js b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.js index 23298e1df13..431447df22e 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.js +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.js @@ -36,9 +36,10 @@ var c = foo([], 1, 2); // boolean var d = foo([], 1, true); // boolean (with error) var e = foo([], 1, "2"); // {} var f = foo([], 1, 2, 3); // any (with error) -var u = foo ""; // number -var v = foo "" + 1; // string -var w = foo "" + 1 + 2; // boolean -var x = foo "" + 1 + true; // boolean (with error) -var y = foo "" + 1 + "2"; // {} -var z = foo "" + 1 + 2 + 3; // any (with error) +var u = (_a = [""], _a.raw = [""], foo(_a)); // number +var v = (_b = ["", ""], _b.raw = ["", ""], foo(_b, 1)); // string +var w = (_c = ["", "", ""], _c.raw = ["", "", ""], foo(_c, 1, 2)); // boolean +var x = (_d = ["", "", ""], _d.raw = ["", "", ""], foo(_d, 1, true)); // boolean (with error) +var y = (_e = ["", "", ""], _e.raw = ["", "", ""], foo(_e, 1, "2")); // {} +var z = (_f = ["", "", "", ""], _f.raw = ["", "", "", ""], foo(_f, 1, 2, 3)); // any (with error) +var _a, _b, _c, _d, _e, _f; diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.errors.txt deleted file mode 100644 index 3bf4af39779..00000000000 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.errors.txt +++ /dev/null @@ -1,27 +0,0 @@ -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution2.ts(8,14): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution2.ts(17,14): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution2.ts (2 errors) ==== - - function foo1(strs: TemplateStringsArray, x: number): string; - function foo1(strs: string[], x: number): number; - function foo1(...stuff: any[]): any { - return undefined; - } - - var a = foo1 `${1}`; // string - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - var b = foo1([], 1); // number - - function foo2(strs: string[], x: number): number; - function foo2(strs: TemplateStringsArray, x: number): string; - function foo2(...stuff: any[]): any { - return undefined; - } - - var c = foo2 `${1}`; // number - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - var d = foo2([], 1); // number \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.js b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.js index 0b1447a3d3f..f12008f9581 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.js +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.js @@ -26,7 +26,7 @@ function foo1() { } return undefined; } -var a = foo1 "" + 1; // string +var a = (_a = ["", ""], _a.raw = ["", ""], foo1(_a, 1)); // string var b = foo1([], 1); // number function foo2() { var stuff = []; @@ -35,5 +35,6 @@ function foo2() { } return undefined; } -var c = foo2 "" + 1; // number +var c = (_b = ["", ""], _b.raw = ["", ""], foo2(_b, 1)); // number var d = foo2([], 1); // number +var _a, _b; diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.types b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.types new file mode 100644 index 00000000000..0863ac3fafc --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.types @@ -0,0 +1,60 @@ +=== tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution2.ts === + +function foo1(strs: TemplateStringsArray, x: number): string; +>foo1 : { (strs: TemplateStringsArray, x: number): string; (strs: string[], x: number): number; } +>strs : TemplateStringsArray +>TemplateStringsArray : TemplateStringsArray +>x : number + +function foo1(strs: string[], x: number): number; +>foo1 : { (strs: TemplateStringsArray, x: number): string; (strs: string[], x: number): number; } +>strs : string[] +>x : number + +function foo1(...stuff: any[]): any { +>foo1 : { (strs: TemplateStringsArray, x: number): string; (strs: string[], x: number): number; } +>stuff : any[] + + return undefined; +>undefined : undefined +} + +var a = foo1 `${1}`; // string +>a : string +>foo1 : { (strs: TemplateStringsArray, x: number): string; (strs: string[], x: number): number; } + +var b = foo1([], 1); // number +>b : number +>foo1([], 1) : number +>foo1 : { (strs: TemplateStringsArray, x: number): string; (strs: string[], x: number): number; } +>[] : undefined[] + +function foo2(strs: string[], x: number): number; +>foo2 : { (strs: string[], x: number): number; (strs: TemplateStringsArray, x: number): string; } +>strs : string[] +>x : number + +function foo2(strs: TemplateStringsArray, x: number): string; +>foo2 : { (strs: string[], x: number): number; (strs: TemplateStringsArray, x: number): string; } +>strs : TemplateStringsArray +>TemplateStringsArray : TemplateStringsArray +>x : number + +function foo2(...stuff: any[]): any { +>foo2 : { (strs: string[], x: number): number; (strs: TemplateStringsArray, x: number): string; } +>stuff : any[] + + return undefined; +>undefined : undefined +} + +var c = foo2 `${1}`; // number +>c : number +>foo2 : { (strs: string[], x: number): number; (strs: TemplateStringsArray, x: number): string; } + +var d = foo2([], 1); // number +>d : number +>foo2([], 1) : number +>foo2 : { (strs: string[], x: number): number; (strs: TemplateStringsArray, x: number): string; } +>[] : undefined[] + diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.errors.txt index c1a6b228b01..0d65c3fd13b 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.errors.txt @@ -1,34 +1,12 @@ -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(7,21): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(10,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(10,9): error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(16,20): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(17,20): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(19,4): error TS2339: Property 'foo' does not exist on type 'Date'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(23,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(26,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(34,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(35,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(36,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(40,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(41,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(42,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(45,1): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(45,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(54,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(55,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(56,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(57,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(60,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(63,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(63,9): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(64,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(64,18): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(70,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(70,18): error TS2339: Property 'toFixed' does not exist on type 'string'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(71,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts (28 errors) ==== +==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts (6 errors) ==== // Ambiguous call picks the first overload in declaration order function fn1(strs: TemplateStringsArray, s: string): string; @@ -36,13 +14,9 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio function fn1() { return null; } var s: string = fn1 `${ undefined }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // No candidate overloads found fn1 `${ {} }`; // Error - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~~ !!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'. @@ -51,11 +25,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio function fn2() { return undefined; } var d1: Date = fn2 `${ 0 }${ undefined }`; // contextually typed - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var d2 = fn2 `${ 0 }${ undefined }`; // any - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. d1.foo(); // error ~~~ @@ -64,13 +34,9 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio // Generic and non-generic overload where generic overload is the only candidate fn2 `${ 0 }${ '' }`; // OK - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic and non-generic overload where non-generic overload is the only candidate fn2 `${ '' }${ 0 }`; // OK - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic overloads with differing arity function fn3(strs: TemplateStringsArray, n: T): string; @@ -79,33 +45,19 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio function fn3() { return null; } var s = fn3 `${ 3 }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var s = fn3 `${'' }${ 3 }${ '' }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var n = fn3 `${ 5 }${ 5 }${ 5 }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var n: number; // Generic overloads with differing arity tagging with arguments matching each overload type parameter count var s = fn3 `${ 4 }` - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var s = fn3 `${ '' }${ '' }${ '' }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var n = fn3 `${ '' }${ '' }${ 3 }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic overloads with differing arity tagging with argument count that doesn't match any overload fn3 ``; // Error ~~~~~~ !!! error TS2346: Supplied parameters do not match any signature of call target. - ~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic overloads with constraints function fn4(strs: TemplateStringsArray, n: T, m: U); @@ -115,32 +67,18 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio // Generic overloads with constraints tagged with types that satisfy the constraints fn4 `${ '' }${ 3 }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. fn4 `${ 3 }${ '' }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. fn4 `${ 3 }${ undefined }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. fn4 `${ '' }${ null }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic overloads with constraints called with type arguments that do not satisfy the constraints fn4 `${ null }${ null }`; // Error - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints fn4 `${ true }${ null }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~~~~ !!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number'. fn4 `${ null }${ true }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~~~~ !!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. @@ -149,12 +87,8 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio function fn5(strs: TemplateStringsArray, f: (n: number) => void): number; function fn5() { return undefined; } fn5 `${ (n) => n.toFixed() }`; // will error; 'n' should have type 'string'. - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~~~~~~~ !!! error TS2339: Property 'toFixed' does not exist on type 'string'. fn5 `${ (n) => n.substr(0) }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js index c6abf11419a..4b9df44d3f7 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js @@ -75,40 +75,41 @@ fn5 `${ (n) => n.substr(0) }`; //// [taggedTemplateStringsWithOverloadResolution3.js] function fn1() { return null; } -var s = fn1 "" + undefined; +var s = (_a = ["", ""], _a.raw = ["", ""], fn1(_a, undefined)); // No candidate overloads found -fn1 "" + {}; // Error +(_b = ["", ""], _b.raw = ["", ""], fn1(_b, {})); // Error function fn2() { return undefined; } -var d1 = fn2 "" + 0 + undefined; // contextually typed -var d2 = fn2 "" + 0 + undefined; // any +var d1 = (_c = ["", "", ""], _c.raw = ["", "", ""], fn2(_c, 0, undefined)); // contextually typed +var d2 = (_d = ["", "", ""], _d.raw = ["", "", ""], fn2(_d, 0, undefined)); // any d1.foo(); // error d2(); // no error (typed as any) // Generic and non-generic overload where generic overload is the only candidate -fn2 "" + 0 + ''; // OK +(_e = ["", "", ""], _e.raw = ["", "", ""], fn2(_e, 0, '')); // OK // Generic and non-generic overload where non-generic overload is the only candidate -fn2 "" + '' + 0; // OK +(_f = ["", "", ""], _f.raw = ["", "", ""], fn2(_f, '', 0)); // OK function fn3() { return null; } -var s = fn3 "" + 3; -var s = fn3 "" + '' + 3 + ''; -var n = fn3 "" + 5 + 5 + 5; +var s = (_g = ["", ""], _g.raw = ["", ""], fn3(_g, 3)); +var s = (_h = ["", "", "", ""], _h.raw = ["", "", "", ""], fn3(_h, '', 3, '')); +var n = (_j = ["", "", "", ""], _j.raw = ["", "", "", ""], fn3(_j, 5, 5, 5)); var n; // Generic overloads with differing arity tagging with arguments matching each overload type parameter count -var s = fn3 "" + 4; -var s = fn3 "" + '' + '' + ''; -var n = fn3 "" + '' + '' + 3; +var s = (_k = ["", ""], _k.raw = ["", ""], fn3(_k, 4)); +var s = (_l = ["", "", "", ""], _l.raw = ["", "", "", ""], fn3(_l, '', '', '')); +var n = (_m = ["", "", "", ""], _m.raw = ["", "", "", ""], fn3(_m, '', '', 3)); // Generic overloads with differing arity tagging with argument count that doesn't match any overload -fn3 ""; // Error +(_n = [""], _n.raw = [""], fn3(_n)); // Error function fn4() { } // Generic overloads with constraints tagged with types that satisfy the constraints -fn4 "" + '' + 3; -fn4 "" + 3 + ''; -fn4 "" + 3 + undefined; -fn4 "" + '' + null; +(_o = ["", "", ""], _o.raw = ["", "", ""], fn4(_o, '', 3)); +(_p = ["", "", ""], _p.raw = ["", "", ""], fn4(_p, 3, '')); +(_q = ["", "", ""], _q.raw = ["", "", ""], fn4(_q, 3, undefined)); +(_r = ["", "", ""], _r.raw = ["", "", ""], fn4(_r, '', null)); // Generic overloads with constraints called with type arguments that do not satisfy the constraints -fn4 "" + null + null; // Error +(_s = ["", "", ""], _s.raw = ["", "", ""], fn4(_s, null, null)); // Error // Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints -fn4 "" + true + null; -fn4 "" + null + true; +(_t = ["", "", ""], _t.raw = ["", "", ""], fn4(_t, true, null)); +(_u = ["", "", ""], _u.raw = ["", "", ""], fn4(_u, null, true)); function fn5() { return undefined; } -fn5 "" + function (n) { return n.toFixed(); }; // will error; 'n' should have type 'string'. -fn5 "" + function (n) { return n.substr(0); }; +(_v = ["", ""], _v.raw = ["", ""], fn5(_v, function (n) { return n.toFixed(); })); // will error; 'n' should have type 'string'. +(_w = ["", ""], _w.raw = ["", ""], fn5(_w, function (n) { return n.substr(0); })); +var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w; diff --git a/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.errors.txt deleted file mode 100644 index 2557d6cc94a..00000000000 --- a/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.errors.txt +++ /dev/null @@ -1,64 +0,0 @@ -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(3,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(5,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(7,7): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(9,7): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(11,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(13,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(15,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(17,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(19,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(19,32): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(21,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts(21,46): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts (12 errors) ==== - var f: any; - - f `abc` - ~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f `abc${1}def${2}ghi`; - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f.g.h `abc` - ~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f.g.h `abc${1}def${2}ghi`; - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f `abc`.member - ~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f `abc${1}def${2}ghi`.member; - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f `abc`["member"]; - ~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f `abc${1}def${2}ghi`["member"]; - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f `abc`["member"].someOtherTag `abc${1}def${2}ghi`; - ~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f `abc${1}def${2}ghi`["member"].someOtherTag `abc${1}def${2}ghi`; - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f.thisIsNotATag(`abc`); - - f.thisIsNotATag(`abc${1}def${2}ghi`); \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.js b/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.js index d5c6b8b31f6..fd83d9d0ba0 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.js +++ b/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.js @@ -27,15 +27,16 @@ f.thisIsNotATag(`abc${1}def${2}ghi`); //// [taggedTemplateStringsWithTagsTypedAsAny.js] var f; -f "abc"; -f "abc" + 1 + "def" + 2 + "ghi"; -f.g.h "abc"; -f.g.h "abc" + 1 + "def" + 2 + "ghi"; -f "abc".member; -f "abc" + 1 + "def" + 2 + "ghi".member; -f "abc"["member"]; -f "abc" + 1 + "def" + 2 + "ghi"["member"]; -f "abc"["member"].someOtherTag "abc" + 1 + "def" + 2 + "ghi"; -f "abc" + 1 + "def" + 2 + "ghi"["member"].someOtherTag "abc" + 1 + "def" + 2 + "ghi"; +(_a = ["abc"], _a.raw = ["abc"], f(_a)); +(_b = ["abc", "def", "ghi"], _b.raw = ["abc", "def", "ghi"], f(_b, 1, 2)); +(_c = ["abc"], _c.raw = ["abc"], f.g.h(_c)); +(_d = ["abc", "def", "ghi"], _d.raw = ["abc", "def", "ghi"], f.g.h(_d, 1, 2)); +(_e = ["abc"], _e.raw = ["abc"], f(_e)).member; +(_f = ["abc", "def", "ghi"], _f.raw = ["abc", "def", "ghi"], f(_f, 1, 2)).member; +(_g = ["abc"], _g.raw = ["abc"], f(_g))["member"]; +(_h = ["abc", "def", "ghi"], _h.raw = ["abc", "def", "ghi"], f(_h, 1, 2))["member"]; +(_j = ["abc", "def", "ghi"], _j.raw = ["abc", "def", "ghi"], (_k = ["abc"], _k.raw = ["abc"], f(_k))["member"].someOtherTag(_j, 1, 2)); +(_l = ["abc", "def", "ghi"], _l.raw = ["abc", "def", "ghi"], (_m = ["abc", "def", "ghi"], _m.raw = ["abc", "def", "ghi"], f(_m, 1, 2))["member"].someOtherTag(_l, 1, 2)); f.thisIsNotATag("abc"); f.thisIsNotATag("abc" + 1 + "def" + 2 + "ghi"); +var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m; diff --git a/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.types b/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.types new file mode 100644 index 00000000000..a9b7c9dfdca --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.types @@ -0,0 +1,66 @@ +=== tests/cases/conformance/es6/templates/taggedTemplateStringsWithTagsTypedAsAny.ts === +var f: any; +>f : any + +f `abc` +>f : any + +f `abc${1}def${2}ghi`; +>f : any + +f.g.h `abc` +>f.g.h : any +>f.g : any +>f : any +>g : any +>h : any + +f.g.h `abc${1}def${2}ghi`; +>f.g.h : any +>f.g : any +>f : any +>g : any +>h : any + +f `abc`.member +>f `abc`.member : any +>f : any +>member : any + +f `abc${1}def${2}ghi`.member; +>f `abc${1}def${2}ghi`.member : any +>f : any +>member : any + +f `abc`["member"]; +>f `abc`["member"] : any +>f : any + +f `abc${1}def${2}ghi`["member"]; +>f `abc${1}def${2}ghi`["member"] : any +>f : any + +f `abc`["member"].someOtherTag `abc${1}def${2}ghi`; +>f `abc`["member"].someOtherTag : any +>f `abc`["member"] : any +>f : any +>someOtherTag : any + +f `abc${1}def${2}ghi`["member"].someOtherTag `abc${1}def${2}ghi`; +>f `abc${1}def${2}ghi`["member"].someOtherTag : any +>f `abc${1}def${2}ghi`["member"] : any +>f : any +>someOtherTag : any + +f.thisIsNotATag(`abc`); +>f.thisIsNotATag(`abc`) : any +>f.thisIsNotATag : any +>f : any +>thisIsNotATag : any + +f.thisIsNotATag(`abc${1}def${2}ghi`); +>f.thisIsNotATag(`abc${1}def${2}ghi`) : any +>f.thisIsNotATag : any +>f : any +>thisIsNotATag : any + diff --git a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.errors.txt index b38a70ca18b..88bfac23211 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.errors.txt @@ -1,15 +1,12 @@ -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.ts(6,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.ts(6,31): error TS2322: Type 'string' is not assignable to type 'number'. -==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.ts (2 errors) ==== +==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.ts (1 errors) ==== function foo(...rest: any[]) { } foo `${function (x: number) { x = "bad"; } }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~ !!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js index 1f5d65390a7..f7523eb9870 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js +++ b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js @@ -8,5 +8,10 @@ foo `${function (x: number) { x = "bad"; } }`; //// [taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js] function foo() { + var rest = []; + for (var _i = 0; _i < arguments.length; _i++) { + rest[_i - 0] = arguments[_i]; + } } -foo "" + function (x) { x = "bad"; }; +(_a = ["", ""], _a.raw = ["", ""], foo(_a, function (x) { x = "bad"; })); +var _a; diff --git a/tests/baselines/reference/taggedTemplateStringsWithTypedTags.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithTypedTags.errors.txt deleted file mode 100644 index 28050ec96c1..00000000000 --- a/tests/baselines/reference/taggedTemplateStringsWithTypedTags.errors.txt +++ /dev/null @@ -1,64 +0,0 @@ -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(12,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(14,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(16,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(18,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(20,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(22,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(24,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(24,19): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(26,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts(26,40): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts (10 errors) ==== - interface I { - (stringParts: string[], ...rest: number[]): I; - g: I; - h: I; - member: I; - thisIsNotATag(x: string): void - [x: number]: I; - } - - var f: I; - - f `abc` - ~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f `abc${1}def${2}ghi`; - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f `abc`.member - ~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f `abc${1}def${2}ghi`.member; - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f `abc`["member"]; - ~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f `abc${1}def${2}ghi`["member"]; - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f `abc`[0].member `abc${1}def${2}ghi`; - ~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f `abc${1}def${2}ghi`["member"].member `abc${1}def${2}ghi`; - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - ~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - f.thisIsNotATag(`abc`); - - f.thisIsNotATag(`abc${1}def${2}ghi`); - \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateStringsWithTypedTags.js b/tests/baselines/reference/taggedTemplateStringsWithTypedTags.js index c2424a07a47..fcc2cda86dc 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithTypedTags.js +++ b/tests/baselines/reference/taggedTemplateStringsWithTypedTags.js @@ -33,13 +33,14 @@ f.thisIsNotATag(`abc${1}def${2}ghi`); //// [taggedTemplateStringsWithTypedTags.js] var f; -f "abc"; -f "abc" + 1 + "def" + 2 + "ghi"; -f "abc".member; -f "abc" + 1 + "def" + 2 + "ghi".member; -f "abc"["member"]; -f "abc" + 1 + "def" + 2 + "ghi"["member"]; -f "abc"[0].member "abc" + 1 + "def" + 2 + "ghi"; -f "abc" + 1 + "def" + 2 + "ghi"["member"].member "abc" + 1 + "def" + 2 + "ghi"; +(_a = ["abc"], _a.raw = ["abc"], f(_a)); +(_b = ["abc", "def", "ghi"], _b.raw = ["abc", "def", "ghi"], f(_b, 1, 2)); +(_c = ["abc"], _c.raw = ["abc"], f(_c)).member; +(_d = ["abc", "def", "ghi"], _d.raw = ["abc", "def", "ghi"], f(_d, 1, 2)).member; +(_e = ["abc"], _e.raw = ["abc"], f(_e))["member"]; +(_f = ["abc", "def", "ghi"], _f.raw = ["abc", "def", "ghi"], f(_f, 1, 2))["member"]; +(_g = ["abc", "def", "ghi"], _g.raw = ["abc", "def", "ghi"], (_h = ["abc"], _h.raw = ["abc"], f(_h))[0].member(_g, 1, 2)); +(_j = ["abc", "def", "ghi"], _j.raw = ["abc", "def", "ghi"], (_k = ["abc", "def", "ghi"], _k.raw = ["abc", "def", "ghi"], f(_k, 1, 2))["member"].member(_j, 1, 2)); f.thisIsNotATag("abc"); f.thisIsNotATag("abc" + 1 + "def" + 2 + "ghi"); +var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; diff --git a/tests/baselines/reference/taggedTemplateStringsWithTypedTags.types b/tests/baselines/reference/taggedTemplateStringsWithTypedTags.types new file mode 100644 index 00000000000..5c8ba71188b --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsWithTypedTags.types @@ -0,0 +1,82 @@ +=== tests/cases/conformance/es6/templates/taggedTemplateStringsWithTypedTags.ts === +interface I { +>I : I + + (stringParts: string[], ...rest: number[]): I; +>stringParts : string[] +>rest : number[] +>I : I + + g: I; +>g : I +>I : I + + h: I; +>h : I +>I : I + + member: I; +>member : I +>I : I + + thisIsNotATag(x: string): void +>thisIsNotATag : (x: string) => void +>x : string + + [x: number]: I; +>x : number +>I : I +} + +var f: I; +>f : I +>I : I + +f `abc` +>f : I + +f `abc${1}def${2}ghi`; +>f : I + +f `abc`.member +>f `abc`.member : I +>f : I +>member : I + +f `abc${1}def${2}ghi`.member; +>f `abc${1}def${2}ghi`.member : I +>f : I +>member : I + +f `abc`["member"]; +>f `abc`["member"] : I +>f : I + +f `abc${1}def${2}ghi`["member"]; +>f `abc${1}def${2}ghi`["member"] : I +>f : I + +f `abc`[0].member `abc${1}def${2}ghi`; +>f `abc`[0].member : I +>f `abc`[0] : I +>f : I +>member : I + +f `abc${1}def${2}ghi`["member"].member `abc${1}def${2}ghi`; +>f `abc${1}def${2}ghi`["member"].member : I +>f `abc${1}def${2}ghi`["member"] : I +>f : I +>member : I + +f.thisIsNotATag(`abc`); +>f.thisIsNotATag(`abc`) : void +>f.thisIsNotATag : (x: string) => void +>f : I +>thisIsNotATag : (x: string) => void + +f.thisIsNotATag(`abc${1}def${2}ghi`); +>f.thisIsNotATag(`abc${1}def${2}ghi`) : void +>f.thisIsNotATag : (x: string) => void +>f : I +>thisIsNotATag : (x: string) => void + diff --git a/tests/baselines/reference/taggedTemplateStringsWithUnicodeEscapes.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithUnicodeEscapes.errors.txt new file mode 100644 index 00000000000..df3def2cb22 --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsWithUnicodeEscapes.errors.txt @@ -0,0 +1,10 @@ +tests/cases/compiler/taggedTemplateStringsWithUnicodeEscapes.ts(4,7): error TS1125: Hexadecimal digit expected. + + +==== tests/cases/compiler/taggedTemplateStringsWithUnicodeEscapes.ts (1 errors) ==== + function f(...args: any[]) { + } + + f `'\u{1f4a9}'${ " should be converted to " }'\uD83D\uDCA9'`; + +!!! error TS1125: Hexadecimal digit expected. \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateStringsWithUnicodeEscapes.js b/tests/baselines/reference/taggedTemplateStringsWithUnicodeEscapes.js new file mode 100644 index 00000000000..bcf0732218a --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsWithUnicodeEscapes.js @@ -0,0 +1,15 @@ +//// [taggedTemplateStringsWithUnicodeEscapes.ts] +function f(...args: any[]) { +} + +f `'\u{1f4a9}'${ " should be converted to " }'\uD83D\uDCA9'`; + +//// [taggedTemplateStringsWithUnicodeEscapes.js] +function f() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i - 0] = arguments[_i]; + } +} +(_a = ["'{1f4a9}'", "'💩'"], _a.raw = ["'\\u{1f4a9}'", "'\\uD83D\\uDCA9'"], f(_a, " should be converted to ")); +var _a; diff --git a/tests/baselines/reference/taggedTemplateStringsWithUnicodeEscapesES6.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithUnicodeEscapesES6.errors.txt new file mode 100644 index 00000000000..c48b43dc3ff --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsWithUnicodeEscapesES6.errors.txt @@ -0,0 +1,10 @@ +tests/cases/compiler/taggedTemplateStringsWithUnicodeEscapesES6.ts(4,7): error TS1125: Hexadecimal digit expected. + + +==== tests/cases/compiler/taggedTemplateStringsWithUnicodeEscapesES6.ts (1 errors) ==== + function f(...args: any[]) { + } + + f `'\u{1f4a9}'${ " should be converted to " }'\uD83D\uDCA9'`; + +!!! error TS1125: Hexadecimal digit expected. \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateStringsWithUnicodeEscapesES6.js b/tests/baselines/reference/taggedTemplateStringsWithUnicodeEscapesES6.js new file mode 100644 index 00000000000..6ca5fa5b03a --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsWithUnicodeEscapesES6.js @@ -0,0 +1,10 @@ +//// [taggedTemplateStringsWithUnicodeEscapesES6.ts] +function f(...args: any[]) { +} + +f `'\u{1f4a9}'${ " should be converted to " }'\uD83D\uDCA9'`; + +//// [taggedTemplateStringsWithUnicodeEscapesES6.js] +function f(...args) { +} +f `'\u{1f4a9}'${" should be converted to "}'\uD83D\uDCA9'`; diff --git a/tests/baselines/reference/taggedTemplateStringsWithWhitespaceEscapes.js b/tests/baselines/reference/taggedTemplateStringsWithWhitespaceEscapes.js new file mode 100644 index 00000000000..65af8da59f9 --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsWithWhitespaceEscapes.js @@ -0,0 +1,15 @@ +//// [taggedTemplateStringsWithWhitespaceEscapes.ts] +function f(...args: any[]) { +} + +f `\t\n\v\f\r\\`; + +//// [taggedTemplateStringsWithWhitespaceEscapes.js] +function f() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i - 0] = arguments[_i]; + } +} +(_a = ["\t\n\v\f\r\\"], _a.raw = ["\\t\\n\\v\\f\\r\\\\"], f(_a)); +var _a; diff --git a/tests/baselines/reference/taggedTemplateStringsWithWhitespaceEscapes.types b/tests/baselines/reference/taggedTemplateStringsWithWhitespaceEscapes.types new file mode 100644 index 00000000000..89027983cba --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsWithWhitespaceEscapes.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/taggedTemplateStringsWithWhitespaceEscapes.ts === +function f(...args: any[]) { +>f : (...args: any[]) => void +>args : any[] +} + +f `\t\n\v\f\r\\`; +>f : (...args: any[]) => void + diff --git a/tests/baselines/reference/taggedTemplateStringsWithWhitespaceEscapesES6.js b/tests/baselines/reference/taggedTemplateStringsWithWhitespaceEscapesES6.js new file mode 100644 index 00000000000..09a4aa765b4 --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsWithWhitespaceEscapesES6.js @@ -0,0 +1,10 @@ +//// [taggedTemplateStringsWithWhitespaceEscapesES6.ts] +function f(...args: any[]) { +} + +f `\t\n\v\f\r\\`; + +//// [taggedTemplateStringsWithWhitespaceEscapesES6.js] +function f(...args) { +} +f `\t\n\v\f\r\\`; diff --git a/tests/baselines/reference/taggedTemplateStringsWithWhitespaceEscapesES6.types b/tests/baselines/reference/taggedTemplateStringsWithWhitespaceEscapesES6.types new file mode 100644 index 00000000000..5aeef9207eb --- /dev/null +++ b/tests/baselines/reference/taggedTemplateStringsWithWhitespaceEscapesES6.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/taggedTemplateStringsWithWhitespaceEscapesES6.ts === +function f(...args: any[]) { +>f : (...args: any[]) => void +>args : any[] +} + +f `\t\n\v\f\r\\`; +>f : (...args: any[]) => void + diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes01.js b/tests/baselines/reference/templateStringControlCharacterEscapes01.js new file mode 100644 index 00000000000..1b129e802e3 --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes01.js @@ -0,0 +1,7 @@ +//// [templateStringControlCharacterEscapes01.ts] + + +var x = `\0\x00\u0000 0 00 0000`; + +//// [templateStringControlCharacterEscapes01.js] +var x = "\0\0\0 0 00 0000"; diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes01.types b/tests/baselines/reference/templateStringControlCharacterEscapes01.types new file mode 100644 index 00000000000..9a7a04c99a4 --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes01.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes01.ts === + + +var x = `\0\x00\u0000 0 00 0000`; +>x : string + diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes01_ES6.js b/tests/baselines/reference/templateStringControlCharacterEscapes01_ES6.js new file mode 100644 index 00000000000..9015655576c --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes01_ES6.js @@ -0,0 +1,6 @@ +//// [templateStringControlCharacterEscapes01_ES6.ts] + +var x = `\0\x00\u0000 0 00 0000`; + +//// [templateStringControlCharacterEscapes01_ES6.js] +var x = `\0\x00\u0000 0 00 0000`; diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes01_ES6.types b/tests/baselines/reference/templateStringControlCharacterEscapes01_ES6.types new file mode 100644 index 00000000000..5decfbc2924 --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes01_ES6.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes01_ES6.ts === + +var x = `\0\x00\u0000 0 00 0000`; +>x : string + diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes02.js b/tests/baselines/reference/templateStringControlCharacterEscapes02.js new file mode 100644 index 00000000000..5b5d34dae02 --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes02.js @@ -0,0 +1,7 @@ +//// [templateStringControlCharacterEscapes02.ts] + + +var x = `\x19\u0019 19`; + +//// [templateStringControlCharacterEscapes02.js] +var x = "\u0019\u0019 19"; diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes02.types b/tests/baselines/reference/templateStringControlCharacterEscapes02.types new file mode 100644 index 00000000000..f47a3f69a77 --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes02.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes02.ts === + + +var x = `\x19\u0019 19`; +>x : string + diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes02_ES6.js b/tests/baselines/reference/templateStringControlCharacterEscapes02_ES6.js new file mode 100644 index 00000000000..2d76674b4dd --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes02_ES6.js @@ -0,0 +1,6 @@ +//// [templateStringControlCharacterEscapes02_ES6.ts] + +var x = `\x19\u0019 19`; + +//// [templateStringControlCharacterEscapes02_ES6.js] +var x = `\x19\u0019 19`; diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes02_ES6.types b/tests/baselines/reference/templateStringControlCharacterEscapes02_ES6.types new file mode 100644 index 00000000000..e7e123e0ab3 --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes02_ES6.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes02_ES6.ts === + +var x = `\x19\u0019 19`; +>x : string + diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes03.js b/tests/baselines/reference/templateStringControlCharacterEscapes03.js new file mode 100644 index 00000000000..ae9774d952a --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes03.js @@ -0,0 +1,7 @@ +//// [templateStringControlCharacterEscapes03.ts] + + +var x = `\x1F\u001f 1F 1f`; + +//// [templateStringControlCharacterEscapes03.js] +var x = "\u001f\u001f 1F 1f"; diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes03.types b/tests/baselines/reference/templateStringControlCharacterEscapes03.types new file mode 100644 index 00000000000..23410460560 --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes03.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes03.ts === + + +var x = `\x1F\u001f 1F 1f`; +>x : string + diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes03_ES6.js b/tests/baselines/reference/templateStringControlCharacterEscapes03_ES6.js new file mode 100644 index 00000000000..b9b3df266d9 --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes03_ES6.js @@ -0,0 +1,6 @@ +//// [templateStringControlCharacterEscapes03_ES6.ts] + +var x = `\x1F\u001f 1F 1f`; + +//// [templateStringControlCharacterEscapes03_ES6.js] +var x = `\x1F\u001f 1F 1f`; diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes03_ES6.types b/tests/baselines/reference/templateStringControlCharacterEscapes03_ES6.types new file mode 100644 index 00000000000..03642563b8a --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes03_ES6.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes03_ES6.ts === + +var x = `\x1F\u001f 1F 1f`; +>x : string + diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes04.js b/tests/baselines/reference/templateStringControlCharacterEscapes04.js new file mode 100644 index 00000000000..70636a584b4 --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes04.js @@ -0,0 +1,7 @@ +//// [templateStringControlCharacterEscapes04.ts] + + +var x = `\x20\u0020 20`; + +//// [templateStringControlCharacterEscapes04.js] +var x = " 20"; diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes04.types b/tests/baselines/reference/templateStringControlCharacterEscapes04.types new file mode 100644 index 00000000000..00aca41a83a --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes04.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes04.ts === + + +var x = `\x20\u0020 20`; +>x : string + diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes04_ES6.js b/tests/baselines/reference/templateStringControlCharacterEscapes04_ES6.js new file mode 100644 index 00000000000..17461fb0841 --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes04_ES6.js @@ -0,0 +1,6 @@ +//// [templateStringControlCharacterEscapes04_ES6.ts] + +var x = `\x20\u0020 20`; + +//// [templateStringControlCharacterEscapes04_ES6.js] +var x = `\x20\u0020 20`; diff --git a/tests/baselines/reference/templateStringControlCharacterEscapes04_ES6.types b/tests/baselines/reference/templateStringControlCharacterEscapes04_ES6.types new file mode 100644 index 00000000000..0b993a8b2dc --- /dev/null +++ b/tests/baselines/reference/templateStringControlCharacterEscapes04_ES6.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes04_ES6.ts === + +var x = `\x20\u0020 20`; +>x : string + diff --git a/tests/baselines/reference/templateStringInEqualityChecks.js b/tests/baselines/reference/templateStringInEqualityChecks.js index ca9fc2ed80b..f7573f8efd5 100644 --- a/tests/baselines/reference/templateStringInEqualityChecks.js +++ b/tests/baselines/reference/templateStringInEqualityChecks.js @@ -7,5 +7,5 @@ var x = `abc${0}abc` === `abc` || //// [templateStringInEqualityChecks.js] var x = "abc" + 0 + "abc" === "abc" || "abc" !== "abc" + 0 + "abc" && - "abc" + 0 + "abc" == "abc0abc" && - "abc0abc" !== "abc" + 0 + "abc"; + "abc" + 0 + "abc" == "abc0abc" && + "abc0abc" !== "abc" + 0 + "abc"; diff --git a/tests/baselines/reference/templateStringInEqualityChecksES6.js b/tests/baselines/reference/templateStringInEqualityChecksES6.js index db00827fac5..9bb001d9dc7 100644 --- a/tests/baselines/reference/templateStringInEqualityChecksES6.js +++ b/tests/baselines/reference/templateStringInEqualityChecksES6.js @@ -7,5 +7,5 @@ var x = `abc${0}abc` === `abc` || //// [templateStringInEqualityChecksES6.js] var x = `abc${0}abc` === `abc` || `abc` !== `abc${0}abc` && - `abc${0}abc` == "abc0abc" && - "abc0abc" !== `abc${0}abc`; + `abc${0}abc` == "abc0abc" && + "abc0abc" !== `abc${0}abc`; diff --git a/tests/baselines/reference/templateStringInModuleName.js b/tests/baselines/reference/templateStringInModuleName.js index 561f308a3d0..36f619176e4 100644 --- a/tests/baselines/reference/templateStringInModuleName.js +++ b/tests/baselines/reference/templateStringInModuleName.js @@ -7,10 +7,11 @@ declare module `M${2}` { //// [templateStringInModuleName.js] declare; -module "M1"; +(_a = ["M1"], _a.raw = ["M1"], module(_a)); { } declare; -module "M" + 2; +(_b = ["M", ""], _b.raw = ["M", ""], module(_b, 2)); { } +var _a, _b; diff --git a/tests/baselines/reference/templateStringInObjectLiteral.js b/tests/baselines/reference/templateStringInObjectLiteral.js index 6df5a64d78a..2e4de70f57c 100644 --- a/tests/baselines/reference/templateStringInObjectLiteral.js +++ b/tests/baselines/reference/templateStringInObjectLiteral.js @@ -5,6 +5,7 @@ var x = { } //// [templateStringInObjectLiteral.js] -var x = { - a: "abc" + 123 + "def" } "b"; +var x = (_a = ["b"], _a.raw = ["b"], ({ + a: "abc" + 123 + "def" })(_a)); 321; +var _a; diff --git a/tests/baselines/reference/templateStringInPropertyName1.js b/tests/baselines/reference/templateStringInPropertyName1.js index 5a396398f67..18e35c475e3 100644 --- a/tests/baselines/reference/templateStringInPropertyName1.js +++ b/tests/baselines/reference/templateStringInPropertyName1.js @@ -4,5 +4,6 @@ var x = { } //// [templateStringInPropertyName1.js] -var x = {} "a"; +var x = (_a = ["a"], _a.raw = ["a"], ({})(_a)); 321; +var _a; diff --git a/tests/baselines/reference/templateStringInPropertyName2.js b/tests/baselines/reference/templateStringInPropertyName2.js index 623f6a69a41..1a2995ca08f 100644 --- a/tests/baselines/reference/templateStringInPropertyName2.js +++ b/tests/baselines/reference/templateStringInPropertyName2.js @@ -4,5 +4,6 @@ var x = { } //// [templateStringInPropertyName2.js] -var x = {} "abc" + 123 + "def" + 456 + "ghi"; +var x = (_a = ["abc", "def", "ghi"], _a.raw = ["abc", "def", "ghi"], ({})(_a, 123, 456)); 321; +var _a; diff --git a/tests/baselines/reference/templateStringInTaggedTemplate.errors.txt b/tests/baselines/reference/templateStringInTaggedTemplate.errors.txt index 9106cdb6151..18ce24a0b3b 100644 --- a/tests/baselines/reference/templateStringInTaggedTemplate.errors.txt +++ b/tests/baselines/reference/templateStringInTaggedTemplate.errors.txt @@ -1,10 +1,7 @@ tests/cases/conformance/es6/templates/templateStringInTaggedTemplate.ts(1,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. -tests/cases/conformance/es6/templates/templateStringInTaggedTemplate.ts(1,42): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -==== tests/cases/conformance/es6/templates/templateStringInTaggedTemplate.ts (2 errors) ==== +==== tests/cases/conformance/es6/templates/templateStringInTaggedTemplate.ts (1 errors) ==== `I AM THE ${ `${ `TAG` } ` } PORTION` `I ${ "AM" } THE TEMPLATE PORTION` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. - ~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. \ No newline at end of file +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringInTaggedTemplate.js b/tests/baselines/reference/templateStringInTaggedTemplate.js index c6d98b0f826..3ba70ba84b6 100644 --- a/tests/baselines/reference/templateStringInTaggedTemplate.js +++ b/tests/baselines/reference/templateStringInTaggedTemplate.js @@ -2,4 +2,5 @@ `I AM THE ${ `${ `TAG` } ` } PORTION` `I ${ "AM" } THE TEMPLATE PORTION` //// [templateStringInTaggedTemplate.js] -"I AM THE " + "TAG" + " " + " PORTION" "I " + "AM" + " THE TEMPLATE PORTION"; +(_a = ["I ", " THE TEMPLATE PORTION"], _a.raw = ["I ", " THE TEMPLATE PORTION"], ("I AM THE " + "TAG" + " " + " PORTION")(_a, "AM")); +var _a; diff --git a/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01.js b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01.js new file mode 100644 index 00000000000..62629f3284f --- /dev/null +++ b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01.js @@ -0,0 +1,6 @@ +//// [templateStringPlainCharactersThatArePartsOfEscapes01.ts] + +`0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` + +//// [templateStringPlainCharactersThatArePartsOfEscapes01.js] +"0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n"; diff --git a/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01.types b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01.types new file mode 100644 index 00000000000..2b77345f8ff --- /dev/null +++ b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes01.ts === + +No type information for this code.`0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01_ES6.js b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01_ES6.js new file mode 100644 index 00000000000..4b599ee1d55 --- /dev/null +++ b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01_ES6.js @@ -0,0 +1,6 @@ +//// [templateStringPlainCharactersThatArePartsOfEscapes01_ES6.ts] + +`0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` + +//// [templateStringPlainCharactersThatArePartsOfEscapes01_ES6.js] +`0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n`; diff --git a/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01_ES6.types b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01_ES6.types new file mode 100644 index 00000000000..33c8839e194 --- /dev/null +++ b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes01_ES6.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes01_ES6.ts === + +No type information for this code.`0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02.js b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02.js new file mode 100644 index 00000000000..27090032ab9 --- /dev/null +++ b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02.js @@ -0,0 +1,7 @@ +//// [templateStringPlainCharactersThatArePartsOfEscapes02.ts] + + +`0${ " " }1${ " " }2${ " " }3${ " " }4${ " " }5${ " " }6${ " " }7${ " " }8${ " " }9${ " " }10${ " " }11${ " " }12${ " " }13${ " " }14${ " " }15${ " " }16${ " " }17${ " " }18${ " " }19${ " " }20${ " " }2028${ " " }2029${ " " }0085${ " " }t${ " " }v${ " " }f${ " " }b${ " " }r${ " " }n` + +//// [templateStringPlainCharactersThatArePartsOfEscapes02.js] +"0" + " " + "1" + " " + "2" + " " + "3" + " " + "4" + " " + "5" + " " + "6" + " " + "7" + " " + "8" + " " + "9" + " " + "10" + " " + "11" + " " + "12" + " " + "13" + " " + "14" + " " + "15" + " " + "16" + " " + "17" + " " + "18" + " " + "19" + " " + "20" + " " + "2028" + " " + "2029" + " " + "0085" + " " + "t" + " " + "v" + " " + "f" + " " + "b" + " " + "r" + " " + "n"; diff --git a/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02.types b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02.types new file mode 100644 index 00000000000..f630d9e71e6 --- /dev/null +++ b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes02.ts === + +No type information for this code. +No type information for this code.`0${ " " }1${ " " }2${ " " }3${ " " }4${ " " }5${ " " }6${ " " }7${ " " }8${ " " }9${ " " }10${ " " }11${ " " }12${ " " }13${ " " }14${ " " }15${ " " }16${ " " }17${ " " }18${ " " }19${ " " }20${ " " }2028${ " " }2029${ " " }0085${ " " }t${ " " }v${ " " }f${ " " }b${ " " }r${ " " }n` +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02_ES6.js b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02_ES6.js new file mode 100644 index 00000000000..0924c35b6ce --- /dev/null +++ b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02_ES6.js @@ -0,0 +1,6 @@ +//// [templateStringPlainCharactersThatArePartsOfEscapes02_ES6.ts] + +`0${ " " }1${ " " }2${ " " }3${ " " }4${ " " }5${ " " }6${ " " }7${ " " }8${ " " }9${ " " }10${ " " }11${ " " }12${ " " }13${ " " }14${ " " }15${ " " }16${ " " }17${ " " }18${ " " }19${ " " }20${ " " }2028${ " " }2029${ " " }0085${ " " }t${ " " }v${ " " }f${ " " }b${ " " }r${ " " }n` + +//// [templateStringPlainCharactersThatArePartsOfEscapes02_ES6.js] +`0${" "}1${" "}2${" "}3${" "}4${" "}5${" "}6${" "}7${" "}8${" "}9${" "}10${" "}11${" "}12${" "}13${" "}14${" "}15${" "}16${" "}17${" "}18${" "}19${" "}20${" "}2028${" "}2029${" "}0085${" "}t${" "}v${" "}f${" "}b${" "}r${" "}n`; diff --git a/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02_ES6.types b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02_ES6.types new file mode 100644 index 00000000000..934e0fc495c --- /dev/null +++ b/tests/baselines/reference/templateStringPlainCharactersThatArePartsOfEscapes02_ES6.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes02_ES6.ts === + +No type information for this code.`0${ " " }1${ " " }2${ " " }3${ " " }4${ " " }5${ " " }6${ " " }7${ " " }8${ " " }9${ " " }10${ " " }11${ " " }12${ " " }13${ " " }14${ " " }15${ " " }16${ " " }17${ " " }18${ " " }19${ " " }20${ " " }2028${ " " }2029${ " " }0085${ " " }t${ " " }v${ " " }f${ " " }b${ " " }r${ " " }n` +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/templateStringsArrayTypeDefinedInES5Mode.errors.txt b/tests/baselines/reference/templateStringsArrayTypeDefinedInES5Mode.errors.txt index 61b82bcb459..7ac2eff8652 100644 --- a/tests/baselines/reference/templateStringsArrayTypeDefinedInES5Mode.errors.txt +++ b/tests/baselines/reference/templateStringsArrayTypeDefinedInES5Mode.errors.txt @@ -2,10 +2,9 @@ lib.d.ts(515,11): error TS2300: Duplicate identifier 'TemplateStringsArray'. tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(2,7): error TS2300: Duplicate identifier 'TemplateStringsArray'. tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(8,3): error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'TemplateStringsArray'. Property 'raw' is missing in type '{ [x: number]: undefined; }'. -tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(10,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -==== tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts (3 errors) ==== +==== tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts (2 errors) ==== class TemplateStringsArray { ~~~~~~~~~~~~~~~~~~~~ @@ -20,6 +19,4 @@ tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(10,3): error TS !!! error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'TemplateStringsArray'. !!! error TS2345: Property 'raw' is missing in type '{ [x: number]: undefined; }'. - f `abcdef${ 1234 }${ 5678 }ghijkl`; - ~~~~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. \ No newline at end of file + f `abcdef${ 1234 }${ 5678 }ghijkl`; \ No newline at end of file diff --git a/tests/baselines/reference/templateStringsArrayTypeDefinedInES5Mode.js b/tests/baselines/reference/templateStringsArrayTypeDefinedInES5Mode.js index a724943c0f3..5d5f925fe69 100644 --- a/tests/baselines/reference/templateStringsArrayTypeDefinedInES5Mode.js +++ b/tests/baselines/reference/templateStringsArrayTypeDefinedInES5Mode.js @@ -19,4 +19,5 @@ var TemplateStringsArray = (function () { function f(x, y, z) { } f({}, 10, 10); -f "abcdef" + 1234 + 5678 + "ghijkl"; +(_a = ["abcdef", "", "ghijkl"], _a.raw = ["abcdef", "", "ghijkl"], f(_a, 1234, 5678)); +var _a; diff --git a/tests/baselines/reference/templateStringsArrayTypeNotDefinedES5Mode.errors.txt b/tests/baselines/reference/templateStringsArrayTypeNotDefinedES5Mode.errors.txt index b233ad963c7..e8bf38c1048 100644 --- a/tests/baselines/reference/templateStringsArrayTypeNotDefinedES5Mode.errors.txt +++ b/tests/baselines/reference/templateStringsArrayTypeNotDefinedES5Mode.errors.txt @@ -1,9 +1,8 @@ tests/cases/compiler/templateStringsArrayTypeNotDefinedES5Mode.ts(5,3): error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'TemplateStringsArray'. Property 'raw' is missing in type '{ [x: number]: undefined; }'. -tests/cases/compiler/templateStringsArrayTypeNotDefinedES5Mode.ts(7,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -==== tests/cases/compiler/templateStringsArrayTypeNotDefinedES5Mode.ts (2 errors) ==== +==== tests/cases/compiler/templateStringsArrayTypeNotDefinedES5Mode.ts (1 errors) ==== function f(x: TemplateStringsArray, y: number, z: number) { } @@ -13,6 +12,4 @@ tests/cases/compiler/templateStringsArrayTypeNotDefinedES5Mode.ts(7,3): error TS !!! error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'TemplateStringsArray'. !!! error TS2345: Property 'raw' is missing in type '{ [x: number]: undefined; }'. - f `abcdef${ 1234 }${ 5678 }ghijkl`; - ~~~~~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. \ No newline at end of file + f `abcdef${ 1234 }${ 5678 }ghijkl`; \ No newline at end of file diff --git a/tests/baselines/reference/templateStringsArrayTypeNotDefinedES5Mode.js b/tests/baselines/reference/templateStringsArrayTypeNotDefinedES5Mode.js index c6cc4ee8408..69d61d79554 100644 --- a/tests/baselines/reference/templateStringsArrayTypeNotDefinedES5Mode.js +++ b/tests/baselines/reference/templateStringsArrayTypeNotDefinedES5Mode.js @@ -11,4 +11,5 @@ f `abcdef${ 1234 }${ 5678 }ghijkl`; function f(x, y, z) { } f({}, 10, 10); -f "abcdef" + 1234 + 5678 + "ghijkl"; +(_a = ["abcdef", "", "ghijkl"], _a.raw = ["abcdef", "", "ghijkl"], f(_a, 1234, 5678)); +var _a; diff --git a/tests/baselines/reference/thisInPropertyBoundDeclarations.js b/tests/baselines/reference/thisInPropertyBoundDeclarations.js index 3f1bac98075..e5004eed431 100644 --- a/tests/baselines/reference/thisInPropertyBoundDeclarations.js +++ b/tests/baselines/reference/thisInPropertyBoundDeclarations.js @@ -117,10 +117,10 @@ var B = (function () { this.prop2 = function () { return _this; }; this.prop3 = function () { return function () { return function () { return function () { return _this; }; }; }; }; this.prop4 = ' ' + - function () { - } + - ' ' + - (function () { return function () { return function () { return _this; }; }; }); + function () { + } + + ' ' + + (function () { return function () { return function () { return _this; }; }; }); this.prop5 = { a: function () { return _this; } }; diff --git a/tests/baselines/reference/typeGuardsInConditionalExpression.js b/tests/baselines/reference/typeGuardsInConditionalExpression.js index e493df66ce6..7c87d80d592 100644 --- a/tests/baselines/reference/typeGuardsInConditionalExpression.js +++ b/tests/baselines/reference/typeGuardsInConditionalExpression.js @@ -143,8 +143,8 @@ function foo7(x) { function foo8(x) { var b; return typeof x === "string" ? x === "hello" : ((b = x) && - (typeof x === "boolean" ? x // boolean - : x == 10)); // number + (typeof x === "boolean" ? x // boolean + : x == 10)); // number } function foo9(x) { var y = 10; diff --git a/tests/baselines/reference/typeResolution.js.map b/tests/baselines/reference/typeResolution.js.map index a7bdf6606c9..6173573d306 100644 --- a/tests/baselines/reference/typeResolution.js.map +++ b/tests/baselines/reference/typeResolution.js.map @@ -1,2 +1,2 @@ //// [typeResolution.js.map] -{"version":3,"file":"typeResolution.js","sourceRoot":"","sources":["typeResolution.ts"],"names":["TopLevelModule1","TopLevelModule1.SubModule1","TopLevelModule1.SubModule1.SubSubModule1","TopLevelModule1.SubModule1.SubSubModule1.ClassA","TopLevelModule1.SubModule1.SubSubModule1.ClassA.constructor","TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1","TopLevelModule1.SubModule1.SubSubModule1.ClassB","TopLevelModule1.SubModule1.SubSubModule1.ClassB.constructor","TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1","TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ","TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor","TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor.QQ","TopLevelModule1.SubModule1.ClassA","TopLevelModule1.SubModule1.ClassA.constructor","TopLevelModule1.SubModule1.ClassA.constructor.AA","TopLevelModule1.SubModule2","TopLevelModule1.SubModule2.SubSubModule2","TopLevelModule1.SubModule2.SubSubModule2.ClassA","TopLevelModule1.SubModule2.SubSubModule2.ClassA.constructor","TopLevelModule1.SubModule2.SubSubModule2.ClassB","TopLevelModule1.SubModule2.SubSubModule2.ClassB.constructor","TopLevelModule1.SubModule2.SubSubModule2.ClassC","TopLevelModule1.SubModule2.SubSubModule2.ClassC.constructor","TopLevelModule1.ClassA","TopLevelModule1.ClassA.constructor","TopLevelModule1.NotExportedModule","TopLevelModule1.NotExportedModule.ClassA","TopLevelModule1.NotExportedModule.ClassA.constructor","TopLevelModule2","TopLevelModule2.SubModule3","TopLevelModule2.SubModule3.ClassA","TopLevelModule2.SubModule3.ClassA.constructor"],"mappings":"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"} \ No newline at end of file +{"version":3,"file":"typeResolution.js","sourceRoot":"","sources":["typeResolution.ts"],"names":["TopLevelModule1","TopLevelModule1.SubModule1","TopLevelModule1.SubModule1.SubSubModule1","TopLevelModule1.SubModule1.SubSubModule1.ClassA","TopLevelModule1.SubModule1.SubSubModule1.ClassA.constructor","TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1","TopLevelModule1.SubModule1.SubSubModule1.ClassB","TopLevelModule1.SubModule1.SubSubModule1.ClassB.constructor","TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1","TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ","TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor","TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor.QQ","TopLevelModule1.SubModule1.ClassA","TopLevelModule1.SubModule1.ClassA.constructor","TopLevelModule1.SubModule1.ClassA.constructor.AA","TopLevelModule1.SubModule2","TopLevelModule1.SubModule2.SubSubModule2","TopLevelModule1.SubModule2.SubSubModule2.ClassA","TopLevelModule1.SubModule2.SubSubModule2.ClassA.constructor","TopLevelModule1.SubModule2.SubSubModule2.ClassA.AisIn1_2_2","TopLevelModule1.SubModule2.SubSubModule2.ClassB","TopLevelModule1.SubModule2.SubSubModule2.ClassB.constructor","TopLevelModule1.SubModule2.SubSubModule2.ClassB.BisIn1_2_2","TopLevelModule1.SubModule2.SubSubModule2.ClassC","TopLevelModule1.SubModule2.SubSubModule2.ClassC.constructor","TopLevelModule1.SubModule2.SubSubModule2.ClassC.CisIn1_2_2","TopLevelModule1.ClassA","TopLevelModule1.ClassA.constructor","TopLevelModule1.ClassA.AisIn1","TopLevelModule1.NotExportedModule","TopLevelModule1.NotExportedModule.ClassA","TopLevelModule1.NotExportedModule.ClassA.constructor","TopLevelModule2","TopLevelModule2.SubModule3","TopLevelModule2.SubModule3.ClassA","TopLevelModule2.SubModule3.ClassA.constructor","TopLevelModule2.SubModule3.ClassA.AisIn2_3"],"mappings":"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"} \ No newline at end of file diff --git a/tests/baselines/reference/typeResolution.sourcemap.txt b/tests/baselines/reference/typeResolution.sourcemap.txt index d233e267f9f..af7aa7cca93 100644 --- a/tests/baselines/reference/typeResolution.sourcemap.txt +++ b/tests/baselines/reference/typeResolution.sourcemap.txt @@ -2276,8 +2276,8 @@ sourceFile:typeResolution.ts 1->Emitted(114, 21) Source(79, 42) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassA) 2 >Emitted(114, 48) Source(79, 52) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassA) 3 >Emitted(114, 51) Source(79, 35) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassA) -4 >Emitted(114, 65) Source(79, 57) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassA) -5 >Emitted(114, 66) Source(79, 58) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassA) +4 >Emitted(114, 65) Source(79, 57) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassA.AisIn1_2_2) +5 >Emitted(114, 66) Source(79, 58) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassA.AisIn1_2_2) --- >>> return ClassA; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -2366,8 +2366,8 @@ sourceFile:typeResolution.ts 1->Emitted(121, 21) Source(80, 42) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassB) 2 >Emitted(121, 48) Source(80, 52) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassB) 3 >Emitted(121, 51) Source(80, 35) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassB) -4 >Emitted(121, 65) Source(80, 57) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassB) -5 >Emitted(121, 66) Source(80, 58) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassB) +4 >Emitted(121, 65) Source(80, 57) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassB.BisIn1_2_2) +5 >Emitted(121, 66) Source(80, 58) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassB.BisIn1_2_2) --- >>> return ClassB; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -2456,8 +2456,8 @@ sourceFile:typeResolution.ts 1->Emitted(128, 21) Source(81, 42) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassC) 2 >Emitted(128, 48) Source(81, 52) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassC) 3 >Emitted(128, 51) Source(81, 35) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassC) -4 >Emitted(128, 65) Source(81, 57) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassC) -5 >Emitted(128, 66) Source(81, 58) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassC) +4 >Emitted(128, 65) Source(81, 57) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassC.CisIn1_2_2) +5 >Emitted(128, 66) Source(81, 58) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassC.CisIn1_2_2) --- >>> return ClassC; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -2638,8 +2638,8 @@ sourceFile:typeResolution.ts 1->Emitted(137, 13) Source(90, 16) + SourceIndex(0) name (TopLevelModule1.ClassA) 2 >Emitted(137, 36) Source(90, 22) + SourceIndex(0) name (TopLevelModule1.ClassA) 3 >Emitted(137, 39) Source(90, 9) + SourceIndex(0) name (TopLevelModule1.ClassA) -4 >Emitted(137, 53) Source(90, 27) + SourceIndex(0) name (TopLevelModule1.ClassA) -5 >Emitted(137, 54) Source(90, 28) + SourceIndex(0) name (TopLevelModule1.ClassA) +4 >Emitted(137, 53) Source(90, 27) + SourceIndex(0) name (TopLevelModule1.ClassA.AisIn1) +5 >Emitted(137, 54) Source(90, 28) + SourceIndex(0) name (TopLevelModule1.ClassA.AisIn1) --- >>> return ClassA; 1 >^^^^^^^^^^^^ @@ -3065,8 +3065,8 @@ sourceFile:typeResolution.ts 1->Emitted(157, 17) Source(105, 20) + SourceIndex(0) name (TopLevelModule2.SubModule3.ClassA) 2 >Emitted(157, 42) Source(105, 28) + SourceIndex(0) name (TopLevelModule2.SubModule3.ClassA) 3 >Emitted(157, 45) Source(105, 13) + SourceIndex(0) name (TopLevelModule2.SubModule3.ClassA) -4 >Emitted(157, 59) Source(105, 33) + SourceIndex(0) name (TopLevelModule2.SubModule3.ClassA) -5 >Emitted(157, 60) Source(105, 34) + SourceIndex(0) name (TopLevelModule2.SubModule3.ClassA) +4 >Emitted(157, 59) Source(105, 33) + SourceIndex(0) name (TopLevelModule2.SubModule3.ClassA.AisIn2_3) +5 >Emitted(157, 60) Source(105, 34) + SourceIndex(0) name (TopLevelModule2.SubModule3.ClassA.AisIn2_3) --- >>> return ClassA; 1 >^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/undeclaredModuleError.js b/tests/baselines/reference/undeclaredModuleError.js index 4b93db57682..0764840cadf 100644 --- a/tests/baselines/reference/undeclaredModuleError.js +++ b/tests/baselines/reference/undeclaredModuleError.js @@ -18,7 +18,12 @@ function instrumentFile(covFileDir: string, covFileName: string, originalFilePat //// [undeclaredModuleError.js] define(["require", "exports", 'fs'], function (require, exports, fs) { function readdir(path, accept, callback) { } - function join() { } + function join() { + var paths = []; + for (var _i = 0; _i < arguments.length; _i++) { + paths[_i - 0] = arguments[_i]; + } + } function instrumentFile(covFileDir, covFileName, originalFilePath) { fs.readFile(originalFilePath, function () { readdir(covFileDir, function () { diff --git a/tests/baselines/reference/underscoreTest1.js b/tests/baselines/reference/underscoreTest1.js index bbecbac4059..a4fa2cbc65d 100644 --- a/tests/baselines/reference/underscoreTest1.js +++ b/tests/baselines/reference/underscoreTest1.js @@ -977,7 +977,12 @@ $('#underscore_button').bind('click', buttonView.onClick); var fibonacci = _.memoize(function (n) { return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2); }); -var log = _.bind(function (message) { }, Date); +var log = _.bind(function (message) { + var rest = []; + for (var _i = 1; _i < arguments.length; _i++) { + rest[_i - 1] = arguments[_i]; + } +}, Date); _.delay(log, 1000, 'logged later'); _.defer(function () { alert('deferred'); }); var updatePosition = function () { return alert('updating position...'); }; diff --git a/tests/baselines/reference/varArgParamTypeCheck.js b/tests/baselines/reference/varArgParamTypeCheck.js index 5d8a60a564a..c2a33416436 100644 --- a/tests/baselines/reference/varArgParamTypeCheck.js +++ b/tests/baselines/reference/varArgParamTypeCheck.js @@ -23,6 +23,10 @@ sequence( //// [varArgParamTypeCheck.js] function sequence() { + var sequences = []; + for (var _i = 0; _i < arguments.length; _i++) { + sequences[_i - 0] = arguments[_i]; + } } function callback(clb) { } diff --git a/tests/baselines/reference/varArgWithNoParamName.js b/tests/baselines/reference/varArgWithNoParamName.js index b61400ff739..05a9695770a 100644 --- a/tests/baselines/reference/varArgWithNoParamName.js +++ b/tests/baselines/reference/varArgWithNoParamName.js @@ -2,4 +2,9 @@ function t1(...) {} //// [varArgWithNoParamName.js] -function t1() { } +function t1() { + var = []; + for (var _i = 0; _i < arguments.length; _i++) { + [_i - 0] = arguments[_i]; + } +} diff --git a/tests/baselines/reference/vararg.js b/tests/baselines/reference/vararg.js index c0260cd8d86..038afb90cbc 100644 --- a/tests/baselines/reference/vararg.js +++ b/tests/baselines/reference/vararg.js @@ -57,6 +57,10 @@ var M; return result; }; C.prototype.fnope = function (x) { + var rest = []; + for (var _i = 1; _i < arguments.length; _i++) { + rest[_i - 1] = arguments[_i]; + } }; C.prototype.fonly = function () { var rest = []; diff --git a/tests/cases/compiler/catchClauseWithBindingPattern1.ts b/tests/cases/compiler/catchClauseWithBindingPattern1.ts new file mode 100644 index 00000000000..dbd0f81c576 --- /dev/null +++ b/tests/cases/compiler/catchClauseWithBindingPattern1.ts @@ -0,0 +1,4 @@ +try { +} +catch ({a}) { +} \ No newline at end of file diff --git a/tests/cases/compiler/catchClauseWithInitializer1.ts b/tests/cases/compiler/catchClauseWithInitializer1.ts new file mode 100644 index 00000000000..320a2813170 --- /dev/null +++ b/tests/cases/compiler/catchClauseWithInitializer1.ts @@ -0,0 +1,4 @@ +try { +} +catch (e = 1) { +} \ No newline at end of file diff --git a/tests/cases/compiler/fromAsIdentifier1.ts b/tests/cases/compiler/fromAsIdentifier1.ts new file mode 100644 index 00000000000..91497ab477e --- /dev/null +++ b/tests/cases/compiler/fromAsIdentifier1.ts @@ -0,0 +1 @@ +var from; \ No newline at end of file diff --git a/tests/cases/compiler/fromAsIdentifier2.ts b/tests/cases/compiler/fromAsIdentifier2.ts new file mode 100644 index 00000000000..037e2128ce9 --- /dev/null +++ b/tests/cases/compiler/fromAsIdentifier2.ts @@ -0,0 +1,2 @@ +"use strict"; +var from; \ No newline at end of file diff --git a/tests/cases/compiler/taggedTemplateStringsHexadecimalEscapes.ts b/tests/cases/compiler/taggedTemplateStringsHexadecimalEscapes.ts new file mode 100644 index 00000000000..09f9200f805 --- /dev/null +++ b/tests/cases/compiler/taggedTemplateStringsHexadecimalEscapes.ts @@ -0,0 +1,4 @@ +function f(...args: any[]) { +} + +f `\x0D${ "Interrupted CRLF" }\x0A`; \ No newline at end of file diff --git a/tests/cases/compiler/taggedTemplateStringsHexadecimalEscapesES6.ts b/tests/cases/compiler/taggedTemplateStringsHexadecimalEscapesES6.ts new file mode 100644 index 00000000000..38c8e09f6cc --- /dev/null +++ b/tests/cases/compiler/taggedTemplateStringsHexadecimalEscapesES6.ts @@ -0,0 +1,5 @@ +//@target: es6 +function f(...args: any[]) { +} + +f `\x0D${ "Interrupted CRLF" }\x0A`; \ No newline at end of file diff --git a/tests/cases/compiler/taggedTemplateStringsWithMultilineTemplate.ts b/tests/cases/compiler/taggedTemplateStringsWithMultilineTemplate.ts new file mode 100644 index 00000000000..80aeabb94d4 --- /dev/null +++ b/tests/cases/compiler/taggedTemplateStringsWithMultilineTemplate.ts @@ -0,0 +1,7 @@ +function f(...args: any[]): void { +} + +f ` +\ + +`; \ No newline at end of file diff --git a/tests/cases/compiler/taggedTemplateStringsWithMultilineTemplateES6.ts b/tests/cases/compiler/taggedTemplateStringsWithMultilineTemplateES6.ts new file mode 100644 index 00000000000..7478e3dd403 --- /dev/null +++ b/tests/cases/compiler/taggedTemplateStringsWithMultilineTemplateES6.ts @@ -0,0 +1,8 @@ +//@target: es6 +function f(...args: any[]): void { +} + +f ` +\ + +`; \ No newline at end of file diff --git a/tests/cases/compiler/taggedTemplateStringsWithUnicodeEscapes.ts b/tests/cases/compiler/taggedTemplateStringsWithUnicodeEscapes.ts new file mode 100644 index 00000000000..f0353713328 --- /dev/null +++ b/tests/cases/compiler/taggedTemplateStringsWithUnicodeEscapes.ts @@ -0,0 +1,4 @@ +function f(...args: any[]) { +} + +f `'\u{1f4a9}'${ " should be converted to " }'\uD83D\uDCA9'`; \ No newline at end of file diff --git a/tests/cases/compiler/taggedTemplateStringsWithUnicodeEscapesES6.ts b/tests/cases/compiler/taggedTemplateStringsWithUnicodeEscapesES6.ts new file mode 100644 index 00000000000..039f723780f --- /dev/null +++ b/tests/cases/compiler/taggedTemplateStringsWithUnicodeEscapesES6.ts @@ -0,0 +1,5 @@ +//@target: es6 +function f(...args: any[]) { +} + +f `'\u{1f4a9}'${ " should be converted to " }'\uD83D\uDCA9'`; \ No newline at end of file diff --git a/tests/cases/compiler/taggedTemplateStringsWithWhitespaceEscapes.ts b/tests/cases/compiler/taggedTemplateStringsWithWhitespaceEscapes.ts new file mode 100644 index 00000000000..f2c2ba315e4 --- /dev/null +++ b/tests/cases/compiler/taggedTemplateStringsWithWhitespaceEscapes.ts @@ -0,0 +1,4 @@ +function f(...args: any[]) { +} + +f `\t\n\v\f\r\\`; \ No newline at end of file diff --git a/tests/cases/compiler/taggedTemplateStringsWithWhitespaceEscapesES6.ts b/tests/cases/compiler/taggedTemplateStringsWithWhitespaceEscapesES6.ts new file mode 100644 index 00000000000..8519d85d79b --- /dev/null +++ b/tests/cases/compiler/taggedTemplateStringsWithWhitespaceEscapesES6.ts @@ -0,0 +1,5 @@ +//@target: es6 +function f(...args: any[]) { +} + +f `\t\n\v\f\r\\`; \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.ts b/tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.ts new file mode 100644 index 00000000000..70f0a82a25f --- /dev/null +++ b/tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.ts @@ -0,0 +1,7 @@ + + +function f(...x: any[]) { + +} + +f `0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6.ts b/tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6.ts new file mode 100644 index 00000000000..2bb885e5979 --- /dev/null +++ b/tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6.ts @@ -0,0 +1,7 @@ +// @target: es6 + +function f(...x: any[]) { + +} + +f `0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.ts b/tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.ts new file mode 100644 index 00000000000..33b9d27a233 --- /dev/null +++ b/tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.ts @@ -0,0 +1,3 @@ + + +`0${ " " }1${ " " }2${ " " }3${ " " }4${ " " }5${ " " }6${ " " }7${ " " }8${ " " }9${ " " }10${ " " }11${ " " }12${ " " }13${ " " }14${ " " }15${ " " }16${ " " }17${ " " }18${ " " }19${ " " }20${ " " }2028${ " " }2029${ " " }0085${ " " }t${ " " }v${ " " }f${ " " }b${ " " }r${ " " }n` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6.ts b/tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6.ts new file mode 100644 index 00000000000..71627997068 --- /dev/null +++ b/tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6.ts @@ -0,0 +1,7 @@ +// @target: es6 + +function f(...x: any[]) { + +} + +f `0${ " " }1${ " " }2${ " " }3${ " " }4${ " " }5${ " " }6${ " " }7${ " " }8${ " " }9${ " " }10${ " " }11${ " " }12${ " " }13${ " " }14${ " " }15${ " " }16${ " " }17${ " " }18${ " " }19${ " " }20${ " " }2028${ " " }2029${ " " }0085${ " " }t${ " " }v${ " " }f${ " " }b${ " " }r${ " " }n` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes01.ts b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes01.ts new file mode 100644 index 00000000000..dda77a70cad --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes01.ts @@ -0,0 +1,3 @@ + + +var x = `\0\x00\u0000 0 00 0000`; \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes01_ES6.ts b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes01_ES6.ts new file mode 100644 index 00000000000..9875706896f --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes01_ES6.ts @@ -0,0 +1,3 @@ +// @target: es6 + +var x = `\0\x00\u0000 0 00 0000`; \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes02.ts b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes02.ts new file mode 100644 index 00000000000..a583517e987 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes02.ts @@ -0,0 +1,3 @@ + + +var x = `\x19\u0019 19`; \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes02_ES6.ts b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes02_ES6.ts new file mode 100644 index 00000000000..4b514ba80c6 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes02_ES6.ts @@ -0,0 +1,3 @@ +// @target: es6 + +var x = `\x19\u0019 19`; \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes03.ts b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes03.ts new file mode 100644 index 00000000000..755cdedc270 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes03.ts @@ -0,0 +1,3 @@ + + +var x = `\x1F\u001f 1F 1f`; \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes03_ES6.ts b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes03_ES6.ts new file mode 100644 index 00000000000..a24d3b57ae3 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes03_ES6.ts @@ -0,0 +1,3 @@ +// @target: es6 + +var x = `\x1F\u001f 1F 1f`; \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes04.ts b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes04.ts new file mode 100644 index 00000000000..19820e9daaa --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes04.ts @@ -0,0 +1,3 @@ + + +var x = `\x20\u0020 20`; \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes04_ES6.ts b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes04_ES6.ts new file mode 100644 index 00000000000..45026545775 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringControlCharacterEscapes04_ES6.ts @@ -0,0 +1,3 @@ +// @target: es6 + +var x = `\x20\u0020 20`; \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes01.ts b/tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes01.ts new file mode 100644 index 00000000000..4f0d66e74a2 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes01.ts @@ -0,0 +1,2 @@ + +`0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes01_ES6.ts b/tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes01_ES6.ts new file mode 100644 index 00000000000..73ac4864314 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes01_ES6.ts @@ -0,0 +1,3 @@ +// @target: es6 + +`0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes02.ts b/tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes02.ts new file mode 100644 index 00000000000..33b9d27a233 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes02.ts @@ -0,0 +1,3 @@ + + +`0${ " " }1${ " " }2${ " " }3${ " " }4${ " " }5${ " " }6${ " " }7${ " " }8${ " " }9${ " " }10${ " " }11${ " " }12${ " " }13${ " " }14${ " " }15${ " " }16${ " " }17${ " " }18${ " " }19${ " " }20${ " " }2028${ " " }2029${ " " }0085${ " " }t${ " " }v${ " " }f${ " " }b${ " " }r${ " " }n` \ No newline at end of file diff --git a/tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes02_ES6.ts b/tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes02_ES6.ts new file mode 100644 index 00000000000..04b69b7f706 --- /dev/null +++ b/tests/cases/conformance/es6/templates/templateStringPlainCharactersThatArePartsOfEscapes02_ES6.ts @@ -0,0 +1,3 @@ +// @target: es6 + +`0${ " " }1${ " " }2${ " " }3${ " " }4${ " " }5${ " " }6${ " " }7${ " " }8${ " " }9${ " " }10${ " " }11${ " " }12${ " " }13${ " " }14${ " " }15${ " " }16${ " " }17${ " " }18${ " " }19${ " " }20${ " " }2028${ " " }2029${ " " }0085${ " " }t${ " " }v${ " " }f${ " " }b${ " " }r${ " " }n` \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationExports.ts b/tests/cases/fourslash/breakpointValidationExports.ts new file mode 100644 index 00000000000..092d4fdc143 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationExports.ts @@ -0,0 +1,9 @@ +/// + +// @BaselineFile: bpSpan_exports.baseline +// @Filename: bpSpan_exports.ts +////export * from "a"; +////export {a as A} from "a"; +////export import e = require("a"); + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationImports.ts b/tests/cases/fourslash/breakpointValidationImports.ts new file mode 100644 index 00000000000..c2ec25a1096 --- /dev/null +++ b/tests/cases/fourslash/breakpointValidationImports.ts @@ -0,0 +1,12 @@ +/// + +// @BaselineFile: bpSpan_imports.baseline +// @Filename: bpSpan_imports.ts +////import * as NS from "a"; +////import {a as A} from "a"; +//// import d from "a"; +////import d2, {c, d as D} from "a"; +////import "a"; +////import e = require("a"); + +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/completionForExports.ts b/tests/cases/fourslash/completionForExports.ts new file mode 100644 index 00000000000..57c0f75efc1 --- /dev/null +++ b/tests/cases/fourslash/completionForExports.ts @@ -0,0 +1,32 @@ +/// + +// @Filename: m1.ts +////export var foo: number = 1; +////export function bar() { return 10; } +////export function baz() { return 10; } + +// @Filename: m2.ts +////import {/*1*/, /*2*/ from "m1" +////import {/*3*/} from "m1" +////import {foo,/*4*/ from "m1" +////import {bar as /*5*/, /*6*/ from "m1" +////import {foo, bar, baz as b,/*7*/} from "m1" +function verifyCompletionAtMarker(marker: string, ...completions: string[]) { + goTo.marker(marker); + if (completions.length) { + for (var i = 0; i < completions.length; ++i) { + verify.completionListContains(completions[i]); + } + } + else { + verify.completionListIsEmpty(); + } +} + +verifyCompletionAtMarker("1", "foo", "bar", "baz"); +verifyCompletionAtMarker("2", "foo", "bar", "baz"); +verifyCompletionAtMarker("3", "foo", "bar", "baz"); +verifyCompletionAtMarker("4", "bar", "baz"); +verifyCompletionAtMarker("5"); +verifyCompletionAtMarker("6", "foo", "baz"); +verifyCompletionAtMarker("7"); \ No newline at end of file diff --git a/tests/cases/fourslash/findAllRefsOnImportAliases.ts b/tests/cases/fourslash/findAllRefsOnImportAliases.ts new file mode 100644 index 00000000000..dbfab33aa86 --- /dev/null +++ b/tests/cases/fourslash/findAllRefsOnImportAliases.ts @@ -0,0 +1,29 @@ +/// + +//@Filename: a.ts +////export class /*1*/Class{ +////} + +//@Filename: b.ts +////import { /*2*/Class } from "a"; +//// +////var c = new /*3*/Class(); + +//@Filename: c.ts +////export { /*4*/Class } from "a"; + +goTo.file("a.ts"); +goTo.marker("1"); +verify.referencesCountIs(4); + +goTo.file("b.ts"); +goTo.marker("2"); +verify.referencesCountIs(4); + +goTo.marker("3"); +verify.referencesCountIs(4); + +goTo.file("c.ts"); +goTo.marker("4"); +verify.referencesCountIs(4); + diff --git a/tests/cases/fourslash/findAllRefsOnImportAliases2.ts b/tests/cases/fourslash/findAllRefsOnImportAliases2.ts new file mode 100644 index 00000000000..dca6b13bbd2 --- /dev/null +++ b/tests/cases/fourslash/findAllRefsOnImportAliases2.ts @@ -0,0 +1,31 @@ +/// + +//@Filename: a.ts +////export class /*1*/Class{ +////} + +//@Filename: b.ts +////import { /*2*/Class as /*3*/C2} from "a"; +//// +////var c = new C2(); + +//@Filename: c.ts +////export { /*4*/Class as /*5*/C3 } from "a"; + +goTo.file("a.ts"); +goTo.marker("1"); +verify.referencesCountIs(3); + +goTo.file("b.ts"); +goTo.marker("2"); +verify.referencesCountIs(3); + +goTo.marker("3"); +verify.referencesCountIs(2); + +goTo.file("c.ts"); +goTo.marker("4"); +verify.referencesCountIs(3); + +goTo.marker("5"); +verify.referencesCountIs(1); diff --git a/tests/cases/fourslash/goToDefinitionExternamModuleName6.ts b/tests/cases/fourslash/goToDefinitionExternamModuleName6.ts new file mode 100644 index 00000000000..46cafbb806c --- /dev/null +++ b/tests/cases/fourslash/goToDefinitionExternamModuleName6.ts @@ -0,0 +1,13 @@ +/// + +// @Filename: b.ts +////import * from 'e/*1*/'; + +// @Filename: a.ts +/////*2*/declare module "e" { +//// class Foo { } +////} + +goTo.marker('1'); +goTo.definition(); +verify.caretAtMarker('2'); \ No newline at end of file diff --git a/tests/cases/fourslash/goToDefinitionExternamModuleName7.ts b/tests/cases/fourslash/goToDefinitionExternamModuleName7.ts new file mode 100644 index 00000000000..dcaf4b1f021 --- /dev/null +++ b/tests/cases/fourslash/goToDefinitionExternamModuleName7.ts @@ -0,0 +1,13 @@ +/// + +// @Filename: b.ts +////import {Foo, Bar} from 'e/*1*/'; + +// @Filename: a.ts +/////*2*/declare module "e" { +//// class Foo { } +////} + +goTo.marker('1'); +goTo.definition(); +verify.caretAtMarker('2'); \ No newline at end of file diff --git a/tests/cases/fourslash/goToDefinitionExternamModuleName8.ts b/tests/cases/fourslash/goToDefinitionExternamModuleName8.ts new file mode 100644 index 00000000000..03c36567dc0 --- /dev/null +++ b/tests/cases/fourslash/goToDefinitionExternamModuleName8.ts @@ -0,0 +1,13 @@ +/// + +// @Filename: b.ts +////export {Foo, Bar} from 'e/*1*/'; + +// @Filename: a.ts +/////*2*/declare module "e" { +//// class Foo { } +////} + +goTo.marker('1'); +goTo.definition(); +verify.caretAtMarker('2'); \ No newline at end of file diff --git a/tests/cases/fourslash/goToDefinitionExternamModuleName9.ts b/tests/cases/fourslash/goToDefinitionExternamModuleName9.ts new file mode 100644 index 00000000000..43111c6763f --- /dev/null +++ b/tests/cases/fourslash/goToDefinitionExternamModuleName9.ts @@ -0,0 +1,13 @@ +/// + +// @Filename: b.ts +////export * from 'e/*1*/'; + +// @Filename: a.ts +/////*2*/declare module "e" { +//// class Foo { } +////} + +goTo.marker('1'); +goTo.definition(); +verify.caretAtMarker('2'); \ No newline at end of file diff --git a/tests/cases/fourslash/goToDefinitionImportedNames.ts b/tests/cases/fourslash/goToDefinitionImportedNames.ts new file mode 100644 index 00000000000..64eb2df96bf --- /dev/null +++ b/tests/cases/fourslash/goToDefinitionImportedNames.ts @@ -0,0 +1,21 @@ +/// + +// @Filename: b.ts +////export {/*classAliasDefinition*/Class} from "a"; + + +// @Filename: a.ts +////export module Module { +////} +/////*classDefinition*/export class Class { +//// private f; +////} +////export interface Interface { +//// x; +////} + +goTo.file("b.ts"); + +goTo.marker('classAliasDefinition'); +goTo.definition(); +verify.caretAtMarker('classDefinition'); diff --git a/tests/cases/fourslash/goToDefinitionImportedNames2.ts b/tests/cases/fourslash/goToDefinitionImportedNames2.ts new file mode 100644 index 00000000000..8533dad62a8 --- /dev/null +++ b/tests/cases/fourslash/goToDefinitionImportedNames2.ts @@ -0,0 +1,21 @@ +/// + +// @Filename: b.ts +////import {/*classAliasDefinition*/Class} from "a"; + + +// @Filename: a.ts +////export module Module { +////} +/////*classDefinition*/export class Class { +//// private f; +////} +////export interface Interface { +//// x; +////} + +goTo.file("b.ts"); + +goTo.marker('classAliasDefinition'); +goTo.definition(); +verify.caretAtMarker('classDefinition'); diff --git a/tests/cases/fourslash/goToDefinitionImportedNames3.ts b/tests/cases/fourslash/goToDefinitionImportedNames3.ts new file mode 100644 index 00000000000..d55137575ef --- /dev/null +++ b/tests/cases/fourslash/goToDefinitionImportedNames3.ts @@ -0,0 +1,38 @@ +/// + +// @Filename: e.ts +//// import {M, /*classAliasDefinition*/C, I} from "d"; +//// var c = new /*classReference*/C(); + + +// @Filename: d.ts +////export * from "c"; + + +// @Filename: c.ts +////export {Module as M, Class as C, Interface as I} from "b"; + + +// @Filename: b.ts +////export * from "a"; + + +// @Filename: a.ts +////export module Module { +////} +/////*classDefinition*/export class Class { +//// private f; +////} +////export interface Interface { +//// x; +////} + +goTo.file("e.ts"); + +goTo.marker('classReference'); +goTo.definition(); +verify.caretAtMarker('classAliasDefinition'); + +goTo.marker('classAliasDefinition'); +goTo.definition(); +verify.caretAtMarker('classDefinition'); diff --git a/tests/cases/fourslash/goToDefinitionImportedNames4.ts b/tests/cases/fourslash/goToDefinitionImportedNames4.ts new file mode 100644 index 00000000000..cce49af874b --- /dev/null +++ b/tests/cases/fourslash/goToDefinitionImportedNames4.ts @@ -0,0 +1,21 @@ +/// + +// @Filename: b.ts +////import {Class as /*classAliasDefinition*/ClassAlias} from "a"; + + +// @Filename: a.ts +////export module Module { +////} +/////*classDefinition*/export class Class { +//// private f; +////} +////export interface Interface { +//// x; +////} + +goTo.file("b.ts"); + +goTo.marker('classAliasDefinition'); +goTo.definition(); +verify.caretAtMarker('classDefinition'); diff --git a/tests/cases/fourslash/goToDefinitionImportedNames5.ts b/tests/cases/fourslash/goToDefinitionImportedNames5.ts new file mode 100644 index 00000000000..46a8c45e272 --- /dev/null +++ b/tests/cases/fourslash/goToDefinitionImportedNames5.ts @@ -0,0 +1,21 @@ +/// + +// @Filename: b.ts +////export {Class as /*classAliasDefinition*/ClassAlias} from "a"; + + +// @Filename: a.ts +////export module Module { +////} +/////*classDefinition*/export class Class { +//// private f; +////} +////export interface Interface { +//// x; +////} + +goTo.file("b.ts"); + +goTo.marker('classAliasDefinition'); +goTo.definition(); +verify.caretAtMarker('classDefinition'); diff --git a/tests/cases/fourslash/goToDefinitionImportedNames6.ts b/tests/cases/fourslash/goToDefinitionImportedNames6.ts new file mode 100644 index 00000000000..27b6c55d107 --- /dev/null +++ b/tests/cases/fourslash/goToDefinitionImportedNames6.ts @@ -0,0 +1,21 @@ +/// + +// @Filename: b.ts +////import /*moduleAliasDefinition*/alias = require("a"); + + +// @Filename: a.ts +/////*moduleDefinition*/export module Module { +////} +////export class Class { +//// private f; +////} +////export interface Interface { +//// x; +////} + +goTo.file("b.ts"); + +goTo.marker('moduleAliasDefinition'); +goTo.definition(); +verify.caretAtMarker('moduleDefinition'); diff --git a/tests/cases/fourslash/goToDefinitionImportedNames7.ts b/tests/cases/fourslash/goToDefinitionImportedNames7.ts new file mode 100644 index 00000000000..46d09012d40 --- /dev/null +++ b/tests/cases/fourslash/goToDefinitionImportedNames7.ts @@ -0,0 +1,17 @@ +/// + +// @Filename: b.ts +////import /*classAliasDefinition*/defaultExport from "a"; + + +// @Filename: a.ts +/////*classDefinition*/class Class { +//// private f; +////} +////export = Class; + +goTo.file("b.ts"); + +goTo.marker('classAliasDefinition'); +goTo.definition(); +verify.caretAtMarker('classDefinition'); diff --git a/tests/cases/fourslash/navigateItemsExports.ts b/tests/cases/fourslash/navigateItemsExports.ts new file mode 100644 index 00000000000..646d557aace --- /dev/null +++ b/tests/cases/fourslash/navigateItemsExports.ts @@ -0,0 +1,20 @@ +/// + +////export { {| "itemName": "a", "kind": "alias", "parentName": "" |}a } from "a"; +//// +////export { {| "itemName": "B", "kind": "alias", "parentName": "" |}b as B } from "a"; +//// +////export { {| "itemName": "c", "kind": "alias", "parentName": "" |}c, +//// {| "itemName": "D", "kind": "alias", "parentName": "" |}d as D } from "a"; +//// +////{| "itemName": "f", "kind": "alias", "parentName": "" |}export import f = require("a"); + +test.markers().forEach(marker => { + verify.navigationItemsListContains( + marker.data.itemName, + marker.data.kind, + marker.data.itemName, + "exact", + marker.fileName, + marker.data.parentName); +}); \ No newline at end of file diff --git a/tests/cases/fourslash/navigateItemsImports.ts b/tests/cases/fourslash/navigateItemsImports.ts new file mode 100644 index 00000000000..8ac3e000639 --- /dev/null +++ b/tests/cases/fourslash/navigateItemsImports.ts @@ -0,0 +1,25 @@ +/// + +////import {| "itemName": "ns", "kind": "alias", "parentName": "" |}* as ns from "a"; +//// +////import { {| "itemName": "a", "kind": "alias", "parentName": "" |}a } from "a"; +//// +////import { {| "itemName": "B", "kind": "alias", "parentName": "" |}b as B } from "a"; +//// +////import { {| "itemName": "c", "kind": "alias", "parentName": "" |}c, +//// {| "itemName": "D", "kind": "alias", "parentName": "" |}d as D } from "a"; +//// +////import {| "itemName": "d1", "kind": "alias", "parentName": "" |}d1, { +//// {| "itemName": "e", "kind": "alias", "parentName": "" |}e } from "a"; +//// +////{| "itemName": "f", "kind": "alias", "parentName": "" |}import f = require("a"); + +test.markers().forEach(marker => { + verify.navigationItemsListContains( + marker.data.itemName, + marker.data.kind, + marker.data.itemName, + "exact", + marker.fileName, + marker.data.parentName); +}); \ No newline at end of file diff --git a/tests/cases/fourslash/quickInfoOnCatchVariable.ts b/tests/cases/fourslash/quickInfoOnCatchVariable.ts index d03b5d7b8b6..5d0af595e91 100644 --- a/tests/cases/fourslash/quickInfoOnCatchVariable.ts +++ b/tests/cases/fourslash/quickInfoOnCatchVariable.ts @@ -6,4 +6,4 @@ goTo.marker(); verify.quickInfoExists(); -verify.quickInfoIs("(var) e: any"); +verify.quickInfoIs("(local var) e: any"); diff --git a/tests/cases/fourslash/scriptLexicalStructureExports.ts b/tests/cases/fourslash/scriptLexicalStructureExports.ts new file mode 100644 index 00000000000..f2a4adfa0d1 --- /dev/null +++ b/tests/cases/fourslash/scriptLexicalStructureExports.ts @@ -0,0 +1,18 @@ +/// + + +////export { {| "itemName": "a", "kind": "alias", "parentName": "" |}a } from "a"; +//// +////export { {| "itemName": "B", "kind": "alias", "parentName": "" |}b as B } from "a" +//// +////{| "itemName": "e", "kind": "alias", "parentName": "" |} export import e = require("a"); +//// +////export * from "a"; // no bindings here + +test.markers().forEach((marker) => { + if (marker.data) { + verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); + } +}); + +verify.getScriptLexicalStructureListCount(4); diff --git a/tests/cases/fourslash/scriptLexicalStructureImports.ts b/tests/cases/fourslash/scriptLexicalStructureImports.ts new file mode 100644 index 00000000000..9d9e3e8b468 --- /dev/null +++ b/tests/cases/fourslash/scriptLexicalStructureImports.ts @@ -0,0 +1,25 @@ +/// + + +////import {| "itemName": "d1", "kind": "alias", "parentName": "" |}d1 from "a"; +//// +////import { {| "itemName": "a", "kind": "alias", "parentName": "" |}a } from "a"; +//// +////import { {| "itemName": "B", "kind": "alias", "parentName": "" |}b as B } from "a" +//// +////import {| "itemName": "d2", "kind": "alias", "parentName": "" |}d2, +//// { {| "itemName": "c", "kind": "alias", "parentName": "" |}c, +//// {| "itemName": "D", "kind": "alias", "parentName": "" |} d as D } from "a" +//// +////{| "itemName": "e", "kind": "alias", "parentName": "" |}import e = require("a"); +//// +////import {| "itemName": "ns", "kind": "alias", "parentName": "" |}* as ns from "a"; + + +test.markers().forEach((marker) => { + if (marker.data) { + verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); + } +}); + +verify.getScriptLexicalStructureListCount(9);