diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..de6d5c49a7 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,10 @@ + +root = true + +[{src,scripts}/**.{ts,json,js}] +end_of_line = crlf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +indent_style = space +indent_size = 4 diff --git a/README.md b/README.md index f7e55d2dff..ac00ef085b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ [![Build Status](https://travis-ci.org/Microsoft/TypeScript.svg?branch=master)](https://travis-ci.org/Microsoft/TypeScript) [![Issue Stats](http://issuestats.com/github/Microsoft/TypeScript/badge/pr)](http://issuestats.com/github/microsoft/typescript) [![Issue Stats](http://issuestats.com/github/Microsoft/TypeScript/badge/issue)](http://issuestats.com/github/microsoft/typescript) +[![npm version](https://badge.fury.io/js/typescript.svg)](http://badge.fury.io/js/typescript) +[![Downloads](http://img.shields.io/npm/dm/TypeScript.svg)](https://npmjs.org/package/typescript) # TypeScript diff --git a/scripts/VSDevMode.ps1 b/scripts/VSDevMode.ps1 index 21cc1f48ac..df34c9e778 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 c26d3369f3..f5b23ffb59 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -67,7 +67,8 @@ module ts { if (!file.locals) { file.locals = {}; - container = blockScopeContainer = file; + container = file; + setBlockScopeContainer(file, /*cleanLocals*/ false); bind(file); file.symbolCount = symbolCount; } @@ -77,6 +78,13 @@ module ts { return new Symbol(flags, name); } + function setBlockScopeContainer(node: Node, cleanLocals: boolean) { + blockScopeContainer = node; + if (cleanLocals) { + blockScopeContainer.locals = undefined; + } + } + function addDeclarationToSymbol(symbol: Symbol, node: Declaration, symbolKind: SymbolFlags) { symbol.flags |= symbolKind; if (!symbol.declarations) symbol.declarations = []; @@ -236,7 +244,13 @@ module ts { } if (isBlockScopeContainer) { - blockScopeContainer = node; + // in incremental scenarios we might reuse nodes that already have locals being allocated + // during the bind step these locals should be dropped to prevent using stale data. + // locals should always be dropped unless they were previously initialized by the binder + // these cases are: + // - node has locals (symbolKind & HasLocals) !== 0 + // - node is a source file + setBlockScopeContainer(node, /*cleanLocals*/ (symbolKind & SymbolFlags.HasLocals) === 0 && node.kind !== SyntaxKind.SourceFile); } forEachChild(node, bind); @@ -342,14 +356,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 +384,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 +397,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 052b39d511..9daa87daed 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -97,6 +97,7 @@ module ts { var globalRegExpType: ObjectType; var globalTemplateStringsArrayType: ObjectType; var globalESSymbolType: ObjectType; + var globalIterableType: ObjectType; var anyArrayType: Type; @@ -416,13 +417,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; @@ -451,7 +445,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)); @@ -595,13 +590,13 @@ module ts { } if (name.kind === SyntaxKind.Identifier) { - var symbol = resolveName(location,(name).text, meaning, Diagnostics.Cannot_find_name_0, name); + var symbol = resolveName(location, (name).text, meaning, Diagnostics.Cannot_find_name_0, name); if (!symbol) { return; } } else if (name.kind === SyntaxKind.QualifiedName) { - var namespace = resolveEntityName(location,(name).left, SymbolFlags.Namespace); + var namespace = resolveEntityName(location, (name).left, SymbolFlags.Namespace); if (!namespace || namespace === unknownSymbol || getFullWidth((name).right) === 0) return; var symbol = getSymbol(getExportsOfSymbol(namespace), (name).right.text, meaning); if (!symbol) { @@ -751,7 +746,10 @@ module ts { forEach(symbol.declarations, node => { if (node.kind === SyntaxKind.SourceFile || node.kind === SyntaxKind.ModuleDeclaration) { forEach((node).exportStars, exportStar => { - visit(resolveExternalModuleName(exportStar, exportStar.moduleSpecifier)); + var moduleSymbol = resolveExternalModuleName(exportStar, exportStar.moduleSpecifier); + if (moduleSymbol) { + visit(moduleSymbol); + } }); } }); @@ -1862,6 +1860,9 @@ module ts { if (declaration.parent.parent.kind === SyntaxKind.ForInStatement) { return anyType; } + if (declaration.parent.parent.kind === SyntaxKind.ForOfStatement) { + return getTypeForVariableDeclarationInForOfStatement(declaration.parent.parent); + } if (isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } @@ -1994,7 +1995,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 @@ -3153,8 +3154,8 @@ module ts { return resolveName(undefined, name, meaning, diagnostic, name); } - function getGlobalType(name: string): ObjectType { - return getTypeOfGlobalSymbol(getGlobalTypeSymbol(name), 0); + function getGlobalType(name: string, arity = 0): ObjectType { + return getTypeOfGlobalSymbol(getGlobalTypeSymbol(name), arity); } function getGlobalESSymbolConstructorSymbol() { @@ -3536,7 +3537,7 @@ module ts { isContextSensitive((node).whenFalse); case SyntaxKind.BinaryExpression: return (node).operatorToken.kind === SyntaxKind.BarBarToken && - (isContextSensitive((node).left) || isContextSensitive((node).right)); + (isContextSensitive((node).left) || isContextSensitive((node).right)); case SyntaxKind.PropertyAssignment: return isContextSensitive((node).initializer); case SyntaxKind.MethodDeclaration: @@ -5002,7 +5003,7 @@ module ts { break; case SyntaxKind.PrefixUnaryExpression: if ((expr).operator === SyntaxKind.ExclamationToken) { - return narrowType(type,(expr).operand, !assumeTrue); + return narrowType(type, (expr).operand, !assumeTrue); } break; } @@ -5073,7 +5074,7 @@ module ts { nodeLinks.importOnRightSide = symbol; } } - + if (symbolLinks.referenced) { markLinkedImportsAsReferenced(getDeclarationOfKind(symbol, SyntaxKind.ImportEqualsDeclaration)); } @@ -5081,10 +5082,63 @@ module ts { checkCollisionWithCapturedSuperVariable(node, node); checkCollisionWithCapturedThisVariable(node, node); + checkBlockScopedBindingCapturedInLoop(node, symbol); return getNarrowedTypeOfSymbol(getExportSymbolOfValueSymbolIfExported(symbol), node); } + function isInsideFunction(node: Node, threshold: Node): boolean { + var current = node; + while (current && current !== threshold) { + if (isAnyFunction(current)) { + return true; + } + current = current.parent; + } + + return false; + } + + function checkBlockScopedBindingCapturedInLoop(node: Identifier, symbol: Symbol): void { + if (languageVersion >= ScriptTarget.ES6 || + (symbol.flags & SymbolFlags.BlockScopedVariable) === 0 || + symbol.valueDeclaration.parent.kind === SyntaxKind.CatchClause) { + return; + } + + // - check if binding is used in some function + // (stop the walk when reaching container of binding declaration) + // - if first check succeeded - check if variable is declared inside the loop + + // nesting structure: + // (variable declaration or binding element) -> variable declaration list -> container + var container: Node = symbol.valueDeclaration; + while (container.kind !== SyntaxKind.VariableDeclarationList) { + container = container.parent; + } + // get the parent of variable declaration list + container = container.parent; + if (container.kind === SyntaxKind.VariableStatement) { + // if parent is variable statement - get its parent + container = container.parent; + } + + var inFunction = isInsideFunction(node.parent, container); + + var current = container; + while (current && !nodeStartsNewLexicalEnvironment(current)) { + if (isIterationStatement(current, /*lookInLabeledStatements*/ false)) { + if (inFunction) { + grammarErrorOnFirstToken(current, Diagnostics.Loop_contains_block_scoped_variable_0_referenced_by_a_function_in_the_loop_This_is_only_supported_in_ECMAScript_6_or_higher, declarationNameToString(node)); + } + // mark value declaration so during emit they can have a special handling + getNodeLinks(symbol.valueDeclaration).flags |= NodeCheckFlags.BlockScopedBindingInLoop; + break; + } + current = current.parent; + } + } + function captureLexicalThis(node: Node, container: Node): void { var classNode = container.parent && container.parent.kind === SyntaxKind.ClassDeclaration ? container.parent : undefined; getNodeLinks(node).flags |= NodeCheckFlags.LexicalThis; @@ -5441,7 +5495,7 @@ module ts { return propertyType; } } - + return isNumericName(element.name) && getIndexTypeOfContextualType(type, IndexKind.Number) || getIndexTypeOfContextualType(type, IndexKind.String); } @@ -5450,14 +5504,17 @@ module ts { } // In an array literal contextually typed by a type T, the contextual type of an element expression at index N is - // the type of the property with the numeric name N in T, if one exists. Otherwise, it is the type of the numeric - // index signature in T, if one exists. + // the type of the property with the numeric name N in T, if one exists. Otherwise, if T has a numeric index signature, + // it is the type of the numeric index signature in T. Otherwise, in ES6 and higher, the contextual type is the iterated + // type of T. function getContextualTypeForElementExpression(node: Expression): Type { var arrayLiteral = node.parent; var type = getContextualType(arrayLiteral); if (type) { var index = indexOf(arrayLiteral.elements, node); - return getTypeOfPropertyOfContextualType(type, "" + index) || getIndexTypeOfContextualType(type, IndexKind.Number); + return getTypeOfPropertyOfContextualType(type, "" + index) + || getIndexTypeOfContextualType(type, IndexKind.Number) + || (languageVersion >= ScriptTarget.ES6 ? checkIteratedType(type, /*expressionForError*/ undefined) : undefined); } return undefined; } @@ -6034,7 +6091,7 @@ module ts { if (!leftHandSideSymbol) { return false; } - + var globalESSymbol = getGlobalESSymbolConstructorSymbol(); if (!globalESSymbol) { // Already errored when we tried to look up the symbol @@ -6308,7 +6365,7 @@ module ts { // unless we're reporting errors var argType = i === 0 && node.kind === SyntaxKind.TaggedTemplateExpression ? globalTemplateStringsArrayType : arg.kind === SyntaxKind.StringLiteral && !reportErrors ? getStringLiteralType(arg) : - checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); + checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); // Use argument expression as error location when reporting errors if (!checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined, Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1)) { @@ -6759,11 +6816,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)); } @@ -6938,7 +6990,7 @@ module ts { if (produceDiagnostics && node.kind !== SyntaxKind.MethodDeclaration && node.kind !== SyntaxKind.MethodSignature) { checkCollisionWithCapturedSuperVariable(node, (node).name); - checkCollisionWithCapturedThisVariable(node,(node).name); + checkCollisionWithCapturedThisVariable(node, (node).name); } return type; @@ -6972,7 +7024,7 @@ module ts { return true; } - function checkReferenceExpression(n: Node, invalidReferenceMessage: DiagnosticMessage, constantVarianleMessage: DiagnosticMessage): boolean { + function checkReferenceExpression(n: Node, invalidReferenceMessage: DiagnosticMessage, constantVariableMessage: DiagnosticMessage): boolean { function findSymbol(n: Node): Symbol { var symbol = getNodeLinks(n).resolvedSymbol; // Because we got the symbol from the resolvedSymbol property, it might be of kind @@ -7039,7 +7091,7 @@ module ts { return false; } if (isConstVariableReference(n)) { - error(n, constantVarianleMessage); + error(n, constantVariableMessage); return false; } return true; @@ -7231,7 +7283,7 @@ module ts { var propName = "" + i; var type = sourceType.flags & TypeFlags.Any ? sourceType : isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) : - getIndexTypeOfType(sourceType, IndexKind.Number); + getIndexTypeOfType(sourceType, IndexKind.Number); if (type) { checkDestructuringAssignment(e, type, contextualMapper); } @@ -7385,7 +7437,7 @@ module ts { if (!checkForDisallowedESSymbolOperand(operator)) { return booleanType; } - // Fall through + // Fall through case SyntaxKind.EqualsEqualsToken: case SyntaxKind.ExclamationEqualsToken: case SyntaxKind.EqualsEqualsEqualsToken: @@ -7409,7 +7461,7 @@ module ts { return rightType; } - // Return type is true if there was no error, false if there was an error. + // Return true if there was no error, false if there was an error. function checkForDisallowedESSymbolOperand(operator: SyntaxKind): boolean { var offendingSymbolOperand = someConstituentTypeHasKind(leftType, TypeFlags.ESSymbol) ? node.left : @@ -7713,8 +7765,8 @@ module ts { } // TODO (yuisu): Remove this check in else-if when SyntaxKind.Construct is moved and ambient context is handled else if (node.kind === SyntaxKind.FunctionType || node.kind === SyntaxKind.FunctionDeclaration || node.kind === SyntaxKind.ConstructorType || - node.kind === SyntaxKind.CallSignature || node.kind === SyntaxKind.Constructor || - node.kind === SyntaxKind.ConstructSignature){ + node.kind === SyntaxKind.CallSignature || node.kind === SyntaxKind.Constructor || + node.kind === SyntaxKind.ConstructSignature) { checkGrammarFunctionLikeDeclaration(node); } @@ -8324,9 +8376,9 @@ module ts { function checkFunctionDeclaration(node: FunctionDeclaration): void { if (produceDiagnostics) { checkFunctionLikeDeclaration(node) || - checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || - checkGrammarFunctionName(node.name) || - checkGrammarForGenerator(node); + checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || + checkGrammarFunctionName(node.name) || + checkGrammarForGenerator(node); checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); @@ -8433,7 +8485,7 @@ module ts { return true; } - + function checkCollisionWithCapturedThisVariable(node: Node, name: Identifier): void { if (needCollisionCheckForIdentifier(node, name, "_this")) { potentialThisCollisions.push(node); @@ -8443,7 +8495,7 @@ module ts { // this function will run after checking the source file so 'CaptureThis' is correct for all nodes function checkIfThisIsCapturedInEnclosingScope(node: Node): void { var current = node; - while (current) { + while (current) { if (getNodeCheckFlags(current) & NodeCheckFlags.CaptureThis) { var isDeclaration = node.kind !== SyntaxKind.Identifier; if (isDeclaration) { @@ -8544,8 +8596,8 @@ module ts { var namesShareScope = container && (container.kind === SyntaxKind.Block && isAnyFunction(container.parent) || - (container.kind === SyntaxKind.ModuleBlock && container.kind === SyntaxKind.ModuleDeclaration) || - container.kind === SyntaxKind.SourceFile); + (container.kind === SyntaxKind.ModuleBlock && container.kind === SyntaxKind.ModuleDeclaration) || + container.kind === SyntaxKind.SourceFile); // here we know that function scoped variable is shadowed by block scoped one // if they are defined in the same scope - binder has already reported redeclaration error @@ -8751,9 +8803,50 @@ module ts { checkSourceElement(node.statement); } - function checkForOfStatement(node: ForOfStatement) { - // TODO: not yet implemented - checkGrammarForOfStatement(node); + function checkForOfStatement(node: ForOfStatement): void { + if (languageVersion < ScriptTarget.ES6) { + grammarErrorOnFirstToken(node, Diagnostics.for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher); + return; + } + + checkGrammarForInOrForOfStatement(node) + + // Check the LHS and RHS + // If the LHS is a declaration, just check it as a variable declaration, which will in turn check the RHS + // via getTypeForVariableDeclarationInForOfStatement. + // If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference. + // Then check that the RHS is assignable to it. + if (node.initializer.kind === SyntaxKind.VariableDeclarationList) { + checkForInOrForOfVariableDeclaration(node); + } + else { + var varExpr = node.initializer; + var rightType = checkExpression(node.expression); + var iteratedType = checkIteratedType(rightType, node.expression); + + // There may be a destructuring assignment on the left side + if (varExpr.kind === SyntaxKind.ArrayLiteralExpression || varExpr.kind === SyntaxKind.ObjectLiteralExpression) { + // iteratedType may be undefined. In this case, we still want to check the structure of + // varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like + // to short circuit the type relation checking as much as possible, so we pass the unknownType. + checkDestructuringAssignment(varExpr, iteratedType || unknownType); + } + else { + var leftType = checkExpression(varExpr); + checkReferenceExpression(varExpr, /*invalidReferenceMessage*/ Diagnostics.Invalid_left_hand_side_in_for_of_statement, + /*constantVariableMessage*/ Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant); + + // iteratedType will be undefined if the rightType was missing properties/signatures + // required to get its iteratedType (like [Symbol.iterator] or next). This may be + // because we accessed properties from anyType, or it may have led to an error inside + // getIteratedType. + if (iteratedType) { + checkTypeAssignableTo(iteratedType, leftType, varExpr, /*headMessage*/ undefined); + } + } + } + + checkSourceElement(node.statement); } function checkForInStatement(node: ForInStatement) { @@ -8766,11 +8859,12 @@ module ts { // VarDecl must be a variable declaration without a type annotation that declares a variable of type Any, // and Expr must be an expression of type Any, an object type, or a type parameter type. if (node.initializer.kind === SyntaxKind.VariableDeclarationList) { - var variableDeclarationList = node.initializer; - if (variableDeclarationList.declarations.length >= 1) { - var decl = variableDeclarationList.declarations[0]; - checkVariableDeclaration(decl); + var variable = (node.initializer).declarations[0]; + if (variable && isBindingPattern(variable.name)) { + error(variable.name, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } + + checkForInOrForOfVariableDeclaration(node); } else { // In a 'for-in' statement of the form @@ -8778,26 +8872,148 @@ module ts { // Var must be an expression classified as a reference of type Any or the String primitive type, // and Expr must be an expression of type Any, an object type, or a type parameter type. var varExpr = node.initializer; - var exprType = checkExpression(varExpr); - if (!allConstituentTypesHaveKind(exprType, TypeFlags.Any | TypeFlags.StringLike)) { + var leftType = checkExpression(varExpr); + if (varExpr.kind === SyntaxKind.ArrayLiteralExpression || varExpr.kind === SyntaxKind.ObjectLiteralExpression) { + error(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); + } + else if (!allConstituentTypesHaveKind(leftType, TypeFlags.Any | TypeFlags.StringLike)) { error(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any); } else { // run check only former check succeeded to avoid cascading errors - checkReferenceExpression(varExpr, Diagnostics.Invalid_left_hand_side_in_for_in_statement, Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant); + checkReferenceExpression(varExpr, Diagnostics.Invalid_left_hand_side_in_for_in_statement, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant); } } - var exprType = checkExpression(node.expression); + var rightType = checkExpression(node.expression); // unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved // in this case error about missing name is already reported - do not report extra one - if (!allConstituentTypesHaveKind(exprType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) { + if (!allConstituentTypesHaveKind(rightType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) { error(node.expression, Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); } checkSourceElement(node.statement); } + function checkForInOrForOfVariableDeclaration(iterationStatement: ForInStatement | ForOfStatement): void { + var variableDeclarationList = iterationStatement.initializer; + // checkGrammarForInOrForOfStatement will check that there is exactly one declaration. + if (variableDeclarationList.declarations.length >= 1) { + var decl = variableDeclarationList.declarations[0]; + checkVariableDeclaration(decl); + } + } + + function getTypeForVariableDeclarationInForOfStatement(forOfStatement: ForOfStatement): Type { + // Temporarily return 'any' below ES6 + if (languageVersion < ScriptTarget.ES6) { + return anyType; + } + + // iteratedType will be undefined if the for-of expression type was missing properties/signatures + // required to get its iteratedType (like [Symbol.iterator] or next). This may be + // because we accessed properties from anyType, or it may have led to an error inside + // getIteratedType. + var expressionType = getTypeOfExpression(forOfStatement.expression); + return checkIteratedType(expressionType, forOfStatement.expression) || anyType; + } + + /** + * When expressionForError is undefined, it means we should not report any errors. + */ + function checkIteratedType(iterable: Type, expressionForError: Expression): Type { + Debug.assert(languageVersion >= ScriptTarget.ES6); + var iteratedType = getIteratedType(iterable, expressionForError); + // Now even though we have extracted the iteratedType, we will have to validate that the type + // passed in is actually an Iterable. + if (expressionForError && iteratedType) { + var completeIterableType = globalIterableType !== emptyObjectType + ? createTypeReference(globalIterableType, [iteratedType]) + : emptyObjectType; + checkTypeAssignableTo(iterable, completeIterableType, expressionForError); + } + + return iteratedType; + + function getIteratedType(iterable: Type, expressionForError: Expression) { + // We want to treat type as an iterable, and get the type it is an iterable of. The iterable + // must have the following structure (annotated with the names of the variables below): + // + // { // iterable + // [Symbol.iterator]: { // iteratorFunction + // (): { // iterator + // next: { // iteratorNextFunction + // (): { // iteratorNextResult + // value: T // iteratorNextValue + // } + // } + // } + // } + // } + // + // T is the type we are after. At every level that involves analyzing return types + // of signatures, we union the return types of all the signatures. + // + // Another thing to note is that at any step of this process, we could run into a dead end, + // meaning either the property is missing, or we run into the anyType. If either of these things + // happens, we return undefined to signal that we could not find the iterated type. If a property + // is missing, and the previous step did not result in 'any', then we also give an error if the + // caller requested it. Then the caller can decide what to do in the case where there is no iterated + // type. This is different from returning anyType, because that would signify that we have matched the + // whole pattern and that T (above) is 'any'. + + if (allConstituentTypesHaveKind(iterable, TypeFlags.Any)) { + return undefined; + } + + var iteratorFunction = getTypeOfPropertyOfType(iterable, getPropertyNameForKnownSymbolName("iterator")); + if (iteratorFunction && allConstituentTypesHaveKind(iteratorFunction, TypeFlags.Any)) { + return undefined; + } + + var iteratorFunctionSignatures = iteratorFunction ? getSignaturesOfType(iteratorFunction, SignatureKind.Call) : emptyArray; + if (iteratorFunctionSignatures.length === 0) { + if (expressionForError) { + error(expressionForError, Diagnostics.The_right_hand_side_of_a_for_of_statement_must_have_a_Symbol_iterator_method_that_returns_an_iterator); + } + return undefined; + } + + var iterator = getUnionType(map(iteratorFunctionSignatures, getReturnTypeOfSignature)); + if (allConstituentTypesHaveKind(iterator, TypeFlags.Any)) { + return undefined; + } + + var iteratorNextFunction = getTypeOfPropertyOfType(iterator, "next"); + if (iteratorNextFunction && allConstituentTypesHaveKind(iteratorNextFunction, TypeFlags.Any)) { + return undefined; + } + + var iteratorNextFunctionSignatures = iteratorNextFunction ? getSignaturesOfType(iteratorNextFunction, SignatureKind.Call) : emptyArray; + if (iteratorNextFunctionSignatures.length === 0) { + if (expressionForError) { + error(expressionForError, Diagnostics.The_iterator_returned_by_the_right_hand_side_of_a_for_of_statement_must_have_a_next_method); + } + return undefined; + } + + var iteratorNextResult = getUnionType(map(iteratorNextFunctionSignatures, getReturnTypeOfSignature)); + if (allConstituentTypesHaveKind(iteratorNextResult, TypeFlags.Any)) { + return undefined; + } + + var iteratorNextValue = getTypeOfPropertyOfType(iteratorNextResult, "value"); + if (!iteratorNextValue) { + if (expressionForError) { + error(expressionForError, Diagnostics.The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property); + } + return undefined; + } + + return iteratorNextValue; + } + } + function checkBreakOrContinueStatement(node: BreakOrContinueStatement) { // Grammar checking checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); @@ -8931,18 +9147,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) { @@ -10054,11 +10281,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; @@ -10195,7 +10417,7 @@ module ts { } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName: EntityName | PropertyAccessExpression): Symbol { - if (isDeclarationOrFunctionExpressionOrCatchVariableName(entityName)) { + if (isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } @@ -10260,7 +10482,7 @@ module ts { return undefined; } - if (isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { + if (isDeclarationName(node)) { // This is a declaration, call getSymbolOfNode return getSymbolOfNode(node.parent); } @@ -10356,7 +10578,7 @@ module ts { return getTypeOfSymbol(symbol); } - if (isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { + if (isDeclarationName(node)) { var symbol = getSymbolInfo(node); return symbol && getTypeOfSymbol(symbol); } @@ -10472,25 +10694,8 @@ module ts { } function makeUniqueName(baseName: string): string { - // First try '_name' - if (baseName.charCodeAt(0) !== CharacterCodes._) { - var baseName = "_" + baseName; - if (!isExistingName(baseName)) { - return generatedNames[baseName] = baseName; - } - } - // Find the first unique '_name_n', where n is a positive number - if (baseName.charCodeAt(baseName.length - 1) !== CharacterCodes._) { - baseName += "_"; - } - var i = 1; - while (true) { - name = baseName + i; - if (!isExistingName(name)) { - return generatedNames[name] = name; - } - i++; - } + var name = generateUniqueName(baseName, isExistingName); + return generatedNames[name] = name; } function assignGeneratedName(node: Node, name: string) { @@ -10691,6 +10896,46 @@ module ts { !hasProperty(getGeneratedNamesForSourceFile(getSourceFile(location)), name); } + function getBlockScopedVariableId(n: Identifier): number { + Debug.assert(!nodeIsSynthesized(n)); + + // ignore name parts of property access expressions + if (n.parent.kind === SyntaxKind.PropertyAccessExpression && + (n.parent).name === n) { + return undefined; + } + + // ignore property names in object binding patterns + if (n.parent.kind === SyntaxKind.BindingElement && + (n.parent).propertyName === n) { + return undefined; + } + + // for names in variable declarations and binding elements try to short circuit and fetch symbol from the node + var declarationSymbol: Symbol = + (n.parent.kind === SyntaxKind.VariableDeclaration && (n.parent).name === n) || + n.parent.kind === SyntaxKind.BindingElement + ? getSymbolOfNode(n.parent) + : undefined; + + var symbol = declarationSymbol || + getNodeLinks(n).resolvedSymbol || + resolveName(n, n.text, SymbolFlags.BlockScopedVariable | SymbolFlags.Import, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined); + + var isLetOrConst = + symbol && + (symbol.flags & SymbolFlags.BlockScopedVariable) && + symbol.valueDeclaration.parent.kind !== SyntaxKind.CatchClause; + + if (isLetOrConst) { + // side-effect of calling this method: + // assign id to symbol if it was not yet set + getSymbolLinks(symbol); + return symbol.id; + } + return undefined; + } + function createResolver(): EmitResolver { return { getGeneratedNameForNode, @@ -10707,6 +10952,7 @@ module ts { isEntityNameVisible, getConstantValue, isUnknownIdentifier, + getBlockScopedVariableId, }; } @@ -10730,7 +10976,7 @@ module ts { globals[undefinedSymbol.name] = undefinedSymbol; // Initialize special types globalArraySymbol = getGlobalTypeSymbol("Array"); - globalArrayType = getTypeOfGlobalSymbol(globalArraySymbol, 1); + globalArrayType = getTypeOfGlobalSymbol(globalArraySymbol, /*arity*/ 1); globalObjectType = getGlobalType("Object"); globalFunctionType = getGlobalType("Function"); globalStringType = getGlobalType("String"); @@ -10744,6 +10990,7 @@ module ts { globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray"); globalESSymbolType = getGlobalType("Symbol"); globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol"); + globalIterableType = getGlobalType("Iterable", /*arity*/ 1); } else { globalTemplateStringsArrayType = unknownType; @@ -11250,16 +11497,6 @@ module ts { return false; } - function checkGrammarForOfStatement(forOfStatement: ForOfStatement): boolean { - // Temporarily disallow for-of statements until type check work is complete. - return grammarErrorOnFirstToken(forOfStatement, Diagnostics.for_of_statements_are_not_currently_supported); - if (languageVersion < ScriptTarget.ES6) { - return grammarErrorOnFirstToken(forOfStatement, Diagnostics.for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher); - } - - return checkGrammarForInOrForOfStatement(forOfStatement); - } - function checkGrammarAccessor(accessor: MethodDeclaration): boolean { var kind = accessor.kind; if (languageVersion < ScriptTarget.ES5) { @@ -11434,17 +11671,19 @@ module ts { } function checkGrammarVariableDeclaration(node: VariableDeclaration) { - if (isInAmbientContext(node)) { - if (isBindingPattern(node.name)) { - return grammarErrorOnNode(node, Diagnostics.Destructuring_declarations_are_not_allowed_in_ambient_contexts); + if (node.parent.parent.kind !== SyntaxKind.ForInStatement && node.parent.parent.kind !== SyntaxKind.ForOfStatement) { + if (isInAmbientContext(node)) { + if (isBindingPattern(node.name)) { + return grammarErrorOnNode(node, Diagnostics.Destructuring_declarations_are_not_allowed_in_ambient_contexts); + } + if (node.initializer) { + // Error on equals token which immediate precedes the initializer + var equalsTokenLength = "=".length; + return grammarErrorAtPos(getSourceFileOfNode(node), node.initializer.pos - equalsTokenLength, + equalsTokenLength, Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); + } } - if (node.initializer) { - // Error on equals token which immediate precedes the initializer - return grammarErrorAtPos(getSourceFileOfNode(node), node.initializer.pos - 1, 1, Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); - } - } - else { - if (!node.initializer) { + else if (!node.initializer) { if (isBindingPattern(node.name) && !isBindingPattern(node.parent)) { return grammarErrorOnNode(node, Diagnostics.A_destructuring_declaration_must_have_an_initializer); } @@ -11490,15 +11729,6 @@ module ts { if (!declarationList.declarations.length) { return grammarErrorAtPos(getSourceFileOfNode(declarationList), declarations.pos, declarations.end - declarations.pos, Diagnostics.Variable_declaration_list_cannot_be_empty); } - - if (languageVersion < ScriptTarget.ES6) { - if (isLet(declarationList)) { - return grammarErrorOnFirstToken(declarationList, Diagnostics.let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher); - } - else if (isConst(declarationList)) { - return grammarErrorOnFirstToken(declarationList, Diagnostics.const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher); - } - } } function allowLetAndConstDeclarations(parent: Node): boolean { @@ -11621,10 +11851,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/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 9169a7bf68..758c3ee6ba 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." }, @@ -327,6 +328,13 @@ module ts { for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 2482, category: DiagnosticCategory.Error, key: "'for...of' statements are only available when targeting ECMAScript 6 or higher." }, The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: DiagnosticCategory.Error, key: "Export declaration conflicts with exported declaration of '{0}'" }, + The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { code: 2485, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." }, + The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant: { code: 2486, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...in' statement cannot be a previously defined constant." }, + Invalid_left_hand_side_in_for_of_statement: { code: 2487, category: DiagnosticCategory.Error, key: "Invalid left-hand side in 'for...of' statement." }, + The_right_hand_side_of_a_for_of_statement_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: DiagnosticCategory.Error, key: "The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator." }, + The_iterator_returned_by_the_right_hand_side_of_a_for_of_statement_must_have_a_next_method: { code: 2489, category: DiagnosticCategory.Error, key: "The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method." }, + The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: DiagnosticCategory.Error, key: "The type returned by the 'next()' method of an iterator must have a 'value' property." }, + The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { code: 2491, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -396,6 +404,7 @@ module ts { Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using private name '{1}'." }, Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: DiagnosticCategory.Error, key: "Exported type alias '{0}' has or is using private name '{1}'." }, + Loop_contains_block_scoped_variable_0_referenced_by_a_function_in_the_loop_This_is_only_supported_in_ECMAScript_6_or_higher: { code: 4091, category: DiagnosticCategory.Error, key: "Loop contains block-scoped variable '{0}' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher." }, The_current_host_does_not_support_the_0_option: { code: 5001, category: DiagnosticCategory.Error, key: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: DiagnosticCategory.Error, key: "Cannot find the common subdirectory path for the input files." }, Cannot_read_file_0_Colon_1: { code: 5012, category: DiagnosticCategory.Error, key: "Cannot read file '{0}': {1}" }, @@ -472,6 +481,5 @@ module ts { yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." }, Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported." }, The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." }, - for_of_statements_are_not_currently_supported: { code: 9003, category: DiagnosticCategory.Error, key: "'for...of' statements are not currently supported." }, }; } \ No newline at end of file diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 38a67dc6ed..b4786bb93d 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", @@ -1300,6 +1304,34 @@ "category": "Error", "code": 2484 }, + "The left-hand side of a 'for...of' statement cannot be a previously defined constant.": { + "category": "Error", + "code": 2485 + }, + "The left-hand side of a 'for...in' statement cannot be a previously defined constant.": { + "category": "Error", + "code": 2486 + }, + "Invalid left-hand side in 'for...of' statement.": { + "category": "Error", + "code": 2487 + }, + "The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator.": { + "category": "Error", + "code": 2488 + }, + "The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method.": { + "category": "Error", + "code": 2489 + }, + "The type returned by the 'next()' method of an iterator must have a 'value' property.": { + "category": "Error", + "code": 2490 + }, + "The left-hand side of a 'for...in' statement cannot be a destructuring pattern.": { + "category": "Error", + "code": 2491 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", @@ -1576,7 +1608,11 @@ "Exported type alias '{0}' has or is using private name '{1}'.": { "category": "Error", "code": 4081 - }, + }, + "Loop contains block-scoped variable '{0}' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher.": { + "category": "Error", + "code": 4091 + }, "The current host does not support the '{0}' option.": { "category": "Error", "code": 5001 @@ -1881,9 +1917,5 @@ "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.": { "category": "Error", "code": 9002 - }, - "'for...of' statements are not currently supported.": { - "category": "Error", - "code": 9003 } } diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 4f2f62fa47..c4f7c79939 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -28,9 +28,10 @@ module ts { typeName?: DeclarationName; } - interface SynthesizedNode extends Node { - leadingCommentRanges?: CommentRange[]; - trailingCommentRanges?: CommentRange[]; + // represents one LexicalEnvironment frame to store unique generated names + interface ScopeFrame { + names: Map; + previous: ScopeFrame; } type GetSymbolAccessibilityDiagnostic = (symbolAccesibilityResult: SymbolAccessiblityResult) => SymbolAccessibilityDiagnostic; @@ -369,7 +370,6 @@ module ts { var enclosingDeclaration: Node; var currentSourceFile: SourceFile; var reportedDeclarationError = false; - var emitJsDocComments = compilerOptions.removeComments ? function (declaration: Node) { } : writeJsDocComments; var emit = compilerOptions.stripInternal ? stripInternal : emitNode; @@ -1574,6 +1574,11 @@ module ts { var currentSourceFile: SourceFile; + var lastFrame: ScopeFrame; + var currentScopeNames: Map; + + var generatedBlockScopeNames: string[]; + var extendsEmitted = false; var tempCount = 0; var tempVariables: Identifier[]; @@ -1648,6 +1653,50 @@ module ts { writeEmittedFiles(writer.getText(), /*writeByteOrderMark*/ compilerOptions.emitBOM); return; + // enters the new lexical environment + // return value should be passed to matching call to exitNameScope. + function enterNameScope(): boolean { + var names = currentScopeNames; + currentScopeNames = undefined; + if (names) { + lastFrame = { names, previous: lastFrame }; + return true; + } + return false; + } + + function exitNameScope(popFrame: boolean): void { + if (popFrame) { + currentScopeNames = lastFrame.names; + lastFrame = lastFrame.previous; + } + else { + currentScopeNames = undefined; + } + } + + function generateUniqueNameForLocation(location: Node, baseName: string): string { + var name: string + // first try to check if base name can be used as is + if (!isExistingName(location, baseName)) { + name = baseName; + } + else { + name = generateUniqueName(baseName, n => isExistingName(location, n)); + } + + if (!currentScopeNames) { + currentScopeNames = {}; + } + + return currentScopeNames[name] = name; + } + + function isExistingName(location: Node, name: string) { + return !resolver.isUnknownIdentifier(location, name) || + (currentScopeNames && hasProperty(currentScopeNames, name)); + } + function initializeEmitterWithSourceMaps() { var sourceMapDir: string; // The directory in which sourcemap will be @@ -2014,14 +2063,14 @@ module ts { function createTempVariable(location: Node, forLoopVariable?: boolean): Identifier { var name = forLoopVariable ? "_i" : undefined; while (true) { - if (name && resolver.isUnknownIdentifier(location, name)) { + if (name && !isExistingName(location, name)) { break; } // _a .. _h, _j ... _z, _0, _1, ... name = "_" + (tempCount < 25 ? String.fromCharCode(tempCount + (tempCount < 8 ? 0 : 1) + CharacterCodes.a) : tempCount - 25); tempCount++; } - var result = createNode(SyntaxKind.Identifier); + var result = createSynthesizedNode(SyntaxKind.Identifier); result.text = name; return result; } @@ -2072,7 +2121,7 @@ module ts { } } - function emitParenthesized(node: Node, parenthesized: boolean) { + function emitParenthesizedIf(node: Node, parenthesized: boolean) { if (parenthesized) { write("("); } @@ -2205,6 +2254,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 @@ -2249,7 +2364,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. @@ -2394,8 +2510,6 @@ module ts { return false; case SyntaxKind.LabeledStatement: return (node.parent).label === node; - case SyntaxKind.CatchClause: - return (node.parent).name === node; } } @@ -2409,7 +2523,20 @@ module ts { } } + function getBlockScopedVariableId(node: Identifier): number { + // return undefined for synthesized nodes + return !nodeIsSynthesized(node) && resolver.getBlockScopedVariableId(node); + } + function emitIdentifier(node: Identifier) { + var variableId = getBlockScopedVariableId(node); + if (variableId !== undefined && generatedBlockScopeNames) { + var text = generatedBlockScopeNames[variableId]; + if (text) { + write(text); + return; + } + } if (!node.parent) { write(node.text); } @@ -2479,7 +2606,7 @@ module ts { emit((node).expression); } - function needsParenthesisForPropertyAccess(node: Expression) { + function needsParenthesisForPropertyAccessOrInvocation(node: Expression) { switch (node.kind) { case SyntaxKind.Identifier: case SyntaxKind.ArrayLiteralExpression: @@ -2509,7 +2636,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 { @@ -2555,14 +2682,6 @@ module ts { } } - function createSynthesizedNode(kind: SyntaxKind): Node { - var node = createNode(kind); - node.pos = -1; - node.end = -1; - - return node; - } - function emitDownlevelObjectLiteralWithComputedProperties(node: ObjectLiteralExpression, firstComputedPropertyIndex: number): void { var parenthesizedObjectLiteral = createDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex); return emit(parenthesizedObjectLiteral); @@ -2596,7 +2715,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); @@ -2619,7 +2738,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) { @@ -2692,8 +2811,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; @@ -2748,8 +2867,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; @@ -2985,9 +3104,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) { @@ -3088,9 +3212,11 @@ module ts { write(tokenToString(node.operatorToken.kind)); + var shouldPlaceOnNewLine = !nodeIsSynthesized(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. - if (!nodeEndIsOnSameLineAsNodeStart(node.operatorToken, node.right)) { + if (shouldPlaceOnNewLine || synthesizedNodeStartsOnNewLine(node.right)) { increaseIndent(); writeLine(); emit(node.right); @@ -3103,6 +3229,10 @@ module ts { } } + function synthesizedNodeStartsOnNewLine(node: Node) { + return nodeIsSynthesized(node) && (node).startsOnNewLine; + } + function emitConditionalExpression(node: ConditionalExpression) { emit(node.condition); write(" ? "); @@ -3157,7 +3287,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(";"); } @@ -3202,6 +3332,32 @@ module ts { emitEmbeddedStatement(node.statement); } + function emitStartOfVariableDeclarationList(decl: Node, startPos?: number): void { + var tokenKind = SyntaxKind.VarKeyword; + if (decl && languageVersion >= ScriptTarget.ES6) { + if (isLet(decl)) { + tokenKind = SyntaxKind.LetKeyword; + } + else if (isConst(decl)) { + tokenKind = SyntaxKind.ConstKeyword; + } + } + + if (startPos !== undefined) { + emitToken(tokenKind, startPos); + } + else { + switch (tokenKind) { + case SyntaxKind.VarKeyword: + return write("var "); + case SyntaxKind.LetKeyword: + return write("let "); + case SyntaxKind.ConstKeyword: + return write("const "); + } + } + } + function emitForStatement(node: ForStatement) { var endPos = emitToken(SyntaxKind.ForKeyword, node.pos); write(" "); @@ -3209,17 +3365,9 @@ module ts { if (node.initializer && node.initializer.kind === SyntaxKind.VariableDeclarationList) { var variableDeclarationList = node.initializer; var declarations = variableDeclarationList.declarations; - if (declarations[0] && isLet(declarations[0])) { - emitToken(SyntaxKind.LetKeyword, endPos); - } - else if (declarations[0] && isConst(declarations[0])) { - emitToken(SyntaxKind.ConstKeyword, endPos); - } - else { - emitToken(SyntaxKind.VarKeyword, endPos); - } + emitStartOfVariableDeclarationList(declarations[0], endPos); write(" "); - emitCommaList(variableDeclarationList.declarations); + emitCommaList(declarations); } else if (node.initializer) { emit(node.initializer); @@ -3240,12 +3388,7 @@ module ts { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { var decl = variableDeclarationList.declarations[0]; - if (isLet(decl)) { - emitToken(SyntaxKind.LetKeyword, endPos); - } - else { - emitToken(SyntaxKind.VarKeyword, endPos); - } + emitStartOfVariableDeclarationList(decl, endPos); write(" "); emit(decl); } @@ -3356,8 +3499,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); } @@ -3394,6 +3537,14 @@ module ts { emitNode(node.name); emitEnd(node.name); } + + function createVoidZero(): Expression { + var zero = createSynthesizedNode(SyntaxKind.NumericLiteral); + zero.text = "0"; + var result = createSynthesizedNode(SyntaxKind.VoidExpression); + result.expression = zero; + return result; + } function emitExportMemberAssignments(name: Identifier) { if (exportSpecifiers && hasProperty(exportSpecifiers, name.text)) { @@ -3427,6 +3578,8 @@ module ts { if (emitCount++) { write(", "); } + + renameNonTopLevelLetAndConst(name); if (name.parent && (name.parent.kind === SyntaxKind.VariableDeclaration || name.parent.kind === SyntaxKind.BindingElement)) { emitModuleMemberName(name.parent); } @@ -3449,24 +3602,16 @@ module ts { return expr; } - function createVoidZero(): Expression { - var zero = createNode(SyntaxKind.NumericLiteral); - zero.text = "0"; - var result = createNode(SyntaxKind.VoidExpression); - result.expression = zero; - return result; - } - function createDefaultValueCheck(value: Expression, defaultValue: Expression): Expression { // The value expression will be evaluated twice, so for anything but a simple identifier // we need to generate a temporary variable value = ensureIdentifier(value); // Return the expression 'value === void 0 ? defaultValue : value' - var equals = createNode(SyntaxKind.BinaryExpression); + var equals = createSynthesizedNode(SyntaxKind.BinaryExpression); equals.left = value; - equals.operatorToken = createNode(SyntaxKind.EqualsEqualsEqualsToken); + equals.operatorToken = createSynthesizedNode(SyntaxKind.EqualsEqualsEqualsToken); equals.right = createVoidZero(); - var cond = createNode(SyntaxKind.ConditionalExpression); + var cond = createSynthesizedNode(SyntaxKind.ConditionalExpression); cond.condition = equals; cond.whenTrue = defaultValue; cond.whenFalse = value; @@ -3474,7 +3619,7 @@ module ts { } function createNumericLiteral(value: number) { - var node = createNode(SyntaxKind.NumericLiteral); + var node = createSynthesizedNode(SyntaxKind.NumericLiteral); node.text = "" + value; return node; } @@ -3483,7 +3628,7 @@ module ts { if (expr.kind === SyntaxKind.Identifier || expr.kind === SyntaxKind.PropertyAccessExpression || expr.kind === SyntaxKind.ElementAccessExpression) { return expr; } - var node = createNode(SyntaxKind.ParenthesizedExpression); + var node = createSynthesizedNode(SyntaxKind.ParenthesizedExpression); node.expression = expr; return node; } @@ -3492,14 +3637,14 @@ module ts { if (propName.kind !== SyntaxKind.Identifier) { return createElementAccess(object, propName); } - var node = createNode(SyntaxKind.PropertyAccessExpression); + var node = createSynthesizedNode(SyntaxKind.PropertyAccessExpression); node.expression = parenthesizeForAccess(object); node.name = propName; return node; } function createElementAccess(object: Expression, index: Expression): Expression { - var node = createNode(SyntaxKind.ElementAccessExpression); + var node = createSynthesizedNode(SyntaxKind.ElementAccessExpression); node.expression = parenthesizeForAccess(object); node.argumentExpression = index; return node; @@ -3638,8 +3783,31 @@ module ts { } } else { + var isLet = renameNonTopLevelLetAndConst(node.name); emitModuleMemberName(node); - emitOptional(" = ", node.initializer); + + var initializer = node.initializer; + if (!initializer && languageVersion < ScriptTarget.ES6) { + + // downlevel emit for non-initialized let bindings defined in loops + // for (...) { let x; } + // should be + // for (...) { var = void 0; } + // this is necessary to preserve ES6 semantic in scenarios like + // for (...) { let x; console.log(x); x = 1 } // assignment on one iteration should not affect other iterations + var isUninitializedLet = + (resolver.getNodeCheckFlags(node) & NodeCheckFlags.BlockScopedBindingInLoop) && + (getCombinedFlagsForIdentifier(node.name) & NodeFlags.Let); + + // NOTE: default initialization should not be added to let bindings in for-in\for-of statements + if (isUninitializedLet && + node.parent.parent.kind !== SyntaxKind.ForInStatement && + node.parent.parent.kind !== SyntaxKind.ForOfStatement) { + initializer = createVoidZero(); + } + } + + emitOptional(" = ", initializer); } } @@ -3652,18 +3820,86 @@ module ts { forEach((name).elements, emitExportVariableAssignments); } } + + function getEnclosingBlockScopeContainer(node: Node): Node { + var current = node; + while (current) { + if (isAnyFunction(current)) { + return current; + } + switch (current.kind) { + case SyntaxKind.SourceFile: + case SyntaxKind.SwitchKeyword: + case SyntaxKind.CatchClause: + case SyntaxKind.ModuleDeclaration: + case SyntaxKind.ForStatement: + case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: + return current; + case SyntaxKind.Block: + // function block is not considered block-scope container + // see comment in binder.ts: bind(...), case for SyntaxKind.Block + if (!isAnyFunction(current.parent)) { + return current; + } + } + + current = current.parent; + } + } + + + function getCombinedFlagsForIdentifier(node: Identifier): NodeFlags { + if (!node.parent || (node.parent.kind !== SyntaxKind.VariableDeclaration && node.parent.kind !== SyntaxKind.BindingElement)) { + return 0; + } + + return getCombinedNodeFlags(node.parent); + } + + function renameNonTopLevelLetAndConst(node: Node): void { + // do not rename if + // - language version is ES6+ + // - node is synthesized + // - node is not identifier (can happen when tree is malformed) + // - node is definitely not name of variable declaration. + // it still can be part of parameter declaration, this check will be done next + if (languageVersion >= ScriptTarget.ES6 || + nodeIsSynthesized(node) || + node.kind !== SyntaxKind.Identifier || + (node.parent.kind !== SyntaxKind.VariableDeclaration && node.parent.kind !== SyntaxKind.BindingElement)) { + return; + } + + var combinedFlags = getCombinedFlagsForIdentifier(node); + if (((combinedFlags & NodeFlags.BlockScoped) === 0) || combinedFlags & NodeFlags.Export) { + // do not rename exported or non-block scoped variables + return; + } + + // here it is known that node is a block scoped variable + var list = getAncestor(node, SyntaxKind.VariableDeclarationList); + if (list.parent.kind === SyntaxKind.VariableStatement && list.parent.parent.kind === SyntaxKind.SourceFile) { + // do not rename variables that are defined on source file level + return; + } + + var blockScopeContainer = getEnclosingBlockScopeContainer(node); + var parent = blockScopeContainer.kind === SyntaxKind.SourceFile + ? blockScopeContainer + : blockScopeContainer.parent; + + var generatedName = generateUniqueNameForLocation(parent, (node).text); + var variableId = resolver.getBlockScopedVariableId(node); + if (!generatedBlockScopeNames) { + generatedBlockScopeNames = []; + } + generatedBlockScopeNames[variableId] = generatedName; + } function emitVariableStatement(node: VariableStatement) { if (!(node.flags & NodeFlags.Export)) { - if (isLet(node.declarationList)) { - write("let "); - } - else if (isConst(node.declarationList)) { - write("const "); - } - else { - write("var "); - } + emitStartOfVariableDeclarationList(node.declarationList); } emitCommaList(node.declarationList.declarations); write(";"); @@ -3840,6 +4076,8 @@ module ts { tempVariables = undefined; tempParameters = undefined; + var popFrame = enterNameScope() + // When targeting ES6, emit arrow function natively in ES6 if (shouldEmitAsArrowFunction(node)) { emitSignatureParametersForArrow(node); @@ -3871,6 +4109,8 @@ module ts { write(";"); } + exitNameScope(popFrame); + tempCount = saveTempCount; tempVariables = saveTempVariables; tempParameters = saveTempParameters; @@ -4192,6 +4432,9 @@ module ts { tempCount = 0; tempVariables = undefined; tempParameters = undefined; + + var popFrame = enterNameScope(); + // Emit the constructor overload pinned comments forEach(node.members, member => { if (member.kind === SyntaxKind.Constructor && !(member).body) { @@ -4252,6 +4495,9 @@ module ts { if (ctor) { emitTrailingComments(ctor); } + + exitNameScope(popFrame); + tempCount = saveTempCount; tempVariables = saveTempVariables; tempParameters = saveTempParameters; @@ -4384,7 +4630,11 @@ module ts { var saveTempVariables = tempVariables; tempCount = 0; tempVariables = undefined; + var popFrame = enterNameScope(); + emit(node.body); + + exitNameScope(popFrame); tempCount = saveTempCount; tempVariables = saveTempVariables; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 9dc8a47552..ff22f857ca 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 a8e5b0b3a7..88ab2825fd 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) { diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index a3755650ae..57c2298d3d 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 a81da0eaf7..27535f41e4 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; } @@ -1204,6 +1204,7 @@ module ts { // Returns the constant value this property access resolves to, or 'undefined' for a non-constant getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; isUnknownIdentifier(location: Node, name: string): boolean; + getBlockScopedVariableId(node: Identifier): number; } export const enum SymbolFlags { @@ -1329,6 +1330,7 @@ module ts { // Values for enum members have been computed, and any errors have been reported for them. EnumValuesComputed = 0x00000080, + BlockScopedBindingInLoop = 0x00000100, } export interface NodeLinks { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index b53c000724..736d5454c9 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -7,6 +7,12 @@ module ts { isNoDefaultLib?: boolean } + export interface SynthesizedNode extends Node { + leadingCommentRanges?: CommentRange[]; + trailingCommentRanges?: CommentRange[]; + startsOnNewLine: boolean; + } + export function getDeclarationOfKind(symbol: Symbol, kind: SyntaxKind): Declaration { var declarations = symbol.declarations; for (var i = 0; i < declarations.length; i++) { @@ -192,6 +198,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. @@ -665,7 +683,7 @@ module ts { } export function isBindingPattern(node: Node) { - return node.kind === SyntaxKind.ArrayBindingPattern || node.kind === SyntaxKind.ObjectBindingPattern; + return !!node && (node.kind === SyntaxKind.ArrayBindingPattern || node.kind === SyntaxKind.ObjectBindingPattern); } export function isInAmbientContext(node: Node): boolean { @@ -681,31 +699,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,7 +759,7 @@ 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; } @@ -751,14 +771,10 @@ module ts { } } - if (isDeclaration(parent) || parent.kind === SyntaxKind.FunctionExpression) { + if (isDeclaration(parent)) { return (parent).name === name; } - if (parent.kind === SyntaxKind.CatchClause) { - return (parent).name === name; - } - return false; } @@ -1123,7 +1139,44 @@ module ts { return createTextChangeRange(createTextSpanFromBounds(oldStartN, oldEndN), /*newLength: */newEndN - oldStartN); } - // @internal + export function nodeStartsNewLexicalEnvironment(n: Node): boolean { + return isAnyFunction(n) || n.kind === SyntaxKind.ModuleDeclaration || n.kind === SyntaxKind.SourceFile; + } + + export function nodeIsSynthesized(node: Node): boolean { + return node.pos === -1 && node.end === -1; + } + + export function createSynthesizedNode(kind: SyntaxKind, startsOnNewLine?: boolean): Node { + var node = createNode(kind); + node.pos = -1; + node.end = -1; + node.startsOnNewLine = startsOnNewLine; + return node; + } + + export function generateUniqueName(baseName: string, isExistingName: (name: string) => boolean): string { + // First try '_name' + if (baseName.charCodeAt(0) !== CharacterCodes._) { + var baseName = "_" + baseName; + if (!isExistingName(baseName)) { + return baseName; + } + } + // Find the first unique '_name_n', where n is a positive number + if (baseName.charCodeAt(baseName.length - 1) !== CharacterCodes._) { + baseName += "_"; + } + var i = 1; + while (true) { + var name = baseName + i; + if (!isExistingName(name)) { + return name; + } + i++; + } + } + export function createDiagnosticCollection(): DiagnosticCollection { var nonFileDiagnostics: Diagnostic[] = []; var fileDiagnostics: Map = {}; diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index a9c28fb70b..4206f16bab 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -1,4 +1,4 @@ -/// +/// /// /// /// diff --git a/src/services/services.ts b/src/services/services.ts index 58c1d08110..fc4d1eff22 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -58,9 +58,10 @@ module ts { } export interface SourceFile { - version: string; - scriptSnapshot: IScriptSnapshot; - nameTable: Map; + /* @internal */ version: string; + /* @internal */ scriptSnapshot: IScriptSnapshot; + /* @internal */ nameTable: Map; + getNamedDeclarations(): Declaration[]; getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; @@ -1270,31 +1271,21 @@ module ts { /** * Request an updated version of an already existing SourceFile with a given fileName - * and compilationSettings. The update will intern call updateLanguageServiceSourceFile + * and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile * to get an updated SourceFile. * - * Note: It is not allowed to call update on a SourceFile that was not acquired from this - * registry originally. - * - * @param sourceFile The original sourceFile object to update * @param fileName The name of the file requested * @param compilationSettings Some compilation settings like target affects the * shape of a the resulting SourceFile. This allows the DocumentRegistry to store * multiple copies of the same file for different compilation settings. - * @parm scriptSnapshot Text of the file. Only used if the file was not found - * in the registry and a new one was created. - * @parm version Current version of the file. Only used if the file was not found - * in the registry and a new one was created. - * @parm textChangeRange Change ranges since the last snapshot. Only used if the file - * was not found in the registry and a new one was created. + * @param scriptSnapshot Text of the file. + * @param version Current version of the file. */ updateDocument( - sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, - version: string, - textChangeRange: TextChangeRange): SourceFile; + version: string): SourceFile; /** * Informs the DocumentRegistry that a file is not needed any longer. @@ -1442,7 +1433,11 @@ module ts { interface DocumentRegistryEntry { sourceFile: SourceFile; - refCount: number; + + // The number of language services that this source file is referenced in. When no more + // language services are referencing the file, then the file can be removed from the + // registry. + languageServiceRefCount: number; owners: string[]; } @@ -1671,6 +1666,8 @@ module ts { } export function createDocumentRegistry(): DocumentRegistry { + // Maps from compiler setting target (ES3, ES5, etc.) to all the cached documents we have + // for those settings. var buckets: Map> = {}; function getKeyFromCompilationSettings(settings: CompilerOptions): string { @@ -1694,7 +1691,7 @@ module ts { var entry = entries[i]; sourceFiles.push({ name: i, - refCount: entry.refCount, + refCount: entry.languageServiceRefCount, references: entry.owners.slice(0) }); } @@ -1707,43 +1704,54 @@ module ts { return JSON.stringify(bucketInfoArray, null, 2); } - function acquireDocument( - fileName: string, - compilationSettings: CompilerOptions, - scriptSnapshot: IScriptSnapshot, - version: string): SourceFile { - - var bucket = getBucketForCompilationSettings(compilationSettings, /*createIfMissing*/ true); - var entry = lookUp(bucket, fileName); - if (!entry) { - var sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, /*setNodeParents:*/ false); - - bucket[fileName] = entry = { - sourceFile: sourceFile, - refCount: 0, - owners: [] - }; - } - entry.refCount++; - - return entry.sourceFile; + function acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile { + return acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, /*acquiring:*/ true); } - function updateDocument( - sourceFile: SourceFile, + function updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile { + return acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, /*acquiring:*/ false); + } + + function acquireOrUpdateDocument( fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, - textChangeRange: TextChangeRange - ): SourceFile { + acquiring: boolean): SourceFile { - var bucket = getBucketForCompilationSettings(compilationSettings, /*createIfMissing*/ false); - Debug.assert(bucket !== undefined); + var bucket = getBucketForCompilationSettings(compilationSettings, /*createIfMissing*/ true); var entry = lookUp(bucket, fileName); - Debug.assert(entry !== undefined); + if (!entry) { + Debug.assert(acquiring, "How could we be trying to update a document that the registry doesn't have?"); + + // Have never seen this file with these settings. Create a new source file for it. + var sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, /*setNodeParents:*/ false); + + bucket[fileName] = entry = { + sourceFile: sourceFile, + languageServiceRefCount: 0, + owners: [] + }; + } + else { + // We have an entry for this file. However, it may be for a different version of + // the script snapshot. If so, update it appropriately. Otherwise, we can just + // return it as is. + if (entry.sourceFile.version !== version) { + entry.sourceFile = updateLanguageServiceSourceFile(entry.sourceFile, scriptSnapshot, version, + scriptSnapshot.getChangeRange(entry.sourceFile.scriptSnapshot)); + } + } + + // If we're acquiring, then this is the first time this LS is asking for this document. + // Increase our ref count so we know there's another LS using the document. If we're + // not acquiring, then that means the LS is 'updating' the file instead, and that means + // it has already acquired the document previously. As such, we do not need to increase + // the ref count. + if (acquiring) { + entry.languageServiceRefCount++; + } - entry.sourceFile = updateLanguageServiceSourceFile(entry.sourceFile, scriptSnapshot, version, textChangeRange); return entry.sourceFile; } @@ -1752,10 +1760,10 @@ module ts { Debug.assert(bucket !== undefined); var entry = lookUp(bucket, fileName); - entry.refCount--; + entry.languageServiceRefCount--; - Debug.assert(entry.refCount >= 0); - if (entry.refCount === 0) { + Debug.assert(entry.languageServiceRefCount >= 0); + if (entry.languageServiceRefCount === 0) { delete bucket[fileName]; } } @@ -1788,33 +1796,140 @@ module ts { }); } + function recordModuleName() { + var importPath = scanner.getTokenValue(); + var pos = scanner.getTokenPos(); + importedFiles.push({ + fileName: importPath, + pos: pos, + end: pos + importPath.length + }); + } + function processImport(): void { scanner.setText(sourceText); var token = scanner.scan(); // Look for: - // import foo = module("foo"); + // import "mod"; + // import d from "mod" + // import {a as A } from "mod"; + // import * as NS from "mod" + // import d, {a, b as B} from "mod" + // import i = require("mod"); + // + // export * from "mod" + // export {a as b} from "mod" + while (token !== SyntaxKind.EndOfFileToken) { if (token === SyntaxKind.ImportKeyword) { token = scanner.scan(); - if (token === SyntaxKind.Identifier) { - token = scanner.scan(); - if (token === SyntaxKind.EqualsToken) { + if (token === SyntaxKind.StringLiteral) { + // import "mod"; + recordModuleName(); + continue; + } + else { + if (token === SyntaxKind.Identifier) { token = scanner.scan(); - if (token === SyntaxKind.RequireKeyword) { + if (token === SyntaxKind.FromKeyword) { token = scanner.scan(); - if (token === SyntaxKind.OpenParenToken) { + if (token === SyntaxKind.StringLiteral) { + // import d from "mod"; + recordModuleName(); + continue + } + } + else if (token === SyntaxKind.EqualsToken) { + token = scanner.scan(); + if (token === SyntaxKind.RequireKeyword) { token = scanner.scan(); - if (token === SyntaxKind.StringLiteral) { - var importPath = scanner.getTokenValue(); - var pos = scanner.getTokenPos(); - importedFiles.push({ - fileName: importPath, - pos: pos, - end: pos + importPath.length - }); + if (token === SyntaxKind.OpenParenToken) { + token = scanner.scan(); + if (token === SyntaxKind.StringLiteral) { + // import i = require("mod"); + recordModuleName(); + continue; + } } } } + else if (token === SyntaxKind.CommaToken) { + // consume comma and keep going + token = scanner.scan(); + } + else { + // unknown syntax + continue; + } + } + + if (token === SyntaxKind.OpenBraceToken) { + token = scanner.scan(); + // consume "{ a as B, c, d as D}" clauses + while (token !== SyntaxKind.CloseBraceToken) { + token = scanner.scan(); + } + + if (token === SyntaxKind.CloseBraceToken) { + token = scanner.scan(); + if (token === SyntaxKind.FromKeyword) { + token = scanner.scan(); + if (token === SyntaxKind.StringLiteral) { + // import {a as A} from "mod"; + // import d, {a, b as B} from "mod" + recordModuleName(); + } + } + } + } + else if (token === SyntaxKind.AsteriskToken) { + token = scanner.scan(); + if (token === SyntaxKind.AsKeyword) { + token = scanner.scan(); + if (token === SyntaxKind.Identifier) { + token = scanner.scan(); + if (token === SyntaxKind.FromKeyword) { + token = scanner.scan(); + if (token === SyntaxKind.StringLiteral) { + // import * as NS from "mod" + // import d, * as NS from "mod" + recordModuleName(); + } + } + } + } + } + } + } + else if (token === SyntaxKind.ExportKeyword) { + token = scanner.scan(); + if (token === SyntaxKind.OpenBraceToken) { + token = scanner.scan(); + // consume "{ a as B, c, d as D}" clauses + while (token !== SyntaxKind.CloseBraceToken) { + token = scanner.scan(); + } + + if (token === SyntaxKind.CloseBraceToken) { + token = scanner.scan(); + if (token === SyntaxKind.FromKeyword) { + token = scanner.scan(); + if (token === SyntaxKind.StringLiteral) { + // export {a as A} from "mod"; + // export {a, b as B} from "mod" + recordModuleName(); + } + } + } + } + else if (token === SyntaxKind.AsteriskToken) { + token = scanner.scan(); + if (token === SyntaxKind.FromKeyword) { + token = scanner.scan(); + if (token === SyntaxKind.StringLiteral) { + // export * from "mod" + recordModuleName(); + } } } } @@ -2162,19 +2277,34 @@ module ts { // it is safe to reuse the souceFiles; if not, then the shape of the AST can change, and the oldSourceFile // can not be reused. we have to dump all syntax trees and create new ones. if (!changesInCompilationSettingsAffectSyntax) { - // Check if the old program had this file already var oldSourceFile = program && program.getSourceFile(fileName); if (oldSourceFile) { - // This SourceFile is safe to reuse, return it - if (sourceFileUpToDate(oldSourceFile)) { - return oldSourceFile; - } - - // We have an older version of the sourceFile, incrementally parse the changes - var textChangeRange = hostFileInformation.scriptSnapshot.getChangeRange(oldSourceFile.scriptSnapshot); - return documentRegistry.updateDocument(oldSourceFile, fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version, textChangeRange); + // We already had a source file for this file name. Go to the registry to + // ensure that we get the right up to date version of it. We need this to + // address the following 'race'. Specifically, say we have the following: + // + // LS1 + // \ + // DocumentRegistry + // / + // LS2 + // + // Each LS has a reference to file 'foo.ts' at version 1. LS2 then updates + // it's version of 'foo.ts' to version 2. This will cause LS2 and the + // DocumentRegistry to have version 2 of the document. HOwever, LS1 will + // have version 1. And *importantly* this source file will be *corrupt*. + // The act of creating version 2 of the file irrevocably damages the version + // 1 file. + // + // So, later when we call into LS1, we need to make sure that it doesn't use + // it's source file any more, and instead defers to DocumentRegistry to get + // either version 1, version 2 (or some other version) depending on what the + // host says should be used. + return documentRegistry.updateDocument(fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version); } + + // We didn't already have the file. Fall through and acquire it from the registry. } // Could not find this file in the old program, create a new SourceFile for it. @@ -2228,8 +2358,8 @@ module ts { function dispose(): void { if (program) { - forEach(program.getSourceFiles(), - (f) => { documentRegistry.releaseDocument(f.fileName, program.getCompilerOptions()); }); + forEach(program.getSourceFiles(), f => + documentRegistry.releaseDocument(f.fileName, program.getCompilerOptions())); } } @@ -4009,27 +4139,6 @@ module ts { return getReferencesForNode(node, program.getSourceFiles(), /*searchOnlyInCurrentFile*/ false, findInStrings, findInComments); } - function initializeNameTable(sourceFile: SourceFile): void { - var nameTable: Map = {}; - - walk(sourceFile); - sourceFile.nameTable = nameTable; - - function walk(node: Node) { - switch (node.kind) { - case SyntaxKind.Identifier: - nameTable[(node).text] = (node).text; - break; - case SyntaxKind.StringLiteral: - case SyntaxKind.NumericLiteral: - nameTable[(node).text] = (node).text; - break; - default: - forEachChild(node, walk); - } - } - } - function getReferencesForNode(node: Node, sourceFiles: SourceFile[], searchOnlyInCurrentFile: boolean, findInStrings: boolean, findInComments: boolean): ReferenceEntry[] { // Labels if (isLabelName(node)) { @@ -4096,13 +4205,9 @@ module ts { forEach(sourceFiles, sourceFile => { cancellationToken.throwIfCancellationRequested(); - if (!sourceFile.nameTable) { - initializeNameTable(sourceFile) - } + var nameTable = getNameTable(sourceFile); - Debug.assert(sourceFile.nameTable !== undefined); - - if (lookUp(sourceFile.nameTable, internedName)) { + if (lookUp(nameTable, internedName)) { result = result || []; getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result); } @@ -4756,7 +4861,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; } @@ -4918,7 +5023,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)) { @@ -5646,6 +5751,52 @@ module ts { }; } + /* @internal */ + export function getNameTable(sourceFile: SourceFile): Map { + if (!sourceFile.nameTable) { + initializeNameTable(sourceFile) + } + + return sourceFile.nameTable; + } + + function initializeNameTable(sourceFile: SourceFile): void { + var nameTable: Map = {}; + + walk(sourceFile); + sourceFile.nameTable = nameTable; + + function walk(node: Node) { + switch (node.kind) { + case SyntaxKind.Identifier: + nameTable[(node).text] = (node).text; + break; + case SyntaxKind.StringLiteral: + case SyntaxKind.NumericLiteral: + // We want to store any numbers/strings if they were a name that could be + // related to a declaration. So, if we have 'import x = require("something")' + // then we want 'something' to be in the name table. Similarly, if we have + // "a['propname']" then we want to store "propname" in the name table. + if (isDeclarationName(node) || + node.parent.kind === SyntaxKind.ExternalModuleReference || + isArgumentOfElementAccessExpression(node)) { + + nameTable[(node).text] = (node).text; + } + break; + default: + forEachChild(node, walk); + } + } + } + + function isArgumentOfElementAccessExpression(node: Node) { + return node && + node.parent && + node.parent.kind === SyntaxKind.ElementAccessExpression && + (node.parent).argumentExpression === node; + } + /// Classifier export function createClassifier(): Classifier { var scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ false); diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index 8b7dea13ea..5c35f87fb2 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -295,8 +295,8 @@ module ts.SignatureHelp { var tagExpression = templateExpression.parent; Debug.assert(templateExpression.kind === SyntaxKind.TemplateExpression); - // If we're just after a template tail, don't show signature help. - if (node.kind === SyntaxKind.TemplateTail && !isInsideTemplateLiteral(node, position)) { + // If we're just after a template tail, don't show signature help. + if (node.kind === SyntaxKind.TemplateTail && !isInsideTemplateLiteral(node, position)) { return undefined; } diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index ba9aced3b2..ca2bb9511a 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 { @@ -941,6 +940,7 @@ declare module "typescript" { isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; isUnknownIdentifier(location: Node, name: string): boolean; + getBlockScopedVariableId(node: Identifier): number; } const enum SymbolFlags { FunctionScopedVariable = 1, @@ -1045,6 +1045,7 @@ declare module "typescript" { SuperStatic = 32, ContextChecked = 64, EnumValuesComputed = 128, + BlockScopedBindingInLoop = 256, } interface NodeLinks { resolvedType?: Type; @@ -1517,9 +1518,6 @@ declare module "typescript" { getDocumentationComment(): SymbolDisplayPart[]; } interface SourceFile { - version: string; - scriptSnapshot: IScriptSnapshot; - nameTable: Map; getNamedDeclarations(): Declaration[]; getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; @@ -1873,25 +1871,17 @@ declare module "typescript" { acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; /** * Request an updated version of an already existing SourceFile with a given fileName - * and compilationSettings. The update will intern call updateLanguageServiceSourceFile + * and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile * to get an updated SourceFile. * - * Note: It is not allowed to call update on a SourceFile that was not acquired from this - * registry originally. - * - * @param sourceFile The original sourceFile object to update * @param fileName The name of the file requested * @param compilationSettings Some compilation settings like target affects the * shape of a the resulting SourceFile. This allows the DocumentRegistry to store * multiple copies of the same file for different compilation settings. - * @parm scriptSnapshot Text of the file. Only used if the file was not found - * in the registry and a new one was created. - * @parm version Current version of the file. Only used if the file was not found - * in the registry and a new one was created. - * @parm textChangeRange Change ranges since the last snapshot. Only used if the file - * was not found in the registry and a new one was created. + * @param scriptSnapshot Text of the file. + * @param version Current version of the file. */ - updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; + updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; /** * Informs the DocumentRegistry that a file is not needed any longer. * diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index 3ad078773d..896290f73c 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 @@ -3063,6 +3059,11 @@ declare module "typescript" { >location : Node >Node : Node >name : string + + getBlockScopedVariableId(node: Identifier): number; +>getBlockScopedVariableId : (node: Identifier) => number +>node : Identifier +>Identifier : Identifier } const enum SymbolFlags { >SymbolFlags : SymbolFlags @@ -3374,6 +3375,9 @@ declare module "typescript" { EnumValuesComputed = 128, >EnumValuesComputed : NodeCheckFlags + + BlockScopedBindingInLoop = 256, +>BlockScopedBindingInLoop : NodeCheckFlags } interface NodeLinks { >NodeLinks : NodeLinks @@ -4892,17 +4896,6 @@ declare module "typescript" { interface SourceFile { >SourceFile : SourceFile - version: string; ->version : string - - scriptSnapshot: IScriptSnapshot; ->scriptSnapshot : IScriptSnapshot ->IScriptSnapshot : IScriptSnapshot - - nameTable: Map; ->nameTable : Map ->Map : Map - getNamedDeclarations(): Declaration[]; >getNamedDeclarations : () => Declaration[] >Declaration : Declaration @@ -5853,36 +5846,24 @@ declare module "typescript" { /** * Request an updated version of an already existing SourceFile with a given fileName - * and compilationSettings. The update will intern call updateLanguageServiceSourceFile + * and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile * to get an updated SourceFile. * - * Note: It is not allowed to call update on a SourceFile that was not acquired from this - * registry originally. - * - * @param sourceFile The original sourceFile object to update * @param fileName The name of the file requested * @param compilationSettings Some compilation settings like target affects the * shape of a the resulting SourceFile. This allows the DocumentRegistry to store * multiple copies of the same file for different compilation settings. - * @parm scriptSnapshot Text of the file. Only used if the file was not found - * in the registry and a new one was created. - * @parm version Current version of the file. Only used if the file was not found - * in the registry and a new one was created. - * @parm textChangeRange Change ranges since the last snapshot. Only used if the file - * was not found in the registry and a new one was created. + * @param scriptSnapshot Text of the file. + * @param version Current version of the file. */ - updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; ->updateDocument : (sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange) => SourceFile ->sourceFile : SourceFile ->SourceFile : SourceFile + updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; +>updateDocument : (fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string) => SourceFile >fileName : string >compilationSettings : CompilerOptions >CompilerOptions : CompilerOptions >scriptSnapshot : IScriptSnapshot >IScriptSnapshot : IScriptSnapshot >version : string ->textChangeRange : TextChangeRange ->TextChangeRange : TextChangeRange >SourceFile : SourceFile /** diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index 54bb4a0dd8..d6177798c7 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 { @@ -972,6 +971,7 @@ declare module "typescript" { isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; isUnknownIdentifier(location: Node, name: string): boolean; + getBlockScopedVariableId(node: Identifier): number; } const enum SymbolFlags { FunctionScopedVariable = 1, @@ -1076,6 +1076,7 @@ declare module "typescript" { SuperStatic = 32, ContextChecked = 64, EnumValuesComputed = 128, + BlockScopedBindingInLoop = 256, } interface NodeLinks { resolvedType?: Type; @@ -1548,9 +1549,6 @@ declare module "typescript" { getDocumentationComment(): SymbolDisplayPart[]; } interface SourceFile { - version: string; - scriptSnapshot: IScriptSnapshot; - nameTable: Map; getNamedDeclarations(): Declaration[]; getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; @@ -1904,25 +1902,17 @@ declare module "typescript" { acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; /** * Request an updated version of an already existing SourceFile with a given fileName - * and compilationSettings. The update will intern call updateLanguageServiceSourceFile + * and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile * to get an updated SourceFile. * - * Note: It is not allowed to call update on a SourceFile that was not acquired from this - * registry originally. - * - * @param sourceFile The original sourceFile object to update * @param fileName The name of the file requested * @param compilationSettings Some compilation settings like target affects the * shape of a the resulting SourceFile. This allows the DocumentRegistry to store * multiple copies of the same file for different compilation settings. - * @parm scriptSnapshot Text of the file. Only used if the file was not found - * in the registry and a new one was created. - * @parm version Current version of the file. Only used if the file was not found - * in the registry and a new one was created. - * @parm textChangeRange Change ranges since the last snapshot. Only used if the file - * was not found in the registry and a new one was created. + * @param scriptSnapshot Text of the file. + * @param version Current version of the file. */ - updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; + updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; /** * Informs the DocumentRegistry that a file is not needed any longer. * diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index 59bb6cc3b8..73c1c52962 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 @@ -3209,6 +3205,11 @@ declare module "typescript" { >location : Node >Node : Node >name : string + + getBlockScopedVariableId(node: Identifier): number; +>getBlockScopedVariableId : (node: Identifier) => number +>node : Identifier +>Identifier : Identifier } const enum SymbolFlags { >SymbolFlags : SymbolFlags @@ -3520,6 +3521,9 @@ declare module "typescript" { EnumValuesComputed = 128, >EnumValuesComputed : NodeCheckFlags + + BlockScopedBindingInLoop = 256, +>BlockScopedBindingInLoop : NodeCheckFlags } interface NodeLinks { >NodeLinks : NodeLinks @@ -5038,17 +5042,6 @@ declare module "typescript" { interface SourceFile { >SourceFile : SourceFile - version: string; ->version : string - - scriptSnapshot: IScriptSnapshot; ->scriptSnapshot : IScriptSnapshot ->IScriptSnapshot : IScriptSnapshot - - nameTable: Map; ->nameTable : Map ->Map : Map - getNamedDeclarations(): Declaration[]; >getNamedDeclarations : () => Declaration[] >Declaration : Declaration @@ -5999,36 +5992,24 @@ declare module "typescript" { /** * Request an updated version of an already existing SourceFile with a given fileName - * and compilationSettings. The update will intern call updateLanguageServiceSourceFile + * and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile * to get an updated SourceFile. * - * Note: It is not allowed to call update on a SourceFile that was not acquired from this - * registry originally. - * - * @param sourceFile The original sourceFile object to update * @param fileName The name of the file requested * @param compilationSettings Some compilation settings like target affects the * shape of a the resulting SourceFile. This allows the DocumentRegistry to store * multiple copies of the same file for different compilation settings. - * @parm scriptSnapshot Text of the file. Only used if the file was not found - * in the registry and a new one was created. - * @parm version Current version of the file. Only used if the file was not found - * in the registry and a new one was created. - * @parm textChangeRange Change ranges since the last snapshot. Only used if the file - * was not found in the registry and a new one was created. + * @param scriptSnapshot Text of the file. + * @param version Current version of the file. */ - updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; ->updateDocument : (sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange) => SourceFile ->sourceFile : SourceFile ->SourceFile : SourceFile + updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; +>updateDocument : (fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string) => SourceFile >fileName : string >compilationSettings : CompilerOptions >CompilerOptions : CompilerOptions >scriptSnapshot : IScriptSnapshot >IScriptSnapshot : IScriptSnapshot >version : string ->textChangeRange : TextChangeRange ->TextChangeRange : TextChangeRange >SourceFile : SourceFile /** diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index 42bb19f5b6..ba7e4a195d 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 { @@ -973,6 +972,7 @@ declare module "typescript" { isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; isUnknownIdentifier(location: Node, name: string): boolean; + getBlockScopedVariableId(node: Identifier): number; } const enum SymbolFlags { FunctionScopedVariable = 1, @@ -1077,6 +1077,7 @@ declare module "typescript" { SuperStatic = 32, ContextChecked = 64, EnumValuesComputed = 128, + BlockScopedBindingInLoop = 256, } interface NodeLinks { resolvedType?: Type; @@ -1549,9 +1550,6 @@ declare module "typescript" { getDocumentationComment(): SymbolDisplayPart[]; } interface SourceFile { - version: string; - scriptSnapshot: IScriptSnapshot; - nameTable: Map; getNamedDeclarations(): Declaration[]; getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; @@ -1905,25 +1903,17 @@ declare module "typescript" { acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; /** * Request an updated version of an already existing SourceFile with a given fileName - * and compilationSettings. The update will intern call updateLanguageServiceSourceFile + * and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile * to get an updated SourceFile. * - * Note: It is not allowed to call update on a SourceFile that was not acquired from this - * registry originally. - * - * @param sourceFile The original sourceFile object to update * @param fileName The name of the file requested * @param compilationSettings Some compilation settings like target affects the * shape of a the resulting SourceFile. This allows the DocumentRegistry to store * multiple copies of the same file for different compilation settings. - * @parm scriptSnapshot Text of the file. Only used if the file was not found - * in the registry and a new one was created. - * @parm version Current version of the file. Only used if the file was not found - * in the registry and a new one was created. - * @parm textChangeRange Change ranges since the last snapshot. Only used if the file - * was not found in the registry and a new one was created. + * @param scriptSnapshot Text of the file. + * @param version Current version of the file. */ - updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; + updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; /** * Informs the DocumentRegistry that a file is not needed any longer. * diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index b3aca49554..6d28f9194e 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 @@ -3159,6 +3155,11 @@ declare module "typescript" { >location : Node >Node : Node >name : string + + getBlockScopedVariableId(node: Identifier): number; +>getBlockScopedVariableId : (node: Identifier) => number +>node : Identifier +>Identifier : Identifier } const enum SymbolFlags { >SymbolFlags : SymbolFlags @@ -3470,6 +3471,9 @@ declare module "typescript" { EnumValuesComputed = 128, >EnumValuesComputed : NodeCheckFlags + + BlockScopedBindingInLoop = 256, +>BlockScopedBindingInLoop : NodeCheckFlags } interface NodeLinks { >NodeLinks : NodeLinks @@ -4988,17 +4992,6 @@ declare module "typescript" { interface SourceFile { >SourceFile : SourceFile - version: string; ->version : string - - scriptSnapshot: IScriptSnapshot; ->scriptSnapshot : IScriptSnapshot ->IScriptSnapshot : IScriptSnapshot - - nameTable: Map; ->nameTable : Map ->Map : Map - getNamedDeclarations(): Declaration[]; >getNamedDeclarations : () => Declaration[] >Declaration : Declaration @@ -5949,36 +5942,24 @@ declare module "typescript" { /** * Request an updated version of an already existing SourceFile with a given fileName - * and compilationSettings. The update will intern call updateLanguageServiceSourceFile + * and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile * to get an updated SourceFile. * - * Note: It is not allowed to call update on a SourceFile that was not acquired from this - * registry originally. - * - * @param sourceFile The original sourceFile object to update * @param fileName The name of the file requested * @param compilationSettings Some compilation settings like target affects the * shape of a the resulting SourceFile. This allows the DocumentRegistry to store * multiple copies of the same file for different compilation settings. - * @parm scriptSnapshot Text of the file. Only used if the file was not found - * in the registry and a new one was created. - * @parm version Current version of the file. Only used if the file was not found - * in the registry and a new one was created. - * @parm textChangeRange Change ranges since the last snapshot. Only used if the file - * was not found in the registry and a new one was created. + * @param scriptSnapshot Text of the file. + * @param version Current version of the file. */ - updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; ->updateDocument : (sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange) => SourceFile ->sourceFile : SourceFile ->SourceFile : SourceFile + updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; +>updateDocument : (fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string) => SourceFile >fileName : string >compilationSettings : CompilerOptions >CompilerOptions : CompilerOptions >scriptSnapshot : IScriptSnapshot >IScriptSnapshot : IScriptSnapshot >version : string ->textChangeRange : TextChangeRange ->TextChangeRange : TextChangeRange >SourceFile : SourceFile /** diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index cafb7f94ce..3d4c3308b8 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 { @@ -1010,6 +1009,7 @@ declare module "typescript" { isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; isUnknownIdentifier(location: Node, name: string): boolean; + getBlockScopedVariableId(node: Identifier): number; } const enum SymbolFlags { FunctionScopedVariable = 1, @@ -1114,6 +1114,7 @@ declare module "typescript" { SuperStatic = 32, ContextChecked = 64, EnumValuesComputed = 128, + BlockScopedBindingInLoop = 256, } interface NodeLinks { resolvedType?: Type; @@ -1586,9 +1587,6 @@ declare module "typescript" { getDocumentationComment(): SymbolDisplayPart[]; } interface SourceFile { - version: string; - scriptSnapshot: IScriptSnapshot; - nameTable: Map; getNamedDeclarations(): Declaration[]; getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; @@ -1942,25 +1940,17 @@ declare module "typescript" { acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; /** * Request an updated version of an already existing SourceFile with a given fileName - * and compilationSettings. The update will intern call updateLanguageServiceSourceFile + * and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile * to get an updated SourceFile. * - * Note: It is not allowed to call update on a SourceFile that was not acquired from this - * registry originally. - * - * @param sourceFile The original sourceFile object to update * @param fileName The name of the file requested * @param compilationSettings Some compilation settings like target affects the * shape of a the resulting SourceFile. This allows the DocumentRegistry to store * multiple copies of the same file for different compilation settings. - * @parm scriptSnapshot Text of the file. Only used if the file was not found - * in the registry and a new one was created. - * @parm version Current version of the file. Only used if the file was not found - * in the registry and a new one was created. - * @parm textChangeRange Change ranges since the last snapshot. Only used if the file - * was not found in the registry and a new one was created. + * @param scriptSnapshot Text of the file. + * @param version Current version of the file. */ - updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; + updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; /** * Informs the DocumentRegistry that a file is not needed any longer. * diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index 3a987c0296..f7d9c0e283 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 @@ -3332,6 +3328,11 @@ declare module "typescript" { >location : Node >Node : Node >name : string + + getBlockScopedVariableId(node: Identifier): number; +>getBlockScopedVariableId : (node: Identifier) => number +>node : Identifier +>Identifier : Identifier } const enum SymbolFlags { >SymbolFlags : SymbolFlags @@ -3643,6 +3644,9 @@ declare module "typescript" { EnumValuesComputed = 128, >EnumValuesComputed : NodeCheckFlags + + BlockScopedBindingInLoop = 256, +>BlockScopedBindingInLoop : NodeCheckFlags } interface NodeLinks { >NodeLinks : NodeLinks @@ -5161,17 +5165,6 @@ declare module "typescript" { interface SourceFile { >SourceFile : SourceFile - version: string; ->version : string - - scriptSnapshot: IScriptSnapshot; ->scriptSnapshot : IScriptSnapshot ->IScriptSnapshot : IScriptSnapshot - - nameTable: Map; ->nameTable : Map ->Map : Map - getNamedDeclarations(): Declaration[]; >getNamedDeclarations : () => Declaration[] >Declaration : Declaration @@ -6122,36 +6115,24 @@ declare module "typescript" { /** * Request an updated version of an already existing SourceFile with a given fileName - * and compilationSettings. The update will intern call updateLanguageServiceSourceFile + * and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile * to get an updated SourceFile. * - * Note: It is not allowed to call update on a SourceFile that was not acquired from this - * registry originally. - * - * @param sourceFile The original sourceFile object to update * @param fileName The name of the file requested * @param compilationSettings Some compilation settings like target affects the * shape of a the resulting SourceFile. This allows the DocumentRegistry to store * multiple copies of the same file for different compilation settings. - * @parm scriptSnapshot Text of the file. Only used if the file was not found - * in the registry and a new one was created. - * @parm version Current version of the file. Only used if the file was not found - * in the registry and a new one was created. - * @parm textChangeRange Change ranges since the last snapshot. Only used if the file - * was not found in the registry and a new one was created. + * @param scriptSnapshot Text of the file. + * @param version Current version of the file. */ - updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; ->updateDocument : (sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange) => SourceFile ->sourceFile : SourceFile ->SourceFile : SourceFile + updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; +>updateDocument : (fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string) => SourceFile >fileName : string >compilationSettings : CompilerOptions >CompilerOptions : CompilerOptions >scriptSnapshot : IScriptSnapshot >IScriptSnapshot : IScriptSnapshot >version : string ->textChangeRange : TextChangeRange ->TextChangeRange : TextChangeRange >SourceFile : SourceFile /** diff --git a/tests/baselines/reference/ES5SymbolProperty1.js b/tests/baselines/reference/ES5SymbolProperty1.js index 7d29658e28..ab3f420c95 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, +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 acb336b641..62692997a9 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, +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 9ecc0eb6d6..c63cf5bb45 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, + 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 6a20d4aff0..51e5d0000e 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 () { }, +var v = (_a = {}, + _a[foo()] = function () { }, _a); var _a; diff --git a/tests/baselines/reference/VariableDeclaration10_es6.errors.txt b/tests/baselines/reference/VariableDeclaration10_es6.errors.txt deleted file mode 100644 index b7d4bf2f1c..0000000000 --- a/tests/baselines/reference/VariableDeclaration10_es6.errors.txt +++ /dev/null @@ -1,7 +0,0 @@ -tests/cases/conformance/es6/variableDeclarations/VariableDeclaration10_es6.ts(1,1): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration10_es6.ts (1 errors) ==== - let a: number = 1 - ~~~ -!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. \ No newline at end of file diff --git a/tests/baselines/reference/VariableDeclaration10_es6.types b/tests/baselines/reference/VariableDeclaration10_es6.types new file mode 100644 index 0000000000..47238fdd5a --- /dev/null +++ b/tests/baselines/reference/VariableDeclaration10_es6.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration10_es6.ts === +let a: number = 1 +>a : number + diff --git a/tests/baselines/reference/VariableDeclaration2_es6.errors.txt b/tests/baselines/reference/VariableDeclaration2_es6.errors.txt index 0d8214f542..35e0ad2821 100644 --- a/tests/baselines/reference/VariableDeclaration2_es6.errors.txt +++ b/tests/baselines/reference/VariableDeclaration2_es6.errors.txt @@ -1,10 +1,7 @@ -tests/cases/conformance/es6/variableDeclarations/VariableDeclaration2_es6.ts(1,1): error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/variableDeclarations/VariableDeclaration2_es6.ts(1,7): error TS1155: 'const' declarations must be initialized -==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration2_es6.ts (2 errors) ==== +==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration2_es6.ts (1 errors) ==== const a - ~~~~~ -!!! error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher. ~ !!! error TS1155: 'const' declarations must be initialized \ No newline at end of file diff --git a/tests/baselines/reference/VariableDeclaration3_es6.errors.txt b/tests/baselines/reference/VariableDeclaration3_es6.errors.txt deleted file mode 100644 index a3b09f70d2..0000000000 --- a/tests/baselines/reference/VariableDeclaration3_es6.errors.txt +++ /dev/null @@ -1,7 +0,0 @@ -tests/cases/conformance/es6/variableDeclarations/VariableDeclaration3_es6.ts(1,1): error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration3_es6.ts (1 errors) ==== - const a = 1 - ~~~~~ -!!! error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher. \ No newline at end of file diff --git a/tests/baselines/reference/VariableDeclaration3_es6.types b/tests/baselines/reference/VariableDeclaration3_es6.types new file mode 100644 index 0000000000..a172c8114c --- /dev/null +++ b/tests/baselines/reference/VariableDeclaration3_es6.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration3_es6.ts === +const a = 1 +>a : number + diff --git a/tests/baselines/reference/VariableDeclaration4_es6.errors.txt b/tests/baselines/reference/VariableDeclaration4_es6.errors.txt index b4bb75b565..33d956ee1e 100644 --- a/tests/baselines/reference/VariableDeclaration4_es6.errors.txt +++ b/tests/baselines/reference/VariableDeclaration4_es6.errors.txt @@ -1,10 +1,7 @@ -tests/cases/conformance/es6/variableDeclarations/VariableDeclaration4_es6.ts(1,1): error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/variableDeclarations/VariableDeclaration4_es6.ts(1,7): error TS1155: 'const' declarations must be initialized -==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration4_es6.ts (2 errors) ==== +==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration4_es6.ts (1 errors) ==== const a: number - ~~~~~ -!!! error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher. ~ !!! error TS1155: 'const' declarations must be initialized \ No newline at end of file diff --git a/tests/baselines/reference/VariableDeclaration5_es6.errors.txt b/tests/baselines/reference/VariableDeclaration5_es6.errors.txt deleted file mode 100644 index c72d423e46..0000000000 --- a/tests/baselines/reference/VariableDeclaration5_es6.errors.txt +++ /dev/null @@ -1,7 +0,0 @@ -tests/cases/conformance/es6/variableDeclarations/VariableDeclaration5_es6.ts(1,1): error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration5_es6.ts (1 errors) ==== - const a: number = 1 - ~~~~~ -!!! error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher. \ No newline at end of file diff --git a/tests/baselines/reference/VariableDeclaration5_es6.types b/tests/baselines/reference/VariableDeclaration5_es6.types new file mode 100644 index 0000000000..a07894d533 --- /dev/null +++ b/tests/baselines/reference/VariableDeclaration5_es6.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration5_es6.ts === +const a: number = 1 +>a : number + diff --git a/tests/baselines/reference/VariableDeclaration7_es6.errors.txt b/tests/baselines/reference/VariableDeclaration7_es6.errors.txt deleted file mode 100644 index 83d12d463e..0000000000 --- a/tests/baselines/reference/VariableDeclaration7_es6.errors.txt +++ /dev/null @@ -1,7 +0,0 @@ -tests/cases/conformance/es6/variableDeclarations/VariableDeclaration7_es6.ts(1,1): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration7_es6.ts (1 errors) ==== - let a - ~~~ -!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. \ No newline at end of file diff --git a/tests/baselines/reference/VariableDeclaration7_es6.types b/tests/baselines/reference/VariableDeclaration7_es6.types new file mode 100644 index 0000000000..321c1b07bb --- /dev/null +++ b/tests/baselines/reference/VariableDeclaration7_es6.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration7_es6.ts === +let a +>a : any + diff --git a/tests/baselines/reference/VariableDeclaration8_es6.errors.txt b/tests/baselines/reference/VariableDeclaration8_es6.errors.txt deleted file mode 100644 index e371c64c9a..0000000000 --- a/tests/baselines/reference/VariableDeclaration8_es6.errors.txt +++ /dev/null @@ -1,7 +0,0 @@ -tests/cases/conformance/es6/variableDeclarations/VariableDeclaration8_es6.ts(1,1): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration8_es6.ts (1 errors) ==== - let a = 1 - ~~~ -!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. \ No newline at end of file diff --git a/tests/baselines/reference/VariableDeclaration8_es6.types b/tests/baselines/reference/VariableDeclaration8_es6.types new file mode 100644 index 0000000000..530b147136 --- /dev/null +++ b/tests/baselines/reference/VariableDeclaration8_es6.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration8_es6.ts === +let a = 1 +>a : number + diff --git a/tests/baselines/reference/VariableDeclaration9_es6.errors.txt b/tests/baselines/reference/VariableDeclaration9_es6.errors.txt deleted file mode 100644 index 4a1890d469..0000000000 --- a/tests/baselines/reference/VariableDeclaration9_es6.errors.txt +++ /dev/null @@ -1,7 +0,0 @@ -tests/cases/conformance/es6/variableDeclarations/VariableDeclaration9_es6.ts(1,1): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration9_es6.ts (1 errors) ==== - let a: number - ~~~ -!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. \ No newline at end of file diff --git a/tests/baselines/reference/VariableDeclaration9_es6.types b/tests/baselines/reference/VariableDeclaration9_es6.types new file mode 100644 index 0000000000..6b29a04281 --- /dev/null +++ b/tests/baselines/reference/VariableDeclaration9_es6.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration9_es6.ts === +let a: number +>a : number + diff --git a/tests/baselines/reference/bpSpan_stmts.baseline b/tests/baselines/reference/bpSpan_stmts.baseline index a81559ee9a..7f6bf21b40 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 5a9e569f40..e5465b8812 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/catchClauseWithBindingPattern1.errors.txt b/tests/baselines/reference/catchClauseWithBindingPattern1.errors.txt new file mode 100644 index 0000000000..0b7482850e --- /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 0000000000..bbdc259946 --- /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 0000000000..b13644f4d8 --- /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 0000000000..5cb89a567f --- /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 d3eea6619b..5bc7339d2f 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/computedPropertyNames10_ES5.js b/tests/baselines/reference/computedPropertyNames10_ES5.js index 00b43fb551..302f9355be 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 () { }, +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 db3b12cbf3..6990200334 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 }), +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 4795047337..a62af50653 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, + 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 fcc46aeff2..bda3e01bbe 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, + 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 115daa53ac..37e06616c2 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 }), +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 06a08c6b73..1eec0a7bcd 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, +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 12ec32d7e9..df12193250 100644 --- a/tests/baselines/reference/computedPropertyNames22_ES5.js +++ b/tests/baselines/reference/computedPropertyNames22_ES5.js @@ -13,7 +13,8 @@ var C = (function () { function C() { } C.prototype.bar = function () { - var obj = (_a = {}, _a[this.bar()] = function () { }, + 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 f0eebd119e..9e02999738 100644 --- a/tests/baselines/reference/computedPropertyNames23_ES5.js +++ b/tests/baselines/reference/computedPropertyNames23_ES5.js @@ -15,8 +15,8 @@ var C = (function () { C.prototype.bar = function () { return 0; }; - C.prototype[(_a = {}, _a[this.bar()] = - 1, + C.prototype[(_a = {}, + _a[this.bar()] = 1, _a)[0]] = function () { }; return C; })(); diff --git a/tests/baselines/reference/computedPropertyNames25_ES5.js b/tests/baselines/reference/computedPropertyNames25_ES5.js index 07673dded7..f8196dd130 100644 --- a/tests/baselines/reference/computedPropertyNames25_ES5.js +++ b/tests/baselines/reference/computedPropertyNames25_ES5.js @@ -34,7 +34,8 @@ var C = (function (_super) { _super.apply(this, arguments); } C.prototype.foo = function () { - var obj = (_a = {}, _a[_super.prototype.bar.call(this)] = function () { }, + 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 50a14294c5..037bd8786e 100644 --- a/tests/baselines/reference/computedPropertyNames26_ES5.js +++ b/tests/baselines/reference/computedPropertyNames26_ES5.js @@ -34,8 +34,8 @@ 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, + C.prototype[(_a = {}, + _a[super.bar.call(this)] = 1, _a)[0]] = function () { }; return C; })(Base); diff --git a/tests/baselines/reference/computedPropertyNames28_ES5.js b/tests/baselines/reference/computedPropertyNames28_ES5.js index 0ee4c6fcb3..b88cb0dfaf 100644 --- a/tests/baselines/reference/computedPropertyNames28_ES5.js +++ b/tests/baselines/reference/computedPropertyNames28_ES5.js @@ -26,7 +26,8 @@ var C = (function (_super) { __extends(C, _super); function C() { _super.call(this); - var obj = (_a = {}, _a[(_super.call(this), "prop")] = function () { }, + var obj = (_a = {}, + _a[(_super.call(this), "prop")] = function () { }, _a); var _a; } diff --git a/tests/baselines/reference/computedPropertyNames29_ES5.js b/tests/baselines/reference/computedPropertyNames29_ES5.js index 6c571ffc48..022c930ab6 100644 --- a/tests/baselines/reference/computedPropertyNames29_ES5.js +++ b/tests/baselines/reference/computedPropertyNames29_ES5.js @@ -17,7 +17,8 @@ var C = (function () { C.prototype.bar = function () { var _this = this; (function () { - var obj = (_a = {}, _a[_this.bar()] = function () { }, + var obj = (_a = {}, + _a[_this.bar()] = function () { }, _a); var _a; }); diff --git a/tests/baselines/reference/computedPropertyNames30_ES5.js b/tests/baselines/reference/computedPropertyNames30_ES5.js index be54ac9f39..fd63a192d0 100644 --- a/tests/baselines/reference/computedPropertyNames30_ES5.js +++ b/tests/baselines/reference/computedPropertyNames30_ES5.js @@ -32,7 +32,8 @@ var C = (function (_super) { function C() { _super.call(this); (function () { - var obj = (_a = {}, _a[(_super.call(this), "prop")] = function () { }, + 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 c195af3eb5..8a3c1a3f6c 100644 --- a/tests/baselines/reference/computedPropertyNames31_ES5.js +++ b/tests/baselines/reference/computedPropertyNames31_ES5.js @@ -38,7 +38,8 @@ var C = (function (_super) { C.prototype.foo = function () { var _this = this; (function () { - var obj = (_a = {}, _a[_super.prototype.bar.call(_this)] = function () { }, + var obj = (_a = {}, + _a[_super.prototype.bar.call(_this)] = function () { }, _a); var _a; }); diff --git a/tests/baselines/reference/computedPropertyNames33_ES5.js b/tests/baselines/reference/computedPropertyNames33_ES5.js index 805531eb6b..3d7c70a925 100644 --- a/tests/baselines/reference/computedPropertyNames33_ES5.js +++ b/tests/baselines/reference/computedPropertyNames33_ES5.js @@ -15,7 +15,8 @@ var C = (function () { function C() { } C.prototype.bar = function () { - var obj = (_a = {}, _a[foo()] = function () { }, + 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 8e5fbe96f6..fd46b144fa 100644 --- a/tests/baselines/reference/computedPropertyNames34_ES5.js +++ b/tests/baselines/reference/computedPropertyNames34_ES5.js @@ -15,7 +15,8 @@ var C = (function () { function C() { } C.bar = function () { - var obj = (_a = {}, _a[foo()] = function () { }, + 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 0cd5bd9bea..815f5769f3 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, +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 2ec3fa5d66..7d839e16ff 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, +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 4a39750768..c5ca0d5b24 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] = - "", +extractIndexer((_a = {}, + _a[a] = "", _a)); // Should return string -extractIndexer((_b = {}, _b[0 /* x */] = - "", +extractIndexer((_b = {}, + _b[0 /* x */] = "", _b)); // Should return string -extractIndexer((_c = {}, _c["" || 0] = - "", +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 79c09624f4..5f952c6f3f 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, + }, 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 22e23f1490..ac0fa8ec93 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, +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 36ca71707c..32502d80e0 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, + }, 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 e99c4ed73b..3367faa2c2 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, +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 a4b9f2131e..29d035bfcb 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, +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 bd19f0cc5e..9c23dcab20 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, +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 9035777bcb..82d262c7e4 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, + 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 1c5198da76..b1ac6c9e3b 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, +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 c29260da04..d8a33951d4 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, +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 60d5706e3f..1ee8835115 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; }, +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 aba28acdd2..6be09e4bef 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; }, +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 6752bf590d..b510cda291 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; }, +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 6e9dbab4b5..0c319a526f 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, +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 1d7d456195..51d78be59d 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, +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 82229dc92e..f50231e3f0 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.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 ca335566d7..e1c567c62d 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.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 89ea38eaa7..24f6218864 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, +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 b4f94dcadb..340802da2a 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, +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 bb495c0f53..58c3133e6e 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js @@ -7,8 +7,11 @@ 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 }), +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 299c599442..972aaf9b52 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; -}, +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 2ea24d441e..d4df74499d 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;IACA,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,CAAA,EAAA,GAAA,EAAA;IAAA,EAAA,CAEA,OAAO,CAFA,GAAA;QAGA,QAAQ,CAAC;IACb,CAAC,AAJA;IAAA,EAAA,CAKA,CAAA;IALA,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 bc6d862eb9..e1a4f764f4 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 @@ -32,128 +27,130 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts 5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 9) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 9) Source(0, NaN) + SourceIndex(0) nameIndex (-1) 5 > 6 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column -6 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 9) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 10) Source(1, 1) + SourceIndex(0) nameIndex (-1) +6 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 9) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 10) Source(0, NaN) + SourceIndex(0) nameIndex (-1) 6 > -7 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -7 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 10) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 12) Source(1, 1) + SourceIndex(0) nameIndex (-1) +7 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +7 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 10) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 12) Source(0, NaN) + SourceIndex(0) nameIndex (-1) 7 > -8 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -8 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 12) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 15) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +8 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +8 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 10) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 15) Source(0, NaN) + SourceIndex(0) nameIndex (-1) 8 > 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 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 12) 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) 4 >Emitted(1, 9) Source(1, 9) + SourceIndex(0) 5 >Emitted(1, 9) Source(0, NaN) + SourceIndex(0) -6 >Emitted(1, 10) Source(1, 1) + SourceIndex(0) -7 >Emitted(1, 12) Source(1, 1) + SourceIndex(0) +6 >Emitted(1, 10) Source(0, NaN) + SourceIndex(0) +7 >Emitted(1, 12) Source(0, NaN) + 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 > +>>> _a["hello"] = function () { +1->^^^^ +2 > ^^ +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(1, 12) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 5) Source(0, NaN) + 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) +2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 15) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 7) Source(0, NaN) + 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, 15) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 8) Source(2, 6) + SourceIndex(0) nameIndex (-1) +3 > +4 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +4 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 17) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 15) Source(2, 13) + SourceIndex(0) nameIndex (-1) +4 > "hello" +5 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 17) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 16) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +5 > +6 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +6 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 5) Source(0, 9) + 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(0, NaN) + SourceIndex(0) +2 >Emitted(2, 7) Source(0, NaN) + 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 >!!^^ !!^^ 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(2, 5) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 9) Source(3, 9) + SourceIndex(0) nameIndex (-1) 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) +2 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 7) Source(0, 9) + 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, 7) Source(0, 9) + 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 >!!^^ !!^^ 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, 8) Source(2, 9) + 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(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) +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, 15) Source(2, 16) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 6) Source(4, 6) + SourceIndex(0) nameIndex (-1) +2 > } +3 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 16) Source(0, 16) + 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 > ^ -5 > ^ -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, 5) Source(1, 1) + SourceIndex(0) nameIndex (-1) +3 > ^ +4 > ^ +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(2, 16) Source(0, 16) + 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(2, 14) Source(3, 30) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 7) Source(1, 1) + SourceIndex(0) nameIndex (-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, 19) Source(0, 16) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 7) Source(0, NaN) + 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, 7) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +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, 19) Source(0, 16) + 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(3, 2) Source(4, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 8) 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, 9) Source(5, 2) + SourceIndex(0) nameIndex (-1) -5 > -1->Emitted(4, 5) Source(1, 1) + SourceIndex(0) -2 >Emitted(4, 7) Source(1, 1) + SourceIndex(0) -3 >Emitted(4, 7) Source(0, NaN) + SourceIndex(0) -4 >Emitted(4, 8) Source(5, 2) + SourceIndex(0) -5 >Emitted(4, 9) Source(5, 2) + SourceIndex(0) +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, 9) Source(3, 16) + 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: 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 >!!^^ !!^^ 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, 24) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(6, 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, 5) 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, 25) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(6, 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) +1 >Emitted(6, 5) Source(0, NaN) + SourceIndex(0) +2 >Emitted(6, 7) Source(0, NaN) + 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: ;IACb,CAAC,AAJA;IAAA,EAAA,CAKA,CAAA;IALA,EAAA >>>//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/constDeclarations-errors.errors.txt b/tests/baselines/reference/constDeclarations-errors.errors.txt index c0ae6635c5..10501beb1a 100644 --- a/tests/baselines/reference/constDeclarations-errors.errors.txt +++ b/tests/baselines/reference/constDeclarations-errors.errors.txt @@ -4,13 +4,12 @@ tests/cases/compiler/constDeclarations-errors.ts(5,7): error TS1155: 'const' dec tests/cases/compiler/constDeclarations-errors.ts(5,11): error TS1155: 'const' declarations must be initialized tests/cases/compiler/constDeclarations-errors.ts(5,15): error TS1155: 'const' declarations must be initialized tests/cases/compiler/constDeclarations-errors.ts(5,27): error TS1155: 'const' declarations must be initialized -tests/cases/compiler/constDeclarations-errors.ts(8,11): error TS1155: 'const' declarations must be initialized -tests/cases/compiler/constDeclarations-errors.ts(11,27): error TS2449: The operand of an increment or decrement operator cannot be a constant. -tests/cases/compiler/constDeclarations-errors.ts(14,11): error TS1155: 'const' declarations must be initialized -tests/cases/compiler/constDeclarations-errors.ts(17,20): error TS1155: 'const' declarations must be initialized +tests/cases/compiler/constDeclarations-errors.ts(10,27): error TS2449: The operand of an increment or decrement operator cannot be a constant. +tests/cases/compiler/constDeclarations-errors.ts(13,11): error TS1155: 'const' declarations must be initialized +tests/cases/compiler/constDeclarations-errors.ts(16,20): error TS1155: 'const' declarations must be initialized -==== tests/cases/compiler/constDeclarations-errors.ts (10 errors) ==== +==== tests/cases/compiler/constDeclarations-errors.ts (9 errors) ==== // error, missing intialicer const c1; @@ -29,10 +28,7 @@ tests/cases/compiler/constDeclarations-errors.ts(17,20): error TS1155: 'const' d ~~ !!! error TS1155: 'const' declarations must be initialized - // error, can not be unintalized for(const c in {}) { } - ~ -!!! error TS1155: 'const' declarations must be initialized // error, assigning to a const for(const c8 = 0; c8 < 1; c8++) { } diff --git a/tests/baselines/reference/constDeclarations-errors.js b/tests/baselines/reference/constDeclarations-errors.js index 2947593b01..e7143f2564 100644 --- a/tests/baselines/reference/constDeclarations-errors.js +++ b/tests/baselines/reference/constDeclarations-errors.js @@ -5,7 +5,6 @@ const c1; const c2: number; const c3, c4, c5 :string, c6; // error, missing initialicer -// error, can not be unintalized for(const c in {}) { } // error, assigning to a const @@ -22,8 +21,7 @@ for(const c10 = 0, c11; c10 < 1;) { } const c1; const c2; const c3, c4, c5, c6; // error, missing initialicer -// error, can not be unintalized -for (var c in {}) { } +for (const c in {}) { } // error, assigning to a const for (const c8 = 0; c8 < 1; c8++) { } // error, can not be unintalized diff --git a/tests/baselines/reference/constDeclarations-es5.errors.txt b/tests/baselines/reference/constDeclarations-es5.errors.txt deleted file mode 100644 index d15535349a..0000000000 --- a/tests/baselines/reference/constDeclarations-es5.errors.txt +++ /dev/null @@ -1,17 +0,0 @@ -tests/cases/compiler/constDeclarations-es5.ts(2,1): error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher. -tests/cases/compiler/constDeclarations-es5.ts(3,1): error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher. -tests/cases/compiler/constDeclarations-es5.ts(4,1): error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/compiler/constDeclarations-es5.ts (3 errors) ==== - - const z7 = false; - ~~~~~ -!!! error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher. - const z8: number = 23; - ~~~~~ -!!! error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher. - const z9 = 0, z10 :string = "", z11 = null; - ~~~~~ -!!! error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher. - \ No newline at end of file diff --git a/tests/baselines/reference/constDeclarations-es5.js b/tests/baselines/reference/constDeclarations-es5.js index 20deb9dca3..736260ad10 100644 --- a/tests/baselines/reference/constDeclarations-es5.js +++ b/tests/baselines/reference/constDeclarations-es5.js @@ -6,6 +6,6 @@ const z9 = 0, z10 :string = "", z11 = null; //// [constDeclarations-es5.js] -const z7 = false; -const z8 = 23; -const z9 = 0, z10 = "", z11 = null; +var z7 = false; +var z8 = 23; +var z9 = 0, z10 = "", z11 = null; diff --git a/tests/baselines/reference/constDeclarations-es5.types b/tests/baselines/reference/constDeclarations-es5.types new file mode 100644 index 0000000000..be55dc0feb --- /dev/null +++ b/tests/baselines/reference/constDeclarations-es5.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/constDeclarations-es5.ts === + +const z7 = false; +>z7 : boolean + +const z8: number = 23; +>z8 : number + +const z9 = 0, z10 :string = "", z11 = null; +>z9 : number +>z10 : string +>z11 : any + diff --git a/tests/baselines/reference/downlevelLetConst1.errors.txt b/tests/baselines/reference/downlevelLetConst1.errors.txt new file mode 100644 index 0000000000..a46d1973e0 --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst1.errors.txt @@ -0,0 +1,7 @@ +tests/cases/compiler/downlevelLetConst1.ts(1,6): error TS1123: Variable declaration list cannot be empty. + + +==== tests/cases/compiler/downlevelLetConst1.ts (1 errors) ==== + const + +!!! error TS1123: Variable declaration list cannot be empty. \ No newline at end of file diff --git a/tests/baselines/reference/downlevelLetConst1.js b/tests/baselines/reference/downlevelLetConst1.js new file mode 100644 index 0000000000..3463c10032 --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst1.js @@ -0,0 +1,5 @@ +//// [downlevelLetConst1.ts] +const + +//// [downlevelLetConst1.js] +var ; diff --git a/tests/baselines/reference/downlevelLetConst10.js b/tests/baselines/reference/downlevelLetConst10.js new file mode 100644 index 0000000000..8beb79b04b --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst10.js @@ -0,0 +1,5 @@ +//// [downlevelLetConst10.ts] +let a: number = 1 + +//// [downlevelLetConst10.js] +var a = 1; diff --git a/tests/baselines/reference/downlevelLetConst10.types b/tests/baselines/reference/downlevelLetConst10.types new file mode 100644 index 0000000000..05fe302945 --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst10.types @@ -0,0 +1,4 @@ +=== tests/cases/compiler/downlevelLetConst10.ts === +let a: number = 1 +>a : number + diff --git a/tests/baselines/reference/downlevelLetConst11.errors.txt b/tests/baselines/reference/downlevelLetConst11.errors.txt new file mode 100644 index 0000000000..42449bd3c8 --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst11.errors.txt @@ -0,0 +1,8 @@ +tests/cases/compiler/downlevelLetConst11.ts(2,4): error TS1123: Variable declaration list cannot be empty. + + +==== tests/cases/compiler/downlevelLetConst11.ts (1 errors) ==== + "use strict"; + let + +!!! error TS1123: Variable declaration list cannot be empty. \ No newline at end of file diff --git a/tests/baselines/reference/downlevelLetConst11.js b/tests/baselines/reference/downlevelLetConst11.js new file mode 100644 index 0000000000..377c7e6a9e --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst11.js @@ -0,0 +1,7 @@ +//// [downlevelLetConst11.ts] +"use strict"; +let + +//// [downlevelLetConst11.js] +"use strict"; +var ; diff --git a/tests/baselines/reference/downlevelLetConst12.js b/tests/baselines/reference/downlevelLetConst12.js new file mode 100644 index 0000000000..6437d17acc --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst12.js @@ -0,0 +1,22 @@ +//// [downlevelLetConst12.ts] + +'use strict' +// top level let\const should not be renamed +let foo; +const bar = 1; + +let [baz] = []; +let {a: baz2} = { a: 1 }; + +const [baz3] = [] +const {a: baz4} = { a: 1 }; + +//// [downlevelLetConst12.js] +'use strict'; +// top level let\const should not be renamed +var foo; +var bar = 1; +var baz = ([])[0]; +var baz2 = ({ a: 1 }).a; +var baz3 = ([])[0]; +var baz4 = ({ a: 1 }).a; diff --git a/tests/baselines/reference/downlevelLetConst12.types b/tests/baselines/reference/downlevelLetConst12.types new file mode 100644 index 0000000000..90a814e075 --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst12.types @@ -0,0 +1,30 @@ +=== tests/cases/compiler/downlevelLetConst12.ts === + +'use strict' +// top level let\const should not be renamed +let foo; +>foo : any + +const bar = 1; +>bar : number + +let [baz] = []; +>baz : any +>[] : undefined[] + +let {a: baz2} = { a: 1 }; +>a : unknown +>baz2 : number +>{ a: 1 } : { a: number; } +>a : number + +const [baz3] = [] +>baz3 : any +>[] : undefined[] + +const {a: baz4} = { a: 1 }; +>a : unknown +>baz4 : number +>{ a: 1 } : { a: number; } +>a : number + diff --git a/tests/baselines/reference/downlevelLetConst13.js b/tests/baselines/reference/downlevelLetConst13.js new file mode 100644 index 0000000000..8324d697e9 --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst13.js @@ -0,0 +1,39 @@ +//// [downlevelLetConst13.ts] + +'use strict' +// exported let\const bindings should not be renamed + +export let foo = 10; +export const bar = "123" +export let [bar1] = [1]; +export const [bar2] = [2]; +export let {a: bar3} = { a: 1 }; +export const {a: bar4} = { a: 1 }; + +export module M { + export let baz = 100; + export const baz2 = true; + export let [bar5] = [1]; + export const [bar6] = [2]; + export let {a: bar7} = { a: 1 }; + export const {a: bar8} = { a: 1 }; +} + +//// [downlevelLetConst13.js] +'use strict'; +// exported let\const bindings should not be renamed +exports.foo = 10; +exports.bar = "123"; +exports.bar1 = ([1])[0]; +exports.bar2 = ([2])[0]; +exports.bar3 = ({ a: 1 }).a; +exports.bar4 = ({ a: 1 }).a; +var M; +(function (M) { + M.baz = 100; + M.baz2 = true; + M.bar5 = ([1])[0]; + M.bar6 = ([2])[0]; + M.bar7 = ({ a: 1 }).a; + M.bar8 = ({ a: 1 }).a; +})(M = exports.M || (exports.M = {})); diff --git a/tests/baselines/reference/downlevelLetConst13.types b/tests/baselines/reference/downlevelLetConst13.types new file mode 100644 index 0000000000..e72e3936f4 --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst13.types @@ -0,0 +1,60 @@ +=== tests/cases/compiler/downlevelLetConst13.ts === + +'use strict' +// exported let\const bindings should not be renamed + +export let foo = 10; +>foo : number + +export const bar = "123" +>bar : string + +export let [bar1] = [1]; +>bar1 : number +>[1] : [number] + +export const [bar2] = [2]; +>bar2 : number +>[2] : [number] + +export let {a: bar3} = { a: 1 }; +>a : unknown +>bar3 : number +>{ a: 1 } : { a: number; } +>a : number + +export const {a: bar4} = { a: 1 }; +>a : unknown +>bar4 : number +>{ a: 1 } : { a: number; } +>a : number + +export module M { +>M : typeof M + + export let baz = 100; +>baz : number + + export const baz2 = true; +>baz2 : boolean + + export let [bar5] = [1]; +>bar5 : number +>[1] : [number] + + export const [bar6] = [2]; +>bar6 : number +>[2] : [number] + + export let {a: bar7} = { a: 1 }; +>a : unknown +>bar7 : number +>{ a: 1 } : { a: number; } +>a : number + + export const {a: bar8} = { a: 1 }; +>a : unknown +>bar8 : number +>{ a: 1 } : { a: number; } +>a : number +} diff --git a/tests/baselines/reference/downlevelLetConst14.js b/tests/baselines/reference/downlevelLetConst14.js new file mode 100644 index 0000000000..212262dc43 --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst14.js @@ -0,0 +1,107 @@ +//// [downlevelLetConst14.ts] +'use strict' +declare function use(a: any); + +var x = 10; +var z0, z1, z2, z3; +{ + let x = 20; + use(x); + + let [z0] = [1]; + use(z0); + let [z1] = [1] + use(z1); + let {a: z2} = { a: 1 }; + use(z2); + let {a: z3} = { a: 1 }; + use(z3); +} +use(x); +use(z0); +use(z1); +use(z2); +use(z3); +var z6; +var y = true; +{ + let y = ""; + let [z6] = [true] + { + let y = 1; + let {a: z6} = {a: 1} + use(y); + use(z6); + } + use(y); + use(z6); +} +use(y); +use(z6); + +var z = false; +var z5 = 1; +{ + let z = ""; + let [z5] = [5]; + { + let _z = 1; + let {a: _z5} = { a: 1 }; + // try to step on generated name + use(_z); + } + use(z); +} +use(y); + +//// [downlevelLetConst14.js] +'use strict'; +var x = 10; +var z0, z1, z2, z3; +{ + var _x = 20; + use(_x); + var _z0 = ([1])[0]; + use(_z0); + var _z1 = ([1])[0]; + use(_z1); + var _z2 = ({ a: 1 }).a; + use(_z2); + var _z3 = ({ a: 1 }).a; + use(_z3); +} +use(x); +use(z0); +use(z1); +use(z2); +use(z3); +var z6; +var y = true; +{ + var _y = ""; + var _z6 = ([true])[0]; + { + var _y_1 = 1; + var _z6_1 = ({ a: 1 }).a; + use(_y_1); + use(_z6_1); + } + use(_y); + use(_z6); +} +use(y); +use(z6); +var z = false; +var z5 = 1; +{ + var _z = ""; + var _z5 = ([5])[0]; + { + var _z_1 = 1; + var _z5_1 = ({ a: 1 }).a; + // try to step on generated name + use(_z_1); + } + use(_z); +} +use(y); diff --git a/tests/baselines/reference/downlevelLetConst14.types b/tests/baselines/reference/downlevelLetConst14.types new file mode 100644 index 0000000000..05b6694883 --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst14.types @@ -0,0 +1,178 @@ +=== tests/cases/compiler/downlevelLetConst14.ts === +'use strict' +declare function use(a: any); +>use : (a: any) => any +>a : any + +var x = 10; +>x : number + +var z0, z1, z2, z3; +>z0 : any +>z1 : any +>z2 : any +>z3 : any +{ + let x = 20; +>x : number + + use(x); +>use(x) : any +>use : (a: any) => any +>x : number + + let [z0] = [1]; +>z0 : number +>[1] : [number] + + use(z0); +>use(z0) : any +>use : (a: any) => any +>z0 : number + + let [z1] = [1] +>z1 : number +>[1] : [number] + + use(z1); +>use(z1) : any +>use : (a: any) => any +>z1 : number + + let {a: z2} = { a: 1 }; +>a : unknown +>z2 : number +>{ a: 1 } : { a: number; } +>a : number + + use(z2); +>use(z2) : any +>use : (a: any) => any +>z2 : number + + let {a: z3} = { a: 1 }; +>a : unknown +>z3 : number +>{ a: 1 } : { a: number; } +>a : number + + use(z3); +>use(z3) : any +>use : (a: any) => any +>z3 : number +} +use(x); +>use(x) : any +>use : (a: any) => any +>x : number + +use(z0); +>use(z0) : any +>use : (a: any) => any +>z0 : any + +use(z1); +>use(z1) : any +>use : (a: any) => any +>z1 : any + +use(z2); +>use(z2) : any +>use : (a: any) => any +>z2 : any + +use(z3); +>use(z3) : any +>use : (a: any) => any +>z3 : any + +var z6; +>z6 : any + +var y = true; +>y : boolean +{ + let y = ""; +>y : string + + let [z6] = [true] +>z6 : boolean +>[true] : [boolean] + { + let y = 1; +>y : number + + let {a: z6} = {a: 1} +>a : unknown +>z6 : number +>{a: 1} : { a: number; } +>a : number + + use(y); +>use(y) : any +>use : (a: any) => any +>y : number + + use(z6); +>use(z6) : any +>use : (a: any) => any +>z6 : number + } + use(y); +>use(y) : any +>use : (a: any) => any +>y : string + + use(z6); +>use(z6) : any +>use : (a: any) => any +>z6 : boolean +} +use(y); +>use(y) : any +>use : (a: any) => any +>y : boolean + +use(z6); +>use(z6) : any +>use : (a: any) => any +>z6 : any + +var z = false; +>z : boolean + +var z5 = 1; +>z5 : number +{ + let z = ""; +>z : string + + let [z5] = [5]; +>z5 : number +>[5] : [number] + { + let _z = 1; +>_z : number + + let {a: _z5} = { a: 1 }; +>a : unknown +>_z5 : number +>{ a: 1 } : { a: number; } +>a : number + + // try to step on generated name + use(_z); +>use(_z) : any +>use : (a: any) => any +>_z : number + } + use(z); +>use(z) : any +>use : (a: any) => any +>z : string +} +use(y); +>use(y) : any +>use : (a: any) => any +>y : boolean + diff --git a/tests/baselines/reference/downlevelLetConst15.js b/tests/baselines/reference/downlevelLetConst15.js new file mode 100644 index 0000000000..c9b6771919 --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst15.js @@ -0,0 +1,107 @@ +//// [downlevelLetConst15.ts] +'use strict' +declare function use(a: any); + +var x = 10; +var z0, z1, z2, z3; +{ + const x = 20; + use(x); + + const [z0] = [1]; + use(z0); + const [{a: z1}] = [{a: 1}] + use(z1); + const {a: z2} = { a: 1 }; + use(z2); + const {a: {b: z3}} = { a: {b: 1} }; + use(z3); +} +use(x); +use(z0); +use(z1); +use(z2); +use(z3); +var z6; +var y = true; +{ + const y = ""; + const [z6] = [true] + { + const y = 1; + const {a: z6} = { a: 1 } + use(y); + use(z6); + } + use(y); + use(z6); +} +use(y); +use(z6); + +var z = false; +var z5 = 1; +{ + const z = ""; + const [z5] = [5]; + { + const _z = 1; + const {a: _z5} = { a: 1 }; + // try to step on generated name + use(_z); + } + use(z); +} +use(y); + +//// [downlevelLetConst15.js] +'use strict'; +var x = 10; +var z0, z1, z2, z3; +{ + var _x = 20; + use(_x); + var _z0 = ([1])[0]; + use(_z0); + var _z1 = ([{ a: 1 }])[0].a; + use(_z1); + var _z2 = ({ a: 1 }).a; + use(_z2); + var _z3 = ({ a: { b: 1 } }).a.b; + use(_z3); +} +use(x); +use(z0); +use(z1); +use(z2); +use(z3); +var z6; +var y = true; +{ + var _y = ""; + var _z6 = ([true])[0]; + { + var _y_1 = 1; + var _z6_1 = ({ a: 1 }).a; + use(_y_1); + use(_z6_1); + } + use(_y); + use(_z6); +} +use(y); +use(z6); +var z = false; +var z5 = 1; +{ + var _z = ""; + var _z5 = ([5])[0]; + { + var _z_1 = 1; + var _z5_1 = ({ a: 1 }).a; + // try to step on generated name + use(_z_1); + } + use(_z); +} +use(y); diff --git a/tests/baselines/reference/downlevelLetConst15.types b/tests/baselines/reference/downlevelLetConst15.types new file mode 100644 index 0000000000..008d132ab7 --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst15.types @@ -0,0 +1,184 @@ +=== tests/cases/compiler/downlevelLetConst15.ts === +'use strict' +declare function use(a: any); +>use : (a: any) => any +>a : any + +var x = 10; +>x : number + +var z0, z1, z2, z3; +>z0 : any +>z1 : any +>z2 : any +>z3 : any +{ + const x = 20; +>x : number + + use(x); +>use(x) : any +>use : (a: any) => any +>x : number + + const [z0] = [1]; +>z0 : number +>[1] : [number] + + use(z0); +>use(z0) : any +>use : (a: any) => any +>z0 : number + + const [{a: z1}] = [{a: 1}] +>a : unknown +>z1 : number +>[{a: 1}] : [{ a: number; }] +>{a: 1} : { a: number; } +>a : number + + use(z1); +>use(z1) : any +>use : (a: any) => any +>z1 : number + + const {a: z2} = { a: 1 }; +>a : unknown +>z2 : number +>{ a: 1 } : { a: number; } +>a : number + + use(z2); +>use(z2) : any +>use : (a: any) => any +>z2 : number + + const {a: {b: z3}} = { a: {b: 1} }; +>a : unknown +>b : unknown +>z3 : number +>{ a: {b: 1} } : { a: { b: number; }; } +>a : { b: number; } +>{b: 1} : { b: number; } +>b : number + + use(z3); +>use(z3) : any +>use : (a: any) => any +>z3 : number +} +use(x); +>use(x) : any +>use : (a: any) => any +>x : number + +use(z0); +>use(z0) : any +>use : (a: any) => any +>z0 : any + +use(z1); +>use(z1) : any +>use : (a: any) => any +>z1 : any + +use(z2); +>use(z2) : any +>use : (a: any) => any +>z2 : any + +use(z3); +>use(z3) : any +>use : (a: any) => any +>z3 : any + +var z6; +>z6 : any + +var y = true; +>y : boolean +{ + const y = ""; +>y : string + + const [z6] = [true] +>z6 : boolean +>[true] : [boolean] + { + const y = 1; +>y : number + + const {a: z6} = { a: 1 } +>a : unknown +>z6 : number +>{ a: 1 } : { a: number; } +>a : number + + use(y); +>use(y) : any +>use : (a: any) => any +>y : number + + use(z6); +>use(z6) : any +>use : (a: any) => any +>z6 : number + } + use(y); +>use(y) : any +>use : (a: any) => any +>y : string + + use(z6); +>use(z6) : any +>use : (a: any) => any +>z6 : boolean +} +use(y); +>use(y) : any +>use : (a: any) => any +>y : boolean + +use(z6); +>use(z6) : any +>use : (a: any) => any +>z6 : any + +var z = false; +>z : boolean + +var z5 = 1; +>z5 : number +{ + const z = ""; +>z : string + + const [z5] = [5]; +>z5 : number +>[5] : [number] + { + const _z = 1; +>_z : number + + const {a: _z5} = { a: 1 }; +>a : unknown +>_z5 : number +>{ a: 1 } : { a: number; } +>a : number + + // try to step on generated name + use(_z); +>use(_z) : any +>use : (a: any) => any +>_z : number + } + use(z); +>use(z) : any +>use : (a: any) => any +>z : string +} +use(y); +>use(y) : any +>use : (a: any) => any +>y : boolean + diff --git a/tests/baselines/reference/downlevelLetConst16.errors.txt b/tests/baselines/reference/downlevelLetConst16.errors.txt new file mode 100644 index 0000000000..c488e96ca2 --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst16.errors.txt @@ -0,0 +1,249 @@ +tests/cases/compiler/downlevelLetConst16.ts(189,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/compiler/downlevelLetConst16.ts(196,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/compiler/downlevelLetConst16.ts(203,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/compiler/downlevelLetConst16.ts(210,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/compiler/downlevelLetConst16.ts(217,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/compiler/downlevelLetConst16.ts(224,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/compiler/downlevelLetConst16.ts (6 errors) ==== + 'use strict' + + declare function use(a: any); + + var x = 10; + var y; + var z; + use(x); + use(y); + use(z); + function foo1() { + let x = 1; + use(x); + let [y] = [1]; + use(y); + let {a: z} = {a: 1}; + use(z); + } + + function foo2() { + { + let x = 1; + use(x); + let [y] = [1]; + use(y); + let {a: z} = { a: 1 }; + use(z); + } + use(x); + } + + class A { + m1() { + let x = 1; + use(x); + let [y] = [1]; + use(y); + let {a: z} = { a: 1 }; + use(z); + } + m2() { + { + let x = 1; + use(x); + let [y] = [1]; + use(y); + let {a: z} = { a: 1 }; + use(z); + } + use(x); + } + + } + + class B { + m1() { + const x = 1; + use(x); + const [y] = [1]; + use(y); + const {a: z} = { a: 1 }; + use(z); + + } + m2() { + { + const x = 1; + use(x); + const [y] = [1]; + use(y); + const {a: z} = { a: 1 }; + use(z); + + } + use(x); + } + } + + function bar1() { + const x = 1; + use(x); + const [y] = [1]; + use(y); + const {a: z} = { a: 1 }; + use(z); + } + + function bar2() { + { + const x = 1; + use(x); + const [y] = [1]; + use(y); + const {a: z} = { a: 1 }; + use(z); + + } + use(x); + } + + module M1 { + let x = 1; + use(x); + let [y] = [1]; + use(y); + let {a: z} = { a: 1 }; + use(z); + } + + module M2 { + { + let x = 1; + use(x); + let [y] = [1]; + use(y); + let {a: z} = { a: 1 }; + use(z); + } + use(x); + } + + module M3 { + const x = 1; + use(x); + const [y] = [1]; + use(y); + const {a: z} = { a: 1 }; + use(z); + + } + + module M4 { + { + const x = 1; + use(x); + const [y] = [1]; + use(y); + const {a: z} = { a: 1 }; + use(z); + + } + use(x); + use(y); + use(z); + } + + function foo3() { + for (let x; ;) { + use(x); + } + for (let [y] = []; ;) { + use(y); + } + for (let {a: z} = {a: 1}; ;) { + use(z); + } + use(x); + } + + function foo4() { + for (const x = 1; ;) { + use(x); + } + for (const [y] = []; ;) { + use(y); + } + for (const {a: z} = { a: 1 }; ;) { + use(z); + } + use(x); + } + + function foo5() { + for (let x in []) { + use(x); + } + use(x); + } + + function foo6() { + for (const x in []) { + use(x); + } + use(x); + } + + // TODO: once for-of is supported downlevel + function foo7() { + for (let x of []) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + use(x); + } + use(x); + } + + function foo8() { + for (let [x] of []) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + use(x); + } + use(x); + } + + function foo9() { + for (let {a: x} of []) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + use(x); + } + use(x); + } + + function foo10() { + for (const x of []) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + use(x); + } + use(x); + } + + function foo11() { + for (const [x] of []) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + use(x); + } + use(x); + } + + function foo12() { + for (const {a: x} of []) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + use(x); + } + use(x); + } \ No newline at end of file diff --git a/tests/baselines/reference/downlevelLetConst16.js b/tests/baselines/reference/downlevelLetConst16.js new file mode 100644 index 0000000000..36da8ac36f --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst16.js @@ -0,0 +1,441 @@ +//// [downlevelLetConst16.ts] +'use strict' + +declare function use(a: any); + +var x = 10; +var y; +var z; +use(x); +use(y); +use(z); +function foo1() { + let x = 1; + use(x); + let [y] = [1]; + use(y); + let {a: z} = {a: 1}; + use(z); +} + +function foo2() { + { + let x = 1; + use(x); + let [y] = [1]; + use(y); + let {a: z} = { a: 1 }; + use(z); + } + use(x); +} + +class A { + m1() { + let x = 1; + use(x); + let [y] = [1]; + use(y); + let {a: z} = { a: 1 }; + use(z); + } + m2() { + { + let x = 1; + use(x); + let [y] = [1]; + use(y); + let {a: z} = { a: 1 }; + use(z); + } + use(x); + } + +} + +class B { + m1() { + const x = 1; + use(x); + const [y] = [1]; + use(y); + const {a: z} = { a: 1 }; + use(z); + + } + m2() { + { + const x = 1; + use(x); + const [y] = [1]; + use(y); + const {a: z} = { a: 1 }; + use(z); + + } + use(x); + } +} + +function bar1() { + const x = 1; + use(x); + const [y] = [1]; + use(y); + const {a: z} = { a: 1 }; + use(z); +} + +function bar2() { + { + const x = 1; + use(x); + const [y] = [1]; + use(y); + const {a: z} = { a: 1 }; + use(z); + + } + use(x); +} + +module M1 { + let x = 1; + use(x); + let [y] = [1]; + use(y); + let {a: z} = { a: 1 }; + use(z); +} + +module M2 { + { + let x = 1; + use(x); + let [y] = [1]; + use(y); + let {a: z} = { a: 1 }; + use(z); + } + use(x); +} + +module M3 { + const x = 1; + use(x); + const [y] = [1]; + use(y); + const {a: z} = { a: 1 }; + use(z); + +} + +module M4 { + { + const x = 1; + use(x); + const [y] = [1]; + use(y); + const {a: z} = { a: 1 }; + use(z); + + } + use(x); + use(y); + use(z); +} + +function foo3() { + for (let x; ;) { + use(x); + } + for (let [y] = []; ;) { + use(y); + } + for (let {a: z} = {a: 1}; ;) { + use(z); + } + use(x); +} + +function foo4() { + for (const x = 1; ;) { + use(x); + } + for (const [y] = []; ;) { + use(y); + } + for (const {a: z} = { a: 1 }; ;) { + use(z); + } + use(x); +} + +function foo5() { + for (let x in []) { + use(x); + } + use(x); +} + +function foo6() { + for (const x in []) { + use(x); + } + use(x); +} + +// TODO: once for-of is supported downlevel +function foo7() { + for (let x of []) { + use(x); + } + use(x); +} + +function foo8() { + for (let [x] of []) { + use(x); + } + use(x); +} + +function foo9() { + for (let {a: x} of []) { + use(x); + } + use(x); +} + +function foo10() { + for (const x of []) { + use(x); + } + use(x); +} + +function foo11() { + for (const [x] of []) { + use(x); + } + use(x); +} + +function foo12() { + for (const {a: x} of []) { + use(x); + } + use(x); +} + +//// [downlevelLetConst16.js] +'use strict'; +var x = 10; +var y; +var z; +use(x); +use(y); +use(z); +function foo1() { + var _x = 1; + use(_x); + var _y = ([1])[0]; + use(_y); + var _z = ({ a: 1 }).a; + use(_z); +} +function foo2() { + { + var _x = 1; + use(_x); + var _y = ([1])[0]; + use(_y); + var _z = ({ a: 1 }).a; + use(_z); + } + use(x); +} +var A = (function () { + function A() { + } + A.prototype.m1 = function () { + var _x = 1; + use(_x); + var _y = ([1])[0]; + use(_y); + var _z = ({ a: 1 }).a; + use(_z); + }; + A.prototype.m2 = function () { + { + var _x = 1; + use(_x); + var _y = ([1])[0]; + use(_y); + var _z = ({ a: 1 }).a; + use(_z); + } + use(x); + }; + return A; +})(); +var B = (function () { + function B() { + } + B.prototype.m1 = function () { + var _x = 1; + use(_x); + var _y = ([1])[0]; + use(_y); + var _z = ({ a: 1 }).a; + use(_z); + }; + B.prototype.m2 = function () { + { + var _x = 1; + use(_x); + var _y = ([1])[0]; + use(_y); + var _z = ({ a: 1 }).a; + use(_z); + } + use(x); + }; + return B; +})(); +function bar1() { + var _x = 1; + use(_x); + var _y = ([1])[0]; + use(_y); + var _z = ({ a: 1 }).a; + use(_z); +} +function bar2() { + { + var _x = 1; + use(_x); + var _y = ([1])[0]; + use(_y); + var _z = ({ a: 1 }).a; + use(_z); + } + use(x); +} +var M1; +(function (M1) { + var _x = 1; + use(_x); + var _y = ([1])[0]; + use(_y); + var _z = ({ a: 1 }).a; + use(_z); +})(M1 || (M1 = {})); +var M2; +(function (M2) { + { + var _x = 1; + use(_x); + var _y = ([1])[0]; + use(_y); + var _z = ({ a: 1 }).a; + use(_z); + } + use(x); +})(M2 || (M2 = {})); +var M3; +(function (M3) { + var _x = 1; + use(_x); + var _y = ([1])[0]; + use(_y); + var _z = ({ a: 1 }).a; + use(_z); +})(M3 || (M3 = {})); +var M4; +(function (M4) { + { + var _x = 1; + use(_x); + var _y = ([1])[0]; + use(_y); + var _z = ({ a: 1 }).a; + use(_z); + } + use(x); + use(y); + use(z); +})(M4 || (M4 = {})); +function foo3() { + for (var _x = void 0;;) { + use(_x); + } + for (var _y = ([])[0];;) { + use(_y); + } + for (var _z = ({ a: 1 }).a;;) { + use(_z); + } + use(x); +} +function foo4() { + for (var _x = 1;;) { + use(_x); + } + for (var _y = ([])[0];;) { + use(_y); + } + for (var _z = ({ a: 1 }).a;;) { + use(_z); + } + use(x); +} +function foo5() { + for (var _x in []) { + use(_x); + } + use(x); +} +function foo6() { + for (var _x in []) { + use(_x); + } + use(x); +} +// TODO: once for-of is supported downlevel +function foo7() { + for (var _x of []) { + use(_x); + } + use(x); +} +function foo8() { + for (var _x = (void 0)[0] of []) { + use(_x); + } + use(x); +} +function foo9() { + for (var _x = (void 0).a of []) { + use(_x); + } + use(x); +} +function foo10() { + for (var _x of []) { + use(_x); + } + use(x); +} +function foo11() { + for (var _x = (void 0)[0] of []) { + use(_x); + } + use(x); +} +function foo12() { + for (var _x = (void 0).a of []) { + use(_x); + } + use(x); +} diff --git a/tests/baselines/reference/downlevelLetConst17.errors.txt b/tests/baselines/reference/downlevelLetConst17.errors.txt new file mode 100644 index 0000000000..ef8f2b8908 --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst17.errors.txt @@ -0,0 +1,74 @@ +tests/cases/compiler/downlevelLetConst17.ts(66,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/compiler/downlevelLetConst17.ts (1 errors) ==== + 'use strict' + + declare function use(a: any); + + var x; + for (let x = 10; ;) { + use(x); + } + use(x); + + for (const x = 10; ;) { + use(x); + } + + for (; ;) { + let x = 10; + use(x); + x = 1; + } + + for (; ;) { + const x = 10; + use(x); + } + + for (let x; ;) { + use(x); + x = 1; + } + + for (; ;) { + let x; + use(x); + x = 1; + } + + while (true) { + let x; + use(x); + } + + while (true) { + const x = true; + use(x); + } + + do { + let x; + use(x); + } while (true); + + do { + let x; + use(x); + } while (true); + + for (let x in []) { + use(x); + } + + for (const x in []) { + use(x); + } + + // TODO: update once for-of statements are supported downlevel + for (const x of []) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + use(x); + } \ No newline at end of file diff --git a/tests/baselines/reference/downlevelLetConst17.js b/tests/baselines/reference/downlevelLetConst17.js new file mode 100644 index 0000000000..1fe9c1a01e --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst17.js @@ -0,0 +1,124 @@ +//// [downlevelLetConst17.ts] +'use strict' + +declare function use(a: any); + +var x; +for (let x = 10; ;) { + use(x); +} +use(x); + +for (const x = 10; ;) { + use(x); +} + +for (; ;) { + let x = 10; + use(x); + x = 1; +} + +for (; ;) { + const x = 10; + use(x); +} + +for (let x; ;) { + use(x); + x = 1; +} + +for (; ;) { + let x; + use(x); + x = 1; +} + +while (true) { + let x; + use(x); +} + +while (true) { + const x = true; + use(x); +} + +do { + let x; + use(x); +} while (true); + +do { + let x; + use(x); +} while (true); + +for (let x in []) { + use(x); +} + +for (const x in []) { + use(x); +} + +// TODO: update once for-of statements are supported downlevel +for (const x of []) { + use(x); +} + +//// [downlevelLetConst17.js] +'use strict'; +var x; +for (var _x = 10;;) { + use(_x); +} +use(x); +for (var _x_1 = 10;;) { + use(_x_1); +} +for (;;) { + var _x_2 = 10; + use(_x_2); + _x_2 = 1; +} +for (;;) { + var _x_3 = 10; + use(_x_3); +} +for (var _x_4 = void 0;;) { + use(_x_4); + _x_4 = 1; +} +for (;;) { + var _x_5 = void 0; + use(_x_5); + _x_5 = 1; +} +while (true) { + var _x_6 = void 0; + use(_x_6); +} +while (true) { + var _x_7 = true; + use(_x_7); +} +do { + var _x_8 = void 0; + use(_x_8); +} while (true); +do { + var _x_9 = void 0; + use(_x_9); +} while (true); +for (var _x_10 in []) { + use(_x_10); +} +for (var _x_11 in []) { + use(_x_11); +} +// TODO: update once for-of statements are supported downlevel +for (var _x_12 of []) { + use(_x_12); +} diff --git a/tests/baselines/reference/downlevelLetConst18.errors.txt b/tests/baselines/reference/downlevelLetConst18.errors.txt new file mode 100644 index 0000000000..8f30b0f802 --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst18.errors.txt @@ -0,0 +1,60 @@ +tests/cases/compiler/downlevelLetConst18.ts(3,1): error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher. +tests/cases/compiler/downlevelLetConst18.ts(4,14): error TS2393: Duplicate function implementation. +tests/cases/compiler/downlevelLetConst18.ts(7,1): error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher. +tests/cases/compiler/downlevelLetConst18.ts(8,14): error TS2393: Duplicate function implementation. +tests/cases/compiler/downlevelLetConst18.ts(11,1): error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher. +tests/cases/compiler/downlevelLetConst18.ts(15,1): error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher. +tests/cases/compiler/downlevelLetConst18.ts(19,1): error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher. +tests/cases/compiler/downlevelLetConst18.ts(23,1): error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher. +tests/cases/compiler/downlevelLetConst18.ts(27,1): error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher. + + +==== tests/cases/compiler/downlevelLetConst18.ts (9 errors) ==== + 'use strict' + + for (let x; ;) { + ~~~ +!!! error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher. + function foo() { x }; + ~~~ +!!! error TS2393: Duplicate function implementation. + } + + for (let x; ;) { + ~~~ +!!! error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher. + function foo() { x }; + ~~~ +!!! error TS2393: Duplicate function implementation. + } + + for (let x; ;) { + ~~~ +!!! error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher. + (() => { x })(); + } + + for (const x = 1; ;) { + ~~~ +!!! error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher. + (() => { x })(); + } + + for (let x; ;) { + ~~~ +!!! error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher. + ({ foo() { x }}) + } + + for (let x; ;) { + ~~~ +!!! error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher. + ({ get foo() { return x } }) + } + + for (let x; ;) { + ~~~ +!!! error TS4091: Loop contains block-scoped variable 'x' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher. + ({ set foo(v) { x } }) + } + \ No newline at end of file diff --git a/tests/baselines/reference/downlevelLetConst18.js b/tests/baselines/reference/downlevelLetConst18.js new file mode 100644 index 0000000000..e9993a90bc --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst18.js @@ -0,0 +1,57 @@ +//// [downlevelLetConst18.ts] +'use strict' + +for (let x; ;) { + function foo() { x }; +} + +for (let x; ;) { + function foo() { x }; +} + +for (let x; ;) { + (() => { x })(); +} + +for (const x = 1; ;) { + (() => { x })(); +} + +for (let x; ;) { + ({ foo() { x }}) +} + +for (let x; ;) { + ({ get foo() { return x } }) +} + +for (let x; ;) { + ({ set foo(v) { x } }) +} + + +//// [downlevelLetConst18.js] +'use strict'; +for (var x = void 0;;) { + function foo() { x; } + ; +} +for (var _x = void 0;;) { + function foo() { _x; } + ; +} +for (var _x_1 = void 0;;) { + (function () { _x_1; })(); +} +for (var _x_2 = 1;;) { + (function () { _x_2; })(); +} +for (var _x_3 = void 0;;) { + ({ foo: function () { _x_3; } }); +} +for (var _x_4 = void 0;;) { + ({ get foo() { return _x_4; } }); +} +for (var _x_5 = void 0;;) { + ({ set foo(v) { _x_5; } }); +} diff --git a/tests/baselines/reference/downlevelLetConst2.errors.txt b/tests/baselines/reference/downlevelLetConst2.errors.txt new file mode 100644 index 0000000000..9da0c94a12 --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst2.errors.txt @@ -0,0 +1,7 @@ +tests/cases/compiler/downlevelLetConst2.ts(1,7): error TS1155: 'const' declarations must be initialized + + +==== tests/cases/compiler/downlevelLetConst2.ts (1 errors) ==== + const a + ~ +!!! error TS1155: 'const' declarations must be initialized \ No newline at end of file diff --git a/tests/baselines/reference/downlevelLetConst2.js b/tests/baselines/reference/downlevelLetConst2.js new file mode 100644 index 0000000000..a73688cd4a --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst2.js @@ -0,0 +1,5 @@ +//// [downlevelLetConst2.ts] +const a + +//// [downlevelLetConst2.js] +var a; diff --git a/tests/baselines/reference/downlevelLetConst3.js b/tests/baselines/reference/downlevelLetConst3.js new file mode 100644 index 0000000000..f6ef605c26 --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst3.js @@ -0,0 +1,5 @@ +//// [downlevelLetConst3.ts] +const a = 1 + +//// [downlevelLetConst3.js] +var a = 1; diff --git a/tests/baselines/reference/downlevelLetConst3.types b/tests/baselines/reference/downlevelLetConst3.types new file mode 100644 index 0000000000..6cd3f85e07 --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst3.types @@ -0,0 +1,4 @@ +=== tests/cases/compiler/downlevelLetConst3.ts === +const a = 1 +>a : number + diff --git a/tests/baselines/reference/downlevelLetConst4.errors.txt b/tests/baselines/reference/downlevelLetConst4.errors.txt new file mode 100644 index 0000000000..3bf3e58cec --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst4.errors.txt @@ -0,0 +1,7 @@ +tests/cases/compiler/downlevelLetConst4.ts(1,7): error TS1155: 'const' declarations must be initialized + + +==== tests/cases/compiler/downlevelLetConst4.ts (1 errors) ==== + const a: number + ~ +!!! error TS1155: 'const' declarations must be initialized \ No newline at end of file diff --git a/tests/baselines/reference/downlevelLetConst4.js b/tests/baselines/reference/downlevelLetConst4.js new file mode 100644 index 0000000000..725aa5cde8 --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst4.js @@ -0,0 +1,5 @@ +//// [downlevelLetConst4.ts] +const a: number + +//// [downlevelLetConst4.js] +var a; diff --git a/tests/baselines/reference/downlevelLetConst5.js b/tests/baselines/reference/downlevelLetConst5.js new file mode 100644 index 0000000000..271c71b682 --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst5.js @@ -0,0 +1,5 @@ +//// [downlevelLetConst5.ts] +const a: number = 1 + +//// [downlevelLetConst5.js] +var a = 1; diff --git a/tests/baselines/reference/downlevelLetConst5.types b/tests/baselines/reference/downlevelLetConst5.types new file mode 100644 index 0000000000..dd8cdf9fcd --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst5.types @@ -0,0 +1,4 @@ +=== tests/cases/compiler/downlevelLetConst5.ts === +const a: number = 1 +>a : number + diff --git a/tests/baselines/reference/downlevelLetConst6.errors.txt b/tests/baselines/reference/downlevelLetConst6.errors.txt new file mode 100644 index 0000000000..bad0674c5c --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst6.errors.txt @@ -0,0 +1,7 @@ +tests/cases/compiler/downlevelLetConst6.ts(1,1): error TS2304: Cannot find name 'let'. + + +==== tests/cases/compiler/downlevelLetConst6.ts (1 errors) ==== + let + ~~~ +!!! error TS2304: Cannot find name 'let'. \ No newline at end of file diff --git a/tests/baselines/reference/downlevelLetConst6.js b/tests/baselines/reference/downlevelLetConst6.js new file mode 100644 index 0000000000..2a1aea002d --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst6.js @@ -0,0 +1,5 @@ +//// [downlevelLetConst6.ts] +let + +//// [downlevelLetConst6.js] +let; diff --git a/tests/baselines/reference/downlevelLetConst7.js b/tests/baselines/reference/downlevelLetConst7.js new file mode 100644 index 0000000000..6020ddf247 --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst7.js @@ -0,0 +1,5 @@ +//// [downlevelLetConst7.ts] +let a + +//// [downlevelLetConst7.js] +var a; diff --git a/tests/baselines/reference/downlevelLetConst7.types b/tests/baselines/reference/downlevelLetConst7.types new file mode 100644 index 0000000000..9c76479ecf --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst7.types @@ -0,0 +1,4 @@ +=== tests/cases/compiler/downlevelLetConst7.ts === +let a +>a : any + diff --git a/tests/baselines/reference/downlevelLetConst8.js b/tests/baselines/reference/downlevelLetConst8.js new file mode 100644 index 0000000000..5cc548c136 --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst8.js @@ -0,0 +1,5 @@ +//// [downlevelLetConst8.ts] +let a = 1 + +//// [downlevelLetConst8.js] +var a = 1; diff --git a/tests/baselines/reference/downlevelLetConst8.types b/tests/baselines/reference/downlevelLetConst8.types new file mode 100644 index 0000000000..a3b9986bbc --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst8.types @@ -0,0 +1,4 @@ +=== tests/cases/compiler/downlevelLetConst8.ts === +let a = 1 +>a : number + diff --git a/tests/baselines/reference/downlevelLetConst9.js b/tests/baselines/reference/downlevelLetConst9.js new file mode 100644 index 0000000000..c6bcfe27a8 --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst9.js @@ -0,0 +1,5 @@ +//// [downlevelLetConst9.ts] +let a: number + +//// [downlevelLetConst9.js] +var a; diff --git a/tests/baselines/reference/downlevelLetConst9.types b/tests/baselines/reference/downlevelLetConst9.types new file mode 100644 index 0000000000..cab9ac82a6 --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst9.types @@ -0,0 +1,4 @@ +=== tests/cases/compiler/downlevelLetConst9.ts === +let a: number +>a : number + diff --git a/tests/baselines/reference/for-inStatementsDestructuring.errors.txt b/tests/baselines/reference/for-inStatementsDestructuring.errors.txt new file mode 100644 index 0000000000..e540b182cf --- /dev/null +++ b/tests/baselines/reference/for-inStatementsDestructuring.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/statements/for-inStatements/for-inStatementsDestructuring.ts(1,10): error TS2491: The left-hand side of a 'for...in' statement cannot be a destructuring pattern. + + +==== tests/cases/conformance/statements/for-inStatements/for-inStatementsDestructuring.ts (1 errors) ==== + for (var [a, b] in []) {} + ~~~~~~ +!!! error TS2491: The left-hand side of a 'for...in' statement cannot be a destructuring pattern. \ No newline at end of file diff --git a/tests/baselines/reference/for-inStatementsDestructuring.js b/tests/baselines/reference/for-inStatementsDestructuring.js new file mode 100644 index 0000000000..e5e00d5b3a --- /dev/null +++ b/tests/baselines/reference/for-inStatementsDestructuring.js @@ -0,0 +1,5 @@ +//// [for-inStatementsDestructuring.ts] +for (var [a, b] in []) {} + +//// [for-inStatementsDestructuring.js] +for (var _a = void 0, a = _a[0], b = _a[1] in []) { } diff --git a/tests/baselines/reference/for-inStatementsDestructuring2.errors.txt b/tests/baselines/reference/for-inStatementsDestructuring2.errors.txt new file mode 100644 index 0000000000..56d2436d4c --- /dev/null +++ b/tests/baselines/reference/for-inStatementsDestructuring2.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/statements/for-inStatements/for-inStatementsDestructuring2.ts(1,10): error TS2491: The left-hand side of a 'for...in' statement cannot be a destructuring pattern. + + +==== tests/cases/conformance/statements/for-inStatements/for-inStatementsDestructuring2.ts (1 errors) ==== + for (var {a, b} in []) {} + ~~~~~~ +!!! error TS2491: The left-hand side of a 'for...in' statement cannot be a destructuring pattern. \ No newline at end of file diff --git a/tests/baselines/reference/for-inStatementsDestructuring2.js b/tests/baselines/reference/for-inStatementsDestructuring2.js new file mode 100644 index 0000000000..41a6d30919 --- /dev/null +++ b/tests/baselines/reference/for-inStatementsDestructuring2.js @@ -0,0 +1,5 @@ +//// [for-inStatementsDestructuring2.ts] +for (var {a, b} in []) {} + +//// [for-inStatementsDestructuring2.js] +for (var _a = void 0, a = _a.a, b = _a.b in []) { } diff --git a/tests/baselines/reference/for-inStatementsDestructuring3.errors.txt b/tests/baselines/reference/for-inStatementsDestructuring3.errors.txt new file mode 100644 index 0000000000..e3ce65f872 --- /dev/null +++ b/tests/baselines/reference/for-inStatementsDestructuring3.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/statements/for-inStatements/for-inStatementsDestructuring3.ts(2,6): error TS2491: The left-hand side of a 'for...in' statement cannot be a destructuring pattern. + + +==== tests/cases/conformance/statements/for-inStatements/for-inStatementsDestructuring3.ts (1 errors) ==== + var a, b; + for ([a, b] in []) { } + ~~~~~~ +!!! error TS2491: The left-hand side of a 'for...in' statement cannot be a destructuring pattern. \ No newline at end of file diff --git a/tests/baselines/reference/for-inStatementsDestructuring3.js b/tests/baselines/reference/for-inStatementsDestructuring3.js new file mode 100644 index 0000000000..0970740aca --- /dev/null +++ b/tests/baselines/reference/for-inStatementsDestructuring3.js @@ -0,0 +1,7 @@ +//// [for-inStatementsDestructuring3.ts] +var a, b; +for ([a, b] in []) { } + +//// [for-inStatementsDestructuring3.js] +var a, b; +for ([a, b] in []) { } diff --git a/tests/baselines/reference/for-inStatementsDestructuring4.errors.txt b/tests/baselines/reference/for-inStatementsDestructuring4.errors.txt new file mode 100644 index 0000000000..8d3fe2d1b5 --- /dev/null +++ b/tests/baselines/reference/for-inStatementsDestructuring4.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/statements/for-inStatements/for-inStatementsDestructuring4.ts(2,6): error TS2491: The left-hand side of a 'for...in' statement cannot be a destructuring pattern. + + +==== tests/cases/conformance/statements/for-inStatements/for-inStatementsDestructuring4.ts (1 errors) ==== + var a, b; + for ({a, b} in []) { } + ~~~~~~ +!!! error TS2491: The left-hand side of a 'for...in' statement cannot be a destructuring pattern. \ No newline at end of file diff --git a/tests/baselines/reference/for-inStatementsDestructuring4.js b/tests/baselines/reference/for-inStatementsDestructuring4.js new file mode 100644 index 0000000000..0cce61ac96 --- /dev/null +++ b/tests/baselines/reference/for-inStatementsDestructuring4.js @@ -0,0 +1,7 @@ +//// [for-inStatementsDestructuring4.ts] +var a, b; +for ({a, b} in []) { } + +//// [for-inStatementsDestructuring4.js] +var a, b; +for ({ a: a, b: b } in []) { } diff --git a/tests/baselines/reference/for-of1.js b/tests/baselines/reference/for-of1.js new file mode 100644 index 0000000000..9df6a96d78 --- /dev/null +++ b/tests/baselines/reference/for-of1.js @@ -0,0 +1,7 @@ +//// [for-of1.ts] +var v; +for (v of []) { } + +//// [for-of1.js] +var v; +for (v of []) { } diff --git a/tests/baselines/reference/for-of1.types b/tests/baselines/reference/for-of1.types new file mode 100644 index 0000000000..b21bb6046a --- /dev/null +++ b/tests/baselines/reference/for-of1.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/es6/for-ofStatements/for-of1.ts === +var v; +>v : any + +for (v of []) { } +>v : any +>[] : undefined[] + diff --git a/tests/baselines/reference/for-of10.errors.txt b/tests/baselines/reference/for-of10.errors.txt new file mode 100644 index 0000000000..1636f1a02d --- /dev/null +++ b/tests/baselines/reference/for-of10.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/es6/for-ofStatements/for-of10.ts(2,6): error TS2322: Type 'number' is not assignable to type 'string'. + + +==== tests/cases/conformance/es6/for-ofStatements/for-of10.ts (1 errors) ==== + var v: string; + for (v of [0]) { } + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/for-of10.js b/tests/baselines/reference/for-of10.js new file mode 100644 index 0000000000..7fd05f5479 --- /dev/null +++ b/tests/baselines/reference/for-of10.js @@ -0,0 +1,7 @@ +//// [for-of10.ts] +var v: string; +for (v of [0]) { } + +//// [for-of10.js] +var v; +for (v of [0]) { } diff --git a/tests/baselines/reference/for-of11.errors.txt b/tests/baselines/reference/for-of11.errors.txt new file mode 100644 index 0000000000..dc527e73ef --- /dev/null +++ b/tests/baselines/reference/for-of11.errors.txt @@ -0,0 +1,10 @@ +tests/cases/conformance/es6/for-ofStatements/for-of11.ts(2,6): error TS2322: Type 'string | number' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. + + +==== tests/cases/conformance/es6/for-ofStatements/for-of11.ts (1 errors) ==== + var v: string; + for (v of [0, ""]) { } + ~ +!!! error TS2322: Type 'string | number' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/for-of11.js b/tests/baselines/reference/for-of11.js new file mode 100644 index 0000000000..055ed0039d --- /dev/null +++ b/tests/baselines/reference/for-of11.js @@ -0,0 +1,7 @@ +//// [for-of11.ts] +var v: string; +for (v of [0, ""]) { } + +//// [for-of11.js] +var v; +for (v of [0, ""]) { } diff --git a/tests/baselines/reference/for-of12.errors.txt b/tests/baselines/reference/for-of12.errors.txt new file mode 100644 index 0000000000..f19fa5ed01 --- /dev/null +++ b/tests/baselines/reference/for-of12.errors.txt @@ -0,0 +1,10 @@ +tests/cases/conformance/es6/for-ofStatements/for-of12.ts(2,6): error TS2322: Type 'string | number' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. + + +==== tests/cases/conformance/es6/for-ofStatements/for-of12.ts (1 errors) ==== + var v: string; + for (v of [0, ""].values()) { } + ~ +!!! error TS2322: Type 'string | number' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/for-of12.js b/tests/baselines/reference/for-of12.js new file mode 100644 index 0000000000..6185ca8e33 --- /dev/null +++ b/tests/baselines/reference/for-of12.js @@ -0,0 +1,7 @@ +//// [for-of12.ts] +var v: string; +for (v of [0, ""].values()) { } + +//// [for-of12.js] +var v; +for (v of [0, ""].values()) { } diff --git a/tests/baselines/reference/for-of13.js b/tests/baselines/reference/for-of13.js new file mode 100644 index 0000000000..e66668f173 --- /dev/null +++ b/tests/baselines/reference/for-of13.js @@ -0,0 +1,7 @@ +//// [for-of13.ts] +var v: string; +for (v of [""].values()) { } + +//// [for-of13.js] +var v; +for (v of [""].values()) { } diff --git a/tests/baselines/reference/for-of13.types b/tests/baselines/reference/for-of13.types new file mode 100644 index 0000000000..4bb29c1e0a --- /dev/null +++ b/tests/baselines/reference/for-of13.types @@ -0,0 +1,11 @@ +=== tests/cases/conformance/es6/for-ofStatements/for-of13.ts === +var v: string; +>v : string + +for (v of [""].values()) { } +>v : string +>[""].values() : IterableIterator +>[""].values : () => IterableIterator +>[""] : string[] +>values : () => IterableIterator + diff --git a/tests/baselines/reference/for-of14.errors.txt b/tests/baselines/reference/for-of14.errors.txt new file mode 100644 index 0000000000..5e8223381c --- /dev/null +++ b/tests/baselines/reference/for-of14.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/for-ofStatements/for-of14.ts(2,11): error TS2488: The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator. + + +==== tests/cases/conformance/es6/for-ofStatements/for-of14.ts (1 errors) ==== + var v: string; + for (v of new StringIterator) { } // Should fail because the iterator is not iterable + ~~~~~~~~~~~~~~~~~~ +!!! error TS2488: The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator. + + class StringIterator { + next() { + return ""; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/for-of14.js b/tests/baselines/reference/for-of14.js new file mode 100644 index 0000000000..d5f9e29b76 --- /dev/null +++ b/tests/baselines/reference/for-of14.js @@ -0,0 +1,21 @@ +//// [for-of14.ts] +var v: string; +for (v of new StringIterator) { } // Should fail because the iterator is not iterable + +class StringIterator { + next() { + return ""; + } +} + +//// [for-of14.js] +var v; +for (v of new StringIterator) { } // Should fail because the iterator is not iterable +var StringIterator = (function () { + function StringIterator() { + } + StringIterator.prototype.next = function () { + return ""; + }; + return StringIterator; +})(); diff --git a/tests/baselines/reference/for-of15.errors.txt b/tests/baselines/reference/for-of15.errors.txt new file mode 100644 index 0000000000..20a4abe4bd --- /dev/null +++ b/tests/baselines/reference/for-of15.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/for-ofStatements/for-of15.ts(2,11): error TS2490: The type returned by the 'next()' method of an iterator must have a 'value' property. + + +==== tests/cases/conformance/es6/for-ofStatements/for-of15.ts (1 errors) ==== + var v: string; + for (v of new StringIterator) { } // Should fail + ~~~~~~~~~~~~~~~~~~ +!!! error TS2490: The type returned by the 'next()' method of an iterator must have a 'value' property. + + class StringIterator { + next() { + return ""; + } + [Symbol.iterator]() { + return this; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/for-of15.js b/tests/baselines/reference/for-of15.js new file mode 100644 index 0000000000..3695538975 --- /dev/null +++ b/tests/baselines/reference/for-of15.js @@ -0,0 +1,27 @@ +//// [for-of15.ts] +var v: string; +for (v of new StringIterator) { } // Should fail + +class StringIterator { + next() { + return ""; + } + [Symbol.iterator]() { + return this; + } +} + +//// [for-of15.js] +var v; +for (v of new StringIterator) { } // Should fail +var StringIterator = (function () { + function StringIterator() { + } + StringIterator.prototype.next = function () { + return ""; + }; + StringIterator.prototype[Symbol.iterator] = function () { + return this; + }; + return StringIterator; +})(); diff --git a/tests/baselines/reference/for-of16.errors.txt b/tests/baselines/reference/for-of16.errors.txt new file mode 100644 index 0000000000..e3ecca1a25 --- /dev/null +++ b/tests/baselines/reference/for-of16.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/for-ofStatements/for-of16.ts(2,11): error TS2489: The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method. + + +==== tests/cases/conformance/es6/for-ofStatements/for-of16.ts (1 errors) ==== + var v: string; + for (v of new StringIterator) { } // Should fail + ~~~~~~~~~~~~~~~~~~ +!!! error TS2489: The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method. + + class StringIterator { + [Symbol.iterator]() { + return this; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/for-of16.js b/tests/baselines/reference/for-of16.js new file mode 100644 index 0000000000..21ba2adb75 --- /dev/null +++ b/tests/baselines/reference/for-of16.js @@ -0,0 +1,21 @@ +//// [for-of16.ts] +var v: string; +for (v of new StringIterator) { } // Should fail + +class StringIterator { + [Symbol.iterator]() { + return this; + } +} + +//// [for-of16.js] +var v; +for (v of new StringIterator) { } // Should fail +var StringIterator = (function () { + function StringIterator() { + } + StringIterator.prototype[Symbol.iterator] = function () { + return this; + }; + return StringIterator; +})(); diff --git a/tests/baselines/reference/for-of17.errors.txt b/tests/baselines/reference/for-of17.errors.txt new file mode 100644 index 0000000000..dfdeb8db00 --- /dev/null +++ b/tests/baselines/reference/for-of17.errors.txt @@ -0,0 +1,20 @@ +tests/cases/conformance/es6/for-ofStatements/for-of17.ts(2,6): error TS2322: Type 'number' is not assignable to type 'string'. + + +==== tests/cases/conformance/es6/for-ofStatements/for-of17.ts (1 errors) ==== + var v: string; + for (v of new NumberIterator) { } // Should succeed + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. + + class NumberIterator { + next() { + return { + value: 0, + done: false + }; + } + [Symbol.iterator]() { + return this; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/for-of17.js b/tests/baselines/reference/for-of17.js new file mode 100644 index 0000000000..5c56cdab44 --- /dev/null +++ b/tests/baselines/reference/for-of17.js @@ -0,0 +1,33 @@ +//// [for-of17.ts] +var v: string; +for (v of new NumberIterator) { } // Should succeed + +class NumberIterator { + next() { + return { + value: 0, + done: false + }; + } + [Symbol.iterator]() { + return this; + } +} + +//// [for-of17.js] +var v; +for (v of new NumberIterator) { } // Should succeed +var NumberIterator = (function () { + function NumberIterator() { + } + NumberIterator.prototype.next = function () { + return { + value: 0, + done: false + }; + }; + NumberIterator.prototype[Symbol.iterator] = function () { + return this; + }; + return NumberIterator; +})(); diff --git a/tests/baselines/reference/for-of18.js b/tests/baselines/reference/for-of18.js new file mode 100644 index 0000000000..57168d9bf0 --- /dev/null +++ b/tests/baselines/reference/for-of18.js @@ -0,0 +1,33 @@ +//// [for-of18.ts] +var v: string; +for (v of new StringIterator) { } // Should succeed + +class StringIterator { + next() { + return { + value: "", + done: false + }; + } + [Symbol.iterator]() { + return this; + } +} + +//// [for-of18.js] +var v; +for (v of new StringIterator) { } // Should succeed +var StringIterator = (function () { + function StringIterator() { + } + StringIterator.prototype.next = function () { + return { + value: "", + done: false + }; + }; + StringIterator.prototype[Symbol.iterator] = function () { + return this; + }; + return StringIterator; +})(); diff --git a/tests/baselines/reference/for-of18.types b/tests/baselines/reference/for-of18.types new file mode 100644 index 0000000000..9ade935947 --- /dev/null +++ b/tests/baselines/reference/for-of18.types @@ -0,0 +1,35 @@ +=== tests/cases/conformance/es6/for-ofStatements/for-of18.ts === +var v: string; +>v : string + +for (v of new StringIterator) { } // Should succeed +>v : string +>new StringIterator : StringIterator +>StringIterator : typeof StringIterator + +class StringIterator { +>StringIterator : StringIterator + + next() { +>next : () => { value: string; done: boolean; } + + return { +>{ value: "", done: false } : { value: string; done: boolean; } + + value: "", +>value : string + + done: false +>done : boolean + + }; + } + [Symbol.iterator]() { +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + + return this; +>this : StringIterator + } +} diff --git a/tests/baselines/reference/for-of19.js b/tests/baselines/reference/for-of19.js new file mode 100644 index 0000000000..eefb9339f1 --- /dev/null +++ b/tests/baselines/reference/for-of19.js @@ -0,0 +1,41 @@ +//// [for-of19.ts] +for (var v of new FooIterator) { + v; +} + +class Foo { } +class FooIterator { + next() { + return { + value: new Foo, + done: false + }; + } + [Symbol.iterator]() { + return this; + } +} + +//// [for-of19.js] +for (var v of new FooIterator) { + v; +} +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var FooIterator = (function () { + function FooIterator() { + } + FooIterator.prototype.next = function () { + return { + value: new Foo, + done: false + }; + }; + FooIterator.prototype[Symbol.iterator] = function () { + return this; + }; + return FooIterator; +})(); diff --git a/tests/baselines/reference/for-of19.types b/tests/baselines/reference/for-of19.types new file mode 100644 index 0000000000..49172b09d8 --- /dev/null +++ b/tests/baselines/reference/for-of19.types @@ -0,0 +1,41 @@ +=== tests/cases/conformance/es6/for-ofStatements/for-of19.ts === +for (var v of new FooIterator) { +>v : Foo +>new FooIterator : FooIterator +>FooIterator : typeof FooIterator + + v; +>v : Foo +} + +class Foo { } +>Foo : Foo + +class FooIterator { +>FooIterator : FooIterator + + next() { +>next : () => { value: Foo; done: boolean; } + + return { +>{ value: new Foo, done: false } : { value: Foo; done: boolean; } + + value: new Foo, +>value : Foo +>new Foo : Foo +>Foo : typeof Foo + + done: false +>done : boolean + + }; + } + [Symbol.iterator]() { +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + + return this; +>this : FooIterator + } +} diff --git a/tests/baselines/reference/for-of2.errors.txt b/tests/baselines/reference/for-of2.errors.txt new file mode 100644 index 0000000000..0b5133cde1 --- /dev/null +++ b/tests/baselines/reference/for-of2.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/es6/for-ofStatements/for-of2.ts(1,7): error TS1155: 'const' declarations must be initialized +tests/cases/conformance/es6/for-ofStatements/for-of2.ts(2,6): error TS2485: The left-hand side of a 'for...of' statement cannot be a previously defined constant. + + +==== tests/cases/conformance/es6/for-ofStatements/for-of2.ts (2 errors) ==== + const v; + ~ +!!! error TS1155: 'const' declarations must be initialized + for (v of []) { } + ~ +!!! error TS2485: The left-hand side of a 'for...of' statement cannot be a previously defined constant. \ No newline at end of file diff --git a/tests/baselines/reference/for-of2.js b/tests/baselines/reference/for-of2.js new file mode 100644 index 0000000000..d7eceb7c49 --- /dev/null +++ b/tests/baselines/reference/for-of2.js @@ -0,0 +1,7 @@ +//// [for-of2.ts] +const v; +for (v of []) { } + +//// [for-of2.js] +const v; +for (v of []) { } diff --git a/tests/baselines/reference/for-of20.js b/tests/baselines/reference/for-of20.js new file mode 100644 index 0000000000..39b1081954 --- /dev/null +++ b/tests/baselines/reference/for-of20.js @@ -0,0 +1,41 @@ +//// [for-of20.ts] +for (let v of new FooIterator) { + v; +} + +class Foo { } +class FooIterator { + next() { + return { + value: new Foo, + done: false + }; + } + [Symbol.iterator]() { + return this; + } +} + +//// [for-of20.js] +for (let v of new FooIterator) { + v; +} +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var FooIterator = (function () { + function FooIterator() { + } + FooIterator.prototype.next = function () { + return { + value: new Foo, + done: false + }; + }; + FooIterator.prototype[Symbol.iterator] = function () { + return this; + }; + return FooIterator; +})(); diff --git a/tests/baselines/reference/for-of20.types b/tests/baselines/reference/for-of20.types new file mode 100644 index 0000000000..e967869fbd --- /dev/null +++ b/tests/baselines/reference/for-of20.types @@ -0,0 +1,41 @@ +=== tests/cases/conformance/es6/for-ofStatements/for-of20.ts === +for (let v of new FooIterator) { +>v : Foo +>new FooIterator : FooIterator +>FooIterator : typeof FooIterator + + v; +>v : Foo +} + +class Foo { } +>Foo : Foo + +class FooIterator { +>FooIterator : FooIterator + + next() { +>next : () => { value: Foo; done: boolean; } + + return { +>{ value: new Foo, done: false } : { value: Foo; done: boolean; } + + value: new Foo, +>value : Foo +>new Foo : Foo +>Foo : typeof Foo + + done: false +>done : boolean + + }; + } + [Symbol.iterator]() { +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + + return this; +>this : FooIterator + } +} diff --git a/tests/baselines/reference/for-of21.js b/tests/baselines/reference/for-of21.js new file mode 100644 index 0000000000..5deaad3c2d --- /dev/null +++ b/tests/baselines/reference/for-of21.js @@ -0,0 +1,41 @@ +//// [for-of21.ts] +for (const v of new FooIterator) { + v; +} + +class Foo { } +class FooIterator { + next() { + return { + value: new Foo, + done: false + }; + } + [Symbol.iterator]() { + return this; + } +} + +//// [for-of21.js] +for (const v of new FooIterator) { + v; +} +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var FooIterator = (function () { + function FooIterator() { + } + FooIterator.prototype.next = function () { + return { + value: new Foo, + done: false + }; + }; + FooIterator.prototype[Symbol.iterator] = function () { + return this; + }; + return FooIterator; +})(); diff --git a/tests/baselines/reference/for-of21.types b/tests/baselines/reference/for-of21.types new file mode 100644 index 0000000000..362f92577e --- /dev/null +++ b/tests/baselines/reference/for-of21.types @@ -0,0 +1,41 @@ +=== tests/cases/conformance/es6/for-ofStatements/for-of21.ts === +for (const v of new FooIterator) { +>v : Foo +>new FooIterator : FooIterator +>FooIterator : typeof FooIterator + + v; +>v : Foo +} + +class Foo { } +>Foo : Foo + +class FooIterator { +>FooIterator : FooIterator + + next() { +>next : () => { value: Foo; done: boolean; } + + return { +>{ value: new Foo, done: false } : { value: Foo; done: boolean; } + + value: new Foo, +>value : Foo +>new Foo : Foo +>Foo : typeof Foo + + done: false +>done : boolean + + }; + } + [Symbol.iterator]() { +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + + return this; +>this : FooIterator + } +} diff --git a/tests/baselines/reference/for-of22.js b/tests/baselines/reference/for-of22.js new file mode 100644 index 0000000000..d38accb6cd --- /dev/null +++ b/tests/baselines/reference/for-of22.js @@ -0,0 +1,42 @@ +//// [for-of22.ts] +v; +for (var v of new FooIterator) { + +} + +class Foo { } +class FooIterator { + next() { + return { + value: new Foo, + done: false + }; + } + [Symbol.iterator]() { + return this; + } +} + +//// [for-of22.js] +v; +for (var v of new FooIterator) { +} +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var FooIterator = (function () { + function FooIterator() { + } + FooIterator.prototype.next = function () { + return { + value: new Foo, + done: false + }; + }; + FooIterator.prototype[Symbol.iterator] = function () { + return this; + }; + return FooIterator; +})(); diff --git a/tests/baselines/reference/for-of22.types b/tests/baselines/reference/for-of22.types new file mode 100644 index 0000000000..bb2d5569bf --- /dev/null +++ b/tests/baselines/reference/for-of22.types @@ -0,0 +1,42 @@ +=== tests/cases/conformance/es6/for-ofStatements/for-of22.ts === +v; +>v : Foo + +for (var v of new FooIterator) { +>v : Foo +>new FooIterator : FooIterator +>FooIterator : typeof FooIterator + +} + +class Foo { } +>Foo : Foo + +class FooIterator { +>FooIterator : FooIterator + + next() { +>next : () => { value: Foo; done: boolean; } + + return { +>{ value: new Foo, done: false } : { value: Foo; done: boolean; } + + value: new Foo, +>value : Foo +>new Foo : Foo +>Foo : typeof Foo + + done: false +>done : boolean + + }; + } + [Symbol.iterator]() { +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + + return this; +>this : FooIterator + } +} diff --git a/tests/baselines/reference/for-of23.js b/tests/baselines/reference/for-of23.js new file mode 100644 index 0000000000..87bb1fd428 --- /dev/null +++ b/tests/baselines/reference/for-of23.js @@ -0,0 +1,41 @@ +//// [for-of23.ts] +for (const v of new FooIterator) { + const v = 0; // new scope +} + +class Foo { } +class FooIterator { + next() { + return { + value: new Foo, + done: false + }; + } + [Symbol.iterator]() { + return this; + } +} + +//// [for-of23.js] +for (const v of new FooIterator) { + const v = 0; // new scope +} +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var FooIterator = (function () { + function FooIterator() { + } + FooIterator.prototype.next = function () { + return { + value: new Foo, + done: false + }; + }; + FooIterator.prototype[Symbol.iterator] = function () { + return this; + }; + return FooIterator; +})(); diff --git a/tests/baselines/reference/for-of23.types b/tests/baselines/reference/for-of23.types new file mode 100644 index 0000000000..b490616edc --- /dev/null +++ b/tests/baselines/reference/for-of23.types @@ -0,0 +1,41 @@ +=== tests/cases/conformance/es6/for-ofStatements/for-of23.ts === +for (const v of new FooIterator) { +>v : Foo +>new FooIterator : FooIterator +>FooIterator : typeof FooIterator + + const v = 0; // new scope +>v : number +} + +class Foo { } +>Foo : Foo + +class FooIterator { +>FooIterator : FooIterator + + next() { +>next : () => { value: Foo; done: boolean; } + + return { +>{ value: new Foo, done: false } : { value: Foo; done: boolean; } + + value: new Foo, +>value : Foo +>new Foo : Foo +>Foo : typeof Foo + + done: false +>done : boolean + + }; + } + [Symbol.iterator]() { +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + + return this; +>this : FooIterator + } +} diff --git a/tests/baselines/reference/for-of24.js b/tests/baselines/reference/for-of24.js new file mode 100644 index 0000000000..b491851960 --- /dev/null +++ b/tests/baselines/reference/for-of24.js @@ -0,0 +1,8 @@ +//// [for-of24.ts] +var x: any; +for (var v of x) { } + + +//// [for-of24.js] +var x; +for (var v of x) { } diff --git a/tests/baselines/reference/for-of24.types b/tests/baselines/reference/for-of24.types new file mode 100644 index 0000000000..dc27cc32e2 --- /dev/null +++ b/tests/baselines/reference/for-of24.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/es6/for-ofStatements/for-of24.ts === +var x: any; +>x : any + +for (var v of x) { } +>v : any +>x : any + diff --git a/tests/baselines/reference/for-of25.js b/tests/baselines/reference/for-of25.js new file mode 100644 index 0000000000..21b5ce1408 --- /dev/null +++ b/tests/baselines/reference/for-of25.js @@ -0,0 +1,21 @@ +//// [for-of25.ts] +var x: any; +for (var v of new StringIterator) { } + +class StringIterator { + [Symbol.iterator]() { + return x; + } +} + +//// [for-of25.js] +var x; +for (var v of new StringIterator) { } +var StringIterator = (function () { + function StringIterator() { + } + StringIterator.prototype[Symbol.iterator] = function () { + return x; + }; + return StringIterator; +})(); diff --git a/tests/baselines/reference/for-of25.types b/tests/baselines/reference/for-of25.types new file mode 100644 index 0000000000..c4d6b32aeb --- /dev/null +++ b/tests/baselines/reference/for-of25.types @@ -0,0 +1,21 @@ +=== tests/cases/conformance/es6/for-ofStatements/for-of25.ts === +var x: any; +>x : any + +for (var v of new StringIterator) { } +>v : any +>new StringIterator : StringIterator +>StringIterator : typeof StringIterator + +class StringIterator { +>StringIterator : StringIterator + + [Symbol.iterator]() { +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + + return x; +>x : any + } +} diff --git a/tests/baselines/reference/for-of26.js b/tests/baselines/reference/for-of26.js new file mode 100644 index 0000000000..a45492a81c --- /dev/null +++ b/tests/baselines/reference/for-of26.js @@ -0,0 +1,27 @@ +//// [for-of26.ts] +var x: any; +for (var v of new StringIterator) { } + +class StringIterator { + next() { + return x; + } + [Symbol.iterator]() { + return this; + } +} + +//// [for-of26.js] +var x; +for (var v of new StringIterator) { } +var StringIterator = (function () { + function StringIterator() { + } + StringIterator.prototype.next = function () { + return x; + }; + StringIterator.prototype[Symbol.iterator] = function () { + return this; + }; + return StringIterator; +})(); diff --git a/tests/baselines/reference/for-of26.types b/tests/baselines/reference/for-of26.types new file mode 100644 index 0000000000..d2608fbf15 --- /dev/null +++ b/tests/baselines/reference/for-of26.types @@ -0,0 +1,27 @@ +=== tests/cases/conformance/es6/for-ofStatements/for-of26.ts === +var x: any; +>x : any + +for (var v of new StringIterator) { } +>v : any +>new StringIterator : StringIterator +>StringIterator : typeof StringIterator + +class StringIterator { +>StringIterator : StringIterator + + next() { +>next : () => any + + return x; +>x : any + } + [Symbol.iterator]() { +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + + return this; +>this : StringIterator + } +} diff --git a/tests/baselines/reference/for-of27.js b/tests/baselines/reference/for-of27.js new file mode 100644 index 0000000000..91e1e7194c --- /dev/null +++ b/tests/baselines/reference/for-of27.js @@ -0,0 +1,14 @@ +//// [for-of27.ts] +for (var v of new StringIterator) { } + +class StringIterator { + [Symbol.iterator]: any; +} + +//// [for-of27.js] +for (var v of new StringIterator) { } +var StringIterator = (function () { + function StringIterator() { + } + return StringIterator; +})(); diff --git a/tests/baselines/reference/for-of27.types b/tests/baselines/reference/for-of27.types new file mode 100644 index 0000000000..8e9130ce27 --- /dev/null +++ b/tests/baselines/reference/for-of27.types @@ -0,0 +1,14 @@ +=== tests/cases/conformance/es6/for-ofStatements/for-of27.ts === +for (var v of new StringIterator) { } +>v : any +>new StringIterator : StringIterator +>StringIterator : typeof StringIterator + +class StringIterator { +>StringIterator : StringIterator + + [Symbol.iterator]: any; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +} diff --git a/tests/baselines/reference/for-of28.js b/tests/baselines/reference/for-of28.js new file mode 100644 index 0000000000..06029e6bb0 --- /dev/null +++ b/tests/baselines/reference/for-of28.js @@ -0,0 +1,20 @@ +//// [for-of28.ts] +for (var v of new StringIterator) { } + +class StringIterator { + next: any; + [Symbol.iterator]() { + return this; + } +} + +//// [for-of28.js] +for (var v of new StringIterator) { } +var StringIterator = (function () { + function StringIterator() { + } + StringIterator.prototype[Symbol.iterator] = function () { + return this; + }; + return StringIterator; +})(); diff --git a/tests/baselines/reference/for-of28.types b/tests/baselines/reference/for-of28.types new file mode 100644 index 0000000000..91b77a55a4 --- /dev/null +++ b/tests/baselines/reference/for-of28.types @@ -0,0 +1,21 @@ +=== tests/cases/conformance/es6/for-ofStatements/for-of28.ts === +for (var v of new StringIterator) { } +>v : any +>new StringIterator : StringIterator +>StringIterator : typeof StringIterator + +class StringIterator { +>StringIterator : StringIterator + + next: any; +>next : any + + [Symbol.iterator]() { +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + + return this; +>this : StringIterator + } +} diff --git a/tests/baselines/reference/for-of29.errors.txt b/tests/baselines/reference/for-of29.errors.txt new file mode 100644 index 0000000000..748fcf4905 --- /dev/null +++ b/tests/baselines/reference/for-of29.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/for-ofStatements/for-of29.ts(5,15): error TS2322: Type '{ [Symbol.iterator]?(): Iterator; }' is not assignable to type 'Iterable'. + Property '[Symbol.iterator]' is optional in type '{ [Symbol.iterator]?(): Iterator; }' but required in type 'Iterable'. + + +==== tests/cases/conformance/es6/for-ofStatements/for-of29.ts (1 errors) ==== + var iterableWithOptionalIterator: { + [Symbol.iterator]?(): Iterator + }; + + for (var v of iterableWithOptionalIterator) { } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '{ [Symbol.iterator]?(): Iterator; }' is not assignable to type 'Iterable'. +!!! error TS2322: Property '[Symbol.iterator]' is optional in type '{ [Symbol.iterator]?(): Iterator; }' but required in type 'Iterable'. + \ No newline at end of file diff --git a/tests/baselines/reference/for-of29.js b/tests/baselines/reference/for-of29.js new file mode 100644 index 0000000000..450cafbde8 --- /dev/null +++ b/tests/baselines/reference/for-of29.js @@ -0,0 +1,11 @@ +//// [for-of29.ts] +var iterableWithOptionalIterator: { + [Symbol.iterator]?(): Iterator +}; + +for (var v of iterableWithOptionalIterator) { } + + +//// [for-of29.js] +var iterableWithOptionalIterator; +for (var v of iterableWithOptionalIterator) { } diff --git a/tests/baselines/reference/for-of3.errors.txt b/tests/baselines/reference/for-of3.errors.txt new file mode 100644 index 0000000000..ba8e3e4a5c --- /dev/null +++ b/tests/baselines/reference/for-of3.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/es6/for-ofStatements/for-of3.ts(2,6): error TS2487: Invalid left-hand side in 'for...of' statement. + + +==== tests/cases/conformance/es6/for-ofStatements/for-of3.ts (1 errors) ==== + var v; + for (v++ of []) { } + ~~~ +!!! error TS2487: Invalid left-hand side in 'for...of' statement. \ No newline at end of file diff --git a/tests/baselines/reference/for-of3.js b/tests/baselines/reference/for-of3.js new file mode 100644 index 0000000000..7ef2718770 --- /dev/null +++ b/tests/baselines/reference/for-of3.js @@ -0,0 +1,7 @@ +//// [for-of3.ts] +var v; +for (v++ of []) { } + +//// [for-of3.js] +var v; +for (v++ of []) { } diff --git a/tests/baselines/reference/for-of30.errors.txt b/tests/baselines/reference/for-of30.errors.txt new file mode 100644 index 0000000000..6434b5294d --- /dev/null +++ b/tests/baselines/reference/for-of30.errors.txt @@ -0,0 +1,32 @@ +tests/cases/conformance/es6/for-ofStatements/for-of30.ts(1,15): error TS2322: Type 'StringIterator' is not assignable to type 'Iterable'. + Types of property '[Symbol.iterator]' are incompatible. + Type '() => StringIterator' is not assignable to type '() => Iterator'. + Type 'StringIterator' is not assignable to type 'Iterator'. + Types of property 'return' are incompatible. + Type 'number' is not assignable to type '(value?: any) => IteratorResult'. + + +==== tests/cases/conformance/es6/for-ofStatements/for-of30.ts (1 errors) ==== + for (var v of new StringIterator) { } + ~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterable'. +!!! error TS2322: Types of property '[Symbol.iterator]' are incompatible. +!!! error TS2322: Type '() => StringIterator' is not assignable to type '() => Iterator'. +!!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterator'. +!!! error TS2322: Types of property 'return' are incompatible. +!!! error TS2322: Type 'number' is not assignable to type '(value?: any) => IteratorResult'. + + class StringIterator { + next() { + return { + done: false, + value: "" + } + } + + return = 0; + + [Symbol.iterator]() { + return this; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/for-of30.js b/tests/baselines/reference/for-of30.js new file mode 100644 index 0000000000..4618dae5ff --- /dev/null +++ b/tests/baselines/reference/for-of30.js @@ -0,0 +1,35 @@ +//// [for-of30.ts] +for (var v of new StringIterator) { } + +class StringIterator { + next() { + return { + done: false, + value: "" + } + } + + return = 0; + + [Symbol.iterator]() { + return this; + } +} + +//// [for-of30.js] +for (var v of new StringIterator) { } +var StringIterator = (function () { + function StringIterator() { + this.return = 0; + } + StringIterator.prototype.next = function () { + return { + done: false, + value: "" + }; + }; + StringIterator.prototype[Symbol.iterator] = function () { + return this; + }; + return StringIterator; +})(); diff --git a/tests/baselines/reference/for-of31.errors.txt b/tests/baselines/reference/for-of31.errors.txt new file mode 100644 index 0000000000..74afff00e9 --- /dev/null +++ b/tests/baselines/reference/for-of31.errors.txt @@ -0,0 +1,34 @@ +tests/cases/conformance/es6/for-ofStatements/for-of31.ts(1,15): error TS2322: Type 'StringIterator' is not assignable to type 'Iterable'. + Types of property '[Symbol.iterator]' are incompatible. + Type '() => StringIterator' is not assignable to type '() => Iterator'. + Type 'StringIterator' is not assignable to type 'Iterator'. + Types of property 'next' are incompatible. + Type '() => { value: string; }' is not assignable to type '() => IteratorResult'. + Type '{ value: string; }' is not assignable to type 'IteratorResult'. + Property 'done' is missing in type '{ value: string; }'. + + +==== tests/cases/conformance/es6/for-ofStatements/for-of31.ts (1 errors) ==== + for (var v of new StringIterator) { } + ~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterable'. +!!! error TS2322: Types of property '[Symbol.iterator]' are incompatible. +!!! error TS2322: Type '() => StringIterator' is not assignable to type '() => Iterator'. +!!! error TS2322: Type 'StringIterator' is not assignable to type 'Iterator'. +!!! error TS2322: Types of property 'next' are incompatible. +!!! error TS2322: Type '() => { value: string; }' is not assignable to type '() => IteratorResult'. +!!! error TS2322: Type '{ value: string; }' is not assignable to type 'IteratorResult'. +!!! error TS2322: Property 'done' is missing in type '{ value: string; }'. + + class StringIterator { + next() { + return { + // no done property + value: "" + } + } + + [Symbol.iterator]() { + return this; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/for-of31.js b/tests/baselines/reference/for-of31.js new file mode 100644 index 0000000000..588c75a114 --- /dev/null +++ b/tests/baselines/reference/for-of31.js @@ -0,0 +1,32 @@ +//// [for-of31.ts] +for (var v of new StringIterator) { } + +class StringIterator { + next() { + return { + // no done property + value: "" + } + } + + [Symbol.iterator]() { + return this; + } +} + +//// [for-of31.js] +for (var v of new StringIterator) { } +var StringIterator = (function () { + function StringIterator() { + } + StringIterator.prototype.next = function () { + return { + // no done property + value: "" + }; + }; + StringIterator.prototype[Symbol.iterator] = function () { + return this; + }; + return StringIterator; +})(); diff --git a/tests/baselines/reference/for-of32.errors.txt b/tests/baselines/reference/for-of32.errors.txt new file mode 100644 index 0000000000..4b139d386c --- /dev/null +++ b/tests/baselines/reference/for-of32.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/for-ofStatements/for-of32.ts(1,10): error TS7022: 'v' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer. + + +==== tests/cases/conformance/es6/for-ofStatements/for-of32.ts (1 errors) ==== + for (var v of v) { } + ~ +!!! error TS7022: 'v' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer. \ No newline at end of file diff --git a/tests/baselines/reference/for-of32.js b/tests/baselines/reference/for-of32.js new file mode 100644 index 0000000000..d25d16fbeb --- /dev/null +++ b/tests/baselines/reference/for-of32.js @@ -0,0 +1,5 @@ +//// [for-of32.ts] +for (var v of v) { } + +//// [for-of32.js] +for (var v of v) { } diff --git a/tests/baselines/reference/for-of33.errors.txt b/tests/baselines/reference/for-of33.errors.txt new file mode 100644 index 0000000000..1c631042d7 --- /dev/null +++ b/tests/baselines/reference/for-of33.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/for-ofStatements/for-of33.ts(1,10): error TS7022: 'v' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer. + + +==== tests/cases/conformance/es6/for-ofStatements/for-of33.ts (1 errors) ==== + for (var v of new StringIterator) { } + ~ +!!! error TS7022: 'v' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer. + + class StringIterator { + [Symbol.iterator]() { + return v; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/for-of33.js b/tests/baselines/reference/for-of33.js new file mode 100644 index 0000000000..91d8de41c6 --- /dev/null +++ b/tests/baselines/reference/for-of33.js @@ -0,0 +1,19 @@ +//// [for-of33.ts] +for (var v of new StringIterator) { } + +class StringIterator { + [Symbol.iterator]() { + return v; + } +} + +//// [for-of33.js] +for (var v of new StringIterator) { } +var StringIterator = (function () { + function StringIterator() { + } + StringIterator.prototype[Symbol.iterator] = function () { + return v; + }; + return StringIterator; +})(); diff --git a/tests/baselines/reference/for-of34.errors.txt b/tests/baselines/reference/for-of34.errors.txt new file mode 100644 index 0000000000..994302db88 --- /dev/null +++ b/tests/baselines/reference/for-of34.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/for-ofStatements/for-of34.ts(1,10): error TS7022: 'v' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer. + + +==== tests/cases/conformance/es6/for-ofStatements/for-of34.ts (1 errors) ==== + for (var v of new StringIterator) { } + ~ +!!! error TS7022: 'v' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer. + + class StringIterator { + next() { + return v; + } + + [Symbol.iterator]() { + return this; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/for-of34.js b/tests/baselines/reference/for-of34.js new file mode 100644 index 0000000000..ccb6006c63 --- /dev/null +++ b/tests/baselines/reference/for-of34.js @@ -0,0 +1,26 @@ +//// [for-of34.ts] +for (var v of new StringIterator) { } + +class StringIterator { + next() { + return v; + } + + [Symbol.iterator]() { + return this; + } +} + +//// [for-of34.js] +for (var v of new StringIterator) { } +var StringIterator = (function () { + function StringIterator() { + } + StringIterator.prototype.next = function () { + return v; + }; + StringIterator.prototype[Symbol.iterator] = function () { + return this; + }; + return StringIterator; +})(); diff --git a/tests/baselines/reference/for-of35.errors.txt b/tests/baselines/reference/for-of35.errors.txt new file mode 100644 index 0000000000..f83b6d2ec3 --- /dev/null +++ b/tests/baselines/reference/for-of35.errors.txt @@ -0,0 +1,20 @@ +tests/cases/conformance/es6/for-ofStatements/for-of35.ts(1,10): error TS7022: 'v' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer. + + +==== tests/cases/conformance/es6/for-ofStatements/for-of35.ts (1 errors) ==== + for (var v of new StringIterator) { } + ~ +!!! error TS7022: 'v' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer. + + class StringIterator { + next() { + return { + done: true, + value: v + } + } + + [Symbol.iterator]() { + return this; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/for-of35.js b/tests/baselines/reference/for-of35.js new file mode 100644 index 0000000000..a4f1a37e3b --- /dev/null +++ b/tests/baselines/reference/for-of35.js @@ -0,0 +1,32 @@ +//// [for-of35.ts] +for (var v of new StringIterator) { } + +class StringIterator { + next() { + return { + done: true, + value: v + } + } + + [Symbol.iterator]() { + return this; + } +} + +//// [for-of35.js] +for (var v of new StringIterator) { } +var StringIterator = (function () { + function StringIterator() { + } + StringIterator.prototype.next = function () { + return { + done: true, + value: v + }; + }; + StringIterator.prototype[Symbol.iterator] = function () { + return this; + }; + return StringIterator; +})(); diff --git a/tests/baselines/reference/for-of36.js b/tests/baselines/reference/for-of36.js new file mode 100644 index 0000000000..1452369515 --- /dev/null +++ b/tests/baselines/reference/for-of36.js @@ -0,0 +1,11 @@ +//// [for-of36.ts] +var tuple: [string, boolean] = ["", true]; +for (var v of tuple) { + v; +} + +//// [for-of36.js] +var tuple = ["", true]; +for (var v of tuple) { + v; +} diff --git a/tests/baselines/reference/for-of36.types b/tests/baselines/reference/for-of36.types new file mode 100644 index 0000000000..da03367ba5 --- /dev/null +++ b/tests/baselines/reference/for-of36.types @@ -0,0 +1,12 @@ +=== tests/cases/conformance/es6/for-ofStatements/for-of36.ts === +var tuple: [string, boolean] = ["", true]; +>tuple : [string, boolean] +>["", true] : [string, boolean] + +for (var v of tuple) { +>v : string | boolean +>tuple : [string, boolean] + + v; +>v : string | boolean +} diff --git a/tests/baselines/reference/for-of37.js b/tests/baselines/reference/for-of37.js new file mode 100644 index 0000000000..472193e6cb --- /dev/null +++ b/tests/baselines/reference/for-of37.js @@ -0,0 +1,11 @@ +//// [for-of37.ts] +var map = new Map([["", true]]); +for (var v of map) { + v; +} + +//// [for-of37.js] +var map = new Map([["", true]]); +for (var v of map) { + v; +} diff --git a/tests/baselines/reference/for-of37.types b/tests/baselines/reference/for-of37.types new file mode 100644 index 0000000000..f137db79af --- /dev/null +++ b/tests/baselines/reference/for-of37.types @@ -0,0 +1,15 @@ +=== tests/cases/conformance/es6/for-ofStatements/for-of37.ts === +var map = new Map([["", true]]); +>map : Map +>new Map([["", true]]) : Map +>Map : MapConstructor +>[["", true]] : [string, boolean][] +>["", true] : [string, boolean] + +for (var v of map) { +>v : [string, boolean] +>map : Map + + v; +>v : [string, boolean] +} diff --git a/tests/baselines/reference/for-of38.js b/tests/baselines/reference/for-of38.js new file mode 100644 index 0000000000..1f0ac09682 --- /dev/null +++ b/tests/baselines/reference/for-of38.js @@ -0,0 +1,13 @@ +//// [for-of38.ts] +var map = new Map([["", true]]); +for (var [k, v] of map) { + k; + v; +} + +//// [for-of38.js] +var map = new Map([["", true]]); +for (var [k, v] of map) { + k; + v; +} diff --git a/tests/baselines/reference/for-of38.types b/tests/baselines/reference/for-of38.types new file mode 100644 index 0000000000..cdd1e05dd7 --- /dev/null +++ b/tests/baselines/reference/for-of38.types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/es6/for-ofStatements/for-of38.ts === +var map = new Map([["", true]]); +>map : Map +>new Map([["", true]]) : Map +>Map : MapConstructor +>[["", true]] : [string, boolean][] +>["", true] : [string, boolean] + +for (var [k, v] of map) { +>k : string +>v : boolean +>map : Map + + k; +>k : string + + v; +>v : boolean +} diff --git a/tests/baselines/reference/for-of39.errors.txt b/tests/baselines/reference/for-of39.errors.txt new file mode 100644 index 0000000000..48db183a58 --- /dev/null +++ b/tests/baselines/reference/for-of39.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/for-ofStatements/for-of39.ts(1,15): error TS2453: The type argument for type parameter 'V' cannot be inferred from the usage. Consider specifying the type arguments explicitly. + Type argument candidate 'boolean' is not a valid type argument because it is not a supertype of candidate 'number'. + + +==== tests/cases/conformance/es6/for-ofStatements/for-of39.ts (1 errors) ==== + var map = new Map([["", true], ["", 0]]); + ~~~ +!!! error TS2453: The type argument for type parameter 'V' cannot be inferred from the usage. Consider specifying the type arguments explicitly. +!!! error TS2453: Type argument candidate 'boolean' is not a valid type argument because it is not a supertype of candidate 'number'. + for (var [k, v] of map) { + k; + v; + } \ No newline at end of file diff --git a/tests/baselines/reference/for-of39.js b/tests/baselines/reference/for-of39.js new file mode 100644 index 0000000000..91dbc56c0a --- /dev/null +++ b/tests/baselines/reference/for-of39.js @@ -0,0 +1,13 @@ +//// [for-of39.ts] +var map = new Map([["", true], ["", 0]]); +for (var [k, v] of map) { + k; + v; +} + +//// [for-of39.js] +var map = new Map([["", true], ["", 0]]); +for (var [k, v] of map) { + k; + v; +} diff --git a/tests/baselines/reference/for-of4.js b/tests/baselines/reference/for-of4.js new file mode 100644 index 0000000000..147619d2fe --- /dev/null +++ b/tests/baselines/reference/for-of4.js @@ -0,0 +1,9 @@ +//// [for-of4.ts] +for (var v of [0]) { + v; +} + +//// [for-of4.js] +for (var v of [0]) { + v; +} diff --git a/tests/baselines/reference/for-of4.types b/tests/baselines/reference/for-of4.types new file mode 100644 index 0000000000..2076fae84f --- /dev/null +++ b/tests/baselines/reference/for-of4.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/es6/for-ofStatements/for-of4.ts === +for (var v of [0]) { +>v : number +>[0] : number[] + + v; +>v : number +} diff --git a/tests/baselines/reference/for-of40.js b/tests/baselines/reference/for-of40.js new file mode 100644 index 0000000000..243f81097d --- /dev/null +++ b/tests/baselines/reference/for-of40.js @@ -0,0 +1,13 @@ +//// [for-of40.ts] +var map = new Map([["", true]]); +for (var [k = "", v = false] of map) { + k; + v; +} + +//// [for-of40.js] +var map = new Map([["", true]]); +for (var [k = "", v = false] of map) { + k; + v; +} diff --git a/tests/baselines/reference/for-of40.types b/tests/baselines/reference/for-of40.types new file mode 100644 index 0000000000..c0fe7cbbc0 --- /dev/null +++ b/tests/baselines/reference/for-of40.types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/es6/for-ofStatements/for-of40.ts === +var map = new Map([["", true]]); +>map : Map +>new Map([["", true]]) : Map +>Map : MapConstructor +>[["", true]] : [string, boolean][] +>["", true] : [string, boolean] + +for (var [k = "", v = false] of map) { +>k : string +>v : boolean +>map : Map + + k; +>k : string + + v; +>v : boolean +} diff --git a/tests/baselines/reference/for-of41.js b/tests/baselines/reference/for-of41.js new file mode 100644 index 0000000000..0fa380c53c --- /dev/null +++ b/tests/baselines/reference/for-of41.js @@ -0,0 +1,13 @@ +//// [for-of41.ts] +var array = [{x: [0], y: {p: ""}}] +for (var {x: [a], y: {p}} of array) { + a; + p; +} + +//// [for-of41.js] +var array = [{ x: [0], y: { p: "" } }]; +for (var { x: [a], y: { p } } of array) { + a; + p; +} diff --git a/tests/baselines/reference/for-of41.types b/tests/baselines/reference/for-of41.types new file mode 100644 index 0000000000..54e58aa1ec --- /dev/null +++ b/tests/baselines/reference/for-of41.types @@ -0,0 +1,24 @@ +=== tests/cases/conformance/es6/for-ofStatements/for-of41.ts === +var array = [{x: [0], y: {p: ""}}] +>array : { x: number[]; y: { p: string; }; }[] +>[{x: [0], y: {p: ""}}] : { x: number[]; y: { p: string; }; }[] +>{x: [0], y: {p: ""}} : { x: number[]; y: { p: string; }; } +>x : number[] +>[0] : number[] +>y : { p: string; } +>{p: ""} : { p: string; } +>p : string + +for (var {x: [a], y: {p}} of array) { +>x : unknown +>a : number +>y : unknown +>p : string +>array : { x: number[]; y: { p: string; }; }[] + + a; +>a : number + + p; +>p : string +} diff --git a/tests/baselines/reference/for-of42.js b/tests/baselines/reference/for-of42.js new file mode 100644 index 0000000000..1fa9219df4 --- /dev/null +++ b/tests/baselines/reference/for-of42.js @@ -0,0 +1,13 @@ +//// [for-of42.ts] +var array = [{ x: "", y: 0 }] +for (var {x: a, y: b} of array) { + a; + b; +} + +//// [for-of42.js] +var array = [{ x: "", y: 0 }]; +for (var { x: a, y: b } of array) { + a; + b; +} diff --git a/tests/baselines/reference/for-of42.types b/tests/baselines/reference/for-of42.types new file mode 100644 index 0000000000..1a81945277 --- /dev/null +++ b/tests/baselines/reference/for-of42.types @@ -0,0 +1,21 @@ +=== tests/cases/conformance/es6/for-ofStatements/for-of42.ts === +var array = [{ x: "", y: 0 }] +>array : { x: string; y: number; }[] +>[{ x: "", y: 0 }] : { x: string; y: number; }[] +>{ x: "", y: 0 } : { x: string; y: number; } +>x : string +>y : number + +for (var {x: a, y: b} of array) { +>x : unknown +>a : string +>y : unknown +>b : number +>array : { x: string; y: number; }[] + + a; +>a : string + + b; +>b : number +} diff --git a/tests/baselines/reference/for-of43.errors.txt b/tests/baselines/reference/for-of43.errors.txt new file mode 100644 index 0000000000..c5790278e5 --- /dev/null +++ b/tests/baselines/reference/for-of43.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/es6/for-ofStatements/for-of43.ts(2,25): error TS2322: Type 'boolean' is not assignable to type 'number'. + + +==== tests/cases/conformance/es6/for-ofStatements/for-of43.ts (1 errors) ==== + var array = [{ x: "", y: 0 }] + for (var {x: a = "", y: b = true} of array) { + ~ +!!! error TS2322: Type 'boolean' is not assignable to type 'number'. + a; + b; + } \ No newline at end of file diff --git a/tests/baselines/reference/for-of43.js b/tests/baselines/reference/for-of43.js new file mode 100644 index 0000000000..de3b4fcd9b --- /dev/null +++ b/tests/baselines/reference/for-of43.js @@ -0,0 +1,13 @@ +//// [for-of43.ts] +var array = [{ x: "", y: 0 }] +for (var {x: a = "", y: b = true} of array) { + a; + b; +} + +//// [for-of43.js] +var array = [{ x: "", y: 0 }]; +for (var { x: a = "", y: b = true } of array) { + a; + b; +} diff --git a/tests/baselines/reference/for-of44.js b/tests/baselines/reference/for-of44.js new file mode 100644 index 0000000000..087485ed73 --- /dev/null +++ b/tests/baselines/reference/for-of44.js @@ -0,0 +1,13 @@ +//// [for-of44.ts] +var array: [number, string | boolean | symbol][] = [[0, ""], [0, true], [1, Symbol()]] +for (var [num, strBoolSym] of array) { + num; + strBoolSym; +} + +//// [for-of44.js] +var array = [[0, ""], [0, true], [1, Symbol()]]; +for (var [num, strBoolSym] of array) { + num; + strBoolSym; +} diff --git a/tests/baselines/reference/for-of44.types b/tests/baselines/reference/for-of44.types new file mode 100644 index 0000000000..078b49bd30 --- /dev/null +++ b/tests/baselines/reference/for-of44.types @@ -0,0 +1,21 @@ +=== tests/cases/conformance/es6/for-ofStatements/for-of44.ts === +var array: [number, string | boolean | symbol][] = [[0, ""], [0, true], [1, Symbol()]] +>array : [number, string | boolean | symbol][] +>[[0, ""], [0, true], [1, Symbol()]] : ([number, string] | [number, boolean] | [number, symbol])[] +>[0, ""] : [number, string] +>[0, true] : [number, boolean] +>[1, Symbol()] : [number, symbol] +>Symbol() : symbol +>Symbol : SymbolConstructor + +for (var [num, strBoolSym] of array) { +>num : number +>strBoolSym : string | boolean | symbol +>array : [number, string | boolean | symbol][] + + num; +>num : number + + strBoolSym; +>strBoolSym : string | boolean | symbol +} diff --git a/tests/baselines/reference/for-of45.js b/tests/baselines/reference/for-of45.js new file mode 100644 index 0000000000..1222b2dcdd --- /dev/null +++ b/tests/baselines/reference/for-of45.js @@ -0,0 +1,15 @@ +//// [for-of45.ts] +var k: string, v: boolean; +var map = new Map([["", true]]); +for ([k = "", v = false] of map) { + k; + v; +} + +//// [for-of45.js] +var k, v; +var map = new Map([["", true]]); +for ([k = "", v = false] of map) { + k; + v; +} diff --git a/tests/baselines/reference/for-of45.types b/tests/baselines/reference/for-of45.types new file mode 100644 index 0000000000..8ac4b9fa7e --- /dev/null +++ b/tests/baselines/reference/for-of45.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/es6/for-ofStatements/for-of45.ts === +var k: string, v: boolean; +>k : string +>v : boolean + +var map = new Map([["", true]]); +>map : Map +>new Map([["", true]]) : Map +>Map : MapConstructor +>[["", true]] : [string, boolean][] +>["", true] : [string, boolean] + +for ([k = "", v = false] of map) { +>[k = "", v = false] : (string | boolean)[] +>k = "" : string +>k : string +>v = false : boolean +>v : boolean +>map : Map + + k; +>k : string + + v; +>v : boolean +} diff --git a/tests/baselines/reference/for-of46.errors.txt b/tests/baselines/reference/for-of46.errors.txt new file mode 100644 index 0000000000..13685b122c --- /dev/null +++ b/tests/baselines/reference/for-of46.errors.txt @@ -0,0 +1,15 @@ +tests/cases/conformance/es6/for-ofStatements/for-of46.ts(3,7): error TS2322: Type 'boolean' is not assignable to type 'string'. +tests/cases/conformance/es6/for-ofStatements/for-of46.ts(3,18): error TS2322: Type 'string' is not assignable to type 'boolean'. + + +==== tests/cases/conformance/es6/for-ofStatements/for-of46.ts (2 errors) ==== + var k: string, v: boolean; + var map = new Map([["", true]]); + for ([k = false, v = ""] of map) { + ~ +!!! error TS2322: Type 'boolean' is not assignable to type 'string'. + ~ +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. + k; + v; + } \ No newline at end of file diff --git a/tests/baselines/reference/for-of46.js b/tests/baselines/reference/for-of46.js new file mode 100644 index 0000000000..2ea15936c5 --- /dev/null +++ b/tests/baselines/reference/for-of46.js @@ -0,0 +1,15 @@ +//// [for-of46.ts] +var k: string, v: boolean; +var map = new Map([["", true]]); +for ([k = false, v = ""] of map) { + k; + v; +} + +//// [for-of46.js] +var k, v; +var map = new Map([["", true]]); +for ([k = false, v = ""] of map) { + k; + v; +} diff --git a/tests/baselines/reference/for-of47.errors.txt b/tests/baselines/reference/for-of47.errors.txt new file mode 100644 index 0000000000..241dc107ca --- /dev/null +++ b/tests/baselines/reference/for-of47.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/for-ofStatements/for-of47.ts(4,13): error TS2322: Type 'boolean' is not assignable to type 'number'. + + +==== tests/cases/conformance/es6/for-ofStatements/for-of47.ts (1 errors) ==== + var x: string, y: number; + var array = [{ x: "", y: true }] + enum E { x } + for ({x, y: y = E.x} of array) { + ~ +!!! error TS2322: Type 'boolean' is not assignable to type 'number'. + x; + y; + } \ No newline at end of file diff --git a/tests/baselines/reference/for-of47.js b/tests/baselines/reference/for-of47.js new file mode 100644 index 0000000000..b2de46d677 --- /dev/null +++ b/tests/baselines/reference/for-of47.js @@ -0,0 +1,20 @@ +//// [for-of47.ts] +var x: string, y: number; +var array = [{ x: "", y: true }] +enum E { x } +for ({x, y: y = E.x} of array) { + x; + y; +} + +//// [for-of47.js] +var x, y; +var array = [{ x: "", y: true }]; +var E; +(function (E) { + E[E["x"] = 0] = "x"; +})(E || (E = {})); +for ({ x, y: y = 0 /* x */ } of array) { + x; + y; +} diff --git a/tests/baselines/reference/for-of48.errors.txt b/tests/baselines/reference/for-of48.errors.txt new file mode 100644 index 0000000000..f6826e14c6 --- /dev/null +++ b/tests/baselines/reference/for-of48.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/for-ofStatements/for-of48.ts(4,12): error TS1005: ':' expected. + + +==== tests/cases/conformance/es6/for-ofStatements/for-of48.ts (1 errors) ==== + var x: string, y: number; + var array = [{ x: "", y: true }] + enum E { x } + for ({x, y = E.x} of array) { + ~ +!!! error TS1005: ':' expected. + x; + y; + } \ No newline at end of file diff --git a/tests/baselines/reference/for-of48.js b/tests/baselines/reference/for-of48.js new file mode 100644 index 0000000000..15b9f5f12f --- /dev/null +++ b/tests/baselines/reference/for-of48.js @@ -0,0 +1,20 @@ +//// [for-of48.ts] +var x: string, y: number; +var array = [{ x: "", y: true }] +enum E { x } +for ({x, y = E.x} of array) { + x; + y; +} + +//// [for-of48.js] +var x, y; +var array = [{ x: "", y: true }]; +var E; +(function (E) { + E[E["x"] = 0] = "x"; +})(E || (E = {})); +for ({ x, y: = 0 /* x */ } of array) { + x; + y; +} diff --git a/tests/baselines/reference/for-of49.errors.txt b/tests/baselines/reference/for-of49.errors.txt new file mode 100644 index 0000000000..d5bc314e67 --- /dev/null +++ b/tests/baselines/reference/for-of49.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/es6/for-ofStatements/for-of49.ts(3,13): error TS2364: Invalid left-hand side of assignment expression. + + +==== tests/cases/conformance/es6/for-ofStatements/for-of49.ts (1 errors) ==== + var k: string, v: boolean; + var map = new Map([["", true]]); + for ([k, ...[v]] of map) { + ~~~ +!!! error TS2364: Invalid left-hand side of assignment expression. + k; + v; + } \ No newline at end of file diff --git a/tests/baselines/reference/for-of49.js b/tests/baselines/reference/for-of49.js new file mode 100644 index 0000000000..ac7f99f360 --- /dev/null +++ b/tests/baselines/reference/for-of49.js @@ -0,0 +1,15 @@ +//// [for-of49.ts] +var k: string, v: boolean; +var map = new Map([["", true]]); +for ([k, ...[v]] of map) { + k; + v; +} + +//// [for-of49.js] +var k, v; +var map = new Map([["", true]]); +for ([k, ...[v]] of map) { + k; + v; +} diff --git a/tests/baselines/reference/for-of5.js b/tests/baselines/reference/for-of5.js new file mode 100644 index 0000000000..4d93b0bd48 --- /dev/null +++ b/tests/baselines/reference/for-of5.js @@ -0,0 +1,9 @@ +//// [for-of5.ts] +for (let v of [0]) { + v; +} + +//// [for-of5.js] +for (let v of [0]) { + v; +} diff --git a/tests/baselines/reference/for-of5.types b/tests/baselines/reference/for-of5.types new file mode 100644 index 0000000000..feac5ef9e5 --- /dev/null +++ b/tests/baselines/reference/for-of5.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/es6/for-ofStatements/for-of5.ts === +for (let v of [0]) { +>v : number +>[0] : number[] + + v; +>v : number +} diff --git a/tests/baselines/reference/for-of50.js b/tests/baselines/reference/for-of50.js new file mode 100644 index 0000000000..a300812e6a --- /dev/null +++ b/tests/baselines/reference/for-of50.js @@ -0,0 +1,13 @@ +//// [for-of50.ts] +var map = new Map([["", true]]); +for (const [k, v] of map) { + k; + v; +} + +//// [for-of50.js] +var map = new Map([["", true]]); +for (const [k, v] of map) { + k; + v; +} diff --git a/tests/baselines/reference/for-of50.types b/tests/baselines/reference/for-of50.types new file mode 100644 index 0000000000..a38f385517 --- /dev/null +++ b/tests/baselines/reference/for-of50.types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/es6/for-ofStatements/for-of50.ts === +var map = new Map([["", true]]); +>map : Map +>new Map([["", true]]) : Map +>Map : MapConstructor +>[["", true]] : [string, boolean][] +>["", true] : [string, boolean] + +for (const [k, v] of map) { +>k : string +>v : boolean +>map : Map + + k; +>k : string + + v; +>v : boolean +} diff --git a/tests/baselines/reference/for-of51.errors.txt b/tests/baselines/reference/for-of51.errors.txt new file mode 100644 index 0000000000..54a6eb9d89 --- /dev/null +++ b/tests/baselines/reference/for-of51.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/for-ofStatements/for-of51.ts(1,10): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. + + +==== tests/cases/conformance/es6/for-ofStatements/for-of51.ts (1 errors) ==== + for (let let of []) {} + ~~~ +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. \ No newline at end of file diff --git a/tests/baselines/reference/for-of51.js b/tests/baselines/reference/for-of51.js new file mode 100644 index 0000000000..cae8c8b38f --- /dev/null +++ b/tests/baselines/reference/for-of51.js @@ -0,0 +1,5 @@ +//// [for-of51.ts] +for (let let of []) {} + +//// [for-of51.js] +for (let let of []) { } diff --git a/tests/baselines/reference/for-of52.errors.txt b/tests/baselines/reference/for-of52.errors.txt new file mode 100644 index 0000000000..5110768e10 --- /dev/null +++ b/tests/baselines/reference/for-of52.errors.txt @@ -0,0 +1,10 @@ +tests/cases/conformance/es6/for-ofStatements/for-of52.ts(1,11): error TS2451: Cannot redeclare block-scoped variable 'v'. +tests/cases/conformance/es6/for-ofStatements/for-of52.ts(1,14): error TS2451: Cannot redeclare block-scoped variable 'v'. + + +==== tests/cases/conformance/es6/for-ofStatements/for-of52.ts (2 errors) ==== + for (let [v, v] of [[]]) {} + ~ +!!! error TS2451: Cannot redeclare block-scoped variable 'v'. + ~ +!!! error TS2451: Cannot redeclare block-scoped variable 'v'. \ No newline at end of file diff --git a/tests/baselines/reference/for-of52.js b/tests/baselines/reference/for-of52.js new file mode 100644 index 0000000000..48e1dca936 --- /dev/null +++ b/tests/baselines/reference/for-of52.js @@ -0,0 +1,5 @@ +//// [for-of52.ts] +for (let [v, v] of [[]]) {} + +//// [for-of52.js] +for (let [v, v] of [[]]) { } diff --git a/tests/baselines/reference/for-of53.js b/tests/baselines/reference/for-of53.js new file mode 100644 index 0000000000..810d23644a --- /dev/null +++ b/tests/baselines/reference/for-of53.js @@ -0,0 +1,9 @@ +//// [for-of53.ts] +for (let v of []) { + var v; +} + +//// [for-of53.js] +for (let v of []) { + var v; +} diff --git a/tests/baselines/reference/for-of53.types b/tests/baselines/reference/for-of53.types new file mode 100644 index 0000000000..475d63e9b5 --- /dev/null +++ b/tests/baselines/reference/for-of53.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/es6/for-ofStatements/for-of53.ts === +for (let v of []) { +>v : any +>[] : undefined[] + + var v; +>v : any +} diff --git a/tests/baselines/reference/for-of54.errors.txt b/tests/baselines/reference/for-of54.errors.txt new file mode 100644 index 0000000000..cb040c4438 --- /dev/null +++ b/tests/baselines/reference/for-of54.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/for-ofStatements/for-of54.ts(2,9): error TS2481: Cannot initialize outer scoped variable 'v' in the same scope as block scoped declaration 'v'. + + +==== tests/cases/conformance/es6/for-ofStatements/for-of54.ts (1 errors) ==== + for (let v of []) { + var v = 0; + ~ +!!! error TS2481: Cannot initialize outer scoped variable 'v' in the same scope as block scoped declaration 'v'. + } \ No newline at end of file diff --git a/tests/baselines/reference/for-of54.js b/tests/baselines/reference/for-of54.js new file mode 100644 index 0000000000..442e6e8614 --- /dev/null +++ b/tests/baselines/reference/for-of54.js @@ -0,0 +1,9 @@ +//// [for-of54.ts] +for (let v of []) { + var v = 0; +} + +//// [for-of54.js] +for (let v of []) { + var v = 0; +} diff --git a/tests/baselines/reference/for-of55.js b/tests/baselines/reference/for-of55.js new file mode 100644 index 0000000000..a0f949c6ce --- /dev/null +++ b/tests/baselines/reference/for-of55.js @@ -0,0 +1,11 @@ +//// [for-of55.ts] +let v = [1]; +for (let v of v) { + v; +} + +//// [for-of55.js] +let v = [1]; +for (let v of v) { + v; +} diff --git a/tests/baselines/reference/for-of55.types b/tests/baselines/reference/for-of55.types new file mode 100644 index 0000000000..b0f5aab3fe --- /dev/null +++ b/tests/baselines/reference/for-of55.types @@ -0,0 +1,12 @@ +=== tests/cases/conformance/es6/for-ofStatements/for-of55.ts === +let v = [1]; +>v : number[] +>[1] : number[] + +for (let v of v) { +>v : any +>v : any + + v; +>v : any +} diff --git a/tests/baselines/reference/for-of56.js b/tests/baselines/reference/for-of56.js new file mode 100644 index 0000000000..0992b9c0bb --- /dev/null +++ b/tests/baselines/reference/for-of56.js @@ -0,0 +1,5 @@ +//// [for-of56.ts] +for (var let of []) {} + +//// [for-of56.js] +for (var let of []) { } diff --git a/tests/baselines/reference/for-of56.types b/tests/baselines/reference/for-of56.types new file mode 100644 index 0000000000..d853ff9f62 --- /dev/null +++ b/tests/baselines/reference/for-of56.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/es6/for-ofStatements/for-of56.ts === +for (var let of []) {} +>let : any +>[] : undefined[] + diff --git a/tests/baselines/reference/for-of6.errors.txt b/tests/baselines/reference/for-of6.errors.txt new file mode 100644 index 0000000000..03f41d18b2 --- /dev/null +++ b/tests/baselines/reference/for-of6.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/for-ofStatements/for-of6.ts(1,6): error TS2304: Cannot find name 'v'. + + +==== tests/cases/conformance/es6/for-ofStatements/for-of6.ts (1 errors) ==== + for (v of [0]) { + ~ +!!! error TS2304: Cannot find name 'v'. + let v; + } \ No newline at end of file diff --git a/tests/baselines/reference/for-of6.js b/tests/baselines/reference/for-of6.js new file mode 100644 index 0000000000..24e93e2a9f --- /dev/null +++ b/tests/baselines/reference/for-of6.js @@ -0,0 +1,9 @@ +//// [for-of6.ts] +for (v of [0]) { + let v; +} + +//// [for-of6.js] +for (v of [0]) { + let v; +} diff --git a/tests/baselines/reference/for-of7.errors.txt b/tests/baselines/reference/for-of7.errors.txt new file mode 100644 index 0000000000..e67c51e2d9 --- /dev/null +++ b/tests/baselines/reference/for-of7.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/es6/for-ofStatements/for-of7.ts(1,1): error TS2304: Cannot find name 'v'. + + +==== tests/cases/conformance/es6/for-ofStatements/for-of7.ts (1 errors) ==== + v; + ~ +!!! error TS2304: Cannot find name 'v'. + for (let v of [0]) { } \ No newline at end of file diff --git a/tests/baselines/reference/for-of7.js b/tests/baselines/reference/for-of7.js new file mode 100644 index 0000000000..04aadd9736 --- /dev/null +++ b/tests/baselines/reference/for-of7.js @@ -0,0 +1,7 @@ +//// [for-of7.ts] +v; +for (let v of [0]) { } + +//// [for-of7.js] +v; +for (let v of [0]) { } diff --git a/tests/baselines/reference/for-of8.js b/tests/baselines/reference/for-of8.js new file mode 100644 index 0000000000..f33d69166d --- /dev/null +++ b/tests/baselines/reference/for-of8.js @@ -0,0 +1,7 @@ +//// [for-of8.ts] +v; +for (var v of [0]) { } + +//// [for-of8.js] +v; +for (var v of [0]) { } diff --git a/tests/baselines/reference/for-of8.types b/tests/baselines/reference/for-of8.types new file mode 100644 index 0000000000..5f239d141f --- /dev/null +++ b/tests/baselines/reference/for-of8.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/es6/for-ofStatements/for-of8.ts === +v; +>v : number + +for (var v of [0]) { } +>v : number +>[0] : number[] + diff --git a/tests/baselines/reference/for-of9.js b/tests/baselines/reference/for-of9.js new file mode 100644 index 0000000000..f96d353bd7 --- /dev/null +++ b/tests/baselines/reference/for-of9.js @@ -0,0 +1,9 @@ +//// [for-of9.ts] +var v: string; +for (v of ["hello"]) { } +for (v of "hello") { } + +//// [for-of9.js] +var v; +for (v of ["hello"]) { } +for (v of "hello") { } diff --git a/tests/baselines/reference/for-of9.types b/tests/baselines/reference/for-of9.types new file mode 100644 index 0000000000..55c8167094 --- /dev/null +++ b/tests/baselines/reference/for-of9.types @@ -0,0 +1,11 @@ +=== tests/cases/conformance/es6/for-ofStatements/for-of9.ts === +var v: string; +>v : string + +for (v of ["hello"]) { } +>v : string +>["hello"] : string[] + +for (v of "hello") { } +>v : string + diff --git a/tests/baselines/reference/fromAsIdentifier1.js b/tests/baselines/reference/fromAsIdentifier1.js new file mode 100644 index 0000000000..54054e9f3e --- /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 0000000000..988a80f333 --- /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 0000000000..efdbdb3c57 --- /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 0000000000..5faf9ec6f6 --- /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/getEmitOutputWithEarlySyntacticErrors.baseline b/tests/baselines/reference/getEmitOutputWithEarlySyntacticErrors.baseline index 8dc9355bca..9e2e9978f4 100644 --- a/tests/baselines/reference/getEmitOutputWithEarlySyntacticErrors.baseline +++ b/tests/baselines/reference/getEmitOutputWithEarlySyntacticErrors.baseline @@ -1,5 +1,5 @@ EmitSkipped: false FileName : tests/cases/fourslash/inputFile1.js // File contains early errors. All outputs should be skipped. -const uninitialized_const_error; +var uninitialized_const_error; diff --git a/tests/baselines/reference/invalidTryStatements.errors.txt b/tests/baselines/reference/invalidTryStatements.errors.txt index 4dacdb8f4b..a2f8a7bac0 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/iterableContextualTyping1.js b/tests/baselines/reference/iterableContextualTyping1.js new file mode 100644 index 0000000000..8621bbd841 --- /dev/null +++ b/tests/baselines/reference/iterableContextualTyping1.js @@ -0,0 +1,5 @@ +//// [iterableContextualTyping1.ts] +var iter: Iterable<(x: string) => number> = [s => s.length]; + +//// [iterableContextualTyping1.js] +var iter = [s => s.length]; diff --git a/tests/baselines/reference/iterableContextualTyping1.types b/tests/baselines/reference/iterableContextualTyping1.types new file mode 100644 index 0000000000..386d64312f --- /dev/null +++ b/tests/baselines/reference/iterableContextualTyping1.types @@ -0,0 +1,12 @@ +=== tests/cases/conformance/expressions/contextualTyping/iterableContextualTyping1.ts === +var iter: Iterable<(x: string) => number> = [s => s.length]; +>iter : Iterable<(x: string) => number> +>Iterable : Iterable +>x : string +>[s => s.length] : ((s: string) => number)[] +>s => s.length : (s: string) => number +>s : string +>s.length : number +>s : string +>length : number + diff --git a/tests/baselines/reference/letAsIdentifierInStrictMode.js b/tests/baselines/reference/letAsIdentifierInStrictMode.js index e844bc1d1d..ccf099bcfc 100644 --- a/tests/baselines/reference/letAsIdentifierInStrictMode.js +++ b/tests/baselines/reference/letAsIdentifierInStrictMode.js @@ -9,9 +9,9 @@ a; //// [letAsIdentifierInStrictMode.js] "use strict"; var ; -let ; +var ; 10; var a = 10; -let ; +var ; 30; -let a; +var a; diff --git a/tests/baselines/reference/letDeclarations-es5-1.errors.txt b/tests/baselines/reference/letDeclarations-es5-1.errors.txt deleted file mode 100644 index f8b5cf629d..0000000000 --- a/tests/baselines/reference/letDeclarations-es5-1.errors.txt +++ /dev/null @@ -1,27 +0,0 @@ -tests/cases/compiler/letDeclarations-es5-1.ts(1,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. -tests/cases/compiler/letDeclarations-es5-1.ts(2,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. -tests/cases/compiler/letDeclarations-es5-1.ts(3,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. -tests/cases/compiler/letDeclarations-es5-1.ts(4,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. -tests/cases/compiler/letDeclarations-es5-1.ts(5,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. -tests/cases/compiler/letDeclarations-es5-1.ts(6,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/compiler/letDeclarations-es5-1.ts (6 errors) ==== - let l1; - ~~~ -!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. - let l2: number; - ~~~ -!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. - let l3, l4, l5 :string, l6; - ~~~ -!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. - let l7 = false; - ~~~ -!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. - let l8: number = 23; - ~~~ -!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. - let l9 = 0, l10 :string = "", l11 = null; - ~~~ -!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. \ No newline at end of file diff --git a/tests/baselines/reference/letDeclarations-es5-1.js b/tests/baselines/reference/letDeclarations-es5-1.js index 24c2c62e58..35439c5966 100644 --- a/tests/baselines/reference/letDeclarations-es5-1.js +++ b/tests/baselines/reference/letDeclarations-es5-1.js @@ -7,9 +7,9 @@ let l9 = 0, l10 :string = "", l11 = null; //// [letDeclarations-es5-1.js] -let l1; -let l2; -let l3, l4, l5, l6; -let l7 = false; -let l8 = 23; -let l9 = 0, l10 = "", l11 = null; +var l1; +var l2; +var l3, l4, l5, l6; +var l7 = false; +var l8 = 23; +var l9 = 0, l10 = "", l11 = null; diff --git a/tests/baselines/reference/letDeclarations-es5-1.types b/tests/baselines/reference/letDeclarations-es5-1.types new file mode 100644 index 0000000000..fb45d521bd --- /dev/null +++ b/tests/baselines/reference/letDeclarations-es5-1.types @@ -0,0 +1,24 @@ +=== tests/cases/compiler/letDeclarations-es5-1.ts === + let l1; +>l1 : any + + let l2: number; +>l2 : number + + let l3, l4, l5 :string, l6; +>l3 : any +>l4 : any +>l5 : string +>l6 : any + + let l7 = false; +>l7 : boolean + + let l8: number = 23; +>l8 : number + + let l9 = 0, l10 :string = "", l11 = null; +>l9 : number +>l10 : string +>l11 : any + diff --git a/tests/baselines/reference/letDeclarations-es5.errors.txt b/tests/baselines/reference/letDeclarations-es5.errors.txt deleted file mode 100644 index 27d526f03e..0000000000 --- a/tests/baselines/reference/letDeclarations-es5.errors.txt +++ /dev/null @@ -1,40 +0,0 @@ -tests/cases/compiler/letDeclarations-es5.ts(2,1): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. -tests/cases/compiler/letDeclarations-es5.ts(3,1): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. -tests/cases/compiler/letDeclarations-es5.ts(4,1): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. -tests/cases/compiler/letDeclarations-es5.ts(6,1): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. -tests/cases/compiler/letDeclarations-es5.ts(7,1): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. -tests/cases/compiler/letDeclarations-es5.ts(8,1): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. -tests/cases/compiler/letDeclarations-es5.ts(10,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. -tests/cases/compiler/letDeclarations-es5.ts(12,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/compiler/letDeclarations-es5.ts (8 errors) ==== - - let l1; - ~~~ -!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. - let l2: number; - ~~~ -!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. - let l3, l4, l5 :string, l6; - ~~~ -!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. - - let l7 = false; - ~~~ -!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. - let l8: number = 23; - ~~~ -!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. - let l9 = 0, l10 :string = "", l11 = null; - ~~~ -!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. - - for(let l11 in {}) { } - ~~~ -!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. - - for(let l12 = 0; l12 < 9; l12++) { } - ~~~ -!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. - \ No newline at end of file diff --git a/tests/baselines/reference/letDeclarations-es5.js b/tests/baselines/reference/letDeclarations-es5.js index 4d2f5423ee..4ad43d52f7 100644 --- a/tests/baselines/reference/letDeclarations-es5.js +++ b/tests/baselines/reference/letDeclarations-es5.js @@ -14,11 +14,11 @@ for(let l12 = 0; l12 < 9; l12++) { } //// [letDeclarations-es5.js] -let l1; -let l2; -let l3, l4, l5, l6; -let l7 = false; -let l8 = 23; -let l9 = 0, l10 = "", l11 = null; -for (let l11 in {}) { } -for (let l12 = 0; l12 < 9; l12++) { } +var l1; +var l2; +var l3, l4, l5, l6; +var l7 = false; +var l8 = 23; +var l9 = 0, l10 = "", l11 = null; +for (var _l11 in {}) { } +for (var l12 = 0; l12 < 9; l12++) { } diff --git a/tests/baselines/reference/letDeclarations-es5.types b/tests/baselines/reference/letDeclarations-es5.types new file mode 100644 index 0000000000..0d6e992886 --- /dev/null +++ b/tests/baselines/reference/letDeclarations-es5.types @@ -0,0 +1,36 @@ +=== tests/cases/compiler/letDeclarations-es5.ts === + +let l1; +>l1 : any + +let l2: number; +>l2 : number + +let l3, l4, l5 :string, l6; +>l3 : any +>l4 : any +>l5 : string +>l6 : any + +let l7 = false; +>l7 : boolean + +let l8: number = 23; +>l8 : number + +let l9 = 0, l10 :string = "", l11 = null; +>l9 : number +>l10 : string +>l11 : any + +for(let l11 in {}) { } +>l11 : any +>{} : {} + +for(let l12 = 0; l12 < 9; l12++) { } +>l12 : number +>l12 < 9 : boolean +>l12 : number +>l12++ : number +>l12 : number + diff --git a/tests/baselines/reference/parserCatchClauseWithTypeAnnotation1.errors.txt b/tests/baselines/reference/parserCatchClauseWithTypeAnnotation1.errors.txt index 73b97ac557..a1f1d1fd6c 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 cd5b088d0e..d8a5bb45fa 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, +var v = (_a = {}, + _a[e] = 1, _a); var _a; diff --git a/tests/baselines/reference/parserES5ComputedPropertyName3.js b/tests/baselines/reference/parserES5ComputedPropertyName3.js index 8bfed4e822..2606746795 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 () { }, +var v = (_a = {}, + _a[e] = function () { }, _a); var _a; diff --git a/tests/baselines/reference/parserES5ComputedPropertyName4.js b/tests/baselines/reference/parserES5ComputedPropertyName4.js index bb0b389afd..378624af08 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 }), +var v = (_a = {}, + _a[e] = Object.defineProperty({ get: function () { }, enumerable: true, configurable: true }), _a); var _a; diff --git a/tests/baselines/reference/parserES5ForOfStatement1.d.errors.txt b/tests/baselines/reference/parserES5ForOfStatement1.d.errors.txt index 9c1a39b1f4..c280b597b2 100644 --- a/tests/baselines/reference/parserES5ForOfStatement1.d.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement1.d.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts (1 errors) ==== for (var i of e) { ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement10.errors.txt b/tests/baselines/reference/parserES5ForOfStatement10.errors.txt index d7f411b187..5cee7472d2 100644 --- a/tests/baselines/reference/parserES5ForOfStatement10.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement10.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts (1 errors) ==== for (const v of X) { ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement11.errors.txt b/tests/baselines/reference/parserES5ForOfStatement11.errors.txt index 48805a336c..79b16ed1ad 100644 --- a/tests/baselines/reference/parserES5ForOfStatement11.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement11.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts (1 errors) ==== for (const [a, b] of X) { ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement12.errors.txt b/tests/baselines/reference/parserES5ForOfStatement12.errors.txt index 3b9f242b97..cdb6db690c 100644 --- a/tests/baselines/reference/parserES5ForOfStatement12.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement12.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts (1 errors) ==== for (const {a, b} of X) { ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement13.errors.txt b/tests/baselines/reference/parserES5ForOfStatement13.errors.txt index 8b8c8ce086..9d97fd9e24 100644 --- a/tests/baselines/reference/parserES5ForOfStatement13.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement13.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts (1 errors) ==== for (let {a, b} of X) { ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement13.js b/tests/baselines/reference/parserES5ForOfStatement13.js index 89706613ad..3fac359c67 100644 --- a/tests/baselines/reference/parserES5ForOfStatement13.js +++ b/tests/baselines/reference/parserES5ForOfStatement13.js @@ -3,5 +3,5 @@ for (let {a, b} of X) { } //// [parserES5ForOfStatement13.js] -for (let _a = void 0, a = _a.a, b = _a.b of X) { +for (var _a = void 0, a = _a.a, b = _a.b of X) { } diff --git a/tests/baselines/reference/parserES5ForOfStatement14.errors.txt b/tests/baselines/reference/parserES5ForOfStatement14.errors.txt index dc4db95270..303439ec44 100644 --- a/tests/baselines/reference/parserES5ForOfStatement14.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement14.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts (1 errors) ==== for (let [a, b] of X) { ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement14.js b/tests/baselines/reference/parserES5ForOfStatement14.js index 96aa327a62..6d1fbbddd6 100644 --- a/tests/baselines/reference/parserES5ForOfStatement14.js +++ b/tests/baselines/reference/parserES5ForOfStatement14.js @@ -3,5 +3,5 @@ for (let [a, b] of X) { } //// [parserES5ForOfStatement14.js] -for (let _a = void 0, a = _a[0], b = _a[1] of X) { +for (var _a = void 0, a = _a[0], b = _a[1] of X) { } diff --git a/tests/baselines/reference/parserES5ForOfStatement15.errors.txt b/tests/baselines/reference/parserES5ForOfStatement15.errors.txt index 07aa6dd5b3..f0eab288fa 100644 --- a/tests/baselines/reference/parserES5ForOfStatement15.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement15.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts (1 errors) ==== for (var [a, b] of X) { ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement16.errors.txt b/tests/baselines/reference/parserES5ForOfStatement16.errors.txt index 15a3e4f7f0..b9248140f3 100644 --- a/tests/baselines/reference/parserES5ForOfStatement16.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement16.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement16.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement16.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement16.ts (1 errors) ==== for (var {a, b} of X) { ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement18.errors.txt b/tests/baselines/reference/parserES5ForOfStatement18.errors.txt index fc314e5101..e123be9c4f 100644 --- a/tests/baselines/reference/parserES5ForOfStatement18.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement18.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts (1 errors) ==== for (var of of of) { } ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. \ No newline at end of file +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement2.errors.txt b/tests/baselines/reference/parserES5ForOfStatement2.errors.txt index 347ae29ddb..618e2f3f0a 100644 --- a/tests/baselines/reference/parserES5ForOfStatement2.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement2.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts (1 errors) ==== for (var of X) { ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement21.errors.txt b/tests/baselines/reference/parserES5ForOfStatement21.errors.txt index 2ddbf4b566..14d97f49fa 100644 --- a/tests/baselines/reference/parserES5ForOfStatement21.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement21.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts (1 errors) ==== for (var of of) { } ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. \ No newline at end of file +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement3.errors.txt b/tests/baselines/reference/parserES5ForOfStatement3.errors.txt index 553ca40aee..dd888a3120 100644 --- a/tests/baselines/reference/parserES5ForOfStatement3.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement3.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts (1 errors) ==== for (var a, b of X) { ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement4.errors.txt b/tests/baselines/reference/parserES5ForOfStatement4.errors.txt index 6a08c8942e..b94de56b17 100644 --- a/tests/baselines/reference/parserES5ForOfStatement4.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement4.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts (1 errors) ==== for (var a = 1 of X) { ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement5.errors.txt b/tests/baselines/reference/parserES5ForOfStatement5.errors.txt index 212eae8ac1..0b8dafc0b9 100644 --- a/tests/baselines/reference/parserES5ForOfStatement5.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement5.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts (1 errors) ==== for (var a: number of X) { ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement6.errors.txt b/tests/baselines/reference/parserES5ForOfStatement6.errors.txt index e331b66eb8..04ac84fbd7 100644 --- a/tests/baselines/reference/parserES5ForOfStatement6.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement6.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts (1 errors) ==== for (var a = 1, b = 2 of X) { ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement7.errors.txt b/tests/baselines/reference/parserES5ForOfStatement7.errors.txt index 5ba60c264e..1def5279f6 100644 --- a/tests/baselines/reference/parserES5ForOfStatement7.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement7.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts (1 errors) ==== for (var a: number = 1, b: string = "" of X) { ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement8.errors.txt b/tests/baselines/reference/parserES5ForOfStatement8.errors.txt index 3696bf11f8..829fea57e6 100644 --- a/tests/baselines/reference/parserES5ForOfStatement8.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement8.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts (1 errors) ==== for (var v of X) { ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement9.errors.txt b/tests/baselines/reference/parserES5ForOfStatement9.errors.txt index 6e2e9d0570..4cf082b4f1 100644 --- a/tests/baselines/reference/parserES5ForOfStatement9.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement9.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts (1 errors) ==== for (let v of X) { ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement9.js b/tests/baselines/reference/parserES5ForOfStatement9.js index e2ec49e9ac..856dd5982a 100644 --- a/tests/baselines/reference/parserES5ForOfStatement9.js +++ b/tests/baselines/reference/parserES5ForOfStatement9.js @@ -3,5 +3,5 @@ for (let v of X) { } //// [parserES5ForOfStatement9.js] -for (let v of X) { +for (var v of X) { } diff --git a/tests/baselines/reference/parserForOfStatement1.d.errors.txt b/tests/baselines/reference/parserForOfStatement1.d.errors.txt index 05af0a6f77..c492c7817e 100644 --- a/tests/baselines/reference/parserForOfStatement1.d.errors.txt +++ b/tests/baselines/reference/parserForOfStatement1.d.errors.txt @@ -1,8 +1,11 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement1.d.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement1.d.ts(1,1): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement1.d.ts(1,15): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement1.d.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement1.d.ts (2 errors) ==== for (var i of e) { ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. +!!! error TS1036: Statements are not allowed in ambient contexts. + ~ +!!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement10.errors.txt b/tests/baselines/reference/parserForOfStatement10.errors.txt index 570c319b51..d2fc73e6b6 100644 --- a/tests/baselines/reference/parserForOfStatement10.errors.txt +++ b/tests/baselines/reference/parserForOfStatement10.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement10.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement10.ts(1,17): error TS2304: Cannot find name 'X'. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement10.ts (1 errors) ==== for (const v of X) { - ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. + ~ +!!! error TS2304: Cannot find name 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement10.js b/tests/baselines/reference/parserForOfStatement10.js index d0b4820309..4d77c16388 100644 --- a/tests/baselines/reference/parserForOfStatement10.js +++ b/tests/baselines/reference/parserForOfStatement10.js @@ -3,5 +3,5 @@ for (const v of X) { } //// [parserForOfStatement10.js] -for (var v of X) { +for (const v of X) { } diff --git a/tests/baselines/reference/parserForOfStatement11.errors.txt b/tests/baselines/reference/parserForOfStatement11.errors.txt index f253a2d429..2c5af586ae 100644 --- a/tests/baselines/reference/parserForOfStatement11.errors.txt +++ b/tests/baselines/reference/parserForOfStatement11.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement11.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement11.ts(1,22): error TS2304: Cannot find name 'X'. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement11.ts (1 errors) ==== for (const [a, b] of X) { - ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. + ~ +!!! error TS2304: Cannot find name 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement11.js b/tests/baselines/reference/parserForOfStatement11.js index daa3fb6df4..5189f9e64a 100644 --- a/tests/baselines/reference/parserForOfStatement11.js +++ b/tests/baselines/reference/parserForOfStatement11.js @@ -3,5 +3,5 @@ for (const [a, b] of X) { } //// [parserForOfStatement11.js] -for (var [a, b] of X) { +for (const [a, b] of X) { } diff --git a/tests/baselines/reference/parserForOfStatement12.errors.txt b/tests/baselines/reference/parserForOfStatement12.errors.txt index 07ef449898..951b70eac3 100644 --- a/tests/baselines/reference/parserForOfStatement12.errors.txt +++ b/tests/baselines/reference/parserForOfStatement12.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement12.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement12.ts(1,22): error TS2304: Cannot find name 'X'. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement12.ts (1 errors) ==== for (const {a, b} of X) { - ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. + ~ +!!! error TS2304: Cannot find name 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement12.js b/tests/baselines/reference/parserForOfStatement12.js index 2e62b90de5..f27c8f41bd 100644 --- a/tests/baselines/reference/parserForOfStatement12.js +++ b/tests/baselines/reference/parserForOfStatement12.js @@ -3,5 +3,5 @@ for (const {a, b} of X) { } //// [parserForOfStatement12.js] -for (var { a, b } of X) { +for (const { a, b } of X) { } diff --git a/tests/baselines/reference/parserForOfStatement13.errors.txt b/tests/baselines/reference/parserForOfStatement13.errors.txt index 6c10a7b058..c789ab89d9 100644 --- a/tests/baselines/reference/parserForOfStatement13.errors.txt +++ b/tests/baselines/reference/parserForOfStatement13.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement13.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement13.ts(1,20): error TS2304: Cannot find name 'X'. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement13.ts (1 errors) ==== for (let {a, b} of X) { - ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. + ~ +!!! error TS2304: Cannot find name 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement14.errors.txt b/tests/baselines/reference/parserForOfStatement14.errors.txt index 209a39c051..46e71e5242 100644 --- a/tests/baselines/reference/parserForOfStatement14.errors.txt +++ b/tests/baselines/reference/parserForOfStatement14.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement14.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement14.ts(1,20): error TS2304: Cannot find name 'X'. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement14.ts (1 errors) ==== for (let [a, b] of X) { - ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. + ~ +!!! error TS2304: Cannot find name 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement15.errors.txt b/tests/baselines/reference/parserForOfStatement15.errors.txt index c5fd77af29..0f159c7a25 100644 --- a/tests/baselines/reference/parserForOfStatement15.errors.txt +++ b/tests/baselines/reference/parserForOfStatement15.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement15.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement15.ts(1,20): error TS2304: Cannot find name 'X'. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement15.ts (1 errors) ==== for (var [a, b] of X) { - ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. + ~ +!!! error TS2304: Cannot find name 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement16.errors.txt b/tests/baselines/reference/parserForOfStatement16.errors.txt index d169eef125..3d950fd145 100644 --- a/tests/baselines/reference/parserForOfStatement16.errors.txt +++ b/tests/baselines/reference/parserForOfStatement16.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement16.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement16.ts(1,20): error TS2304: Cannot find name 'X'. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement16.ts (1 errors) ==== for (var {a, b} of X) { - ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. + ~ +!!! error TS2304: Cannot find name 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement18.errors.txt b/tests/baselines/reference/parserForOfStatement18.errors.txt deleted file mode 100644 index 9312af76fc..0000000000 --- a/tests/baselines/reference/parserForOfStatement18.errors.txt +++ /dev/null @@ -1,7 +0,0 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement18.ts(1,1): error TS9003: 'for...of' statements are not currently supported. - - -==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement18.ts (1 errors) ==== - for (var of of of) { } - ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement18.types b/tests/baselines/reference/parserForOfStatement18.types new file mode 100644 index 0000000000..8e3b52ac87 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement18.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement18.ts === +for (var of of of) { } +>of : any +>of : any + diff --git a/tests/baselines/reference/parserForOfStatement2.errors.txt b/tests/baselines/reference/parserForOfStatement2.errors.txt index 8e7da49730..7229fe4196 100644 --- a/tests/baselines/reference/parserForOfStatement2.errors.txt +++ b/tests/baselines/reference/parserForOfStatement2.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement2.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement2.ts(1,9): error TS1123: Variable declaration list cannot be empty. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement2.ts (1 errors) ==== for (var of X) { - ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. + +!!! error TS1123: Variable declaration list cannot be empty. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement21.errors.txt b/tests/baselines/reference/parserForOfStatement21.errors.txt index dad48f415c..9103e2fede 100644 --- a/tests/baselines/reference/parserForOfStatement21.errors.txt +++ b/tests/baselines/reference/parserForOfStatement21.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement21.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement21.ts(1,9): error TS1123: Variable declaration list cannot be empty. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement21.ts (1 errors) ==== for (var of of) { } - ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. \ No newline at end of file + +!!! error TS1123: Variable declaration list cannot be empty. \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement3.errors.txt b/tests/baselines/reference/parserForOfStatement3.errors.txt index 83985f1a71..a565ae37d3 100644 --- a/tests/baselines/reference/parserForOfStatement3.errors.txt +++ b/tests/baselines/reference/parserForOfStatement3.errors.txt @@ -1,8 +1,11 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts(1,13): error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts(1,18): error TS2304: Cannot find name 'X'. -==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts (2 errors) ==== for (var a, b of X) { - ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. + ~ +!!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. + ~ +!!! error TS2304: Cannot find name 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement4.errors.txt b/tests/baselines/reference/parserForOfStatement4.errors.txt index 94dd08ed59..9787368208 100644 --- a/tests/baselines/reference/parserForOfStatement4.errors.txt +++ b/tests/baselines/reference/parserForOfStatement4.errors.txt @@ -1,8 +1,11 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts(1,10): error TS1190: The variable declaration of a 'for...of' statement cannot have an initializer. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts(1,19): error TS2304: Cannot find name 'X'. -==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts (2 errors) ==== for (var a = 1 of X) { - ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. + ~ +!!! error TS1190: The variable declaration of a 'for...of' statement cannot have an initializer. + ~ +!!! error TS2304: Cannot find name 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement5.errors.txt b/tests/baselines/reference/parserForOfStatement5.errors.txt index 6570f4a075..e3ed323591 100644 --- a/tests/baselines/reference/parserForOfStatement5.errors.txt +++ b/tests/baselines/reference/parserForOfStatement5.errors.txt @@ -1,8 +1,11 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts(1,10): error TS2483: The left-hand side of a 'for...of' statement cannot use a type annotation. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts(1,23): error TS2304: Cannot find name 'X'. -==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts (2 errors) ==== for (var a: number of X) { - ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. + ~ +!!! error TS2483: The left-hand side of a 'for...of' statement cannot use a type annotation. + ~ +!!! error TS2304: Cannot find name 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement6.errors.txt b/tests/baselines/reference/parserForOfStatement6.errors.txt index 6208749911..59a18f03bc 100644 --- a/tests/baselines/reference/parserForOfStatement6.errors.txt +++ b/tests/baselines/reference/parserForOfStatement6.errors.txt @@ -1,8 +1,11 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts(1,17): error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts(1,26): error TS2304: Cannot find name 'X'. -==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts (2 errors) ==== for (var a = 1, b = 2 of X) { - ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. + ~ +!!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. + ~ +!!! error TS2304: Cannot find name 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement7.errors.txt b/tests/baselines/reference/parserForOfStatement7.errors.txt index 1810daad5e..f5ab97b441 100644 --- a/tests/baselines/reference/parserForOfStatement7.errors.txt +++ b/tests/baselines/reference/parserForOfStatement7.errors.txt @@ -1,8 +1,11 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts(1,25): error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts(1,43): error TS2304: Cannot find name 'X'. -==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts (2 errors) ==== for (var a: number = 1, b: string = "" of X) { - ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. + ~ +!!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. + ~ +!!! error TS2304: Cannot find name 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement8.errors.txt b/tests/baselines/reference/parserForOfStatement8.errors.txt index 8e2c41d0ce..5fe9bb4341 100644 --- a/tests/baselines/reference/parserForOfStatement8.errors.txt +++ b/tests/baselines/reference/parserForOfStatement8.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement8.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement8.ts(1,15): error TS2304: Cannot find name 'X'. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement8.ts (1 errors) ==== for (var v of X) { - ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. + ~ +!!! error TS2304: Cannot find name 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement9.errors.txt b/tests/baselines/reference/parserForOfStatement9.errors.txt index 01fd729e9c..fae9beec25 100644 --- a/tests/baselines/reference/parserForOfStatement9.errors.txt +++ b/tests/baselines/reference/parserForOfStatement9.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement9.ts(1,1): error TS9003: 'for...of' statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement9.ts(1,15): error TS2304: Cannot find name 'X'. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement9.ts (1 errors) ==== for (let v of X) { - ~~~ -!!! error TS9003: 'for...of' statements are not currently supported. + ~ +!!! error TS2304: Cannot find name 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForStatement5.errors.txt b/tests/baselines/reference/parserForStatement5.errors.txt index 72c9bffce4..ae1e855b76 100644 --- a/tests/baselines/reference/parserForStatement5.errors.txt +++ b/tests/baselines/reference/parserForStatement5.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement5.ts(1,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement5.ts(1,6): error TS2491: The left-hand side of a 'for...in' statement cannot be a destructuring pattern. tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement5.ts(1,12): error TS2304: Cannot find name 'b'. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement5.ts (2 errors) ==== for ({} in b) { ~~ -!!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +!!! error TS2491: The left-hand side of a 'for...in' statement cannot be a destructuring pattern. ~ !!! error TS2304: Cannot find name 'b'. } \ No newline at end of file diff --git a/tests/baselines/reference/privateIndexer2.js b/tests/baselines/reference/privateIndexer2.js index 40b28ce980..a90e03a5bc 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 = -, +var x = (_a = {}, + _a[x] = string, + _a.string = , _a); var y; var _a; diff --git a/tests/baselines/reference/shadowingViaLocalValue.errors.txt b/tests/baselines/reference/shadowingViaLocalValue.errors.txt index 8e6f16b91c..67ab72ed22 100644 --- a/tests/baselines/reference/shadowingViaLocalValue.errors.txt +++ b/tests/baselines/reference/shadowingViaLocalValue.errors.txt @@ -1,14 +1,10 @@ -tests/cases/compiler/shadowingViaLocalValue.ts(2,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. tests/cases/compiler/shadowingViaLocalValue.ts(4,13): error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. -tests/cases/compiler/shadowingViaLocalValue.ts(9,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. tests/cases/compiler/shadowingViaLocalValue.ts(11,18): error TS2481: Cannot initialize outer scoped variable 'x1' in the same scope as block scoped declaration 'x1'. -==== tests/cases/compiler/shadowingViaLocalValue.ts (4 errors) ==== +==== tests/cases/compiler/shadowingViaLocalValue.ts (2 errors) ==== { let x; - ~~~ -!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. { var x = 1; ~ @@ -18,8 +14,6 @@ tests/cases/compiler/shadowingViaLocalValue.ts(11,18): error TS2481: Cannot init { let x1; - ~~~ -!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. { for (var x1 = 0; ;); ~~ diff --git a/tests/baselines/reference/shadowingViaLocalValue.js b/tests/baselines/reference/shadowingViaLocalValue.js index f99a209f0d..e788caf572 100644 --- a/tests/baselines/reference/shadowingViaLocalValue.js +++ b/tests/baselines/reference/shadowingViaLocalValue.js @@ -17,13 +17,13 @@ //// [shadowingViaLocalValue.js] { - let x; + var _x; { var x = 1; } } { - let x1; + var _x1; { for (var x1 = 0;;) ; diff --git a/tests/baselines/reference/taggedTemplateStringsHexadecimalEscapes.js b/tests/baselines/reference/taggedTemplateStringsHexadecimalEscapes.js new file mode 100644 index 0000000000..e4482ded0c --- /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 0000000000..37f583efd5 --- /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 0000000000..31a0358973 --- /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 0000000000..b96c0664e2 --- /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.errors.txt b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.errors.txt deleted file mode 100644 index 93b22614b9..0000000000 --- a/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.errors.txt +++ /dev/null @@ -1,13 +0,0 @@ -tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.ts(7,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.ts (1 errors) ==== - - - 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` - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! 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/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.js b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.js index 5e5feac077..9450e939f2 100644 --- a/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.js +++ b/tests/baselines/reference/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.js @@ -14,4 +14,5 @@ function f() { x[_i - 0] = arguments[_i]; } } -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"; +(_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 0000000000..db79359122 --- /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/taggedTemplateStringsTypeArgumentInference.errors.txt b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.errors.txt index 275fdac6ac..f3706ae8f1 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 bbcd663796..9d3531c266 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 6b389218f6..166769fbbf 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 c3e145afb2..9d11379322 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 17c0b330db..0000000000 --- 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 d507e95172..1814816283 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 0000000000..6fa83bbde3 --- /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 0000000000..cee9d1efce --- /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 0000000000..ec687ac0fa --- /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 0000000000..f1d0fb896d --- /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 0000000000..7047f7194c --- /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 e4c79537ce..9e450cbb36 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 23298e1df1..431447df22 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 3bf4af3977..0000000000 --- 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 0b1447a3d3..f12008f958 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 0000000000..0863ac3faf --- /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 c1a6b228b0..0d65c3fd13 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 c6abf11419..4b9df44d3f 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 2557d6cc94..0000000000 --- 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 d5c6b8b31f..fd83d9d0ba 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 0000000000..a9b7c9dfdc --- /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 b38a70ca18..88bfac2321 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 a4dd161964..f7523eb987 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js +++ b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js @@ -13,4 +13,5 @@ function foo() { 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 28050ec96c..0000000000 --- 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 c2424a07a4..fcc2cda86d 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 0000000000..5c8ba71188 --- /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 0000000000..df3def2cb2 --- /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 0000000000..bcf0732218 --- /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 0000000000..c48b43dc3f --- /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 0000000000..6ca5fa5b03 --- /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 0000000000..65af8da59f --- /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 0000000000..89027983cb --- /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 0000000000..09a4aa765b --- /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 0000000000..5aeef9207e --- /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/templateStringInModuleName.js b/tests/baselines/reference/templateStringInModuleName.js index 561f308a3d..36f619176e 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 6df5a64d78..2e4de70f57 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 5a396398f6..18e35c475e 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 623f6a69a4..1a2995ca08 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 9106cdb615..18ce24a0b3 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 c6d98b0f82..3ba70ba84b 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/templateStringsArrayTypeDefinedInES5Mode.errors.txt b/tests/baselines/reference/templateStringsArrayTypeDefinedInES5Mode.errors.txt index 61b82bcb45..7ac2eff865 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 a724943c0f..5d5f925fe6 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 b233ad963c..e8bf38c104 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 c6cc4ee840..69d61d7955 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/cases/compiler/catchClauseWithBindingPattern1.ts b/tests/cases/compiler/catchClauseWithBindingPattern1.ts new file mode 100644 index 0000000000..dbd0f81c57 --- /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 0000000000..320a281317 --- /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/constDeclarations-errors.ts b/tests/cases/compiler/constDeclarations-errors.ts index 09dc0e9679..1c3ef8848b 100644 --- a/tests/cases/compiler/constDeclarations-errors.ts +++ b/tests/cases/compiler/constDeclarations-errors.ts @@ -5,7 +5,6 @@ const c1; const c2: number; const c3, c4, c5 :string, c6; // error, missing initialicer -// error, can not be unintalized for(const c in {}) { } // error, assigning to a const diff --git a/tests/cases/compiler/downlevelLetConst1.ts b/tests/cases/compiler/downlevelLetConst1.ts new file mode 100644 index 0000000000..8baacf4ea5 --- /dev/null +++ b/tests/cases/compiler/downlevelLetConst1.ts @@ -0,0 +1 @@ +const \ No newline at end of file diff --git a/tests/cases/compiler/downlevelLetConst10.ts b/tests/cases/compiler/downlevelLetConst10.ts new file mode 100644 index 0000000000..2b6e9657ef --- /dev/null +++ b/tests/cases/compiler/downlevelLetConst10.ts @@ -0,0 +1 @@ +let a: number = 1 \ No newline at end of file diff --git a/tests/cases/compiler/downlevelLetConst11.ts b/tests/cases/compiler/downlevelLetConst11.ts new file mode 100644 index 0000000000..aca6070823 --- /dev/null +++ b/tests/cases/compiler/downlevelLetConst11.ts @@ -0,0 +1,2 @@ +"use strict"; +let \ No newline at end of file diff --git a/tests/cases/compiler/downlevelLetConst12.ts b/tests/cases/compiler/downlevelLetConst12.ts new file mode 100644 index 0000000000..5acefcdf7b --- /dev/null +++ b/tests/cases/compiler/downlevelLetConst12.ts @@ -0,0 +1,12 @@ +// @target:es5 + +'use strict' +// top level let\const should not be renamed +let foo; +const bar = 1; + +let [baz] = []; +let {a: baz2} = { a: 1 }; + +const [baz3] = [] +const {a: baz4} = { a: 1 }; \ No newline at end of file diff --git a/tests/cases/compiler/downlevelLetConst13.ts b/tests/cases/compiler/downlevelLetConst13.ts new file mode 100644 index 0000000000..af803e079b --- /dev/null +++ b/tests/cases/compiler/downlevelLetConst13.ts @@ -0,0 +1,21 @@ +// @target:es5 +// @module: commonjs + +'use strict' +// exported let\const bindings should not be renamed + +export let foo = 10; +export const bar = "123" +export let [bar1] = [1]; +export const [bar2] = [2]; +export let {a: bar3} = { a: 1 }; +export const {a: bar4} = { a: 1 }; + +export module M { + export let baz = 100; + export const baz2 = true; + export let [bar5] = [1]; + export const [bar6] = [2]; + export let {a: bar7} = { a: 1 }; + export const {a: bar8} = { a: 1 }; +} \ No newline at end of file diff --git a/tests/cases/compiler/downlevelLetConst14.ts b/tests/cases/compiler/downlevelLetConst14.ts new file mode 100644 index 0000000000..0a77883809 --- /dev/null +++ b/tests/cases/compiler/downlevelLetConst14.ts @@ -0,0 +1,55 @@ +// @target:es5 +'use strict' +declare function use(a: any); + +var x = 10; +var z0, z1, z2, z3; +{ + let x = 20; + use(x); + + let [z0] = [1]; + use(z0); + let [z1] = [1] + use(z1); + let {a: z2} = { a: 1 }; + use(z2); + let {a: z3} = { a: 1 }; + use(z3); +} +use(x); +use(z0); +use(z1); +use(z2); +use(z3); +var z6; +var y = true; +{ + let y = ""; + let [z6] = [true] + { + let y = 1; + let {a: z6} = {a: 1} + use(y); + use(z6); + } + use(y); + use(z6); +} +use(y); +use(z6); + +var z = false; +var z5 = 1; +{ + let z = ""; + let [z5] = [5]; + { + let _z = 1; + let {a: _z5} = { a: 1 }; + // try to step on generated name + use(_z); + } + use(z); +} +use(y); \ No newline at end of file diff --git a/tests/cases/compiler/downlevelLetConst15.ts b/tests/cases/compiler/downlevelLetConst15.ts new file mode 100644 index 0000000000..abe06e1709 --- /dev/null +++ b/tests/cases/compiler/downlevelLetConst15.ts @@ -0,0 +1,55 @@ +// @target:es5 +'use strict' +declare function use(a: any); + +var x = 10; +var z0, z1, z2, z3; +{ + const x = 20; + use(x); + + const [z0] = [1]; + use(z0); + const [{a: z1}] = [{a: 1}] + use(z1); + const {a: z2} = { a: 1 }; + use(z2); + const {a: {b: z3}} = { a: {b: 1} }; + use(z3); +} +use(x); +use(z0); +use(z1); +use(z2); +use(z3); +var z6; +var y = true; +{ + const y = ""; + const [z6] = [true] + { + const y = 1; + const {a: z6} = { a: 1 } + use(y); + use(z6); + } + use(y); + use(z6); +} +use(y); +use(z6); + +var z = false; +var z5 = 1; +{ + const z = ""; + const [z5] = [5]; + { + const _z = 1; + const {a: _z5} = { a: 1 }; + // try to step on generated name + use(_z); + } + use(z); +} +use(y); \ No newline at end of file diff --git a/tests/cases/compiler/downlevelLetConst16.ts b/tests/cases/compiler/downlevelLetConst16.ts new file mode 100644 index 0000000000..2d592d253c --- /dev/null +++ b/tests/cases/compiler/downlevelLetConst16.ts @@ -0,0 +1,229 @@ +// @target:es5 +'use strict' + +declare function use(a: any); + +var x = 10; +var y; +var z; +use(x); +use(y); +use(z); +function foo1() { + let x = 1; + use(x); + let [y] = [1]; + use(y); + let {a: z} = {a: 1}; + use(z); +} + +function foo2() { + { + let x = 1; + use(x); + let [y] = [1]; + use(y); + let {a: z} = { a: 1 }; + use(z); + } + use(x); +} + +class A { + m1() { + let x = 1; + use(x); + let [y] = [1]; + use(y); + let {a: z} = { a: 1 }; + use(z); + } + m2() { + { + let x = 1; + use(x); + let [y] = [1]; + use(y); + let {a: z} = { a: 1 }; + use(z); + } + use(x); + } + +} + +class B { + m1() { + const x = 1; + use(x); + const [y] = [1]; + use(y); + const {a: z} = { a: 1 }; + use(z); + + } + m2() { + { + const x = 1; + use(x); + const [y] = [1]; + use(y); + const {a: z} = { a: 1 }; + use(z); + + } + use(x); + } +} + +function bar1() { + const x = 1; + use(x); + const [y] = [1]; + use(y); + const {a: z} = { a: 1 }; + use(z); +} + +function bar2() { + { + const x = 1; + use(x); + const [y] = [1]; + use(y); + const {a: z} = { a: 1 }; + use(z); + + } + use(x); +} + +module M1 { + let x = 1; + use(x); + let [y] = [1]; + use(y); + let {a: z} = { a: 1 }; + use(z); +} + +module M2 { + { + let x = 1; + use(x); + let [y] = [1]; + use(y); + let {a: z} = { a: 1 }; + use(z); + } + use(x); +} + +module M3 { + const x = 1; + use(x); + const [y] = [1]; + use(y); + const {a: z} = { a: 1 }; + use(z); + +} + +module M4 { + { + const x = 1; + use(x); + const [y] = [1]; + use(y); + const {a: z} = { a: 1 }; + use(z); + + } + use(x); + use(y); + use(z); +} + +function foo3() { + for (let x; ;) { + use(x); + } + for (let [y] = []; ;) { + use(y); + } + for (let {a: z} = {a: 1}; ;) { + use(z); + } + use(x); +} + +function foo4() { + for (const x = 1; ;) { + use(x); + } + for (const [y] = []; ;) { + use(y); + } + for (const {a: z} = { a: 1 }; ;) { + use(z); + } + use(x); +} + +function foo5() { + for (let x in []) { + use(x); + } + use(x); +} + +function foo6() { + for (const x in []) { + use(x); + } + use(x); +} + +// TODO: once for-of is supported downlevel +function foo7() { + for (let x of []) { + use(x); + } + use(x); +} + +function foo8() { + for (let [x] of []) { + use(x); + } + use(x); +} + +function foo9() { + for (let {a: x} of []) { + use(x); + } + use(x); +} + +function foo10() { + for (const x of []) { + use(x); + } + use(x); +} + +function foo11() { + for (const [x] of []) { + use(x); + } + use(x); +} + +function foo12() { + for (const {a: x} of []) { + use(x); + } + use(x); +} \ No newline at end of file diff --git a/tests/cases/compiler/downlevelLetConst17.ts b/tests/cases/compiler/downlevelLetConst17.ts new file mode 100644 index 0000000000..5cbb7b605f --- /dev/null +++ b/tests/cases/compiler/downlevelLetConst17.ts @@ -0,0 +1,69 @@ +// @target:es5 +'use strict' + +declare function use(a: any); + +var x; +for (let x = 10; ;) { + use(x); +} +use(x); + +for (const x = 10; ;) { + use(x); +} + +for (; ;) { + let x = 10; + use(x); + x = 1; +} + +for (; ;) { + const x = 10; + use(x); +} + +for (let x; ;) { + use(x); + x = 1; +} + +for (; ;) { + let x; + use(x); + x = 1; +} + +while (true) { + let x; + use(x); +} + +while (true) { + const x = true; + use(x); +} + +do { + let x; + use(x); +} while (true); + +do { + let x; + use(x); +} while (true); + +for (let x in []) { + use(x); +} + +for (const x in []) { + use(x); +} + +// TODO: update once for-of statements are supported downlevel +for (const x of []) { + use(x); +} \ No newline at end of file diff --git a/tests/cases/compiler/downlevelLetConst18.ts b/tests/cases/compiler/downlevelLetConst18.ts new file mode 100644 index 0000000000..59f2ee7a46 --- /dev/null +++ b/tests/cases/compiler/downlevelLetConst18.ts @@ -0,0 +1,30 @@ +// @target:es5 +'use strict' + +for (let x; ;) { + function foo() { x }; +} + +for (let x; ;) { + function foo() { x }; +} + +for (let x; ;) { + (() => { x })(); +} + +for (const x = 1; ;) { + (() => { x })(); +} + +for (let x; ;) { + ({ foo() { x }}) +} + +for (let x; ;) { + ({ get foo() { return x } }) +} + +for (let x; ;) { + ({ set foo(v) { x } }) +} diff --git a/tests/cases/compiler/downlevelLetConst2.ts b/tests/cases/compiler/downlevelLetConst2.ts new file mode 100644 index 0000000000..06871c9a45 --- /dev/null +++ b/tests/cases/compiler/downlevelLetConst2.ts @@ -0,0 +1 @@ +const a \ No newline at end of file diff --git a/tests/cases/compiler/downlevelLetConst3.ts b/tests/cases/compiler/downlevelLetConst3.ts new file mode 100644 index 0000000000..6779cd775c --- /dev/null +++ b/tests/cases/compiler/downlevelLetConst3.ts @@ -0,0 +1 @@ +const a = 1 \ No newline at end of file diff --git a/tests/cases/compiler/downlevelLetConst4.ts b/tests/cases/compiler/downlevelLetConst4.ts new file mode 100644 index 0000000000..f96229b7ea --- /dev/null +++ b/tests/cases/compiler/downlevelLetConst4.ts @@ -0,0 +1 @@ +const a: number \ No newline at end of file diff --git a/tests/cases/compiler/downlevelLetConst5.ts b/tests/cases/compiler/downlevelLetConst5.ts new file mode 100644 index 0000000000..4a05e895a3 --- /dev/null +++ b/tests/cases/compiler/downlevelLetConst5.ts @@ -0,0 +1 @@ +const a: number = 1 \ No newline at end of file diff --git a/tests/cases/compiler/downlevelLetConst6.ts b/tests/cases/compiler/downlevelLetConst6.ts new file mode 100644 index 0000000000..33ae002d85 --- /dev/null +++ b/tests/cases/compiler/downlevelLetConst6.ts @@ -0,0 +1 @@ +let \ No newline at end of file diff --git a/tests/cases/compiler/downlevelLetConst7.ts b/tests/cases/compiler/downlevelLetConst7.ts new file mode 100644 index 0000000000..7350ac02e7 --- /dev/null +++ b/tests/cases/compiler/downlevelLetConst7.ts @@ -0,0 +1 @@ +let a \ No newline at end of file diff --git a/tests/cases/compiler/downlevelLetConst8.ts b/tests/cases/compiler/downlevelLetConst8.ts new file mode 100644 index 0000000000..067c6699cf --- /dev/null +++ b/tests/cases/compiler/downlevelLetConst8.ts @@ -0,0 +1 @@ +let a = 1 \ No newline at end of file diff --git a/tests/cases/compiler/downlevelLetConst9.ts b/tests/cases/compiler/downlevelLetConst9.ts new file mode 100644 index 0000000000..aab3d49c18 --- /dev/null +++ b/tests/cases/compiler/downlevelLetConst9.ts @@ -0,0 +1 @@ +let a: number \ 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 0000000000..91497ab477 --- /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 0000000000..037e2128ce --- /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 0000000000..09f9200f80 --- /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 0000000000..38c8e09f6c --- /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 0000000000..80aeabb94d --- /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 0000000000..7478e3dd40 --- /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 0000000000..f035371332 --- /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 0000000000..039f723780 --- /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 0000000000..f2c2ba315e --- /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 0000000000..8519d85d79 --- /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/for-ofStatements/for-of1.ts b/tests/cases/conformance/es6/for-ofStatements/for-of1.ts new file mode 100644 index 0000000000..b9e25f2060 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of1.ts @@ -0,0 +1,3 @@ +//@target: ES6 +var v; +for (v of []) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of10.ts b/tests/cases/conformance/es6/for-ofStatements/for-of10.ts new file mode 100644 index 0000000000..dec00541e9 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of10.ts @@ -0,0 +1,3 @@ +//@target: ES6 +var v: string; +for (v of [0]) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of11.ts b/tests/cases/conformance/es6/for-ofStatements/for-of11.ts new file mode 100644 index 0000000000..e434758efa --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of11.ts @@ -0,0 +1,3 @@ +//@target: ES6 +var v: string; +for (v of [0, ""]) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of12.ts b/tests/cases/conformance/es6/for-ofStatements/for-of12.ts new file mode 100644 index 0000000000..78cfbaccec --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of12.ts @@ -0,0 +1,3 @@ +//@target: ES6 +var v: string; +for (v of [0, ""].values()) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of13.ts b/tests/cases/conformance/es6/for-ofStatements/for-of13.ts new file mode 100644 index 0000000000..2f2b922cb1 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of13.ts @@ -0,0 +1,3 @@ +//@target: ES6 +var v: string; +for (v of [""].values()) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of14.ts b/tests/cases/conformance/es6/for-ofStatements/for-of14.ts new file mode 100644 index 0000000000..84fbda4825 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of14.ts @@ -0,0 +1,9 @@ +//@target: ES6 +var v: string; +for (v of new StringIterator) { } // Should fail because the iterator is not iterable + +class StringIterator { + next() { + return ""; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of15.ts b/tests/cases/conformance/es6/for-ofStatements/for-of15.ts new file mode 100644 index 0000000000..1973e7ff95 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of15.ts @@ -0,0 +1,12 @@ +//@target: ES6 +var v: string; +for (v of new StringIterator) { } // Should fail + +class StringIterator { + next() { + return ""; + } + [Symbol.iterator]() { + return this; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of16.ts b/tests/cases/conformance/es6/for-ofStatements/for-of16.ts new file mode 100644 index 0000000000..8f7bd6d848 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of16.ts @@ -0,0 +1,9 @@ +//@target: ES6 +var v: string; +for (v of new StringIterator) { } // Should fail + +class StringIterator { + [Symbol.iterator]() { + return this; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of17.ts b/tests/cases/conformance/es6/for-ofStatements/for-of17.ts new file mode 100644 index 0000000000..431f066d47 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of17.ts @@ -0,0 +1,15 @@ +//@target: ES6 +var v: string; +for (v of new NumberIterator) { } // Should succeed + +class NumberIterator { + next() { + return { + value: 0, + done: false + }; + } + [Symbol.iterator]() { + return this; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of18.ts b/tests/cases/conformance/es6/for-ofStatements/for-of18.ts new file mode 100644 index 0000000000..407ad7f0ed --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of18.ts @@ -0,0 +1,15 @@ +//@target: ES6 +var v: string; +for (v of new StringIterator) { } // Should succeed + +class StringIterator { + next() { + return { + value: "", + done: false + }; + } + [Symbol.iterator]() { + return this; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of19.ts b/tests/cases/conformance/es6/for-ofStatements/for-of19.ts new file mode 100644 index 0000000000..ff80b2690e --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of19.ts @@ -0,0 +1,17 @@ +//@target: ES6 +for (var v of new FooIterator) { + v; +} + +class Foo { } +class FooIterator { + next() { + return { + value: new Foo, + done: false + }; + } + [Symbol.iterator]() { + return this; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of2.ts b/tests/cases/conformance/es6/for-ofStatements/for-of2.ts new file mode 100644 index 0000000000..77f72330de --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of2.ts @@ -0,0 +1,3 @@ +//@target: ES6 +const v; +for (v of []) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of20.ts b/tests/cases/conformance/es6/for-ofStatements/for-of20.ts new file mode 100644 index 0000000000..615f514937 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of20.ts @@ -0,0 +1,17 @@ +//@target: ES6 +for (let v of new FooIterator) { + v; +} + +class Foo { } +class FooIterator { + next() { + return { + value: new Foo, + done: false + }; + } + [Symbol.iterator]() { + return this; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of21.ts b/tests/cases/conformance/es6/for-ofStatements/for-of21.ts new file mode 100644 index 0000000000..4e4621034e --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of21.ts @@ -0,0 +1,17 @@ +//@target: ES6 +for (const v of new FooIterator) { + v; +} + +class Foo { } +class FooIterator { + next() { + return { + value: new Foo, + done: false + }; + } + [Symbol.iterator]() { + return this; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of22.ts b/tests/cases/conformance/es6/for-ofStatements/for-of22.ts new file mode 100644 index 0000000000..10a96502cd --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of22.ts @@ -0,0 +1,18 @@ +//@target: ES6 +v; +for (var v of new FooIterator) { + +} + +class Foo { } +class FooIterator { + next() { + return { + value: new Foo, + done: false + }; + } + [Symbol.iterator]() { + return this; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of23.ts b/tests/cases/conformance/es6/for-ofStatements/for-of23.ts new file mode 100644 index 0000000000..81227cd066 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of23.ts @@ -0,0 +1,17 @@ +//@target: ES6 +for (const v of new FooIterator) { + const v = 0; // new scope +} + +class Foo { } +class FooIterator { + next() { + return { + value: new Foo, + done: false + }; + } + [Symbol.iterator]() { + return this; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of24.ts b/tests/cases/conformance/es6/for-ofStatements/for-of24.ts new file mode 100644 index 0000000000..6f68821a0b --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of24.ts @@ -0,0 +1,3 @@ +//@target: ES6 +var x: any; +for (var v of x) { } diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of25.ts b/tests/cases/conformance/es6/for-ofStatements/for-of25.ts new file mode 100644 index 0000000000..a1698bd282 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of25.ts @@ -0,0 +1,9 @@ +//@target: ES6 +var x: any; +for (var v of new StringIterator) { } + +class StringIterator { + [Symbol.iterator]() { + return x; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of26.ts b/tests/cases/conformance/es6/for-ofStatements/for-of26.ts new file mode 100644 index 0000000000..0ab564a4f5 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of26.ts @@ -0,0 +1,12 @@ +//@target: ES6 +var x: any; +for (var v of new StringIterator) { } + +class StringIterator { + next() { + return x; + } + [Symbol.iterator]() { + return this; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of27.ts b/tests/cases/conformance/es6/for-ofStatements/for-of27.ts new file mode 100644 index 0000000000..8f2b84cbe1 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of27.ts @@ -0,0 +1,6 @@ +//@target: ES6 +for (var v of new StringIterator) { } + +class StringIterator { + [Symbol.iterator]: any; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of28.ts b/tests/cases/conformance/es6/for-ofStatements/for-of28.ts new file mode 100644 index 0000000000..8c693193b0 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of28.ts @@ -0,0 +1,9 @@ +//@target: ES6 +for (var v of new StringIterator) { } + +class StringIterator { + next: any; + [Symbol.iterator]() { + return this; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of29.ts b/tests/cases/conformance/es6/for-ofStatements/for-of29.ts new file mode 100644 index 0000000000..8df83db158 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of29.ts @@ -0,0 +1,6 @@ +//@target: ES6 +var iterableWithOptionalIterator: { + [Symbol.iterator]?(): Iterator +}; + +for (var v of iterableWithOptionalIterator) { } diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of3.ts b/tests/cases/conformance/es6/for-ofStatements/for-of3.ts new file mode 100644 index 0000000000..7eb1e1fd22 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of3.ts @@ -0,0 +1,3 @@ +//@target: ES6 +var v; +for (v++ of []) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of30.ts b/tests/cases/conformance/es6/for-ofStatements/for-of30.ts new file mode 100644 index 0000000000..03b97c2313 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of30.ts @@ -0,0 +1,17 @@ +//@target: ES6 +for (var v of new StringIterator) { } + +class StringIterator { + next() { + return { + done: false, + value: "" + } + } + + return = 0; + + [Symbol.iterator]() { + return this; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of31.ts b/tests/cases/conformance/es6/for-ofStatements/for-of31.ts new file mode 100644 index 0000000000..307f9b7cd4 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of31.ts @@ -0,0 +1,15 @@ +//@target: ES6 +for (var v of new StringIterator) { } + +class StringIterator { + next() { + return { + // no done property + value: "" + } + } + + [Symbol.iterator]() { + return this; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of32.ts b/tests/cases/conformance/es6/for-ofStatements/for-of32.ts new file mode 100644 index 0000000000..de95350b72 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of32.ts @@ -0,0 +1,3 @@ +//@target: ES6 +//@noImplicitAny: true +for (var v of v) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of33.ts b/tests/cases/conformance/es6/for-ofStatements/for-of33.ts new file mode 100644 index 0000000000..b73d2daee8 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of33.ts @@ -0,0 +1,9 @@ +//@target: ES6 +//@noImplicitAny: true +for (var v of new StringIterator) { } + +class StringIterator { + [Symbol.iterator]() { + return v; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of34.ts b/tests/cases/conformance/es6/for-ofStatements/for-of34.ts new file mode 100644 index 0000000000..d00f5ccde2 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of34.ts @@ -0,0 +1,13 @@ +//@target: ES6 +//@noImplicitAny: true +for (var v of new StringIterator) { } + +class StringIterator { + next() { + return v; + } + + [Symbol.iterator]() { + return this; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of35.ts b/tests/cases/conformance/es6/for-ofStatements/for-of35.ts new file mode 100644 index 0000000000..0d66ce39ed --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of35.ts @@ -0,0 +1,16 @@ +//@target: ES6 +//@noImplicitAny: true +for (var v of new StringIterator) { } + +class StringIterator { + next() { + return { + done: true, + value: v + } + } + + [Symbol.iterator]() { + return this; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of36.ts b/tests/cases/conformance/es6/for-ofStatements/for-of36.ts new file mode 100644 index 0000000000..e67806fef6 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of36.ts @@ -0,0 +1,5 @@ +//@target: ES6 +var tuple: [string, boolean] = ["", true]; +for (var v of tuple) { + v; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of37.ts b/tests/cases/conformance/es6/for-ofStatements/for-of37.ts new file mode 100644 index 0000000000..561e3bf2e5 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of37.ts @@ -0,0 +1,5 @@ +//@target: ES6 +var map = new Map([["", true]]); +for (var v of map) { + v; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of38.ts b/tests/cases/conformance/es6/for-ofStatements/for-of38.ts new file mode 100644 index 0000000000..0511ff140b --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of38.ts @@ -0,0 +1,6 @@ +//@target: ES6 +var map = new Map([["", true]]); +for (var [k, v] of map) { + k; + v; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of39.ts b/tests/cases/conformance/es6/for-ofStatements/for-of39.ts new file mode 100644 index 0000000000..1d3ae5fc76 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of39.ts @@ -0,0 +1,6 @@ +//@target: ES6 +var map = new Map([["", true], ["", 0]]); +for (var [k, v] of map) { + k; + v; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of4.ts b/tests/cases/conformance/es6/for-ofStatements/for-of4.ts new file mode 100644 index 0000000000..d37925b67a --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of4.ts @@ -0,0 +1,4 @@ +//@target: ES6 +for (var v of [0]) { + v; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of40.ts b/tests/cases/conformance/es6/for-ofStatements/for-of40.ts new file mode 100644 index 0000000000..128e6b4f18 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of40.ts @@ -0,0 +1,6 @@ +//@target: ES6 +var map = new Map([["", true]]); +for (var [k = "", v = false] of map) { + k; + v; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of41.ts b/tests/cases/conformance/es6/for-ofStatements/for-of41.ts new file mode 100644 index 0000000000..207ab8ab2b --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of41.ts @@ -0,0 +1,6 @@ +//@target: ES6 +var array = [{x: [0], y: {p: ""}}] +for (var {x: [a], y: {p}} of array) { + a; + p; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of42.ts b/tests/cases/conformance/es6/for-ofStatements/for-of42.ts new file mode 100644 index 0000000000..2eb25ab52f --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of42.ts @@ -0,0 +1,6 @@ +//@target: ES6 +var array = [{ x: "", y: 0 }] +for (var {x: a, y: b} of array) { + a; + b; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of43.ts b/tests/cases/conformance/es6/for-ofStatements/for-of43.ts new file mode 100644 index 0000000000..fec349e107 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of43.ts @@ -0,0 +1,6 @@ +//@target: ES6 +var array = [{ x: "", y: 0 }] +for (var {x: a = "", y: b = true} of array) { + a; + b; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of44.ts b/tests/cases/conformance/es6/for-ofStatements/for-of44.ts new file mode 100644 index 0000000000..7d7d21d869 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of44.ts @@ -0,0 +1,6 @@ +//@target: ES6 +var array: [number, string | boolean | symbol][] = [[0, ""], [0, true], [1, Symbol()]] +for (var [num, strBoolSym] of array) { + num; + strBoolSym; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of45.ts b/tests/cases/conformance/es6/for-ofStatements/for-of45.ts new file mode 100644 index 0000000000..f347069ab1 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of45.ts @@ -0,0 +1,7 @@ +//@target: ES6 +var k: string, v: boolean; +var map = new Map([["", true]]); +for ([k = "", v = false] of map) { + k; + v; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of46.ts b/tests/cases/conformance/es6/for-ofStatements/for-of46.ts new file mode 100644 index 0000000000..a08791068b --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of46.ts @@ -0,0 +1,7 @@ +//@target: ES6 +var k: string, v: boolean; +var map = new Map([["", true]]); +for ([k = false, v = ""] of map) { + k; + v; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of47.ts b/tests/cases/conformance/es6/for-ofStatements/for-of47.ts new file mode 100644 index 0000000000..bd21a0db38 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of47.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var x: string, y: number; +var array = [{ x: "", y: true }] +enum E { x } +for ({x, y: y = E.x} of array) { + x; + y; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of48.ts b/tests/cases/conformance/es6/for-ofStatements/for-of48.ts new file mode 100644 index 0000000000..c2e228d0fb --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of48.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var x: string, y: number; +var array = [{ x: "", y: true }] +enum E { x } +for ({x, y = E.x} of array) { + x; + y; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of49.ts b/tests/cases/conformance/es6/for-ofStatements/for-of49.ts new file mode 100644 index 0000000000..62fa4acd42 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of49.ts @@ -0,0 +1,7 @@ +//@target: ES6 +var k: string, v: boolean; +var map = new Map([["", true]]); +for ([k, ...[v]] of map) { + k; + v; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of5.ts b/tests/cases/conformance/es6/for-ofStatements/for-of5.ts new file mode 100644 index 0000000000..2a581676b4 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of5.ts @@ -0,0 +1,4 @@ +//@target: ES6 +for (let v of [0]) { + v; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of50.ts b/tests/cases/conformance/es6/for-ofStatements/for-of50.ts new file mode 100644 index 0000000000..d4e1bba5ae --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of50.ts @@ -0,0 +1,6 @@ +//@target: ES6 +var map = new Map([["", true]]); +for (const [k, v] of map) { + k; + v; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of51.ts b/tests/cases/conformance/es6/for-ofStatements/for-of51.ts new file mode 100644 index 0000000000..a97b05d7fe --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of51.ts @@ -0,0 +1,2 @@ +//@target: ES6 +for (let let of []) {} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of52.ts b/tests/cases/conformance/es6/for-ofStatements/for-of52.ts new file mode 100644 index 0000000000..80cc680060 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of52.ts @@ -0,0 +1,2 @@ +//@target: ES6 +for (let [v, v] of [[]]) {} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of53.ts b/tests/cases/conformance/es6/for-ofStatements/for-of53.ts new file mode 100644 index 0000000000..34db2bab70 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of53.ts @@ -0,0 +1,4 @@ +//@target: ES6 +for (let v of []) { + var v; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of54.ts b/tests/cases/conformance/es6/for-ofStatements/for-of54.ts new file mode 100644 index 0000000000..6cf79ae094 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of54.ts @@ -0,0 +1,4 @@ +//@target: ES6 +for (let v of []) { + var v = 0; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of55.ts b/tests/cases/conformance/es6/for-ofStatements/for-of55.ts new file mode 100644 index 0000000000..e1d16a3e06 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of55.ts @@ -0,0 +1,5 @@ +//@target: ES6 +let v = [1]; +for (let v of v) { + v; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of56.ts b/tests/cases/conformance/es6/for-ofStatements/for-of56.ts new file mode 100644 index 0000000000..3b73a52942 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of56.ts @@ -0,0 +1,2 @@ +//@target: ES6 +for (var let of []) {} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of6.ts b/tests/cases/conformance/es6/for-ofStatements/for-of6.ts new file mode 100644 index 0000000000..1d8eccde01 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of6.ts @@ -0,0 +1,4 @@ +//@target: ES6 +for (v of [0]) { + let v; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of7.ts b/tests/cases/conformance/es6/for-ofStatements/for-of7.ts new file mode 100644 index 0000000000..5303278d91 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of7.ts @@ -0,0 +1,3 @@ +//@target: ES6 +v; +for (let v of [0]) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of8.ts b/tests/cases/conformance/es6/for-ofStatements/for-of8.ts new file mode 100644 index 0000000000..34bd4943c7 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of8.ts @@ -0,0 +1,3 @@ +//@target: ES6 +v; +for (var v of [0]) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/for-ofStatements/for-of9.ts b/tests/cases/conformance/es6/for-ofStatements/for-of9.ts new file mode 100644 index 0000000000..45a3c7e1d9 --- /dev/null +++ b/tests/cases/conformance/es6/for-ofStatements/for-of9.ts @@ -0,0 +1,4 @@ +//@target: ES6 +var v: string; +for (v of ["hello"]) { } +for (v of "hello") { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration10_es6.ts b/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration10_es6.ts index 2b6e9657ef..9e02b6de03 100644 --- a/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration10_es6.ts +++ b/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration10_es6.ts @@ -1 +1,2 @@ +// @target:es6 let a: number = 1 \ No newline at end of file diff --git a/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration11_es6.ts b/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration11_es6.ts index aca6070823..0de0f085a8 100644 --- a/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration11_es6.ts +++ b/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration11_es6.ts @@ -1,2 +1,3 @@ +// @target:es6 "use strict"; let \ No newline at end of file diff --git a/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration1_es6.ts b/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration1_es6.ts index 8baacf4ea5..27157193b2 100644 --- a/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration1_es6.ts +++ b/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration1_es6.ts @@ -1 +1,2 @@ +// @target:es6 const \ No newline at end of file diff --git a/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration2_es6.ts b/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration2_es6.ts index 06871c9a45..17986424b1 100644 --- a/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration2_es6.ts +++ b/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration2_es6.ts @@ -1 +1,2 @@ +// @target:es6 const a \ No newline at end of file diff --git a/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration3_es6.ts b/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration3_es6.ts index 6779cd775c..cd1b75836e 100644 --- a/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration3_es6.ts +++ b/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration3_es6.ts @@ -1 +1,2 @@ +// @target:es6 const a = 1 \ No newline at end of file diff --git a/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration4_es6.ts b/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration4_es6.ts index f96229b7ea..e40c7b1528 100644 --- a/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration4_es6.ts +++ b/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration4_es6.ts @@ -1 +1,2 @@ +// @target:es6 const a: number \ No newline at end of file diff --git a/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration5_es6.ts b/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration5_es6.ts index 4a05e895a3..52738ea2f0 100644 --- a/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration5_es6.ts +++ b/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration5_es6.ts @@ -1 +1,2 @@ +// @target:es6 const a: number = 1 \ No newline at end of file diff --git a/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration6_es6.ts b/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration6_es6.ts index 33ae002d85..5fbd509be7 100644 --- a/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration6_es6.ts +++ b/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration6_es6.ts @@ -1 +1,2 @@ +// @target:es6 let \ No newline at end of file diff --git a/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration7_es6.ts b/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration7_es6.ts index 7350ac02e7..14f4b48341 100644 --- a/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration7_es6.ts +++ b/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration7_es6.ts @@ -1 +1,2 @@ +// @target:es6 let a \ No newline at end of file diff --git a/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration8_es6.ts b/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration8_es6.ts index 067c6699cf..2bab0e1a1a 100644 --- a/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration8_es6.ts +++ b/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration8_es6.ts @@ -1 +1,2 @@ +// @target:es6 let a = 1 \ No newline at end of file diff --git a/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration9_es6.ts b/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration9_es6.ts index aab3d49c18..db3cd38806 100644 --- a/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration9_es6.ts +++ b/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration9_es6.ts @@ -1 +1,2 @@ +// @target:es6 let a: number \ No newline at end of file diff --git a/tests/cases/conformance/expressions/contextualTyping/iterableContextualTyping1.ts b/tests/cases/conformance/expressions/contextualTyping/iterableContextualTyping1.ts new file mode 100644 index 0000000000..542d192801 --- /dev/null +++ b/tests/cases/conformance/expressions/contextualTyping/iterableContextualTyping1.ts @@ -0,0 +1,2 @@ +//@target: ES6 +var iter: Iterable<(x: string) => number> = [s => s.length]; \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-inStatements/for-inStatementsDestructuring.ts b/tests/cases/conformance/statements/for-inStatements/for-inStatementsDestructuring.ts new file mode 100644 index 0000000000..94868ef3bd --- /dev/null +++ b/tests/cases/conformance/statements/for-inStatements/for-inStatementsDestructuring.ts @@ -0,0 +1 @@ +for (var [a, b] in []) {} \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-inStatements/for-inStatementsDestructuring2.ts b/tests/cases/conformance/statements/for-inStatements/for-inStatementsDestructuring2.ts new file mode 100644 index 0000000000..8671acc675 --- /dev/null +++ b/tests/cases/conformance/statements/for-inStatements/for-inStatementsDestructuring2.ts @@ -0,0 +1 @@ +for (var {a, b} in []) {} \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-inStatements/for-inStatementsDestructuring3.ts b/tests/cases/conformance/statements/for-inStatements/for-inStatementsDestructuring3.ts new file mode 100644 index 0000000000..411261dee4 --- /dev/null +++ b/tests/cases/conformance/statements/for-inStatements/for-inStatementsDestructuring3.ts @@ -0,0 +1,2 @@ +var a, b; +for ([a, b] in []) { } \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-inStatements/for-inStatementsDestructuring4.ts b/tests/cases/conformance/statements/for-inStatements/for-inStatementsDestructuring4.ts new file mode 100644 index 0000000000..816dd564b6 --- /dev/null +++ b/tests/cases/conformance/statements/for-inStatements/for-inStatementsDestructuring4.ts @@ -0,0 +1,2 @@ +var a, b; +for ({a, b} in []) { } \ No newline at end of file diff --git a/tests/cases/fourslash/addDeclareToModule.ts b/tests/cases/fourslash/addDeclareToModule.ts index 428ee46841..3be95a03ee 100644 --- a/tests/cases/fourslash/addDeclareToModule.ts +++ b/tests/cases/fourslash/addDeclareToModule.ts @@ -1,8 +1,8 @@ -/// - -//// /**/module mAmbient { -//// module m3 { } -//// } - -goTo.marker(''); -edit.insert("declare "); +/// + +//// /**/module mAmbient { +//// module m3 { } +//// } + +goTo.marker(''); +edit.insert("declare "); diff --git a/tests/cases/fourslash/addDuplicateSetter.ts b/tests/cases/fourslash/addDuplicateSetter.ts index 0f3ed110f3..339c30d68a 100644 --- a/tests/cases/fourslash/addDuplicateSetter.ts +++ b/tests/cases/fourslash/addDuplicateSetter.ts @@ -1,10 +1,10 @@ -/// - -//// class C { -//// set foo(value) { } -//// /**/ -//// } - -goTo.marker(); -edit.insert("set foo(value) { }"); - +/// + +//// class C { +//// set foo(value) { } +//// /**/ +//// } + +goTo.marker(); +edit.insert("set foo(value) { }"); + diff --git a/tests/cases/fourslash/addFunctionInDuplicatedConstructorClassBody.ts b/tests/cases/fourslash/addFunctionInDuplicatedConstructorClassBody.ts index adbdd4820a..383f96b4f2 100644 --- a/tests/cases/fourslash/addFunctionInDuplicatedConstructorClassBody.ts +++ b/tests/cases/fourslash/addFunctionInDuplicatedConstructorClassBody.ts @@ -1,12 +1,12 @@ -/// - -//// class Foo { -//// constructor() { } -//// constructor() { } -//// /**/ -//// } - -goTo.marker(); -var func = 'fn() { }'; -edit.insert(func); -verify.numberOfErrorsInCurrentFile(2); +/// + +//// class Foo { +//// constructor() { } +//// constructor() { } +//// /**/ +//// } + +goTo.marker(); +var func = 'fn() { }'; +edit.insert(func); +verify.numberOfErrorsInCurrentFile(2); diff --git a/tests/cases/fourslash/addInterfaceMemberAboveClass.ts b/tests/cases/fourslash/addInterfaceMemberAboveClass.ts index 7da128c02b..0f131d0c92 100644 --- a/tests/cases/fourslash/addInterfaceMemberAboveClass.ts +++ b/tests/cases/fourslash/addInterfaceMemberAboveClass.ts @@ -1,21 +1,21 @@ -/// - -//// -//// interface Intersection { -//// /*insertHere*/ -//// } -//// interface Scene { } -//// class /*className*/Sphere { -//// constructor() { -//// } -//// } - -goTo.marker('className'); -verify.quickInfoIs('class Sphere'); - -goTo.marker('insertHere'); -edit.insert("ray: Ray;"); - -goTo.marker('className'); - +/// + +//// +//// interface Intersection { +//// /*insertHere*/ +//// } +//// interface Scene { } +//// class /*className*/Sphere { +//// constructor() { +//// } +//// } + +goTo.marker('className'); +verify.quickInfoIs('class Sphere'); + +goTo.marker('insertHere'); +edit.insert("ray: Ray;"); + +goTo.marker('className'); + verify.quickInfoIs('class Sphere'); \ No newline at end of file diff --git a/tests/cases/fourslash/addInterfaceToNotSatisfyConstraint.ts b/tests/cases/fourslash/addInterfaceToNotSatisfyConstraint.ts index bafc8cf304..a04ba99b65 100644 --- a/tests/cases/fourslash/addInterfaceToNotSatisfyConstraint.ts +++ b/tests/cases/fourslash/addInterfaceToNotSatisfyConstraint.ts @@ -1,14 +1,14 @@ -/// - -//// interface A { -//// a: number; -//// } -//// /**/ -//// interface C { -//// x: T; -//// } -//// -//// var v2: C; // should not work - -goTo.marker(); -edit.insert("interface B { b: string; }"); +/// + +//// interface A { +//// a: number; +//// } +//// /**/ +//// interface C { +//// x: T; +//// } +//// +//// var v2: C; // should not work + +goTo.marker(); +edit.insert("interface B { b: string; }"); diff --git a/tests/cases/fourslash/addMemberToInterface.ts b/tests/cases/fourslash/addMemberToInterface.ts index cc0ecbdb36..ab0f99e468 100644 --- a/tests/cases/fourslash/addMemberToInterface.ts +++ b/tests/cases/fourslash/addMemberToInterface.ts @@ -1,20 +1,20 @@ -/// - -//// -//// module /*check*/Mod{ -//// } -//// -//// interface MyInterface { -//// /*insert*/ -//// } - -edit.disableFormatting(); - -goTo.marker('check'); -verify.quickInfoIs('module Mod'); - -goTo.marker('insert'); -edit.insert("x: number;\n"); - -goTo.marker('check'); -verify.quickInfoIs('module Mod'); +/// + +//// +//// module /*check*/Mod{ +//// } +//// +//// interface MyInterface { +//// /*insert*/ +//// } + +edit.disableFormatting(); + +goTo.marker('check'); +verify.quickInfoIs('module Mod'); + +goTo.marker('insert'); +edit.insert("x: number;\n"); + +goTo.marker('check'); +verify.quickInfoIs('module Mod'); diff --git a/tests/cases/fourslash/addMethodToInterface1.ts b/tests/cases/fourslash/addMethodToInterface1.ts index 07cd470058..0bedbe634f 100644 --- a/tests/cases/fourslash/addMethodToInterface1.ts +++ b/tests/cases/fourslash/addMethodToInterface1.ts @@ -1,14 +1,14 @@ -/// - -//// interface Comparable { -//// /*1*/} -//// interface Comparer { -//// } -//// var max2: Comparer = (x, y) => { return (x.compareTo(y) > 0) ? x : y }; -//// var maxResult = max2(1); - -edit.disableFormatting(); - -goTo.marker('1'); - -edit.insert(" compareTo(): number;\n"); +/// + +//// interface Comparable { +//// /*1*/} +//// interface Comparer { +//// } +//// var max2: Comparer = (x, y) => { return (x.compareTo(y) > 0) ? x : y }; +//// var maxResult = max2(1); + +edit.disableFormatting(); + +goTo.marker('1'); + +edit.insert(" compareTo(): number;\n"); diff --git a/tests/cases/fourslash/addVarToConstructor1.ts b/tests/cases/fourslash/addVarToConstructor1.ts index 986de53f00..31eedf88be 100644 --- a/tests/cases/fourslash/addVarToConstructor1.ts +++ b/tests/cases/fourslash/addVarToConstructor1.ts @@ -1,24 +1,24 @@ -/// - -//// -//// //_modes. // produces an internal error - please implement in derived class -//// -//// module editor { -//// import modes = _modes; -//// -//// var i : modes.IMode; -//// -//// // If you just use p1:modes, the compiler accepts it - should be an error -//// class Bg { -//// constructor(p1: modes, p2: modes.Mode) {// should be an error on p2 - it's not exported -//// /*1*/} -//// -//// } -//// } -//// - -edit.disableFormatting(); - -goTo.marker('1'); - -edit.insert(" var x:modes.Mode;\n"); +/// + +//// +//// //_modes. // produces an internal error - please implement in derived class +//// +//// module editor { +//// import modes = _modes; +//// +//// var i : modes.IMode; +//// +//// // If you just use p1:modes, the compiler accepts it - should be an error +//// class Bg { +//// constructor(p1: modes, p2: modes.Mode) {// should be an error on p2 - it's not exported +//// /*1*/} +//// +//// } +//// } +//// + +edit.disableFormatting(); + +goTo.marker('1'); + +edit.insert(" var x:modes.Mode;\n"); diff --git a/tests/cases/fourslash/alignmentAfterFormattingOnMultilineExpressionAndParametersList.ts b/tests/cases/fourslash/alignmentAfterFormattingOnMultilineExpressionAndParametersList.ts index 0b50612d45..c202aa00a5 100644 --- a/tests/cases/fourslash/alignmentAfterFormattingOnMultilineExpressionAndParametersList.ts +++ b/tests/cases/fourslash/alignmentAfterFormattingOnMultilineExpressionAndParametersList.ts @@ -1,25 +1,25 @@ -/// - -////class TestClass { -//// private testMethod1(param1: boolean, -//// param2/*1*/: boolean) { -//// } -//// -//// public testMethod2(a: number, b: number, c: number) { -//// if (a === b) { -//// } -//// else if (a != c && -//// a/*2*/ > b && -//// b/*3*/ < c) { -//// } -//// -//// } -////} - -format.document(); -goTo.marker("1"); -verify.indentationIs(8); -goTo.marker("2"); -verify.indentationIs(12); -goTo.marker("3"); -verify.indentationIs(12); +/// + +////class TestClass { +//// private testMethod1(param1: boolean, +//// param2/*1*/: boolean) { +//// } +//// +//// public testMethod2(a: number, b: number, c: number) { +//// if (a === b) { +//// } +//// else if (a != c && +//// a/*2*/ > b && +//// b/*3*/ < c) { +//// } +//// +//// } +////} + +format.document(); +goTo.marker("1"); +verify.indentationIs(8); +goTo.marker("2"); +verify.indentationIs(12); +goTo.marker("3"); +verify.indentationIs(12); diff --git a/tests/cases/fourslash/argumentsAreAvailableAfterEditsAtEndOfFunction.ts b/tests/cases/fourslash/argumentsAreAvailableAfterEditsAtEndOfFunction.ts index e3ab138851..8a1efef397 100644 --- a/tests/cases/fourslash/argumentsAreAvailableAfterEditsAtEndOfFunction.ts +++ b/tests/cases/fourslash/argumentsAreAvailableAfterEditsAtEndOfFunction.ts @@ -1,15 +1,15 @@ -/// - -////module Test1 { -//// class Person { -//// children: string[]; -//// constructor(public name: string, children: string[]) { -//// /**/ -//// } -//// } -////} - -goTo.marker(); -var text = "this.children = ch"; -edit.insert(text); +/// + +////module Test1 { +//// class Person { +//// children: string[]; +//// constructor(public name: string, children: string[]) { +//// /**/ +//// } +//// } +////} + +goTo.marker(); +var text = "this.children = ch"; +edit.insert(text); verify.completionListContains("children", "(parameter) children: string[]"); \ No newline at end of file diff --git a/tests/cases/fourslash/argumentsIndexExpression.ts b/tests/cases/fourslash/argumentsIndexExpression.ts index 6f54a76676..bda0c23e48 100644 --- a/tests/cases/fourslash/argumentsIndexExpression.ts +++ b/tests/cases/fourslash/argumentsIndexExpression.ts @@ -1,8 +1,8 @@ -/// - -//// function f() { -//// var x = /**/arguments[0]; -//// } - -goTo.marker(); -verify.quickInfoExists(); +/// + +//// function f() { +//// var x = /**/arguments[0]; +//// } + +goTo.marker(); +verify.quickInfoExists(); diff --git a/tests/cases/fourslash/arrayConcatTypeCheck0.ts b/tests/cases/fourslash/arrayConcatTypeCheck0.ts index 9250eb5b6f..7361f3c9e8 100644 --- a/tests/cases/fourslash/arrayConcatTypeCheck0.ts +++ b/tests/cases/fourslash/arrayConcatTypeCheck0.ts @@ -1,16 +1,16 @@ -/// - -//// var a = []; -//// a.concat("hello"/*1*/); -//// -//// a.concat('Hello'); -//// -//// var b = new Array(); -//// b.concat('hello'); -//// - -edit.disableFormatting(); - -goTo.marker('1'); - -edit.insert(", 'world'"); +/// + +//// var a = []; +//// a.concat("hello"/*1*/); +//// +//// a.concat('Hello'); +//// +//// var b = new Array(); +//// b.concat('hello'); +//// + +edit.disableFormatting(); + +goTo.marker('1'); + +edit.insert(", 'world'"); diff --git a/tests/cases/fourslash/arrayConcatTypeCheck1.ts b/tests/cases/fourslash/arrayConcatTypeCheck1.ts index c62bd5b7f1..9d7de1704a 100644 --- a/tests/cases/fourslash/arrayConcatTypeCheck1.ts +++ b/tests/cases/fourslash/arrayConcatTypeCheck1.ts @@ -1,26 +1,26 @@ -/// - -//// a.concat(/*2*/"hello"/*1*/, 'world'); -//// -//// a.concat(/*3*/'Hello'); -//// -//// var b = new Array/*4*/<>(); -//// b.concat('hello'); -//// - -edit.disableFormatting(); - -goTo.marker('1'); - -edit.deleteAtCaret(9); - -goTo.marker('3'); - -edit.deleteAtCaret(7); - -goTo.marker('2'); - -edit.deleteAtCaret(7); - -goTo.marker('4'); - +/// + +//// a.concat(/*2*/"hello"/*1*/, 'world'); +//// +//// a.concat(/*3*/'Hello'); +//// +//// var b = new Array/*4*/<>(); +//// b.concat('hello'); +//// + +edit.disableFormatting(); + +goTo.marker('1'); + +edit.deleteAtCaret(9); + +goTo.marker('3'); + +edit.deleteAtCaret(7); + +goTo.marker('2'); + +edit.deleteAtCaret(7); + +goTo.marker('4'); + diff --git a/tests/cases/fourslash/autoFormattingOnPasting.ts b/tests/cases/fourslash/autoFormattingOnPasting.ts index cee2be4bec..0c7f471d43 100644 --- a/tests/cases/fourslash/autoFormattingOnPasting.ts +++ b/tests/cases/fourslash/autoFormattingOnPasting.ts @@ -1,28 +1,28 @@ -/// - -////module TestModule { -/////**/ -////} -goTo.marker(""); -edit.paste(" class TestClass{\r\n\ -private foo;\r\n\ -public testMethod( )\r\n\ -{}\r\n\ -}"); -// We're missing scenarios of formatting option settings due to bug 693273 - [TypeScript] Need to improve fourslash support for formatting options. -// Missing scenario ** Uncheck Tools->Options->Text Editor->TypeScript->Formatting->General->Format on paste ** -//verify.currentFileContentIs("module TestModule {\r\n\ -// class TestClass{\r\n\ -//private foo;\r\n\ -//public testMethod( )\r\n\ -//{}\r\n\ -//}\r\n\ -//}"); -// Missing scenario ** Check Tools->Options->Text Editor->TypeScript->Formatting->General->Format on paste ** -verify.currentFileContentIs("module TestModule {\r\n\ - class TestClass {\r\n\ - private foo;\r\n\ - public testMethod()\r\n\ - { }\r\n\ - }\r\n\ +/// + +////module TestModule { +/////**/ +////} +goTo.marker(""); +edit.paste(" class TestClass{\r\n\ +private foo;\r\n\ +public testMethod( )\r\n\ +{}\r\n\ +}"); +// We're missing scenarios of formatting option settings due to bug 693273 - [TypeScript] Need to improve fourslash support for formatting options. +// Missing scenario ** Uncheck Tools->Options->Text Editor->TypeScript->Formatting->General->Format on paste ** +//verify.currentFileContentIs("module TestModule {\r\n\ +// class TestClass{\r\n\ +//private foo;\r\n\ +//public testMethod( )\r\n\ +//{}\r\n\ +//}\r\n\ +//}"); +// Missing scenario ** Check Tools->Options->Text Editor->TypeScript->Formatting->General->Format on paste ** +verify.currentFileContentIs("module TestModule {\r\n\ + class TestClass {\r\n\ + private foo;\r\n\ + public testMethod()\r\n\ + { }\r\n\ + }\r\n\ }"); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationClass.ts b/tests/cases/fourslash/breakpointValidationClass.ts index 99209c465b..112c89dbb7 100644 --- a/tests/cases/fourslash/breakpointValidationClass.ts +++ b/tests/cases/fourslash/breakpointValidationClass.ts @@ -19,7 +19,7 @@ //// set greetings(greetings: string) { //// this.greeting = greetings; //// } -////} +////} ////class Greeter2 { ////} ////class Greeter1 @@ -45,9 +45,9 @@ //// { //// this.greeting = greetings; //// } -////} +////} ////class Greeter12 ////{ ////} - + verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationClassAmbient.ts b/tests/cases/fourslash/breakpointValidationClassAmbient.ts index ab0b78003a..4e6d0bb0af 100644 --- a/tests/cases/fourslash/breakpointValidationClassAmbient.ts +++ b/tests/cases/fourslash/breakpointValidationClassAmbient.ts @@ -9,6 +9,6 @@ //// private val; //// static x: number; //// static fn(a: number, ...b:string[]); -////} +////} verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationClasses.ts b/tests/cases/fourslash/breakpointValidationClasses.ts index 286001cfee..8ffe62e30e 100644 --- a/tests/cases/fourslash/breakpointValidationClasses.ts +++ b/tests/cases/fourslash/breakpointValidationClasses.ts @@ -3,37 +3,37 @@ // @BaselineFile: bpSpan_classes.baseline // @Filename: bpSpan_classes.ts ////module Foo.Bar { -//// "use strict"; -//// +//// "use strict"; +//// //// class Greeter { //// constructor(public greeting: string) { //// } -//// +//// //// greet() { //// return "

" + this.greeting + "

"; //// } -//// } -//// -//// +//// } +//// +//// //// function foo(greeting: string): Greeter { //// return new Greeter(greeting); -//// } -//// -//// var greeter = new Greeter("Hello, world!"); -//// var str = greeter.greet(); -//// +//// } +//// +//// var greeter = new Greeter("Hello, world!"); +//// var str = greeter.greet(); +//// //// function foo2(greeting: string, ...restGreetings /* more greeting */: string[]) { //// var greeters: Greeter[] = []; /* inline block comment */ //// greeters[0] = new Greeter(greeting); //// for (var i = 0; i < restGreetings.length; i++) { //// greeters.push(new Greeter(restGreetings[i])); //// } -//// +//// //// return greeters; -//// } -//// -//// var b = foo2("Hello", "World", "!"); -//// // This is simple signle line comment +//// } +//// +//// var b = foo2("Hello", "World", "!"); +//// // This is simple signle line comment //// for (var j = 0; j < b.length; j++) { //// b[j].greet(); //// } diff --git a/tests/cases/fourslash/brokenClassErrorRecovery.ts b/tests/cases/fourslash/brokenClassErrorRecovery.ts index f5badafaef..7dafaafeb0 100644 --- a/tests/cases/fourslash/brokenClassErrorRecovery.ts +++ b/tests/cases/fourslash/brokenClassErrorRecovery.ts @@ -1,10 +1,10 @@ -/// - -////class Foo { -//// constructor() { var x = [1, 2, 3 } -////} -/////**/ -////var bar = new Foo(); - -verify.not.errorExistsAfterMarker(); - +/// + +////class Foo { +//// constructor() { var x = [1, 2, 3 } +////} +/////**/ +////var bar = new Foo(); + +verify.not.errorExistsAfterMarker(); + diff --git a/tests/cases/fourslash/classExtendsInterfaceSigHelp1.ts b/tests/cases/fourslash/classExtendsInterfaceSigHelp1.ts index ebdccef485..c2b4d5e70a 100644 --- a/tests/cases/fourslash/classExtendsInterfaceSigHelp1.ts +++ b/tests/cases/fourslash/classExtendsInterfaceSigHelp1.ts @@ -11,8 +11,8 @@ ////} ////var i: I; -////i.foo(/**/ - -goTo.marker(); -verify.signatureHelpCountIs(2); +////i.foo(/**/ + +goTo.marker(); +verify.signatureHelpCountIs(2); verify.currentParameterSpanIs('x: string'); \ No newline at end of file diff --git a/tests/cases/fourslash/classRenamingErrorRecovery.ts b/tests/cases/fourslash/classRenamingErrorRecovery.ts index eabc9c748a..c95d112cdc 100644 --- a/tests/cases/fourslash/classRenamingErrorRecovery.ts +++ b/tests/cases/fourslash/classRenamingErrorRecovery.ts @@ -1,9 +1,9 @@ -/// - -////class Foo/*1*//*2*/ { public Bar() { } } - -goTo.marker("1"); -edit.backspace(3); -edit.insert("Pizza"); -verify.currentLineContentIs("class Pizza { public Bar() { } }"); +/// + +////class Foo/*1*//*2*/ { public Bar() { } } + +goTo.marker("1"); +edit.backspace(3); +edit.insert("Pizza"); +verify.currentLineContentIs("class Pizza { public Bar() { } }"); verify.not.errorExistsAfterMarker("2"); \ No newline at end of file diff --git a/tests/cases/fourslash/closedCommentsInConstructor.ts b/tests/cases/fourslash/closedCommentsInConstructor.ts index 6ab5c4b981..8a168a5835 100644 --- a/tests/cases/fourslash/closedCommentsInConstructor.ts +++ b/tests/cases/fourslash/closedCommentsInConstructor.ts @@ -1,8 +1,8 @@ -/// - -////class Foo { -//// constructor(/* /**/ */) { } -////} - -goTo.marker(); +/// + +////class Foo { +//// constructor(/* /**/ */) { } +////} + +goTo.marker(); verify.completionListIsEmpty(); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListAfterClassExtends.ts b/tests/cases/fourslash/completionListAfterClassExtends.ts index 37eb476eff..15a3e26176 100644 --- a/tests/cases/fourslash/completionListAfterClassExtends.ts +++ b/tests/cases/fourslash/completionListAfterClassExtends.ts @@ -1,16 +1,16 @@ -/// - -////module Bar { -//// export class Bleah { -//// } -//// export class Foo extends /**/Bleah { -//// } -////} -//// -////function Blah(x: Bar.Bleah) { -////} - -goTo.marker(); -verify.completionListContains("Bar"); -verify.completionListContains("Bleah"); +/// + +////module Bar { +//// export class Bleah { +//// } +//// export class Foo extends /**/Bleah { +//// } +////} +//// +////function Blah(x: Bar.Bleah) { +////} + +goTo.marker(); +verify.completionListContains("Bar"); +verify.completionListContains("Bleah"); verify.completionListContains("Foo"); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListAndMemberListOnCommentedDot.ts b/tests/cases/fourslash/completionListAndMemberListOnCommentedDot.ts index 6c2288afb6..c3ee033bf5 100644 --- a/tests/cases/fourslash/completionListAndMemberListOnCommentedDot.ts +++ b/tests/cases/fourslash/completionListAndMemberListOnCommentedDot.ts @@ -1,18 +1,18 @@ -/// - -////module M { -//// export class C { public pub = 0; private priv = 1; } -//// export var V = 0; -////} -//// -//// -////var c = new M.C(); -//// -////c. // test on c. -//// -//////Test for comment -//////c./**/ - -goTo.marker(); -verify.completionListIsEmpty(); +/// + +////module M { +//// export class C { public pub = 0; private priv = 1; } +//// export var V = 0; +////} +//// +//// +////var c = new M.C(); +//// +////c. // test on c. +//// +//////Test for comment +//////c./**/ + +goTo.marker(); +verify.completionListIsEmpty(); verify.memberListIsEmpty(); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListAndMemberListOnCommentedLine.ts b/tests/cases/fourslash/completionListAndMemberListOnCommentedLine.ts index 500f0bc858..96eac09b6f 100644 --- a/tests/cases/fourslash/completionListAndMemberListOnCommentedLine.ts +++ b/tests/cases/fourslash/completionListAndMemberListOnCommentedLine.ts @@ -1,7 +1,7 @@ -/// - -////// /**/ -////var - -goTo.marker(); +/// + +////// /**/ +////var + +goTo.marker(); verify.completionListIsEmpty(); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListAndMemberListOnCommentedWhiteSpace.ts b/tests/cases/fourslash/completionListAndMemberListOnCommentedWhiteSpace.ts index 2e30851ea1..f0287a0bae 100644 --- a/tests/cases/fourslash/completionListAndMemberListOnCommentedWhiteSpace.ts +++ b/tests/cases/fourslash/completionListAndMemberListOnCommentedWhiteSpace.ts @@ -1,18 +1,18 @@ -/// - -////module M { -//// export class C { public pub = 0; private priv = 1; } -//// export var V = 0; -////} -//// -//// -////var c = new M.C(); -//// -////c. // test on c. -//// -//////Test for comment -//////c. /**/ - -goTo.marker(); -verify.completionListIsEmpty(); +/// + +////module M { +//// export class C { public pub = 0; private priv = 1; } +//// export var V = 0; +////} +//// +//// +////var c = new M.C(); +//// +////c. // test on c. +//// +//////Test for comment +//////c. /**/ + +goTo.marker(); +verify.completionListIsEmpty(); verify.memberListIsEmpty(); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListAtDeclarationOfParameterType.ts b/tests/cases/fourslash/completionListAtDeclarationOfParameterType.ts index fcc40d8ee5..94de51cc9a 100644 --- a/tests/cases/fourslash/completionListAtDeclarationOfParameterType.ts +++ b/tests/cases/fourslash/completionListAtDeclarationOfParameterType.ts @@ -1,14 +1,14 @@ -/// - -////module Bar { -//// export class Bleah { -//// } -//// export class Foo extends Bleah { -//// } -////} -//// -////function Blah(x: /**/Bar.Bleah) { -////} - -goTo.marker(); +/// + +////module Bar { +//// export class Bleah { +//// } +//// export class Foo extends Bleah { +//// } +////} +//// +////function Blah(x: /**/Bar.Bleah) { +////} + +goTo.marker(); verify.completionListContains("Bar"); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListAtIdentifierDefinitionLocations_destructuring.ts b/tests/cases/fourslash/completionListAtIdentifierDefinitionLocations_destructuring.ts index 143c884e17..0812cb138d 100644 --- a/tests/cases/fourslash/completionListAtIdentifierDefinitionLocations_destructuring.ts +++ b/tests/cases/fourslash/completionListAtIdentifierDefinitionLocations_destructuring.ts @@ -1,22 +1,22 @@ -/// - -//// var [x/*variable1*/ - -//// var [x, y/*variable2*/ - -//// var [./*variable3*/ - -//// var [x, ...z/*variable4*/ - -//// var {x/*variable5*/ - -//// var {x, y/*variable6*/ - -//// function func1({ a/*parameter1*/ - -//// function func2({ a, b/*parameter2*/ - -test.markers().forEach((m) => { - goTo.position(m.position, m.fileName); - verify.completionListIsEmpty(); -}); +/// + +//// var [x/*variable1*/ + +//// var [x, y/*variable2*/ + +//// var [./*variable3*/ + +//// var [x, ...z/*variable4*/ + +//// var {x/*variable5*/ + +//// var {x, y/*variable6*/ + +//// function func1({ a/*parameter1*/ + +//// function func2({ a, b/*parameter2*/ + +test.markers().forEach((m) => { + goTo.position(m.position, m.fileName); + verify.completionListIsEmpty(); +}); diff --git a/tests/cases/fourslash/completionListBuilderLocations_VariableDeclarations.ts b/tests/cases/fourslash/completionListBuilderLocations_VariableDeclarations.ts index 45f16090fd..d069b9a722 100644 --- a/tests/cases/fourslash/completionListBuilderLocations_VariableDeclarations.ts +++ b/tests/cases/fourslash/completionListBuilderLocations_VariableDeclarations.ts @@ -1,34 +1,34 @@ -/// - -////var x = a/*var1*/ - -////var x = (b/*var2*/ - -////var x = (c, d/*var3*/ - -//// var y : any = "", x = a/*var4*/ - -//// var y : any = "", x = (a/*var5*/ - -////class C{} -////var y = new C( - -//// class C{} -//// var y = new C(0, /*var7*/ - -////var y = [/*var8*/ - -////var y = [0, /*var9*/ - -////var y = `${/*var10*/ - -////var y = `${10} dd ${ /*var11*/ - -////var y = 10; y=/*var12*/ - -test.markers().forEach((m) => { - goTo.position(m.position, m.fileName); - verify.completionListAllowsNewIdentifier(); -}); - - +/// + +////var x = a/*var1*/ + +////var x = (b/*var2*/ + +////var x = (c, d/*var3*/ + +//// var y : any = "", x = a/*var4*/ + +//// var y : any = "", x = (a/*var5*/ + +////class C{} +////var y = new C( + +//// class C{} +//// var y = new C(0, /*var7*/ + +////var y = [/*var8*/ + +////var y = [0, /*var9*/ + +////var y = `${/*var10*/ + +////var y = `${10} dd ${ /*var11*/ + +////var y = 10; y=/*var12*/ + +test.markers().forEach((m) => { + goTo.position(m.position, m.fileName); + verify.completionListAllowsNewIdentifier(); +}); + + diff --git a/tests/cases/fourslash/completionListCladule.ts b/tests/cases/fourslash/completionListCladule.ts index 372e5efa21..79c2e8aea6 100644 --- a/tests/cases/fourslash/completionListCladule.ts +++ b/tests/cases/fourslash/completionListCladule.ts @@ -1,4 +1,4 @@ -/// +/// ////class Foo { //// doStuff(): number { return 0; } diff --git a/tests/cases/fourslash/completionListErrorRecovery.ts b/tests/cases/fourslash/completionListErrorRecovery.ts index b71212061c..7a7b9f81ca 100644 --- a/tests/cases/fourslash/completionListErrorRecovery.ts +++ b/tests/cases/fourslash/completionListErrorRecovery.ts @@ -1,13 +1,13 @@ -/// - -////class Foo { static fun() { }; } - -////Foo./**/; -/////*1*/var bar; - +/// + +////class Foo { static fun() { }; } + +////Foo./**/; +/////*1*/var bar; + // this line triggers a semantic/syntactic error check, remove line when 788570 is fixed -edit.insert(''); - -goTo.marker(); -verify.memberListContains("fun"); +edit.insert(''); + +goTo.marker(); +verify.memberListContains("fun"); verify.not.errorExistsAfterMarker("1"); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListErrorRecovery2.ts b/tests/cases/fourslash/completionListErrorRecovery2.ts index d2411dfd90..8a368ba446 100644 --- a/tests/cases/fourslash/completionListErrorRecovery2.ts +++ b/tests/cases/fourslash/completionListErrorRecovery2.ts @@ -1,12 +1,12 @@ -/// - -////class Foo { static bar() { return "x"; } } -////var baz = Foo/**/; -/////*1*/baz.concat("y"); - +/// + +////class Foo { static bar() { return "x"; } } +////var baz = Foo/**/; +/////*1*/baz.concat("y"); + // this line triggers a semantic/syntactic error check, remove line when 788570 is fixed -edit.insert(''); - -goTo.marker(); -edit.insert(".b"); -verify.not.errorExistsAfterMarker("1"); +edit.insert(''); + +goTo.marker(); +edit.insert(".b"); +verify.not.errorExistsAfterMarker("1"); diff --git a/tests/cases/fourslash/completionListFunctionMembers.ts b/tests/cases/fourslash/completionListFunctionMembers.ts index 6f4e2bf606..c24dff1bee 100644 --- a/tests/cases/fourslash/completionListFunctionMembers.ts +++ b/tests/cases/fourslash/completionListFunctionMembers.ts @@ -1,11 +1,11 @@ -/// - -////function fnc1() { -//// var bar = 1; -//// function foob(){ } -////} -//// -////fnc1./**/ - -goTo.marker(); +/// + +////function fnc1() { +//// var bar = 1; +//// function foob(){ } +////} +//// +////fnc1./**/ + +goTo.marker(); verify.memberListContains('arguments', '(property) Function.arguments: any'); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListInstanceProtectedMembers.ts b/tests/cases/fourslash/completionListInstanceProtectedMembers.ts index de09f05968..996bef7077 100644 --- a/tests/cases/fourslash/completionListInstanceProtectedMembers.ts +++ b/tests/cases/fourslash/completionListInstanceProtectedMembers.ts @@ -1,63 +1,63 @@ -/// - -////class Base { -//// private privateMethod() { } -//// private privateProperty; -//// -//// protected protectedMethod() { } -//// protected protectedProperty; -//// -//// public publicMethod() { } -//// public publicProperty; -//// -//// protected protectedOverriddenMethod() { } -//// protected protectedOverriddenProperty; -//// -//// test() { -//// this./*1*/; -//// -//// var b: Base; -//// var c: C1; -//// -//// b./*2*/; -//// c./*3*/; -//// } -////} -//// -////class C1 extends Base { -//// protected protectedOverriddenMethod() { } -//// protected protectedOverriddenProperty; -////} - - -// Same class, everything is visible -goTo.marker("1"); -verify.memberListContains('privateMethod'); -verify.memberListContains('privateProperty'); -verify.memberListContains('protectedMethod'); -verify.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.memberListContains('protectedOverriddenMethod'); -verify.memberListContains('protectedOverriddenProperty'); - -goTo.marker("2"); -verify.memberListContains('privateMethod'); -verify.memberListContains('privateProperty'); -verify.memberListContains('protectedMethod'); -verify.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.memberListContains('protectedOverriddenMethod'); -verify.memberListContains('protectedOverriddenProperty'); - -// Can not access protected properties overridden in subclass -goTo.marker("3"); -verify.memberListContains('privateMethod'); -verify.memberListContains('privateProperty'); -verify.memberListContains('protectedMethod'); -verify.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.not.memberListContains('protectedOverriddenMethod'); +/// + +////class Base { +//// private privateMethod() { } +//// private privateProperty; +//// +//// protected protectedMethod() { } +//// protected protectedProperty; +//// +//// public publicMethod() { } +//// public publicProperty; +//// +//// protected protectedOverriddenMethod() { } +//// protected protectedOverriddenProperty; +//// +//// test() { +//// this./*1*/; +//// +//// var b: Base; +//// var c: C1; +//// +//// b./*2*/; +//// c./*3*/; +//// } +////} +//// +////class C1 extends Base { +//// protected protectedOverriddenMethod() { } +//// protected protectedOverriddenProperty; +////} + + +// Same class, everything is visible +goTo.marker("1"); +verify.memberListContains('privateMethod'); +verify.memberListContains('privateProperty'); +verify.memberListContains('protectedMethod'); +verify.memberListContains('protectedProperty'); +verify.memberListContains('publicMethod'); +verify.memberListContains('publicProperty'); +verify.memberListContains('protectedOverriddenMethod'); +verify.memberListContains('protectedOverriddenProperty'); + +goTo.marker("2"); +verify.memberListContains('privateMethod'); +verify.memberListContains('privateProperty'); +verify.memberListContains('protectedMethod'); +verify.memberListContains('protectedProperty'); +verify.memberListContains('publicMethod'); +verify.memberListContains('publicProperty'); +verify.memberListContains('protectedOverriddenMethod'); +verify.memberListContains('protectedOverriddenProperty'); + +// Can not access protected properties overridden in subclass +goTo.marker("3"); +verify.memberListContains('privateMethod'); +verify.memberListContains('privateProperty'); +verify.memberListContains('protectedMethod'); +verify.memberListContains('protectedProperty'); +verify.memberListContains('publicMethod'); +verify.memberListContains('publicProperty'); +verify.not.memberListContains('protectedOverriddenMethod'); verify.not.memberListContains('protectedOverriddenProperty'); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListInstanceProtectedMembers2.ts b/tests/cases/fourslash/completionListInstanceProtectedMembers2.ts index 72b6f3a1f7..c074bc0631 100644 --- a/tests/cases/fourslash/completionListInstanceProtectedMembers2.ts +++ b/tests/cases/fourslash/completionListInstanceProtectedMembers2.ts @@ -1,76 +1,76 @@ -/// - -////class Base { -//// private privateMethod() { } -//// private privateProperty; -//// -//// protected protectedMethod() { } -//// protected protectedProperty; -//// -//// public publicMethod() { } -//// public publicProperty; -//// -//// protected protectedOverriddenMethod() { } -//// protected protectedOverriddenProperty; -////} -//// -////class C1 extends Base { -//// protected protectedOverriddenMethod() { } -//// protected protectedOverriddenProperty; -//// -//// test() { -//// this./*1*/; -//// super./*2*/; -//// -//// var b: Base; -//// var c: C1; -//// -//// b./*3*/; -//// c./*4*/; -//// } -////} - - -// Same class, everything is visible -goTo.marker("1"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.memberListContains('protectedMethod'); -verify.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.memberListContains('protectedOverriddenMethod'); -verify.memberListContains('protectedOverriddenProperty'); - -// Can not access properties on super -goTo.marker("2"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.memberListContains('protectedMethod'); -verify.not.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.not.memberListContains('publicProperty'); -verify.memberListContains('protectedOverriddenMethod'); -verify.not.memberListContains('protectedOverriddenProperty'); - -// Can not access protected properties through base class -goTo.marker("3"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.not.memberListContains('protectedMethod'); -verify.not.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.not.memberListContains('protectedOverriddenMethod'); -verify.not.memberListContains('protectedOverriddenProperty'); - -// Same class, everything is visible -goTo.marker("4"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.memberListContains('protectedMethod'); -verify.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.memberListContains('protectedOverriddenMethod'); -verify.memberListContains('protectedOverriddenProperty'); +/// + +////class Base { +//// private privateMethod() { } +//// private privateProperty; +//// +//// protected protectedMethod() { } +//// protected protectedProperty; +//// +//// public publicMethod() { } +//// public publicProperty; +//// +//// protected protectedOverriddenMethod() { } +//// protected protectedOverriddenProperty; +////} +//// +////class C1 extends Base { +//// protected protectedOverriddenMethod() { } +//// protected protectedOverriddenProperty; +//// +//// test() { +//// this./*1*/; +//// super./*2*/; +//// +//// var b: Base; +//// var c: C1; +//// +//// b./*3*/; +//// c./*4*/; +//// } +////} + + +// Same class, everything is visible +goTo.marker("1"); +verify.not.memberListContains('privateMethod'); +verify.not.memberListContains('privateProperty'); +verify.memberListContains('protectedMethod'); +verify.memberListContains('protectedProperty'); +verify.memberListContains('publicMethod'); +verify.memberListContains('publicProperty'); +verify.memberListContains('protectedOverriddenMethod'); +verify.memberListContains('protectedOverriddenProperty'); + +// Can not access properties on super +goTo.marker("2"); +verify.not.memberListContains('privateMethod'); +verify.not.memberListContains('privateProperty'); +verify.memberListContains('protectedMethod'); +verify.not.memberListContains('protectedProperty'); +verify.memberListContains('publicMethod'); +verify.not.memberListContains('publicProperty'); +verify.memberListContains('protectedOverriddenMethod'); +verify.not.memberListContains('protectedOverriddenProperty'); + +// Can not access protected properties through base class +goTo.marker("3"); +verify.not.memberListContains('privateMethod'); +verify.not.memberListContains('privateProperty'); +verify.not.memberListContains('protectedMethod'); +verify.not.memberListContains('protectedProperty'); +verify.memberListContains('publicMethod'); +verify.memberListContains('publicProperty'); +verify.not.memberListContains('protectedOverriddenMethod'); +verify.not.memberListContains('protectedOverriddenProperty'); + +// Same class, everything is visible +goTo.marker("4"); +verify.not.memberListContains('privateMethod'); +verify.not.memberListContains('privateProperty'); +verify.memberListContains('protectedMethod'); +verify.memberListContains('protectedProperty'); +verify.memberListContains('publicMethod'); +verify.memberListContains('publicProperty'); +verify.memberListContains('protectedOverriddenMethod'); +verify.memberListContains('protectedOverriddenProperty'); diff --git a/tests/cases/fourslash/completionListInstanceProtectedMembers3.ts b/tests/cases/fourslash/completionListInstanceProtectedMembers3.ts index 2b3bf2ac2d..c2956da8a4 100644 --- a/tests/cases/fourslash/completionListInstanceProtectedMembers3.ts +++ b/tests/cases/fourslash/completionListInstanceProtectedMembers3.ts @@ -1,46 +1,46 @@ -/// - -////class Base { -//// private privateMethod() { } -//// private privateProperty; -//// -//// protected protectedMethod() { } -//// protected protectedProperty; -//// -//// public publicMethod() { } -//// public publicProperty; -//// -//// protected protectedOverriddenMethod() { } -//// protected protectedOverriddenProperty; -////} -//// -////class C1 extends Base { -//// protected protectedOverriddenMethod() { } -//// protected protectedOverriddenProperty; -////} -//// -//// var b: Base; -//// var c: C1; -//// b./*1*/; -//// c./*2*/; - -// Only public properties are visible outside the class -goTo.marker("1"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.not.memberListContains('protectedMethod'); -verify.not.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.not.memberListContains('protectedOverriddenMethod'); -verify.not.memberListContains('protectedOverriddenProperty'); - -goTo.marker("2"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.not.memberListContains('protectedMethod'); -verify.not.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.not.memberListContains('protectedOverriddenMethod'); -verify.not.memberListContains('protectedOverriddenProperty'); +/// + +////class Base { +//// private privateMethod() { } +//// private privateProperty; +//// +//// protected protectedMethod() { } +//// protected protectedProperty; +//// +//// public publicMethod() { } +//// public publicProperty; +//// +//// protected protectedOverriddenMethod() { } +//// protected protectedOverriddenProperty; +////} +//// +////class C1 extends Base { +//// protected protectedOverriddenMethod() { } +//// protected protectedOverriddenProperty; +////} +//// +//// var b: Base; +//// var c: C1; +//// b./*1*/; +//// c./*2*/; + +// Only public properties are visible outside the class +goTo.marker("1"); +verify.not.memberListContains('privateMethod'); +verify.not.memberListContains('privateProperty'); +verify.not.memberListContains('protectedMethod'); +verify.not.memberListContains('protectedProperty'); +verify.memberListContains('publicMethod'); +verify.memberListContains('publicProperty'); +verify.not.memberListContains('protectedOverriddenMethod'); +verify.not.memberListContains('protectedOverriddenProperty'); + +goTo.marker("2"); +verify.not.memberListContains('privateMethod'); +verify.not.memberListContains('privateProperty'); +verify.not.memberListContains('protectedMethod'); +verify.not.memberListContains('protectedProperty'); +verify.memberListContains('publicMethod'); +verify.memberListContains('publicProperty'); +verify.not.memberListContains('protectedOverriddenMethod'); +verify.not.memberListContains('protectedOverriddenProperty'); diff --git a/tests/cases/fourslash/completionListInstanceProtectedMembers4.ts b/tests/cases/fourslash/completionListInstanceProtectedMembers4.ts index 27f9bb5a1c..82593391fa 100644 --- a/tests/cases/fourslash/completionListInstanceProtectedMembers4.ts +++ b/tests/cases/fourslash/completionListInstanceProtectedMembers4.ts @@ -1,34 +1,34 @@ -/// - -////class Base { -//// private privateMethod() { } -//// private privateProperty; -//// -//// protected protectedMethod() { } -//// protected protectedProperty; -//// -//// public publicMethod() { } -//// public publicProperty; -//// -//// protected protectedOverriddenMethod() { } -//// protected protectedOverriddenProperty; -////} -//// -////class C1 extends Base { -//// public protectedOverriddenMethod() { } -//// public protectedOverriddenProperty; -////} -//// -//// var c: C1; -//// c./*1*/ - - -goTo.marker("1"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.not.memberListContains('protectedMethod'); -verify.not.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.memberListContains('protectedOverriddenMethod'); -verify.memberListContains('protectedOverriddenProperty'); +/// + +////class Base { +//// private privateMethod() { } +//// private privateProperty; +//// +//// protected protectedMethod() { } +//// protected protectedProperty; +//// +//// public publicMethod() { } +//// public publicProperty; +//// +//// protected protectedOverriddenMethod() { } +//// protected protectedOverriddenProperty; +////} +//// +////class C1 extends Base { +//// public protectedOverriddenMethod() { } +//// public protectedOverriddenProperty; +////} +//// +//// var c: C1; +//// c./*1*/ + + +goTo.marker("1"); +verify.not.memberListContains('privateMethod'); +verify.not.memberListContains('privateProperty'); +verify.not.memberListContains('protectedMethod'); +verify.not.memberListContains('protectedProperty'); +verify.memberListContains('publicMethod'); +verify.memberListContains('publicProperty'); +verify.memberListContains('protectedOverriddenMethod'); +verify.memberListContains('protectedOverriddenProperty'); diff --git a/tests/cases/fourslash/completionListInvalidMemberNames2.ts b/tests/cases/fourslash/completionListInvalidMemberNames2.ts index cd8ff00df4..b261f71848 100644 --- a/tests/cases/fourslash/completionListInvalidMemberNames2.ts +++ b/tests/cases/fourslash/completionListInvalidMemberNames2.ts @@ -1,4 +1,4 @@ -/// +/// ////enum Foo { //// X, Y, '☆' diff --git a/tests/cases/fourslash/completionListObjectMembers.ts b/tests/cases/fourslash/completionListObjectMembers.ts index cbddba61be..5d66b31fa5 100644 --- a/tests/cases/fourslash/completionListObjectMembers.ts +++ b/tests/cases/fourslash/completionListObjectMembers.ts @@ -7,8 +7,8 @@ //// bar: any; //// foo(bar: any): any; //// }; -////object./**/ - -goTo.marker(); -verify.memberListContains("bar", '(property) bar: any'); -verify.memberListContains("foo", '(method) foo(bar: any): any'); +////object./**/ + +goTo.marker(); +verify.memberListContains("bar", '(property) bar: any'); +verify.memberListContains("foo", '(method) foo(bar: any): any'); diff --git a/tests/cases/fourslash/completionListOnPrivateVariableInModule.ts b/tests/cases/fourslash/completionListOnPrivateVariableInModule.ts index 8eeee08767..eecb5724d1 100644 --- a/tests/cases/fourslash/completionListOnPrivateVariableInModule.ts +++ b/tests/cases/fourslash/completionListOnPrivateVariableInModule.ts @@ -1,6 +1,6 @@ -/// - -//// module Foo { var testing = ""; test/**/ } - -goTo.marker(); +/// + +//// module Foo { var testing = ""; test/**/ } + +goTo.marker(); verify.completionListContains('testing', '(var) testing: string'); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListStaticProtectedMembers.ts b/tests/cases/fourslash/completionListStaticProtectedMembers.ts index af56f28ef0..d72859570a 100644 --- a/tests/cases/fourslash/completionListStaticProtectedMembers.ts +++ b/tests/cases/fourslash/completionListStaticProtectedMembers.ts @@ -1,59 +1,59 @@ -/// - -////class Base { -//// private static privateMethod() { } -//// private static privateProperty; -//// -//// protected static protectedMethod() { } -//// protected static protectedProperty; -//// -//// public static publicMethod() { } -//// public static publicProperty; -//// -//// protected static protectedOverriddenMethod() { } -//// protected static protectedOverriddenProperty; -//// -//// static test() { -//// Base./*1*/; -//// this./*2*/; -//// C1./*3*/; -//// } -////} -//// -////class C1 extends Base { -//// protected static protectedOverriddenMethod() { } -//// protected static protectedOverriddenProperty; -////} - - -// Same class, everything is visible -goTo.marker("1"); -verify.memberListContains('privateMethod'); -verify.memberListContains('privateProperty'); -verify.memberListContains('protectedMethod'); -verify.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.memberListContains('protectedOverriddenMethod'); -verify.memberListContains('protectedOverriddenProperty'); - -goTo.marker("2"); -verify.memberListContains('privateMethod'); -verify.memberListContains('privateProperty'); -verify.memberListContains('protectedMethod'); -verify.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.memberListContains('protectedOverriddenMethod'); -verify.memberListContains('protectedOverriddenProperty'); - -// Can not access protected properties overridden in subclass -goTo.marker("3"); -verify.memberListContains('privateMethod'); -verify.memberListContains('privateProperty'); -verify.memberListContains('protectedMethod'); -verify.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.not.memberListContains('protectedOverriddenMethod'); +/// + +////class Base { +//// private static privateMethod() { } +//// private static privateProperty; +//// +//// protected static protectedMethod() { } +//// protected static protectedProperty; +//// +//// public static publicMethod() { } +//// public static publicProperty; +//// +//// protected static protectedOverriddenMethod() { } +//// protected static protectedOverriddenProperty; +//// +//// static test() { +//// Base./*1*/; +//// this./*2*/; +//// C1./*3*/; +//// } +////} +//// +////class C1 extends Base { +//// protected static protectedOverriddenMethod() { } +//// protected static protectedOverriddenProperty; +////} + + +// Same class, everything is visible +goTo.marker("1"); +verify.memberListContains('privateMethod'); +verify.memberListContains('privateProperty'); +verify.memberListContains('protectedMethod'); +verify.memberListContains('protectedProperty'); +verify.memberListContains('publicMethod'); +verify.memberListContains('publicProperty'); +verify.memberListContains('protectedOverriddenMethod'); +verify.memberListContains('protectedOverriddenProperty'); + +goTo.marker("2"); +verify.memberListContains('privateMethod'); +verify.memberListContains('privateProperty'); +verify.memberListContains('protectedMethod'); +verify.memberListContains('protectedProperty'); +verify.memberListContains('publicMethod'); +verify.memberListContains('publicProperty'); +verify.memberListContains('protectedOverriddenMethod'); +verify.memberListContains('protectedOverriddenProperty'); + +// Can not access protected properties overridden in subclass +goTo.marker("3"); +verify.memberListContains('privateMethod'); +verify.memberListContains('privateProperty'); +verify.memberListContains('protectedMethod'); +verify.memberListContains('protectedProperty'); +verify.memberListContains('publicMethod'); +verify.memberListContains('publicProperty'); +verify.not.memberListContains('protectedOverriddenMethod'); verify.not.memberListContains('protectedOverriddenProperty'); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListStaticProtectedMembers2.ts b/tests/cases/fourslash/completionListStaticProtectedMembers2.ts index 9964a91d21..44cf9f73fd 100644 --- a/tests/cases/fourslash/completionListStaticProtectedMembers2.ts +++ b/tests/cases/fourslash/completionListStaticProtectedMembers2.ts @@ -1,70 +1,70 @@ -/// - -////class Base { -//// private static privateMethod() { } -//// private static privateProperty; -//// -//// protected static protectedMethod() { } -//// protected static protectedProperty; -//// -//// public static publicMethod() { } -//// public static publicProperty; -//// -//// protected static protectedOverriddenMethod() { } -//// protected static protectedOverriddenProperty; -////} -//// -////class C2 extends Base { -//// protected static protectedOverriddenMethod() { } -//// protected static protectedOverriddenProperty; -//// -//// static test() { -//// Base./*1*/; -//// C2./*2*/; -//// this./*3*/; -//// super./*4*/; -//// } -////} - - -// Same class, everything is visible -goTo.marker("1"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.memberListContains('protectedMethod'); -verify.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.memberListContains('protectedOverriddenMethod'); -verify.memberListContains('protectedOverriddenProperty'); - -goTo.marker("2"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.memberListContains('protectedMethod'); -verify.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.memberListContains('protectedOverriddenMethod'); -verify.memberListContains('protectedOverriddenProperty'); - -goTo.marker("3"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.memberListContains('protectedMethod'); -verify.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.memberListContains('protectedOverriddenMethod'); -verify.memberListContains('protectedOverriddenProperty'); - -// only public and protected methods of the base class are accessible through super -goTo.marker("4"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.memberListContains('protectedMethod'); -verify.not.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.not.memberListContains('publicProperty'); -verify.memberListContains('protectedOverriddenMethod'); +/// + +////class Base { +//// private static privateMethod() { } +//// private static privateProperty; +//// +//// protected static protectedMethod() { } +//// protected static protectedProperty; +//// +//// public static publicMethod() { } +//// public static publicProperty; +//// +//// protected static protectedOverriddenMethod() { } +//// protected static protectedOverriddenProperty; +////} +//// +////class C2 extends Base { +//// protected static protectedOverriddenMethod() { } +//// protected static protectedOverriddenProperty; +//// +//// static test() { +//// Base./*1*/; +//// C2./*2*/; +//// this./*3*/; +//// super./*4*/; +//// } +////} + + +// Same class, everything is visible +goTo.marker("1"); +verify.not.memberListContains('privateMethod'); +verify.not.memberListContains('privateProperty'); +verify.memberListContains('protectedMethod'); +verify.memberListContains('protectedProperty'); +verify.memberListContains('publicMethod'); +verify.memberListContains('publicProperty'); +verify.memberListContains('protectedOverriddenMethod'); +verify.memberListContains('protectedOverriddenProperty'); + +goTo.marker("2"); +verify.not.memberListContains('privateMethod'); +verify.not.memberListContains('privateProperty'); +verify.memberListContains('protectedMethod'); +verify.memberListContains('protectedProperty'); +verify.memberListContains('publicMethod'); +verify.memberListContains('publicProperty'); +verify.memberListContains('protectedOverriddenMethod'); +verify.memberListContains('protectedOverriddenProperty'); + +goTo.marker("3"); +verify.not.memberListContains('privateMethod'); +verify.not.memberListContains('privateProperty'); +verify.memberListContains('protectedMethod'); +verify.memberListContains('protectedProperty'); +verify.memberListContains('publicMethod'); +verify.memberListContains('publicProperty'); +verify.memberListContains('protectedOverriddenMethod'); +verify.memberListContains('protectedOverriddenProperty'); + +// only public and protected methods of the base class are accessible through super +goTo.marker("4"); +verify.not.memberListContains('privateMethod'); +verify.not.memberListContains('privateProperty'); +verify.memberListContains('protectedMethod'); +verify.not.memberListContains('protectedProperty'); +verify.memberListContains('publicMethod'); +verify.not.memberListContains('publicProperty'); +verify.memberListContains('protectedOverriddenMethod'); verify.not.memberListContains('protectedOverriddenProperty'); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListStaticProtectedMembers3.ts b/tests/cases/fourslash/completionListStaticProtectedMembers3.ts index f80186c93c..c955f23fa3 100644 --- a/tests/cases/fourslash/completionListStaticProtectedMembers3.ts +++ b/tests/cases/fourslash/completionListStaticProtectedMembers3.ts @@ -1,45 +1,45 @@ -/// - -////class Base { -//// private static privateMethod() { } -//// private static privateProperty; -//// -//// protected static protectedMethod() { } -//// protected static protectedProperty; -//// -//// public static publicMethod() { } -//// public static publicProperty; -//// -//// protected static protectedOverriddenMethod() { } -//// protected static protectedOverriddenProperty; -////} -//// -////class C3 extends Base { -//// protected static protectedOverriddenMethod() { } -//// protected static protectedOverriddenProperty; -////} -//// -////Base./*1*/; -////C3./*2*/; - - -// Only public properties are visible outside the class -goTo.marker("1"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.not.memberListContains('protectedMethod'); -verify.not.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.not.memberListContains('protectedOverriddenMethod'); -verify.not.memberListContains('protectedOverriddenProperty'); - -goTo.marker("2"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.not.memberListContains('protectedMethod'); -verify.not.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.not.memberListContains('protectedOverriddenMethod'); +/// + +////class Base { +//// private static privateMethod() { } +//// private static privateProperty; +//// +//// protected static protectedMethod() { } +//// protected static protectedProperty; +//// +//// public static publicMethod() { } +//// public static publicProperty; +//// +//// protected static protectedOverriddenMethod() { } +//// protected static protectedOverriddenProperty; +////} +//// +////class C3 extends Base { +//// protected static protectedOverriddenMethod() { } +//// protected static protectedOverriddenProperty; +////} +//// +////Base./*1*/; +////C3./*2*/; + + +// Only public properties are visible outside the class +goTo.marker("1"); +verify.not.memberListContains('privateMethod'); +verify.not.memberListContains('privateProperty'); +verify.not.memberListContains('protectedMethod'); +verify.not.memberListContains('protectedProperty'); +verify.memberListContains('publicMethod'); +verify.memberListContains('publicProperty'); +verify.not.memberListContains('protectedOverriddenMethod'); +verify.not.memberListContains('protectedOverriddenProperty'); + +goTo.marker("2"); +verify.not.memberListContains('privateMethod'); +verify.not.memberListContains('privateProperty'); +verify.not.memberListContains('protectedMethod'); +verify.not.memberListContains('protectedProperty'); +verify.memberListContains('publicMethod'); +verify.memberListContains('publicProperty'); +verify.not.memberListContains('protectedOverriddenMethod'); verify.not.memberListContains('protectedOverriddenProperty'); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListStaticProtectedMembers4.ts b/tests/cases/fourslash/completionListStaticProtectedMembers4.ts index 72cc081f2f..817d2c4829 100644 --- a/tests/cases/fourslash/completionListStaticProtectedMembers4.ts +++ b/tests/cases/fourslash/completionListStaticProtectedMembers4.ts @@ -1,49 +1,49 @@ -/// - -////class Base { -//// private static privateMethod() { } -//// private static privateProperty; -//// -//// protected static protectedMethod() { } -//// protected static protectedProperty; -//// -//// public static publicMethod() { } -//// public static publicProperty; -//// -//// protected static protectedOverriddenMethod() { } -//// protected static protectedOverriddenProperty; -////} -//// -/////// Make the protected members public -////class C4 extends Base { -//// public static protectedOverriddenMethod() { } -//// public static protectedOverriddenProperty; -////} -////class Derived extends C4 { -//// test() { -//// Derived./*1*/ -//// } -////} -//// Derived./*2*/ - -// Sub class, everything but private is visible -goTo.marker("1"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.memberListContains('protectedMethod'); -verify.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.memberListContains('protectedOverriddenMethod'); -verify.memberListContains('protectedOverriddenProperty'); - -// Can see protected methods elevated to public -goTo.marker("2"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.not.memberListContains('protectedMethod'); -verify.not.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.memberListContains('protectedOverriddenMethod'); -verify.memberListContains('protectedOverriddenProperty'); +/// + +////class Base { +//// private static privateMethod() { } +//// private static privateProperty; +//// +//// protected static protectedMethod() { } +//// protected static protectedProperty; +//// +//// public static publicMethod() { } +//// public static publicProperty; +//// +//// protected static protectedOverriddenMethod() { } +//// protected static protectedOverriddenProperty; +////} +//// +/////// Make the protected members public +////class C4 extends Base { +//// public static protectedOverriddenMethod() { } +//// public static protectedOverriddenProperty; +////} +////class Derived extends C4 { +//// test() { +//// Derived./*1*/ +//// } +////} +//// Derived./*2*/ + +// Sub class, everything but private is visible +goTo.marker("1"); +verify.not.memberListContains('privateMethod'); +verify.not.memberListContains('privateProperty'); +verify.memberListContains('protectedMethod'); +verify.memberListContains('protectedProperty'); +verify.memberListContains('publicMethod'); +verify.memberListContains('publicProperty'); +verify.memberListContains('protectedOverriddenMethod'); +verify.memberListContains('protectedOverriddenProperty'); + +// Can see protected methods elevated to public +goTo.marker("2"); +verify.not.memberListContains('privateMethod'); +verify.not.memberListContains('privateProperty'); +verify.not.memberListContains('protectedMethod'); +verify.not.memberListContains('protectedProperty'); +verify.memberListContains('publicMethod'); +verify.memberListContains('publicProperty'); +verify.memberListContains('protectedOverriddenMethod'); +verify.memberListContains('protectedOverriddenProperty'); diff --git a/tests/cases/fourslash/completionListWithAmbientDeclaration.ts b/tests/cases/fourslash/completionListWithAmbientDeclaration.ts index afb5d96fbb..7cfac28fb2 100644 --- a/tests/cases/fourslash/completionListWithAmbientDeclaration.ts +++ b/tests/cases/fourslash/completionListWithAmbientDeclaration.ts @@ -1,15 +1,15 @@ -/// - -//// declare module "http" { -//// var x; -//// /*1*/ -//// } -//// declare module 'https' { -//// } -//// /*2*/ - -goTo.marker("1"); -verify.not.completionListContains("http"); -goTo.marker("2"); -verify.not.completionListContains("http"); -verify.not.completionListContains("https"); +/// + +//// declare module "http" { +//// var x; +//// /*1*/ +//// } +//// declare module 'https' { +//// } +//// /*2*/ + +goTo.marker("1"); +verify.not.completionListContains("http"); +goTo.marker("2"); +verify.not.completionListContains("http"); +verify.not.completionListContains("https"); diff --git a/tests/cases/fourslash/completionListWithModulesFromModule.ts b/tests/cases/fourslash/completionListWithModulesFromModule.ts index a8d99a4785..96610b203a 100644 --- a/tests/cases/fourslash/completionListWithModulesFromModule.ts +++ b/tests/cases/fourslash/completionListWithModulesFromModule.ts @@ -1,326 +1,326 @@ -/// - -////module mod1 { -//// var mod1var = 1; -//// function mod1fn() { -//// var bar = 1; -//// function foob() { } -//// } -//// class mod1cls { -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// interface mod1int { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// } -//// module mod1mod { -//// var m1X = 1; -//// function m1Func() { -//// var bar = 1; -//// function foob() { } -//// } -//// class m1Class { -//// private cVar = 1; -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// interface m1Int { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// } -//// export var m1eX = 1; -//// export function m1eFunc() { -//// } -//// export class m1eClass { -//// private cVar = 1; -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// export interface m1eInt { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// } -//// module m1Mod { } -//// export module m1eMod { } -//// } -//// export var mod1evar = 1; -//// export function mod1efn() { -//// var bar = 1; -//// function foob() { } -//// } -//// export class mod1ecls { -//// private cVar = 1; -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// export interface mod1eint { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// } -//// export module mod1emod { -//// var mX = 1; -//// function mFunc() { -//// var bar = 1; -//// function foob() { } -//// } -//// class mClass { -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// interface mInt { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// } -//// export var meX = 1; -//// export function meFunc() { -//// } -//// export class meClass { -//// private cVar = 1; -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// export interface meInt { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// } -//// module mMod { } -//// export module meMod { } -//// } -////} -//// -////// EXTENDING MODULE 1 -////module mod1 { -//// export var mod1eexvar = 1; -//// var mod1exvar = 2; -////} -//// -////module mod2 { -//// var mod2var = "shadow"; -//// function mod2fn() { -//// var bar = 1; -//// function foob() { } -//// } -//// class mod2cls { -//// private cVar = 1; -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// module mod2mod { } -//// interface mod2int { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// } -//// export var mod2evar = 1; -//// export function mod2efn() { -//// } -//// export class mod2ecls { -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// export interface mod2eint { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// } -//// export module mod2emod { } -////} -//// -////module mod2 { -//// export var mod2eexvar = 1; -////} -//// -////module mod3 { -//// var shwvar = "shadow"; -//// function shwfn(shadow: any) { -//// var bar = 1; -//// function foob() { } -//// } -//// class shwcls { -//// constructor(public shadow: any) { } -//// private cVar = 1; -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// interface shwint { -//// (bar: any): any; -//// new (bar: any): any; -//// sivar: string; -//// sifn(shadow: any): any; -//// } -//// /*shadowModuleWithNoExport*/ -////} -//// -////module mod4 { -//// export var shwvar = "shadow"; -//// export function shwfn(shadow: any) { -//// var bar = 1; -//// function foob(){ } -//// } -//// export class shwcls { -//// constructor(shadow: any) { } -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// export interface shwint { -//// (bar: any): any; -//// new (bar: any): any; -//// sivar: string; -//// sifn(shadow: any): any; -//// } -//// /*shadowModuleWithExport*/ -////} -//// -////module mod5 { -//// import Mod1 = mod1; -//// import iMod1 = mod1.mod1emod; -//// /*moduleWithImport*/ -////} -//// -////function shwfn() { -//// var sfvar = 1; -//// function sffn() { } -////} -//// -////class shwcls { -//// private scvar = 1; -//// private scfn() { } -//// public scpfn() { } -//// public scpvar = 1; -//// static scsvar = 1; -//// static scsfn() { } -////} -//// -////interface shwint { -//// (bar: any): any; -//// new (bar: any): any; -//// sivar: any; -//// sifn(bar: any): any; -////} -//// -////var shwvar = 1; - -function sharedNegativeVerify() -{ - verify.not.completionListContains('sfvar'); - verify.not.completionListContains('sffn'); - verify.not.completionListContains('scvar'); - verify.not.completionListContains('scfn'); - verify.not.completionListContains('scpfn'); - verify.not.completionListContains('scpvar'); - verify.not.completionListContains('scsvar'); - verify.not.completionListContains('scsfn'); - verify.not.completionListContains('sivar'); - verify.not.completionListContains('sifn'); - verify.not.completionListContains('mod1exvar'); - verify.not.completionListContains('mod2eexvar'); -} - -function goToMarkAndVerifyShadow() -{ - sharedNegativeVerify(); - verify.not.completionListContains('mod2var'); - verify.not.completionListContains('mod2fn'); - verify.not.completionListContains('mod2cls'); - verify.not.completionListContains('mod2int'); - verify.not.completionListContains('mod2mod'); - verify.not.completionListContains('mod2evar'); - verify.not.completionListContains('mod2efn'); - verify.not.completionListContains('mod2ecls'); - verify.not.completionListContains('mod2eint'); - verify.not.completionListContains('mod2emod'); -} - -// from a shadow module with no export -goTo.marker('shadowModuleWithNoExport'); -verify.completionListContains('shwvar', '(var) shwvar: string'); -verify.completionListContains('shwfn', '(function) shwfn(shadow: any): void'); -verify.completionListContains('shwcls', 'class shwcls'); -verify.completionListContains('shwint', 'interface shwint'); -goToMarkAndVerifyShadow(); - -// from a shadow module with export -goTo.marker('shadowModuleWithExport'); -verify.completionListContains('shwvar', '(var) mod4.shwvar: string'); -verify.completionListContains('shwfn', '(function) mod4.shwfn(shadow: any): void'); -verify.completionListContains('shwcls', 'class mod4.shwcls'); -verify.completionListContains('shwint', 'interface mod4.shwint'); -goToMarkAndVerifyShadow(); - -// from a modlue with import -goTo.marker('moduleWithImport'); -verify.completionListContains('mod1', 'module mod1'); -verify.completionListContains('mod2', 'module mod2'); -verify.completionListContains('mod3', 'module mod3'); -verify.completionListContains('shwvar', '(var) shwvar: number'); -verify.completionListContains('shwfn', '(function) shwfn(): void'); -verify.completionListContains('shwcls', 'class shwcls'); -verify.completionListContains('shwint', 'interface shwint'); - -sharedNegativeVerify(); - -verify.not.completionListContains('mod1var'); -verify.not.completionListContains('mod1fn'); -verify.not.completionListContains('mod1cls'); -verify.not.completionListContains('mod1int'); -verify.not.completionListContains('mod1mod'); -verify.not.completionListContains('mod1evar'); -verify.not.completionListContains('mod1efn'); -verify.not.completionListContains('mod1ecls'); -verify.not.completionListContains('mod1eint'); -verify.not.completionListContains('mod1emod'); -verify.not.completionListContains('mX'); -verify.not.completionListContains('mFunc'); -verify.not.completionListContains('mClass'); -verify.not.completionListContains('mInt'); -verify.not.completionListContains('mMod'); -verify.not.completionListContains('meX'); -verify.not.completionListContains('meFunc'); -verify.not.completionListContains('meClass'); -verify.not.completionListContains('meInt'); +/// + +////module mod1 { +//// var mod1var = 1; +//// function mod1fn() { +//// var bar = 1; +//// function foob() { } +//// } +//// class mod1cls { +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// interface mod1int { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// } +//// module mod1mod { +//// var m1X = 1; +//// function m1Func() { +//// var bar = 1; +//// function foob() { } +//// } +//// class m1Class { +//// private cVar = 1; +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// interface m1Int { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// } +//// export var m1eX = 1; +//// export function m1eFunc() { +//// } +//// export class m1eClass { +//// private cVar = 1; +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// export interface m1eInt { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// } +//// module m1Mod { } +//// export module m1eMod { } +//// } +//// export var mod1evar = 1; +//// export function mod1efn() { +//// var bar = 1; +//// function foob() { } +//// } +//// export class mod1ecls { +//// private cVar = 1; +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// export interface mod1eint { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// } +//// export module mod1emod { +//// var mX = 1; +//// function mFunc() { +//// var bar = 1; +//// function foob() { } +//// } +//// class mClass { +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// interface mInt { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// } +//// export var meX = 1; +//// export function meFunc() { +//// } +//// export class meClass { +//// private cVar = 1; +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// export interface meInt { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// } +//// module mMod { } +//// export module meMod { } +//// } +////} +//// +////// EXTENDING MODULE 1 +////module mod1 { +//// export var mod1eexvar = 1; +//// var mod1exvar = 2; +////} +//// +////module mod2 { +//// var mod2var = "shadow"; +//// function mod2fn() { +//// var bar = 1; +//// function foob() { } +//// } +//// class mod2cls { +//// private cVar = 1; +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// module mod2mod { } +//// interface mod2int { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// } +//// export var mod2evar = 1; +//// export function mod2efn() { +//// } +//// export class mod2ecls { +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// export interface mod2eint { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// } +//// export module mod2emod { } +////} +//// +////module mod2 { +//// export var mod2eexvar = 1; +////} +//// +////module mod3 { +//// var shwvar = "shadow"; +//// function shwfn(shadow: any) { +//// var bar = 1; +//// function foob() { } +//// } +//// class shwcls { +//// constructor(public shadow: any) { } +//// private cVar = 1; +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// interface shwint { +//// (bar: any): any; +//// new (bar: any): any; +//// sivar: string; +//// sifn(shadow: any): any; +//// } +//// /*shadowModuleWithNoExport*/ +////} +//// +////module mod4 { +//// export var shwvar = "shadow"; +//// export function shwfn(shadow: any) { +//// var bar = 1; +//// function foob(){ } +//// } +//// export class shwcls { +//// constructor(shadow: any) { } +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// export interface shwint { +//// (bar: any): any; +//// new (bar: any): any; +//// sivar: string; +//// sifn(shadow: any): any; +//// } +//// /*shadowModuleWithExport*/ +////} +//// +////module mod5 { +//// import Mod1 = mod1; +//// import iMod1 = mod1.mod1emod; +//// /*moduleWithImport*/ +////} +//// +////function shwfn() { +//// var sfvar = 1; +//// function sffn() { } +////} +//// +////class shwcls { +//// private scvar = 1; +//// private scfn() { } +//// public scpfn() { } +//// public scpvar = 1; +//// static scsvar = 1; +//// static scsfn() { } +////} +//// +////interface shwint { +//// (bar: any): any; +//// new (bar: any): any; +//// sivar: any; +//// sifn(bar: any): any; +////} +//// +////var shwvar = 1; + +function sharedNegativeVerify() +{ + verify.not.completionListContains('sfvar'); + verify.not.completionListContains('sffn'); + verify.not.completionListContains('scvar'); + verify.not.completionListContains('scfn'); + verify.not.completionListContains('scpfn'); + verify.not.completionListContains('scpvar'); + verify.not.completionListContains('scsvar'); + verify.not.completionListContains('scsfn'); + verify.not.completionListContains('sivar'); + verify.not.completionListContains('sifn'); + verify.not.completionListContains('mod1exvar'); + verify.not.completionListContains('mod2eexvar'); +} + +function goToMarkAndVerifyShadow() +{ + sharedNegativeVerify(); + verify.not.completionListContains('mod2var'); + verify.not.completionListContains('mod2fn'); + verify.not.completionListContains('mod2cls'); + verify.not.completionListContains('mod2int'); + verify.not.completionListContains('mod2mod'); + verify.not.completionListContains('mod2evar'); + verify.not.completionListContains('mod2efn'); + verify.not.completionListContains('mod2ecls'); + verify.not.completionListContains('mod2eint'); + verify.not.completionListContains('mod2emod'); +} + +// from a shadow module with no export +goTo.marker('shadowModuleWithNoExport'); +verify.completionListContains('shwvar', '(var) shwvar: string'); +verify.completionListContains('shwfn', '(function) shwfn(shadow: any): void'); +verify.completionListContains('shwcls', 'class shwcls'); +verify.completionListContains('shwint', 'interface shwint'); +goToMarkAndVerifyShadow(); + +// from a shadow module with export +goTo.marker('shadowModuleWithExport'); +verify.completionListContains('shwvar', '(var) mod4.shwvar: string'); +verify.completionListContains('shwfn', '(function) mod4.shwfn(shadow: any): void'); +verify.completionListContains('shwcls', 'class mod4.shwcls'); +verify.completionListContains('shwint', 'interface mod4.shwint'); +goToMarkAndVerifyShadow(); + +// from a modlue with import +goTo.marker('moduleWithImport'); +verify.completionListContains('mod1', 'module mod1'); +verify.completionListContains('mod2', 'module mod2'); +verify.completionListContains('mod3', 'module mod3'); +verify.completionListContains('shwvar', '(var) shwvar: number'); +verify.completionListContains('shwfn', '(function) shwfn(): void'); +verify.completionListContains('shwcls', 'class shwcls'); +verify.completionListContains('shwint', 'interface shwint'); + +sharedNegativeVerify(); + +verify.not.completionListContains('mod1var'); +verify.not.completionListContains('mod1fn'); +verify.not.completionListContains('mod1cls'); +verify.not.completionListContains('mod1int'); +verify.not.completionListContains('mod1mod'); +verify.not.completionListContains('mod1evar'); +verify.not.completionListContains('mod1efn'); +verify.not.completionListContains('mod1ecls'); +verify.not.completionListContains('mod1eint'); +verify.not.completionListContains('mod1emod'); +verify.not.completionListContains('mX'); +verify.not.completionListContains('mFunc'); +verify.not.completionListContains('mClass'); +verify.not.completionListContains('mInt'); +verify.not.completionListContains('mMod'); +verify.not.completionListContains('meX'); +verify.not.completionListContains('meFunc'); +verify.not.completionListContains('meClass'); +verify.not.completionListContains('meInt'); verify.not.completionListContains('meMod'); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListWithModulesInsideModuleScope.ts b/tests/cases/fourslash/completionListWithModulesInsideModuleScope.ts index 920ba03026..49180cb95d 100644 --- a/tests/cases/fourslash/completionListWithModulesInsideModuleScope.ts +++ b/tests/cases/fourslash/completionListWithModulesInsideModuleScope.ts @@ -1,364 +1,364 @@ -/// - -////module mod1 { -//// var mod1var = 1; -//// function mod1fn() { -//// var bar = 1; -//// function foob() { } -//// /*function*/ -//// } -//// class mod1cls { -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// /*class*/ -//// } -//// interface mod1int { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// /*interface*/ -//// } -//// module mod1mod { -//// var m1X = 1; -//// function m1Func() { -//// var bar = 1; -//// function foob() { } -//// } -//// class m1Class { -//// private cVar = 1; -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// interface m1Int { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// } -//// export var m1eX = 1; -//// export function m1eFunc() { -//// } -//// export class m1eClass { -//// private cVar = 1; -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// export interface m1eInt { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// } -//// module m1Mod { } -//// export module m1eMod { } -//// /*module*/ -//// } -//// export var mod1evar = 1; -//// export function mod1efn() { -//// var bar = 1; -//// function foob() { } -//// /*exportedFunction*/ -//// } -//// export class mod1ecls { -//// private cVar = 1; -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// /*exportedClass*/ -//// } -//// export interface mod1eint { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// /*exportedInterface*/ -//// } -//// export module mod1emod { -//// var mX = 1; -//// function mFunc() { -//// var bar = 1; -//// function foob() { } -//// } -//// class mClass { -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// interface mInt { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// } -//// export var meX = 1; -//// export function meFunc() { -//// } -//// export class meClass { -//// private cVar = 1; -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// export interface meInt { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// } -//// module mMod { } -//// export module meMod { } -//// /*exportedModule*/ -//// } -//// /*mod1*/ -////} -//// -////// EXTENDING MODULE 1 -////module mod1 { -//// export var mod1eexvar = 1; -//// var mod1exvar = 2; -//// /*extendedModule*/ -////} -//// -////module mod2 { -//// var mod2var = "shadow"; -//// function mod2fn() { -//// var bar = 1; -//// function foob() { } -//// } -//// class mod2cls { -//// private cVar = 1; -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// module mod2mod { } -//// interface mod2int { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// } -//// export var mod2evar = 1; -//// export function mod2efn() { -//// } -//// export class mod2ecls { -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// export interface mod2eint { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// } -//// export module mod2emod { } -////} -//// -////module mod2 { -//// export var mod2eexvar = 1; -////} -//// -////module mod3 { -//// var shwvar = "shadow"; -//// function shwfn() { -//// var bar = 1; -//// function foob() { } -//// } -//// class shwcls { -//// constructor(public shadow: any) { } -//// private cVar = 1; -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// interface shwint { -//// (bar: any): any; -//// new (bar: any): any; -//// sivar: string; -//// sifn(shadow: any): any; -//// } -////} -//// -////function shwfn() { -//// var sfvar = 1; -//// function sffn() { } -////} -//// -////class shwcls { -//// private scvar = 1; -//// private scfn() { } -//// public scpfn() { } -//// public scpvar = 1; -//// static scsvar = 1; -//// static scsfn() { } -////} -//// -////interface shwint { -//// (bar: any): any; -//// new (bar: any): any; -//// sivar: any; -//// sifn(bar: any): any; -////} -//// -////var shwvar = 1; - -function goToMarkAndGeneralVerify(marker: string) -{ - goTo.marker(marker); - - verify.completionListContains('mod1var', '(var) mod1var: number'); - verify.completionListContains('mod1fn', '(function) mod1fn(): void'); - verify.completionListContains('mod1cls', 'class mod1cls'); - verify.completionListContains('mod1int', 'interface mod1int'); - verify.completionListContains('mod1mod', 'module mod1mod'); - verify.completionListContains('mod1evar', '(var) mod1.mod1evar: number'); - verify.completionListContains('mod1efn', '(function) mod1.mod1efn(): void'); - verify.completionListContains('mod1ecls', 'class mod1.mod1ecls'); - verify.completionListContains('mod1eint', 'interface mod1.mod1eint'); - verify.completionListContains('mod1emod', 'module mod1.mod1emod'); - verify.completionListContains('mod1eexvar', '(var) mod1.mod1eexvar: number'); - verify.completionListContains('mod2', 'module mod2'); - verify.completionListContains('mod3', 'module mod3'); - verify.completionListContains('shwvar', '(var) shwvar: number'); - verify.completionListContains('shwfn', '(function) shwfn(): void'); - verify.completionListContains('shwcls', 'class shwcls'); - verify.completionListContains('shwint', 'interface shwint'); - - verify.not.completionListContains('mod2var'); - verify.not.completionListContains('mod2fn'); - verify.not.completionListContains('mod2cls'); - verify.not.completionListContains('mod2int'); - verify.not.completionListContains('mod2mod'); - verify.not.completionListContains('mod2evar'); - verify.not.completionListContains('mod2efn'); - verify.not.completionListContains('mod2ecls'); - verify.not.completionListContains('mod2eint'); - verify.not.completionListContains('mod2emod'); - verify.not.completionListContains('sfvar'); - verify.not.completionListContains('sffn'); - verify.not.completionListContains('scvar'); - verify.not.completionListContains('scfn'); - verify.not.completionListContains('scpfn'); - verify.not.completionListContains('scpvar'); - verify.not.completionListContains('scsvar'); - verify.not.completionListContains('scsfn'); - verify.not.completionListContains('sivar'); - verify.not.completionListContains('sifn'); - verify.not.completionListContains('mod1exvar'); - verify.not.completionListContains('mod2eexvar'); -} - -// from mod1 -goToMarkAndGeneralVerify('mod1'); - -// from function in mod1 -goToMarkAndGeneralVerify('function'); -verify.completionListContains('bar', '(local var) bar: number'); -verify.completionListContains('foob', '(local function) foob(): void'); - -// from class in mod1 -goToMarkAndGeneralVerify('class'); -//verify.not.completionListContains('ceFunc'); -//verify.not.completionListContains('ceVar'); - -// from interface in mod1 -goToMarkAndGeneralVerify('interface'); - -// from module in mod1 -goToMarkAndGeneralVerify('module'); -verify.completionListContains('m1X', '(var) m1X: number'); -verify.completionListContains('m1Func', '(function) m1Func(): void'); -verify.completionListContains('m1Class', 'class m1Class'); -verify.completionListContains('m1Int', 'interface m1Int'); -verify.completionListContains('m1Mod', 'module m1Mod'); -verify.completionListContains('m1eX', '(var) mod1mod.m1eX: number'); -verify.completionListContains('m1eFunc', '(function) mod1mod.m1eFunc(): void'); -verify.completionListContains('m1eClass', 'class mod1mod.m1eClass'); -verify.completionListContains('m1eInt', 'interface mod1mod.m1eInt'); -verify.completionListContains('m1eMod', 'module mod1mod.m1eMod'); - -// from exported function in mod1 -goToMarkAndGeneralVerify('exportedFunction'); -verify.completionListContains('bar', '(local var) bar: number'); -verify.completionListContains('foob', '(local function) foob(): void'); - -// from exported class in mod1 -goToMarkAndGeneralVerify('exportedClass'); -//verify.not.completionListContains('ceFunc'); -//verify.not.completionListContains('ceVar'); - -// from exported interface in mod1 -goToMarkAndGeneralVerify('exportedInterface'); - -// from exported module in mod1 -goToMarkAndGeneralVerify('exportedModule'); -verify.completionListContains('mX', '(var) mX: number'); -verify.completionListContains('mFunc', '(function) mFunc(): void'); -verify.completionListContains('mClass', 'class mClass'); -verify.completionListContains('mInt', 'interface mInt'); -verify.completionListContains('mMod', 'module mMod'); -verify.completionListContains('meX', '(var) mod1.mod1emod.meX: number'); -verify.completionListContains('meFunc', '(function) mod1.mod1emod.meFunc(): void'); -verify.completionListContains('meClass', 'class mod1.mod1emod.meClass'); -verify.completionListContains('meInt', 'interface mod1.mod1emod.meInt'); -verify.completionListContains('meMod', 'module mod1.mod1emod.meMod'); - -// from extended module -goTo.marker('extendedModule'); -verify.completionListContains('mod1evar', '(var) mod1.mod1evar: number'); -verify.completionListContains('mod1efn', '(function) mod1.mod1efn(): void'); -verify.completionListContains('mod1ecls', 'class mod1.mod1ecls'); -verify.completionListContains('mod1eint', 'interface mod1.mod1eint'); -verify.completionListContains('mod1emod', 'module mod1.mod1emod'); -verify.completionListContains('mod1eexvar', '(var) mod1.mod1eexvar: number'); -verify.completionListContains('mod2', 'module mod2'); -verify.completionListContains('mod3', 'module mod3'); -verify.completionListContains('shwvar', '(var) shwvar: number'); -verify.completionListContains('shwfn', '(function) shwfn(): void'); -verify.completionListContains('shwcls', 'class shwcls'); -verify.completionListContains('shwint', 'interface shwint'); - -verify.not.completionListContains('mod2var'); -verify.not.completionListContains('mod2fn'); -verify.not.completionListContains('mod2cls'); -verify.not.completionListContains('mod2int'); -verify.not.completionListContains('mod2mod'); -verify.not.completionListContains('mod2evar'); -verify.not.completionListContains('mod2efn'); -verify.not.completionListContains('mod2ecls'); -verify.not.completionListContains('mod2eint'); -verify.not.completionListContains('mod2emod'); -verify.not.completionListContains('sfvar'); -verify.not.completionListContains('sffn'); -verify.not.completionListContains('scvar'); -verify.not.completionListContains('scfn'); -verify.not.completionListContains('scpfn'); -verify.not.completionListContains('scpvar'); -verify.not.completionListContains('scsvar'); -verify.not.completionListContains('scsfn'); -verify.not.completionListContains('sivar'); -verify.not.completionListContains('sifn'); +/// + +////module mod1 { +//// var mod1var = 1; +//// function mod1fn() { +//// var bar = 1; +//// function foob() { } +//// /*function*/ +//// } +//// class mod1cls { +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// /*class*/ +//// } +//// interface mod1int { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// /*interface*/ +//// } +//// module mod1mod { +//// var m1X = 1; +//// function m1Func() { +//// var bar = 1; +//// function foob() { } +//// } +//// class m1Class { +//// private cVar = 1; +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// interface m1Int { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// } +//// export var m1eX = 1; +//// export function m1eFunc() { +//// } +//// export class m1eClass { +//// private cVar = 1; +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// export interface m1eInt { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// } +//// module m1Mod { } +//// export module m1eMod { } +//// /*module*/ +//// } +//// export var mod1evar = 1; +//// export function mod1efn() { +//// var bar = 1; +//// function foob() { } +//// /*exportedFunction*/ +//// } +//// export class mod1ecls { +//// private cVar = 1; +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// /*exportedClass*/ +//// } +//// export interface mod1eint { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// /*exportedInterface*/ +//// } +//// export module mod1emod { +//// var mX = 1; +//// function mFunc() { +//// var bar = 1; +//// function foob() { } +//// } +//// class mClass { +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// interface mInt { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// } +//// export var meX = 1; +//// export function meFunc() { +//// } +//// export class meClass { +//// private cVar = 1; +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// export interface meInt { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// } +//// module mMod { } +//// export module meMod { } +//// /*exportedModule*/ +//// } +//// /*mod1*/ +////} +//// +////// EXTENDING MODULE 1 +////module mod1 { +//// export var mod1eexvar = 1; +//// var mod1exvar = 2; +//// /*extendedModule*/ +////} +//// +////module mod2 { +//// var mod2var = "shadow"; +//// function mod2fn() { +//// var bar = 1; +//// function foob() { } +//// } +//// class mod2cls { +//// private cVar = 1; +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// module mod2mod { } +//// interface mod2int { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// } +//// export var mod2evar = 1; +//// export function mod2efn() { +//// } +//// export class mod2ecls { +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// export interface mod2eint { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// } +//// export module mod2emod { } +////} +//// +////module mod2 { +//// export var mod2eexvar = 1; +////} +//// +////module mod3 { +//// var shwvar = "shadow"; +//// function shwfn() { +//// var bar = 1; +//// function foob() { } +//// } +//// class shwcls { +//// constructor(public shadow: any) { } +//// private cVar = 1; +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// interface shwint { +//// (bar: any): any; +//// new (bar: any): any; +//// sivar: string; +//// sifn(shadow: any): any; +//// } +////} +//// +////function shwfn() { +//// var sfvar = 1; +//// function sffn() { } +////} +//// +////class shwcls { +//// private scvar = 1; +//// private scfn() { } +//// public scpfn() { } +//// public scpvar = 1; +//// static scsvar = 1; +//// static scsfn() { } +////} +//// +////interface shwint { +//// (bar: any): any; +//// new (bar: any): any; +//// sivar: any; +//// sifn(bar: any): any; +////} +//// +////var shwvar = 1; + +function goToMarkAndGeneralVerify(marker: string) +{ + goTo.marker(marker); + + verify.completionListContains('mod1var', '(var) mod1var: number'); + verify.completionListContains('mod1fn', '(function) mod1fn(): void'); + verify.completionListContains('mod1cls', 'class mod1cls'); + verify.completionListContains('mod1int', 'interface mod1int'); + verify.completionListContains('mod1mod', 'module mod1mod'); + verify.completionListContains('mod1evar', '(var) mod1.mod1evar: number'); + verify.completionListContains('mod1efn', '(function) mod1.mod1efn(): void'); + verify.completionListContains('mod1ecls', 'class mod1.mod1ecls'); + verify.completionListContains('mod1eint', 'interface mod1.mod1eint'); + verify.completionListContains('mod1emod', 'module mod1.mod1emod'); + verify.completionListContains('mod1eexvar', '(var) mod1.mod1eexvar: number'); + verify.completionListContains('mod2', 'module mod2'); + verify.completionListContains('mod3', 'module mod3'); + verify.completionListContains('shwvar', '(var) shwvar: number'); + verify.completionListContains('shwfn', '(function) shwfn(): void'); + verify.completionListContains('shwcls', 'class shwcls'); + verify.completionListContains('shwint', 'interface shwint'); + + verify.not.completionListContains('mod2var'); + verify.not.completionListContains('mod2fn'); + verify.not.completionListContains('mod2cls'); + verify.not.completionListContains('mod2int'); + verify.not.completionListContains('mod2mod'); + verify.not.completionListContains('mod2evar'); + verify.not.completionListContains('mod2efn'); + verify.not.completionListContains('mod2ecls'); + verify.not.completionListContains('mod2eint'); + verify.not.completionListContains('mod2emod'); + verify.not.completionListContains('sfvar'); + verify.not.completionListContains('sffn'); + verify.not.completionListContains('scvar'); + verify.not.completionListContains('scfn'); + verify.not.completionListContains('scpfn'); + verify.not.completionListContains('scpvar'); + verify.not.completionListContains('scsvar'); + verify.not.completionListContains('scsfn'); + verify.not.completionListContains('sivar'); + verify.not.completionListContains('sifn'); + verify.not.completionListContains('mod1exvar'); + verify.not.completionListContains('mod2eexvar'); +} + +// from mod1 +goToMarkAndGeneralVerify('mod1'); + +// from function in mod1 +goToMarkAndGeneralVerify('function'); +verify.completionListContains('bar', '(local var) bar: number'); +verify.completionListContains('foob', '(local function) foob(): void'); + +// from class in mod1 +goToMarkAndGeneralVerify('class'); +//verify.not.completionListContains('ceFunc'); +//verify.not.completionListContains('ceVar'); + +// from interface in mod1 +goToMarkAndGeneralVerify('interface'); + +// from module in mod1 +goToMarkAndGeneralVerify('module'); +verify.completionListContains('m1X', '(var) m1X: number'); +verify.completionListContains('m1Func', '(function) m1Func(): void'); +verify.completionListContains('m1Class', 'class m1Class'); +verify.completionListContains('m1Int', 'interface m1Int'); +verify.completionListContains('m1Mod', 'module m1Mod'); +verify.completionListContains('m1eX', '(var) mod1mod.m1eX: number'); +verify.completionListContains('m1eFunc', '(function) mod1mod.m1eFunc(): void'); +verify.completionListContains('m1eClass', 'class mod1mod.m1eClass'); +verify.completionListContains('m1eInt', 'interface mod1mod.m1eInt'); +verify.completionListContains('m1eMod', 'module mod1mod.m1eMod'); + +// from exported function in mod1 +goToMarkAndGeneralVerify('exportedFunction'); +verify.completionListContains('bar', '(local var) bar: number'); +verify.completionListContains('foob', '(local function) foob(): void'); + +// from exported class in mod1 +goToMarkAndGeneralVerify('exportedClass'); +//verify.not.completionListContains('ceFunc'); +//verify.not.completionListContains('ceVar'); + +// from exported interface in mod1 +goToMarkAndGeneralVerify('exportedInterface'); + +// from exported module in mod1 +goToMarkAndGeneralVerify('exportedModule'); +verify.completionListContains('mX', '(var) mX: number'); +verify.completionListContains('mFunc', '(function) mFunc(): void'); +verify.completionListContains('mClass', 'class mClass'); +verify.completionListContains('mInt', 'interface mInt'); +verify.completionListContains('mMod', 'module mMod'); +verify.completionListContains('meX', '(var) mod1.mod1emod.meX: number'); +verify.completionListContains('meFunc', '(function) mod1.mod1emod.meFunc(): void'); +verify.completionListContains('meClass', 'class mod1.mod1emod.meClass'); +verify.completionListContains('meInt', 'interface mod1.mod1emod.meInt'); +verify.completionListContains('meMod', 'module mod1.mod1emod.meMod'); + +// from extended module +goTo.marker('extendedModule'); +verify.completionListContains('mod1evar', '(var) mod1.mod1evar: number'); +verify.completionListContains('mod1efn', '(function) mod1.mod1efn(): void'); +verify.completionListContains('mod1ecls', 'class mod1.mod1ecls'); +verify.completionListContains('mod1eint', 'interface mod1.mod1eint'); +verify.completionListContains('mod1emod', 'module mod1.mod1emod'); +verify.completionListContains('mod1eexvar', '(var) mod1.mod1eexvar: number'); +verify.completionListContains('mod2', 'module mod2'); +verify.completionListContains('mod3', 'module mod3'); +verify.completionListContains('shwvar', '(var) shwvar: number'); +verify.completionListContains('shwfn', '(function) shwfn(): void'); +verify.completionListContains('shwcls', 'class shwcls'); +verify.completionListContains('shwint', 'interface shwint'); + +verify.not.completionListContains('mod2var'); +verify.not.completionListContains('mod2fn'); +verify.not.completionListContains('mod2cls'); +verify.not.completionListContains('mod2int'); +verify.not.completionListContains('mod2mod'); +verify.not.completionListContains('mod2evar'); +verify.not.completionListContains('mod2efn'); +verify.not.completionListContains('mod2ecls'); +verify.not.completionListContains('mod2eint'); +verify.not.completionListContains('mod2emod'); +verify.not.completionListContains('sfvar'); +verify.not.completionListContains('sffn'); +verify.not.completionListContains('scvar'); +verify.not.completionListContains('scfn'); +verify.not.completionListContains('scpfn'); +verify.not.completionListContains('scpvar'); +verify.not.completionListContains('scsvar'); +verify.not.completionListContains('scsfn'); +verify.not.completionListContains('sivar'); +verify.not.completionListContains('sifn'); verify.not.completionListContains('mod2eexvar'); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListWithModulesOutsideModuleScope.ts b/tests/cases/fourslash/completionListWithModulesOutsideModuleScope.ts index 43314b45d7..b228b244fe 100644 --- a/tests/cases/fourslash/completionListWithModulesOutsideModuleScope.ts +++ b/tests/cases/fourslash/completionListWithModulesOutsideModuleScope.ts @@ -1,291 +1,291 @@ -/// - -////module mod1 { -//// var mod1var = 1; -//// function mod1fn() { -//// var bar = 1; -//// function foob() { } -//// } -//// class mod1cls { -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// interface mod1int { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// } -//// module mod1mod { -//// var m1X = 1; -//// function m1Func() { -//// var bar = 1; -//// function foob() { } -//// } -//// class m1Class { -//// private cVar = 1; -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// interface m1Int { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// } -//// export var m1eX = 1; -//// export function m1eFunc() { -//// } -//// export class m1eClass { -//// private cVar = 1; -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// export interface m1eInt { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// } -//// module m1Mod { } -//// export module m1eMod { } -//// } -//// export var mod1evar = 1; -//// export function mod1efn() { -//// var bar = 1; -//// function foob() { } -//// } -//// export class mod1ecls { -//// private cVar = 1; -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// export interface mod1eint { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// } -//// export module mod1emod { -//// var mX = 1; -//// function mFunc() { -//// var bar = 1; -//// function foob() { } -//// } -//// class mClass { -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// interface mInt { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// } -//// export var meX = 1; -//// export function meFunc() { -//// } -//// export class meClass { -//// private cVar = 1; -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// export interface meInt { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// } -//// module mMod { } -//// export module meMod { } -//// } -////} -//// -////// EXTENDING MODULE 1 -////module mod1 { -//// export var mod1eexvar = 1; -//// var mod1exvar = 2; -////} -//// -////module mod2 { -//// var mod2var = "shadow"; -//// function mod2fn() { -//// var bar = 1; -//// function foob() { } -//// } -//// class mod2cls { -//// private cVar = 1; -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// module mod2mod { } -//// interface mod2int { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// } -//// export var mod2evar = 1; -//// export function mod2efn() { -//// } -//// export class mod2ecls { -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// export interface mod2eint { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// } -//// export module mod2emod { } -////} -//// -////module mod2 { -//// export var mod2eexvar = 1; -////} -//// -////module mod3 { -//// var shwvar = "shadow"; -//// function shwfn() { -//// var bar = 1; -//// function foob() { } -//// } -//// class shwcls { -//// constructor(public shadow: any) { } -//// private cVar = 1; -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// interface shwint { -//// (bar: any): any; -//// new (bar: any): any; -//// sivar: string; -//// sifn(shadow: any): any; -//// } -////} -//// -////function shwfn() { -//// var sfvar = 1; -//// function sffn() { } -//// /*function*/ -////} -//// -////class shwcls { -//// private scvar = 1; -//// private scfn() { } -//// public scpfn() { } -//// public scpvar = 1; -//// static scsvar = 1; -//// static scsfn() { } -//// /*class*/ -////} -//// -////interface shwint { -//// (bar: any): any; -//// new (bar: any): any; -//// sivar: any; -//// sifn(bar: any): any; -//// /*interface*/ -////} -//// -////var shwvar = 1; -/////*global*/ - -function verifyNotContainFunctionMembers() -{ - verify.not.completionListContains('sfvar'); - verify.not.completionListContains('sffn'); -} - -function verifyNotContainClassMembers() -{ - verify.not.completionListContains('scvar'); - verify.not.completionListContains('scfn'); - verify.not.completionListContains('scpfn'); - verify.not.completionListContains('scpvar'); - verify.not.completionListContains('scsvar'); - verify.not.completionListContains('scsfn'); -} - -function verifyNotContainInterfaceMembers() -{ - verify.not.completionListContains('sivar'); - verify.not.completionListContains('sifn'); -} - -function goToMarkAndGeneralVerify(marker: string) -{ - goTo.marker(marker); - - verify.not.completionListContains('mod1var'); - verify.not.completionListContains('mod1fn'); - verify.not.completionListContains('mod1cls'); - verify.not.completionListContains('mod1int'); - verify.not.completionListContains('mod1mod'); - verify.not.completionListContains('mod1evar'); - verify.not.completionListContains('mod1efn'); - verify.not.completionListContains('mod1ecls'); - verify.not.completionListContains('mod1eint'); - verify.not.completionListContains('mod1emod'); - verify.not.completionListContains('mod1eexvar'); -} - -// from global scope -goToMarkAndGeneralVerify('global'); -verify.completionListContains('mod1', 'module mod1'); -verify.completionListContains('mod2', 'module mod2'); -verify.completionListContains('mod3', 'module mod3'); -verify.completionListContains('shwvar', '(var) shwvar: number'); -verify.completionListContains('shwfn', '(function) shwfn(): void'); -verify.completionListContains('shwcls', 'class shwcls'); -verify.completionListContains('shwint', 'interface shwint'); - -verifyNotContainFunctionMembers(); -verifyNotContainClassMembers(); -verifyNotContainInterfaceMembers(); - -// from function scope -goToMarkAndGeneralVerify('function'); -verify.completionListContains('sfvar', '(local var) sfvar: number'); -verify.completionListContains('sffn', '(local function) sffn(): void'); - -verifyNotContainClassMembers(); -verifyNotContainInterfaceMembers(); - -// from class scope -goToMarkAndGeneralVerify('class'); -verifyNotContainFunctionMembers(); -verifyNotContainInterfaceMembers(); - -// from interface scope -goToMarkAndGeneralVerify('interface'); -verifyNotContainClassMembers(); +/// + +////module mod1 { +//// var mod1var = 1; +//// function mod1fn() { +//// var bar = 1; +//// function foob() { } +//// } +//// class mod1cls { +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// interface mod1int { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// } +//// module mod1mod { +//// var m1X = 1; +//// function m1Func() { +//// var bar = 1; +//// function foob() { } +//// } +//// class m1Class { +//// private cVar = 1; +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// interface m1Int { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// } +//// export var m1eX = 1; +//// export function m1eFunc() { +//// } +//// export class m1eClass { +//// private cVar = 1; +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// export interface m1eInt { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// } +//// module m1Mod { } +//// export module m1eMod { } +//// } +//// export var mod1evar = 1; +//// export function mod1efn() { +//// var bar = 1; +//// function foob() { } +//// } +//// export class mod1ecls { +//// private cVar = 1; +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// export interface mod1eint { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// } +//// export module mod1emod { +//// var mX = 1; +//// function mFunc() { +//// var bar = 1; +//// function foob() { } +//// } +//// class mClass { +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// interface mInt { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// } +//// export var meX = 1; +//// export function meFunc() { +//// } +//// export class meClass { +//// private cVar = 1; +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// export interface meInt { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// } +//// module mMod { } +//// export module meMod { } +//// } +////} +//// +////// EXTENDING MODULE 1 +////module mod1 { +//// export var mod1eexvar = 1; +//// var mod1exvar = 2; +////} +//// +////module mod2 { +//// var mod2var = "shadow"; +//// function mod2fn() { +//// var bar = 1; +//// function foob() { } +//// } +//// class mod2cls { +//// private cVar = 1; +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// module mod2mod { } +//// interface mod2int { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// } +//// export var mod2evar = 1; +//// export function mod2efn() { +//// } +//// export class mod2ecls { +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// export interface mod2eint { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// } +//// export module mod2emod { } +////} +//// +////module mod2 { +//// export var mod2eexvar = 1; +////} +//// +////module mod3 { +//// var shwvar = "shadow"; +//// function shwfn() { +//// var bar = 1; +//// function foob() { } +//// } +//// class shwcls { +//// constructor(public shadow: any) { } +//// private cVar = 1; +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// interface shwint { +//// (bar: any): any; +//// new (bar: any): any; +//// sivar: string; +//// sifn(shadow: any): any; +//// } +////} +//// +////function shwfn() { +//// var sfvar = 1; +//// function sffn() { } +//// /*function*/ +////} +//// +////class shwcls { +//// private scvar = 1; +//// private scfn() { } +//// public scpfn() { } +//// public scpvar = 1; +//// static scsvar = 1; +//// static scsfn() { } +//// /*class*/ +////} +//// +////interface shwint { +//// (bar: any): any; +//// new (bar: any): any; +//// sivar: any; +//// sifn(bar: any): any; +//// /*interface*/ +////} +//// +////var shwvar = 1; +/////*global*/ + +function verifyNotContainFunctionMembers() +{ + verify.not.completionListContains('sfvar'); + verify.not.completionListContains('sffn'); +} + +function verifyNotContainClassMembers() +{ + verify.not.completionListContains('scvar'); + verify.not.completionListContains('scfn'); + verify.not.completionListContains('scpfn'); + verify.not.completionListContains('scpvar'); + verify.not.completionListContains('scsvar'); + verify.not.completionListContains('scsfn'); +} + +function verifyNotContainInterfaceMembers() +{ + verify.not.completionListContains('sivar'); + verify.not.completionListContains('sifn'); +} + +function goToMarkAndGeneralVerify(marker: string) +{ + goTo.marker(marker); + + verify.not.completionListContains('mod1var'); + verify.not.completionListContains('mod1fn'); + verify.not.completionListContains('mod1cls'); + verify.not.completionListContains('mod1int'); + verify.not.completionListContains('mod1mod'); + verify.not.completionListContains('mod1evar'); + verify.not.completionListContains('mod1efn'); + verify.not.completionListContains('mod1ecls'); + verify.not.completionListContains('mod1eint'); + verify.not.completionListContains('mod1emod'); + verify.not.completionListContains('mod1eexvar'); +} + +// from global scope +goToMarkAndGeneralVerify('global'); +verify.completionListContains('mod1', 'module mod1'); +verify.completionListContains('mod2', 'module mod2'); +verify.completionListContains('mod3', 'module mod3'); +verify.completionListContains('shwvar', '(var) shwvar: number'); +verify.completionListContains('shwfn', '(function) shwfn(): void'); +verify.completionListContains('shwcls', 'class shwcls'); +verify.completionListContains('shwint', 'interface shwint'); + +verifyNotContainFunctionMembers(); +verifyNotContainClassMembers(); +verifyNotContainInterfaceMembers(); + +// from function scope +goToMarkAndGeneralVerify('function'); +verify.completionListContains('sfvar', '(local var) sfvar: number'); +verify.completionListContains('sffn', '(local function) sffn(): void'); + +verifyNotContainClassMembers(); +verifyNotContainInterfaceMembers(); + +// from class scope +goToMarkAndGeneralVerify('class'); +verifyNotContainFunctionMembers(); +verifyNotContainInterfaceMembers(); + +// from interface scope +goToMarkAndGeneralVerify('interface'); +verifyNotContainClassMembers(); verifyNotContainFunctionMembers(); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListWithModulesOutsideModuleScope2.ts b/tests/cases/fourslash/completionListWithModulesOutsideModuleScope2.ts index 04bf7bf26d..aed914657a 100644 --- a/tests/cases/fourslash/completionListWithModulesOutsideModuleScope2.ts +++ b/tests/cases/fourslash/completionListWithModulesOutsideModuleScope2.ts @@ -1,275 +1,275 @@ -/// - -////module mod1 { -//// var mod1var = 1; -//// function mod1fn() { -//// var bar = 1; -//// function foob() { } -//// } -//// class mod1cls { -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// interface mod1int { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// } -//// module mod1mod { -//// var m1X = 1; -//// function m1Func() { -//// var bar = 1; -//// function foob() { } -//// } -//// class m1Class { -//// private cVar = 1; -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// interface m1Int { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// } -//// export var m1eX = 1; -//// export function m1eFunc() { -//// } -//// export class m1eClass { -//// private cVar = 1; -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// export interface m1eInt { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// } -//// module m1Mod { } -//// export module m1eMod { } -//// } -//// export var mod1evar = 1; -//// export function mod1efn() { -//// var bar = 1; -//// function foob() { } -//// } -//// export class mod1ecls { -//// private cVar = 1; -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// export interface mod1eint { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// } -//// export module mod1emod { -//// var mX = 1; -//// function mFunc() { -//// var bar = 1; -//// function foob() { } -//// } -//// class mClass { -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// interface mInt { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// } -//// export var meX = 1; -//// export function meFunc() { -//// } -//// export class meClass { -//// private cVar = 1; -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// export interface meInt { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// } -//// module mMod { } -//// export module meMod { } -//// } -////} -//// -////// EXTENDING MODULE 1 -////module mod1 { -//// export var mod1eexvar = 1; -//// var mod1exvar = 2; -////} -//// -////module mod2 { -//// var mod2var = "shadow"; -//// function mod2fn() { -//// var bar = 1; -//// function foob() { } -//// } -//// class mod2cls { -//// private cVar = 1; -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// module mod2mod { } -//// interface mod2int { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// } -//// export var mod2evar = 1; -//// export function mod2efn() { -//// } -//// export class mod2ecls { -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// export interface mod2eint { -//// (bar: any): any; -//// new (bar: any): any; -//// bar: any; -//// foob(bar: any): any; -//// } -//// export module mod2emod { } -////} -//// -////module mod2 { -//// export var mod2eexvar = 1; -////} -//// -////module mod3 { -//// var shwvar = "shadow"; -//// function shwfn() { -//// var bar = 1; -//// function foob() { } -//// } -//// class shwcls { -//// constructor(public shadow: any) { } -//// private cVar = 1; -//// public cFunc() { } -//// public ceFunc() { } -//// public ceVar = 1; -//// static csVar = 1; -//// static csFunc() { } -//// } -//// interface shwint { -//// (bar: any): any; -//// new (bar: any): any; -//// sivar: string; -//// sifn(shadow: any): any; -//// } -////} -//// -////function shwfn() { -//// var sfvar = 1; -//// function sffn() { } -////} -//// -////class shwcls { -//// private scvar = 1; -//// private scfn() { } -//// public scpfn() { } -//// public scpvar = 1; -//// static scsvar = 1; -//// static scsfn() { } -////} -//// -////interface shwint { -//// (bar: any): any; -//// new (bar: any): any; -//// sivar: any; -//// sifn(bar: any): any; -////} -//// -////var shwvar = 1; -//// -////class extCls extends shwcls { -//// /*extendedClass*/ -////} -//// -////function shwFnTest() { -//// function shwFnTest { -//// -//// } -//// var shwvar = "1"; -//// /*localVar*/ -////} -//// -////var obj = { -//// x: /*objectLiteral*/ -////} - -function goToMarkerAndVerify(marker: string) -{ - goTo.marker(marker); - - verify.completionListContains('mod1'); - verify.completionListContains('mod2'); - verify.completionListContains('mod3'); - verify.completionListContains('shwvar', '(var) shwvar: number'); - verify.completionListContains('shwfn', '(function) shwfn(): void'); - verify.completionListContains('shwcls', 'class shwcls'); - verify.completionListContains('shwint', 'interface shwint'); - - verify.not.completionListContains('mod2var'); - verify.not.completionListContains('mod2fn'); - verify.not.completionListContains('mod2cls'); - verify.not.completionListContains('mod2int'); - verify.not.completionListContains('mod2mod'); - verify.not.completionListContains('mod2evar'); - verify.not.completionListContains('mod2efn'); - verify.not.completionListContains('mod2ecls'); - verify.not.completionListContains('mod2eint'); - verify.not.completionListContains('mod2emod'); - verify.not.completionListContains('sfvar'); - verify.not.completionListContains('sffn'); - verify.not.completionListContains('scvar'); - verify.not.completionListContains('scfn'); - verify.not.completionListContains('scpfn'); - verify.not.completionListContains('scpvar'); - verify.not.completionListContains('scsvar'); - verify.not.completionListContains('scsfn'); - verify.not.completionListContains('sivar'); - verify.not.completionListContains('sifn'); - verify.not.completionListContains('mod1exvar'); - verify.not.completionListContains('mod2eexvar'); -} - -goToMarkerAndVerify('extendedClass'); - -goToMarkerAndVerify('objectLiteral'); - -goTo.marker('localVar'); +/// + +////module mod1 { +//// var mod1var = 1; +//// function mod1fn() { +//// var bar = 1; +//// function foob() { } +//// } +//// class mod1cls { +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// interface mod1int { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// } +//// module mod1mod { +//// var m1X = 1; +//// function m1Func() { +//// var bar = 1; +//// function foob() { } +//// } +//// class m1Class { +//// private cVar = 1; +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// interface m1Int { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// } +//// export var m1eX = 1; +//// export function m1eFunc() { +//// } +//// export class m1eClass { +//// private cVar = 1; +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// export interface m1eInt { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// } +//// module m1Mod { } +//// export module m1eMod { } +//// } +//// export var mod1evar = 1; +//// export function mod1efn() { +//// var bar = 1; +//// function foob() { } +//// } +//// export class mod1ecls { +//// private cVar = 1; +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// export interface mod1eint { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// } +//// export module mod1emod { +//// var mX = 1; +//// function mFunc() { +//// var bar = 1; +//// function foob() { } +//// } +//// class mClass { +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// interface mInt { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// } +//// export var meX = 1; +//// export function meFunc() { +//// } +//// export class meClass { +//// private cVar = 1; +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// export interface meInt { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// } +//// module mMod { } +//// export module meMod { } +//// } +////} +//// +////// EXTENDING MODULE 1 +////module mod1 { +//// export var mod1eexvar = 1; +//// var mod1exvar = 2; +////} +//// +////module mod2 { +//// var mod2var = "shadow"; +//// function mod2fn() { +//// var bar = 1; +//// function foob() { } +//// } +//// class mod2cls { +//// private cVar = 1; +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// module mod2mod { } +//// interface mod2int { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// } +//// export var mod2evar = 1; +//// export function mod2efn() { +//// } +//// export class mod2ecls { +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// export interface mod2eint { +//// (bar: any): any; +//// new (bar: any): any; +//// bar: any; +//// foob(bar: any): any; +//// } +//// export module mod2emod { } +////} +//// +////module mod2 { +//// export var mod2eexvar = 1; +////} +//// +////module mod3 { +//// var shwvar = "shadow"; +//// function shwfn() { +//// var bar = 1; +//// function foob() { } +//// } +//// class shwcls { +//// constructor(public shadow: any) { } +//// private cVar = 1; +//// public cFunc() { } +//// public ceFunc() { } +//// public ceVar = 1; +//// static csVar = 1; +//// static csFunc() { } +//// } +//// interface shwint { +//// (bar: any): any; +//// new (bar: any): any; +//// sivar: string; +//// sifn(shadow: any): any; +//// } +////} +//// +////function shwfn() { +//// var sfvar = 1; +//// function sffn() { } +////} +//// +////class shwcls { +//// private scvar = 1; +//// private scfn() { } +//// public scpfn() { } +//// public scpvar = 1; +//// static scsvar = 1; +//// static scsfn() { } +////} +//// +////interface shwint { +//// (bar: any): any; +//// new (bar: any): any; +//// sivar: any; +//// sifn(bar: any): any; +////} +//// +////var shwvar = 1; +//// +////class extCls extends shwcls { +//// /*extendedClass*/ +////} +//// +////function shwFnTest() { +//// function shwFnTest { +//// +//// } +//// var shwvar = "1"; +//// /*localVar*/ +////} +//// +////var obj = { +//// x: /*objectLiteral*/ +////} + +function goToMarkerAndVerify(marker: string) +{ + goTo.marker(marker); + + verify.completionListContains('mod1'); + verify.completionListContains('mod2'); + verify.completionListContains('mod3'); + verify.completionListContains('shwvar', '(var) shwvar: number'); + verify.completionListContains('shwfn', '(function) shwfn(): void'); + verify.completionListContains('shwcls', 'class shwcls'); + verify.completionListContains('shwint', 'interface shwint'); + + verify.not.completionListContains('mod2var'); + verify.not.completionListContains('mod2fn'); + verify.not.completionListContains('mod2cls'); + verify.not.completionListContains('mod2int'); + verify.not.completionListContains('mod2mod'); + verify.not.completionListContains('mod2evar'); + verify.not.completionListContains('mod2efn'); + verify.not.completionListContains('mod2ecls'); + verify.not.completionListContains('mod2eint'); + verify.not.completionListContains('mod2emod'); + verify.not.completionListContains('sfvar'); + verify.not.completionListContains('sffn'); + verify.not.completionListContains('scvar'); + verify.not.completionListContains('scfn'); + verify.not.completionListContains('scpfn'); + verify.not.completionListContains('scpvar'); + verify.not.completionListContains('scsvar'); + verify.not.completionListContains('scsfn'); + verify.not.completionListContains('sivar'); + verify.not.completionListContains('sifn'); + verify.not.completionListContains('mod1exvar'); + verify.not.completionListContains('mod2eexvar'); +} + +goToMarkerAndVerify('extendedClass'); + +goToMarkerAndVerify('objectLiteral'); + +goTo.marker('localVar'); verify.completionListContains('shwvar', '(local var) shwvar: string'); \ No newline at end of file diff --git a/tests/cases/fourslash/consistenceOnIndentionsOfChainedFunctionCalls.ts b/tests/cases/fourslash/consistenceOnIndentionsOfChainedFunctionCalls.ts index 693f9698da..ec2ae9b3c2 100644 --- a/tests/cases/fourslash/consistenceOnIndentionsOfChainedFunctionCalls.ts +++ b/tests/cases/fourslash/consistenceOnIndentionsOfChainedFunctionCalls.ts @@ -1,21 +1,21 @@ -/// - -////interface ig { -//// module(data): ig; -//// requires(data): ig; -//// defines(data): ig; -////} -//// -////var ig: ig; -////ig.module( -//// 'mything' -////).requires( -//// 'otherstuff' -////).defines(/*0*//*1*/ -////}); - -goTo.marker("1"); -edit.insert("\r\n"); -goTo.marker("0"); -// Won't-fixed: Smart indent during chained function calls +/// + +////interface ig { +//// module(data): ig; +//// requires(data): ig; +//// defines(data): ig; +////} +//// +////var ig: ig; +////ig.module( +//// 'mything' +////).requires( +//// 'otherstuff' +////).defines(/*0*//*1*/ +////}); + +goTo.marker("1"); +edit.insert("\r\n"); +goTo.marker("0"); +// Won't-fixed: Smart indent during chained function calls verify.indentationIs(4); \ No newline at end of file diff --git a/tests/cases/fourslash/consistenceOnIndentionsOfObjectsInAListAfterFormatting.ts b/tests/cases/fourslash/consistenceOnIndentionsOfObjectsInAListAfterFormatting.ts index 310f91915d..14ada20602 100644 --- a/tests/cases/fourslash/consistenceOnIndentionsOfObjectsInAListAfterFormatting.ts +++ b/tests/cases/fourslash/consistenceOnIndentionsOfObjectsInAListAfterFormatting.ts @@ -1,11 +1,11 @@ -/// - -////foo({ -////}, {/*1*/ -////});/*2*/ - -format.document(); -goTo.marker("1"); -verify.currentLineContentIs("}, {"); -goTo.marker("2"); +/// + +////foo({ +////}, {/*1*/ +////});/*2*/ + +format.document(); +goTo.marker("1"); +verify.currentLineContentIs("}, {"); +goTo.marker("2"); verify.currentLineContentIs(" });"); \ No newline at end of file diff --git a/tests/cases/fourslash/consistentContextualTypeErrorsAfterEdits.ts b/tests/cases/fourslash/consistentContextualTypeErrorsAfterEdits.ts index 7e434c6bb8..03024ce002 100644 --- a/tests/cases/fourslash/consistentContextualTypeErrorsAfterEdits.ts +++ b/tests/cases/fourslash/consistentContextualTypeErrorsAfterEdits.ts @@ -1,5 +1,5 @@ -/// - +/// + //// class A { //// foo: string; //// } diff --git a/tests/cases/fourslash/contextualTypingGenericFunction1.ts b/tests/cases/fourslash/contextualTypingGenericFunction1.ts index c7e409820d..0216f713cf 100644 --- a/tests/cases/fourslash/contextualTypingGenericFunction1.ts +++ b/tests/cases/fourslash/contextualTypingGenericFunction1.ts @@ -4,10 +4,10 @@ ////var obj: { f(x: T): T } = { f: (/*1*/x) => x }; ////var obj2: (x: T) => T = (/*2*/x) => x; //// -////class C { -//// obj: (x: T) => T -////} -////var c = new C(); +////class C { +//// obj: (x: T) => T +////} +////var c = new C(); ////c.obj = (/*3*/x) => x; goTo.marker('1'); diff --git a/tests/cases/fourslash/definition.ts b/tests/cases/fourslash/definition.ts index 531e456284..f403965fe1 100644 --- a/tests/cases/fourslash/definition.ts +++ b/tests/cases/fourslash/definition.ts @@ -1,4 +1,4 @@ -/// +/// // @Filename: b.ts ////import n = require('a/*1*/'); diff --git a/tests/cases/fourslash/deleteExtensionInReopenedInterface.ts b/tests/cases/fourslash/deleteExtensionInReopenedInterface.ts index 13c3498e71..1fd0a99e0a 100644 --- a/tests/cases/fourslash/deleteExtensionInReopenedInterface.ts +++ b/tests/cases/fourslash/deleteExtensionInReopenedInterface.ts @@ -1,24 +1,24 @@ -/// - -//// interface A { a: number; } -//// interface B { b: number; } -//// -//// interface I /*del*/extends A { } -//// interface I extends B { } -//// -//// var i: I; -//// class C /*delImplements*/implements A { } -//// var c: C; -//// c.a; - -goTo.marker('del'); -edit.deleteAtCaret('extends A'.length); - -goTo.eof(); -edit.insert("var a = i.a;"); - -goTo.marker('delImplements'); -edit.deleteAtCaret('implements A'.length); - -goTo.marker('del'); +/// + +//// interface A { a: number; } +//// interface B { b: number; } +//// +//// interface I /*del*/extends A { } +//// interface I extends B { } +//// +//// var i: I; +//// class C /*delImplements*/implements A { } +//// var c: C; +//// c.a; + +goTo.marker('del'); +edit.deleteAtCaret('extends A'.length); + +goTo.eof(); +edit.insert("var a = i.a;"); + +goTo.marker('delImplements'); +edit.deleteAtCaret('implements A'.length); + +goTo.marker('del'); edit.insert('extends A'); \ No newline at end of file diff --git a/tests/cases/fourslash/deleteModifierBeforeVarStatement1.ts b/tests/cases/fourslash/deleteModifierBeforeVarStatement1.ts index 803d6bf66c..a929e67687 100644 --- a/tests/cases/fourslash/deleteModifierBeforeVarStatement1.ts +++ b/tests/cases/fourslash/deleteModifierBeforeVarStatement1.ts @@ -1,64 +1,64 @@ -/// - -//// -//// -//// ///////////////////////////// -//// /// Windows Script Host APIS -//// ///////////////////////////// -//// -//// declare var ActiveXObject: { new (s: string): any; }; -//// -//// interface ITextWriter { -//// WriteLine(s): void; -//// } -//// -//// declare var WScript: { -//// Echo(s): void; -//// StdErr: ITextWriter; -//// Arguments: { length: number; Item(): string; }; -//// ScriptFullName: string; -//// Quit(): number; -//// } -//// - - -goTo.file(0); - -// : -// : |--- go here -// 1: -// 2: -goTo.position(0); - -// : -// : |--- delete "\n\n///..." -// 1: -// 2: -debugger; -edit.deleteAtCaret(100); - - -// 12: -// : |--- go here -// 13: declare var WScript: { -// 14: Echo(s): void; -goTo.position(198); - -// 12: -// : |--- delete "declare..." -// 13: declare var WScript: { -// 14: Echo(s): void; -edit.deleteAtCaret(16); - - -// 9: StdErr: ITextWriter; -// : |--- go here -// 10: Arguments: { length: number; Item(): string; }; -// 11: ScriptFullName: string; -goTo.position(198); - -// 9: StdErr: ITextWriter; -// : |--- insert "Item(): string; " -// 10: Arguments: { length: number; Item(): string; }; -// 11: ScriptFullName: string; -edit.insert("Item(): string; "); +/// + +//// +//// +//// ///////////////////////////// +//// /// Windows Script Host APIS +//// ///////////////////////////// +//// +//// declare var ActiveXObject: { new (s: string): any; }; +//// +//// interface ITextWriter { +//// WriteLine(s): void; +//// } +//// +//// declare var WScript: { +//// Echo(s): void; +//// StdErr: ITextWriter; +//// Arguments: { length: number; Item(): string; }; +//// ScriptFullName: string; +//// Quit(): number; +//// } +//// + + +goTo.file(0); + +// : +// : |--- go here +// 1: +// 2: +goTo.position(0); + +// : +// : |--- delete "\n\n///..." +// 1: +// 2: +debugger; +edit.deleteAtCaret(100); + + +// 12: +// : |--- go here +// 13: declare var WScript: { +// 14: Echo(s): void; +goTo.position(198); + +// 12: +// : |--- delete "declare..." +// 13: declare var WScript: { +// 14: Echo(s): void; +edit.deleteAtCaret(16); + + +// 9: StdErr: ITextWriter; +// : |--- go here +// 10: Arguments: { length: number; Item(): string; }; +// 11: ScriptFullName: string; +goTo.position(198); + +// 9: StdErr: ITextWriter; +// : |--- insert "Item(): string; " +// 10: Arguments: { length: number; Item(): string; }; +// 11: ScriptFullName: string; +edit.insert("Item(): string; "); diff --git a/tests/cases/fourslash/deleteTypeParameter.ts b/tests/cases/fourslash/deleteTypeParameter.ts index c3d2236813..4c70d61580 100644 --- a/tests/cases/fourslash/deleteTypeParameter.ts +++ b/tests/cases/fourslash/deleteTypeParameter.ts @@ -9,6 +9,6 @@ //// var q1: Query; //// var q2: Query2; //// q1 = q2; - -goTo.marker(); -edit.deleteAtCaret(1); + +goTo.marker(); +edit.deleteAtCaret(1); diff --git a/tests/cases/fourslash/duplicateClassModuleError0.ts b/tests/cases/fourslash/duplicateClassModuleError0.ts index e133ba70e9..a6d63ba527 100644 --- a/tests/cases/fourslash/duplicateClassModuleError0.ts +++ b/tests/cases/fourslash/duplicateClassModuleError0.ts @@ -1,25 +1,25 @@ -/// - -//// module A -//// { -//// class B -//// { -//// public Hello(): string -//// { -//// return "from private B"; -//// } -//// } -//// } -//// -//// module A -//// { -//// /*1*/ -//// } - -edit.disableFormatting(); - -goTo.marker("1"); - -edit.insert(" export class B\n {\n public Hello(): string\n {\n return \"from export B\";\n }\n }\n"); - -edit.insert("\n"); +/// + +//// module A +//// { +//// class B +//// { +//// public Hello(): string +//// { +//// return "from private B"; +//// } +//// } +//// } +//// +//// module A +//// { +//// /*1*/ +//// } + +edit.disableFormatting(); + +goTo.marker("1"); + +edit.insert(" export class B\n {\n public Hello(): string\n {\n return \"from export B\";\n }\n }\n"); + +edit.insert("\n"); diff --git a/tests/cases/fourslash/duplicateTypeParameters.ts b/tests/cases/fourslash/duplicateTypeParameters.ts index 40b0441606..a7cdebe115 100644 --- a/tests/cases/fourslash/duplicateTypeParameters.ts +++ b/tests/cases/fourslash/duplicateTypeParameters.ts @@ -1,7 +1,7 @@ -/// - +/// + //// class A { } - -goTo.marker(); -verify.quickInfoExists(); - + +goTo.marker(); +verify.quickInfoExists(); + diff --git a/tests/cases/fourslash/eval.ts b/tests/cases/fourslash/eval.ts index e9ee90b768..db1077a0b1 100644 --- a/tests/cases/fourslash/eval.ts +++ b/tests/cases/fourslash/eval.ts @@ -1,14 +1,14 @@ -/// - -////class SomeObj { -//// public n = 5; -//// -//// public getCallback() { -//// return () => this.n; -//// } -////} -//// -////var x = new SomeObj(); -////var y = x.getCallback()(); - -verify.eval('y', 5); +/// + +////class SomeObj { +//// public n = 5; +//// +//// public getCallback() { +//// return () => this.n; +//// } +////} +//// +////var x = new SomeObj(); +////var y = x.getCallback()(); + +verify.eval('y', 5); diff --git a/tests/cases/fourslash/exportClauseErrorReporting0.ts b/tests/cases/fourslash/exportClauseErrorReporting0.ts index 75490500d8..a931c3ff13 100644 --- a/tests/cases/fourslash/exportClauseErrorReporting0.ts +++ b/tests/cases/fourslash/exportClauseErrorReporting0.ts @@ -1,16 +1,16 @@ -/// - -//// module M { -//// /*1*/class C { } -//// } -//// -//// var x = new M.C(); -//// - -edit.disableFormatting(); - -goTo.marker("1"); -edit.insert("export "); -goTo.marker("1"); - -edit.deleteAtCaret(8); +/// + +//// module M { +//// /*1*/class C { } +//// } +//// +//// var x = new M.C(); +//// + +edit.disableFormatting(); + +goTo.marker("1"); +edit.insert("export "); +goTo.marker("1"); + +edit.deleteAtCaret(8); diff --git a/tests/cases/fourslash/failureToImplementClass.ts b/tests/cases/fourslash/failureToImplementClass.ts index d6942f8711..345a8d9411 100644 --- a/tests/cases/fourslash/failureToImplementClass.ts +++ b/tests/cases/fourslash/failureToImplementClass.ts @@ -1,9 +1,9 @@ -/// - -////interface IExec { -//// exec: (filename: string, cmdLine: string) => boolean; -////} -////class /*1*/NodeExec/*2*/ implements IExec { } - -verify.errorExistsBetweenMarkers("1", "2"); +/// + +////interface IExec { +//// exec: (filename: string, cmdLine: string) => boolean; +////} +////class /*1*/NodeExec/*2*/ implements IExec { } + +verify.errorExistsBetweenMarkers("1", "2"); verify.numberOfErrorsInCurrentFile(1); \ No newline at end of file diff --git a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames7.ts b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames7.ts index 76adc714b2..afcaf625ed 100644 --- a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames7.ts +++ b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames7.ts @@ -1,4 +1,4 @@ -/// +/// ////function [|__foo|]() { //// [|__foo|](); diff --git a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames8.ts b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames8.ts index d25d6335f2..08ed341436 100644 --- a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames8.ts +++ b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames8.ts @@ -1,4 +1,4 @@ -/// +/// ////(function [|__foo|]() { //// [|__foo|](); diff --git a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames9.ts b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames9.ts index 295344d23f..a3923783c4 100644 --- a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames9.ts +++ b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames9.ts @@ -1,4 +1,4 @@ -/// +/// ////(function [|___foo|]() { //// [|___foo|](); diff --git a/tests/cases/fourslash/formatArrayOrObjectLiteralsInVariableList.ts b/tests/cases/fourslash/formatArrayOrObjectLiteralsInVariableList.ts index 8de0a6a245..40ad89c420 100644 --- a/tests/cases/fourslash/formatArrayOrObjectLiteralsInVariableList.ts +++ b/tests/cases/fourslash/formatArrayOrObjectLiteralsInVariableList.ts @@ -1,7 +1,7 @@ -/// - -////var v30 = [1, 2], v31, v32, v33 = [0], v34 = {'a': true}, v35;/**/ - -format.document(); -goTo.marker(""); +/// + +////var v30 = [1, 2], v31, v32, v33 = [0], v34 = {'a': true}, v35;/**/ + +format.document(); +goTo.marker(""); verify.currentLineContentIs("var v30 = [1, 2], v31, v32, v33 = [0], v34 = { 'a': true }, v35;"); \ No newline at end of file diff --git a/tests/cases/fourslash/formatColonAndQMark.ts b/tests/cases/fourslash/formatColonAndQMark.ts index 4a2b956ee1..856c994111 100644 --- a/tests/cases/fourslash/formatColonAndQMark.ts +++ b/tests/cases/fourslash/formatColonAndQMark.ts @@ -1,16 +1,16 @@ -/// - -////class foo {/*1*/ -//// constructor (n?: number, m = 5, o?: string) { }/*2*/ -//// x:number = 1?2:3;/*3*/ -////}/*4*/ - -format.document(); -goTo.marker("1"); -verify.currentLineContentIs("class foo {"); -goTo.marker("2"); -verify.currentLineContentIs(" constructor(n?: number, m = 5, o?: string) { }"); -goTo.marker("3"); -verify.currentLineContentIs(" x: number = 1 ? 2 : 3;"); -goTo.marker("4"); +/// + +////class foo {/*1*/ +//// constructor (n?: number, m = 5, o?: string) { }/*2*/ +//// x:number = 1?2:3;/*3*/ +////}/*4*/ + +format.document(); +goTo.marker("1"); +verify.currentLineContentIs("class foo {"); +goTo.marker("2"); +verify.currentLineContentIs(" constructor(n?: number, m = 5, o?: string) { }"); +goTo.marker("3"); +verify.currentLineContentIs(" x: number = 1 ? 2 : 3;"); +goTo.marker("4"); verify.currentLineContentIs("}"); \ No newline at end of file diff --git a/tests/cases/fourslash/formatControlFlowConstructs.ts b/tests/cases/fourslash/formatControlFlowConstructs.ts index 853df75115..001a708c64 100644 --- a/tests/cases/fourslash/formatControlFlowConstructs.ts +++ b/tests/cases/fourslash/formatControlFlowConstructs.ts @@ -1,9 +1,9 @@ -/// +/// ////if (true)/**/ ////{ -////} - -format.document(); -goTo.marker(); +////} + +format.document(); +goTo.marker(); verify.currentLineContentIs("if (true) {"); \ No newline at end of file diff --git a/tests/cases/fourslash/formatDebuggerStatement.ts b/tests/cases/fourslash/formatDebuggerStatement.ts index 82175ef3f9..f91359f76f 100644 --- a/tests/cases/fourslash/formatDebuggerStatement.ts +++ b/tests/cases/fourslash/formatDebuggerStatement.ts @@ -1,10 +1,10 @@ -/// - -////if(false){debugger;} -//// if ( false ) { debugger ; } - -format.document(); -goTo.bof(); -verify.currentLineContentIs("if (false) { debugger; }"); -goTo.eof(); +/// + +////if(false){debugger;} +//// if ( false ) { debugger ; } + +format.document(); +goTo.bof(); +verify.currentLineContentIs("if (false) { debugger; }"); +goTo.eof(); verify.currentLineContentIs("if (false) { debugger; }"); \ No newline at end of file diff --git a/tests/cases/fourslash/formatEmptyBlock.ts b/tests/cases/fourslash/formatEmptyBlock.ts index c65a2d607d..565dbc6257 100644 --- a/tests/cases/fourslash/formatEmptyBlock.ts +++ b/tests/cases/fourslash/formatEmptyBlock.ts @@ -1,8 +1,8 @@ -/// - -////{} - -goTo.eof(); -edit.insert("\r\n"); -goTo.bof(); +/// + +////{} + +goTo.eof(); +edit.insert("\r\n"); +goTo.bof(); verify.currentLineContentIs("{ }"); \ No newline at end of file diff --git a/tests/cases/fourslash/formatEmptyParamList.ts b/tests/cases/fourslash/formatEmptyParamList.ts index 5b207581d6..a5372010ba 100644 --- a/tests/cases/fourslash/formatEmptyParamList.ts +++ b/tests/cases/fourslash/formatEmptyParamList.ts @@ -1,5 +1,5 @@ -/// -////function f( f: function){/*1*/ -goTo.marker("1"); -edit.insert("}"); +/// +////function f( f: function){/*1*/ +goTo.marker("1"); +edit.insert("}"); verify.currentLineContentIs("function f(f: function){ }") \ No newline at end of file diff --git a/tests/cases/fourslash/formatImplicitModule.ts b/tests/cases/fourslash/formatImplicitModule.ts index 22583940d6..22a933ce03 100644 --- a/tests/cases/fourslash/formatImplicitModule.ts +++ b/tests/cases/fourslash/formatImplicitModule.ts @@ -1,11 +1,11 @@ -/// - -//// export class A { -//// -//// } - -format.document(); -goTo.bof(); -verify.currentLineContentIs("export class A {"); -goTo.eof(); +/// + +//// export class A { +//// +//// } + +format.document(); +goTo.bof(); +verify.currentLineContentIs("export class A {"); +goTo.eof(); verify.currentLineContentIs("}"); \ No newline at end of file diff --git a/tests/cases/fourslash/formatImportDeclaration.ts b/tests/cases/fourslash/formatImportDeclaration.ts index 4dc26fd5bc..09c3e95964 100644 --- a/tests/cases/fourslash/formatImportDeclaration.ts +++ b/tests/cases/fourslash/formatImportDeclaration.ts @@ -1,18 +1,18 @@ -/// - -////module Foo {/*1*/ -////}/*2*/ -//// -////import bar = Foo;/*3*/ -//// -////import bar2=Foo;/*4*/ - -format.document(); -goTo.marker("1"); -verify.currentLineContentIs("module Foo {"); -goTo.marker("2"); -verify.currentLineContentIs("}"); -goTo.marker("3"); -verify.currentLineContentIs("import bar = Foo;"); -goTo.marker("4"); +/// + +////module Foo {/*1*/ +////}/*2*/ +//// +////import bar = Foo;/*3*/ +//// +////import bar2=Foo;/*4*/ + +format.document(); +goTo.marker("1"); +verify.currentLineContentIs("module Foo {"); +goTo.marker("2"); +verify.currentLineContentIs("}"); +goTo.marker("3"); +verify.currentLineContentIs("import bar = Foo;"); +goTo.marker("4"); verify.currentLineContentIs("import bar2 = Foo;"); \ No newline at end of file diff --git a/tests/cases/fourslash/formatNestedClassWithOpenBraceOnNewLines.ts b/tests/cases/fourslash/formatNestedClassWithOpenBraceOnNewLines.ts index 2f3157a283..028fc349b3 100644 --- a/tests/cases/fourslash/formatNestedClassWithOpenBraceOnNewLines.ts +++ b/tests/cases/fourslash/formatNestedClassWithOpenBraceOnNewLines.ts @@ -1,21 +1,21 @@ -/// - -////module A -////{ -//// class B { -//// /*1*/ -////} - -format.setOption("PlaceOpenBraceOnNewLineForControlBlocks", true); -format.setOption("PlaceOpenBraceOnNewLineForFunctions", true); -goTo.marker("1"); -edit.insert("}"); - -verify.currentFileContentIs( -"module A\n\ -{\n\ - class B\n\ - {\n\ - }\n\ -}" +/// + +////module A +////{ +//// class B { +//// /*1*/ +////} + +format.setOption("PlaceOpenBraceOnNewLineForControlBlocks", true); +format.setOption("PlaceOpenBraceOnNewLineForFunctions", true); +goTo.marker("1"); +edit.insert("}"); + +verify.currentFileContentIs( +"module A\n\ +{\n\ + class B\n\ + {\n\ + }\n\ +}" ); \ No newline at end of file diff --git a/tests/cases/fourslash/formatSelectionWithTrivia.ts b/tests/cases/fourslash/formatSelectionWithTrivia.ts index 3aae18d920..ff39964274 100644 --- a/tests/cases/fourslash/formatSelectionWithTrivia.ts +++ b/tests/cases/fourslash/formatSelectionWithTrivia.ts @@ -1,13 +1,13 @@ -/// +/// ////if (true) { -//// // -//// /*begin*/ -//// // -//// ; -//// -//// }/*end*/ - -format.selection('begin', 'end'); - -verify.currentFileContentIs("if (true) { \n // \n\n // \n ;\n\n}"); +//// // +//// /*begin*/ +//// // +//// ; +//// +//// }/*end*/ + +format.selection('begin', 'end'); + +verify.currentFileContentIs("if (true) { \n // \n\n // \n ;\n\n}"); diff --git a/tests/cases/fourslash/formatVariableDeclarationList.ts b/tests/cases/fourslash/formatVariableDeclarationList.ts index 6d1b6e0ac5..37392d38c6 100644 --- a/tests/cases/fourslash/formatVariableDeclarationList.ts +++ b/tests/cases/fourslash/formatVariableDeclarationList.ts @@ -1,40 +1,40 @@ -/// - -/////*1*/var fun1 = function ( ) { -/////*2*/ var x = 'foo' , -/////*3*/ z = 'bar' ; -/////*4*/ return x ; -/////*5*/}, -//// -/////*6*/fun2 = ( function ( f ) { -/////*7*/ var fun = function ( ) { -/////*8*/ console . log ( f ( ) ) ; -/////*9*/ }, -/////*10*/ x = 'Foo' ; -/////*11*/ return fun ; -/////*12*/} ( fun1 ) ) ; -format.document(); -goTo.marker("1"); -verify.currentLineContentIs("var fun1 = function() {"); -goTo.marker("2"); -verify.currentLineContentIs(" var x = 'foo',"); -goTo.marker("3"); -verify.currentLineContentIs(" z = 'bar';"); -goTo.marker("4"); -verify.currentLineContentIs(" return x;"); -goTo.marker("5"); -verify.currentLineContentIs("},"); -goTo.marker("6"); -verify.currentLineContentIs(" fun2 = (function(f) {"); -goTo.marker("7"); -verify.currentLineContentIs(" var fun = function() {"); -goTo.marker("8"); -verify.currentLineContentIs(" console.log(f());"); -goTo.marker("9"); -verify.currentLineContentIs(" },"); -goTo.marker("10"); -verify.currentLineContentIs(" x = 'Foo';"); -goTo.marker("11"); -verify.currentLineContentIs(" return fun;"); -goTo.marker("12"); -verify.currentLineContentIs(" } (fun1));"); +/// + +/////*1*/var fun1 = function ( ) { +/////*2*/ var x = 'foo' , +/////*3*/ z = 'bar' ; +/////*4*/ return x ; +/////*5*/}, +//// +/////*6*/fun2 = ( function ( f ) { +/////*7*/ var fun = function ( ) { +/////*8*/ console . log ( f ( ) ) ; +/////*9*/ }, +/////*10*/ x = 'Foo' ; +/////*11*/ return fun ; +/////*12*/} ( fun1 ) ) ; +format.document(); +goTo.marker("1"); +verify.currentLineContentIs("var fun1 = function() {"); +goTo.marker("2"); +verify.currentLineContentIs(" var x = 'foo',"); +goTo.marker("3"); +verify.currentLineContentIs(" z = 'bar';"); +goTo.marker("4"); +verify.currentLineContentIs(" return x;"); +goTo.marker("5"); +verify.currentLineContentIs("},"); +goTo.marker("6"); +verify.currentLineContentIs(" fun2 = (function(f) {"); +goTo.marker("7"); +verify.currentLineContentIs(" var fun = function() {"); +goTo.marker("8"); +verify.currentLineContentIs(" console.log(f());"); +goTo.marker("9"); +verify.currentLineContentIs(" },"); +goTo.marker("10"); +verify.currentLineContentIs(" x = 'Foo';"); +goTo.marker("11"); +verify.currentLineContentIs(" return fun;"); +goTo.marker("12"); +verify.currentLineContentIs(" } (fun1));"); diff --git a/tests/cases/fourslash/formatWithStatement.ts b/tests/cases/fourslash/formatWithStatement.ts index 410b8f5601..bc5ddf3844 100644 --- a/tests/cases/fourslash/formatWithStatement.ts +++ b/tests/cases/fourslash/formatWithStatement.ts @@ -1,15 +1,15 @@ -/// - -////with /*1*/(foo.bar) -//// -//// {/*2*/ -//// -//// }/*3*/ -//// -////with (bar.blah)/*4*/ -////{/*5*/ -////}/*6*/ - +/// + +////with /*1*/(foo.bar) +//// +//// {/*2*/ +//// +//// }/*3*/ +//// +////with (bar.blah)/*4*/ +////{/*5*/ +////}/*6*/ + format.setOption("PlaceOpenBraceOnNewLineForControlBlocks", false); format.document(); goTo.marker("1"); @@ -19,15 +19,15 @@ verify.currentLineContentIs("}"); goTo.marker("4"); verify.currentLineContentIs("with (bar.blah) {"); goTo.marker("6"); -verify.currentLineContentIs("}"); - -format.setOption("PlaceOpenBraceOnNewLineForControlBlocks", true); -format.document(); -goTo.marker("1"); -verify.currentLineContentIs("with (foo.bar)"); -goTo.marker("2"); -verify.currentLineContentIs("{"); -goTo.marker("4"); -verify.currentLineContentIs("with (bar.blah)"); -goTo.marker("5"); +verify.currentLineContentIs("}"); + +format.setOption("PlaceOpenBraceOnNewLineForControlBlocks", true); +format.document(); +goTo.marker("1"); +verify.currentLineContentIs("with (foo.bar)"); +goTo.marker("2"); +verify.currentLineContentIs("{"); +goTo.marker("4"); +verify.currentLineContentIs("with (bar.blah)"); +goTo.marker("5"); verify.currentLineContentIs("{"); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingFatArrowFunctions.ts b/tests/cases/fourslash/formattingFatArrowFunctions.ts index 73463852a6..c540c2837e 100644 --- a/tests/cases/fourslash/formattingFatArrowFunctions.ts +++ b/tests/cases/fourslash/formattingFatArrowFunctions.ts @@ -1,290 +1,290 @@ -/// - -////// valid -//// ( ) => 1 ;/*1*/ -//// ( arg ) => 2 ;/*2*/ -//// arg => 2 ;/*3*/ -//// ( arg = 1 ) => 3 ;/*4*/ -//// ( arg ? ) => 4 ;/*5*/ -//// ( arg : number ) => 5 ;/*6*/ -//// ( arg : number = 0 ) => 6 ;/*7*/ -//// ( arg ? : number ) => 7 ;/*8*/ -//// ( ... arg : number [ ] ) => 8 ;/*9*/ -//// ( arg1 , arg2 ) => 12 ;/*10*/ -//// ( arg1 = 1 , arg2 =3 ) => 13 ;/*11*/ -//// ( arg1 ? , arg2 ? ) => 14 ;/*12*/ -//// ( arg1 : number , arg2 : number ) => 15 ;/*13*/ -//// ( arg1 : number = 0 , arg2 : number = 1 ) => 16 ;/*14*/ -//// ( arg1 ? : number , arg2 ? : number ) => 17 ;/*15*/ -//// ( arg1 , ... arg2 : number [ ] ) => 18 ;/*16*/ -//// ( arg1 , arg2 ? : number ) => 19 ;/*17*/ -//// -////// in paren -//// ( ( ) => 21 ) ;/*18*/ -//// ( ( arg ) => 22 ) ;/*19*/ -//// ( ( arg = 1 ) => 23 ) ;/*20*/ -//// ( ( arg ? ) => 24 ) ;/*21*/ -//// ( ( arg : number ) => 25 ) ;/*22*/ -//// ( ( arg : number = 0 ) => 26 ) ;/*23*/ -//// ( ( arg ? : number ) => 27 ) ;/*24*/ -//// ( ( ... arg : number [ ] ) => 28 ) ;/*25*/ -//// -////// in multiple paren -//// ( ( ( ( ( arg ) => { return 32 ; } ) ) ) ) ;/*26*/ -//// -////// in ternary exression -//// false ? ( ) => 41 : null ;/*27*/ -//// false ? ( arg ) => 42 : null ;/*28*/ -//// false ? ( arg = 1 ) => 43 : null ;/*29*/ -//// false ? ( arg ? ) => 44 : null ;/*30*/ -//// false ? ( arg : number ) => 45 : null ;/*31*/ -//// false ? ( arg ? : number ) => 46 : null ;/*32*/ -//// false ? ( arg ? : number = 0 ) => 47 : null ;/*33*/ -//// false ? ( ... arg : number [ ] ) => 48 : null ;/*34*/ -//// -////// in ternary exression within paren -//// false ? ( ( ) => 51 ) : null ;/*35*/ -//// false ? ( ( arg ) => 52 ) : null ;/*36*/ -//// false ? ( ( arg = 1 ) => 53 ) : null ;/*37*/ -//// false ? ( ( arg ? ) => 54 ) : null ;/*38*/ -//// false ? ( ( arg : number ) => 55 ) : null ;/*39*/ -//// false ? ( ( arg ? : number ) => 56 ) : null ;/*40*/ -//// false ? ( ( arg ? : number = 0 ) => 57 ) : null ;/*41*/ -//// false ? ( ( ... arg : number [ ] ) => 58 ) : null ;/*42*/ -//// -////// ternary exression's else clause -//// false ? null : ( ) => 61 ;/*43*/ -//// false ? null : ( arg ) => 62 ;/*44*/ -//// false ? null : ( arg = 1 ) => 63 ;/*45*/ -//// false ? null : ( arg ? ) => 64 ;/*46*/ -//// false ? null : ( arg : number ) => 65 ;/*47*/ -//// false ? null : ( arg ? : number ) => 66 ;/*48*/ -//// false ? null : ( arg ? : number = 0 ) => 67 ;/*49*/ -//// false ? null : ( ... arg : number [ ] ) => 68 ;/*50*/ -//// -//// -////// nested ternary expressions -//// (( a ? ) => { return a ; }) ? ( b ? ) => { return b ; } : ( c ? ) => { return c ; } ;/*51*/ -//// -//////multiple levels -//// (( a ? ) => { return a ; }) ? ( b ) => ( c ) => 81 : ( c ) => ( d ) => 82 ;/*52*/ -//// -//// -////// In Expressions -//// ( ( arg ) => 90 ) instanceof Function ;/*53*/ -//// ( ( arg = 1 ) => 91 ) instanceof Function ;/*54*/ -//// ( ( arg ? ) => 92 ) instanceof Function ;/*55*/ -//// ( ( arg : number ) => 93 ) instanceof Function ;/*56*/ -//// ( ( arg : number = 1 ) => 94 ) instanceof Function ;/*57*/ -//// ( ( arg ? : number ) => 95 ) instanceof Function ;/*58*/ -//// ( ( ... arg : number [ ] ) => 96 ) instanceof Function ;/*59*/ -//// -////'' + (( arg ) => 100) ;/*60*/ -//// ( ( arg ) => 0 ) + '' + (( arg ) => 101) ;/*61*/ -//// ( ( arg = 1 ) => 0 ) + '' + (( arg = 2 ) => 102) ;/*62*/ -//// ( ( arg ? ) => 0 ) + '' + (( arg ? ) => 103) ;/*63*/ -//// ( ( arg : number ) => 0 ) + '' + (( arg : number ) => 104) ;/*64*/ -//// ( ( arg : number = 1 ) => 0 ) + '' + (( arg : number = 2 ) => 105) ;/*65*/ -//// ( ( arg ? : number ) => 0 ) + '' + (( arg ? : number ) => 106) ;/*66*/ -//// ( ( ... arg : number [ ] ) => 0 ) + '' + (( ... arg : number [ ] ) => 107) ;/*67*/ -//// ( ( arg1 , arg2 ? ) => 0 ) + '' + (( arg1 , arg2 ? ) => 108) ;/*68*/ -//// ( ( arg1 , ... arg2 : number [ ] ) => 0 ) + '' + (( arg1 , ... arg2 : number [ ] ) => 108) ;/*69*/ -//// -//// -////// Function Parameters -/////*70*/function foo ( ... arg : any [ ] ) { } -//// -/////*71*/foo ( -/////*72*/ ( a ) => 110 , -/////*73*/ ( ( a ) => 111 ) , -/////*74*/ ( a ) => { -//// return /*75*/112 ; -/////*76*/ } , -/////*77*/ ( a ? ) => 113 , -/////*78*/ ( a , b ? ) => 114 , -/////*79*/ ( a : number ) => 115 , -/////*80*/ ( a : number = 0 ) => 116 , -/////*81*/ ( a = 0 ) => 117 , -/////*82*/ ( a : number = 0 ) => 118 , -/////*83*/ ( a ? , b ? : number ) => 118 , -/////*84*/ ( ... a : number [ ] ) => 119 , -/////*85*/ ( a , b = 0 , ... c : number [ ] ) => 120 , -/////*86*/ ( a ) => ( b ) => ( c ) => 121 , -/////*87*/ false ? ( a ) => 0 : ( b ) => 122 -//// /*88*/) ; -format.document(); -goTo.marker("1"); -verify.currentLineContentIs("() => 1;"); -goTo.marker("2"); -verify.currentLineContentIs("(arg) => 2;"); -goTo.marker("3"); -verify.currentLineContentIs("arg => 2;"); -goTo.marker("4"); -verify.currentLineContentIs("(arg = 1) => 3;"); -goTo.marker("5"); -verify.currentLineContentIs("(arg?) => 4;"); -goTo.marker("6"); -verify.currentLineContentIs("(arg: number) => 5;"); -goTo.marker("7"); -verify.currentLineContentIs("(arg: number = 0) => 6;"); -goTo.marker("8"); -verify.currentLineContentIs("(arg?: number) => 7;"); -goTo.marker("9"); -verify.currentLineContentIs("(...arg: number[]) => 8;"); -goTo.marker("10"); -verify.currentLineContentIs("(arg1, arg2) => 12;"); -goTo.marker("11"); -verify.currentLineContentIs("(arg1 = 1, arg2 = 3) => 13;"); -goTo.marker("12"); -verify.currentLineContentIs("(arg1?, arg2?) => 14;"); -goTo.marker("13"); -verify.currentLineContentIs("(arg1: number, arg2: number) => 15;"); -goTo.marker("14"); -verify.currentLineContentIs("(arg1: number = 0, arg2: number = 1) => 16;"); -goTo.marker("15"); -verify.currentLineContentIs("(arg1?: number, arg2?: number) => 17;"); -goTo.marker("16"); -verify.currentLineContentIs("(arg1, ...arg2: number[]) => 18;"); -goTo.marker("17"); -verify.currentLineContentIs("(arg1, arg2?: number) => 19;"); -goTo.marker("18"); -verify.currentLineContentIs("(() => 21);"); -goTo.marker("19"); -verify.currentLineContentIs("((arg) => 22);"); -goTo.marker("20"); -verify.currentLineContentIs("((arg = 1) => 23);"); -goTo.marker("21"); -verify.currentLineContentIs("((arg?) => 24);"); -goTo.marker("22"); -verify.currentLineContentIs("((arg: number) => 25);"); -goTo.marker("23"); -verify.currentLineContentIs("((arg: number = 0) => 26);"); -goTo.marker("24"); -verify.currentLineContentIs("((arg?: number) => 27);"); -goTo.marker("25"); -verify.currentLineContentIs("((...arg: number[]) => 28);"); -goTo.marker("26"); -verify.currentLineContentIs("(((((arg) => { return 32; }))));"); -goTo.marker("27"); -verify.currentLineContentIs("false ? () => 41 : null;"); -goTo.marker("28"); -verify.currentLineContentIs("false ? (arg) => 42 : null;"); -goTo.marker("29"); -verify.currentLineContentIs("false ? (arg = 1) => 43 : null;"); -goTo.marker("30"); -verify.currentLineContentIs("false ? (arg?) => 44 : null;"); -goTo.marker("31"); -verify.currentLineContentIs("false ? (arg: number) => 45 : null;"); -goTo.marker("32"); -verify.currentLineContentIs("false ? (arg?: number) => 46 : null;"); -goTo.marker("33"); -verify.currentLineContentIs("false ? (arg?: number = 0) => 47 : null;"); -goTo.marker("34"); -verify.currentLineContentIs("false ? (...arg: number[]) => 48 : null;"); -goTo.marker("35"); -verify.currentLineContentIs("false ? (() => 51) : null;"); -goTo.marker("36"); -verify.currentLineContentIs("false ? ((arg) => 52) : null;"); -goTo.marker("37"); -verify.currentLineContentIs("false ? ((arg = 1) => 53) : null;"); -goTo.marker("38"); -verify.currentLineContentIs("false ? ((arg?) => 54) : null;"); -goTo.marker("39"); -verify.currentLineContentIs("false ? ((arg: number) => 55) : null;"); -goTo.marker("40"); -verify.currentLineContentIs("false ? ((arg?: number) => 56) : null;"); -goTo.marker("41"); -verify.currentLineContentIs("false ? ((arg?: number = 0) => 57) : null;"); -goTo.marker("42"); -verify.currentLineContentIs("false ? ((...arg: number[]) => 58) : null;"); -goTo.marker("43"); -verify.currentLineContentIs("false ? null : () => 61;"); -goTo.marker("44"); -verify.currentLineContentIs("false ? null : (arg) => 62;"); -goTo.marker("45"); -verify.currentLineContentIs("false ? null : (arg = 1) => 63;"); -goTo.marker("46"); -verify.currentLineContentIs("false ? null : (arg?) => 64;"); -goTo.marker("47"); -verify.currentLineContentIs("false ? null : (arg: number) => 65;"); -goTo.marker("48"); -verify.currentLineContentIs("false ? null : (arg?: number) => 66;"); -goTo.marker("49"); -verify.currentLineContentIs("false ? null : (arg?: number = 0) => 67;"); -goTo.marker("50"); -verify.currentLineContentIs("false ? null : (...arg: number[]) => 68;"); -goTo.marker("51"); -verify.currentLineContentIs("((a?) => { return a; }) ? (b?) => { return b; } : (c?) => { return c; };"); -goTo.marker("52"); -verify.currentLineContentIs("((a?) => { return a; }) ? (b) => (c) => 81 : (c) => (d) => 82;"); -goTo.marker("53"); -verify.currentLineContentIs("((arg) => 90) instanceof Function;"); -goTo.marker("54"); -verify.currentLineContentIs("((arg = 1) => 91) instanceof Function;"); -goTo.marker("55"); -verify.currentLineContentIs("((arg?) => 92) instanceof Function;"); -goTo.marker("56"); -verify.currentLineContentIs("((arg: number) => 93) instanceof Function;"); -goTo.marker("57"); -verify.currentLineContentIs("((arg: number = 1) => 94) instanceof Function;"); -goTo.marker("58"); -verify.currentLineContentIs("((arg?: number) => 95) instanceof Function;"); -goTo.marker("59"); -verify.currentLineContentIs("((...arg: number[]) => 96) instanceof Function;"); -goTo.marker("60"); -verify.currentLineContentIs("'' + ((arg) => 100);"); - -goTo.marker("61"); -verify.currentLineContentIs("((arg) => 0) + '' + ((arg) => 101);"); -goTo.marker("62"); -verify.currentLineContentIs("((arg = 1) => 0) + '' + ((arg = 2) => 102);"); -goTo.marker("63"); -verify.currentLineContentIs("((arg?) => 0) + '' + ((arg?) => 103);"); -goTo.marker("64"); -verify.currentLineContentIs("((arg: number) => 0) + '' + ((arg: number) => 104);"); -goTo.marker("65"); -verify.currentLineContentIs("((arg: number = 1) => 0) + '' + ((arg: number = 2) => 105);"); -goTo.marker("66"); -verify.currentLineContentIs("((arg?: number) => 0) + '' + ((arg?: number) => 106);"); -goTo.marker("67"); -verify.currentLineContentIs("((...arg: number[]) => 0) + '' + ((...arg: number[]) => 107);"); -goTo.marker("68"); -verify.currentLineContentIs("((arg1, arg2?) => 0) + '' + ((arg1, arg2?) => 108);"); -goTo.marker("69"); -verify.currentLineContentIs("((arg1, ...arg2: number[]) => 0) + '' + ((arg1, ...arg2: number[]) => 108);"); -goTo.marker("70"); -verify.currentLineContentIs("function foo(...arg: any[]) { }"); -goTo.marker("71"); -verify.currentLineContentIs("foo("); -goTo.marker("72"); -verify.currentLineContentIs(" (a) => 110,"); -goTo.marker("73"); -verify.currentLineContentIs(" ((a) => 111),"); -goTo.marker("74"); -verify.currentLineContentIs(" (a) => {"); -goTo.marker("75"); -verify.currentLineContentIs(" return 112;"); -goTo.marker("76"); -verify.currentLineContentIs(" },"); -goTo.marker("77"); -verify.currentLineContentIs(" (a?) => 113,"); -goTo.marker("78"); -verify.currentLineContentIs(" (a, b?) => 114,"); -goTo.marker("79"); -verify.currentLineContentIs(" (a: number) => 115,"); -goTo.marker("80"); -verify.currentLineContentIs(" (a: number = 0) => 116,"); -goTo.marker("81"); -verify.currentLineContentIs(" (a = 0) => 117,"); -goTo.marker("82"); -verify.currentLineContentIs(" (a: number = 0) => 118,"); -goTo.marker("83"); -verify.currentLineContentIs(" (a?, b?: number) => 118,"); -goTo.marker("84"); -verify.currentLineContentIs(" (...a: number[]) => 119,"); -goTo.marker("85"); -verify.currentLineContentIs(" (a, b = 0, ...c: number[]) => 120,"); -goTo.marker("86"); -verify.currentLineContentIs(" (a) => (b) => (c) => 121,"); -goTo.marker("87"); -verify.currentLineContentIs(" false ? (a) => 0 : (b) => 122"); +/// + +////// valid +//// ( ) => 1 ;/*1*/ +//// ( arg ) => 2 ;/*2*/ +//// arg => 2 ;/*3*/ +//// ( arg = 1 ) => 3 ;/*4*/ +//// ( arg ? ) => 4 ;/*5*/ +//// ( arg : number ) => 5 ;/*6*/ +//// ( arg : number = 0 ) => 6 ;/*7*/ +//// ( arg ? : number ) => 7 ;/*8*/ +//// ( ... arg : number [ ] ) => 8 ;/*9*/ +//// ( arg1 , arg2 ) => 12 ;/*10*/ +//// ( arg1 = 1 , arg2 =3 ) => 13 ;/*11*/ +//// ( arg1 ? , arg2 ? ) => 14 ;/*12*/ +//// ( arg1 : number , arg2 : number ) => 15 ;/*13*/ +//// ( arg1 : number = 0 , arg2 : number = 1 ) => 16 ;/*14*/ +//// ( arg1 ? : number , arg2 ? : number ) => 17 ;/*15*/ +//// ( arg1 , ... arg2 : number [ ] ) => 18 ;/*16*/ +//// ( arg1 , arg2 ? : number ) => 19 ;/*17*/ +//// +////// in paren +//// ( ( ) => 21 ) ;/*18*/ +//// ( ( arg ) => 22 ) ;/*19*/ +//// ( ( arg = 1 ) => 23 ) ;/*20*/ +//// ( ( arg ? ) => 24 ) ;/*21*/ +//// ( ( arg : number ) => 25 ) ;/*22*/ +//// ( ( arg : number = 0 ) => 26 ) ;/*23*/ +//// ( ( arg ? : number ) => 27 ) ;/*24*/ +//// ( ( ... arg : number [ ] ) => 28 ) ;/*25*/ +//// +////// in multiple paren +//// ( ( ( ( ( arg ) => { return 32 ; } ) ) ) ) ;/*26*/ +//// +////// in ternary exression +//// false ? ( ) => 41 : null ;/*27*/ +//// false ? ( arg ) => 42 : null ;/*28*/ +//// false ? ( arg = 1 ) => 43 : null ;/*29*/ +//// false ? ( arg ? ) => 44 : null ;/*30*/ +//// false ? ( arg : number ) => 45 : null ;/*31*/ +//// false ? ( arg ? : number ) => 46 : null ;/*32*/ +//// false ? ( arg ? : number = 0 ) => 47 : null ;/*33*/ +//// false ? ( ... arg : number [ ] ) => 48 : null ;/*34*/ +//// +////// in ternary exression within paren +//// false ? ( ( ) => 51 ) : null ;/*35*/ +//// false ? ( ( arg ) => 52 ) : null ;/*36*/ +//// false ? ( ( arg = 1 ) => 53 ) : null ;/*37*/ +//// false ? ( ( arg ? ) => 54 ) : null ;/*38*/ +//// false ? ( ( arg : number ) => 55 ) : null ;/*39*/ +//// false ? ( ( arg ? : number ) => 56 ) : null ;/*40*/ +//// false ? ( ( arg ? : number = 0 ) => 57 ) : null ;/*41*/ +//// false ? ( ( ... arg : number [ ] ) => 58 ) : null ;/*42*/ +//// +////// ternary exression's else clause +//// false ? null : ( ) => 61 ;/*43*/ +//// false ? null : ( arg ) => 62 ;/*44*/ +//// false ? null : ( arg = 1 ) => 63 ;/*45*/ +//// false ? null : ( arg ? ) => 64 ;/*46*/ +//// false ? null : ( arg : number ) => 65 ;/*47*/ +//// false ? null : ( arg ? : number ) => 66 ;/*48*/ +//// false ? null : ( arg ? : number = 0 ) => 67 ;/*49*/ +//// false ? null : ( ... arg : number [ ] ) => 68 ;/*50*/ +//// +//// +////// nested ternary expressions +//// (( a ? ) => { return a ; }) ? ( b ? ) => { return b ; } : ( c ? ) => { return c ; } ;/*51*/ +//// +//////multiple levels +//// (( a ? ) => { return a ; }) ? ( b ) => ( c ) => 81 : ( c ) => ( d ) => 82 ;/*52*/ +//// +//// +////// In Expressions +//// ( ( arg ) => 90 ) instanceof Function ;/*53*/ +//// ( ( arg = 1 ) => 91 ) instanceof Function ;/*54*/ +//// ( ( arg ? ) => 92 ) instanceof Function ;/*55*/ +//// ( ( arg : number ) => 93 ) instanceof Function ;/*56*/ +//// ( ( arg : number = 1 ) => 94 ) instanceof Function ;/*57*/ +//// ( ( arg ? : number ) => 95 ) instanceof Function ;/*58*/ +//// ( ( ... arg : number [ ] ) => 96 ) instanceof Function ;/*59*/ +//// +////'' + (( arg ) => 100) ;/*60*/ +//// ( ( arg ) => 0 ) + '' + (( arg ) => 101) ;/*61*/ +//// ( ( arg = 1 ) => 0 ) + '' + (( arg = 2 ) => 102) ;/*62*/ +//// ( ( arg ? ) => 0 ) + '' + (( arg ? ) => 103) ;/*63*/ +//// ( ( arg : number ) => 0 ) + '' + (( arg : number ) => 104) ;/*64*/ +//// ( ( arg : number = 1 ) => 0 ) + '' + (( arg : number = 2 ) => 105) ;/*65*/ +//// ( ( arg ? : number ) => 0 ) + '' + (( arg ? : number ) => 106) ;/*66*/ +//// ( ( ... arg : number [ ] ) => 0 ) + '' + (( ... arg : number [ ] ) => 107) ;/*67*/ +//// ( ( arg1 , arg2 ? ) => 0 ) + '' + (( arg1 , arg2 ? ) => 108) ;/*68*/ +//// ( ( arg1 , ... arg2 : number [ ] ) => 0 ) + '' + (( arg1 , ... arg2 : number [ ] ) => 108) ;/*69*/ +//// +//// +////// Function Parameters +/////*70*/function foo ( ... arg : any [ ] ) { } +//// +/////*71*/foo ( +/////*72*/ ( a ) => 110 , +/////*73*/ ( ( a ) => 111 ) , +/////*74*/ ( a ) => { +//// return /*75*/112 ; +/////*76*/ } , +/////*77*/ ( a ? ) => 113 , +/////*78*/ ( a , b ? ) => 114 , +/////*79*/ ( a : number ) => 115 , +/////*80*/ ( a : number = 0 ) => 116 , +/////*81*/ ( a = 0 ) => 117 , +/////*82*/ ( a : number = 0 ) => 118 , +/////*83*/ ( a ? , b ? : number ) => 118 , +/////*84*/ ( ... a : number [ ] ) => 119 , +/////*85*/ ( a , b = 0 , ... c : number [ ] ) => 120 , +/////*86*/ ( a ) => ( b ) => ( c ) => 121 , +/////*87*/ false ? ( a ) => 0 : ( b ) => 122 +//// /*88*/) ; +format.document(); +goTo.marker("1"); +verify.currentLineContentIs("() => 1;"); +goTo.marker("2"); +verify.currentLineContentIs("(arg) => 2;"); +goTo.marker("3"); +verify.currentLineContentIs("arg => 2;"); +goTo.marker("4"); +verify.currentLineContentIs("(arg = 1) => 3;"); +goTo.marker("5"); +verify.currentLineContentIs("(arg?) => 4;"); +goTo.marker("6"); +verify.currentLineContentIs("(arg: number) => 5;"); +goTo.marker("7"); +verify.currentLineContentIs("(arg: number = 0) => 6;"); +goTo.marker("8"); +verify.currentLineContentIs("(arg?: number) => 7;"); +goTo.marker("9"); +verify.currentLineContentIs("(...arg: number[]) => 8;"); +goTo.marker("10"); +verify.currentLineContentIs("(arg1, arg2) => 12;"); +goTo.marker("11"); +verify.currentLineContentIs("(arg1 = 1, arg2 = 3) => 13;"); +goTo.marker("12"); +verify.currentLineContentIs("(arg1?, arg2?) => 14;"); +goTo.marker("13"); +verify.currentLineContentIs("(arg1: number, arg2: number) => 15;"); +goTo.marker("14"); +verify.currentLineContentIs("(arg1: number = 0, arg2: number = 1) => 16;"); +goTo.marker("15"); +verify.currentLineContentIs("(arg1?: number, arg2?: number) => 17;"); +goTo.marker("16"); +verify.currentLineContentIs("(arg1, ...arg2: number[]) => 18;"); +goTo.marker("17"); +verify.currentLineContentIs("(arg1, arg2?: number) => 19;"); +goTo.marker("18"); +verify.currentLineContentIs("(() => 21);"); +goTo.marker("19"); +verify.currentLineContentIs("((arg) => 22);"); +goTo.marker("20"); +verify.currentLineContentIs("((arg = 1) => 23);"); +goTo.marker("21"); +verify.currentLineContentIs("((arg?) => 24);"); +goTo.marker("22"); +verify.currentLineContentIs("((arg: number) => 25);"); +goTo.marker("23"); +verify.currentLineContentIs("((arg: number = 0) => 26);"); +goTo.marker("24"); +verify.currentLineContentIs("((arg?: number) => 27);"); +goTo.marker("25"); +verify.currentLineContentIs("((...arg: number[]) => 28);"); +goTo.marker("26"); +verify.currentLineContentIs("(((((arg) => { return 32; }))));"); +goTo.marker("27"); +verify.currentLineContentIs("false ? () => 41 : null;"); +goTo.marker("28"); +verify.currentLineContentIs("false ? (arg) => 42 : null;"); +goTo.marker("29"); +verify.currentLineContentIs("false ? (arg = 1) => 43 : null;"); +goTo.marker("30"); +verify.currentLineContentIs("false ? (arg?) => 44 : null;"); +goTo.marker("31"); +verify.currentLineContentIs("false ? (arg: number) => 45 : null;"); +goTo.marker("32"); +verify.currentLineContentIs("false ? (arg?: number) => 46 : null;"); +goTo.marker("33"); +verify.currentLineContentIs("false ? (arg?: number = 0) => 47 : null;"); +goTo.marker("34"); +verify.currentLineContentIs("false ? (...arg: number[]) => 48 : null;"); +goTo.marker("35"); +verify.currentLineContentIs("false ? (() => 51) : null;"); +goTo.marker("36"); +verify.currentLineContentIs("false ? ((arg) => 52) : null;"); +goTo.marker("37"); +verify.currentLineContentIs("false ? ((arg = 1) => 53) : null;"); +goTo.marker("38"); +verify.currentLineContentIs("false ? ((arg?) => 54) : null;"); +goTo.marker("39"); +verify.currentLineContentIs("false ? ((arg: number) => 55) : null;"); +goTo.marker("40"); +verify.currentLineContentIs("false ? ((arg?: number) => 56) : null;"); +goTo.marker("41"); +verify.currentLineContentIs("false ? ((arg?: number = 0) => 57) : null;"); +goTo.marker("42"); +verify.currentLineContentIs("false ? ((...arg: number[]) => 58) : null;"); +goTo.marker("43"); +verify.currentLineContentIs("false ? null : () => 61;"); +goTo.marker("44"); +verify.currentLineContentIs("false ? null : (arg) => 62;"); +goTo.marker("45"); +verify.currentLineContentIs("false ? null : (arg = 1) => 63;"); +goTo.marker("46"); +verify.currentLineContentIs("false ? null : (arg?) => 64;"); +goTo.marker("47"); +verify.currentLineContentIs("false ? null : (arg: number) => 65;"); +goTo.marker("48"); +verify.currentLineContentIs("false ? null : (arg?: number) => 66;"); +goTo.marker("49"); +verify.currentLineContentIs("false ? null : (arg?: number = 0) => 67;"); +goTo.marker("50"); +verify.currentLineContentIs("false ? null : (...arg: number[]) => 68;"); +goTo.marker("51"); +verify.currentLineContentIs("((a?) => { return a; }) ? (b?) => { return b; } : (c?) => { return c; };"); +goTo.marker("52"); +verify.currentLineContentIs("((a?) => { return a; }) ? (b) => (c) => 81 : (c) => (d) => 82;"); +goTo.marker("53"); +verify.currentLineContentIs("((arg) => 90) instanceof Function;"); +goTo.marker("54"); +verify.currentLineContentIs("((arg = 1) => 91) instanceof Function;"); +goTo.marker("55"); +verify.currentLineContentIs("((arg?) => 92) instanceof Function;"); +goTo.marker("56"); +verify.currentLineContentIs("((arg: number) => 93) instanceof Function;"); +goTo.marker("57"); +verify.currentLineContentIs("((arg: number = 1) => 94) instanceof Function;"); +goTo.marker("58"); +verify.currentLineContentIs("((arg?: number) => 95) instanceof Function;"); +goTo.marker("59"); +verify.currentLineContentIs("((...arg: number[]) => 96) instanceof Function;"); +goTo.marker("60"); +verify.currentLineContentIs("'' + ((arg) => 100);"); + +goTo.marker("61"); +verify.currentLineContentIs("((arg) => 0) + '' + ((arg) => 101);"); +goTo.marker("62"); +verify.currentLineContentIs("((arg = 1) => 0) + '' + ((arg = 2) => 102);"); +goTo.marker("63"); +verify.currentLineContentIs("((arg?) => 0) + '' + ((arg?) => 103);"); +goTo.marker("64"); +verify.currentLineContentIs("((arg: number) => 0) + '' + ((arg: number) => 104);"); +goTo.marker("65"); +verify.currentLineContentIs("((arg: number = 1) => 0) + '' + ((arg: number = 2) => 105);"); +goTo.marker("66"); +verify.currentLineContentIs("((arg?: number) => 0) + '' + ((arg?: number) => 106);"); +goTo.marker("67"); +verify.currentLineContentIs("((...arg: number[]) => 0) + '' + ((...arg: number[]) => 107);"); +goTo.marker("68"); +verify.currentLineContentIs("((arg1, arg2?) => 0) + '' + ((arg1, arg2?) => 108);"); +goTo.marker("69"); +verify.currentLineContentIs("((arg1, ...arg2: number[]) => 0) + '' + ((arg1, ...arg2: number[]) => 108);"); +goTo.marker("70"); +verify.currentLineContentIs("function foo(...arg: any[]) { }"); +goTo.marker("71"); +verify.currentLineContentIs("foo("); +goTo.marker("72"); +verify.currentLineContentIs(" (a) => 110,"); +goTo.marker("73"); +verify.currentLineContentIs(" ((a) => 111),"); +goTo.marker("74"); +verify.currentLineContentIs(" (a) => {"); +goTo.marker("75"); +verify.currentLineContentIs(" return 112;"); +goTo.marker("76"); +verify.currentLineContentIs(" },"); +goTo.marker("77"); +verify.currentLineContentIs(" (a?) => 113,"); +goTo.marker("78"); +verify.currentLineContentIs(" (a, b?) => 114,"); +goTo.marker("79"); +verify.currentLineContentIs(" (a: number) => 115,"); +goTo.marker("80"); +verify.currentLineContentIs(" (a: number = 0) => 116,"); +goTo.marker("81"); +verify.currentLineContentIs(" (a = 0) => 117,"); +goTo.marker("82"); +verify.currentLineContentIs(" (a: number = 0) => 118,"); +goTo.marker("83"); +verify.currentLineContentIs(" (a?, b?: number) => 118,"); +goTo.marker("84"); +verify.currentLineContentIs(" (...a: number[]) => 119,"); +goTo.marker("85"); +verify.currentLineContentIs(" (a, b = 0, ...c: number[]) => 120,"); +goTo.marker("86"); +verify.currentLineContentIs(" (a) => (b) => (c) => 121,"); +goTo.marker("87"); +verify.currentLineContentIs(" false ? (a) => 0 : (b) => 122"); diff --git a/tests/cases/fourslash/formattingKeywordAsIdentifier.ts b/tests/cases/fourslash/formattingKeywordAsIdentifier.ts index aa1a636f62..ee544da345 100644 --- a/tests/cases/fourslash/formattingKeywordAsIdentifier.ts +++ b/tests/cases/fourslash/formattingKeywordAsIdentifier.ts @@ -1,7 +1,7 @@ -/// - -////declare var module/*1*/ - -goTo.marker("1"); -edit.insert(";"); +/// + +////declare var module/*1*/ + +goTo.marker("1"); +edit.insert(";"); verify.currentLineContentIs("declare var module;"); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingNestedScopes.ts b/tests/cases/fourslash/formattingNestedScopes.ts index 269a67dcaa..cbec72d9b1 100644 --- a/tests/cases/fourslash/formattingNestedScopes.ts +++ b/tests/cases/fourslash/formattingNestedScopes.ts @@ -1,4 +1,4 @@ -/// +/// /////*1*/ module My.App { /////*2*/export var appModule = angular.module("app", [ diff --git a/tests/cases/fourslash/formattingOnClasses.ts b/tests/cases/fourslash/formattingOnClasses.ts index 91e63eb3c9..045ee91e42 100644 --- a/tests/cases/fourslash/formattingOnClasses.ts +++ b/tests/cases/fourslash/formattingOnClasses.ts @@ -1,207 +1,207 @@ -/// - -/////*1*/ class a { -/////*2*/ constructor ( n : number ) ; -/////*3*/ constructor ( s : string ) ; -/////*4*/ constructor ( ns : any ) { -//// -/////*5*/ } -//// -/////*6*/ public pgF ( ) { } -//// -/////*7*/ public pv ; -/////*8*/ public get d ( ) { -/////*9*/ return 30 ; -/////*10*/ } -/////*11*/ public set d ( number ) { -/////*12*/ } -//// -/////*13*/ public static get p2 ( ) { -/////*14*/ return { x : 30 , y : 40 } ; -/////*15*/ } -//// -/////*16*/ private static d2 ( ) { -/////*17*/ } -/////*18*/ private static get p3 ( ) { -/////*19*/ return "string" ; -/////*20*/ } -/////*21*/ private pv3 ; -//// -/////*22*/ private foo ( n : number ) : string ; -/////*23*/ private foo ( s : string ) : string ; -/////*24*/ private foo ( ns : any ) { -/////*25*/ return ns.toString ( ) ; -/////*26*/ } -/////*27*/} -//// -/////*28*/ class b extends a { -/////*29*/} -//// -/////*30*/ class m1b { -//// -/////*31*/} -//// -/////*32*/ interface m1ib { -//// -/////*33*/ } -/////*34*/ class c extends m1b { -/////*35*/} -//// -/////*36*/ class ib2 implements m1ib { -/////*37*/} -//// -/////*38*/ declare class aAmbient { -/////*39*/ constructor ( n : number ) ; -/////*40*/ constructor ( s : string ) ; -/////*41*/ public pgF ( ) : void ; -/////*42*/ public pv ; -/////*43*/ public d : number ; -/////*44*/ static p2 : { x : number ; y : number ; } ; -/////*45*/ static d2 ( ) ; -/////*46*/ static p3 ; -/////*47*/ private pv3 ; -/////*48*/ private foo ( s ) ; -/////*49*/} -//// -/////*50*/ class d { -/////*51*/ private foo ( n : number ) : string ; -/////*52*/ private foo ( s : string ) : string ; -/////*53*/ private foo ( ns : any ) { -/////*54*/ return ns.toString ( ) ; -/////*55*/ } -/////*56*/} -//// -/////*57*/ class e { -/////*58*/ private foo ( s : string ) : string ; -/////*59*/ private foo ( n : number ) : string ; -/////*60*/ private foo ( ns : any ) { -/////*61*/ return ns.toString ( ) ; -/////*62*/ } -/////*63*/} -format.document(); -goTo.marker("1"); -verify.currentLineContentIs("class a {"); -goTo.marker("2"); -verify.currentLineContentIs(" constructor(n: number);"); -goTo.marker("3"); -verify.currentLineContentIs(" constructor(s: string);"); -goTo.marker("4"); -verify.currentLineContentIs(" constructor(ns: any) {"); -goTo.marker("5"); -verify.currentLineContentIs(" }"); -goTo.marker("6"); -verify.currentLineContentIs(" public pgF() { }"); -goTo.marker("7"); -verify.currentLineContentIs(" public pv;"); -goTo.marker("8"); -verify.currentLineContentIs(" public get d() {"); -goTo.marker("9"); -verify.currentLineContentIs(" return 30;"); -goTo.marker("10"); -verify.currentLineContentIs(" }"); -goTo.marker("11"); -verify.currentLineContentIs(" public set d(number) {"); -goTo.marker("12"); -verify.currentLineContentIs(" }"); -goTo.marker("13"); -verify.currentLineContentIs(" public static get p2() {"); -goTo.marker("14"); -verify.currentLineContentIs(" return { x: 30, y: 40 };"); -goTo.marker("15"); -verify.currentLineContentIs(" }"); -goTo.marker("16"); -verify.currentLineContentIs(" private static d2() {"); -goTo.marker("17"); -verify.currentLineContentIs(" }"); -goTo.marker("18"); -verify.currentLineContentIs(" private static get p3() {"); -goTo.marker("19"); -verify.currentLineContentIs(' return "string";'); -goTo.marker("20"); -verify.currentLineContentIs(" }"); -goTo.marker("21"); -verify.currentLineContentIs(" private pv3;"); -goTo.marker("22"); -verify.currentLineContentIs(" private foo(n: number): string;"); -goTo.marker("23"); -verify.currentLineContentIs(" private foo(s: string): string;"); -goTo.marker("24"); -verify.currentLineContentIs(" private foo(ns: any) {"); -goTo.marker("25"); -verify.currentLineContentIs(" return ns.toString();"); -goTo.marker("26"); -verify.currentLineContentIs(" }"); -goTo.marker("27"); -verify.currentLineContentIs("}"); -goTo.marker("28"); -verify.currentLineContentIs("class b extends a {"); -goTo.marker("29"); -verify.currentLineContentIs("}"); -goTo.marker("30"); -verify.currentLineContentIs("class m1b {"); -goTo.marker("31"); -verify.currentLineContentIs("}"); -goTo.marker("32"); -verify.currentLineContentIs("interface m1ib {"); -goTo.marker("33"); -verify.currentLineContentIs("}"); -goTo.marker("34"); -verify.currentLineContentIs("class c extends m1b {"); -goTo.marker("35"); -verify.currentLineContentIs("}"); -goTo.marker("36"); -verify.currentLineContentIs("class ib2 implements m1ib {"); -goTo.marker("37"); -verify.currentLineContentIs("}"); -goTo.marker("38"); -verify.currentLineContentIs("declare class aAmbient {"); -goTo.marker("39"); -verify.currentLineContentIs(" constructor(n: number);"); -goTo.marker("40"); -verify.currentLineContentIs(" constructor(s: string);"); -goTo.marker("41"); -verify.currentLineContentIs(" public pgF(): void;"); -goTo.marker("42"); -verify.currentLineContentIs(" public pv;"); -goTo.marker("43"); -verify.currentLineContentIs(" public d: number;"); -goTo.marker("44"); -verify.currentLineContentIs(" static p2: { x: number; y: number; };"); -goTo.marker("45"); -verify.currentLineContentIs(" static d2();"); -goTo.marker("46"); -verify.currentLineContentIs(" static p3;"); -goTo.marker("47"); -verify.currentLineContentIs(" private pv3;"); -goTo.marker("48"); -verify.currentLineContentIs(" private foo(s);"); -goTo.marker("49"); -verify.currentLineContentIs("}"); -goTo.marker("50"); -verify.currentLineContentIs("class d {"); -goTo.marker("51"); -verify.currentLineContentIs(" private foo(n: number): string;"); -goTo.marker("52"); -verify.currentLineContentIs(" private foo(s: string): string;"); -goTo.marker("53"); -verify.currentLineContentIs(" private foo(ns: any) {"); -goTo.marker("54"); -verify.currentLineContentIs(" return ns.toString();"); -goTo.marker("55"); -verify.currentLineContentIs(" }"); -goTo.marker("56"); -verify.currentLineContentIs("}"); -goTo.marker("57"); -verify.currentLineContentIs("class e {"); -goTo.marker("58"); -verify.currentLineContentIs(" private foo(s: string): string;"); -goTo.marker("59"); -verify.currentLineContentIs(" private foo(n: number): string;"); -goTo.marker("60"); -verify.currentLineContentIs(" private foo(ns: any) {"); -goTo.marker("61"); -verify.currentLineContentIs(" return ns.toString();"); -goTo.marker("62"); -verify.currentLineContentIs(" }"); -goTo.marker("63"); +/// + +/////*1*/ class a { +/////*2*/ constructor ( n : number ) ; +/////*3*/ constructor ( s : string ) ; +/////*4*/ constructor ( ns : any ) { +//// +/////*5*/ } +//// +/////*6*/ public pgF ( ) { } +//// +/////*7*/ public pv ; +/////*8*/ public get d ( ) { +/////*9*/ return 30 ; +/////*10*/ } +/////*11*/ public set d ( number ) { +/////*12*/ } +//// +/////*13*/ public static get p2 ( ) { +/////*14*/ return { x : 30 , y : 40 } ; +/////*15*/ } +//// +/////*16*/ private static d2 ( ) { +/////*17*/ } +/////*18*/ private static get p3 ( ) { +/////*19*/ return "string" ; +/////*20*/ } +/////*21*/ private pv3 ; +//// +/////*22*/ private foo ( n : number ) : string ; +/////*23*/ private foo ( s : string ) : string ; +/////*24*/ private foo ( ns : any ) { +/////*25*/ return ns.toString ( ) ; +/////*26*/ } +/////*27*/} +//// +/////*28*/ class b extends a { +/////*29*/} +//// +/////*30*/ class m1b { +//// +/////*31*/} +//// +/////*32*/ interface m1ib { +//// +/////*33*/ } +/////*34*/ class c extends m1b { +/////*35*/} +//// +/////*36*/ class ib2 implements m1ib { +/////*37*/} +//// +/////*38*/ declare class aAmbient { +/////*39*/ constructor ( n : number ) ; +/////*40*/ constructor ( s : string ) ; +/////*41*/ public pgF ( ) : void ; +/////*42*/ public pv ; +/////*43*/ public d : number ; +/////*44*/ static p2 : { x : number ; y : number ; } ; +/////*45*/ static d2 ( ) ; +/////*46*/ static p3 ; +/////*47*/ private pv3 ; +/////*48*/ private foo ( s ) ; +/////*49*/} +//// +/////*50*/ class d { +/////*51*/ private foo ( n : number ) : string ; +/////*52*/ private foo ( s : string ) : string ; +/////*53*/ private foo ( ns : any ) { +/////*54*/ return ns.toString ( ) ; +/////*55*/ } +/////*56*/} +//// +/////*57*/ class e { +/////*58*/ private foo ( s : string ) : string ; +/////*59*/ private foo ( n : number ) : string ; +/////*60*/ private foo ( ns : any ) { +/////*61*/ return ns.toString ( ) ; +/////*62*/ } +/////*63*/} +format.document(); +goTo.marker("1"); +verify.currentLineContentIs("class a {"); +goTo.marker("2"); +verify.currentLineContentIs(" constructor(n: number);"); +goTo.marker("3"); +verify.currentLineContentIs(" constructor(s: string);"); +goTo.marker("4"); +verify.currentLineContentIs(" constructor(ns: any) {"); +goTo.marker("5"); +verify.currentLineContentIs(" }"); +goTo.marker("6"); +verify.currentLineContentIs(" public pgF() { }"); +goTo.marker("7"); +verify.currentLineContentIs(" public pv;"); +goTo.marker("8"); +verify.currentLineContentIs(" public get d() {"); +goTo.marker("9"); +verify.currentLineContentIs(" return 30;"); +goTo.marker("10"); +verify.currentLineContentIs(" }"); +goTo.marker("11"); +verify.currentLineContentIs(" public set d(number) {"); +goTo.marker("12"); +verify.currentLineContentIs(" }"); +goTo.marker("13"); +verify.currentLineContentIs(" public static get p2() {"); +goTo.marker("14"); +verify.currentLineContentIs(" return { x: 30, y: 40 };"); +goTo.marker("15"); +verify.currentLineContentIs(" }"); +goTo.marker("16"); +verify.currentLineContentIs(" private static d2() {"); +goTo.marker("17"); +verify.currentLineContentIs(" }"); +goTo.marker("18"); +verify.currentLineContentIs(" private static get p3() {"); +goTo.marker("19"); +verify.currentLineContentIs(' return "string";'); +goTo.marker("20"); +verify.currentLineContentIs(" }"); +goTo.marker("21"); +verify.currentLineContentIs(" private pv3;"); +goTo.marker("22"); +verify.currentLineContentIs(" private foo(n: number): string;"); +goTo.marker("23"); +verify.currentLineContentIs(" private foo(s: string): string;"); +goTo.marker("24"); +verify.currentLineContentIs(" private foo(ns: any) {"); +goTo.marker("25"); +verify.currentLineContentIs(" return ns.toString();"); +goTo.marker("26"); +verify.currentLineContentIs(" }"); +goTo.marker("27"); +verify.currentLineContentIs("}"); +goTo.marker("28"); +verify.currentLineContentIs("class b extends a {"); +goTo.marker("29"); +verify.currentLineContentIs("}"); +goTo.marker("30"); +verify.currentLineContentIs("class m1b {"); +goTo.marker("31"); +verify.currentLineContentIs("}"); +goTo.marker("32"); +verify.currentLineContentIs("interface m1ib {"); +goTo.marker("33"); +verify.currentLineContentIs("}"); +goTo.marker("34"); +verify.currentLineContentIs("class c extends m1b {"); +goTo.marker("35"); +verify.currentLineContentIs("}"); +goTo.marker("36"); +verify.currentLineContentIs("class ib2 implements m1ib {"); +goTo.marker("37"); +verify.currentLineContentIs("}"); +goTo.marker("38"); +verify.currentLineContentIs("declare class aAmbient {"); +goTo.marker("39"); +verify.currentLineContentIs(" constructor(n: number);"); +goTo.marker("40"); +verify.currentLineContentIs(" constructor(s: string);"); +goTo.marker("41"); +verify.currentLineContentIs(" public pgF(): void;"); +goTo.marker("42"); +verify.currentLineContentIs(" public pv;"); +goTo.marker("43"); +verify.currentLineContentIs(" public d: number;"); +goTo.marker("44"); +verify.currentLineContentIs(" static p2: { x: number; y: number; };"); +goTo.marker("45"); +verify.currentLineContentIs(" static d2();"); +goTo.marker("46"); +verify.currentLineContentIs(" static p3;"); +goTo.marker("47"); +verify.currentLineContentIs(" private pv3;"); +goTo.marker("48"); +verify.currentLineContentIs(" private foo(s);"); +goTo.marker("49"); +verify.currentLineContentIs("}"); +goTo.marker("50"); +verify.currentLineContentIs("class d {"); +goTo.marker("51"); +verify.currentLineContentIs(" private foo(n: number): string;"); +goTo.marker("52"); +verify.currentLineContentIs(" private foo(s: string): string;"); +goTo.marker("53"); +verify.currentLineContentIs(" private foo(ns: any) {"); +goTo.marker("54"); +verify.currentLineContentIs(" return ns.toString();"); +goTo.marker("55"); +verify.currentLineContentIs(" }"); +goTo.marker("56"); +verify.currentLineContentIs("}"); +goTo.marker("57"); +verify.currentLineContentIs("class e {"); +goTo.marker("58"); +verify.currentLineContentIs(" private foo(s: string): string;"); +goTo.marker("59"); +verify.currentLineContentIs(" private foo(n: number): string;"); +goTo.marker("60"); +verify.currentLineContentIs(" private foo(ns: any) {"); +goTo.marker("61"); +verify.currentLineContentIs(" return ns.toString();"); +goTo.marker("62"); +verify.currentLineContentIs(" }"); +goTo.marker("63"); verify.currentLineContentIs("}"); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingOnClosingBracket.ts b/tests/cases/fourslash/formattingOnClosingBracket.ts index babfd39b90..0890975331 100644 --- a/tests/cases/fourslash/formattingOnClosingBracket.ts +++ b/tests/cases/fourslash/formattingOnClosingBracket.ts @@ -1,91 +1,91 @@ -/// - -////function f( ) {/*1*/ -////var x = 3;/*2*/ -//// var z = 2 ;/*3*/ -//// a = z ++ - 2 * x ;/*4*/ -//// for ( ; ; ) {/*5*/ -//// a+=(g +g)*a%t;/*6*/ -//// b -- ;/*7*/ -////}/*8*/ -//// -//// switch ( a )/*9*/ -//// { -//// case 1 : {/*10*/ -//// a ++ ;/*11*/ -//// b--;/*12*/ -//// if(a===a)/*13*/ -//// return;/*14*/ -//// else/*15*/ -//// { -//// for(a in b)/*16*/ -//// if(a!=a)/*17*/ -//// { -//// for(a in b)/*18*/ -//// { -////a++;/*19*/ -//// }/*20*/ -//// }/*21*/ -//// }/*22*/ -//// }/*23*/ -//// default:/*24*/ -//// break;/*25*/ -//// }/*26*/ -////}/*27*/ - -format.setOption("InsertSpaceAfterSemicolonInForStatements", true); -format.document(); -goTo.marker("1"); -verify.currentLineContentIs("function f() {"); -goTo.marker("2"); -verify.currentLineContentIs(" var x = 3;"); -goTo.marker("3"); -verify.currentLineContentIs(" var z = 2;"); -goTo.marker("4"); -verify.currentLineContentIs(" a = z++ - 2 * x;"); -goTo.marker("5"); -verify.currentLineContentIs(" for (; ;) {"); -goTo.marker("6"); -verify.currentLineContentIs(" a += (g + g) * a % t;"); -goTo.marker("7"); -verify.currentLineContentIs(" b--;"); -goTo.marker("8"); -verify.currentLineContentIs(" }"); -goTo.marker("9"); -verify.currentLineContentIs(" switch (a) {"); -goTo.marker("10"); -verify.currentLineContentIs(" case 1: {"); -goTo.marker("11"); -verify.currentLineContentIs(" a++;"); -goTo.marker("12"); -verify.currentLineContentIs(" b--;"); -goTo.marker("13"); -verify.currentLineContentIs(" if (a === a)"); -goTo.marker("14"); -verify.currentLineContentIs(" return;"); -goTo.marker("15"); -verify.currentLineContentIs(" else {"); -goTo.marker("16"); -verify.currentLineContentIs(" for (a in b)"); -goTo.marker("17"); -verify.currentLineContentIs(" if (a != a) {"); -goTo.marker("18"); -verify.currentLineContentIs(" for (a in b) {"); -goTo.marker("19"); -verify.currentLineContentIs(" a++;"); -goTo.marker("20"); -verify.currentLineContentIs(" }"); -goTo.marker("21"); -verify.currentLineContentIs(" }"); -goTo.marker("22"); -verify.currentLineContentIs(" }"); -goTo.marker("23"); -verify.currentLineContentIs(" }"); -goTo.marker("24"); -verify.currentLineContentIs(" default:"); -goTo.marker("25"); -verify.currentLineContentIs(" break;"); -goTo.marker("26"); -verify.currentLineContentIs(" }"); -goTo.marker("27"); +/// + +////function f( ) {/*1*/ +////var x = 3;/*2*/ +//// var z = 2 ;/*3*/ +//// a = z ++ - 2 * x ;/*4*/ +//// for ( ; ; ) {/*5*/ +//// a+=(g +g)*a%t;/*6*/ +//// b -- ;/*7*/ +////}/*8*/ +//// +//// switch ( a )/*9*/ +//// { +//// case 1 : {/*10*/ +//// a ++ ;/*11*/ +//// b--;/*12*/ +//// if(a===a)/*13*/ +//// return;/*14*/ +//// else/*15*/ +//// { +//// for(a in b)/*16*/ +//// if(a!=a)/*17*/ +//// { +//// for(a in b)/*18*/ +//// { +////a++;/*19*/ +//// }/*20*/ +//// }/*21*/ +//// }/*22*/ +//// }/*23*/ +//// default:/*24*/ +//// break;/*25*/ +//// }/*26*/ +////}/*27*/ + +format.setOption("InsertSpaceAfterSemicolonInForStatements", true); +format.document(); +goTo.marker("1"); +verify.currentLineContentIs("function f() {"); +goTo.marker("2"); +verify.currentLineContentIs(" var x = 3;"); +goTo.marker("3"); +verify.currentLineContentIs(" var z = 2;"); +goTo.marker("4"); +verify.currentLineContentIs(" a = z++ - 2 * x;"); +goTo.marker("5"); +verify.currentLineContentIs(" for (; ;) {"); +goTo.marker("6"); +verify.currentLineContentIs(" a += (g + g) * a % t;"); +goTo.marker("7"); +verify.currentLineContentIs(" b--;"); +goTo.marker("8"); +verify.currentLineContentIs(" }"); +goTo.marker("9"); +verify.currentLineContentIs(" switch (a) {"); +goTo.marker("10"); +verify.currentLineContentIs(" case 1: {"); +goTo.marker("11"); +verify.currentLineContentIs(" a++;"); +goTo.marker("12"); +verify.currentLineContentIs(" b--;"); +goTo.marker("13"); +verify.currentLineContentIs(" if (a === a)"); +goTo.marker("14"); +verify.currentLineContentIs(" return;"); +goTo.marker("15"); +verify.currentLineContentIs(" else {"); +goTo.marker("16"); +verify.currentLineContentIs(" for (a in b)"); +goTo.marker("17"); +verify.currentLineContentIs(" if (a != a) {"); +goTo.marker("18"); +verify.currentLineContentIs(" for (a in b) {"); +goTo.marker("19"); +verify.currentLineContentIs(" a++;"); +goTo.marker("20"); +verify.currentLineContentIs(" }"); +goTo.marker("21"); +verify.currentLineContentIs(" }"); +goTo.marker("22"); +verify.currentLineContentIs(" }"); +goTo.marker("23"); +verify.currentLineContentIs(" }"); +goTo.marker("24"); +verify.currentLineContentIs(" default:"); +goTo.marker("25"); +verify.currentLineContentIs(" break;"); +goTo.marker("26"); +verify.currentLineContentIs(" }"); +goTo.marker("27"); verify.currentLineContentIs("}"); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingOnCommaOperator.ts b/tests/cases/fourslash/formattingOnCommaOperator.ts index 00626f992c..1b8ec5087a 100644 --- a/tests/cases/fourslash/formattingOnCommaOperator.ts +++ b/tests/cases/fourslash/formattingOnCommaOperator.ts @@ -1,13 +1,13 @@ -/// - -////var v1 = ((1, 2, 3), 4, 5, (6, 7));/*1*/ -////function f1() { -//// var a = 1; -//// return a, v1, a;/*2*/ -////} - -format.document(); -goTo.marker("1"); -verify.currentLineContentIs("var v1 = ((1, 2, 3), 4, 5, (6, 7));"); -goTo.marker("2"); +/// + +////var v1 = ((1, 2, 3), 4, 5, (6, 7));/*1*/ +////function f1() { +//// var a = 1; +//// return a, v1, a;/*2*/ +////} + +format.document(); +goTo.marker("1"); +verify.currentLineContentIs("var v1 = ((1, 2, 3), 4, 5, (6, 7));"); +goTo.marker("2"); verify.currentLineContentIs(" return a, v1, a;"); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingOnDoWhileNoSemicolon.ts b/tests/cases/fourslash/formattingOnDoWhileNoSemicolon.ts index ccc00b587e..848f994392 100644 --- a/tests/cases/fourslash/formattingOnDoWhileNoSemicolon.ts +++ b/tests/cases/fourslash/formattingOnDoWhileNoSemicolon.ts @@ -1,19 +1,19 @@ -/// - -/////*2*/do { -/////*3*/ for (var i = 0; i < 10; i++) -/////*4*/ i -= 2 -/////*5*/ }/*1*/while (1 !== 1) -goTo.marker("1"); -edit.insert("\r\n"); -verify.currentLineContentIs("while (1 !== 1)"); -goTo.marker("2"); -verify.currentLineContentIs("do {"); -goTo.marker("3"); -verify.currentLineContentIs(" for (var i = 0; i < 10; i++)"); -goTo.marker("4"); -verify.currentLineContentIs(" i -= 2"); -goTo.marker("5"); -//bug 718362 expected result : "}" , actual result : " }" -//verify.currentLineContentIs("}"); +/// + +/////*2*/do { +/////*3*/ for (var i = 0; i < 10; i++) +/////*4*/ i -= 2 +/////*5*/ }/*1*/while (1 !== 1) +goTo.marker("1"); +edit.insert("\r\n"); +verify.currentLineContentIs("while (1 !== 1)"); +goTo.marker("2"); +verify.currentLineContentIs("do {"); +goTo.marker("3"); +verify.currentLineContentIs(" for (var i = 0; i < 10; i++)"); +goTo.marker("4"); +verify.currentLineContentIs(" i -= 2"); +goTo.marker("5"); +//bug 718362 expected result : "}" , actual result : " }" +//verify.currentLineContentIs("}"); verify.currentLineContentIs("}"); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingOnDocumentReadyFunction.ts b/tests/cases/fourslash/formattingOnDocumentReadyFunction.ts index 17a7f34c98..ecc42c0532 100644 --- a/tests/cases/fourslash/formattingOnDocumentReadyFunction.ts +++ b/tests/cases/fourslash/formattingOnDocumentReadyFunction.ts @@ -1,12 +1,12 @@ -/// - -/////*1*/$ ( document ) . ready ( function ( ) { -/////*2*/ alert ( 'i am ready' ) ; -/////*3*/ } ); -format.document(); -goTo.marker("1"); -verify.currentLineContentIs("$(document).ready(function() {"); -goTo.marker("2"); -verify.currentLineContentIs(" alert('i am ready');"); -goTo.marker("3"); +/// + +/////*1*/$ ( document ) . ready ( function ( ) { +/////*2*/ alert ( 'i am ready' ) ; +/////*3*/ } ); +format.document(); +goTo.marker("1"); +verify.currentLineContentIs("$(document).ready(function() {"); +goTo.marker("2"); +verify.currentLineContentIs(" alert('i am ready');"); +goTo.marker("3"); verify.currentLineContentIs("});"); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingOnEmptyInterfaceLiteral.ts b/tests/cases/fourslash/formattingOnEmptyInterfaceLiteral.ts index 5710357c37..bd82ed698c 100644 --- a/tests/cases/fourslash/formattingOnEmptyInterfaceLiteral.ts +++ b/tests/cases/fourslash/formattingOnEmptyInterfaceLiteral.ts @@ -1,25 +1,25 @@ -/// - -/////*1*/ function foo ( x : { } ) { } -//// -/////*2*/foo ( { } ) ; -//// -//// -//// -/////*3*/ interface bar { -/////*4*/ x : { } ; -/////*5*/ y : ( ) => { } ; -/////*6*/ } -format.document(); -goTo.marker("1"); -verify.currentLineContentIs("function foo(x: {}) { }"); -goTo.marker("2"); -verify.currentLineContentIs("foo({});"); -goTo.marker("3"); -verify.currentLineContentIs("interface bar {"); -goTo.marker("4"); -verify.currentLineContentIs(" x: {};"); -goTo.marker("5"); -verify.currentLineContentIs(" y: () => {};"); -goTo.marker("6"); +/// + +/////*1*/ function foo ( x : { } ) { } +//// +/////*2*/foo ( { } ) ; +//// +//// +//// +/////*3*/ interface bar { +/////*4*/ x : { } ; +/////*5*/ y : ( ) => { } ; +/////*6*/ } +format.document(); +goTo.marker("1"); +verify.currentLineContentIs("function foo(x: {}) { }"); +goTo.marker("2"); +verify.currentLineContentIs("foo({});"); +goTo.marker("3"); +verify.currentLineContentIs("interface bar {"); +goTo.marker("4"); +verify.currentLineContentIs(" x: {};"); +goTo.marker("5"); +verify.currentLineContentIs(" y: () => {};"); +goTo.marker("6"); verify.currentLineContentIs("}"); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingOnInvalidCodes.ts b/tests/cases/fourslash/formattingOnInvalidCodes.ts index c42412628b..c5d7102024 100644 --- a/tests/cases/fourslash/formattingOnInvalidCodes.ts +++ b/tests/cases/fourslash/formattingOnInvalidCodes.ts @@ -1,273 +1,273 @@ -/// - -/////*1*/var a;var c , b;var $d -/////*2*/var $e -/////*3*/var f -/////*4*/a++;b++; -//// -/////*5*/function f ( ) { -/////*6*/ for (i = 0; i < 10; i++) { -/////*7*/ k = abc + 123 ^ d; -/////*8*/ a = XYZ[m (a[b[c][d]])]; -/////*9*/ break; -//// -/////*10*/ switch ( variable){ -/////*11*/ case 1: abc += 425; -/////*12*/break; -/////*13*/case 404 : a [x--/2]%=3 ; -/////*14*/ break ; -/////*15*/ case vari : v[--x ] *=++y*( m + n / k[z]); -/////*16*/ for (a in b){ -/////*17*/ for (a = 0; a < 10; ++a) { -/////*18*/ a++;--a; -/////*19*/ if (a == b) { -/////*20*/ a++;b--; -/////*21*/ } -/////*22*/else -/////*23*/if (a == c){ -/////*24*/++a; -/////*25*/(--c)+=d; -/////*26*/$c = $a + --$b; -/////*27*/} -/////*28*/if (a == b) -/////*29*/if (a != b) { -/////*30*/ if (a !== b) -/////*31*/ if (a === b) -/////*32*/ --a; -/////*33*/ else -/////*34*/ --a; -/////*35*/ else { -/////*36*/ a--;++b; -/////*37*/a++ -/////*38*/ } -/////*39*/ } -/////*40*/ } -/////*41*/ for (x in y) { -/////*42*/m-=m; -/////*43*/k=1+2+3+4; -/////*44*/} -/////*45*/} -/////*46*/ break; -//// -/////*47*/ } -/////*48*/ } -/////*49*/ var a ={b:function(){}}; -/////*50*/ return {a:1,b:2} -/////*51*/} -//// -/////*52*/var z = 1; -/////*53*/ for (i = 0; i < 10; i++) -/////*54*/ for (j = 0; j < 10; j++) -/////*55*/for (k = 0; k < 10; ++k) { -/////*56*/z++; -/////*57*/} -//// -/////*58*/for (k = 0; k < 10; k += 2) { -/////*59*/z++; -/////*60*/} -//// -/////*61*/ $(document).ready (); -//// -//// -/////*62*/ function pageLoad() { -/////*63*/ $('#TextBox1' ) . unbind ( ) ; -/////*64*/$('#TextBox1' ) . datepicker ( ) ; -/////*65*/} -//// -/////*66*/ function pageLoad ( ) { -/////*67*/ var webclass=[ -/////*68*/ { 'student' :/*69*/ -/////*70*/ { 'id': '1', 'name': 'Linda Jones', 'legacySkill': 'Access, VB 5.0' } -/////*71*/ } , -/////*72*/{ 'student':/*73*/ -/////*74*/{'id':'2','name':'Adam Davidson','legacySkill':'Cobol,MainFrame'} -/////*75*/} , -/////*76*/ { 'student':/*77*/ -/////*78*/{ 'id':'3','name':'Charles Boyer' ,'legacySkill':'HTML, XML'} -/////*79*/} -/////*80*/ ]; -//// -/////*81*/$create(Sys.UI.DataView,{data:webclass},null,null,$get('SList')); -//// -/////*82*/} -//// -/////*83*/$( document ).ready(function(){ -/////*84*/alert('hello'); -/////*85*/ } ) ; -format.document(); -goTo.marker("1"); -verify.currentLineContentIs("var a; var c, b; var $d"); -goTo.marker("2"); -verify.currentLineContentIs("var $e"); -goTo.marker("3"); -verify.currentLineContentIs("var f"); -goTo.marker("4"); -verify.currentLineContentIs("a++; b++;"); -goTo.marker("5"); -verify.currentLineContentIs("function f() {"); -goTo.marker("6"); -verify.currentLineContentIs(" for (i = 0; i < 10; i++) {"); -goTo.marker("7"); -verify.currentLineContentIs(" k = abc + 123 ^ d;"); -goTo.marker("8"); -verify.currentLineContentIs(" a = XYZ[m(a[b[c][d]])];"); -goTo.marker("9"); -verify.currentLineContentIs(" break;"); -goTo.marker("10"); -verify.currentLineContentIs(" switch (variable) {"); -goTo.marker("11"); -verify.currentLineContentIs(" case 1: abc += 425;"); -goTo.marker("12"); -verify.currentLineContentIs(" break;"); -goTo.marker("13"); -verify.currentLineContentIs(" case 404: a[x-- / 2] %= 3;"); -goTo.marker("14"); -verify.currentLineContentIs(" break;"); -goTo.marker("15"); -verify.currentLineContentIs(" case vari: v[--x] *= ++y * (m + n / k[z]);"); -goTo.marker("16"); -verify.currentLineContentIs(" for (a in b) {"); -goTo.marker("17"); -verify.currentLineContentIs(" for (a = 0; a < 10; ++a) {"); -goTo.marker("18"); -verify.currentLineContentIs(" a++; --a;"); -goTo.marker("19"); -verify.currentLineContentIs(" if (a == b) {"); -goTo.marker("20"); -verify.currentLineContentIs(" a++; b--;"); -goTo.marker("21"); -verify.currentLineContentIs(" }"); -goTo.marker("22"); -verify.currentLineContentIs(" else"); -goTo.marker("23"); -verify.currentLineContentIs(" if (a == c) {"); -goTo.marker("24"); -verify.currentLineContentIs(" ++a;"); -goTo.marker("25"); -verify.currentLineContentIs(" (--c) += d;"); -goTo.marker("26"); -verify.currentLineContentIs(" $c = $a + --$b;"); -goTo.marker("27"); -verify.currentLineContentIs(" }"); -goTo.marker("28"); -verify.currentLineContentIs(" if (a == b)"); -goTo.marker("29"); -verify.currentLineContentIs(" if (a != b) {"); -goTo.marker("30"); -verify.currentLineContentIs(" if (a !== b)"); -goTo.marker("31"); -verify.currentLineContentIs(" if (a === b)"); -goTo.marker("32"); -verify.currentLineContentIs(" --a;"); -goTo.marker("33"); -verify.currentLineContentIs(" else"); -goTo.marker("34"); -verify.currentLineContentIs(" --a;"); -goTo.marker("35"); -verify.currentLineContentIs(" else {"); -goTo.marker("36"); -verify.currentLineContentIs(" a--; ++b;"); -goTo.marker("37"); -verify.currentLineContentIs(" a++"); -goTo.marker("38"); -//bug 697788 expect result : " }", actual result : " }" -//verify.currentLineContentIs(" }"); -verify.currentLineContentIs(" }"); -goTo.marker("39"); -verify.currentLineContentIs(" }"); -goTo.marker("40"); -verify.currentLineContentIs(" }"); -goTo.marker("41"); -verify.currentLineContentIs(" for (x in y) {"); -goTo.marker("42"); -verify.currentLineContentIs(" m -= m;"); -goTo.marker("43"); -verify.currentLineContentIs(" k = 1 + 2 + 3 + 4;"); -goTo.marker("44"); -verify.currentLineContentIs(" }"); -goTo.marker("45"); -verify.currentLineContentIs(" }"); -goTo.marker("46"); -verify.currentLineContentIs(" break;"); -goTo.marker("47"); -verify.currentLineContentIs(" }"); -goTo.marker("48"); -verify.currentLineContentIs(" }"); -goTo.marker("49"); -//bug 704204 expect result : " var a = { b: function () { } };", actual result : " var a = { b: function() { } };" -//verify.currentLineContentIs(" var a = { b: function () { } };"); -verify.currentLineContentIs(" var a = { b: function() { } };"); -goTo.marker("50"); -verify.currentLineContentIs(" return { a: 1, b: 2 }"); -goTo.marker("51"); -verify.currentLineContentIs("}"); -goTo.marker("52"); -verify.currentLineContentIs("var z = 1;"); -goTo.marker("53"); -verify.currentLineContentIs("for (i = 0; i < 10; i++)"); -goTo.marker("54"); -verify.currentLineContentIs(" for (j = 0; j < 10; j++)"); -goTo.marker("55"); -verify.currentLineContentIs(" for (k = 0; k < 10; ++k) {"); -goTo.marker("56"); -verify.currentLineContentIs(" z++;"); -goTo.marker("57"); -verify.currentLineContentIs(" }"); -goTo.marker("58"); -verify.currentLineContentIs("for (k = 0; k < 10; k += 2) {"); -goTo.marker("59"); -verify.currentLineContentIs(" z++;"); -goTo.marker("60"); -verify.currentLineContentIs("}"); -goTo.marker("61"); -verify.currentLineContentIs("$(document).ready();"); -goTo.marker("62"); -verify.currentLineContentIs("function pageLoad() {"); -goTo.marker("63"); -verify.currentLineContentIs(" $('#TextBox1').unbind();"); -goTo.marker("64"); -verify.currentLineContentIs(" $('#TextBox1').datepicker();"); -goTo.marker("65"); -verify.currentLineContentIs("}"); -goTo.marker("66"); -verify.currentLineContentIs("function pageLoad() {"); -goTo.marker("67"); -verify.currentLineContentIs(" var webclass = ["); -goTo.marker("68"); -verify.currentLineContentIs(" {"); -goTo.marker("69"); -verify.currentLineContentIs(" 'student':"); -goTo.marker("70"); -verify.currentLineContentIs(" { 'id': '1', 'name': 'Linda Jones', 'legacySkill': 'Access, VB 5.0' }"); -goTo.marker("71"); -verify.currentLineContentIs(" },"); -goTo.marker("72"); -verify.currentLineContentIs(" {"); -goTo.marker("73"); -verify.currentLineContentIs(" 'student':"); -goTo.marker("74"); -verify.currentLineContentIs(" { 'id': '2', 'name': 'Adam Davidson', 'legacySkill': 'Cobol,MainFrame' }"); -goTo.marker("75"); -verify.currentLineContentIs(" },"); -goTo.marker("76"); -verify.currentLineContentIs(" {"); -goTo.marker("77"); -verify.currentLineContentIs(" 'student':"); -goTo.marker("78"); -verify.currentLineContentIs(" { 'id': '3', 'name': 'Charles Boyer', 'legacySkill': 'HTML, XML' }"); -goTo.marker("79"); -verify.currentLineContentIs(" }"); -goTo.marker("80"); -verify.currentLineContentIs(" ];"); -goTo.marker("81"); -verify.currentLineContentIs(" $create(Sys.UI.DataView, { data: webclass }, null, null, $get('SList'));"); -goTo.marker("82"); -verify.currentLineContentIs("}"); -goTo.marker("83"); -//bug 704204 expect result : "$(document).ready(function () {", actual result : "$(document).ready(function() " -//verify.currentLineContentIs("$(document).ready(function () {"); -verify.currentLineContentIs("$(document).ready(function() {"); -goTo.marker("84"); -verify.currentLineContentIs(" alert('hello');"); -goTo.marker("85"); +/// + +/////*1*/var a;var c , b;var $d +/////*2*/var $e +/////*3*/var f +/////*4*/a++;b++; +//// +/////*5*/function f ( ) { +/////*6*/ for (i = 0; i < 10; i++) { +/////*7*/ k = abc + 123 ^ d; +/////*8*/ a = XYZ[m (a[b[c][d]])]; +/////*9*/ break; +//// +/////*10*/ switch ( variable){ +/////*11*/ case 1: abc += 425; +/////*12*/break; +/////*13*/case 404 : a [x--/2]%=3 ; +/////*14*/ break ; +/////*15*/ case vari : v[--x ] *=++y*( m + n / k[z]); +/////*16*/ for (a in b){ +/////*17*/ for (a = 0; a < 10; ++a) { +/////*18*/ a++;--a; +/////*19*/ if (a == b) { +/////*20*/ a++;b--; +/////*21*/ } +/////*22*/else +/////*23*/if (a == c){ +/////*24*/++a; +/////*25*/(--c)+=d; +/////*26*/$c = $a + --$b; +/////*27*/} +/////*28*/if (a == b) +/////*29*/if (a != b) { +/////*30*/ if (a !== b) +/////*31*/ if (a === b) +/////*32*/ --a; +/////*33*/ else +/////*34*/ --a; +/////*35*/ else { +/////*36*/ a--;++b; +/////*37*/a++ +/////*38*/ } +/////*39*/ } +/////*40*/ } +/////*41*/ for (x in y) { +/////*42*/m-=m; +/////*43*/k=1+2+3+4; +/////*44*/} +/////*45*/} +/////*46*/ break; +//// +/////*47*/ } +/////*48*/ } +/////*49*/ var a ={b:function(){}}; +/////*50*/ return {a:1,b:2} +/////*51*/} +//// +/////*52*/var z = 1; +/////*53*/ for (i = 0; i < 10; i++) +/////*54*/ for (j = 0; j < 10; j++) +/////*55*/for (k = 0; k < 10; ++k) { +/////*56*/z++; +/////*57*/} +//// +/////*58*/for (k = 0; k < 10; k += 2) { +/////*59*/z++; +/////*60*/} +//// +/////*61*/ $(document).ready (); +//// +//// +/////*62*/ function pageLoad() { +/////*63*/ $('#TextBox1' ) . unbind ( ) ; +/////*64*/$('#TextBox1' ) . datepicker ( ) ; +/////*65*/} +//// +/////*66*/ function pageLoad ( ) { +/////*67*/ var webclass=[ +/////*68*/ { 'student' :/*69*/ +/////*70*/ { 'id': '1', 'name': 'Linda Jones', 'legacySkill': 'Access, VB 5.0' } +/////*71*/ } , +/////*72*/{ 'student':/*73*/ +/////*74*/{'id':'2','name':'Adam Davidson','legacySkill':'Cobol,MainFrame'} +/////*75*/} , +/////*76*/ { 'student':/*77*/ +/////*78*/{ 'id':'3','name':'Charles Boyer' ,'legacySkill':'HTML, XML'} +/////*79*/} +/////*80*/ ]; +//// +/////*81*/$create(Sys.UI.DataView,{data:webclass},null,null,$get('SList')); +//// +/////*82*/} +//// +/////*83*/$( document ).ready(function(){ +/////*84*/alert('hello'); +/////*85*/ } ) ; +format.document(); +goTo.marker("1"); +verify.currentLineContentIs("var a; var c, b; var $d"); +goTo.marker("2"); +verify.currentLineContentIs("var $e"); +goTo.marker("3"); +verify.currentLineContentIs("var f"); +goTo.marker("4"); +verify.currentLineContentIs("a++; b++;"); +goTo.marker("5"); +verify.currentLineContentIs("function f() {"); +goTo.marker("6"); +verify.currentLineContentIs(" for (i = 0; i < 10; i++) {"); +goTo.marker("7"); +verify.currentLineContentIs(" k = abc + 123 ^ d;"); +goTo.marker("8"); +verify.currentLineContentIs(" a = XYZ[m(a[b[c][d]])];"); +goTo.marker("9"); +verify.currentLineContentIs(" break;"); +goTo.marker("10"); +verify.currentLineContentIs(" switch (variable) {"); +goTo.marker("11"); +verify.currentLineContentIs(" case 1: abc += 425;"); +goTo.marker("12"); +verify.currentLineContentIs(" break;"); +goTo.marker("13"); +verify.currentLineContentIs(" case 404: a[x-- / 2] %= 3;"); +goTo.marker("14"); +verify.currentLineContentIs(" break;"); +goTo.marker("15"); +verify.currentLineContentIs(" case vari: v[--x] *= ++y * (m + n / k[z]);"); +goTo.marker("16"); +verify.currentLineContentIs(" for (a in b) {"); +goTo.marker("17"); +verify.currentLineContentIs(" for (a = 0; a < 10; ++a) {"); +goTo.marker("18"); +verify.currentLineContentIs(" a++; --a;"); +goTo.marker("19"); +verify.currentLineContentIs(" if (a == b) {"); +goTo.marker("20"); +verify.currentLineContentIs(" a++; b--;"); +goTo.marker("21"); +verify.currentLineContentIs(" }"); +goTo.marker("22"); +verify.currentLineContentIs(" else"); +goTo.marker("23"); +verify.currentLineContentIs(" if (a == c) {"); +goTo.marker("24"); +verify.currentLineContentIs(" ++a;"); +goTo.marker("25"); +verify.currentLineContentIs(" (--c) += d;"); +goTo.marker("26"); +verify.currentLineContentIs(" $c = $a + --$b;"); +goTo.marker("27"); +verify.currentLineContentIs(" }"); +goTo.marker("28"); +verify.currentLineContentIs(" if (a == b)"); +goTo.marker("29"); +verify.currentLineContentIs(" if (a != b) {"); +goTo.marker("30"); +verify.currentLineContentIs(" if (a !== b)"); +goTo.marker("31"); +verify.currentLineContentIs(" if (a === b)"); +goTo.marker("32"); +verify.currentLineContentIs(" --a;"); +goTo.marker("33"); +verify.currentLineContentIs(" else"); +goTo.marker("34"); +verify.currentLineContentIs(" --a;"); +goTo.marker("35"); +verify.currentLineContentIs(" else {"); +goTo.marker("36"); +verify.currentLineContentIs(" a--; ++b;"); +goTo.marker("37"); +verify.currentLineContentIs(" a++"); +goTo.marker("38"); +//bug 697788 expect result : " }", actual result : " }" +//verify.currentLineContentIs(" }"); +verify.currentLineContentIs(" }"); +goTo.marker("39"); +verify.currentLineContentIs(" }"); +goTo.marker("40"); +verify.currentLineContentIs(" }"); +goTo.marker("41"); +verify.currentLineContentIs(" for (x in y) {"); +goTo.marker("42"); +verify.currentLineContentIs(" m -= m;"); +goTo.marker("43"); +verify.currentLineContentIs(" k = 1 + 2 + 3 + 4;"); +goTo.marker("44"); +verify.currentLineContentIs(" }"); +goTo.marker("45"); +verify.currentLineContentIs(" }"); +goTo.marker("46"); +verify.currentLineContentIs(" break;"); +goTo.marker("47"); +verify.currentLineContentIs(" }"); +goTo.marker("48"); +verify.currentLineContentIs(" }"); +goTo.marker("49"); +//bug 704204 expect result : " var a = { b: function () { } };", actual result : " var a = { b: function() { } };" +//verify.currentLineContentIs(" var a = { b: function () { } };"); +verify.currentLineContentIs(" var a = { b: function() { } };"); +goTo.marker("50"); +verify.currentLineContentIs(" return { a: 1, b: 2 }"); +goTo.marker("51"); +verify.currentLineContentIs("}"); +goTo.marker("52"); +verify.currentLineContentIs("var z = 1;"); +goTo.marker("53"); +verify.currentLineContentIs("for (i = 0; i < 10; i++)"); +goTo.marker("54"); +verify.currentLineContentIs(" for (j = 0; j < 10; j++)"); +goTo.marker("55"); +verify.currentLineContentIs(" for (k = 0; k < 10; ++k) {"); +goTo.marker("56"); +verify.currentLineContentIs(" z++;"); +goTo.marker("57"); +verify.currentLineContentIs(" }"); +goTo.marker("58"); +verify.currentLineContentIs("for (k = 0; k < 10; k += 2) {"); +goTo.marker("59"); +verify.currentLineContentIs(" z++;"); +goTo.marker("60"); +verify.currentLineContentIs("}"); +goTo.marker("61"); +verify.currentLineContentIs("$(document).ready();"); +goTo.marker("62"); +verify.currentLineContentIs("function pageLoad() {"); +goTo.marker("63"); +verify.currentLineContentIs(" $('#TextBox1').unbind();"); +goTo.marker("64"); +verify.currentLineContentIs(" $('#TextBox1').datepicker();"); +goTo.marker("65"); +verify.currentLineContentIs("}"); +goTo.marker("66"); +verify.currentLineContentIs("function pageLoad() {"); +goTo.marker("67"); +verify.currentLineContentIs(" var webclass = ["); +goTo.marker("68"); +verify.currentLineContentIs(" {"); +goTo.marker("69"); +verify.currentLineContentIs(" 'student':"); +goTo.marker("70"); +verify.currentLineContentIs(" { 'id': '1', 'name': 'Linda Jones', 'legacySkill': 'Access, VB 5.0' }"); +goTo.marker("71"); +verify.currentLineContentIs(" },"); +goTo.marker("72"); +verify.currentLineContentIs(" {"); +goTo.marker("73"); +verify.currentLineContentIs(" 'student':"); +goTo.marker("74"); +verify.currentLineContentIs(" { 'id': '2', 'name': 'Adam Davidson', 'legacySkill': 'Cobol,MainFrame' }"); +goTo.marker("75"); +verify.currentLineContentIs(" },"); +goTo.marker("76"); +verify.currentLineContentIs(" {"); +goTo.marker("77"); +verify.currentLineContentIs(" 'student':"); +goTo.marker("78"); +verify.currentLineContentIs(" { 'id': '3', 'name': 'Charles Boyer', 'legacySkill': 'HTML, XML' }"); +goTo.marker("79"); +verify.currentLineContentIs(" }"); +goTo.marker("80"); +verify.currentLineContentIs(" ];"); +goTo.marker("81"); +verify.currentLineContentIs(" $create(Sys.UI.DataView, { data: webclass }, null, null, $get('SList'));"); +goTo.marker("82"); +verify.currentLineContentIs("}"); +goTo.marker("83"); +//bug 704204 expect result : "$(document).ready(function () {", actual result : "$(document).ready(function() " +//verify.currentLineContentIs("$(document).ready(function () {"); +verify.currentLineContentIs("$(document).ready(function() {"); +goTo.marker("84"); +verify.currentLineContentIs(" alert('hello');"); +goTo.marker("85"); verify.currentLineContentIs("});"); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingOnModuleIndentation.ts b/tests/cases/fourslash/formattingOnModuleIndentation.ts index 374c5a7c95..776e2fa1bd 100644 --- a/tests/cases/fourslash/formattingOnModuleIndentation.ts +++ b/tests/cases/fourslash/formattingOnModuleIndentation.ts @@ -1,13 +1,13 @@ -/// - -//// module Foo { -//// export module A . B . C { }/**/ -//// } - -format.document(); -goTo.bof(); -verify.currentLineContentIs("module Foo {"); -goTo.marker(); -verify.currentLineContentIs(" export module A.B.C { }"); -goTo.eof(); +/// + +//// module Foo { +//// export module A . B . C { }/**/ +//// } + +format.document(); +goTo.bof(); +verify.currentLineContentIs("module Foo {"); +goTo.marker(); +verify.currentLineContentIs(" export module A.B.C { }"); +goTo.eof(); verify.currentLineContentIs("}"); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingOnNestedDoWhileByEnter.ts b/tests/cases/fourslash/formattingOnNestedDoWhileByEnter.ts index 17b91dbd80..e35f4a333b 100644 --- a/tests/cases/fourslash/formattingOnNestedDoWhileByEnter.ts +++ b/tests/cases/fourslash/formattingOnNestedDoWhileByEnter.ts @@ -1,23 +1,23 @@ -/// - -/////*2*/do{ -/////*3*/do/*1*/{ -/////*4*/do{ -/////*5*/}while(a!==b) -/////*6*/}while(a!==b) -/////*7*/}while(a!==b) -goTo.marker("1"); -edit.insert("\r\n"); -verify.currentLineContentIs(" {"); -goTo.marker("2"); -verify.currentLineContentIs("do{"); -goTo.marker("3"); -verify.currentLineContentIs(" do"); -goTo.marker("4"); -verify.currentLineContentIs("do{"); -goTo.marker("5"); -verify.currentLineContentIs("}while(a!==b)"); -goTo.marker("6"); -verify.currentLineContentIs("}while(a!==b)"); -goTo.marker("7"); +/// + +/////*2*/do{ +/////*3*/do/*1*/{ +/////*4*/do{ +/////*5*/}while(a!==b) +/////*6*/}while(a!==b) +/////*7*/}while(a!==b) +goTo.marker("1"); +edit.insert("\r\n"); +verify.currentLineContentIs(" {"); +goTo.marker("2"); +verify.currentLineContentIs("do{"); +goTo.marker("3"); +verify.currentLineContentIs(" do"); +goTo.marker("4"); +verify.currentLineContentIs("do{"); +goTo.marker("5"); +verify.currentLineContentIs("}while(a!==b)"); +goTo.marker("6"); +verify.currentLineContentIs("}while(a!==b)"); +goTo.marker("7"); verify.currentLineContentIs("}while(a!==b)"); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingOnNestedStatements.ts b/tests/cases/fourslash/formattingOnNestedStatements.ts index 547fcfa27e..13c957af45 100644 --- a/tests/cases/fourslash/formattingOnNestedStatements.ts +++ b/tests/cases/fourslash/formattingOnNestedStatements.ts @@ -1,14 +1,14 @@ -/// - -////{ -/////*1*/{ -/////*3*/test -////}/*2*/ -////} -format.selection("1", "2"); -goTo.marker("1"); -verify.currentLineContentIs(" {"); -goTo.marker("3"); -verify.currentLineContentIs(" test"); -goTo.marker("2"); +/// + +////{ +/////*1*/{ +/////*3*/test +////}/*2*/ +////} +format.selection("1", "2"); +goTo.marker("1"); +verify.currentLineContentIs(" {"); +goTo.marker("3"); +verify.currentLineContentIs(" test"); +goTo.marker("2"); verify.currentLineContentIs(" }"); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingOnObjectLiteral.ts b/tests/cases/fourslash/formattingOnObjectLiteral.ts index b8db4dd45d..5b8d5f9cb5 100644 --- a/tests/cases/fourslash/formattingOnObjectLiteral.ts +++ b/tests/cases/fourslash/formattingOnObjectLiteral.ts @@ -1,85 +1,85 @@ -/// - -////var x = /*1*/{foo:/*2*/ 1, -////bar: "tt",/*3*/ -////boo: /*4*/1 + 5}/*5*/; -//// -////var x2 = /*6*/{foo/*7*/: 1, -////bar: /*8*/"tt",boo:1+5}/*9*/; -//// -////function Foo() {/*10*/ -////var typeICalc = {/*11*/ -////clear: {/*12*/ -////"()": [1, 2, 3]/*13*/ -////}/*14*/ -////}/*15*/ -////}/*16*/ -//// -////// Rule for object literal members for the "value" of the memebr to follow the indent/*17*/ -////// of the member, i.e. the relative position of the value is maintained when the member/*18*/ -////// is indented./*19*/ -////var x2 = {/*20*/ -//// foo:/*21*/ -////3,/*22*/ -//// 'bar':/*23*/ -//// { a: 1, b : 2}/*24*/ -////};/*25*/ -//// -////var x={ };/*26*/ -////var y = {};/*27*/ - -format.document(); -goTo.marker("1"); -verify.currentLineContentIs("var x = {"); -goTo.marker("2"); -verify.currentLineContentIs(" foo: 1,"); -goTo.marker("3"); -verify.currentLineContentIs(" bar: \"tt\","); -goTo.marker("4"); -verify.currentLineContentIs(" boo: 1 + 5"); -goTo.marker("5"); -verify.currentLineContentIs("};"); -goTo.marker("6"); -verify.currentLineContentIs("var x2 = {"); -goTo.marker("7"); -verify.currentLineContentIs(" foo: 1,"); -goTo.marker("8"); -verify.currentLineContentIs(" bar: \"tt\", boo: 1 + 5"); -goTo.marker("9"); -verify.currentLineContentIs("};"); -goTo.marker("10"); -verify.currentLineContentIs("function Foo() {"); -goTo.marker("11"); -verify.currentLineContentIs(" var typeICalc = {"); -goTo.marker("12"); -verify.currentLineContentIs(" clear: {"); -goTo.marker("13"); -verify.currentLineContentIs(" \"()\": [1, 2, 3]"); -goTo.marker("14"); -verify.currentLineContentIs(" }"); -goTo.marker("15"); -verify.currentLineContentIs(" }"); -goTo.marker("16"); -verify.currentLineContentIs("}"); -goTo.marker("17"); -verify.currentLineContentIs("// Rule for object literal members for the \"value\" of the memebr to follow the indent"); -goTo.marker("18"); -verify.currentLineContentIs("// of the member, i.e. the relative position of the value is maintained when the member"); -goTo.marker("19"); -verify.currentLineContentIs("// is indented."); -goTo.marker("20"); -verify.currentLineContentIs("var x2 = {"); -goTo.marker("21"); -verify.currentLineContentIs(" foo:"); -goTo.marker("22"); -verify.currentLineContentIs(" 3,"); -goTo.marker("23"); -verify.currentLineContentIs(" 'bar':"); -goTo.marker("24"); -verify.currentLineContentIs(" { a: 1, b: 2 }"); -goTo.marker("25"); -verify.currentLineContentIs("};"); -goTo.marker("26"); -verify.currentLineContentIs("var x = {};"); -goTo.marker("27"); +/// + +////var x = /*1*/{foo:/*2*/ 1, +////bar: "tt",/*3*/ +////boo: /*4*/1 + 5}/*5*/; +//// +////var x2 = /*6*/{foo/*7*/: 1, +////bar: /*8*/"tt",boo:1+5}/*9*/; +//// +////function Foo() {/*10*/ +////var typeICalc = {/*11*/ +////clear: {/*12*/ +////"()": [1, 2, 3]/*13*/ +////}/*14*/ +////}/*15*/ +////}/*16*/ +//// +////// Rule for object literal members for the "value" of the memebr to follow the indent/*17*/ +////// of the member, i.e. the relative position of the value is maintained when the member/*18*/ +////// is indented./*19*/ +////var x2 = {/*20*/ +//// foo:/*21*/ +////3,/*22*/ +//// 'bar':/*23*/ +//// { a: 1, b : 2}/*24*/ +////};/*25*/ +//// +////var x={ };/*26*/ +////var y = {};/*27*/ + +format.document(); +goTo.marker("1"); +verify.currentLineContentIs("var x = {"); +goTo.marker("2"); +verify.currentLineContentIs(" foo: 1,"); +goTo.marker("3"); +verify.currentLineContentIs(" bar: \"tt\","); +goTo.marker("4"); +verify.currentLineContentIs(" boo: 1 + 5"); +goTo.marker("5"); +verify.currentLineContentIs("};"); +goTo.marker("6"); +verify.currentLineContentIs("var x2 = {"); +goTo.marker("7"); +verify.currentLineContentIs(" foo: 1,"); +goTo.marker("8"); +verify.currentLineContentIs(" bar: \"tt\", boo: 1 + 5"); +goTo.marker("9"); +verify.currentLineContentIs("};"); +goTo.marker("10"); +verify.currentLineContentIs("function Foo() {"); +goTo.marker("11"); +verify.currentLineContentIs(" var typeICalc = {"); +goTo.marker("12"); +verify.currentLineContentIs(" clear: {"); +goTo.marker("13"); +verify.currentLineContentIs(" \"()\": [1, 2, 3]"); +goTo.marker("14"); +verify.currentLineContentIs(" }"); +goTo.marker("15"); +verify.currentLineContentIs(" }"); +goTo.marker("16"); +verify.currentLineContentIs("}"); +goTo.marker("17"); +verify.currentLineContentIs("// Rule for object literal members for the \"value\" of the memebr to follow the indent"); +goTo.marker("18"); +verify.currentLineContentIs("// of the member, i.e. the relative position of the value is maintained when the member"); +goTo.marker("19"); +verify.currentLineContentIs("// is indented."); +goTo.marker("20"); +verify.currentLineContentIs("var x2 = {"); +goTo.marker("21"); +verify.currentLineContentIs(" foo:"); +goTo.marker("22"); +verify.currentLineContentIs(" 3,"); +goTo.marker("23"); +verify.currentLineContentIs(" 'bar':"); +goTo.marker("24"); +verify.currentLineContentIs(" { a: 1, b: 2 }"); +goTo.marker("25"); +verify.currentLineContentIs("};"); +goTo.marker("26"); +verify.currentLineContentIs("var x = {};"); +goTo.marker("27"); verify.currentLineContentIs("var y = {};"); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingOnOpenBraceOfFunctions.ts b/tests/cases/fourslash/formattingOnOpenBraceOfFunctions.ts index 6414362a4c..a7905dc938 100644 --- a/tests/cases/fourslash/formattingOnOpenBraceOfFunctions.ts +++ b/tests/cases/fourslash/formattingOnOpenBraceOfFunctions.ts @@ -1,10 +1,10 @@ -/// - -/////**/function T2_y() -////{ -////Plugin.T1.t1_x(); -////} - -format.document(); -goTo.marker(); +/// + +/////**/function T2_y() +////{ +////Plugin.T1.t1_x(); +////} + +format.document(); +goTo.marker(); verify.currentLineContentIs("function T2_y() {"); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingOnSemiColon.ts b/tests/cases/fourslash/formattingOnSemiColon.ts index b560055a76..027bb637ed 100644 --- a/tests/cases/fourslash/formattingOnSemiColon.ts +++ b/tests/cases/fourslash/formattingOnSemiColon.ts @@ -1,7 +1,7 @@ -/// - -////var a=b+c^d-e*++f - -goTo.eof(); -edit.insert(";"); +/// + +////var a=b+c^d-e*++f + +goTo.eof(); +edit.insert(";"); verify.currentFileContentIs("var a = b + c ^ d - e * ++f;"); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingOnSingleLineBlocks.ts b/tests/cases/fourslash/formattingOnSingleLineBlocks.ts index b832fa7222..fc1a6818b9 100644 --- a/tests/cases/fourslash/formattingOnSingleLineBlocks.ts +++ b/tests/cases/fourslash/formattingOnSingleLineBlocks.ts @@ -1,16 +1,16 @@ -/// - -/////*1*/class C -////{}/*2*/ -/////*3*/if (true) -////{}/*4*/ - -format.document(); -goTo.marker("1"); -verify.currentLineContentIs("class C"); -goTo.marker("2"); -verify.currentLineContentIs("{ }"); -goTo.marker("3"); -verify.currentLineContentIs("if (true)"); -goTo.marker("4"); +/// + +/////*1*/class C +////{}/*2*/ +/////*3*/if (true) +////{}/*4*/ + +format.document(); +goTo.marker("1"); +verify.currentLineContentIs("class C"); +goTo.marker("2"); +verify.currentLineContentIs("{ }"); +goTo.marker("3"); +verify.currentLineContentIs("if (true)"); +goTo.marker("4"); verify.currentLineContentIs("{ }"); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingOnStatementsWithNoSemicolon.ts b/tests/cases/fourslash/formattingOnStatementsWithNoSemicolon.ts index c49152f501..e33298a5a3 100644 --- a/tests/cases/fourslash/formattingOnStatementsWithNoSemicolon.ts +++ b/tests/cases/fourslash/formattingOnStatementsWithNoSemicolon.ts @@ -1,170 +1,170 @@ -/// - -/////*1*/do -//// { var a/*2*/ -/////*3*/} while (1) -/////*4*/function f() { -/////*5*/ var s = 1 -/////*6*/ } -/////*7*/switch (t) { -/////*8*/ case 1: -/////*9*/{ -/////*10*/test -/////*11*/} -/////*12*/} -/////*13*/do{do{do{}while(a!==b)}while(a!==b)}while(a!==b) -/////*14*/do{ -/////*15*/do{ -/////*16*/do{ -/////*17*/}while(a!==b) -/////*18*/}while(a!==b) -/////*19*/}while(a!==b) -/////*20*/for(var i=0;i<10;i++){ -/////*21*/for(var j=0;j<10;j++){ -/////*22*/j-=i -/////*23*/}/*24*/} -/////*25*/function foo() { -/////*26*/try { -/////*27*/x+=2 -/////*28*/} -/////*29*/catch( e){ -/////*30*/x+=2 -/////*31*/}finally { -/////*32*/x+=2 -/////*33*/} -/////*34*/} -/////*35*/do { var a } while (1) -//// foo(function (file) {/*49*/ -//// return 0/*50*/ -//// }).then(function (doc) {/*51*/ -//// return 1/*52*/ -//// });/*53*/ -/////*54*/if(1) -/////*55*/if(1) -/////*56*/x++ -/////*57*/else -/////*58*/if(1) -/////*59*/x+=2 -/////*60*/else -/////*61*/x+=2 -//// -//// -//// -/////*62*/; -//// do do do do/*63*/ -//// test;/*64*/ -//// while (0)/*65*/ -//// while (0)/*66*/ -//// while (0)/*67*/ -//// while (0)/*68*/ -format.document(); -goTo.marker("1"); -verify.currentLineContentIs("do {"); -goTo.marker("2"); -verify.currentLineContentIs(" var a"); -goTo.marker("3"); -verify.currentLineContentIs("} while (1)"); -goTo.marker("4"); -verify.currentLineContentIs("function f() {"); -goTo.marker("5"); -verify.currentLineContentIs(" var s = 1"); -goTo.marker("6"); -verify.currentLineContentIs("}"); -goTo.marker("7"); -verify.currentLineContentIs("switch (t) {"); -goTo.marker("8"); -verify.currentLineContentIs(" case 1:"); -goTo.marker("9"); -verify.currentLineContentIs(" {"); -goTo.marker("10"); -verify.currentLineContentIs(" test"); -goTo.marker("11"); -verify.currentLineContentIs(" }"); -goTo.marker("12"); -verify.currentLineContentIs("}"); -goTo.marker("13"); -verify.currentLineContentIs("do { do { do { } while (a !== b) } while (a !== b) } while (a !== b)"); -goTo.marker("14"); -verify.currentLineContentIs("do {"); -goTo.marker("15"); -verify.currentLineContentIs(" do {"); -goTo.marker("16"); -verify.currentLineContentIs(" do {"); -goTo.marker("17"); -verify.currentLineContentIs(" } while (a !== b)"); -goTo.marker("18"); -verify.currentLineContentIs(" } while (a !== b)"); -goTo.marker("19"); -verify.currentLineContentIs("} while (a !== b)"); -goTo.marker("20"); -verify.currentLineContentIs("for (var i = 0; i < 10; i++) {"); -goTo.marker("21"); -verify.currentLineContentIs(" for (var j = 0; j < 10; j++) {"); -goTo.marker("22"); -verify.currentLineContentIs(" j -= i"); -goTo.marker("23"); -verify.currentLineContentIs(" }"); -goTo.marker("24"); -verify.currentLineContentIs(" }"); -goTo.marker("25"); -verify.currentLineContentIs("function foo() {"); -goTo.marker("26"); -verify.currentLineContentIs(" try {"); -goTo.marker("27"); -verify.currentLineContentIs(" x += 2"); -goTo.marker("28"); -verify.currentLineContentIs(" }"); -goTo.marker("29"); -verify.currentLineContentIs(" catch (e) {"); -goTo.marker("30"); -verify.currentLineContentIs(" x += 2"); -goTo.marker("31"); -verify.currentLineContentIs(" } finally {"); -goTo.marker("32"); -verify.currentLineContentIs(" x += 2"); -goTo.marker("33"); -verify.currentLineContentIs(" }"); -goTo.marker("34"); -verify.currentLineContentIs("}"); -goTo.marker("35"); -verify.currentLineContentIs("do { var a } while (1)"); -goTo.marker("49"); -verify.currentLineContentIs("foo(function(file) {"); -goTo.marker("50"); -verify.currentLineContentIs(" return 0"); -goTo.marker("51"); -verify.currentLineContentIs("}).then(function(doc) {"); -goTo.marker("52"); -verify.currentLineContentIs(" return 1"); -goTo.marker("53"); -verify.currentLineContentIs("});"); -goTo.marker("54"); -verify.currentLineContentIs("if (1)"); -goTo.marker("55"); -verify.currentLineContentIs(" if (1)"); -goTo.marker("56"); -verify.currentLineContentIs(" x++"); -goTo.marker("57"); -verify.currentLineContentIs(" else"); -goTo.marker("58"); -verify.currentLineContentIs(" if (1)"); -goTo.marker("59"); -verify.currentLineContentIs(" x += 2"); -goTo.marker("60"); -verify.currentLineContentIs(" else"); -goTo.marker("61"); -verify.currentLineContentIs(" x += 2"); -goTo.marker("62"); -verify.currentLineContentIs(" ;"); -goTo.marker("63"); -verify.currentLineContentIs("do do do do"); -goTo.marker("64"); -verify.currentLineContentIs(" test;"); -goTo.marker("65"); -verify.currentLineContentIs("while (0)"); -goTo.marker("66"); -verify.currentLineContentIs("while (0)"); -goTo.marker("67"); -verify.currentLineContentIs("while (0)"); -goTo.marker("68"); -verify.currentLineContentIs("while (0)"); +/// + +/////*1*/do +//// { var a/*2*/ +/////*3*/} while (1) +/////*4*/function f() { +/////*5*/ var s = 1 +/////*6*/ } +/////*7*/switch (t) { +/////*8*/ case 1: +/////*9*/{ +/////*10*/test +/////*11*/} +/////*12*/} +/////*13*/do{do{do{}while(a!==b)}while(a!==b)}while(a!==b) +/////*14*/do{ +/////*15*/do{ +/////*16*/do{ +/////*17*/}while(a!==b) +/////*18*/}while(a!==b) +/////*19*/}while(a!==b) +/////*20*/for(var i=0;i<10;i++){ +/////*21*/for(var j=0;j<10;j++){ +/////*22*/j-=i +/////*23*/}/*24*/} +/////*25*/function foo() { +/////*26*/try { +/////*27*/x+=2 +/////*28*/} +/////*29*/catch( e){ +/////*30*/x+=2 +/////*31*/}finally { +/////*32*/x+=2 +/////*33*/} +/////*34*/} +/////*35*/do { var a } while (1) +//// foo(function (file) {/*49*/ +//// return 0/*50*/ +//// }).then(function (doc) {/*51*/ +//// return 1/*52*/ +//// });/*53*/ +/////*54*/if(1) +/////*55*/if(1) +/////*56*/x++ +/////*57*/else +/////*58*/if(1) +/////*59*/x+=2 +/////*60*/else +/////*61*/x+=2 +//// +//// +//// +/////*62*/; +//// do do do do/*63*/ +//// test;/*64*/ +//// while (0)/*65*/ +//// while (0)/*66*/ +//// while (0)/*67*/ +//// while (0)/*68*/ +format.document(); +goTo.marker("1"); +verify.currentLineContentIs("do {"); +goTo.marker("2"); +verify.currentLineContentIs(" var a"); +goTo.marker("3"); +verify.currentLineContentIs("} while (1)"); +goTo.marker("4"); +verify.currentLineContentIs("function f() {"); +goTo.marker("5"); +verify.currentLineContentIs(" var s = 1"); +goTo.marker("6"); +verify.currentLineContentIs("}"); +goTo.marker("7"); +verify.currentLineContentIs("switch (t) {"); +goTo.marker("8"); +verify.currentLineContentIs(" case 1:"); +goTo.marker("9"); +verify.currentLineContentIs(" {"); +goTo.marker("10"); +verify.currentLineContentIs(" test"); +goTo.marker("11"); +verify.currentLineContentIs(" }"); +goTo.marker("12"); +verify.currentLineContentIs("}"); +goTo.marker("13"); +verify.currentLineContentIs("do { do { do { } while (a !== b) } while (a !== b) } while (a !== b)"); +goTo.marker("14"); +verify.currentLineContentIs("do {"); +goTo.marker("15"); +verify.currentLineContentIs(" do {"); +goTo.marker("16"); +verify.currentLineContentIs(" do {"); +goTo.marker("17"); +verify.currentLineContentIs(" } while (a !== b)"); +goTo.marker("18"); +verify.currentLineContentIs(" } while (a !== b)"); +goTo.marker("19"); +verify.currentLineContentIs("} while (a !== b)"); +goTo.marker("20"); +verify.currentLineContentIs("for (var i = 0; i < 10; i++) {"); +goTo.marker("21"); +verify.currentLineContentIs(" for (var j = 0; j < 10; j++) {"); +goTo.marker("22"); +verify.currentLineContentIs(" j -= i"); +goTo.marker("23"); +verify.currentLineContentIs(" }"); +goTo.marker("24"); +verify.currentLineContentIs(" }"); +goTo.marker("25"); +verify.currentLineContentIs("function foo() {"); +goTo.marker("26"); +verify.currentLineContentIs(" try {"); +goTo.marker("27"); +verify.currentLineContentIs(" x += 2"); +goTo.marker("28"); +verify.currentLineContentIs(" }"); +goTo.marker("29"); +verify.currentLineContentIs(" catch (e) {"); +goTo.marker("30"); +verify.currentLineContentIs(" x += 2"); +goTo.marker("31"); +verify.currentLineContentIs(" } finally {"); +goTo.marker("32"); +verify.currentLineContentIs(" x += 2"); +goTo.marker("33"); +verify.currentLineContentIs(" }"); +goTo.marker("34"); +verify.currentLineContentIs("}"); +goTo.marker("35"); +verify.currentLineContentIs("do { var a } while (1)"); +goTo.marker("49"); +verify.currentLineContentIs("foo(function(file) {"); +goTo.marker("50"); +verify.currentLineContentIs(" return 0"); +goTo.marker("51"); +verify.currentLineContentIs("}).then(function(doc) {"); +goTo.marker("52"); +verify.currentLineContentIs(" return 1"); +goTo.marker("53"); +verify.currentLineContentIs("});"); +goTo.marker("54"); +verify.currentLineContentIs("if (1)"); +goTo.marker("55"); +verify.currentLineContentIs(" if (1)"); +goTo.marker("56"); +verify.currentLineContentIs(" x++"); +goTo.marker("57"); +verify.currentLineContentIs(" else"); +goTo.marker("58"); +verify.currentLineContentIs(" if (1)"); +goTo.marker("59"); +verify.currentLineContentIs(" x += 2"); +goTo.marker("60"); +verify.currentLineContentIs(" else"); +goTo.marker("61"); +verify.currentLineContentIs(" x += 2"); +goTo.marker("62"); +verify.currentLineContentIs(" ;"); +goTo.marker("63"); +verify.currentLineContentIs("do do do do"); +goTo.marker("64"); +verify.currentLineContentIs(" test;"); +goTo.marker("65"); +verify.currentLineContentIs("while (0)"); +goTo.marker("66"); +verify.currentLineContentIs("while (0)"); +goTo.marker("67"); +verify.currentLineContentIs("while (0)"); +goTo.marker("68"); +verify.currentLineContentIs("while (0)"); diff --git a/tests/cases/fourslash/formattingOnTabAfterCloseCurly.ts b/tests/cases/fourslash/formattingOnTabAfterCloseCurly.ts index 2e7c344d22..e3d9490be0 100644 --- a/tests/cases/fourslash/formattingOnTabAfterCloseCurly.ts +++ b/tests/cases/fourslash/formattingOnTabAfterCloseCurly.ts @@ -1,32 +1,32 @@ -/// - -////module Tools {/*1*/ -//// export enum NodeType {/*2*/ -//// Error,/*3*/ -//// Comment,/*4*/ -//// } /*5*/ -//// export enum foob/*6*/ -//// { -//// Blah=1, Bleah=2/*7*/ -//// }/*8*/ -////}/*9*/ - -format.document(); -goTo.marker("1"); -verify.currentLineContentIs("module Tools {"); -goTo.marker("2"); -verify.currentLineContentIs(" export enum NodeType {"); -goTo.marker("3"); -verify.currentLineContentIs(" Error,"); -goTo.marker("4"); -verify.currentLineContentIs(" Comment,"); -goTo.marker("5"); -verify.currentLineContentIs(" }"); -goTo.marker("6"); -verify.currentLineContentIs(" export enum foob {"); -goTo.marker("7"); -verify.currentLineContentIs(" Blah = 1, Bleah = 2"); -goTo.marker("8"); -verify.currentLineContentIs(" }"); -goTo.marker("9"); +/// + +////module Tools {/*1*/ +//// export enum NodeType {/*2*/ +//// Error,/*3*/ +//// Comment,/*4*/ +//// } /*5*/ +//// export enum foob/*6*/ +//// { +//// Blah=1, Bleah=2/*7*/ +//// }/*8*/ +////}/*9*/ + +format.document(); +goTo.marker("1"); +verify.currentLineContentIs("module Tools {"); +goTo.marker("2"); +verify.currentLineContentIs(" export enum NodeType {"); +goTo.marker("3"); +verify.currentLineContentIs(" Error,"); +goTo.marker("4"); +verify.currentLineContentIs(" Comment,"); +goTo.marker("5"); +verify.currentLineContentIs(" }"); +goTo.marker("6"); +verify.currentLineContentIs(" export enum foob {"); +goTo.marker("7"); +verify.currentLineContentIs(" Blah = 1, Bleah = 2"); +goTo.marker("8"); +verify.currentLineContentIs(" }"); +goTo.marker("9"); verify.currentLineContentIs("}"); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingSkippedTokens.ts b/tests/cases/fourslash/formattingSkippedTokens.ts index 094612c893..3b8ec47bf3 100644 --- a/tests/cases/fourslash/formattingSkippedTokens.ts +++ b/tests/cases/fourslash/formattingSkippedTokens.ts @@ -19,4 +19,4 @@ verify.currentLineContentIs('4 +:5'); goTo.marker('4'); verify.currentLineContentIs(' : T) { }'); goTo.marker('5'); -verify.currentLineContentIs('var x ='); +verify.currentLineContentIs('var x ='); diff --git a/tests/cases/fourslash/formattingSpacesAfterConstructor.ts b/tests/cases/fourslash/formattingSpacesAfterConstructor.ts index fa46feedb4..8df762def2 100644 --- a/tests/cases/fourslash/formattingSpacesAfterConstructor.ts +++ b/tests/cases/fourslash/formattingSpacesAfterConstructor.ts @@ -1,6 +1,6 @@ -/// - -/////*1*/class test { constructor () { } } -format.document(); -goTo.marker("1"); +/// + +/////*1*/class test { constructor () { } } +format.document(); +goTo.marker("1"); verify.currentLineContentIs("class test { constructor() { } }"); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingWithEnterAfterMultilineString.ts b/tests/cases/fourslash/formattingWithEnterAfterMultilineString.ts index 9c35768d86..e64c7be049 100644 --- a/tests/cases/fourslash/formattingWithEnterAfterMultilineString.ts +++ b/tests/cases/fourslash/formattingWithEnterAfterMultilineString.ts @@ -1,15 +1,15 @@ -/// - -////class Greeter3 { -//// stop() { -//// /*2*/var s = "hello\ -////"/*1*/ -//// } -////} - -goTo.marker("1"); -edit.insert("\r\n"); -// We actually need to verify smart (virtual) identation here rather than actual identation. Fourslash support is required. -verify.indentationIs(8); -goTo.marker("2"); +/// + +////class Greeter3 { +//// stop() { +//// /*2*/var s = "hello\ +////"/*1*/ +//// } +////} + +goTo.marker("1"); +edit.insert("\r\n"); +// We actually need to verify smart (virtual) identation here rather than actual identation. Fourslash support is required. +verify.indentationIs(8); +goTo.marker("2"); verify.currentLineContentIs(" var s = \"hello\\"); \ No newline at end of file diff --git a/tests/cases/fourslash/functionOverloadCount.ts b/tests/cases/fourslash/functionOverloadCount.ts index 00856dcb24..71dad1d9d7 100644 --- a/tests/cases/fourslash/functionOverloadCount.ts +++ b/tests/cases/fourslash/functionOverloadCount.ts @@ -9,7 +9,7 @@ //// } ////} ////var i = new C1; -////i.attr(/*1*/ - -goTo.marker('1'); +////i.attr(/*1*/ + +goTo.marker('1'); verify.signatureHelpCountIs(3); \ No newline at end of file diff --git a/tests/cases/fourslash/functionRenamingErrorRecovery.ts b/tests/cases/fourslash/functionRenamingErrorRecovery.ts index 0c39356093..0a120022ee 100644 --- a/tests/cases/fourslash/functionRenamingErrorRecovery.ts +++ b/tests/cases/fourslash/functionRenamingErrorRecovery.ts @@ -1,9 +1,9 @@ -/// - -////class Foo { public bar/*1*//*2*/() { } } - -goTo.marker("1"); -edit.backspace(3); -edit.insert("Pizza"); -verify.currentLineContentIs("class Foo { public Pizza() { } }"); +/// + +////class Foo { public bar/*1*//*2*/() { } } + +goTo.marker("1"); +edit.backspace(3); +edit.insert("Pizza"); +verify.currentLineContentIs("class Foo { public Pizza() { } }"); verify.not.errorExistsAfterMarker("2"); \ No newline at end of file diff --git a/tests/cases/fourslash/genericArityEnforcementAfterEdit.ts b/tests/cases/fourslash/genericArityEnforcementAfterEdit.ts index 899a4387f9..5b107e3779 100644 --- a/tests/cases/fourslash/genericArityEnforcementAfterEdit.ts +++ b/tests/cases/fourslash/genericArityEnforcementAfterEdit.ts @@ -1,10 +1,10 @@ -/// - -//// interface G { } -//// /**/ -//// var v4: G, any>; - -verify.numberOfErrorsInCurrentFile(1); -goTo.marker(); -edit.insert(' '); -verify.numberOfErrorsInCurrentFile(1); +/// + +//// interface G { } +//// /**/ +//// var v4: G, any>; + +verify.numberOfErrorsInCurrentFile(1); +goTo.marker(); +edit.insert(' '); +verify.numberOfErrorsInCurrentFile(1); diff --git a/tests/cases/fourslash/genericRespecialization1.ts b/tests/cases/fourslash/genericRespecialization1.ts index 34eff79806..e8db5eafc4 100644 --- a/tests/cases/fourslash/genericRespecialization1.ts +++ b/tests/cases/fourslash/genericRespecialization1.ts @@ -1,75 +1,75 @@ -/// - -//// class Food { -//// private amount: number; -//// constructor(public name: string) { -//// this.amount = 100; -//// } -//// public eat(amountToEat: number): boolean { -//// this.amount -= amountToEat; -//// if (this.amount <= 0) { -//// this.amount = 0; -//// return false; -//// } -//// else { -//// return true; -//// } -//// } -//// } -//// class IceCream extends Food { -//// private isDairyFree: boolean; -//// constructor(public flavor: string) { -//// super("Ice Cream"); -//// } -//// } -//// class Cookie extends Food { -//// constructor(public flavor: string, public isGlutenFree: boolean) { -//// super("Cookie"); -//// } -//// } -//// class Slug { -//// // This is NOT a food!!! -//// } -//// class GenericMonster { -//// private name: string; -//// private age: number; -//// private isFriendly: boolean; -//// constructor(name: string, age: number, isFriendly: boolean, private food: T, public variant: V) { -//// this.name = name; -//// this.age = age; -//// this.isFriendly = isFriendly; -//// } -//// public getFood(): T { -//// return this.food; -//// } -//// public getVariant(): V { -//// return this.variant; -//// } -//// public eatFood(amountToEat: number): boolean { -//// return this.food.eat(amountToEat); -//// } -//// public sayGreeting(): string { -//// return ("My name is " + this.name + ", and my age is " + this.age + ". I enjoy eating " + this.food.name + " and my variant is " + this.variant); -//// } -//// } -//// class GenericPlanet> { -//// constructor(public name: string, public solarSystem: string, public species: T) { } -//// } -//// var cookie = new Cookie("Chocolate Chip", false); -//// var cookieMonster = new GenericMonster("Cookie Monster", 50, true, cookie, "hello"); -//// var sesameStreet = new GenericPlanet>("Sesame Street", "Alpha Centuri", cookieMonster); -//// class GenericPlanet2{ -//// constructor(public name: string, public solarSystem: string, public species: GenericMonster) { } -//// } -//// /*1*/ - -verify.numberOfErrorsInCurrentFile(0); -goTo.marker('1'); -edit.insertLine(''); -edit.insertLine(''); -verify.numberOfErrorsInCurrentFile(0); -goTo.marker('2'); -edit.deleteAtCaret("Cookie".length); -edit.insert("any"); -verify.numberOfErrorsInCurrentFile(0); +/// + +//// class Food { +//// private amount: number; +//// constructor(public name: string) { +//// this.amount = 100; +//// } +//// public eat(amountToEat: number): boolean { +//// this.amount -= amountToEat; +//// if (this.amount <= 0) { +//// this.amount = 0; +//// return false; +//// } +//// else { +//// return true; +//// } +//// } +//// } +//// class IceCream extends Food { +//// private isDairyFree: boolean; +//// constructor(public flavor: string) { +//// super("Ice Cream"); +//// } +//// } +//// class Cookie extends Food { +//// constructor(public flavor: string, public isGlutenFree: boolean) { +//// super("Cookie"); +//// } +//// } +//// class Slug { +//// // This is NOT a food!!! +//// } +//// class GenericMonster { +//// private name: string; +//// private age: number; +//// private isFriendly: boolean; +//// constructor(name: string, age: number, isFriendly: boolean, private food: T, public variant: V) { +//// this.name = name; +//// this.age = age; +//// this.isFriendly = isFriendly; +//// } +//// public getFood(): T { +//// return this.food; +//// } +//// public getVariant(): V { +//// return this.variant; +//// } +//// public eatFood(amountToEat: number): boolean { +//// return this.food.eat(amountToEat); +//// } +//// public sayGreeting(): string { +//// return ("My name is " + this.name + ", and my age is " + this.age + ". I enjoy eating " + this.food.name + " and my variant is " + this.variant); +//// } +//// } +//// class GenericPlanet> { +//// constructor(public name: string, public solarSystem: string, public species: T) { } +//// } +//// var cookie = new Cookie("Chocolate Chip", false); +//// var cookieMonster = new GenericMonster("Cookie Monster", 50, true, cookie, "hello"); +//// var sesameStreet = new GenericPlanet>("Sesame Street", "Alpha Centuri", cookieMonster); +//// class GenericPlanet2{ +//// constructor(public name: string, public solarSystem: string, public species: GenericMonster) { } +//// } +//// /*1*/ + +verify.numberOfErrorsInCurrentFile(0); +goTo.marker('1'); +edit.insertLine(''); +edit.insertLine(''); +verify.numberOfErrorsInCurrentFile(0); +goTo.marker('2'); +edit.deleteAtCaret("Cookie".length); +edit.insert("any"); +verify.numberOfErrorsInCurrentFile(0); edit.insertLine('var narnia = new GenericPlanet2('); // shouldn't crash at this point \ No newline at end of file diff --git a/tests/cases/fourslash/getDeclarationDiagnostics.ts b/tests/cases/fourslash/getDeclarationDiagnostics.ts index 693261d62b..0dcc9fea6a 100644 --- a/tests/cases/fourslash/getDeclarationDiagnostics.ts +++ b/tests/cases/fourslash/getDeclarationDiagnostics.ts @@ -1,19 +1,19 @@ -/// - -// @declaration: true -// @out: true - -// @Filename: inputFile1.ts -//// module m { -//// export class C implements I { } -//// interface I { } -//// } /*1*/ - -// @Filename: input2.ts -//// var x = "hello world"; /*2*/ - -goTo.marker("1"); -verify.numberOfErrorsInCurrentFile(1); - -goTo.marker("2"); -verify.numberOfErrorsInCurrentFile(0); +/// + +// @declaration: true +// @out: true + +// @Filename: inputFile1.ts +//// module m { +//// export class C implements I { } +//// interface I { } +//// } /*1*/ + +// @Filename: input2.ts +//// var x = "hello world"; /*2*/ + +goTo.marker("1"); +verify.numberOfErrorsInCurrentFile(1); + +goTo.marker("2"); +verify.numberOfErrorsInCurrentFile(0); diff --git a/tests/cases/fourslash/getEmitOutputDeclarationMultiFiles.ts b/tests/cases/fourslash/getEmitOutputDeclarationMultiFiles.ts index b9c7f5a0db..8148dd3960 100644 --- a/tests/cases/fourslash/getEmitOutputDeclarationMultiFiles.ts +++ b/tests/cases/fourslash/getEmitOutputDeclarationMultiFiles.ts @@ -1,22 +1,22 @@ -/// - -// @BaselineFile: getEmitOutputDeclarationMultiFiles.baseline -// @declaration: true - -// @Filename: inputFile1.ts -// @emitThisFile: true -//// var x: number = 5; -//// class Bar { -//// x : string; -//// y : number -//// } - -// @Filename: inputFile2.ts -// @emitThisFile: true -//// var x1: string = "hello world"; -//// class Foo{ -//// x : string; -//// y : number; -//// } - +/// + +// @BaselineFile: getEmitOutputDeclarationMultiFiles.baseline +// @declaration: true + +// @Filename: inputFile1.ts +// @emitThisFile: true +//// var x: number = 5; +//// class Bar { +//// x : string; +//// y : number +//// } + +// @Filename: inputFile2.ts +// @emitThisFile: true +//// var x1: string = "hello world"; +//// class Foo{ +//// x : string; +//// y : number; +//// } + verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/getEmitOutputDeclarationSingleFile.ts b/tests/cases/fourslash/getEmitOutputDeclarationSingleFile.ts index b8e9c58f5b..502e3903d7 100644 --- a/tests/cases/fourslash/getEmitOutputDeclarationSingleFile.ts +++ b/tests/cases/fourslash/getEmitOutputDeclarationSingleFile.ts @@ -1,22 +1,22 @@ -/// - -// @BaselineFile: getEmitOutputDeclarationSingleFile.baseline -// @declaration: true -// @out: declSingleFile.js - -// @Filename: inputFile1.ts -// @emitThisFile: true -//// var x: number = 5; -//// class Bar { -//// x : string; -//// y : number -//// } - -// @Filename: inputFile2.ts -//// var x1: string = "hello world"; -//// class Foo{ -//// x : string; -//// y : number; -//// } - +/// + +// @BaselineFile: getEmitOutputDeclarationSingleFile.baseline +// @declaration: true +// @out: declSingleFile.js + +// @Filename: inputFile1.ts +// @emitThisFile: true +//// var x: number = 5; +//// class Bar { +//// x : string; +//// y : number +//// } + +// @Filename: inputFile2.ts +//// var x1: string = "hello world"; +//// class Foo{ +//// x : string; +//// y : number; +//// } + verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/getEmitOutputExternalModule.ts b/tests/cases/fourslash/getEmitOutputExternalModule.ts index ef9fb348c5..080cd56e97 100644 --- a/tests/cases/fourslash/getEmitOutputExternalModule.ts +++ b/tests/cases/fourslash/getEmitOutputExternalModule.ts @@ -1,19 +1,19 @@ -/// - -// @BaselineFile: getEmitOutputExternalModule.baseline -// @out: declSingleFile.js - -// @Filename: inputFile1.ts -// @emitThisFile: true -//// var x: number = 5; -//// class Bar { -//// x : string; -//// y : number -//// } - -// @Filename: inputFile2.ts -//// export module M { -//// class C {c} -//// } - +/// + +// @BaselineFile: getEmitOutputExternalModule.baseline +// @out: declSingleFile.js + +// @Filename: inputFile1.ts +// @emitThisFile: true +//// var x: number = 5; +//// class Bar { +//// x : string; +//// y : number +//// } + +// @Filename: inputFile2.ts +//// export module M { +//// class C {c} +//// } + verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/getEmitOutputExternalModule2.ts b/tests/cases/fourslash/getEmitOutputExternalModule2.ts index abecc21969..f4b55abc2e 100644 --- a/tests/cases/fourslash/getEmitOutputExternalModule2.ts +++ b/tests/cases/fourslash/getEmitOutputExternalModule2.ts @@ -1,26 +1,26 @@ -/// - -// @BaselineFile: getEmitOutputExternalModule2.baseline -// @out: declSingleFile.js - -// @Filename: inputFile1.ts -//// var x: number = 5; -//// class Bar { -//// x : string; -//// y : number -//// } - -// @Filename: inputFile2.ts -// @emitThisFile: true -//// var x: string = "world"; -//// class Bar2 { -//// x : string; -//// y : number -//// } - -// @Filename: inputFile3.ts -//// export module M { -//// class C {c} -//// } - +/// + +// @BaselineFile: getEmitOutputExternalModule2.baseline +// @out: declSingleFile.js + +// @Filename: inputFile1.ts +//// var x: number = 5; +//// class Bar { +//// x : string; +//// y : number +//// } + +// @Filename: inputFile2.ts +// @emitThisFile: true +//// var x: string = "world"; +//// class Bar2 { +//// x : string; +//// y : number +//// } + +// @Filename: inputFile3.ts +//// export module M { +//// class C {c} +//// } + verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/getEmitOutputMapRoot.ts b/tests/cases/fourslash/getEmitOutputMapRoot.ts index 15932d41c3..7cbaf5d60b 100644 --- a/tests/cases/fourslash/getEmitOutputMapRoot.ts +++ b/tests/cases/fourslash/getEmitOutputMapRoot.ts @@ -1,17 +1,17 @@ -/// - -// @BaselineFile: getEmitOutputMapRoots.baseline -// @out: declSingleFile.js -// @sourceMap: true -// @mapRoot: mapRootDir/ - -// @Filename: inputFile.ts -// @emitThisFile: true -//// var x = 109; -//// var foo = "hello world"; -//// class M { -//// x: number; -//// y: string; -//// } - +/// + +// @BaselineFile: getEmitOutputMapRoots.baseline +// @out: declSingleFile.js +// @sourceMap: true +// @mapRoot: mapRootDir/ + +// @Filename: inputFile.ts +// @emitThisFile: true +//// var x = 109; +//// var foo = "hello world"; +//// class M { +//// x: number; +//// y: string; +//// } + verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/getEmitOutputNoErrors.ts b/tests/cases/fourslash/getEmitOutputNoErrors.ts index b48a86a03a..6ef4f34da5 100644 --- a/tests/cases/fourslash/getEmitOutputNoErrors.ts +++ b/tests/cases/fourslash/getEmitOutputNoErrors.ts @@ -1,12 +1,12 @@ -/// - -// @BaselineFile: getEmitOutputNoErrors.baseline -// @Filename: inputFile.ts -// @emitThisFile: true -//// var x; -//// class M { -//// x: number; -//// y: string; -//// } - +/// + +// @BaselineFile: getEmitOutputNoErrors.baseline +// @Filename: inputFile.ts +// @emitThisFile: true +//// var x; +//// class M { +//// x: number; +//// y: string; +//// } + verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/getEmitOutputOnlyOneFile.ts b/tests/cases/fourslash/getEmitOutputOnlyOneFile.ts index 2ad822741f..ecf042f918 100644 --- a/tests/cases/fourslash/getEmitOutputOnlyOneFile.ts +++ b/tests/cases/fourslash/getEmitOutputOnlyOneFile.ts @@ -1,20 +1,20 @@ -/// - -// @BaselineFile: getEmitOutputOnlyOneFile.baseline - -// @Filename: inputFile1.ts -//// var x: any; -//// class Bar { -//// x : string; -//// y : number -//// } - -// @Filename: inputFile2.ts -// @emitThisFile: true -//// var x: any; -//// class Foo{ -//// x : string; -//// y : number -//// } - +/// + +// @BaselineFile: getEmitOutputOnlyOneFile.baseline + +// @Filename: inputFile1.ts +//// var x: any; +//// class Bar { +//// x : string; +//// y : number +//// } + +// @Filename: inputFile2.ts +// @emitThisFile: true +//// var x: any; +//// class Foo{ +//// x : string; +//// y : number +//// } + verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/getEmitOutputSingleFile.ts b/tests/cases/fourslash/getEmitOutputSingleFile.ts index ec774149f4..babeb8dee1 100644 --- a/tests/cases/fourslash/getEmitOutputSingleFile.ts +++ b/tests/cases/fourslash/getEmitOutputSingleFile.ts @@ -1,21 +1,21 @@ -/// - -// @BaselineFile: getEmitOutputSingleFile.baseline -// @out: outputDir/singleFile.js - -// @Filename: inputFile1.ts -//// var x: any; -//// class Bar { -//// x : string; -//// y : number -//// } - -// @Filename: inputFile2.ts -// @emitThisFile: true -//// var x: any; -//// class Foo{ -//// x : string; -//// y : number -//// } - +/// + +// @BaselineFile: getEmitOutputSingleFile.baseline +// @out: outputDir/singleFile.js + +// @Filename: inputFile1.ts +//// var x: any; +//// class Bar { +//// x : string; +//// y : number +//// } + +// @Filename: inputFile2.ts +// @emitThisFile: true +//// var x: any; +//// class Foo{ +//// x : string; +//// y : number +//// } + verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/getEmitOutputSingleFile2.ts b/tests/cases/fourslash/getEmitOutputSingleFile2.ts index 8bf4f7f4af..5dd0276a93 100644 --- a/tests/cases/fourslash/getEmitOutputSingleFile2.ts +++ b/tests/cases/fourslash/getEmitOutputSingleFile2.ts @@ -1,28 +1,28 @@ -/// - -// @BaselineFile: getEmitOutputSingleFile2.baseline -// @module: CommonJS -// @declaration: true -// @out: declSingleFile.js -// @outDir: tests/cases/fourslash/ - -// @Filename: inputFile1.ts -//// var x: number = 5; -//// class Bar { -//// x : string; -//// y : number -//// } - -// @Filename: inputFile2.ts -//// var x1: string = "hello world"; -//// class Foo{ -//// x : string; -//// y : number; -//// } - -// @Filename: inputFile3.ts -// @emitThisFile: true -////export var foo = 10; -////export var bar = "hello world" - +/// + +// @BaselineFile: getEmitOutputSingleFile2.baseline +// @module: CommonJS +// @declaration: true +// @out: declSingleFile.js +// @outDir: tests/cases/fourslash/ + +// @Filename: inputFile1.ts +//// var x: number = 5; +//// class Bar { +//// x : string; +//// y : number +//// } + +// @Filename: inputFile2.ts +//// var x1: string = "hello world"; +//// class Foo{ +//// x : string; +//// y : number; +//// } + +// @Filename: inputFile3.ts +// @emitThisFile: true +////export var foo = 10; +////export var bar = "hello world" + verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/getEmitOutputSourceMap.ts b/tests/cases/fourslash/getEmitOutputSourceMap.ts index df02af35ec..24e3764806 100644 --- a/tests/cases/fourslash/getEmitOutputSourceMap.ts +++ b/tests/cases/fourslash/getEmitOutputSourceMap.ts @@ -1,15 +1,15 @@ -/// - -// @BaselineFile: getEmitOutputSourceMap.baseline -// @sourceMap: true - -// @Filename: inputFile.ts -// @emitThisFile: true -//// var x = 109; -//// var foo = "hello world"; -//// class M { -//// x: number; -//// y: string; -//// } - +/// + +// @BaselineFile: getEmitOutputSourceMap.baseline +// @sourceMap: true + +// @Filename: inputFile.ts +// @emitThisFile: true +//// var x = 109; +//// var foo = "hello world"; +//// class M { +//// x: number; +//// y: string; +//// } + verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/getEmitOutputSourceMap2.ts b/tests/cases/fourslash/getEmitOutputSourceMap2.ts index a8b43328ea..4b4b1185c7 100644 --- a/tests/cases/fourslash/getEmitOutputSourceMap2.ts +++ b/tests/cases/fourslash/getEmitOutputSourceMap2.ts @@ -1,23 +1,23 @@ -/// - -// @BaselineFile: getEmitOutputSourceMap2.baseline -// @sourceMap: true -// @outDir: sample/outDir - -// @Filename: inputFile1.ts -// @emitThisFile: true -//// var x = 109; -//// var foo = "hello world"; -//// class M { -//// x: number; -//// y: string; -//// } - -// @Filename: inputFile2.ts -// @emitThisFile: true -//// var intro = "hello world"; -//// if (intro !== undefined) { -//// var k = 10; -//// } - +/// + +// @BaselineFile: getEmitOutputSourceMap2.baseline +// @sourceMap: true +// @outDir: sample/outDir + +// @Filename: inputFile1.ts +// @emitThisFile: true +//// var x = 109; +//// var foo = "hello world"; +//// class M { +//// x: number; +//// y: string; +//// } + +// @Filename: inputFile2.ts +// @emitThisFile: true +//// var intro = "hello world"; +//// if (intro !== undefined) { +//// var k = 10; +//// } + verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/getEmitOutputSourceRoot.ts b/tests/cases/fourslash/getEmitOutputSourceRoot.ts index b260e59309..ac7d63558e 100644 --- a/tests/cases/fourslash/getEmitOutputSourceRoot.ts +++ b/tests/cases/fourslash/getEmitOutputSourceRoot.ts @@ -1,16 +1,16 @@ -/// - -// @BaselineFile: getEmitOutputSourceRoot.baseline -// @sourceMap: true -// @sourceRoot: sourceRootDir/ - -// @Filename: inputFile.ts -// @emitThisFile: true -//// var x = 109; -//// var foo = "hello world"; -//// class M { -//// x: number; -//// y: string; -//// } - +/// + +// @BaselineFile: getEmitOutputSourceRoot.baseline +// @sourceMap: true +// @sourceRoot: sourceRootDir/ + +// @Filename: inputFile.ts +// @emitThisFile: true +//// var x = 109; +//// var foo = "hello world"; +//// class M { +//// x: number; +//// y: string; +//// } + verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/getEmitOutputSourceRootMultiFiles.ts b/tests/cases/fourslash/getEmitOutputSourceRootMultiFiles.ts index bddf9e423c..7360f9f27e 100644 --- a/tests/cases/fourslash/getEmitOutputSourceRootMultiFiles.ts +++ b/tests/cases/fourslash/getEmitOutputSourceRootMultiFiles.ts @@ -1,24 +1,24 @@ -/// - -// @BaselineFile: getEmitOutputSourceRootMultiFiles.baseline -// @sourceMap: true -// @sourceRoot: sourceRootDir/ - -// @Filename: inputFile1.ts -// @emitThisFile: true -//// var x = 109; -//// var foo = "hello world"; -//// class M { -//// x: number; -//// y: string; -//// } - -// @Filename: inputFile2.ts -// @emitThisFile: true -//// var bar = "hello world Typescript"; -//// class C { -//// x: number; -//// y: string[]; -//// } - +/// + +// @BaselineFile: getEmitOutputSourceRootMultiFiles.baseline +// @sourceMap: true +// @sourceRoot: sourceRootDir/ + +// @Filename: inputFile1.ts +// @emitThisFile: true +//// var x = 109; +//// var foo = "hello world"; +//// class M { +//// x: number; +//// y: string; +//// } + +// @Filename: inputFile2.ts +// @emitThisFile: true +//// var bar = "hello world Typescript"; +//// class C { +//// x: number; +//// y: string[]; +//// } + verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/getEmitOutputWithDeclarationFile.ts b/tests/cases/fourslash/getEmitOutputWithDeclarationFile.ts index d15b49755d..9e73a8490d 100644 --- a/tests/cases/fourslash/getEmitOutputWithDeclarationFile.ts +++ b/tests/cases/fourslash/getEmitOutputWithDeclarationFile.ts @@ -1,17 +1,17 @@ -/// - -// @BaselineFile: getEmitOutputWithDeclarationFile.baseline - -// @Filename: decl.d.ts -// @emitThisFile: true -//// interface I { a: string; } - -// @Filename: inputFile2.ts -// @emitThisFile: true -//// var x1: string = "hello world"; -//// class Foo{ -//// x : string; -//// y : number; -//// } - +/// + +// @BaselineFile: getEmitOutputWithDeclarationFile.baseline + +// @Filename: decl.d.ts +// @emitThisFile: true +//// interface I { a: string; } + +// @Filename: inputFile2.ts +// @emitThisFile: true +//// var x1: string = "hello world"; +//// class Foo{ +//// x : string; +//// y : number; +//// } + verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/getEmitOutputWithDeclarationFile2.ts b/tests/cases/fourslash/getEmitOutputWithDeclarationFile2.ts index ac68611246..8f8e21cbcb 100644 --- a/tests/cases/fourslash/getEmitOutputWithDeclarationFile2.ts +++ b/tests/cases/fourslash/getEmitOutputWithDeclarationFile2.ts @@ -1,18 +1,18 @@ -/// - -// @BaselineFile: getEmitOutputWithDeclarationFile2.baseline -// @module: CommonJS - -// @Filename: decl.d.ts -// @emitThisFile: true -//// interface I { a: string; } - -// @Filename: inputFile2.ts -// @emitThisFile: true -//// export class Foo { } - -// @Filename: inputFile3.ts -// @emitThisFile: true -//// var x:string = "hello"; - +/// + +// @BaselineFile: getEmitOutputWithDeclarationFile2.baseline +// @module: CommonJS + +// @Filename: decl.d.ts +// @emitThisFile: true +//// interface I { a: string; } + +// @Filename: inputFile2.ts +// @emitThisFile: true +//// export class Foo { } + +// @Filename: inputFile3.ts +// @emitThisFile: true +//// var x:string = "hello"; + verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/getEmitOutputWithDeclarationFile3.ts b/tests/cases/fourslash/getEmitOutputWithDeclarationFile3.ts index 266edaf23e..60f7b43314 100644 --- a/tests/cases/fourslash/getEmitOutputWithDeclarationFile3.ts +++ b/tests/cases/fourslash/getEmitOutputWithDeclarationFile3.ts @@ -1,22 +1,22 @@ -/// - -// @BaselineFile: getEmitOutputWithDeclarationFile3.baseline -// @out: declSingle.js - -// @Filename: decl.d.ts -//// interface I { a: string; } - -// @Filename: inputFile2.ts -//// export class Foo { } - -// @Filename: inputFile3.ts -// @emitThisFile: true -//// var x:string = "hello"; - -// @Filename: inputFile4.ts -//// var x1:number = 1000; - -// @Filename: inputFile5.js -//// var x2 = 1000; -debugger; +/// + +// @BaselineFile: getEmitOutputWithDeclarationFile3.baseline +// @out: declSingle.js + +// @Filename: decl.d.ts +//// interface I { a: string; } + +// @Filename: inputFile2.ts +//// export class Foo { } + +// @Filename: inputFile3.ts +// @emitThisFile: true +//// var x:string = "hello"; + +// @Filename: inputFile4.ts +//// var x1:number = 1000; + +// @Filename: inputFile5.js +//// var x2 = 1000; +debugger; verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/getEmitOutputWithEarlySemanticErrors.ts b/tests/cases/fourslash/getEmitOutputWithEarlySemanticErrors.ts index 2946fffb80..58d6ce19ed 100644 --- a/tests/cases/fourslash/getEmitOutputWithEarlySemanticErrors.ts +++ b/tests/cases/fourslash/getEmitOutputWithEarlySemanticErrors.ts @@ -1,10 +1,10 @@ -/// - -// @BaselineFile: getEmitOutputWithEarlySyntacticErrors.baseline - -// @Filename: inputFile1.ts -// @emitThisFile: true -//// // File contains early errors. All outputs should be skipped. -//// const uninitialized_const_error; - +/// + +// @BaselineFile: getEmitOutputWithEarlySyntacticErrors.baseline + +// @Filename: inputFile1.ts +// @emitThisFile: true +//// // File contains early errors. All outputs should be skipped. +//// const uninitialized_const_error; + verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/getEmitOutputWithEmitterErrors.ts b/tests/cases/fourslash/getEmitOutputWithEmitterErrors.ts index ba643f996d..0d2f488e43 100644 --- a/tests/cases/fourslash/getEmitOutputWithEmitterErrors.ts +++ b/tests/cases/fourslash/getEmitOutputWithEmitterErrors.ts @@ -1,15 +1,15 @@ -/// - -// @BaselineFile: getEmitOutputWithEmitterErrors.baseline -// @declaration: true - -// @Filename: inputFile.ts -// @emitThisFile: true -////module M { -//// class C { } -//// export var foo = new C(); -////} - - -// Only generate javscript file. The semantic error should not affect it +/// + +// @BaselineFile: getEmitOutputWithEmitterErrors.baseline +// @declaration: true + +// @Filename: inputFile.ts +// @emitThisFile: true +////module M { +//// class C { } +//// export var foo = new C(); +////} + + +// Only generate javscript file. The semantic error should not affect it verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/getEmitOutputWithEmitterErrors2.ts b/tests/cases/fourslash/getEmitOutputWithEmitterErrors2.ts index 5240a102a2..865c94adca 100644 --- a/tests/cases/fourslash/getEmitOutputWithEmitterErrors2.ts +++ b/tests/cases/fourslash/getEmitOutputWithEmitterErrors2.ts @@ -1,14 +1,14 @@ -/// - -// @BaselineFile: getEmitOutputWithEmitterErrors2.baseline -// @declaration: true -// @module: AMD - -// @Filename: inputFile.ts -// @emitThisFile: true -////class C { } -////export module M { -//// export var foo = new C(); -////} - +/// + +// @BaselineFile: getEmitOutputWithEmitterErrors2.baseline +// @declaration: true +// @module: AMD + +// @Filename: inputFile.ts +// @emitThisFile: true +////class C { } +////export module M { +//// export var foo = new C(); +////} + verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/getEmitOutputWithSemanticErrors.ts b/tests/cases/fourslash/getEmitOutputWithSemanticErrors.ts index b4e3a50b0e..13aeda82cc 100644 --- a/tests/cases/fourslash/getEmitOutputWithSemanticErrors.ts +++ b/tests/cases/fourslash/getEmitOutputWithSemanticErrors.ts @@ -1,9 +1,9 @@ -/// - -// @BaselineFile: getEmitOutputWithSemanticErrors.baseline - -// @Filename: inputFile.ts -// @emitThisFile: true -//// var x:number = "hello world"; - +/// + +// @BaselineFile: getEmitOutputWithSemanticErrors.baseline + +// @Filename: inputFile.ts +// @emitThisFile: true +//// var x:number = "hello world"; + verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/getEmitOutputWithSemanticErrors2.ts b/tests/cases/fourslash/getEmitOutputWithSemanticErrors2.ts index c67ef0fd29..174b42bb37 100644 --- a/tests/cases/fourslash/getEmitOutputWithSemanticErrors2.ts +++ b/tests/cases/fourslash/getEmitOutputWithSemanticErrors2.ts @@ -1,10 +1,10 @@ -/// - -// @BaselineFile: getEmitOutputWithSemanticErrors2.baseline -// @declaration: true - -// @Filename: inputFile.ts -// @emitThisFile: true -//// var x:number = "hello world"; - +/// + +// @BaselineFile: getEmitOutputWithSemanticErrors2.baseline +// @declaration: true + +// @Filename: inputFile.ts +// @emitThisFile: true +//// var x:number = "hello world"; + verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/getEmitOutputWithSemanticErrorsForMultipleFiles.ts b/tests/cases/fourslash/getEmitOutputWithSemanticErrorsForMultipleFiles.ts index 69f8b8a8b4..d24bcfbf50 100644 --- a/tests/cases/fourslash/getEmitOutputWithSemanticErrorsForMultipleFiles.ts +++ b/tests/cases/fourslash/getEmitOutputWithSemanticErrorsForMultipleFiles.ts @@ -1,16 +1,16 @@ -/// - -// @BaselineFile: getEmitOutputWithSemanticErrorsForMultipleFiles.baseline -// @declaration: true - -// @Filename: inputFile1.ts -// @emitThisFile: true -//// // File to emit, does not contain semantic errors -//// // expected to be emitted correctelly regardless of the semantic errors in the other file -//// var noErrors = true; - -// @Filename: inputFile2.ts -//// // File not emitted, and contains semantic errors -//// var semanticError: boolean = "string"; -debugger; +/// + +// @BaselineFile: getEmitOutputWithSemanticErrorsForMultipleFiles.baseline +// @declaration: true + +// @Filename: inputFile1.ts +// @emitThisFile: true +//// // File to emit, does not contain semantic errors +//// // expected to be emitted correctelly regardless of the semantic errors in the other file +//// var noErrors = true; + +// @Filename: inputFile2.ts +//// // File not emitted, and contains semantic errors +//// var semanticError: boolean = "string"; +debugger; verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/getEmitOutputWithSemanticErrorsForMultipleFiles2.ts b/tests/cases/fourslash/getEmitOutputWithSemanticErrorsForMultipleFiles2.ts index d5cfd1346c..95a4ac78a8 100644 --- a/tests/cases/fourslash/getEmitOutputWithSemanticErrorsForMultipleFiles2.ts +++ b/tests/cases/fourslash/getEmitOutputWithSemanticErrorsForMultipleFiles2.ts @@ -1,17 +1,17 @@ -/// - -// @BaselineFile: getEmitOutputWithSemanticErrorsForMultipleFiles2.baseline -// @declaration: true -// @out: out.js - -// @Filename: inputFile1.ts -// @emitThisFile: true -//// // File to emit, does not contain semantic errors, but --out is passed -//// // expected to not generate declarations because of the semantic errors in the other file -//// var noErrors = true; - -// @Filename: inputFile2.ts -//// // File not emitted, and contains semantic errors -//// var semanticError: boolean = "string"; - +/// + +// @BaselineFile: getEmitOutputWithSemanticErrorsForMultipleFiles2.baseline +// @declaration: true +// @out: out.js + +// @Filename: inputFile1.ts +// @emitThisFile: true +//// // File to emit, does not contain semantic errors, but --out is passed +//// // expected to not generate declarations because of the semantic errors in the other file +//// var noErrors = true; + +// @Filename: inputFile2.ts +//// // File not emitted, and contains semantic errors +//// var semanticError: boolean = "string"; + verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/getEmitOutputWithSyntacticErrorsForMultipleFiles.ts b/tests/cases/fourslash/getEmitOutputWithSyntacticErrorsForMultipleFiles.ts index 3b3d01eaac..c2ddd3ea00 100644 --- a/tests/cases/fourslash/getEmitOutputWithSyntacticErrorsForMultipleFiles.ts +++ b/tests/cases/fourslash/getEmitOutputWithSyntacticErrorsForMultipleFiles.ts @@ -1,15 +1,15 @@ -/// - -// @BaselineFile: getEmitOutputWithSyntacticErrorsForMultipleFiles.baseline - -// @Filename: inputFile1.ts -// @emitThisFile: true -//// // File to emit, does not contain syntactic errors -//// // expected to be emitted correctelly regardless of the syntactic errors in the other file -//// var noErrors = true; - -// @Filename: inputFile2.ts -//// // File not emitted, and contains syntactic errors -//// var syntactic Error; - +/// + +// @BaselineFile: getEmitOutputWithSyntacticErrorsForMultipleFiles.baseline + +// @Filename: inputFile1.ts +// @emitThisFile: true +//// // File to emit, does not contain syntactic errors +//// // expected to be emitted correctelly regardless of the syntactic errors in the other file +//// var noErrors = true; + +// @Filename: inputFile2.ts +//// // File not emitted, and contains syntactic errors +//// var syntactic Error; + verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/getEmitOutputWithSyntacticErrorsForMultipleFiles2.ts b/tests/cases/fourslash/getEmitOutputWithSyntacticErrorsForMultipleFiles2.ts index ce82f958b9..f66e6563c8 100644 --- a/tests/cases/fourslash/getEmitOutputWithSyntacticErrorsForMultipleFiles2.ts +++ b/tests/cases/fourslash/getEmitOutputWithSyntacticErrorsForMultipleFiles2.ts @@ -1,16 +1,16 @@ -/// - -// @BaselineFile: getEmitOutputWithSyntacticErrorsForMultipleFiles2.baseline -// @out: out.js - -// @Filename: inputFile1.ts -// @emitThisFile: true -//// // File to emit, does not contain syntactic errors, but --out is passed -//// // expected to not generate outputs because of the syntactic errors in the other file. -//// var noErrors = true; - -// @Filename: inputFile2.ts -//// // File not emitted, and contains syntactic errors -//// var syntactic Error; - +/// + +// @BaselineFile: getEmitOutputWithSyntacticErrorsForMultipleFiles2.baseline +// @out: out.js + +// @Filename: inputFile1.ts +// @emitThisFile: true +//// // File to emit, does not contain syntactic errors, but --out is passed +//// // expected to not generate outputs because of the syntactic errors in the other file. +//// var noErrors = true; + +// @Filename: inputFile2.ts +//// // File not emitted, and contains syntactic errors +//// var syntactic Error; + verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/getEmitOutputWithSyntaxErrors.ts b/tests/cases/fourslash/getEmitOutputWithSyntaxErrors.ts index 87e9bb076a..4d094f463d 100644 --- a/tests/cases/fourslash/getEmitOutputWithSyntaxErrors.ts +++ b/tests/cases/fourslash/getEmitOutputWithSyntaxErrors.ts @@ -1,9 +1,9 @@ -/// - -// @BaselineFile: getEmitOutputWithSyntaxErrors.baseline - -// @Filename: inputFile.ts -// @emitThisFile: true -//// var x: - +/// + +// @BaselineFile: getEmitOutputWithSyntaxErrors.baseline + +// @Filename: inputFile.ts +// @emitThisFile: true +//// var x: + verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/getMatchingBracesAdjacentBraces.ts b/tests/cases/fourslash/getMatchingBracesAdjacentBraces.ts index 8dd997ebe7..0dbd5630a5 100644 --- a/tests/cases/fourslash/getMatchingBracesAdjacentBraces.ts +++ b/tests/cases/fourslash/getMatchingBracesAdjacentBraces.ts @@ -1,4 +1,4 @@ -////function f[||][|(x: T)|][|{ +////function f[||][|(x: T)|][|{ //// return x; ////}|] diff --git a/tests/cases/fourslash/getOccurrencesModifiersNegatives1.ts b/tests/cases/fourslash/getOccurrencesModifiersNegatives1.ts index ac74fc2192..51d5907a5d 100644 --- a/tests/cases/fourslash/getOccurrencesModifiersNegatives1.ts +++ b/tests/cases/fourslash/getOccurrencesModifiersNegatives1.ts @@ -1,4 +1,4 @@ -/// +/// ////class C { //// [|export|] foo; diff --git a/tests/cases/fourslash/getOccurrencesPropertyInAliasedInterface.ts b/tests/cases/fourslash/getOccurrencesPropertyInAliasedInterface.ts index f9d47b0747..53840fc3bd 100644 --- a/tests/cases/fourslash/getOccurrencesPropertyInAliasedInterface.ts +++ b/tests/cases/fourslash/getOccurrencesPropertyInAliasedInterface.ts @@ -1,4 +1,4 @@ -////module m { +////module m { //// export interface Foo { //// [|abc|] //// } diff --git a/tests/cases/fourslash/getOccurrencesSetAndGet.ts b/tests/cases/fourslash/getOccurrencesSetAndGet.ts index b1ab6f44c6..ddeaf8f26f 100644 --- a/tests/cases/fourslash/getOccurrencesSetAndGet.ts +++ b/tests/cases/fourslash/getOccurrencesSetAndGet.ts @@ -1,34 +1,34 @@ -/// - -////class Foo { -//// [|set|] bar(b: any) { -//// } -//// -//// public [|get|] bar(): any { -//// return undefined; -//// } -//// -//// public set set(s: any) { -//// } -//// -//// public get set(): any { -//// return undefined; -//// } -//// -//// public set get(g: any) { -//// } -//// -//// public get get(): any { -//// return undefined; -//// } -////} - -test.ranges().forEach(r => { - goTo.position(r.start); - - test.ranges().forEach(range => { - verify.occurrencesAtPositionContains(range, false); - }); - - verify.occurrencesAtPositionCount(test.ranges().length); -}); +/// + +////class Foo { +//// [|set|] bar(b: any) { +//// } +//// +//// public [|get|] bar(): any { +//// return undefined; +//// } +//// +//// public set set(s: any) { +//// } +//// +//// public get set(): any { +//// return undefined; +//// } +//// +//// public set get(g: any) { +//// } +//// +//// public get get(): any { +//// return undefined; +//// } +////} + +test.ranges().forEach(r => { + goTo.position(r.start); + + test.ranges().forEach(range => { + verify.occurrencesAtPositionContains(range, false); + }); + + verify.occurrencesAtPositionCount(test.ranges().length); +}); diff --git a/tests/cases/fourslash/getOccurrencesSetAndGet2.ts b/tests/cases/fourslash/getOccurrencesSetAndGet2.ts index 1345394b8e..3e05f511ef 100644 --- a/tests/cases/fourslash/getOccurrencesSetAndGet2.ts +++ b/tests/cases/fourslash/getOccurrencesSetAndGet2.ts @@ -1,34 +1,34 @@ -/// - -////class Foo { -//// set bar(b: any) { -//// } -//// -//// public get bar(): any { -//// return undefined; -//// } -//// -//// public [|set|] set(s: any) { -//// } -//// -//// public [|get|] set(): any { -//// return undefined; -//// } -//// -//// public set get(g: any) { -//// } -//// -//// public get get(): any { -//// return undefined; -//// } -////} - -test.ranges().forEach(r => { - goTo.position(r.start); - - test.ranges().forEach(range => { - verify.occurrencesAtPositionContains(range, false); - }); - - verify.occurrencesAtPositionCount(test.ranges().length); -}); +/// + +////class Foo { +//// set bar(b: any) { +//// } +//// +//// public get bar(): any { +//// return undefined; +//// } +//// +//// public [|set|] set(s: any) { +//// } +//// +//// public [|get|] set(): any { +//// return undefined; +//// } +//// +//// public set get(g: any) { +//// } +//// +//// public get get(): any { +//// return undefined; +//// } +////} + +test.ranges().forEach(r => { + goTo.position(r.start); + + test.ranges().forEach(range => { + verify.occurrencesAtPositionContains(range, false); + }); + + verify.occurrencesAtPositionCount(test.ranges().length); +}); diff --git a/tests/cases/fourslash/getOccurrencesSetAndGet3.ts b/tests/cases/fourslash/getOccurrencesSetAndGet3.ts index 4105a40757..777a62db6a 100644 --- a/tests/cases/fourslash/getOccurrencesSetAndGet3.ts +++ b/tests/cases/fourslash/getOccurrencesSetAndGet3.ts @@ -1,34 +1,34 @@ -/// - -////class Foo { -//// set bar(b: any) { -//// } -//// -//// public get bar(): any { -//// return undefined; -//// } -//// -//// public set set(s: any) { -//// } -//// -//// public get set(): any { -//// return undefined; -//// } -//// -//// public [|set|] get(g: any) { -//// } -//// -//// public [|get|] get(): any { -//// return undefined; -//// } -////} - -test.ranges().forEach(r => { - goTo.position(r.start); - - test.ranges().forEach(range => { - verify.occurrencesAtPositionContains(range, false); - }); - - verify.occurrencesAtPositionCount(test.ranges().length); -}); +/// + +////class Foo { +//// set bar(b: any) { +//// } +//// +//// public get bar(): any { +//// return undefined; +//// } +//// +//// public set set(s: any) { +//// } +//// +//// public get set(): any { +//// return undefined; +//// } +//// +//// public [|set|] get(g: any) { +//// } +//// +//// public [|get|] get(): any { +//// return undefined; +//// } +////} + +test.ranges().forEach(r => { + goTo.position(r.start); + + test.ranges().forEach(range => { + verify.occurrencesAtPositionContains(range, false); + }); + + verify.occurrencesAtPositionCount(test.ranges().length); +}); diff --git a/tests/cases/fourslash/getOccurrencesThrow.ts b/tests/cases/fourslash/getOccurrencesThrow.ts index c25551db92..19f10dbfb9 100644 --- a/tests/cases/fourslash/getOccurrencesThrow.ts +++ b/tests/cases/fourslash/getOccurrencesThrow.ts @@ -1,58 +1,58 @@ -/// - -////function f(a: number) { -//// try { -//// throw "Hello"; -//// -//// try { -//// throw 10; -//// } -//// catch (x) { -//// [|return|] 100; -//// } -//// finally { -//// throw 10; -//// } -//// } -//// catch (x) { -//// [|throw|] "Something"; -//// } -//// finally { -//// [|throw|] "Also something"; -//// } -//// if (a > 0) { -//// [|return|] (function () { -//// return; -//// return; -//// return; -//// -//// if (false) { -//// return true; -//// } -//// throw "Hello!"; -//// })() || true; -//// } -//// -//// [|th/**/row|] 10; -//// -//// var unusued = [1, 2, 3, 4].map(x => { throw 4 }) -//// -//// [|return|]; -//// [|return|] true; -//// [|throw|] false; -////} - -test.ranges().forEach(r => { - goTo.position(r.start); - - test.ranges().forEach(range => { - verify.occurrencesAtPositionContains(range, false); - }); - - verify.occurrencesAtPositionCount(test.ranges().length); -}); - -goTo.marker(); -test.ranges().forEach(range => { - verify.occurrencesAtPositionContains(range, false); -}); +/// + +////function f(a: number) { +//// try { +//// throw "Hello"; +//// +//// try { +//// throw 10; +//// } +//// catch (x) { +//// [|return|] 100; +//// } +//// finally { +//// throw 10; +//// } +//// } +//// catch (x) { +//// [|throw|] "Something"; +//// } +//// finally { +//// [|throw|] "Also something"; +//// } +//// if (a > 0) { +//// [|return|] (function () { +//// return; +//// return; +//// return; +//// +//// if (false) { +//// return true; +//// } +//// throw "Hello!"; +//// })() || true; +//// } +//// +//// [|th/**/row|] 10; +//// +//// var unusued = [1, 2, 3, 4].map(x => { throw 4 }) +//// +//// [|return|]; +//// [|return|] true; +//// [|throw|] false; +////} + +test.ranges().forEach(r => { + goTo.position(r.start); + + test.ranges().forEach(range => { + verify.occurrencesAtPositionContains(range, false); + }); + + verify.occurrencesAtPositionCount(test.ranges().length); +}); + +goTo.marker(); +test.ranges().forEach(range => { + verify.occurrencesAtPositionContains(range, false); +}); diff --git a/tests/cases/fourslash/getOccurrencesThrow2.ts b/tests/cases/fourslash/getOccurrencesThrow2.ts index 99e1802039..9bd2f82e63 100644 --- a/tests/cases/fourslash/getOccurrencesThrow2.ts +++ b/tests/cases/fourslash/getOccurrencesThrow2.ts @@ -1,58 +1,58 @@ -/// - -////function f(a: number) { -//// try { -//// throw "Hello"; -//// -//// try { -//// [|t/**/hrow|] 10; -//// } -//// catch (x) { -//// return 100; -//// } -//// finally { -//// throw 10; -//// } -//// } -//// catch (x) { -//// throw "Something"; -//// } -//// finally { -//// throw "Also something"; -//// } -//// if (a > 0) { -//// return (function () { -//// return; -//// return; -//// return; -//// -//// if (false) { -//// return true; -//// } -//// throw "Hello!"; -//// })() || true; -//// } -//// -//// throw 10; -//// -//// var unusued = [1, 2, 3, 4].map(x => { throw 4 }) -//// -//// return; -//// return true; -//// throw false; -////} - -test.ranges().forEach(r => { - goTo.position(r.start); - - test.ranges().forEach(range => { - verify.occurrencesAtPositionContains(range, false); - }); - - verify.occurrencesAtPositionCount(test.ranges().length); -}); - -goTo.marker(); -test.ranges().forEach(range => { - verify.occurrencesAtPositionContains(range, false); -}); +/// + +////function f(a: number) { +//// try { +//// throw "Hello"; +//// +//// try { +//// [|t/**/hrow|] 10; +//// } +//// catch (x) { +//// return 100; +//// } +//// finally { +//// throw 10; +//// } +//// } +//// catch (x) { +//// throw "Something"; +//// } +//// finally { +//// throw "Also something"; +//// } +//// if (a > 0) { +//// return (function () { +//// return; +//// return; +//// return; +//// +//// if (false) { +//// return true; +//// } +//// throw "Hello!"; +//// })() || true; +//// } +//// +//// throw 10; +//// +//// var unusued = [1, 2, 3, 4].map(x => { throw 4 }) +//// +//// return; +//// return true; +//// throw false; +////} + +test.ranges().forEach(r => { + goTo.position(r.start); + + test.ranges().forEach(range => { + verify.occurrencesAtPositionContains(range, false); + }); + + verify.occurrencesAtPositionCount(test.ranges().length); +}); + +goTo.marker(); +test.ranges().forEach(range => { + verify.occurrencesAtPositionContains(range, false); +}); diff --git a/tests/cases/fourslash/getOccurrencesThrow3.ts b/tests/cases/fourslash/getOccurrencesThrow3.ts index 313d04b8e3..359b783df0 100644 --- a/tests/cases/fourslash/getOccurrencesThrow3.ts +++ b/tests/cases/fourslash/getOccurrencesThrow3.ts @@ -1,58 +1,58 @@ -/// - -////function f(a: number) { -//// try { -//// [|throw|] "Hello"; -//// -//// try { -//// throw 10; -//// } -//// catch (x) { -//// return 100; -//// } -//// finally { -//// [|thr/**/ow|] 10; -//// } -//// } -//// catch (x) { -//// throw "Something"; -//// } -//// finally { -//// throw "Also something"; -//// } -//// if (a > 0) { -//// return (function () { -//// return; -//// return; -//// return; -//// -//// if (false) { -//// return true; -//// } -//// throw "Hello!"; -//// })() || true; -//// } -//// -//// throw 10; -//// -//// var unusued = [1, 2, 3, 4].map(x => { throw 4 }) -//// -//// return; -//// return true; -//// throw false; -////} - -test.ranges().forEach(r => { - goTo.position(r.start); - - test.ranges().forEach(range => { - verify.occurrencesAtPositionContains(range, false); - }); - - verify.occurrencesAtPositionCount(test.ranges().length); -}); - -goTo.marker(); -test.ranges().forEach(range => { - verify.occurrencesAtPositionContains(range, false); -}); +/// + +////function f(a: number) { +//// try { +//// [|throw|] "Hello"; +//// +//// try { +//// throw 10; +//// } +//// catch (x) { +//// return 100; +//// } +//// finally { +//// [|thr/**/ow|] 10; +//// } +//// } +//// catch (x) { +//// throw "Something"; +//// } +//// finally { +//// throw "Also something"; +//// } +//// if (a > 0) { +//// return (function () { +//// return; +//// return; +//// return; +//// +//// if (false) { +//// return true; +//// } +//// throw "Hello!"; +//// })() || true; +//// } +//// +//// throw 10; +//// +//// var unusued = [1, 2, 3, 4].map(x => { throw 4 }) +//// +//// return; +//// return true; +//// throw false; +////} + +test.ranges().forEach(r => { + goTo.position(r.start); + + test.ranges().forEach(range => { + verify.occurrencesAtPositionContains(range, false); + }); + + verify.occurrencesAtPositionCount(test.ranges().length); +}); + +goTo.marker(); +test.ranges().forEach(range => { + verify.occurrencesAtPositionContains(range, false); +}); diff --git a/tests/cases/fourslash/getOccurrencesThrow4.ts b/tests/cases/fourslash/getOccurrencesThrow4.ts index adf321526a..ab2375907e 100644 --- a/tests/cases/fourslash/getOccurrencesThrow4.ts +++ b/tests/cases/fourslash/getOccurrencesThrow4.ts @@ -1,58 +1,58 @@ -/// - -////function f(a: number) { -//// try { -//// throw "Hello"; -//// -//// try { -//// throw 10; -//// } -//// catch (x) { -//// return 100; -//// } -//// finally { -//// throw 10; -//// } -//// } -//// catch (x) { -//// throw "Something"; -//// } -//// finally { -//// throw "Also something"; -//// } -//// if (a > 0) { -//// return (function () { -//// [|return|]; -//// [|return|]; -//// [|return|]; -//// -//// if (false) { -//// [|return|] true; -//// } -//// [|th/**/row|] "Hello!"; -//// })() || true; -//// } -//// -//// throw 10; -//// -//// var unusued = [1, 2, 3, 4].map(x => { throw 4 }) -//// -//// return; -//// return true; -//// throw false; -////} - -test.ranges().forEach(r => { - goTo.position(r.start); - - test.ranges().forEach(range => { - verify.occurrencesAtPositionContains(range, false); - }); - - verify.occurrencesAtPositionCount(test.ranges().length); -}); - -goTo.marker(); -test.ranges().forEach(range => { - verify.occurrencesAtPositionContains(range, false); -}); +/// + +////function f(a: number) { +//// try { +//// throw "Hello"; +//// +//// try { +//// throw 10; +//// } +//// catch (x) { +//// return 100; +//// } +//// finally { +//// throw 10; +//// } +//// } +//// catch (x) { +//// throw "Something"; +//// } +//// finally { +//// throw "Also something"; +//// } +//// if (a > 0) { +//// return (function () { +//// [|return|]; +//// [|return|]; +//// [|return|]; +//// +//// if (false) { +//// [|return|] true; +//// } +//// [|th/**/row|] "Hello!"; +//// })() || true; +//// } +//// +//// throw 10; +//// +//// var unusued = [1, 2, 3, 4].map(x => { throw 4 }) +//// +//// return; +//// return true; +//// throw false; +////} + +test.ranges().forEach(r => { + goTo.position(r.start); + + test.ranges().forEach(range => { + verify.occurrencesAtPositionContains(range, false); + }); + + verify.occurrencesAtPositionCount(test.ranges().length); +}); + +goTo.marker(); +test.ranges().forEach(range => { + verify.occurrencesAtPositionContains(range, false); +}); diff --git a/tests/cases/fourslash/getOccurrencesThrow5.ts b/tests/cases/fourslash/getOccurrencesThrow5.ts index 3e5ba4bca1..9ba2819175 100644 --- a/tests/cases/fourslash/getOccurrencesThrow5.ts +++ b/tests/cases/fourslash/getOccurrencesThrow5.ts @@ -1,58 +1,58 @@ -/// - -////function f(a: number) { -//// try { -//// throw "Hello"; -//// -//// try { -//// throw 10; -//// } -//// catch (x) { -//// return 100; -//// } -//// finally { -//// throw 10; -//// } -//// } -//// catch (x) { -//// throw "Something"; -//// } -//// finally { -//// throw "Also something"; -//// } -//// if (a > 0) { -//// return (function () { -//// return; -//// return; -//// return; -//// -//// if (false) { -//// return true; -//// } -//// throw "Hello!"; -//// })() || true; -//// } -//// -//// throw 10; -//// -//// var unusued = [1, 2, 3, 4].map(x => { [|thr/**/ow|] 4 }) -//// -//// return; -//// return true; -//// throw false; -////} - -test.ranges().forEach(r => { - goTo.position(r.start); - - test.ranges().forEach(range => { - verify.occurrencesAtPositionContains(range, false); - }); - - verify.occurrencesAtPositionCount(test.ranges().length); -}); - -goTo.marker(); -test.ranges().forEach(range => { - verify.occurrencesAtPositionContains(range, false); -}); +/// + +////function f(a: number) { +//// try { +//// throw "Hello"; +//// +//// try { +//// throw 10; +//// } +//// catch (x) { +//// return 100; +//// } +//// finally { +//// throw 10; +//// } +//// } +//// catch (x) { +//// throw "Something"; +//// } +//// finally { +//// throw "Also something"; +//// } +//// if (a > 0) { +//// return (function () { +//// return; +//// return; +//// return; +//// +//// if (false) { +//// return true; +//// } +//// throw "Hello!"; +//// })() || true; +//// } +//// +//// throw 10; +//// +//// var unusued = [1, 2, 3, 4].map(x => { [|thr/**/ow|] 4 }) +//// +//// return; +//// return true; +//// throw false; +////} + +test.ranges().forEach(r => { + goTo.position(r.start); + + test.ranges().forEach(range => { + verify.occurrencesAtPositionContains(range, false); + }); + + verify.occurrencesAtPositionCount(test.ranges().length); +}); + +goTo.marker(); +test.ranges().forEach(range => { + verify.occurrencesAtPositionContains(range, false); +}); diff --git a/tests/cases/fourslash/getOccurrencesThrow6.ts b/tests/cases/fourslash/getOccurrencesThrow6.ts index 2769c9933d..8b58347ed8 100644 --- a/tests/cases/fourslash/getOccurrencesThrow6.ts +++ b/tests/cases/fourslash/getOccurrencesThrow6.ts @@ -1,28 +1,28 @@ -/// - -////[|throw|] 100; -//// -////try { -//// throw 0; -//// var x = () => { throw 0; }; -////} -////catch (y) { -//// var x = () => { throw 0; }; -//// [|throw|] 200; -////} -////finally { -//// [|throw|] 300; -////} - - - -test.ranges().forEach(r => { - goTo.position(r.start); - - test.ranges().forEach(range => { - verify.occurrencesAtPositionContains(range, false); - }); - - verify.occurrencesAtPositionCount(test.ranges().length); -}); - +/// + +////[|throw|] 100; +//// +////try { +//// throw 0; +//// var x = () => { throw 0; }; +////} +////catch (y) { +//// var x = () => { throw 0; }; +//// [|throw|] 200; +////} +////finally { +//// [|throw|] 300; +////} + + + +test.ranges().forEach(r => { + goTo.position(r.start); + + test.ranges().forEach(range => { + verify.occurrencesAtPositionContains(range, false); + }); + + verify.occurrencesAtPositionCount(test.ranges().length); +}); + diff --git a/tests/cases/fourslash/getOccurrencesThrow7.ts b/tests/cases/fourslash/getOccurrencesThrow7.ts index 46e899a891..48ab981d76 100644 --- a/tests/cases/fourslash/getOccurrencesThrow7.ts +++ b/tests/cases/fourslash/getOccurrencesThrow7.ts @@ -1,31 +1,31 @@ -/// - -////try { -//// [|throw|] 10; -//// -//// try { -//// throw 10; -//// } -//// catch (x) { -//// [|throw|] 10; -//// } -//// finally { -//// [|throw|] 10; -//// } -////} -////finally { -//// [|throw|] 10; -////} -//// -////[|throw|] 10; - -test.ranges().forEach(r => { - goTo.position(r.start); - - test.ranges().forEach(range => { - verify.occurrencesAtPositionContains(range, false); - }); - - verify.occurrencesAtPositionCount(test.ranges().length); -}); - +/// + +////try { +//// [|throw|] 10; +//// +//// try { +//// throw 10; +//// } +//// catch (x) { +//// [|throw|] 10; +//// } +//// finally { +//// [|throw|] 10; +//// } +////} +////finally { +//// [|throw|] 10; +////} +//// +////[|throw|] 10; + +test.ranges().forEach(r => { + goTo.position(r.start); + + test.ranges().forEach(range => { + verify.occurrencesAtPositionContains(range, false); + }); + + verify.occurrencesAtPositionCount(test.ranges().length); +}); + diff --git a/tests/cases/fourslash/getOccurrencesThrow8.ts b/tests/cases/fourslash/getOccurrencesThrow8.ts index 679e13c8d5..cc527720dc 100644 --- a/tests/cases/fourslash/getOccurrencesThrow8.ts +++ b/tests/cases/fourslash/getOccurrencesThrow8.ts @@ -1,31 +1,31 @@ -/// - -////try { -//// throw 10; -//// -//// try { -//// [|throw|] 10; -//// } -//// catch (x) { -//// throw 10; -//// } -//// finally { -//// throw 10; -//// } -////} -////finally { -//// throw 10; -////} -//// -////throw 10; - -test.ranges().forEach(r => { - goTo.position(r.start); - - test.ranges().forEach(range => { - verify.occurrencesAtPositionContains(range, false); - }); - - verify.occurrencesAtPositionCount(test.ranges().length); -}); - +/// + +////try { +//// throw 10; +//// +//// try { +//// [|throw|] 10; +//// } +//// catch (x) { +//// throw 10; +//// } +//// finally { +//// throw 10; +//// } +////} +////finally { +//// throw 10; +////} +//// +////throw 10; + +test.ranges().forEach(r => { + goTo.position(r.start); + + test.ranges().forEach(range => { + verify.occurrencesAtPositionContains(range, false); + }); + + verify.occurrencesAtPositionCount(test.ranges().length); +}); + diff --git a/tests/cases/fourslash/getSemanticDiagnosticForDeclaration.ts b/tests/cases/fourslash/getSemanticDiagnosticForDeclaration.ts index 6345c46421..804abbde33 100644 --- a/tests/cases/fourslash/getSemanticDiagnosticForDeclaration.ts +++ b/tests/cases/fourslash/getSemanticDiagnosticForDeclaration.ts @@ -1,11 +1,11 @@ -/// - -// @module: CommonJS -// @declaration: true -//// interface privateInterface {} -//// export class Bar implements /*1*/privateInterface/*2*/{ } - -verify.errorExistsBetweenMarkers("1", "2"); -verify.numberOfErrorsInCurrentFile(1); - - +/// + +// @module: CommonJS +// @declaration: true +//// interface privateInterface {} +//// export class Bar implements /*1*/privateInterface/*2*/{ } + +verify.errorExistsBetweenMarkers("1", "2"); +verify.numberOfErrorsInCurrentFile(1); + + diff --git a/tests/cases/fourslash/getSemanticDiagnosticForNoDeclaration.ts b/tests/cases/fourslash/getSemanticDiagnosticForNoDeclaration.ts index dc351a21f2..cdcde01054 100644 --- a/tests/cases/fourslash/getSemanticDiagnosticForNoDeclaration.ts +++ b/tests/cases/fourslash/getSemanticDiagnosticForNoDeclaration.ts @@ -1,10 +1,10 @@ -/// - -// @module: CommonJS - -//// interface privateInterface {} -//// export class Bar implements /*1*/privateInterface/*2*/{ } - -verify.numberOfErrorsInCurrentFile(0); - - +/// + +// @module: CommonJS + +//// interface privateInterface {} +//// export class Bar implements /*1*/privateInterface/*2*/{ } + +verify.numberOfErrorsInCurrentFile(0); + + diff --git a/tests/cases/fourslash/globalCompletionListInsideObjectLiterals.ts b/tests/cases/fourslash/globalCompletionListInsideObjectLiterals.ts index 3f80f3d9c2..af7bc075f8 100644 --- a/tests/cases/fourslash/globalCompletionListInsideObjectLiterals.ts +++ b/tests/cases/fourslash/globalCompletionListInsideObjectLiterals.ts @@ -1,49 +1,49 @@ -/// - -////module ObjectLiterals { -//// interface MyPoint { -//// x1: number; -//// y1: number; -//// } -//// -//// // Negative cases (global completion) -//// var p1: MyPoint = /*1*/{ -//// }; -//// -//// var p2: MyPoint = { -//// x1: /*2*/ -//// /*3*/}; -//// -//// var p3: MyPoint = { -//// y1 /*4*/ -//// }; -//// -//// var p4: MyPoint = { -//// x1: /*5*/ /*6*/, -//// }; -////} - -function VerifyGlobalCompletionList() { - verify.completionListItemsCountIsGreaterThan(10); -} - -// Completion on '{' location. -goTo.marker("1"); -VerifyGlobalCompletionList(); - -// Literal member completion after member name with empty member expression and missing colon. -goTo.marker("2"); -VerifyGlobalCompletionList(); - -goTo.marker("3"); -VerifyGlobalCompletionList(); - -goTo.marker("4"); -VerifyGlobalCompletionList(); - -// Literal member completion after member name with empty member expression. -goTo.marker("5"); -VerifyGlobalCompletionList(); - -goTo.marker("6"); +/// + +////module ObjectLiterals { +//// interface MyPoint { +//// x1: number; +//// y1: number; +//// } +//// +//// // Negative cases (global completion) +//// var p1: MyPoint = /*1*/{ +//// }; +//// +//// var p2: MyPoint = { +//// x1: /*2*/ +//// /*3*/}; +//// +//// var p3: MyPoint = { +//// y1 /*4*/ +//// }; +//// +//// var p4: MyPoint = { +//// x1: /*5*/ /*6*/, +//// }; +////} + +function VerifyGlobalCompletionList() { + verify.completionListItemsCountIsGreaterThan(10); +} + +// Completion on '{' location. +goTo.marker("1"); +VerifyGlobalCompletionList(); + +// Literal member completion after member name with empty member expression and missing colon. +goTo.marker("2"); +VerifyGlobalCompletionList(); + +goTo.marker("3"); +VerifyGlobalCompletionList(); + +goTo.marker("4"); +VerifyGlobalCompletionList(); + +// Literal member completion after member name with empty member expression. +goTo.marker("5"); +VerifyGlobalCompletionList(); + +goTo.marker("6"); VerifyGlobalCompletionList(); \ No newline at end of file diff --git a/tests/cases/fourslash/goToDefinitionConstructorOverloads.ts b/tests/cases/fourslash/goToDefinitionConstructorOverloads.ts index 0c1248a042..a1fda8886d 100644 --- a/tests/cases/fourslash/goToDefinitionConstructorOverloads.ts +++ b/tests/cases/fourslash/goToDefinitionConstructorOverloads.ts @@ -1,22 +1,22 @@ -/// - -////class ConstructorOverload { -//// /*constructorOverload1*/constructor(); -//// /*constructorOverload2*/constructor(foo: string); -//// /*constructorDefinition*/constructor(foo: any) { } -////} -//// -////var constructorOverload = new /*constructorOverloadReference1*/ConstructorOverload(); -////var constructorOverload = new /*constructorOverloadReference2*/ConstructorOverload("foo"); - -goTo.marker('constructorOverloadReference1'); -goTo.definition(); -verify.caretAtMarker('constructorDefinition'); - -goTo.marker('constructorOverloadReference2'); -goTo.definition(); -verify.caretAtMarker('constructorDefinition'); - -goTo.marker('constructorOverload1'); -goTo.definition(); -verify.caretAtMarker('constructorDefinition'); +/// + +////class ConstructorOverload { +//// /*constructorOverload1*/constructor(); +//// /*constructorOverload2*/constructor(foo: string); +//// /*constructorDefinition*/constructor(foo: any) { } +////} +//// +////var constructorOverload = new /*constructorOverloadReference1*/ConstructorOverload(); +////var constructorOverload = new /*constructorOverloadReference2*/ConstructorOverload("foo"); + +goTo.marker('constructorOverloadReference1'); +goTo.definition(); +verify.caretAtMarker('constructorDefinition'); + +goTo.marker('constructorOverloadReference2'); +goTo.definition(); +verify.caretAtMarker('constructorDefinition'); + +goTo.marker('constructorOverload1'); +goTo.definition(); +verify.caretAtMarker('constructorDefinition'); diff --git a/tests/cases/fourslash/goToDefinitionDifferentFile.ts b/tests/cases/fourslash/goToDefinitionDifferentFile.ts index 54b799ba65..3aa31d1556 100644 --- a/tests/cases/fourslash/goToDefinitionDifferentFile.ts +++ b/tests/cases/fourslash/goToDefinitionDifferentFile.ts @@ -1,29 +1,29 @@ -/// - -// @Filename: goToDefinitionDifferentFile_Definition.ts -////var /*remoteVariableDefinition*/remoteVariable; -/////*remoteFunctionDefinition*/function remoteFunction() { } -/////*remoteClassDefinition*/class remoteClass { } -/////*remoteInterfaceDefinition*/interface remoteInterface{ } -/////*remoteModuleDefinition*/module remoteModule{ export var foo = 1;} - -// @Filename: goToDefinitionDifferentFile_Consumption.ts -/////*remoteVariableReference*/remoteVariable = 1; -/////*remoteFunctionReference*/remoteFunction(); -////var foo = new /*remoteClassReference*/remoteClass(); -////class fooCls implements /*remoteInterfaceReference*/remoteInterface { } -////var fooVar = /*remoteModuleReference*/remoteModule.foo; - -var markerList = [ - "remoteVariable", - "remoteFunction", - "remoteClass", - "remoteInterface", - "remoteModule", -]; - -markerList.forEach((marker) => { - goTo.marker(marker + 'Reference'); - goTo.definition(); - verify.caretAtMarker(marker + 'Definition'); -}); +/// + +// @Filename: goToDefinitionDifferentFile_Definition.ts +////var /*remoteVariableDefinition*/remoteVariable; +/////*remoteFunctionDefinition*/function remoteFunction() { } +/////*remoteClassDefinition*/class remoteClass { } +/////*remoteInterfaceDefinition*/interface remoteInterface{ } +/////*remoteModuleDefinition*/module remoteModule{ export var foo = 1;} + +// @Filename: goToDefinitionDifferentFile_Consumption.ts +/////*remoteVariableReference*/remoteVariable = 1; +/////*remoteFunctionReference*/remoteFunction(); +////var foo = new /*remoteClassReference*/remoteClass(); +////class fooCls implements /*remoteInterfaceReference*/remoteInterface { } +////var fooVar = /*remoteModuleReference*/remoteModule.foo; + +var markerList = [ + "remoteVariable", + "remoteFunction", + "remoteClass", + "remoteInterface", + "remoteModule", +]; + +markerList.forEach((marker) => { + goTo.marker(marker + 'Reference'); + goTo.definition(); + verify.caretAtMarker(marker + 'Definition'); +}); diff --git a/tests/cases/fourslash/goToDefinitionDifferentFileIndirectly.ts b/tests/cases/fourslash/goToDefinitionDifferentFileIndirectly.ts index c0675b29d2..7287fde2d1 100644 --- a/tests/cases/fourslash/goToDefinitionDifferentFileIndirectly.ts +++ b/tests/cases/fourslash/goToDefinitionDifferentFileIndirectly.ts @@ -1,36 +1,36 @@ -/// - -// @Filename: Remote2.ts -////var /*remoteVariableDefinition*/rem2Var; -/////*remoteFunctionDefinition*/function rem2Fn() { } -/////*remoteClassDefinition*/class rem2Cls { } -/////*remoteInterfaceDefinition*/interface rem2Int{} -/////*remoteModuleDefinition*/module rem2Mod { export var foo; } - -// @Filename: Remote1.ts -////var remVar; -////function remFn() { } -////class remCls { } -////interface remInt{} -////module remMod { export var foo; } - -// @Filename: Definition.ts -/////*remoteVariableReference*/rem2Var = 1; -/////*remoteFunctionReference*/rem2Fn(); -////var rem2foo = new /*remoteClassReference*/rem2Cls(); -////class rem2fooCls implements /*remoteInterfaceReference*/rem2Int { } -////var rem2fooVar = /*remoteModuleReference*/rem2Mod.foo; - -var markerList = [ - "remoteVariable", - "remoteFunction", - "remoteClass", - "remoteInterface", - "remoteModule", -]; - -markerList.forEach((marker) => { - goTo.marker(marker + 'Reference'); - goTo.definition(); - verify.caretAtMarker(marker + 'Definition'); +/// + +// @Filename: Remote2.ts +////var /*remoteVariableDefinition*/rem2Var; +/////*remoteFunctionDefinition*/function rem2Fn() { } +/////*remoteClassDefinition*/class rem2Cls { } +/////*remoteInterfaceDefinition*/interface rem2Int{} +/////*remoteModuleDefinition*/module rem2Mod { export var foo; } + +// @Filename: Remote1.ts +////var remVar; +////function remFn() { } +////class remCls { } +////interface remInt{} +////module remMod { export var foo; } + +// @Filename: Definition.ts +/////*remoteVariableReference*/rem2Var = 1; +/////*remoteFunctionReference*/rem2Fn(); +////var rem2foo = new /*remoteClassReference*/rem2Cls(); +////class rem2fooCls implements /*remoteInterfaceReference*/rem2Int { } +////var rem2fooVar = /*remoteModuleReference*/rem2Mod.foo; + +var markerList = [ + "remoteVariable", + "remoteFunction", + "remoteClass", + "remoteInterface", + "remoteModule", +]; + +markerList.forEach((marker) => { + goTo.marker(marker + 'Reference'); + goTo.definition(); + verify.caretAtMarker(marker + 'Definition'); }); \ No newline at end of file diff --git a/tests/cases/fourslash/goToDefinitionExternamModuleName.ts b/tests/cases/fourslash/goToDefinitionExternamModuleName.ts index 531e456284..f403965fe1 100644 --- a/tests/cases/fourslash/goToDefinitionExternamModuleName.ts +++ b/tests/cases/fourslash/goToDefinitionExternamModuleName.ts @@ -1,4 +1,4 @@ -/// +/// // @Filename: b.ts ////import n = require('a/*1*/'); diff --git a/tests/cases/fourslash/goToDefinitionExternamModuleName2.ts b/tests/cases/fourslash/goToDefinitionExternamModuleName2.ts index 3ef9c2555e..df7b331039 100644 --- a/tests/cases/fourslash/goToDefinitionExternamModuleName2.ts +++ b/tests/cases/fourslash/goToDefinitionExternamModuleName2.ts @@ -1,4 +1,4 @@ -/// +/// // @Filename: b.ts ////import n = require('a/*1*/'); diff --git a/tests/cases/fourslash/goToDefinitionExternamModuleName3.ts b/tests/cases/fourslash/goToDefinitionExternamModuleName3.ts index ace3851e5b..cd31f02789 100644 --- a/tests/cases/fourslash/goToDefinitionExternamModuleName3.ts +++ b/tests/cases/fourslash/goToDefinitionExternamModuleName3.ts @@ -1,4 +1,4 @@ -/// +/// // @Filename: b.ts ////import n = require('e/*1*/'); diff --git a/tests/cases/fourslash/goToDefinitionInterfaceAfterImplement.ts b/tests/cases/fourslash/goToDefinitionInterfaceAfterImplement.ts index 8867b67401..e6a763a98f 100644 --- a/tests/cases/fourslash/goToDefinitionInterfaceAfterImplement.ts +++ b/tests/cases/fourslash/goToDefinitionInterfaceAfterImplement.ts @@ -1,16 +1,16 @@ -/// - -/////*interfaceDefinition*/interface sInt { -//// sVar: number; -//// sFn: () => void; -////} -//// -////class iClass implements /*interfaceReference*/sInt { -//// public sVar = 1; -//// public sFn() { -//// } -////} - -goTo.marker('interfaceReference'); -goTo.definition(); +/// + +/////*interfaceDefinition*/interface sInt { +//// sVar: number; +//// sFn: () => void; +////} +//// +////class iClass implements /*interfaceReference*/sInt { +//// public sVar = 1; +//// public sFn() { +//// } +////} + +goTo.marker('interfaceReference'); +goTo.definition(); verify.caretAtMarker('interfaceDefinition'); \ No newline at end of file diff --git a/tests/cases/fourslash/goToDefinitionShadowVariableInsideModule.ts b/tests/cases/fourslash/goToDefinitionShadowVariableInsideModule.ts index dd073ccb6c..92f2761b61 100644 --- a/tests/cases/fourslash/goToDefinitionShadowVariableInsideModule.ts +++ b/tests/cases/fourslash/goToDefinitionShadowVariableInsideModule.ts @@ -1,10 +1,10 @@ -/// - -////module shdModule { -//// var /*shadowVariableDefinition*/shdVar; -//// /*shadowVariableReference*/shdVar = 1; -////} - -goTo.marker('shadowVariableReference'); -goTo.definition(); +/// + +////module shdModule { +//// var /*shadowVariableDefinition*/shdVar; +//// /*shadowVariableReference*/shdVar = 1; +////} + +goTo.marker('shadowVariableReference'); +goTo.definition(); verify.caretAtMarker('shadowVariableDefinition'); \ No newline at end of file diff --git a/tests/cases/fourslash/goToDefinitionShorthandProperty.ts b/tests/cases/fourslash/goToDefinitionShorthandProperty.ts index 07ea82c03e..5e90689371 100644 --- a/tests/cases/fourslash/goToDefinitionShorthandProperty.ts +++ b/tests/cases/fourslash/goToDefinitionShorthandProperty.ts @@ -1,4 +1,4 @@ -/// +/// //// var /*valueDeclaration1*/name = "hello"; //// var /*valueDeclaration2*/id = 100000; diff --git a/tests/cases/fourslash/goToDefinitionSourceUnit.ts b/tests/cases/fourslash/goToDefinitionSourceUnit.ts index 5a310d3ffc..09900ff41b 100644 --- a/tests/cases/fourslash/goToDefinitionSourceUnit.ts +++ b/tests/cases/fourslash/goToDefinitionSourceUnit.ts @@ -1,24 +1,24 @@ -/// - -// @Filename: a.ts -//// //MyFile Comments -//// //more comments -//// /// -//// /// -//// -//// class clsInOverload { -//// static fnOverload(); -//// static fnOverload(foo: string); -//// static fnOverload(foo: any) { } -//// } -//// - -// @Filename: b.ts -/////*fileB*/ - -goTo.marker("unknownFile"); -verify.not.definitionLocationExists(); - -goTo.marker("knownFile"); -goTo.definition(); -verify.caretAtMarker('fileB'); +/// + +// @Filename: a.ts +//// //MyFile Comments +//// //more comments +//// /// +//// /// +//// +//// class clsInOverload { +//// static fnOverload(); +//// static fnOverload(foo: string); +//// static fnOverload(foo: any) { } +//// } +//// + +// @Filename: b.ts +/////*fileB*/ + +goTo.marker("unknownFile"); +verify.not.definitionLocationExists(); + +goTo.marker("knownFile"); +goTo.definition(); +verify.caretAtMarker('fileB'); diff --git a/tests/cases/fourslash/importDeclPaste0.ts b/tests/cases/fourslash/importDeclPaste0.ts index 6bb8eb6894..f86920cdfd 100644 --- a/tests/cases/fourslash/importDeclPaste0.ts +++ b/tests/cases/fourslash/importDeclPaste0.ts @@ -1,18 +1,18 @@ -/// - -//// // @Filename: exportEqualsInterface_A.ts -//// interface A { -//// p1: number; -//// } -//// -//// export = A; -//// /*1*/ -//// var i: I1; -//// -//// var n: number = i.p1; - -edit.disableFormatting(); - -goTo.marker('1'); - -//edit.insert("\nimport I1 = module(\"exportEqualsInterface_A\");\n"); +/// + +//// // @Filename: exportEqualsInterface_A.ts +//// interface A { +//// p1: number; +//// } +//// +//// export = A; +//// /*1*/ +//// var i: I1; +//// +//// var n: number = i.p1; + +edit.disableFormatting(); + +goTo.marker('1'); + +//edit.insert("\nimport I1 = module(\"exportEqualsInterface_A\");\n"); diff --git a/tests/cases/fourslash/importValueUsedAsType.ts b/tests/cases/fourslash/importValueUsedAsType.ts index e2b881eb9b..f3e5fb5486 100644 --- a/tests/cases/fourslash/importValueUsedAsType.ts +++ b/tests/cases/fourslash/importValueUsedAsType.ts @@ -1,12 +1,12 @@ -/// - -//// /**/ -//// module A { -//// export var X; -//// import Z = A.X; -//// var v: Z; -//// } - -goTo.marker(); -// Used to crash here -edit.insert(' '); +/// + +//// /**/ +//// module A { +//// export var X; +//// import Z = A.X; +//// var v: Z; +//// } + +goTo.marker(); +// Used to crash here +edit.insert(' '); diff --git a/tests/cases/fourslash/incrementalUpdateToClassImplementingGenericClass.ts b/tests/cases/fourslash/incrementalUpdateToClassImplementingGenericClass.ts index 8bb6cf489d..f8dcc0a1f3 100644 --- a/tests/cases/fourslash/incrementalUpdateToClassImplementingGenericClass.ts +++ b/tests/cases/fourslash/incrementalUpdateToClassImplementingGenericClass.ts @@ -12,7 +12,7 @@ //// /*1*/get name2() { return this.name; } ////} ////var a = new Animal2('eprst'); - + goTo.marker('1'); diff --git a/tests/cases/fourslash/indentionsOfCommentBlockAfterFormatting.ts b/tests/cases/fourslash/indentionsOfCommentBlockAfterFormatting.ts index 4247b0e5e4..3b686285b9 100644 --- a/tests/cases/fourslash/indentionsOfCommentBlockAfterFormatting.ts +++ b/tests/cases/fourslash/indentionsOfCommentBlockAfterFormatting.ts @@ -1,43 +1,43 @@ -/// - -////// This is a test case of formatting. -////class TestClass { -////private foo: string; -////public bar: string; -////constructor(foo: string, bar: string) { -////this.foo = foo; -////this.bar = bar; -////} -/////** /*1*/ -////* This document is to be formatted./*2*/ -////* /*3*/ -////* After formatting, each line of this comment block should have indent consistent with the method./*4*/ -////* -//// */ -/////*5*/public testMethod() { -////} -////} -////var cookieMonster: TestClass; -////cookieMonster = new TestClass("FOO", "BAR"); - - -format.document(); -goTo.marker("1"); -verify.indentationIs(4); -goTo.marker("2"); -verify.indentationIs(4); -goTo.marker("3"); -verify.indentationIs(4); -goTo.marker("4"); -verify.indentationIs(4); -// Putting a marker in line "*" would bring some error when parsing code in automation. -// So move right by 1 offset from marker 4 to locate the caret in this line. -edit.moveRight(1); -verify.indentationIs(4); -// Putting a marker in line " */" would bring some error when parsing code in automation. -// So move left by 1 offset from marker 5 to locate the caret in this line. -goTo.marker("5"); -edit.moveLeft(1); -verify.indentationIs(4); -goTo.marker("5"); +/// + +////// This is a test case of formatting. +////class TestClass { +////private foo: string; +////public bar: string; +////constructor(foo: string, bar: string) { +////this.foo = foo; +////this.bar = bar; +////} +/////** /*1*/ +////* This document is to be formatted./*2*/ +////* /*3*/ +////* After formatting, each line of this comment block should have indent consistent with the method./*4*/ +////* +//// */ +/////*5*/public testMethod() { +////} +////} +////var cookieMonster: TestClass; +////cookieMonster = new TestClass("FOO", "BAR"); + + +format.document(); +goTo.marker("1"); +verify.indentationIs(4); +goTo.marker("2"); +verify.indentationIs(4); +goTo.marker("3"); +verify.indentationIs(4); +goTo.marker("4"); +verify.indentationIs(4); +// Putting a marker in line "*" would bring some error when parsing code in automation. +// So move right by 1 offset from marker 4 to locate the caret in this line. +edit.moveRight(1); +verify.indentationIs(4); +// Putting a marker in line " */" would bring some error when parsing code in automation. +// So move left by 1 offset from marker 5 to locate the caret in this line. +goTo.marker("5"); +edit.moveLeft(1); +verify.indentationIs(4); +goTo.marker("5"); verify.indentationIs(4); \ No newline at end of file diff --git a/tests/cases/fourslash/indexSignatureWithoutAnnotation.ts b/tests/cases/fourslash/indexSignatureWithoutAnnotation.ts index bc7449ece7..af5fe9010f 100644 --- a/tests/cases/fourslash/indexSignatureWithoutAnnotation.ts +++ b/tests/cases/fourslash/indexSignatureWithoutAnnotation.ts @@ -1,5 +1,5 @@ -/// - +/// + //// interface B { //// 1: any; //// } @@ -8,6 +8,6 @@ //// } //// interface D extends B, C /**/ { //// } - -goTo.marker(); -edit.insert(" "); + +goTo.marker(); +edit.insert(" "); diff --git a/tests/cases/fourslash/insertArgumentBeforeOverloadedConstructor.ts b/tests/cases/fourslash/insertArgumentBeforeOverloadedConstructor.ts index 659a3fb035..7c8b9571c4 100644 --- a/tests/cases/fourslash/insertArgumentBeforeOverloadedConstructor.ts +++ b/tests/cases/fourslash/insertArgumentBeforeOverloadedConstructor.ts @@ -1,11 +1,11 @@ -/// - -//// alert(/**/100); -//// -//// class OverloadedMonster { -//// constructor(); -//// constructor(name) { } -//// } - -goTo.marker(); -edit.insert("'1', "); +/// + +//// alert(/**/100); +//// +//// class OverloadedMonster { +//// constructor(); +//// constructor(name) { } +//// } + +goTo.marker(); +edit.insert("'1', "); diff --git a/tests/cases/fourslash/insertInterfaceAndCheckTypeLiteralField.ts b/tests/cases/fourslash/insertInterfaceAndCheckTypeLiteralField.ts index 0cb5db908e..d941421b12 100644 --- a/tests/cases/fourslash/insertInterfaceAndCheckTypeLiteralField.ts +++ b/tests/cases/fourslash/insertInterfaceAndCheckTypeLiteralField.ts @@ -1,11 +1,11 @@ -/// - -//// /*addC*/ -//// interface G { } -//// var v2: G<{ a: /*checkParam*/C }, C>; - -goTo.marker('addC'); -edit.insert('interface C { }'); - -goTo.marker('checkParam'); -verify.quickInfoExists(); +/// + +//// /*addC*/ +//// interface G { } +//// var v2: G<{ a: /*checkParam*/C }, C>; + +goTo.marker('addC'); +edit.insert('interface C { }'); + +goTo.marker('checkParam'); +verify.quickInfoExists(); diff --git a/tests/cases/fourslash/insertMethodCallAboveOthers.ts b/tests/cases/fourslash/insertMethodCallAboveOthers.ts index 4f7e1cf0e6..5b8fe45d94 100644 --- a/tests/cases/fourslash/insertMethodCallAboveOthers.ts +++ b/tests/cases/fourslash/insertMethodCallAboveOthers.ts @@ -1,8 +1,8 @@ -/// - -//// /**/ -//// paired.reduce(); -//// paired.map(() => undefined); - -goTo.marker(); -edit.insert("paired.reduce();"); +/// + +//// /**/ +//// paired.reduce(); +//// paired.map(() => undefined); + +goTo.marker(); +edit.insert("paired.reduce();"); diff --git a/tests/cases/fourslash/insertPublicBeforeSetter.ts b/tests/cases/fourslash/insertPublicBeforeSetter.ts index ca83d3ce05..1fb0b40e01 100644 --- a/tests/cases/fourslash/insertPublicBeforeSetter.ts +++ b/tests/cases/fourslash/insertPublicBeforeSetter.ts @@ -1,9 +1,9 @@ -/// - -//// class C { -//// /**/set Bar(bar:string) {} -//// } -//// var o2 = { set Foo(val:number) { } }; - -goTo.marker(); -edit.insert("public "); +/// + +//// class C { +//// /**/set Bar(bar:string) {} +//// } +//// var o2 = { set Foo(val:number) { } }; + +goTo.marker(); +edit.insert("public "); diff --git a/tests/cases/fourslash/insertSecondTryCatchBlock.ts b/tests/cases/fourslash/insertSecondTryCatchBlock.ts index 1d6f1963ad..89bf0f0267 100644 --- a/tests/cases/fourslash/insertSecondTryCatchBlock.ts +++ b/tests/cases/fourslash/insertSecondTryCatchBlock.ts @@ -1,7 +1,7 @@ -/// - -//// try {} catch(e) { } -//// /**/ - -goTo.marker(); -edit.insert('try {} catch(e) { }'); +/// + +//// try {} catch(e) { } +//// /**/ + +goTo.marker(); +edit.insert('try {} catch(e) { }'); diff --git a/tests/cases/fourslash/localGetReferences.ts b/tests/cases/fourslash/localGetReferences.ts index b390f9bef8..6d5f541dd5 100644 --- a/tests/cases/fourslash/localGetReferences.ts +++ b/tests/cases/fourslash/localGetReferences.ts @@ -1,238 +1,238 @@ -/// - -// @Filename: localGetReferences_1.ts -////// Comment Refence Test: g/*1*/lobalVar -////var g/*3*/lobalVar: n/*2*/umber = 2; -//// -////class fooCls { -//// static clsS/*5*/Var = 1; -//// //Declare -//// cls/*4*/Var = 1; -//// -//// constructor (public clsParam: number) { -//// //Increments -//// globalVar++; -//// this.clsVar++; -//// fooCls.clsSVar++; -//// this.cls/*7*/Param++; -//// modTest.modVar++; -//// } -////} -//// -////function foo(/*8*/x: number) { -//// //Declare -//// var fn/*6*/Var = 1; -//// -//// //Increments -//// fooCls.clsSVar++; -//// globalVar++; -//// modTest.modVar++; -//// fnVar++; -//// -//// //Return -//// return x++; -////} -//// -////module modTest { -//// //Declare -//// export var modVar:number; -//// -//// //Increments -//// globalVar++; -//// fooCls.clsSVar++; -//// modVar++; -//// -//// class testCls { -//// static boo = foo; -//// } -//// -//// function testFn(){ -//// static boo = foo; -//// -//// //Increments -//// globalVar++; -//// fooCls.clsSVar++; -//// modVar++; -//// } -//// -//// module testMod { -//// var boo = foo; -//// } -////} -//// -//////Type test -////var clsTest: fooCls; -//// -//////Arguments -////clsTest = new fooCls(globalV/*10*/ar); -////foo(glo/*9*/balVar); -//// -//////Increments -////fooCls.clsSVar++; -////modTest.modVar++; -////globalVar = globalVar + globalVar; -//// -//////ETC - Other cases -////globalVar = 3; -/////*11*/foo = foo + 1; -/////*12*/err = err++; -/////*13*/ -//////Shadowed fn Parameter -////function shdw(globa/*14*/lVar: number) { -//// //Increments -//// globalVar++; -//// return globalVar; -////} -//// -//////Remotes -//////Type test -////var remoteclsTest: remotefooCls; -//// -//////Arguments -////remoteclsTest = new remotefooCls(remoteglobalVar); -////remotefoo(remoteglobalVar); -//// -//////Increments -////remotefooCls.remoteclsSVar++; -////remotemodTest.remotemodVar++; -////remoteglobalVar = remoteglobalVar + remoteglobalVar; -//// -//////ETC - Other cases -////remoteglobalVar = 3; -//// -//////Find References misses method param -////var -//// -//// -//// -//// array = ["f", "o", "o"]; -//// -////array.forEach( -//// -//// -////function(str) { -//// -//// -//// -//// return /*15*/str + " "; -//// -////}); - -// @Filename: localGetReferences_2.ts -////var remoteglobalVar: number = 2; -//// -////class remotefooCls { -//// //Declare -//// remoteclsVar = 1; -//// static remoteclsSVar = 1; -//// -//// constructor(public remoteclsParam: number) { -//// //Increments -//// remoteglobalVar++; -//// this.remoteclsVar++; -//// remotefooCls.remoteclsSVar++; -//// this.remoteclsParam++; -//// remotemodTest.remotemodVar++; -//// } -////} -//// -////function remotefoo(remotex: number) { -//// //Declare -//// var remotefnVar = 1; -//// -//// //Increments -//// remotefooCls.remoteclsSVar++; -//// remoteglobalVar++; -//// remotemodTest.remotemodVar++; -//// remotefnVar++; -//// -//// //Return -//// return remotex++; -////} -//// -////module remotemodTest { -//// //Declare -//// export var remotemodVar: number; -//// -//// //Increments -//// remoteglobalVar++; -//// remotefooCls.remoteclsSVar++; -//// remotemodVar++; -//// -//// class remotetestCls { -//// static remoteboo = remotefoo; -//// } -//// -//// function remotetestFn(){ -//// static remoteboo = remotefoo; -//// -//// //Increments -//// remoteglobalVar++; -//// remotefooCls.remoteclsSVar++; -//// remotemodVar++; -//// } -//// -//// module remotetestMod { -//// var remoteboo = remotefoo; -//// } -////} - -// References to comment. -goTo.marker("1"); -verify.referencesCountIs(0); - -// References to type. -goTo.marker("2"); -verify.referencesCountIs(0); - -// References to a variable declared in global. -goTo.marker("3"); -verify.referencesCountIs(11); - -// References to a variable declared in a class. -goTo.marker("4"); -verify.referencesCountIs(2); - -// References to static variable declared in a class. -goTo.marker("5"); -verify.referencesCountIs(6); - -// References to a variable declared in a function. -goTo.marker("6"); -verify.referencesCountIs(2); - -// References to a class parameter. -goTo.marker("7"); -verify.referencesCountIs(2); - -// References to a function parameter. -goTo.marker("8"); -verify.referencesCountIs(2); - -// References to a function argument. -goTo.marker("9"); -verify.referencesCountIs(11); - -// References to a class argument. -goTo.marker("10"); -verify.referencesCountIs(11); - -// References to illegal assignment. -goTo.marker("11"); -verify.referencesCountIs(7); - -// References to unresolved symbol. -goTo.marker("12"); -verify.referencesCountIs(1); - -// References to no context. -goTo.marker("13"); -verify.referencesCountIs(0); - -// References to shadowed function parameter. -goTo.marker("14"); -verify.referencesCountIs(3); - -// Reference misses function parameter. -goTo.marker("15"); +/// + +// @Filename: localGetReferences_1.ts +////// Comment Refence Test: g/*1*/lobalVar +////var g/*3*/lobalVar: n/*2*/umber = 2; +//// +////class fooCls { +//// static clsS/*5*/Var = 1; +//// //Declare +//// cls/*4*/Var = 1; +//// +//// constructor (public clsParam: number) { +//// //Increments +//// globalVar++; +//// this.clsVar++; +//// fooCls.clsSVar++; +//// this.cls/*7*/Param++; +//// modTest.modVar++; +//// } +////} +//// +////function foo(/*8*/x: number) { +//// //Declare +//// var fn/*6*/Var = 1; +//// +//// //Increments +//// fooCls.clsSVar++; +//// globalVar++; +//// modTest.modVar++; +//// fnVar++; +//// +//// //Return +//// return x++; +////} +//// +////module modTest { +//// //Declare +//// export var modVar:number; +//// +//// //Increments +//// globalVar++; +//// fooCls.clsSVar++; +//// modVar++; +//// +//// class testCls { +//// static boo = foo; +//// } +//// +//// function testFn(){ +//// static boo = foo; +//// +//// //Increments +//// globalVar++; +//// fooCls.clsSVar++; +//// modVar++; +//// } +//// +//// module testMod { +//// var boo = foo; +//// } +////} +//// +//////Type test +////var clsTest: fooCls; +//// +//////Arguments +////clsTest = new fooCls(globalV/*10*/ar); +////foo(glo/*9*/balVar); +//// +//////Increments +////fooCls.clsSVar++; +////modTest.modVar++; +////globalVar = globalVar + globalVar; +//// +//////ETC - Other cases +////globalVar = 3; +/////*11*/foo = foo + 1; +/////*12*/err = err++; +/////*13*/ +//////Shadowed fn Parameter +////function shdw(globa/*14*/lVar: number) { +//// //Increments +//// globalVar++; +//// return globalVar; +////} +//// +//////Remotes +//////Type test +////var remoteclsTest: remotefooCls; +//// +//////Arguments +////remoteclsTest = new remotefooCls(remoteglobalVar); +////remotefoo(remoteglobalVar); +//// +//////Increments +////remotefooCls.remoteclsSVar++; +////remotemodTest.remotemodVar++; +////remoteglobalVar = remoteglobalVar + remoteglobalVar; +//// +//////ETC - Other cases +////remoteglobalVar = 3; +//// +//////Find References misses method param +////var +//// +//// +//// +//// array = ["f", "o", "o"]; +//// +////array.forEach( +//// +//// +////function(str) { +//// +//// +//// +//// return /*15*/str + " "; +//// +////}); + +// @Filename: localGetReferences_2.ts +////var remoteglobalVar: number = 2; +//// +////class remotefooCls { +//// //Declare +//// remoteclsVar = 1; +//// static remoteclsSVar = 1; +//// +//// constructor(public remoteclsParam: number) { +//// //Increments +//// remoteglobalVar++; +//// this.remoteclsVar++; +//// remotefooCls.remoteclsSVar++; +//// this.remoteclsParam++; +//// remotemodTest.remotemodVar++; +//// } +////} +//// +////function remotefoo(remotex: number) { +//// //Declare +//// var remotefnVar = 1; +//// +//// //Increments +//// remotefooCls.remoteclsSVar++; +//// remoteglobalVar++; +//// remotemodTest.remotemodVar++; +//// remotefnVar++; +//// +//// //Return +//// return remotex++; +////} +//// +////module remotemodTest { +//// //Declare +//// export var remotemodVar: number; +//// +//// //Increments +//// remoteglobalVar++; +//// remotefooCls.remoteclsSVar++; +//// remotemodVar++; +//// +//// class remotetestCls { +//// static remoteboo = remotefoo; +//// } +//// +//// function remotetestFn(){ +//// static remoteboo = remotefoo; +//// +//// //Increments +//// remoteglobalVar++; +//// remotefooCls.remoteclsSVar++; +//// remotemodVar++; +//// } +//// +//// module remotetestMod { +//// var remoteboo = remotefoo; +//// } +////} + +// References to comment. +goTo.marker("1"); +verify.referencesCountIs(0); + +// References to type. +goTo.marker("2"); +verify.referencesCountIs(0); + +// References to a variable declared in global. +goTo.marker("3"); +verify.referencesCountIs(11); + +// References to a variable declared in a class. +goTo.marker("4"); +verify.referencesCountIs(2); + +// References to static variable declared in a class. +goTo.marker("5"); +verify.referencesCountIs(6); + +// References to a variable declared in a function. +goTo.marker("6"); +verify.referencesCountIs(2); + +// References to a class parameter. +goTo.marker("7"); +verify.referencesCountIs(2); + +// References to a function parameter. +goTo.marker("8"); +verify.referencesCountIs(2); + +// References to a function argument. +goTo.marker("9"); +verify.referencesCountIs(11); + +// References to a class argument. +goTo.marker("10"); +verify.referencesCountIs(11); + +// References to illegal assignment. +goTo.marker("11"); +verify.referencesCountIs(7); + +// References to unresolved symbol. +goTo.marker("12"); +verify.referencesCountIs(1); + +// References to no context. +goTo.marker("13"); +verify.referencesCountIs(0); + +// References to shadowed function parameter. +goTo.marker("14"); +verify.referencesCountIs(3); + +// Reference misses function parameter. +goTo.marker("15"); verify.referencesCountIs(2); \ No newline at end of file diff --git a/tests/cases/fourslash/malformedObjectLiteral.ts b/tests/cases/fourslash/malformedObjectLiteral.ts index dd0690c4ca..85d1a95618 100644 --- a/tests/cases/fourslash/malformedObjectLiteral.ts +++ b/tests/cases/fourslash/malformedObjectLiteral.ts @@ -1,10 +1,10 @@ -/// - -////var tt = { aa };/**/ -////var y = /*1*/"unclosed string literal -/////*2*/var x = "closed string literal" -verify.errorExistsBeforeMarker(); -verify.errorExistsAfterMarker("1"); -verify.not.errorExistsAfterMarker("2"); - - +/// + +////var tt = { aa };/**/ +////var y = /*1*/"unclosed string literal +/////*2*/var x = "closed string literal" +verify.errorExistsBeforeMarker(); +verify.errorExistsAfterMarker("1"); +verify.not.errorExistsAfterMarker("2"); + + diff --git a/tests/cases/fourslash/memberCompletionFromFunctionCall.ts b/tests/cases/fourslash/memberCompletionFromFunctionCall.ts index a60a2d37b2..56629a3b51 100644 --- a/tests/cases/fourslash/memberCompletionFromFunctionCall.ts +++ b/tests/cases/fourslash/memberCompletionFromFunctionCall.ts @@ -1,12 +1,12 @@ -/// - -////declare interface ifoo { -//// text: (value: any) => ifoo; -////} -////declare var foo: ifoo; -////foo.text(function() { })/**/ - -goTo.marker(); -edit.insert("."); -verify.not.memberListIsEmpty(); +/// + +////declare interface ifoo { +//// text: (value: any) => ifoo; +////} +////declare var foo: ifoo; +////foo.text(function() { })/**/ + +goTo.marker(); +edit.insert("."); +verify.not.memberListIsEmpty(); verify.memberListContains("text"); \ No newline at end of file diff --git a/tests/cases/fourslash/memberConstructorEdits.ts b/tests/cases/fourslash/memberConstructorEdits.ts index 2bc2018cd8..45d631cd2b 100644 --- a/tests/cases/fourslash/memberConstructorEdits.ts +++ b/tests/cases/fourslash/memberConstructorEdits.ts @@ -1,26 +1,26 @@ -/// - -//// module M { -//// export class A { -//// constructor(a: string) {} -//// public m(n: number) { -//// return 0; -//// } -//// public n() { -//// return this.m(0); -//// } -//// } -//// export class B extends A { -//// constructor(a: string) { -//// super(a); -//// } -//// /*1*/ -//// } -//// var a = new A("s"); -//// var b = new B("s"); -//// } - -verify.numberOfErrorsInCurrentFile(0); -goTo.marker('1'); -edit.insert("public m(n: number) { return 0; }"); +/// + +//// module M { +//// export class A { +//// constructor(a: string) {} +//// public m(n: number) { +//// return 0; +//// } +//// public n() { +//// return this.m(0); +//// } +//// } +//// export class B extends A { +//// constructor(a: string) { +//// super(a); +//// } +//// /*1*/ +//// } +//// var a = new A("s"); +//// var b = new B("s"); +//// } + +verify.numberOfErrorsInCurrentFile(0); +goTo.marker('1'); +edit.insert("public m(n: number) { return 0; }"); verify.numberOfErrorsInCurrentFile(0); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListAfterSingleDot.ts b/tests/cases/fourslash/memberListAfterSingleDot.ts index e6e5d8ad0e..0bc5107f2c 100644 --- a/tests/cases/fourslash/memberListAfterSingleDot.ts +++ b/tests/cases/fourslash/memberListAfterSingleDot.ts @@ -1,6 +1,6 @@ -/// - -////./**/ - -goTo.marker(); +/// + +////./**/ + +goTo.marker(); verify.not.memberListIsEmpty(); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListErrorRecovery.ts b/tests/cases/fourslash/memberListErrorRecovery.ts index d1957ba3e4..74bd25464f 100644 --- a/tests/cases/fourslash/memberListErrorRecovery.ts +++ b/tests/cases/fourslash/memberListErrorRecovery.ts @@ -1,10 +1,10 @@ -/// - -////class Foo { static fun() { }; } -//// -////Foo./**/; -/////*1*/var bar; - -goTo.marker(); -verify.memberListContains("fun"); +/// + +////class Foo { static fun() { }; } +//// +////Foo./**/; +/////*1*/var bar; + +goTo.marker(); +verify.memberListContains("fun"); verify.not.errorExistsAfterMarker("1"); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListInsideObjectLiterals.ts b/tests/cases/fourslash/memberListInsideObjectLiterals.ts index 6da0ac5b56..99d62cbc6e 100644 --- a/tests/cases/fourslash/memberListInsideObjectLiterals.ts +++ b/tests/cases/fourslash/memberListInsideObjectLiterals.ts @@ -1,41 +1,41 @@ -/// - -////module ObjectLiterals { -//// interface MyPoint { -//// x1: number; -//// y1: number; -//// } -//// -//// var p1: MyPoint = { -//// /*1*/ -//// }; -//// -//// var p2: MyPoint = { -//// x1: 5, -//// /*2*/ -//// }; -//// -//// var p3: MyPoint = { -//// x1/*3*/: -//// }; -//// -//// var p4: MyPoint = { -//// /*4*/y1 -//// }; -////} - -// Literal member completion inside empty literal. -goTo.marker("1"); -verify.memberListContains("x1", "(property) MyPoint.x1: number"); -verify.memberListContains("y1", "(property) MyPoint.y1: number"); - -// Literal member completion for 2nd member name. -goTo.marker("2"); -verify.memberListContains("y1", "(property) MyPoint.y1: number"); - -// Literal member completion at existing member name location. -goTo.marker("3"); -verify.memberListContains("y1", "(property) MyPoint.y1: number"); - -goTo.marker("4"); +/// + +////module ObjectLiterals { +//// interface MyPoint { +//// x1: number; +//// y1: number; +//// } +//// +//// var p1: MyPoint = { +//// /*1*/ +//// }; +//// +//// var p2: MyPoint = { +//// x1: 5, +//// /*2*/ +//// }; +//// +//// var p3: MyPoint = { +//// x1/*3*/: +//// }; +//// +//// var p4: MyPoint = { +//// /*4*/y1 +//// }; +////} + +// Literal member completion inside empty literal. +goTo.marker("1"); +verify.memberListContains("x1", "(property) MyPoint.x1: number"); +verify.memberListContains("y1", "(property) MyPoint.y1: number"); + +// Literal member completion for 2nd member name. +goTo.marker("2"); +verify.memberListContains("y1", "(property) MyPoint.y1: number"); + +// Literal member completion at existing member name location. +goTo.marker("3"); +verify.memberListContains("y1", "(property) MyPoint.y1: number"); + +goTo.marker("4"); verify.memberListContains("x1", "(property) MyPoint.x1: number"); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOfClass.ts b/tests/cases/fourslash/memberListOfClass.ts index c12e781a85..6c93a0536d 100644 --- a/tests/cases/fourslash/memberListOfClass.ts +++ b/tests/cases/fourslash/memberListOfClass.ts @@ -1,15 +1,15 @@ -/// - -////class C1 { -//// public pubMeth() { } -//// private privMeth() { } -//// public pubProp = 0; -//// private privProp = 0; -////} -////var f = new C1(); -////f./**/ - -goTo.marker(); -verify.memberListCount(2); -verify.memberListContains('pubMeth', '(method) C1.pubMeth(): void'); +/// + +////class C1 { +//// public pubMeth() { } +//// private privMeth() { } +//// public pubProp = 0; +//// private privProp = 0; +////} +////var f = new C1(); +////f./**/ + +goTo.marker(); +verify.memberListCount(2); +verify.memberListContains('pubMeth', '(method) C1.pubMeth(): void'); verify.memberListContains('pubProp', '(property) C1.pubProp: number'); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOfEnumInModule.ts b/tests/cases/fourslash/memberListOfEnumInModule.ts index 09db5d2461..f92c5d43ea 100644 --- a/tests/cases/fourslash/memberListOfEnumInModule.ts +++ b/tests/cases/fourslash/memberListOfEnumInModule.ts @@ -1,13 +1,13 @@ -/// - -////module Fixes { -//// enum Foo { -//// bar, -//// baz -//// } -//// var f: Foo = Foo./**/; -////} - -goTo.marker(); -verify.memberListContains("bar"); +/// + +////module Fixes { +//// enum Foo { +//// bar, +//// baz +//// } +//// var f: Foo = Foo./**/; +////} + +goTo.marker(); +verify.memberListContains("bar"); verify.memberListContains("baz"); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOfExportedClass.ts b/tests/cases/fourslash/memberListOfExportedClass.ts index eaebab14f2..f6632bfe7b 100644 --- a/tests/cases/fourslash/memberListOfExportedClass.ts +++ b/tests/cases/fourslash/memberListOfExportedClass.ts @@ -1,15 +1,15 @@ -/// - -////module M { -//// export class C { public pub = 0; private priv = 1; } -//// export var V = 0; -////} -//// -//// -////var c = new M.C(); -//// -////c./**/ // test on c. - -goTo.marker(); -verify.memberListCount(1); +/// + +////module M { +//// export class C { public pub = 0; private priv = 1; } +//// export var V = 0; +////} +//// +//// +////var c = new M.C(); +//// +////c./**/ // test on c. + +goTo.marker(); +verify.memberListCount(1); verify.memberListContains('pub', '(property) M.C.pub: number'); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOfModule.ts b/tests/cases/fourslash/memberListOfModule.ts index be6066043d..f09dfd67db 100644 --- a/tests/cases/fourslash/memberListOfModule.ts +++ b/tests/cases/fourslash/memberListOfModule.ts @@ -1,19 +1,19 @@ -/// - -////module Foo { -//// export class Bar { -//// -//// } -//// -//// -//// export module Blah { -//// -//// } -////} -//// -////var x: Foo./**/ - -goTo.marker(); -verify.memberListCount(2); -verify.memberListContains('Bar'); +/// + +////module Foo { +//// export class Bar { +//// +//// } +//// +//// +//// export module Blah { +//// +//// } +////} +//// +////var x: Foo./**/ + +goTo.marker(); +verify.memberListCount(2); +verify.memberListContains('Bar'); verify.memberListContains('Blah'); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOfModuleAfterInvalidCharater.ts b/tests/cases/fourslash/memberListOfModuleAfterInvalidCharater.ts index a571c519c0..b5bd4fb6bb 100644 --- a/tests/cases/fourslash/memberListOfModuleAfterInvalidCharater.ts +++ b/tests/cases/fourslash/memberListOfModuleAfterInvalidCharater.ts @@ -1,10 +1,10 @@ -/// - -////module testModule { -//// export var foo = 1; -////} -////@ -////testModule./**/ - -goTo.marker(); +/// + +////module testModule { +//// export var foo = 1; +////} +////@ +////testModule./**/ + +goTo.marker(); verify.completionListContains('foo', '(var) testModule.foo: number'); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOfModuleBeforeKeyword.ts b/tests/cases/fourslash/memberListOfModuleBeforeKeyword.ts index 33f085cde0..0ea07e87a0 100644 --- a/tests/cases/fourslash/memberListOfModuleBeforeKeyword.ts +++ b/tests/cases/fourslash/memberListOfModuleBeforeKeyword.ts @@ -1,24 +1,24 @@ -/// - -////module TypeModule1 { -//// export class C1 { } -//// export class C2 { } -////} -////var x: TypeModule1./*namedType*/ -////module TypeModule2 { -//// export class Test3 {} -////} -//// -////TypeModule1./*dotedExpression*/ -////module TypeModule3 { -//// export class Test3 {} -////} - -// Verify the memberlist of module when the following line has a keyword -goTo.marker('namedType'); -verify.completionListContains('C1'); -verify.completionListContains('C2'); - -goTo.marker('dotedExpression'); -verify.completionListContains('C1'); +/// + +////module TypeModule1 { +//// export class C1 { } +//// export class C2 { } +////} +////var x: TypeModule1./*namedType*/ +////module TypeModule2 { +//// export class Test3 {} +////} +//// +////TypeModule1./*dotedExpression*/ +////module TypeModule3 { +//// export class Test3 {} +////} + +// Verify the memberlist of module when the following line has a keyword +goTo.marker('namedType'); +verify.completionListContains('C1'); +verify.completionListContains('C2'); + +goTo.marker('dotedExpression'); +verify.completionListContains('C1'); verify.completionListContains('C2'); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOfModuleInAnotherModule.ts b/tests/cases/fourslash/memberListOfModuleInAnotherModule.ts index 96044ffcc8..4ac2778ac5 100644 --- a/tests/cases/fourslash/memberListOfModuleInAnotherModule.ts +++ b/tests/cases/fourslash/memberListOfModuleInAnotherModule.ts @@ -1,37 +1,37 @@ -/// - -////module mod1 { -//// var mX = 1; -//// function mFunc() { } -//// class mClass { } -//// module mMod { } -//// interface mInt {} -//// export var meX = 1; -//// export function meFunc() { } -//// export class meClass { } -//// export module meMod { export var iMex = 1; } -//// export interface meInt {} -////} -//// -////module frmConfirm { -//// import Mod1 = mod1; -//// import iMod1 = mod1./*1*/meMod; -//// Mod1./*2*/meX = 1; -//// iMod1./*3*/iMex = 1; -////} - -goTo.marker('1'); -verify.completionListContains('meX', '(var) mod1.meX: number'); -verify.completionListContains('meFunc', '(function) mod1.meFunc(): void'); -verify.completionListContains('meClass', 'class mod1.meClass'); -verify.completionListContains('meMod', 'module mod1.meMod'); -verify.completionListContains('meInt', 'interface mod1.meInt'); - -goTo.marker('2'); -verify.completionListContains('meX', '(var) mod1.meX: number'); -verify.completionListContains('meFunc', '(function) mod1.meFunc(): void'); -verify.completionListContains('meClass', 'class mod1.meClass'); -verify.completionListContains('meMod', 'module mod1.meMod'); - -goTo.marker('3'); +/// + +////module mod1 { +//// var mX = 1; +//// function mFunc() { } +//// class mClass { } +//// module mMod { } +//// interface mInt {} +//// export var meX = 1; +//// export function meFunc() { } +//// export class meClass { } +//// export module meMod { export var iMex = 1; } +//// export interface meInt {} +////} +//// +////module frmConfirm { +//// import Mod1 = mod1; +//// import iMod1 = mod1./*1*/meMod; +//// Mod1./*2*/meX = 1; +//// iMod1./*3*/iMex = 1; +////} + +goTo.marker('1'); +verify.completionListContains('meX', '(var) mod1.meX: number'); +verify.completionListContains('meFunc', '(function) mod1.meFunc(): void'); +verify.completionListContains('meClass', 'class mod1.meClass'); +verify.completionListContains('meMod', 'module mod1.meMod'); +verify.completionListContains('meInt', 'interface mod1.meInt'); + +goTo.marker('2'); +verify.completionListContains('meX', '(var) mod1.meX: number'); +verify.completionListContains('meFunc', '(function) mod1.meFunc(): void'); +verify.completionListContains('meClass', 'class mod1.meClass'); +verify.completionListContains('meMod', 'module mod1.meMod'); + +goTo.marker('3'); verify.completionListContains('iMex', '(var) mod1.meMod.iMex: number'); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOnConstructorType.ts b/tests/cases/fourslash/memberListOnConstructorType.ts index 071b597955..3d5596f2e5 100644 --- a/tests/cases/fourslash/memberListOnConstructorType.ts +++ b/tests/cases/fourslash/memberListOnConstructorType.ts @@ -1,8 +1,8 @@ -/// - -////var f: new () => void; -////f./*1*/ - -goTo.marker('1'); -verify.completionListContains('apply'); +/// + +////var f: new () => void; +////f./*1*/ + +goTo.marker('1'); +verify.completionListContains('apply'); verify.completionListContains('arguments'); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOnFunctionParameter.ts b/tests/cases/fourslash/memberListOnFunctionParameter.ts index add2ed442b..ee33cdc95e 100644 --- a/tests/cases/fourslash/memberListOnFunctionParameter.ts +++ b/tests/cases/fourslash/memberListOnFunctionParameter.ts @@ -1,13 +1,13 @@ -/// - -////module Test10 { -//// var x: string[] = []; -//// x.forEach(function (y) { y./**/} ); -////} - -goTo.marker(); -verify.memberListContains("charAt"); -verify.memberListContains("charCodeAt"); -verify.memberListContains("length"); -verify.memberListContains("concat"); +/// + +////module Test10 { +//// var x: string[] = []; +//// x.forEach(function (y) { y./**/} ); +////} + +goTo.marker(); +verify.memberListContains("charAt"); +verify.memberListContains("charCodeAt"); +verify.memberListContains("length"); +verify.memberListContains("concat"); verify.not.memberListContains("toFixed"); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOnThisInClassWithPrivates.ts b/tests/cases/fourslash/memberListOnThisInClassWithPrivates.ts index 15686b4f7b..341605e391 100644 --- a/tests/cases/fourslash/memberListOnThisInClassWithPrivates.ts +++ b/tests/cases/fourslash/memberListOnThisInClassWithPrivates.ts @@ -1,13 +1,13 @@ -/// - -////class C1 { -//// public pubMeth() {this./**/} // test on 'this.' -//// private privMeth() {} -//// public pubProp = 0; -//// private privProp = 0; -////} - -goTo.marker(); -verify.memberListContains('privMeth', '(method) C1.privMeth(): void'); -verify.memberListContains('pubMeth', '(method) C1.pubMeth(): void'); +/// + +////class C1 { +//// public pubMeth() {this./**/} // test on 'this.' +//// private privMeth() {} +//// public pubProp = 0; +//// private privProp = 0; +////} + +goTo.marker(); +verify.memberListContains('privMeth', '(method) C1.privMeth(): void'); +verify.memberListContains('pubMeth', '(method) C1.pubMeth(): void'); verify.memberListContains('pubProp', '(property) C1.pubProp: number'); \ No newline at end of file diff --git a/tests/cases/fourslash/memberOverloadEdits.ts b/tests/cases/fourslash/memberOverloadEdits.ts index 95184027bd..43553a8117 100644 --- a/tests/cases/fourslash/memberOverloadEdits.ts +++ b/tests/cases/fourslash/memberOverloadEdits.ts @@ -1,18 +1,18 @@ -/// - -//// module M { -//// export class A { -//// public m(n: number) { -//// return 0; -//// } -//// public n() { -//// return this.m(0); -//// } -//// } -//// export class B extends A { /*1*/ } -//// } - -verify.numberOfErrorsInCurrentFile(0); -goTo.marker('1'); -edit.insert("public m(n: number) { return 0; }"); +/// + +//// module M { +//// export class A { +//// public m(n: number) { +//// return 0; +//// } +//// public n() { +//// return this.m(0); +//// } +//// } +//// export class B extends A { /*1*/ } +//// } + +verify.numberOfErrorsInCurrentFile(0); +goTo.marker('1'); +edit.insert("public m(n: number) { return 0; }"); verify.numberOfErrorsInCurrentFile(0); \ No newline at end of file diff --git a/tests/cases/fourslash/mispeltVariableForInLoopErrorRecovery.ts b/tests/cases/fourslash/mispeltVariableForInLoopErrorRecovery.ts index 38636f8842..48d6aedac8 100644 --- a/tests/cases/fourslash/mispeltVariableForInLoopErrorRecovery.ts +++ b/tests/cases/fourslash/mispeltVariableForInLoopErrorRecovery.ts @@ -1,8 +1,8 @@ -/// - -////var alpha = [1, 2, 3]; -////for (var beta in alpha) { -//// alpha[beat/**/]++; -////} - -verify.not.errorExistsAfterMarker(); +/// + +////var alpha = [1, 2, 3]; +////for (var beta in alpha) { +//// alpha[beat/**/]++; +////} + +verify.not.errorExistsAfterMarker(); diff --git a/tests/cases/fourslash/moduleRenamingErrorRecovery.ts b/tests/cases/fourslash/moduleRenamingErrorRecovery.ts index f8d83a9e40..ada428d03b 100644 --- a/tests/cases/fourslash/moduleRenamingErrorRecovery.ts +++ b/tests/cases/fourslash/moduleRenamingErrorRecovery.ts @@ -1,9 +1,9 @@ -/// - -////module Alpha/*1*//*2*/ { class Foo { public bar() { } } } - -goTo.marker("1"); -edit.backspace(5); -edit.insert("Pizza"); -verify.currentLineContentIs("module Pizza { class Foo { public bar() { } } }"); +/// + +////module Alpha/*1*//*2*/ { class Foo { public bar() { } } } + +goTo.marker("1"); +edit.backspace(5); +edit.insert("Pizza"); +verify.currentLineContentIs("module Pizza { class Foo { public bar() { } } }"); verify.not.errorExistsAfterMarker("2"); \ No newline at end of file diff --git a/tests/cases/fourslash/multipleExportAssignmentsErrorList0.ts b/tests/cases/fourslash/multipleExportAssignmentsErrorList0.ts index 721d110ce6..bb13973cc8 100644 --- a/tests/cases/fourslash/multipleExportAssignmentsErrorList0.ts +++ b/tests/cases/fourslash/multipleExportAssignmentsErrorList0.ts @@ -1,27 +1,27 @@ -/// - -//// interface connectModule { -//// (res, req, next): void; -//// } -//// interface connectExport { -//// use: (mod: connectModule) => connectExport; -//// listen: (port: number) => void; -//// } -//// var server: { -//// (): connectExport; -//// test1: connectModule; -//// test2(): connectModule; -//// }; -//// export = server; -//// /*1*/export = connectExport; -//// -//// - -edit.disableFormatting(); -goTo.marker('1'); - -edit.deleteAtCaret(24); - -goTo.marker('1'); - -edit.insert("export = connectExport;\n"); +/// + +//// interface connectModule { +//// (res, req, next): void; +//// } +//// interface connectExport { +//// use: (mod: connectModule) => connectExport; +//// listen: (port: number) => void; +//// } +//// var server: { +//// (): connectExport; +//// test1: connectModule; +//// test2(): connectModule; +//// }; +//// export = server; +//// /*1*/export = connectExport; +//// +//// + +edit.disableFormatting(); +goTo.marker('1'); + +edit.deleteAtCaret(24); + +goTo.marker('1'); + +edit.insert("export = connectExport;\n"); diff --git a/tests/cases/fourslash/nameOfRetypedClassInModule.ts b/tests/cases/fourslash/nameOfRetypedClassInModule.ts index 4faddd2b68..7dea74020f 100644 --- a/tests/cases/fourslash/nameOfRetypedClassInModule.ts +++ b/tests/cases/fourslash/nameOfRetypedClassInModule.ts @@ -1,32 +1,32 @@ -/// - -//// module M { -//// } -//// -//// module M { -//// /*A*/class A {} -//// /*B*/export class B {} -//// class Check { /*check*/constructor(val) {} } -//// export class Check2 { /*check2*/constructor(val) {} } -//// } -//// - -edit.disableFormatting(); - -goTo.marker('check'); -verify.quickInfoIs('(constructor) Check(val: any): Check'); - -goTo.marker('check2'); -verify.quickInfoIs('(constructor) M.Check2(val: any): Check2'); - -goTo.marker('A'); -edit.deleteAtCaret('class A {}'.length); -edit.insert('class A { constructor(val) {} }'); -edit.moveLeft('constructor(val) {} }'.length); -verify.quickInfoIs('(constructor) A(val: any): A'); - -goTo.marker('B'); -edit.deleteAtCaret('export class B {}'.length); -edit.insert('export class B { constructor(val) {} }'); -edit.moveLeft('constructor(val) {} }'.length); -verify.quickInfoIs('(constructor) M.B(val: any): B'); +/// + +//// module M { +//// } +//// +//// module M { +//// /*A*/class A {} +//// /*B*/export class B {} +//// class Check { /*check*/constructor(val) {} } +//// export class Check2 { /*check2*/constructor(val) {} } +//// } +//// + +edit.disableFormatting(); + +goTo.marker('check'); +verify.quickInfoIs('(constructor) Check(val: any): Check'); + +goTo.marker('check2'); +verify.quickInfoIs('(constructor) M.Check2(val: any): Check2'); + +goTo.marker('A'); +edit.deleteAtCaret('class A {}'.length); +edit.insert('class A { constructor(val) {} }'); +edit.moveLeft('constructor(val) {} }'.length); +verify.quickInfoIs('(constructor) A(val: any): A'); + +goTo.marker('B'); +edit.deleteAtCaret('export class B {}'.length); +edit.insert('export class B { constructor(val) {} }'); +edit.moveLeft('constructor(val) {} }'.length); +verify.quickInfoIs('(constructor) M.B(val: any): B'); diff --git a/tests/cases/fourslash/nameOrDottedNameClasses.ts b/tests/cases/fourslash/nameOrDottedNameClasses.ts index 9aa63a7a47..7a0fd8c19c 100644 --- a/tests/cases/fourslash/nameOrDottedNameClasses.ts +++ b/tests/cases/fourslash/nameOrDottedNameClasses.ts @@ -3,37 +3,37 @@ // @BaselineFile: nameOrDottedSpan_classes.baseline // @Filename: nameOrDottedSpan_classes.ts ////module Foo.Bar { -//// "use strict"; -//// +//// "use strict"; +//// //// class Greeter { //// constructor(public greeting: string) { //// } -//// +//// //// greet() { //// return "

" + this.greeting + "

"; //// } -//// } -//// -//// +//// } +//// +//// //// function foo(greeting: string): Greeter { //// return new Greeter(greeting); -//// } -//// -//// var greeter = new Greeter("Hello, world!"); -//// var str = greeter.greet(); -//// +//// } +//// +//// var greeter = new Greeter("Hello, world!"); +//// var str = greeter.greet(); +//// //// function foo2(greeting: string, ...restGreetings /* more greeting */: string[]) { //// var greeters: Greeter[] = []; /* inline block comment */ //// greeters[0] = new Greeter(greeting); //// for (var i = 0; i < restGreetings.length; i++) { //// greeters.push(new Greeter(restGreetings[i])); //// } -//// +//// //// return greeters; -//// } -//// -//// var b = foo2("Hello", "World", "!"); -//// // This is simple signle line comment +//// } +//// +//// var b = foo2("Hello", "World", "!"); +//// // This is simple signle line comment //// for (var j = 0; j < b.length; j++) { //// b[j].greet(); //// } diff --git a/tests/cases/fourslash/navigateItemsConst.ts b/tests/cases/fourslash/navigateItemsConst.ts index d5ccb31066..a20c019287 100644 --- a/tests/cases/fourslash/navigateItemsConst.ts +++ b/tests/cases/fourslash/navigateItemsConst.ts @@ -1,9 +1,9 @@ /// -////{| "itemName": "c", "kind": "const", "parentName": "" |}const c = 10; -////function foo() { -//// {| "itemName": "d", "kind": "const", "parentName": "foo" |}const d = 10; -////} +////{| "itemName": "c", "kind": "const", "parentName": "" |}const c = 10; +////function foo() { +//// {| "itemName": "d", "kind": "const", "parentName": "foo" |}const d = 10; +////} test.markers().forEach(marker => { verify.navigationItemsListContains( diff --git a/tests/cases/fourslash/navigationItemsExactMatch.ts b/tests/cases/fourslash/navigationItemsExactMatch.ts index 9658c52324..5481f4295c 100644 --- a/tests/cases/fourslash/navigationItemsExactMatch.ts +++ b/tests/cases/fourslash/navigationItemsExactMatch.ts @@ -1,27 +1,27 @@ -/// - -/////// Module -////{| "itemName": "Shapes", "kind": "module", "parentName": "" |}module Shapes { -//// -//// // Class -//// {| "itemName": "Point", "kind": "class", "parentName": "Shapes" |}export class Point { -//// // Instance member -//// {| "itemName": "origin", "kind": "property", "parentName": "Point", "matchKind": "exact"|}private origin = 0.0; -//// -//// {| "itemName": "distFromZero", "kind": "property", "parentName": "Point", "matchKind": "exact"|}private distFromZero = 0.0; -//// -//// // Getter -//// {| "itemName": "distance", "kind": "getter", "parentName": "Point", "matchKind": "exact" |}get distance(): number { return 0; } -//// } -////} -//// -////// Local variables -////{| "itemName": "point", "kind": "var", "parentName": "", "matchKind": "exact"|}var point = new Shapes.Point(); - -//// Testing for exact matching of navigationItems - -test.markers().forEach((marker) => { - if (marker.data) { - verify.navigationItemsListContains(marker.data.itemName, marker.data.kind, marker.data.itemName, marker.data.matchKind, marker.fileName, marker.data.parentName); - } -}); +/// + +/////// Module +////{| "itemName": "Shapes", "kind": "module", "parentName": "" |}module Shapes { +//// +//// // Class +//// {| "itemName": "Point", "kind": "class", "parentName": "Shapes" |}export class Point { +//// // Instance member +//// {| "itemName": "origin", "kind": "property", "parentName": "Point", "matchKind": "exact"|}private origin = 0.0; +//// +//// {| "itemName": "distFromZero", "kind": "property", "parentName": "Point", "matchKind": "exact"|}private distFromZero = 0.0; +//// +//// // Getter +//// {| "itemName": "distance", "kind": "getter", "parentName": "Point", "matchKind": "exact" |}get distance(): number { return 0; } +//// } +////} +//// +////// Local variables +////{| "itemName": "point", "kind": "var", "parentName": "", "matchKind": "exact"|}var point = new Shapes.Point(); + +//// Testing for exact matching of navigationItems + +test.markers().forEach((marker) => { + if (marker.data) { + verify.navigationItemsListContains(marker.data.itemName, marker.data.kind, marker.data.itemName, marker.data.matchKind, marker.fileName, marker.data.parentName); + } +}); diff --git a/tests/cases/fourslash/navigationItemsExactMatch2.ts b/tests/cases/fourslash/navigationItemsExactMatch2.ts index adf8e69761..e96d4f65ed 100644 --- a/tests/cases/fourslash/navigationItemsExactMatch2.ts +++ b/tests/cases/fourslash/navigationItemsExactMatch2.ts @@ -1,28 +1,28 @@ -/// -// @Filename: navigationItemsContainsNoAnonymousFunctions_0.ts -/////*file1*/ -////module Shapes { -//// class Point { -//// private _origin = 0.0; -//// private distanceFromA = 0.0; -//// -//// get distance1(distanceParam): number { -//// var distanceLocal; -//// return 0; -//// } -//// } -////} -//// -////var point = new Shapes.Point(); -////function distance2(distanceParam1): void { -//// var distanceLocal1; -////} -debugger; -goTo.marker("file1"); -verify.navigationItemsListCount(2, "point", "exact"); -verify.navigationItemsListCount(5, "distance", "prefix"); -verify.navigationItemsListCount(1, "origin", "substring"); - -verify.navigationItemsListCount(0, "square", "exact"); -verify.navigationItemsListCount(0, "square", "prefix"); +/// +// @Filename: navigationItemsContainsNoAnonymousFunctions_0.ts +/////*file1*/ +////module Shapes { +//// class Point { +//// private _origin = 0.0; +//// private distanceFromA = 0.0; +//// +//// get distance1(distanceParam): number { +//// var distanceLocal; +//// return 0; +//// } +//// } +////} +//// +////var point = new Shapes.Point(); +////function distance2(distanceParam1): void { +//// var distanceLocal1; +////} +debugger; +goTo.marker("file1"); +verify.navigationItemsListCount(2, "point", "exact"); +verify.navigationItemsListCount(5, "distance", "prefix"); +verify.navigationItemsListCount(1, "origin", "substring"); + +verify.navigationItemsListCount(0, "square", "exact"); +verify.navigationItemsListCount(0, "square", "prefix"); verify.navigationItemsListCount(0, "square", "substring"); \ No newline at end of file diff --git a/tests/cases/fourslash/navigationItemsInConstructorsExactMatch.ts b/tests/cases/fourslash/navigationItemsInConstructorsExactMatch.ts index 68bb7db5c7..10397813fd 100644 --- a/tests/cases/fourslash/navigationItemsInConstructorsExactMatch.ts +++ b/tests/cases/fourslash/navigationItemsInConstructorsExactMatch.ts @@ -1,12 +1,12 @@ -/// - -////class Test { -//// private search1: number; -//// constructor(public search2: boolean, search3: string) { -//// } -////} - -// Search for properties defined in the constructor, but not other constructor paramters -var searchValue = "search"; -verify.navigationItemsListContains("search1", "property", searchValue, "prefix"); -verify.navigationItemsListContains("search2", "property", searchValue, "prefix"); +/// + +////class Test { +//// private search1: number; +//// constructor(public search2: boolean, search3: string) { +//// } +////} + +// Search for properties defined in the constructor, but not other constructor paramters +var searchValue = "search"; +verify.navigationItemsListContains("search1", "property", searchValue, "prefix"); +verify.navigationItemsListContains("search2", "property", searchValue, "prefix"); diff --git a/tests/cases/fourslash/navigationItemsOverloads1.ts b/tests/cases/fourslash/navigationItemsOverloads1.ts index 5f1981fe91..68d0c8d1f8 100644 --- a/tests/cases/fourslash/navigationItemsOverloads1.ts +++ b/tests/cases/fourslash/navigationItemsOverloads1.ts @@ -1,30 +1,30 @@ -/// - -////function overload(a: string): boolean; -////function overload(b: boolean): boolean; -////function overload(b: number): boolean; -////function overload(f: typeof overload): boolean; -////function overload(x: any, b = (function overload() { return false })): boolean { -//// throw overload; -////} -//// -////interface I { -//// interfaceMethodSignature(a: string): boolean; -//// interfaceMethodSignature(b: boolean): boolean; -//// interfaceMethodSignature(b: number): boolean; -//// interfaceMethodSignature(f: I): boolean; -////} -//// -////class C { -//// methodOverload(a: string): boolean; -//// methodOverload(b: boolean): boolean; -//// methodOverload(b: number): boolean; -//// methodOverload(f: I): boolean; -//// methodOverload(x: any, b = (function overload() { return false })): boolean { -//// throw C; -//// } -////} - -verify.navigationItemsListCount(1, "overload", "exact"); -verify.navigationItemsListCount(1, "interfaceMethodSignature", "exact"); -verify.navigationItemsListCount(1, "methodOverload", "exact"); +/// + +////function overload(a: string): boolean; +////function overload(b: boolean): boolean; +////function overload(b: number): boolean; +////function overload(f: typeof overload): boolean; +////function overload(x: any, b = (function overload() { return false })): boolean { +//// throw overload; +////} +//// +////interface I { +//// interfaceMethodSignature(a: string): boolean; +//// interfaceMethodSignature(b: boolean): boolean; +//// interfaceMethodSignature(b: number): boolean; +//// interfaceMethodSignature(f: I): boolean; +////} +//// +////class C { +//// methodOverload(a: string): boolean; +//// methodOverload(b: boolean): boolean; +//// methodOverload(b: number): boolean; +//// methodOverload(f: I): boolean; +//// methodOverload(x: any, b = (function overload() { return false })): boolean { +//// throw C; +//// } +////} + +verify.navigationItemsListCount(1, "overload", "exact"); +verify.navigationItemsListCount(1, "interfaceMethodSignature", "exact"); +verify.navigationItemsListCount(1, "methodOverload", "exact"); diff --git a/tests/cases/fourslash/navigationItemsOverloads2.ts b/tests/cases/fourslash/navigationItemsOverloads2.ts index c5824b639b..2c33ef65f0 100644 --- a/tests/cases/fourslash/navigationItemsOverloads2.ts +++ b/tests/cases/fourslash/navigationItemsOverloads2.ts @@ -1,12 +1,12 @@ -/// - -////interface I { -//// interfaceMethodSignature(a: string): boolean; -//// interfaceMethodSignature(b: number): boolean; -//// interfaceMethodSignature(f: I): boolean; -////} -////interface I { -//// interfaceMethodSignature(b: boolean): boolean; -////} - -verify.navigationItemsListCount(2, "interfaceMethodSignature", "exact"); +/// + +////interface I { +//// interfaceMethodSignature(a: string): boolean; +//// interfaceMethodSignature(b: number): boolean; +//// interfaceMethodSignature(f: I): boolean; +////} +////interface I { +//// interfaceMethodSignature(b: boolean): boolean; +////} + +verify.navigationItemsListCount(2, "interfaceMethodSignature", "exact"); diff --git a/tests/cases/fourslash/navigationItemsOverloadsBroken1.ts b/tests/cases/fourslash/navigationItemsOverloadsBroken1.ts index 7b8ebc9181..d2a9ec8e25 100644 --- a/tests/cases/fourslash/navigationItemsOverloadsBroken1.ts +++ b/tests/cases/fourslash/navigationItemsOverloadsBroken1.ts @@ -1,29 +1,29 @@ -/// - -////function overload1(a: string): boolean; -////function overload1(b: boolean): boolean; -////function overload1(b: number): boolean; -//// -////var heyImNotInterruptingAnythingAmI = '?'; -//// -////function overload1(f: typeof overload): boolean; -////function overload1(x: any, b = (function overload() { return false })): boolean { -//// throw overload; -////} - -////function overload2(a: string): boolean; -////function overload2(b: boolean): boolean; -////function overload2(b: number): boolean; -//// -////function iJustRuinEverything(x: any, b = (function overload() { return false })): boolean { -//// throw overload; -////} -//// -////function overload2(f: typeof overload): boolean; -////function overload2(x: any, b = (function overload() { return false })): boolean { -//// throw overload; -////} - -verify.navigationItemsListCount(2, "overload1", "exact"); -verify.navigationItemsListCount(2, "overload2", "exact"); +/// + +////function overload1(a: string): boolean; +////function overload1(b: boolean): boolean; +////function overload1(b: number): boolean; +//// +////var heyImNotInterruptingAnythingAmI = '?'; +//// +////function overload1(f: typeof overload): boolean; +////function overload1(x: any, b = (function overload() { return false })): boolean { +//// throw overload; +////} + +////function overload2(a: string): boolean; +////function overload2(b: boolean): boolean; +////function overload2(b: number): boolean; +//// +////function iJustRuinEverything(x: any, b = (function overload() { return false })): boolean { +//// throw overload; +////} +//// +////function overload2(f: typeof overload): boolean; +////function overload2(x: any, b = (function overload() { return false })): boolean { +//// throw overload; +////} + +verify.navigationItemsListCount(2, "overload1", "exact"); +verify.navigationItemsListCount(2, "overload2", "exact"); verify.navigationItemsListCount(4, "overload", "prefix"); \ No newline at end of file diff --git a/tests/cases/fourslash/navigationItemsOverloadsBroken2.ts b/tests/cases/fourslash/navigationItemsOverloadsBroken2.ts index c1f6ccae2f..6b03932241 100644 --- a/tests/cases/fourslash/navigationItemsOverloadsBroken2.ts +++ b/tests/cases/fourslash/navigationItemsOverloadsBroken2.ts @@ -1,23 +1,23 @@ -/// - -////function overload1(a: string): boolean; -////function overload1(b: boolean): boolean; -////function overload1(x: any, b = (function overload() { return false })): boolean { -//// throw overload1; -////} -////function overload1(b: number): boolean; -////function overload1(f: typeof overload): boolean; - -////function overload2(a: string): boolean; -////function overload2(b: boolean): boolean; -////function overload2(x: any, b = (function overload() { return false })): boolean { -//// function overload2(): boolean; -//// function overload2(x: any): boolean; -//// throw overload2; -////} -////function overload2(b: number): boolean; -////function overload2(f: typeof overload): boolean; - -verify.navigationItemsListCount(1, "overload1", "exact"); -verify.navigationItemsListCount(3, "overload2", "exact"); +/// + +////function overload1(a: string): boolean; +////function overload1(b: boolean): boolean; +////function overload1(x: any, b = (function overload() { return false })): boolean { +//// throw overload1; +////} +////function overload1(b: number): boolean; +////function overload1(f: typeof overload): boolean; + +////function overload2(a: string): boolean; +////function overload2(b: boolean): boolean; +////function overload2(x: any, b = (function overload() { return false })): boolean { +//// function overload2(): boolean; +//// function overload2(x: any): boolean; +//// throw overload2; +////} +////function overload2(b: number): boolean; +////function overload2(f: typeof overload): boolean; + +verify.navigationItemsListCount(1, "overload1", "exact"); +verify.navigationItemsListCount(3, "overload2", "exact"); verify.navigationItemsListCount(4, "overload", "prefix"); \ No newline at end of file diff --git a/tests/cases/fourslash/navigationItemsPrefixMatch.ts b/tests/cases/fourslash/navigationItemsPrefixMatch.ts index b6ae4af0f3..b295def114 100644 --- a/tests/cases/fourslash/navigationItemsPrefixMatch.ts +++ b/tests/cases/fourslash/navigationItemsPrefixMatch.ts @@ -1,29 +1,29 @@ -/// - -/////// Module -////{| "itemName": "Shapes", "kind": "module", "parentName": "" |}module Shapes { -//// -//// // Class -//// {| "itemName": "Point", "kind": "class", "parentName": "Shapes" |}export class Point { -//// // Instance member -//// {| "itemName": "originality", "kind": "property", "parentName": "Point", "matchKind": "prefix"|}private originality = 0.0; -//// -//// {| "itemName": "distanceFromOrig", "kind": "property", "parentName": "Point", "matchKind": "prefix"|}private distanceFromOrig = 0.0; -//// -//// // Getter -//// {| "itemName": "distanceFarFarAway", "kind": "getter", "parentName": "Point", "matchKind": "prefix" |}get distanceFarFarAway(): number { return 0; } -//// } -////} -//// -////// Local variables -////{| "itemName": "pointsSquareBox", "kind": "var", "parentName": "", "matchKind": "prefix" |}var pointsSquareBox = new Shapes.Point(); - -//// Testing for exact matching of navigationItems -// var searchValue = "origin distance points shape"; - -test.markers().forEach((marker) => { - if (marker.data) { - var itemName = marker.data.itemName; - verify.navigationItemsListContains(itemName, marker.data.kind, itemName.substr(0, itemName.length - 1), marker.data.matchKind, marker.fileName, marker.data.parentName); - } -}); +/// + +/////// Module +////{| "itemName": "Shapes", "kind": "module", "parentName": "" |}module Shapes { +//// +//// // Class +//// {| "itemName": "Point", "kind": "class", "parentName": "Shapes" |}export class Point { +//// // Instance member +//// {| "itemName": "originality", "kind": "property", "parentName": "Point", "matchKind": "prefix"|}private originality = 0.0; +//// +//// {| "itemName": "distanceFromOrig", "kind": "property", "parentName": "Point", "matchKind": "prefix"|}private distanceFromOrig = 0.0; +//// +//// // Getter +//// {| "itemName": "distanceFarFarAway", "kind": "getter", "parentName": "Point", "matchKind": "prefix" |}get distanceFarFarAway(): number { return 0; } +//// } +////} +//// +////// Local variables +////{| "itemName": "pointsSquareBox", "kind": "var", "parentName": "", "matchKind": "prefix" |}var pointsSquareBox = new Shapes.Point(); + +//// Testing for exact matching of navigationItems +// var searchValue = "origin distance points shape"; + +test.markers().forEach((marker) => { + if (marker.data) { + var itemName = marker.data.itemName; + verify.navigationItemsListContains(itemName, marker.data.kind, itemName.substr(0, itemName.length - 1), marker.data.matchKind, marker.fileName, marker.data.parentName); + } +}); diff --git a/tests/cases/fourslash/navigationItemsPrefixMatch2.ts b/tests/cases/fourslash/navigationItemsPrefixMatch2.ts index 282d0e2414..0bce1f36b3 100644 --- a/tests/cases/fourslash/navigationItemsPrefixMatch2.ts +++ b/tests/cases/fourslash/navigationItemsPrefixMatch2.ts @@ -1,32 +1,32 @@ -/// -// @Filename: navigationItemsContainsNoAnonymousFunctions_0.ts -/////*file1*/ -////module Shapes { -//// export class Point { -//// private originality = 0.0; -//// private distanceFromOrig = 0.0; -//// get distanceFarFarAway(distanceFarFarAwayParam: number): number { -//// var distanceFarFarAwayLocal; -//// return 0; -//// } -//// } -////} -////var pointsSquareBox = new Shapes.Point(); -////function PointsFunc(): void { -//// var pointFuncLocal; -////} -////interface OriginI { -//// var 123; -//// var origin1; -//// public _distance(distanceParam): void; -////} - -var notFoundSearchValue = "mPointThatIJustInitiated wrongKeyWord"; - -goTo.marker("file1"); -verify.navigationItemsListCount(3, "origin", "prefix"); -verify.navigationItemsListCount(3, "distance", "prefix"); - -verify.navigationItemsListCount(0, notFoundSearchValue, "exact"); -verify.navigationItemsListCount(0, notFoundSearchValue, "prefix"); +/// +// @Filename: navigationItemsContainsNoAnonymousFunctions_0.ts +/////*file1*/ +////module Shapes { +//// export class Point { +//// private originality = 0.0; +//// private distanceFromOrig = 0.0; +//// get distanceFarFarAway(distanceFarFarAwayParam: number): number { +//// var distanceFarFarAwayLocal; +//// return 0; +//// } +//// } +////} +////var pointsSquareBox = new Shapes.Point(); +////function PointsFunc(): void { +//// var pointFuncLocal; +////} +////interface OriginI { +//// var 123; +//// var origin1; +//// public _distance(distanceParam): void; +////} + +var notFoundSearchValue = "mPointThatIJustInitiated wrongKeyWord"; + +goTo.marker("file1"); +verify.navigationItemsListCount(3, "origin", "prefix"); +verify.navigationItemsListCount(3, "distance", "prefix"); + +verify.navigationItemsListCount(0, notFoundSearchValue, "exact"); +verify.navigationItemsListCount(0, notFoundSearchValue, "prefix"); verify.navigationItemsListCount(0, notFoundSearchValue, "substring"); \ No newline at end of file diff --git a/tests/cases/fourslash/navigationItemsSubStringMatch.ts b/tests/cases/fourslash/navigationItemsSubStringMatch.ts index b90a2a2f33..4be7495314 100644 --- a/tests/cases/fourslash/navigationItemsSubStringMatch.ts +++ b/tests/cases/fourslash/navigationItemsSubStringMatch.ts @@ -1,26 +1,26 @@ -/// - -/////// Module -////{| "itemName": "MyShapes", "kind": "module", "parentName": "", "matchKind": "substring" |}module MyShapes { -//// -//// // Class -//// {| "itemName": "MyPoint", "kind": "class", "parentName": "MyShapes", "matchKind": "substring" |}export class MyPoint { -//// // Instance member -//// {| "itemName": "MyoriginPointAttheHorizon", "kind": "property", "parentName": "MyPoint", "matchKind": "substring"|}private MyoriginPointAttheHorizon = 0.0; -//// -//// // Getter -//// {| "itemName": "MydistanceFromOrigin", "kind": "getter", "parentName": "MyPoint", "matchKind": "substring" |}get MydistanceFromOrigin(): number { return 0; } -//// -//// } -////} -//// -////// Local variables -////{| "itemName": "MymyPointThatIJustInitiated", "kind": "var", "parentName": "", "matchKind": "substring"|}var MymyPointThatIJustInitiated = new Shapes.Point(); - -debugger; -test.markers().forEach((marker) => { - if (marker.data) { - var name = marker.data.itemName; - verify.navigationItemsListContains(name, marker.data.kind, name.substr(2), marker.data.matchKind, marker.fileName, marker.data.parentName); - } +/// + +/////// Module +////{| "itemName": "MyShapes", "kind": "module", "parentName": "", "matchKind": "substring" |}module MyShapes { +//// +//// // Class +//// {| "itemName": "MyPoint", "kind": "class", "parentName": "MyShapes", "matchKind": "substring" |}export class MyPoint { +//// // Instance member +//// {| "itemName": "MyoriginPointAttheHorizon", "kind": "property", "parentName": "MyPoint", "matchKind": "substring"|}private MyoriginPointAttheHorizon = 0.0; +//// +//// // Getter +//// {| "itemName": "MydistanceFromOrigin", "kind": "getter", "parentName": "MyPoint", "matchKind": "substring" |}get MydistanceFromOrigin(): number { return 0; } +//// +//// } +////} +//// +////// Local variables +////{| "itemName": "MymyPointThatIJustInitiated", "kind": "var", "parentName": "", "matchKind": "substring"|}var MymyPointThatIJustInitiated = new Shapes.Point(); + +debugger; +test.markers().forEach((marker) => { + if (marker.data) { + var name = marker.data.itemName; + verify.navigationItemsListContains(name, marker.data.kind, name.substr(2), marker.data.matchKind, marker.fileName, marker.data.parentName); + } }); \ No newline at end of file diff --git a/tests/cases/fourslash/navigationItemsSubStringMatch2.ts b/tests/cases/fourslash/navigationItemsSubStringMatch2.ts index edce5ad761..7ea901c9de 100644 --- a/tests/cases/fourslash/navigationItemsSubStringMatch2.ts +++ b/tests/cases/fourslash/navigationItemsSubStringMatch2.ts @@ -1,36 +1,36 @@ -/// -// @Filename: navigationItemsContainsNoAnonymousFunctions_0.ts -/////*file1*/ -////module Shapes { -//// export class Point { -//// private originPointAttheHorizon = 0.0; -//// -//// get distanceFromOrigin(distanceParam): number { -//// var distanceLocal; -//// return 0; -//// } -//// } -////} -//// -////var myPointThatIJustInitiated = new Shapes.Point(); -////interface IDistance{ -//// INITIATED123; -//// public horizon(): void; -////} -debugger; -var notFoundSearchValue = "mPointThatIJustInitiated wrongKeyWord"; - -goTo.marker("file1"); -// case sensitive matching for 'Horizon' will fail -verify.navigationItemsListCount(1, "Horizon", "exact"); -// case insensitive matching will find 'horizon' -verify.navigationItemsListCount(1, "horizon", "exact"); -// case sensitive matching will find 'Distance' and INITIATED -verify.navigationItemsListCount(1, "Distance", "substring"); -// case sensitive matching will find 'INITIATED' -verify.navigationItemsListCount(1, "INITIATED", "prefix"); - - -verify.navigationItemsListCount(0, notFoundSearchValue, "exact"); -verify.navigationItemsListCount(0, notFoundSearchValue, "prefix"); +/// +// @Filename: navigationItemsContainsNoAnonymousFunctions_0.ts +/////*file1*/ +////module Shapes { +//// export class Point { +//// private originPointAttheHorizon = 0.0; +//// +//// get distanceFromOrigin(distanceParam): number { +//// var distanceLocal; +//// return 0; +//// } +//// } +////} +//// +////var myPointThatIJustInitiated = new Shapes.Point(); +////interface IDistance{ +//// INITIATED123; +//// public horizon(): void; +////} +debugger; +var notFoundSearchValue = "mPointThatIJustInitiated wrongKeyWord"; + +goTo.marker("file1"); +// case sensitive matching for 'Horizon' will fail +verify.navigationItemsListCount(1, "Horizon", "exact"); +// case insensitive matching will find 'horizon' +verify.navigationItemsListCount(1, "horizon", "exact"); +// case sensitive matching will find 'Distance' and INITIATED +verify.navigationItemsListCount(1, "Distance", "substring"); +// case sensitive matching will find 'INITIATED' +verify.navigationItemsListCount(1, "INITIATED", "prefix"); + + +verify.navigationItemsListCount(0, notFoundSearchValue, "exact"); +verify.navigationItemsListCount(0, notFoundSearchValue, "prefix"); verify.navigationItemsListCount(0, notFoundSearchValue, "substring"); \ No newline at end of file diff --git a/tests/cases/fourslash/noCompletionListOnCommentsInsideObjectLiterals.ts b/tests/cases/fourslash/noCompletionListOnCommentsInsideObjectLiterals.ts index 15affd3b61..38f9133149 100644 --- a/tests/cases/fourslash/noCompletionListOnCommentsInsideObjectLiterals.ts +++ b/tests/cases/fourslash/noCompletionListOnCommentsInsideObjectLiterals.ts @@ -1,18 +1,18 @@ -/// - -////module ObjectLiterals { -//// interface MyPoint { -//// x1: number; -//// y1: number; -//// } -//// -//// var p1: MyPoint = { -//// /* /*1*/ Comment /*2*/ */ -//// }; -////} - -goTo.marker("1"); -verify.completionListIsEmpty(); - -goTo.marker("2"); +/// + +////module ObjectLiterals { +//// interface MyPoint { +//// x1: number; +//// y1: number; +//// } +//// +//// var p1: MyPoint = { +//// /* /*1*/ Comment /*2*/ */ +//// }; +////} + +goTo.marker("1"); +verify.completionListIsEmpty(); + +goTo.marker("2"); verify.completionListIsEmpty(); \ No newline at end of file diff --git a/tests/cases/fourslash/noSignatureHelpOnNewKeyword.ts b/tests/cases/fourslash/noSignatureHelpOnNewKeyword.ts index 30314b1c66..8dc942f275 100644 --- a/tests/cases/fourslash/noSignatureHelpOnNewKeyword.ts +++ b/tests/cases/fourslash/noSignatureHelpOnNewKeyword.ts @@ -1,4 +1,4 @@ -/// +/// ////class Foo { } ////new/*1*/ Foo diff --git a/tests/cases/fourslash/noSmartIndentInsideMultilineString.ts b/tests/cases/fourslash/noSmartIndentInsideMultilineString.ts index 692dfe7075..06c0fb6e44 100644 --- a/tests/cases/fourslash/noSmartIndentInsideMultilineString.ts +++ b/tests/cases/fourslash/noSmartIndentInsideMultilineString.ts @@ -1,11 +1,11 @@ -/// - -////window.onload = () => { -//// var el = document.getElementById('content\/*1*/'); -//// var greeter = new Greeter(el); -////greeter.start(); -////}; - -goTo.marker("1"); -edit.insert("\r\n"); +/// + +////window.onload = () => { +//// var el = document.getElementById('content\/*1*/'); +//// var greeter = new Greeter(el); +////greeter.start(); +////}; + +goTo.marker("1"); +edit.insert("\r\n"); verify.indentationIs(0); \ No newline at end of file diff --git a/tests/cases/fourslash/overloadObjectLiteralCrash.ts b/tests/cases/fourslash/overloadObjectLiteralCrash.ts index 91f081a54f..f98469443b 100644 --- a/tests/cases/fourslash/overloadObjectLiteralCrash.ts +++ b/tests/cases/fourslash/overloadObjectLiteralCrash.ts @@ -1,12 +1,12 @@ -/// - -//// interface Foo { -//// extend(...objs: any[]): T; -//// extend(deep, target: T): T; -//// } -//// var $: Foo; -//// $.extend({ /**/foo: 0 }, ""); -//// - -goTo.marker(); -verify.quickInfoExists(); +/// + +//// interface Foo { +//// extend(...objs: any[]): T; +//// extend(deep, target: T): T; +//// } +//// var $: Foo; +//// $.extend({ /**/foo: 0 }, ""); +//// + +goTo.marker(); +verify.quickInfoExists(); diff --git a/tests/cases/fourslash/parenthesisFatArrows.ts b/tests/cases/fourslash/parenthesisFatArrows.ts index e4bdc2c1f9..1751e50afc 100644 --- a/tests/cases/fourslash/parenthesisFatArrows.ts +++ b/tests/cases/fourslash/parenthesisFatArrows.ts @@ -1,11 +1,11 @@ -/// - -////x => x; -////(y) => y; -/////**/ -////(y) => y; -////x => x; - -verify.numberOfErrorsInCurrentFile(0); -verify.not.errorExistsBeforeMarker(); +/// + +////x => x; +////(y) => y; +/////**/ +////(y) => y; +////x => x; + +verify.numberOfErrorsInCurrentFile(0); +verify.not.errorExistsBeforeMarker(); verify.not.errorExistsAfterMarker(); \ No newline at end of file diff --git a/tests/cases/fourslash/publicBreak.ts b/tests/cases/fourslash/publicBreak.ts index 630e5714a4..26407184b4 100644 --- a/tests/cases/fourslash/publicBreak.ts +++ b/tests/cases/fourslash/publicBreak.ts @@ -1,7 +1,7 @@ -/// - -//// public break; -//// /**/ - -goTo.marker(); -edit.insert(' '); +/// + +//// public break; +//// /**/ + +goTo.marker(); +edit.insert(' '); diff --git a/tests/cases/fourslash/qualifiedName_import-declaration-with-variable-entity-names.ts b/tests/cases/fourslash/qualifiedName_import-declaration-with-variable-entity-names.ts index fa57a17f98..b6f64e4be4 100644 --- a/tests/cases/fourslash/qualifiedName_import-declaration-with-variable-entity-names.ts +++ b/tests/cases/fourslash/qualifiedName_import-declaration-with-variable-entity-names.ts @@ -1,5 +1,5 @@ -/// - +/// + ////module Alpha { //// export var [|{| "name" : "def" |}x|] = 100; ////} @@ -7,20 +7,20 @@ ////module Beta { //// import p = Alpha.[|{| "name" : "import" |}x|]; ////} -//// -////var x = Alpha.[|{| "name" : "mem" |}x|] - -goTo.marker('import'); -verify.completionListContains('x', '(var) Alpha.x: number'); +//// +////var x = Alpha.[|{| "name" : "mem" |}x|] + +goTo.marker('import'); +verify.completionListContains('x', '(var) Alpha.x: number'); var def: FourSlashInterface.Range = test.ranges().filter(range => range.marker.data.name === "def")[0]; -var imp: FourSlashInterface.Range = test.ranges().filter(range => range.marker.data.name === "import")[0]; -var mem: FourSlashInterface.Range = test.ranges().filter(range => range.marker.data.name === "mem")[0]; - +var imp: FourSlashInterface.Range = test.ranges().filter(range => range.marker.data.name === "import")[0]; +var mem: FourSlashInterface.Range = test.ranges().filter(range => range.marker.data.name === "mem")[0]; + verify.occurrencesAtPositionContains(def); -verify.occurrencesAtPositionContains(imp); -verify.occurrencesAtPositionContains(mem); - -goTo.definition(); - +verify.occurrencesAtPositionContains(imp); +verify.occurrencesAtPositionContains(mem); + +goTo.definition(); + verify.caretAtMarker('def'); \ No newline at end of file diff --git a/tests/cases/fourslash/quickInfoForContextuallyTypedArrowFunctionInSuperCall.ts b/tests/cases/fourslash/quickInfoForContextuallyTypedArrowFunctionInSuperCall.ts index e24a484979..51eb59378a 100644 --- a/tests/cases/fourslash/quickInfoForContextuallyTypedArrowFunctionInSuperCall.ts +++ b/tests/cases/fourslash/quickInfoForContextuallyTypedArrowFunctionInSuperCall.ts @@ -1,4 +1,4 @@ -/// +/// ////class A { //// constructor(private map: (value: T1) => T2) { diff --git a/tests/cases/fourslash/quickInfoForShorthandProperty.ts b/tests/cases/fourslash/quickInfoForShorthandProperty.ts index 21ba9db683..d4b30b0d73 100644 --- a/tests/cases/fourslash/quickInfoForShorthandProperty.ts +++ b/tests/cases/fourslash/quickInfoForShorthandProperty.ts @@ -1,4 +1,4 @@ -/// +/// //// var name1 = undefined, id1 = undefined; //// var /*obj1*/obj1 = {/*name1*/name1, /*id1*/id1}; diff --git a/tests/cases/fourslash/quickInfoInInvalidIndexSignature.ts b/tests/cases/fourslash/quickInfoInInvalidIndexSignature.ts index b08fb92b8b..0aa634d089 100644 --- a/tests/cases/fourslash/quickInfoInInvalidIndexSignature.ts +++ b/tests/cases/fourslash/quickInfoInInvalidIndexSignature.ts @@ -1,6 +1,6 @@ -/// - -//// function method() { var /**/dictionary = <{ [index]: string; }>{}; } - -goTo.marker(); -verify.quickInfoIs('(local var) dictionary: {}'); +/// + +//// function method() { var /**/dictionary = <{ [index]: string; }>{}; } + +goTo.marker(); +verify.quickInfoIs('(local var) dictionary: {}'); diff --git a/tests/cases/fourslash/quickInfoOfLablledForStatementIterator.ts b/tests/cases/fourslash/quickInfoOfLablledForStatementIterator.ts index d1fd6994f7..5091dd0c1c 100644 --- a/tests/cases/fourslash/quickInfoOfLablledForStatementIterator.ts +++ b/tests/cases/fourslash/quickInfoOfLablledForStatementIterator.ts @@ -1,6 +1,6 @@ -/// - -//// label1: for(var /**/i = 0; i < 1; i++) { } - -goTo.marker(); +/// + +//// label1: for(var /**/i = 0; i < 1; i++) { } + +goTo.marker(); verify.quickInfoExists(); \ No newline at end of file diff --git a/tests/cases/fourslash/quickInfoOnCatchVariable.ts b/tests/cases/fourslash/quickInfoOnCatchVariable.ts index d03b5d7b8b..1ca0aa670d 100644 --- a/tests/cases/fourslash/quickInfoOnCatchVariable.ts +++ b/tests/cases/fourslash/quickInfoOnCatchVariable.ts @@ -1,9 +1,9 @@ -/// - -//// function f() { -//// try { } catch (/**/e) { } -//// } - -goTo.marker(); -verify.quickInfoExists(); -verify.quickInfoIs("(var) e: any"); +/// + +//// function f() { +//// try { } catch (/**/e) { } +//// } + +goTo.marker(); +verify.quickInfoExists(); +verify.quickInfoIs("(local var) e: any"); diff --git a/tests/cases/fourslash/recursiveGenerics2.ts b/tests/cases/fourslash/recursiveGenerics2.ts index 6db5e03fc3..171bc31069 100644 --- a/tests/cases/fourslash/recursiveGenerics2.ts +++ b/tests/cases/fourslash/recursiveGenerics2.ts @@ -1,5 +1,5 @@ -/// - +/// + //// class S18 extends S18 { } //// /**/ diff --git a/tests/cases/fourslash/recursiveInternalModuleImport.ts b/tests/cases/fourslash/recursiveInternalModuleImport.ts index 3f377cb579..afd94a1de2 100644 --- a/tests/cases/fourslash/recursiveInternalModuleImport.ts +++ b/tests/cases/fourslash/recursiveInternalModuleImport.ts @@ -1,11 +1,11 @@ -/// - -//// module M { -//// import A = B; -//// import /**/B = A; -//// } -//// - -goTo.marker(); -verify.quickInfoExists(); - +/// + +//// module M { +//// import A = B; +//// import /**/B = A; +//// } +//// + +goTo.marker(); +verify.quickInfoExists(); + diff --git a/tests/cases/fourslash/referenceToClass.ts b/tests/cases/fourslash/referenceToClass.ts index 2dd0bdc3e7..2907a46857 100644 --- a/tests/cases/fourslash/referenceToClass.ts +++ b/tests/cases/fourslash/referenceToClass.ts @@ -1,36 +1,36 @@ -/// - -// Class references should work across file and not find local variables. - -// @Filename: referenceToClass_1.ts -////class /*1*/foo { -//// public n: /*2*/foo; -//// public foo: number; -////} -//// -////class bar { -//// public n: fo/*3*/o; -//// public k = new foo(); -////} -//// -////module mod { -//// var k: foo = null; -////} - -// @Filename: referenceToClass_2.ts -////var k: /*4*/foo; - -goTo.marker("1"); -verify.referencesCountIs(6); - -goTo.marker("2"); - -verify.referencesCountIs(6); - -goTo.marker("3"); - -verify.referencesCountIs(6); - -goTo.marker("4"); - +/// + +// Class references should work across file and not find local variables. + +// @Filename: referenceToClass_1.ts +////class /*1*/foo { +//// public n: /*2*/foo; +//// public foo: number; +////} +//// +////class bar { +//// public n: fo/*3*/o; +//// public k = new foo(); +////} +//// +////module mod { +//// var k: foo = null; +////} + +// @Filename: referenceToClass_2.ts +////var k: /*4*/foo; + +goTo.marker("1"); +verify.referencesCountIs(6); + +goTo.marker("2"); + +verify.referencesCountIs(6); + +goTo.marker("3"); + +verify.referencesCountIs(6); + +goTo.marker("4"); + verify.referencesCountIs(6); \ No newline at end of file diff --git a/tests/cases/fourslash/referencesBloomFilters.ts b/tests/cases/fourslash/referencesBloomFilters.ts index ea7dcfaaf0..3961d557e8 100644 --- a/tests/cases/fourslash/referencesBloomFilters.ts +++ b/tests/cases/fourslash/referencesBloomFilters.ts @@ -1,20 +1,20 @@ -/// - -// Ensure BloomFilter building logic is correct, by having one reference per file - -// @Filename: declaration.ts -////var container = { /*1*/searchProp : 1 }; - -// @Filename: expression.ts -////function blah() { return (1 + 2 + container./*2*/searchProp()) === 2; }; - -// @Filename: stringIndexer.ts -////function blah2() { container[/*3*/"searchProp"] }; - -// @Filename: redeclaration.ts -////container = { /*4*/"searchProp" : 18 }; - -test.markers().forEach(m => { - goTo.position(m.position, m.fileName); - verify.referencesCountIs(4); +/// + +// Ensure BloomFilter building logic is correct, by having one reference per file + +// @Filename: declaration.ts +////var container = { /*1*/searchProp : 1 }; + +// @Filename: expression.ts +////function blah() { return (1 + 2 + container./*2*/searchProp()) === 2; }; + +// @Filename: stringIndexer.ts +////function blah2() { container[/*3*/"searchProp"] }; + +// @Filename: redeclaration.ts +////container = { /*4*/"searchProp" : 18 }; + +test.markers().forEach(m => { + goTo.position(m.position, m.fileName); + verify.referencesCountIs(4); }); \ No newline at end of file diff --git a/tests/cases/fourslash/referencesBloomFilters2.ts b/tests/cases/fourslash/referencesBloomFilters2.ts index 7599e2fe96..ef7643e021 100644 --- a/tests/cases/fourslash/referencesBloomFilters2.ts +++ b/tests/cases/fourslash/referencesBloomFilters2.ts @@ -1,20 +1,20 @@ -/// - -// Ensure BloomFilter building logic is correct, by having one reference per file - -// @Filename: declaration.ts -////var container = { /*1*/42 : 1 }; - -// @Filename: expression.ts -////function blah() { return (container[/*2*/42]) === 2; }; - -// @Filename: stringIndexer.ts -////function blah2() { container[/*3*/"42"] }; - -// @Filename: redeclaration.ts -////container = { /*4*/"42" : 18 }; - -test.markers().forEach(m => { - goTo.position(m.position, m.fileName); - verify.referencesCountIs(4); +/// + +// Ensure BloomFilter building logic is correct, by having one reference per file + +// @Filename: declaration.ts +////var container = { /*1*/42 : 1 }; + +// @Filename: expression.ts +////function blah() { return (container[/*2*/42]) === 2; }; + +// @Filename: stringIndexer.ts +////function blah2() { container[/*3*/"42"] }; + +// @Filename: redeclaration.ts +////container = { /*4*/"42" : 18 }; + +test.markers().forEach(m => { + goTo.position(m.position, m.fileName); + verify.referencesCountIs(4); }); \ No newline at end of file diff --git a/tests/cases/fourslash/referencesBloomFilters3.ts b/tests/cases/fourslash/referencesBloomFilters3.ts index 7056bab239..6521546995 100644 --- a/tests/cases/fourslash/referencesBloomFilters3.ts +++ b/tests/cases/fourslash/referencesBloomFilters3.ts @@ -1,16 +1,16 @@ -/// - -// Ensure BloomFilter building logic is correct, by having one reference per file - - -// @Filename: declaration.ts -////enum Test { /*1*/"42" = 1 }; - -// @Filename: expression.ts -////(Test[/*2*/42]); - - -test.markers().forEach(m => { - goTo.position(m.position, m.fileName); - verify.referencesCountIs(2); +/// + +// Ensure BloomFilter building logic is correct, by having one reference per file + + +// @Filename: declaration.ts +////enum Test { /*1*/"42" = 1 }; + +// @Filename: expression.ts +////(Test[/*2*/42]); + + +test.markers().forEach(m => { + goTo.position(m.position, m.fileName); + verify.referencesCountIs(2); }); \ No newline at end of file diff --git a/tests/cases/fourslash/referencesForClassParameter.ts b/tests/cases/fourslash/referencesForClassParameter.ts index 2d0bdf9f9c..48cdbbf1e4 100644 --- a/tests/cases/fourslash/referencesForClassParameter.ts +++ b/tests/cases/fourslash/referencesForClassParameter.ts @@ -1,26 +1,26 @@ -/// - -// Reference to a class parameter. - -////var p = 2; -//// -////class p { } -//// -////class foo { -//// constructor (public p: any) { -//// } -//// -//// public f(p) { -//// this./*1*/p = p; -//// } -//// -////} -//// -////var n = new foo(undefined); -////n./*2*/p = null; - -goTo.marker("1"); -verify.referencesCountIs(3); - -goTo.marker("2"); +/// + +// Reference to a class parameter. + +////var p = 2; +//// +////class p { } +//// +////class foo { +//// constructor (public p: any) { +//// } +//// +//// public f(p) { +//// this./*1*/p = p; +//// } +//// +////} +//// +////var n = new foo(undefined); +////n./*2*/p = null; + +goTo.marker("1"); +verify.referencesCountIs(3); + +goTo.marker("2"); verify.referencesCountIs(3); \ No newline at end of file diff --git a/tests/cases/fourslash/referencesForFunctionOverloads.ts b/tests/cases/fourslash/referencesForFunctionOverloads.ts index f27dd8e846..2a4981ff4a 100644 --- a/tests/cases/fourslash/referencesForFunctionOverloads.ts +++ b/tests/cases/fourslash/referencesForFunctionOverloads.ts @@ -1,17 +1,17 @@ -/// - -// Function overloads should be highlighted together. - -////function /*1*/foo(x: string); -////function /*2*/foo(x: string, y: number) { -//// /*3*/foo('', 43); -////} - -goTo.marker("1"); -verify.referencesCountIs(3); - -goTo.marker("2"); -verify.referencesCountIs(3); - -goTo.marker("3"); +/// + +// Function overloads should be highlighted together. + +////function /*1*/foo(x: string); +////function /*2*/foo(x: string, y: number) { +//// /*3*/foo('', 43); +////} + +goTo.marker("1"); +verify.referencesCountIs(3); + +goTo.marker("2"); +verify.referencesCountIs(3); + +goTo.marker("3"); verify.referencesCountIs(3); \ No newline at end of file diff --git a/tests/cases/fourslash/referencesForFunctionParameter.ts b/tests/cases/fourslash/referencesForFunctionParameter.ts index b8ffc5f639..fd9189d1b7 100644 --- a/tests/cases/fourslash/referencesForFunctionParameter.ts +++ b/tests/cases/fourslash/referencesForFunctionParameter.ts @@ -1,15 +1,15 @@ -/// - -////var x; -////var n; -//// -////function n(x: number, /*1*/n: number) { -//// /*2*/n = 32; -//// x = n; -////} - -goTo.marker("1"); -verify.referencesCountIs(3); - -goTo.marker("2"); +/// + +////var x; +////var n; +//// +////function n(x: number, /*1*/n: number) { +//// /*2*/n = 32; +//// x = n; +////} + +goTo.marker("1"); +verify.referencesCountIs(3); + +goTo.marker("2"); verify.referencesCountIs(3); \ No newline at end of file diff --git a/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts b/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts index 4afaedf93e..b76007624b 100644 --- a/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts +++ b/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts @@ -1,24 +1,24 @@ -/// - -// Global variable reference. - -////var /*1*/topLevelVar = 2; -////var topLevelVar2 = topLevelVar; -//// -////class /*2*/topLevelClass { } -////var c = new topLevelClass(); -//// -////interface topLevelInterface { } -////var i: /*3*/topLevelInterface; -//// -////module topLevelModule { -//// export var x; -////} -////var x = /*4*/topLevelModule.x; -//// -////export = x; - -test.markers().forEach(m => { - goTo.position(m.position, m.fileName); - verify.referencesCountIs(2); +/// + +// Global variable reference. + +////var /*1*/topLevelVar = 2; +////var topLevelVar2 = topLevelVar; +//// +////class /*2*/topLevelClass { } +////var c = new topLevelClass(); +//// +////interface topLevelInterface { } +////var i: /*3*/topLevelInterface; +//// +////module topLevelModule { +//// export var x; +////} +////var x = /*4*/topLevelModule.x; +//// +////export = x; + +test.markers().forEach(m => { + goTo.position(m.position, m.fileName); + verify.referencesCountIs(2); }); \ No newline at end of file diff --git a/tests/cases/fourslash/referencesForIllegalAssignment.ts b/tests/cases/fourslash/referencesForIllegalAssignment.ts index 6c7d228d3e..81a45f6415 100644 --- a/tests/cases/fourslash/referencesForIllegalAssignment.ts +++ b/tests/cases/fourslash/referencesForIllegalAssignment.ts @@ -1,21 +1,21 @@ -/// - -////f/*1*/oo = fo/*2*/o; - -////var /*3*/bar = function () { }; -////ba/*4*/r = b/*5*/ar + 1; - -goTo.marker("1"); -verify.referencesCountIs(1); - -goTo.marker("2"); -verify.referencesCountIs(1); - -goTo.marker("3"); -verify.referencesCountIs(3); - -goTo.marker("4"); -verify.referencesCountIs(3); - -goTo.marker("5"); +/// + +////f/*1*/oo = fo/*2*/o; + +////var /*3*/bar = function () { }; +////ba/*4*/r = b/*5*/ar + 1; + +goTo.marker("1"); +verify.referencesCountIs(1); + +goTo.marker("2"); +verify.referencesCountIs(1); + +goTo.marker("3"); +verify.referencesCountIs(3); + +goTo.marker("4"); +verify.referencesCountIs(3); + +goTo.marker("5"); verify.referencesCountIs(3); \ No newline at end of file diff --git a/tests/cases/fourslash/referencesForIndexProperty.ts b/tests/cases/fourslash/referencesForIndexProperty.ts index 96ae1ff05e..89084a2ef0 100644 --- a/tests/cases/fourslash/referencesForIndexProperty.ts +++ b/tests/cases/fourslash/referencesForIndexProperty.ts @@ -1,18 +1,18 @@ -/// - -// References a class property using string index access - -////class Foo { -//// property: number; -//// method(): void { } -////} -//// -////var f: Foo; -////f[/*1*/"property"]; -////f[/*2*/"method"]; - -goTo.marker("1"); -verify.referencesCountIs(2); - -goTo.marker("2"); -verify.referencesCountIs(2); +/// + +// References a class property using string index access + +////class Foo { +//// property: number; +//// method(): void { } +////} +//// +////var f: Foo; +////f[/*1*/"property"]; +////f[/*2*/"method"]; + +goTo.marker("1"); +verify.referencesCountIs(2); + +goTo.marker("2"); +verify.referencesCountIs(2); diff --git a/tests/cases/fourslash/referencesForIndexProperty2.ts b/tests/cases/fourslash/referencesForIndexProperty2.ts index a84adf672a..fd9cf0e718 100644 --- a/tests/cases/fourslash/referencesForIndexProperty2.ts +++ b/tests/cases/fourslash/referencesForIndexProperty2.ts @@ -1,9 +1,9 @@ -/// - -// References to a unknown index property - -////var a; -////a[/*1*/"blah"]; - -goTo.marker("1"); +/// + +// References to a unknown index property + +////var a; +////a[/*1*/"blah"]; + +goTo.marker("1"); verify.referencesCountIs(1); \ No newline at end of file diff --git a/tests/cases/fourslash/referencesForIndexProperty3.ts b/tests/cases/fourslash/referencesForIndexProperty3.ts index 72a2b560b4..07081f8c17 100644 --- a/tests/cases/fourslash/referencesForIndexProperty3.ts +++ b/tests/cases/fourslash/referencesForIndexProperty3.ts @@ -1,19 +1,19 @@ -/// - -// References to a property of the apparent type using string indexer - -////interface Object { -//// toMyString(); -////} -//// -////var y: Object; -////y./*1*/toMyString(); -//// -////var x = {}; -////x[/*2*/"toMyString"](); - -goTo.marker("1"); -verify.referencesCountIs(3); - -goTo.marker("2"); -verify.referencesCountIs(3); +/// + +// References to a property of the apparent type using string indexer + +////interface Object { +//// toMyString(); +////} +//// +////var y: Object; +////y./*1*/toMyString(); +//// +////var x = {}; +////x[/*2*/"toMyString"](); + +goTo.marker("1"); +verify.referencesCountIs(3); + +goTo.marker("2"); +verify.referencesCountIs(3); diff --git a/tests/cases/fourslash/referencesForLabel.ts b/tests/cases/fourslash/referencesForLabel.ts index ee5df8049c..f79e038ca0 100644 --- a/tests/cases/fourslash/referencesForLabel.ts +++ b/tests/cases/fourslash/referencesForLabel.ts @@ -1,23 +1,23 @@ -/// - -// Valid References for a label - -/////*1*/label: while (true) { -//// if (false) break /*2*/label; -//// if (true) continue /*3*/label; -////} -//// -/////*4*/label: while (false) { } -////var label = "label"; - -goTo.marker("1"); -verify.referencesCountIs(3); - -goTo.marker("2"); -verify.referencesCountIs(3); - -goTo.marker("3"); -verify.referencesCountIs(3); - -goTo.marker("4"); +/// + +// Valid References for a label + +/////*1*/label: while (true) { +//// if (false) break /*2*/label; +//// if (true) continue /*3*/label; +////} +//// +/////*4*/label: while (false) { } +////var label = "label"; + +goTo.marker("1"); +verify.referencesCountIs(3); + +goTo.marker("2"); +verify.referencesCountIs(3); + +goTo.marker("3"); +verify.referencesCountIs(3); + +goTo.marker("4"); verify.referencesCountIs(1); \ No newline at end of file diff --git a/tests/cases/fourslash/referencesForLabel2.ts b/tests/cases/fourslash/referencesForLabel2.ts index 96467158cc..054ce56286 100644 --- a/tests/cases/fourslash/referencesForLabel2.ts +++ b/tests/cases/fourslash/referencesForLabel2.ts @@ -1,12 +1,12 @@ -/// - -// References to undefined label - -////var label = "label"; -////while (true) { -//// if (false) break /*1*/label; -//// if (true) continue label; -////} - -goTo.marker("1"); -verify.referencesCountIs(1); +/// + +// References to undefined label + +////var label = "label"; +////while (true) { +//// if (false) break /*1*/label; +//// if (true) continue label; +////} + +goTo.marker("1"); +verify.referencesCountIs(1); diff --git a/tests/cases/fourslash/referencesForLabel3.ts b/tests/cases/fourslash/referencesForLabel3.ts index 5a4c389321..9c621909c3 100644 --- a/tests/cases/fourslash/referencesForLabel3.ts +++ b/tests/cases/fourslash/referencesForLabel3.ts @@ -1,10 +1,10 @@ -/// - -// References to unused label - -/////*1*/label: while (true) { -//// var label = "label"; -////} - -goTo.marker("1"); -verify.referencesCountIs(1); +/// + +// References to unused label + +/////*1*/label: while (true) { +//// var label = "label"; +////} + +goTo.marker("1"); +verify.referencesCountIs(1); diff --git a/tests/cases/fourslash/referencesForLabel4.ts b/tests/cases/fourslash/referencesForLabel4.ts index 4288046ece..d9817b2d85 100644 --- a/tests/cases/fourslash/referencesForLabel4.ts +++ b/tests/cases/fourslash/referencesForLabel4.ts @@ -1,15 +1,15 @@ -/// - -// References to a label outside function bounderies - -/////*1*/label: function foo(label) { -//// while (true) { -//// break /*2*/label; -//// } -////} - -goTo.marker("1"); -verify.referencesCountIs(2); - -goTo.marker("2"); -verify.referencesCountIs(2); +/// + +// References to a label outside function bounderies + +/////*1*/label: function foo(label) { +//// while (true) { +//// break /*2*/label; +//// } +////} + +goTo.marker("1"); +verify.referencesCountIs(2); + +goTo.marker("2"); +verify.referencesCountIs(2); diff --git a/tests/cases/fourslash/referencesForLabel5.ts b/tests/cases/fourslash/referencesForLabel5.ts index 0a465a89f2..dba59ec79a 100644 --- a/tests/cases/fourslash/referencesForLabel5.ts +++ b/tests/cases/fourslash/referencesForLabel5.ts @@ -1,28 +1,28 @@ -/// - -// References to shadowed label - -/////*outer1*/label: while (true) { -//// if (false) break /*outer2*/label; -//// function blah() { -/////*inner1*/label: while (true) { -//// if (false) break /*inner2*/label; -//// } -//// } -//// if (false) break /*outer3*/label; -//// } - -goTo.marker("outer1"); -verify.referencesCountIs(3); - -goTo.marker("outer2"); -verify.referencesCountIs(3); - -goTo.marker("outer3"); -verify.referencesCountIs(3); - -goTo.marker("inner1"); -verify.referencesCountIs(2); - -goTo.marker("inner2"); -verify.referencesCountIs(2); +/// + +// References to shadowed label + +/////*outer1*/label: while (true) { +//// if (false) break /*outer2*/label; +//// function blah() { +/////*inner1*/label: while (true) { +//// if (false) break /*inner2*/label; +//// } +//// } +//// if (false) break /*outer3*/label; +//// } + +goTo.marker("outer1"); +verify.referencesCountIs(3); + +goTo.marker("outer2"); +verify.referencesCountIs(3); + +goTo.marker("outer3"); +verify.referencesCountIs(3); + +goTo.marker("inner1"); +verify.referencesCountIs(2); + +goTo.marker("inner2"); +verify.referencesCountIs(2); diff --git a/tests/cases/fourslash/referencesForLabel6.ts b/tests/cases/fourslash/referencesForLabel6.ts index 83c3c8a2fc..a9aab59c46 100644 --- a/tests/cases/fourslash/referencesForLabel6.ts +++ b/tests/cases/fourslash/referencesForLabel6.ts @@ -1,14 +1,14 @@ -/// - -// References to lable wiht close names - -/////*1*/labela: while (true) { -/////*2*/labelb: while (false) { break labelb; } -//// break labelc; -////} - -goTo.marker("1"); -verify.referencesCountIs(1); - -goTo.marker("2"); +/// + +// References to lable wiht close names + +/////*1*/labela: while (true) { +/////*2*/labelb: while (false) { break labelb; } +//// break labelc; +////} + +goTo.marker("1"); +verify.referencesCountIs(1); + +goTo.marker("2"); verify.referencesCountIs(2); \ No newline at end of file diff --git a/tests/cases/fourslash/referencesForMergedDeclarations.ts b/tests/cases/fourslash/referencesForMergedDeclarations.ts index 51ad4ea8ce..a475780b66 100644 --- a/tests/cases/fourslash/referencesForMergedDeclarations.ts +++ b/tests/cases/fourslash/referencesForMergedDeclarations.ts @@ -1,5 +1,5 @@ -/// - +/// + ////interface /*type1*/Foo { ////} //// @@ -12,10 +12,10 @@ //// ////var f1: /*namespace2*/Foo.Bar; ////var f2: /*type2*/Foo; -/////*value2*/Foo.bind(this); - - -test.markers().forEach(m => { - goTo.position(m.position, m.fileName); - verify.referencesCountIs(2); -}); +/////*value2*/Foo.bind(this); + + +test.markers().forEach(m => { + goTo.position(m.position, m.fileName); + verify.referencesCountIs(2); +}); diff --git a/tests/cases/fourslash/referencesForMergedDeclarations3.ts b/tests/cases/fourslash/referencesForMergedDeclarations3.ts index c673f89179..80cf1fb9e4 100644 --- a/tests/cases/fourslash/referencesForMergedDeclarations3.ts +++ b/tests/cases/fourslash/referencesForMergedDeclarations3.ts @@ -1,4 +1,4 @@ -/// +/// // class and uninstanciated module @@ -18,22 +18,22 @@ /////*class2*/testClass.staticMethod(); /////*class3*/testClass.prototype.method(); /////*class4*/testClass.bind(this); -////new /*class5*/testClass(); - -goTo.marker("module"); -verify.referencesCountIs(2); - -goTo.marker("class1"); -verify.referencesCountIs(6); - -goTo.marker("class2"); -verify.referencesCountIs(6); - -goTo.marker("class3"); -verify.referencesCountIs(6); - -goTo.marker("class4"); -verify.referencesCountIs(6); - -goTo.marker("class5"); +////new /*class5*/testClass(); + +goTo.marker("module"); +verify.referencesCountIs(2); + +goTo.marker("class1"); +verify.referencesCountIs(6); + +goTo.marker("class2"); +verify.referencesCountIs(6); + +goTo.marker("class3"); +verify.referencesCountIs(6); + +goTo.marker("class4"); +verify.referencesCountIs(6); + +goTo.marker("class5"); verify.referencesCountIs(6); \ No newline at end of file diff --git a/tests/cases/fourslash/referencesForMergedDeclarations4.ts b/tests/cases/fourslash/referencesForMergedDeclarations4.ts index 1838659463..88faf672fc 100644 --- a/tests/cases/fourslash/referencesForMergedDeclarations4.ts +++ b/tests/cases/fourslash/referencesForMergedDeclarations4.ts @@ -1,4 +1,4 @@ -/// +/// // class and instanciated module @@ -20,10 +20,10 @@ /////*4*/testClass.prototype.method(); /////*5*/testClass.bind(this); /////*6*/testClass.s; -////new /*7*/testClass(); - -// Instanciated Module and class intersect in the value space, so we consider them all one group -test.markers().forEach(m => { - goTo.position(m.position, m.fileName); - verify.referencesCountIs(9); -}); +////new /*7*/testClass(); + +// Instanciated Module and class intersect in the value space, so we consider them all one group +test.markers().forEach(m => { + goTo.position(m.position, m.fileName); + verify.referencesCountIs(9); +}); diff --git a/tests/cases/fourslash/referencesForMergedDeclarations5.ts b/tests/cases/fourslash/referencesForMergedDeclarations5.ts index cf4ddea31d..deb7ad321c 100644 --- a/tests/cases/fourslash/referencesForMergedDeclarations5.ts +++ b/tests/cases/fourslash/referencesForMergedDeclarations5.ts @@ -1,10 +1,10 @@ -/// - -////interface Foo { } -////module Foo { export interface Bar { } } -////function Foo() { } -//// -////export = /*1*/Foo; - -goTo.marker("1"); +/// + +////interface Foo { } +////module Foo { export interface Bar { } } +////function Foo() { } +//// +////export = /*1*/Foo; + +goTo.marker("1"); verify.referencesCountIs(4); \ No newline at end of file diff --git a/tests/cases/fourslash/referencesForMergedDeclarations7.ts b/tests/cases/fourslash/referencesForMergedDeclarations7.ts index 7a86362907..1c6d730797 100644 --- a/tests/cases/fourslash/referencesForMergedDeclarations7.ts +++ b/tests/cases/fourslash/referencesForMergedDeclarations7.ts @@ -1,14 +1,14 @@ -/// - -////interface Foo { } -////module Foo { +/// + +////interface Foo { } +////module Foo { //// export interface Bar { } //// export module Bar { export interface Baz { } } //// export function Bar() { } -////} -//// -////// module, value and type -////import a2 = Foo./*1*/Bar; - -goTo.marker("1"); +////} +//// +////// module, value and type +////import a2 = Foo./*1*/Bar; + +goTo.marker("1"); verify.referencesCountIs(4); \ No newline at end of file diff --git a/tests/cases/fourslash/referencesForNoContext.ts b/tests/cases/fourslash/referencesForNoContext.ts index 4fe0753da6..ee9391e541 100644 --- a/tests/cases/fourslash/referencesForNoContext.ts +++ b/tests/cases/fourslash/referencesForNoContext.ts @@ -1,34 +1,34 @@ -/// - -////module modTest { -//// //Declare -//// export var modVar:number; -//// /*1*/ -//// -//// //Increments -//// modVar++; -//// -//// class testCls{ -//// /*2*/ -//// } -//// -//// function testFn(){ -//// //Increments -//// modVar++; -//// } /*3*/ -/////*4*/ -//// module testMod { -//// } -////} - -goTo.marker("1"); -verify.referencesCountIs(0); - -goTo.marker("2"); -verify.referencesCountIs(0); - -goTo.marker("3"); -verify.referencesCountIs(0); - -goTo.marker("4"); -verify.referencesCountIs(0); +/// + +////module modTest { +//// //Declare +//// export var modVar:number; +//// /*1*/ +//// +//// //Increments +//// modVar++; +//// +//// class testCls{ +//// /*2*/ +//// } +//// +//// function testFn(){ +//// //Increments +//// modVar++; +//// } /*3*/ +/////*4*/ +//// module testMod { +//// } +////} + +goTo.marker("1"); +verify.referencesCountIs(0); + +goTo.marker("2"); +verify.referencesCountIs(0); + +goTo.marker("3"); +verify.referencesCountIs(0); + +goTo.marker("4"); +verify.referencesCountIs(0); diff --git a/tests/cases/fourslash/referencesForObjectLiteralProperties.ts b/tests/cases/fourslash/referencesForObjectLiteralProperties.ts index c606e2f13f..8515a5487b 100644 --- a/tests/cases/fourslash/referencesForObjectLiteralProperties.ts +++ b/tests/cases/fourslash/referencesForObjectLiteralProperties.ts @@ -1,15 +1,15 @@ -/// - -// References to an object literal property - +/// + +// References to an object literal property + ////var x = { /*1*/add: 0, b: "string" }; ////x["add"]; ////x./*2*/add; ////var y = x; -////y.add; - -goTo.marker("1"); -verify.referencesCountIs(4); - -goTo.marker("2"); +////y.add; + +goTo.marker("1"); +verify.referencesCountIs(4); + +goTo.marker("2"); verify.referencesCountIs(4); \ No newline at end of file diff --git a/tests/cases/fourslash/referencesForOverrides.ts b/tests/cases/fourslash/referencesForOverrides.ts index df3a6f208a..2b67269a6f 100644 --- a/tests/cases/fourslash/referencesForOverrides.ts +++ b/tests/cases/fourslash/referencesForOverrides.ts @@ -1,84 +1,84 @@ -/// - -////module FindRef3 { -//// module SimpleClassTest { -//// export class Foo { -//// public foo(): void { -//// } -//// } -//// export class Bar extends Foo { -//// public foo(): void { -//// } -//// } -//// } -//// -//// module SimpleInterfaceTest { -//// export interface IFoo { -//// foo(): void; -//// } -//// export interface IBar extends IFoo { -//// foo(): void; -//// } -//// } -//// -//// module SimpleClassInterfaceTest { -//// export interface IFoo { -//// foo(): void; -//// } -//// export class Bar implements IFoo { -//// public foo(): void { -//// } -//// } -//// } -//// -//// module Test { -//// export interface IBase { -//// field: string; -//// method(): void; -//// } -//// -//// export interface IBlah extends IBase { -//// field: string; -//// } -//// -//// export interface IBlah2 extends IBlah { -//// field: string; -//// } -//// -//// export interface IDerived extends IBlah2 { -//// method(): void; -//// } -//// -//// export class Bar implements IDerived { -//// public field: string; -//// public method(): void { } -//// } -//// -//// export class BarBlah extends Bar { -//// public field: string; -//// } -//// } -//// -//// function test() { -//// var x = new SimpleClassTest.Bar(); -//// x.fo/*1*/o(); -//// -//// var y: SimpleInterfaceTest.IBar = null; -//// y.fo/*2*/o(); -//// -//// var z = new Test.BarBlah(); -//// z.fi/*3*/eld = ""; -//// } -////} - -// References to a field declared in a base class. -goTo.marker("1"); -verify.referencesCountIs(3); - -// References to a field declared in a base interface. -goTo.marker("2"); -verify.referencesCountIs(3); - -// References to a field declared in a chain of base class and interfaces. -goTo.marker("3"); -verify.referencesCountIs(6); +/// + +////module FindRef3 { +//// module SimpleClassTest { +//// export class Foo { +//// public foo(): void { +//// } +//// } +//// export class Bar extends Foo { +//// public foo(): void { +//// } +//// } +//// } +//// +//// module SimpleInterfaceTest { +//// export interface IFoo { +//// foo(): void; +//// } +//// export interface IBar extends IFoo { +//// foo(): void; +//// } +//// } +//// +//// module SimpleClassInterfaceTest { +//// export interface IFoo { +//// foo(): void; +//// } +//// export class Bar implements IFoo { +//// public foo(): void { +//// } +//// } +//// } +//// +//// module Test { +//// export interface IBase { +//// field: string; +//// method(): void; +//// } +//// +//// export interface IBlah extends IBase { +//// field: string; +//// } +//// +//// export interface IBlah2 extends IBlah { +//// field: string; +//// } +//// +//// export interface IDerived extends IBlah2 { +//// method(): void; +//// } +//// +//// export class Bar implements IDerived { +//// public field: string; +//// public method(): void { } +//// } +//// +//// export class BarBlah extends Bar { +//// public field: string; +//// } +//// } +//// +//// function test() { +//// var x = new SimpleClassTest.Bar(); +//// x.fo/*1*/o(); +//// +//// var y: SimpleInterfaceTest.IBar = null; +//// y.fo/*2*/o(); +//// +//// var z = new Test.BarBlah(); +//// z.fi/*3*/eld = ""; +//// } +////} + +// References to a field declared in a base class. +goTo.marker("1"); +verify.referencesCountIs(3); + +// References to a field declared in a base interface. +goTo.marker("2"); +verify.referencesCountIs(3); + +// References to a field declared in a chain of base class and interfaces. +goTo.marker("3"); +verify.referencesCountIs(6); diff --git a/tests/cases/fourslash/referencesForPropertiesOfGenericType.ts b/tests/cases/fourslash/referencesForPropertiesOfGenericType.ts index e5428df0d5..c611c40fc8 100644 --- a/tests/cases/fourslash/referencesForPropertiesOfGenericType.ts +++ b/tests/cases/fourslash/referencesForPropertiesOfGenericType.ts @@ -1,5 +1,5 @@ -/// - +/// + ////interface IFoo { //// /*1*/doSomething(v: T): T; ////} @@ -8,8 +8,8 @@ ////x.doSomething("ss"); //// ////var y: IFoo; -////y.doSomething(12); - - -goTo.marker("1"); +////y.doSomething(12); + + +goTo.marker("1"); verify.referencesCountIs(3); \ No newline at end of file diff --git a/tests/cases/fourslash/referencesForStatic.ts b/tests/cases/fourslash/referencesForStatic.ts index 97a88a9278..34b34e2d47 100644 --- a/tests/cases/fourslash/referencesForStatic.ts +++ b/tests/cases/fourslash/referencesForStatic.ts @@ -1,40 +1,40 @@ -/// - -// Reference a class static. - -// @Filename: referencesOnStatic_1.ts -////var n = 43; -//// -////class foo { -//// static n = ''; -//// -//// public bar() { -//// foo./*1*/n = "'"; -//// if(foo.n) { -//// var x = foo.n; -//// } -//// } -////} -//// -////class foo2 { -//// private x = foo./*2*/n; -//// constructor() { -//// foo./*3*/n = x; -//// } -//// -//// function b(n) { -//// n = foo.n; -//// } -////} - -// @Filename: referencesOnStatic_2.ts -////var q = foo.n; - -goTo.marker("1"); -verify.referencesCountIs(8); - -goTo.marker("2"); -verify.referencesCountIs(8); - -goTo.marker("3"); +/// + +// Reference a class static. + +// @Filename: referencesOnStatic_1.ts +////var n = 43; +//// +////class foo { +//// static n = ''; +//// +//// public bar() { +//// foo./*1*/n = "'"; +//// if(foo.n) { +//// var x = foo.n; +//// } +//// } +////} +//// +////class foo2 { +//// private x = foo./*2*/n; +//// constructor() { +//// foo./*3*/n = x; +//// } +//// +//// function b(n) { +//// n = foo.n; +//// } +////} + +// @Filename: referencesOnStatic_2.ts +////var q = foo.n; + +goTo.marker("1"); +verify.referencesCountIs(8); + +goTo.marker("2"); +verify.referencesCountIs(8); + +goTo.marker("3"); verify.referencesCountIs(8); \ No newline at end of file diff --git a/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts b/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts index 15ae06e056..fe83f47757 100644 --- a/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts +++ b/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts @@ -1,49 +1,49 @@ -/// - -////module FindRef4 { -//// module MixedStaticsClassTest { -//// export class Foo { -//// b/*3*/ar: Foo; -//// static b/*4*/ar: Foo; -//// -//// public f/*1*/oo(): void { -//// } -//// public static f/*2*/oo(): void { -//// } -//// } -//// } -//// -//// function test() { -//// // instance function -//// var x = new MixedStaticsClassTest.Foo(); -//// x.foo(); -//// x.bar; -//// -//// var y = new MixedStaticsClassTest.Foo(); -//// y.foo(); -//// y.bar; -//// -//// // static function -//// MixedStaticsClassTest.Foo.foo(); -//// MixedStaticsClassTest.Foo.bar; -//// } -////} - +/// + +////module FindRef4 { +//// module MixedStaticsClassTest { +//// export class Foo { +//// b/*3*/ar: Foo; +//// static b/*4*/ar: Foo; +//// +//// public f/*1*/oo(): void { +//// } +//// public static f/*2*/oo(): void { +//// } +//// } +//// } +//// +//// function test() { +//// // instance function +//// var x = new MixedStaticsClassTest.Foo(); +//// x.foo(); +//// x.bar; +//// +//// var y = new MixedStaticsClassTest.Foo(); +//// y.foo(); +//// y.bar; +//// +//// // static function +//// MixedStaticsClassTest.Foo.foo(); +//// MixedStaticsClassTest.Foo.bar; +//// } +////} + // this line triggers a semantic/syntactic error check, remove line when 788570 is fixed -edit.insert(''); - -// References to a member method with the same name as a static. -goTo.marker("1"); -verify.referencesCountIs(3); - -// References to a static method with the same name as a member. -goTo.marker("2"); -verify.referencesCountIs(2); - -// References to a member property with the same name as a static. -goTo.marker("3"); -verify.referencesCountIs(3); - -// References to a static property with the same name as a member. -goTo.marker("4"); -verify.referencesCountIs(2); +edit.insert(''); + +// References to a member method with the same name as a static. +goTo.marker("1"); +verify.referencesCountIs(3); + +// References to a static method with the same name as a member. +goTo.marker("2"); +verify.referencesCountIs(2); + +// References to a member property with the same name as a static. +goTo.marker("3"); +verify.referencesCountIs(3); + +// References to a static property with the same name as a member. +goTo.marker("4"); +verify.referencesCountIs(2); diff --git a/tests/cases/fourslash/referencesForStringLiteralPropertyNames2.ts b/tests/cases/fourslash/referencesForStringLiteralPropertyNames2.ts index 86ce18abb8..67b956dcd0 100644 --- a/tests/cases/fourslash/referencesForStringLiteralPropertyNames2.ts +++ b/tests/cases/fourslash/referencesForStringLiteralPropertyNames2.ts @@ -1,15 +1,15 @@ -/// - +/// + ////class Foo { //// /*1*/"blah"() { return 0; } ////} //// ////var x: Foo; ////x./*2*/blah; - - -goTo.marker("1"); -verify.referencesCountIs(2); - -goTo.marker("2"); -verify.referencesCountIs(2); + + +goTo.marker("1"); +verify.referencesCountIs(2); + +goTo.marker("2"); +verify.referencesCountIs(2); diff --git a/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts b/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts index 59ab77e584..3288aec9b9 100644 --- a/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts +++ b/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts @@ -1,15 +1,15 @@ -/// - +/// + ////class Foo2 { //// get /*1*/"42"() { return 0; } //// set /*2*/42(n) { } ////} //// ////var y: Foo2; -////y[42]; - -goTo.marker("1"); -verify.referencesCountIs(3); - -goTo.marker("2"); +////y[42]; + +goTo.marker("1"); +verify.referencesCountIs(3); + +goTo.marker("2"); verify.referencesCountIs(3); \ No newline at end of file diff --git a/tests/cases/fourslash/referencesForStringLiteralPropertyNames4.ts b/tests/cases/fourslash/referencesForStringLiteralPropertyNames4.ts index 8c6292143a..08d04188ee 100644 --- a/tests/cases/fourslash/referencesForStringLiteralPropertyNames4.ts +++ b/tests/cases/fourslash/referencesForStringLiteralPropertyNames4.ts @@ -1,8 +1,8 @@ -/// - -////var x = { "[|someProperty|]": 0 } -////x["[|someProperty|]"] = 3; -////x./*1*/[|someProperty|] = 5; - -goTo.marker("1"); +/// + +////var x = { "[|someProperty|]": 0 } +////x["[|someProperty|]"] = 3; +////x./*1*/[|someProperty|] = 5; + +goTo.marker("1"); test.ranges().forEach(r => verify.referencesAtPositionContains(r)); \ No newline at end of file diff --git a/tests/cases/fourslash/referencesForUnionProperties.ts b/tests/cases/fourslash/referencesForUnionProperties.ts index f4ef85e8e4..d5f0a2fd51 100644 --- a/tests/cases/fourslash/referencesForUnionProperties.ts +++ b/tests/cases/fourslash/referencesForUnionProperties.ts @@ -4,15 +4,15 @@ //// common: { /*1*/a: number; }; ////} //// -////interface Base { -//// /*2*/a: string; -//// b: string; -////} +////interface Base { +//// /*2*/a: string; +//// b: string; +////} //// -////interface HasAOrB extends Base { -//// /*3*/a: string; -//// b: string; -////} +////interface HasAOrB extends Base { +//// /*3*/a: string; +//// b: string; +////} //// ////interface Two { //// common: HasAOrB; diff --git a/tests/cases/fourslash/referencesInComment.ts b/tests/cases/fourslash/referencesInComment.ts index f6a9fcdb0f..7ae9fdec9d 100644 --- a/tests/cases/fourslash/referencesInComment.ts +++ b/tests/cases/fourslash/referencesInComment.ts @@ -1,18 +1,18 @@ -/// - -////// References to /*1*/foo or b/*2*/ar -/////* in comments should not find fo/*3*/o or bar/*4*/ */ -////class foo { } -////var bar = 0; - -goTo.marker("1"); -verify.referencesCountIs(0); - -goTo.marker("2"); -verify.referencesCountIs(0); - -goTo.marker("3"); -verify.referencesCountIs(0); - -goTo.marker("4"); +/// + +////// References to /*1*/foo or b/*2*/ar +/////* in comments should not find fo/*3*/o or bar/*4*/ */ +////class foo { } +////var bar = 0; + +goTo.marker("1"); +verify.referencesCountIs(0); + +goTo.marker("2"); +verify.referencesCountIs(0); + +goTo.marker("3"); +verify.referencesCountIs(0); + +goTo.marker("4"); verify.referencesCountIs(0); \ No newline at end of file diff --git a/tests/cases/fourslash/regexDetection.ts b/tests/cases/fourslash/regexDetection.ts index 03ad81f63b..585e25ceba 100644 --- a/tests/cases/fourslash/regexDetection.ts +++ b/tests/cases/fourslash/regexDetection.ts @@ -1,15 +1,15 @@ -/// - -//// /*1*/15 / /*2*/Math.min(61 / /*3*/42, 32 / 15) / /*4*/15; - -goTo.marker("1"); -verify.not.quickInfoExists(); - -goTo.marker("2"); -verify.not.quickInfoIs('RegExp'); - -goTo.marker("3"); -verify.not.quickInfoExists(); - -goTo.marker("4"); +/// + +//// /*1*/15 / /*2*/Math.min(61 / /*3*/42, 32 / 15) / /*4*/15; + +goTo.marker("1"); +verify.not.quickInfoExists(); + +goTo.marker("2"); +verify.not.quickInfoIs('RegExp'); + +goTo.marker("3"); +verify.not.quickInfoExists(); + +goTo.marker("4"); verify.not.quickInfoExists(); \ No newline at end of file diff --git a/tests/cases/fourslash/regexErrorRecovery.ts b/tests/cases/fourslash/regexErrorRecovery.ts index 8b5a0e5e65..4f46249552 100644 --- a/tests/cases/fourslash/regexErrorRecovery.ts +++ b/tests/cases/fourslash/regexErrorRecovery.ts @@ -1,13 +1,13 @@ -/// - -//// // test code -//////var x = //**/a/;/*1*/ -//////x.exec("bab"); - -//goTo.marker(""); -//debug.printCurrentFileState(); -//verify.quickInfoIs("RegExp"); -//// Bug 579071: Parser no longer detects a Regex when an open bracket is inserted -edit.insert("("); -////verify.quickInfoIs("RegExp"); +/// + +//// // test code +//////var x = //**/a/;/*1*/ +//////x.exec("bab"); + +//goTo.marker(""); +//debug.printCurrentFileState(); +//verify.quickInfoIs("RegExp"); +//// Bug 579071: Parser no longer detects a Regex when an open bracket is inserted +edit.insert("("); +////verify.quickInfoIs("RegExp"); ////verify.not.errorExistsAfterMarker("1"); \ No newline at end of file diff --git a/tests/cases/fourslash/remoteGetReferences.ts b/tests/cases/fourslash/remoteGetReferences.ts index 1bf857f24f..cdc4ab035a 100644 --- a/tests/cases/fourslash/remoteGetReferences.ts +++ b/tests/cases/fourslash/remoteGetReferences.ts @@ -1,202 +1,202 @@ -/// - -// @Filename: remoteGetReferences_1.ts -////// Comment Refence Test: globalVar -////var globalVar: number = 2; -//// -////class fooCls { -//// static clsSVar = 1; -//// //Declare -//// clsVar = 1; -//// -//// constructor (public clsParam: number) { -//// //Increments -//// globalVar++; -//// this.clsVar++; -//// fooCls.clsSVar++; -//// this.clsParam++; -//// modTest.modVar++; -//// } -////} -//// -////function foo(x: number) { -//// //Declare -//// var fnVar = 1; -//// -//// //Increments -//// fooCls.clsSVar++; -//// globalVar++; -//// modTest.modVar++; -//// fnVar++; -//// -//// //Return -//// return x++; -////} -//// -////module modTest { -//// //Declare -//// export var modVar:number; -//// -//// //Increments -//// globalVar++; -//// fooCls.clsSVar++; -//// modVar++; -//// -//// class testCls { -//// static boo = foo; -//// } -//// -//// function testFn(){ -//// static boo = foo; -//// -//// //Increments -//// globalVar++; -//// fooCls.clsSVar++; -//// modVar++; -//// } -//// -//// module testMod { -//// var boo = foo; -//// } -////} -//// -//////Type test -////var clsTest: fooCls; -//// -//////Arguments -////clsTest = new fooCls(globalVar); -////foo(globalVar); -//// -//////Increments -////fooCls.clsSVar++; -////modTest.modVar++; -////globalVar = globalVar + globalVar; -//// -//////ETC - Other cases -////globalVar = 3; -////foo = foo + 1; -////err = err++; -//// -//////Shadowed fn Parameter -////function shdw(globalVar: number) { -//// //Increments -//// globalVar++; -//// return globalVar; -////} -//// -//////Remotes -//////Type test -////var remoteclsTest: rem/*2*/otefooCls; -//// -//////Arguments -////remoteclsTest = new remotefooCls(remoteglo/*4*/balVar); -////remotefoo(remotegl/*3*/obalVar); -//// -//////Increments -////remotefooCls.remoteclsSVar++; -////remotemodTest.remotemodVar++; -/////*1*/remoteglobalVar = remoteglobalVar + remoteglobalVar; -//// -//////ETC - Other cases -////remoteglobalVar = 3; -//// -//////Find References misses method param -////var -//// -//// -//// -//// array = ["f", "o", "o"]; -//// -////array.forEach( -//// -//// -////function(str) { -//// -//// -//// -//// return str + " "; -//// -////}); - -// @Filename: remoteGetReferences_2.ts -////var remoteglobalVar: number = 2; -//// -////class remotefooCls { -//// //Declare -//// rem/*5*/oteclsVar = 1; -//// static r/*6*/emoteclsSVar = 1; -//// -//// constructor(public remoteclsParam: number) { -//// //Increments -//// remoteglobalVar++; -//// this.remoteclsVar++; -//// remotefooCls.remoteclsSVar++; -//// this.remoteclsParam++; -//// remotemodTest.remotemodVar++; -//// } -////} -//// -////function remotefoo(remotex: number) { -//// //Declare -//// var remotefnVar = 1; -//// -//// //Increments -//// remotefooCls.remoteclsSVar++; -//// remoteglobalVar++; -//// remotemodTest.remotemodVar++; -//// remotefnVar++; -//// -//// //Return -//// return remotex++; -////} -//// -////module remotemodTest { -//// //Declare -//// export var remotemodVar: number; -//// -//// //Increments -//// remoteglobalVar++; -//// remotefooCls.remoteclsSVar++; -//// remotemodVar++; -//// -//// class remotetestCls { -//// static remoteboo = remotefoo; -//// } -//// -//// function remotetestFn(){ -//// static remoteboo = remotefoo; -//// -//// //Increments -//// remoteglobalVar++; -//// remotefooCls.remoteclsSVar++; -//// remotemodVar++; -//// } -//// -//// module remotetestMod { -//// var remoteboo = remotefoo; -//// } -////} - -// References to a variable declared in global. -goTo.marker("1"); -verify.referencesCountIs(11); - -// References to a type. -goTo.marker("2"); -verify.referencesCountIs(8); - -// References to a function argument. -goTo.marker("3"); -verify.referencesCountIs(11); - -// References to a class argument. -goTo.marker("4"); -verify.referencesCountIs(11); - -// References to a variable declared in a class. -goTo.marker("5"); -verify.referencesCountIs(2); - -// References to static variable declared in a class. -goTo.marker("6"); +/// + +// @Filename: remoteGetReferences_1.ts +////// Comment Refence Test: globalVar +////var globalVar: number = 2; +//// +////class fooCls { +//// static clsSVar = 1; +//// //Declare +//// clsVar = 1; +//// +//// constructor (public clsParam: number) { +//// //Increments +//// globalVar++; +//// this.clsVar++; +//// fooCls.clsSVar++; +//// this.clsParam++; +//// modTest.modVar++; +//// } +////} +//// +////function foo(x: number) { +//// //Declare +//// var fnVar = 1; +//// +//// //Increments +//// fooCls.clsSVar++; +//// globalVar++; +//// modTest.modVar++; +//// fnVar++; +//// +//// //Return +//// return x++; +////} +//// +////module modTest { +//// //Declare +//// export var modVar:number; +//// +//// //Increments +//// globalVar++; +//// fooCls.clsSVar++; +//// modVar++; +//// +//// class testCls { +//// static boo = foo; +//// } +//// +//// function testFn(){ +//// static boo = foo; +//// +//// //Increments +//// globalVar++; +//// fooCls.clsSVar++; +//// modVar++; +//// } +//// +//// module testMod { +//// var boo = foo; +//// } +////} +//// +//////Type test +////var clsTest: fooCls; +//// +//////Arguments +////clsTest = new fooCls(globalVar); +////foo(globalVar); +//// +//////Increments +////fooCls.clsSVar++; +////modTest.modVar++; +////globalVar = globalVar + globalVar; +//// +//////ETC - Other cases +////globalVar = 3; +////foo = foo + 1; +////err = err++; +//// +//////Shadowed fn Parameter +////function shdw(globalVar: number) { +//// //Increments +//// globalVar++; +//// return globalVar; +////} +//// +//////Remotes +//////Type test +////var remoteclsTest: rem/*2*/otefooCls; +//// +//////Arguments +////remoteclsTest = new remotefooCls(remoteglo/*4*/balVar); +////remotefoo(remotegl/*3*/obalVar); +//// +//////Increments +////remotefooCls.remoteclsSVar++; +////remotemodTest.remotemodVar++; +/////*1*/remoteglobalVar = remoteglobalVar + remoteglobalVar; +//// +//////ETC - Other cases +////remoteglobalVar = 3; +//// +//////Find References misses method param +////var +//// +//// +//// +//// array = ["f", "o", "o"]; +//// +////array.forEach( +//// +//// +////function(str) { +//// +//// +//// +//// return str + " "; +//// +////}); + +// @Filename: remoteGetReferences_2.ts +////var remoteglobalVar: number = 2; +//// +////class remotefooCls { +//// //Declare +//// rem/*5*/oteclsVar = 1; +//// static r/*6*/emoteclsSVar = 1; +//// +//// constructor(public remoteclsParam: number) { +//// //Increments +//// remoteglobalVar++; +//// this.remoteclsVar++; +//// remotefooCls.remoteclsSVar++; +//// this.remoteclsParam++; +//// remotemodTest.remotemodVar++; +//// } +////} +//// +////function remotefoo(remotex: number) { +//// //Declare +//// var remotefnVar = 1; +//// +//// //Increments +//// remotefooCls.remoteclsSVar++; +//// remoteglobalVar++; +//// remotemodTest.remotemodVar++; +//// remotefnVar++; +//// +//// //Return +//// return remotex++; +////} +//// +////module remotemodTest { +//// //Declare +//// export var remotemodVar: number; +//// +//// //Increments +//// remoteglobalVar++; +//// remotefooCls.remoteclsSVar++; +//// remotemodVar++; +//// +//// class remotetestCls { +//// static remoteboo = remotefoo; +//// } +//// +//// function remotetestFn(){ +//// static remoteboo = remotefoo; +//// +//// //Increments +//// remoteglobalVar++; +//// remotefooCls.remoteclsSVar++; +//// remotemodVar++; +//// } +//// +//// module remotetestMod { +//// var remoteboo = remotefoo; +//// } +////} + +// References to a variable declared in global. +goTo.marker("1"); +verify.referencesCountIs(11); + +// References to a type. +goTo.marker("2"); +verify.referencesCountIs(8); + +// References to a function argument. +goTo.marker("3"); +verify.referencesCountIs(11); + +// References to a class argument. +goTo.marker("4"); +verify.referencesCountIs(11); + +// References to a variable declared in a class. +goTo.marker("5"); +verify.referencesCountIs(2); + +// References to static variable declared in a class. +goTo.marker("6"); verify.referencesCountIs(6); \ No newline at end of file diff --git a/tests/cases/fourslash/removeDeclareParamTypeAnnotation.ts b/tests/cases/fourslash/removeDeclareParamTypeAnnotation.ts index c78c681e51..ec04d1f362 100644 --- a/tests/cases/fourslash/removeDeclareParamTypeAnnotation.ts +++ b/tests/cases/fourslash/removeDeclareParamTypeAnnotation.ts @@ -1,8 +1,8 @@ -/// - -//// declare class T { } -//// declare function parseInt(/**/s:T):T; -//// parseInt('2'); - -goTo.marker(); -edit.deleteAtCaret('s:T'.length); +/// + +//// declare class T { } +//// declare function parseInt(/**/s:T):T; +//// parseInt('2'); + +goTo.marker(); +edit.deleteAtCaret('s:T'.length); diff --git a/tests/cases/fourslash/removeExportFromInterfaceError0.ts b/tests/cases/fourslash/removeExportFromInterfaceError0.ts index f10180d53b..103f51ff41 100644 --- a/tests/cases/fourslash/removeExportFromInterfaceError0.ts +++ b/tests/cases/fourslash/removeExportFromInterfaceError0.ts @@ -1,15 +1,15 @@ -/// - -//// module M { -//// export class C1 { } -//// /*1*/export interface I { n: number; } -//// } -//// module M { -//// function f(): I { return null; } } -//// - -edit.disableFormatting(); - -goTo.marker("1"); - -edit.deleteAtCaret(6); +/// + +//// module M { +//// export class C1 { } +//// /*1*/export interface I { n: number; } +//// } +//// module M { +//// function f(): I { return null; } } +//// + +edit.disableFormatting(); + +goTo.marker("1"); + +edit.deleteAtCaret(6); diff --git a/tests/cases/fourslash/removeExportFromInterfaceError1.ts b/tests/cases/fourslash/removeExportFromInterfaceError1.ts index f10180d53b..103f51ff41 100644 --- a/tests/cases/fourslash/removeExportFromInterfaceError1.ts +++ b/tests/cases/fourslash/removeExportFromInterfaceError1.ts @@ -1,15 +1,15 @@ -/// - -//// module M { -//// export class C1 { } -//// /*1*/export interface I { n: number; } -//// } -//// module M { -//// function f(): I { return null; } } -//// - -edit.disableFormatting(); - -goTo.marker("1"); - -edit.deleteAtCaret(6); +/// + +//// module M { +//// export class C1 { } +//// /*1*/export interface I { n: number; } +//// } +//// module M { +//// function f(): I { return null; } } +//// + +edit.disableFormatting(); + +goTo.marker("1"); + +edit.deleteAtCaret(6); diff --git a/tests/cases/fourslash/removeExportedClassFromReopenedModule.ts b/tests/cases/fourslash/removeExportedClassFromReopenedModule.ts index 3d5ce9cb55..701a19074f 100644 --- a/tests/cases/fourslash/removeExportedClassFromReopenedModule.ts +++ b/tests/cases/fourslash/removeExportedClassFromReopenedModule.ts @@ -1,16 +1,16 @@ -/// - -//// module multiM { } -//// -//// module multiM { -//// /*1*/export class c { } -//// } -//// - -goTo.marker('1'); -edit.deleteAtCaret('export class c { }'.length); - -goTo.eof(); - -edit.insert("new multiM.c();"); -verify.numberOfErrorsInCurrentFile(1); +/// + +//// module multiM { } +//// +//// module multiM { +//// /*1*/export class c { } +//// } +//// + +goTo.marker('1'); +edit.deleteAtCaret('export class c { }'.length); + +goTo.eof(); + +edit.insert("new multiM.c();"); +verify.numberOfErrorsInCurrentFile(1); diff --git a/tests/cases/fourslash/removeInterfaceUsedAsGenericTypeArgument.ts b/tests/cases/fourslash/removeInterfaceUsedAsGenericTypeArgument.ts index 200f21fa78..86d25e167c 100644 --- a/tests/cases/fourslash/removeInterfaceUsedAsGenericTypeArgument.ts +++ b/tests/cases/fourslash/removeInterfaceUsedAsGenericTypeArgument.ts @@ -1,8 +1,8 @@ -/// - -//// /**/interface A { a: string; } -//// interface G { } -//// var v1: G; - -goTo.marker(); -edit.deleteAtCaret('interface A { a: string; }'.length); +/// + +//// /**/interface A { a: string; } +//// interface G { } +//// var v1: G; + +goTo.marker(); +edit.deleteAtCaret('interface A { a: string; }'.length); diff --git a/tests/cases/fourslash/removeParameterBetweenCommentAndParameter.ts b/tests/cases/fourslash/removeParameterBetweenCommentAndParameter.ts index d145e16feb..29de69b8ef 100644 --- a/tests/cases/fourslash/removeParameterBetweenCommentAndParameter.ts +++ b/tests/cases/fourslash/removeParameterBetweenCommentAndParameter.ts @@ -1,6 +1,6 @@ -/// - -//// function fn(/* comment! */ /**/a: number, c) { } - -goTo.marker(); -edit.deleteAtCaret('a: number,'.length); +/// + +//// function fn(/* comment! */ /**/a: number, c) { } + +goTo.marker(); +edit.deleteAtCaret('a: number,'.length); diff --git a/tests/cases/fourslash/removeVarFromModuleWithReopenedEnums.ts b/tests/cases/fourslash/removeVarFromModuleWithReopenedEnums.ts index b25cbfde3a..ef0012a62e 100644 --- a/tests/cases/fourslash/removeVarFromModuleWithReopenedEnums.ts +++ b/tests/cases/fourslash/removeVarFromModuleWithReopenedEnums.ts @@ -1,16 +1,16 @@ -/// - -//// module A { -//// /**/var o; -//// } -//// enum A { -//// } -//// enum A { -//// } -//// module A { -//// var p; -//// } - -goTo.marker(); -edit.deleteAtCaret('var o;'.length); - +/// + +//// module A { +//// /**/var o; +//// } +//// enum A { +//// } +//// enum A { +//// } +//// module A { +//// var p; +//// } + +goTo.marker(); +edit.deleteAtCaret('var o;'.length); + diff --git a/tests/cases/fourslash/renameCommentsAndStrings1.ts b/tests/cases/fourslash/renameCommentsAndStrings1.ts index b5c8ac6aac..b7a1f5d61a 100644 --- a/tests/cases/fourslash/renameCommentsAndStrings1.ts +++ b/tests/cases/fourslash/renameCommentsAndStrings1.ts @@ -1,5 +1,5 @@ -/// - +/// + /////// ////function /**/[|Bar|]() { diff --git a/tests/cases/fourslash/scriptLexicalStructureEmptyConstructors.ts b/tests/cases/fourslash/scriptLexicalStructureEmptyConstructors.ts index 27bae4ab6b..570b2f7518 100644 --- a/tests/cases/fourslash/scriptLexicalStructureEmptyConstructors.ts +++ b/tests/cases/fourslash/scriptLexicalStructureEmptyConstructors.ts @@ -1,12 +1,12 @@ -/// - -////class Test { -//// constructor() { -//// } -////} - -verify.getScriptLexicalStructureListContains("Test", "class"); -verify.getScriptLexicalStructureListContains("constructor", "constructor"); - -// no other items +/// + +////class Test { +//// constructor() { +//// } +////} + +verify.getScriptLexicalStructureListContains("Test", "class"); +verify.getScriptLexicalStructureListContains("constructor", "constructor"); + +// no other items verify.getScriptLexicalStructureListCount(2); \ No newline at end of file diff --git a/tests/cases/fourslash/scriptLexicalStructureExports.ts b/tests/cases/fourslash/scriptLexicalStructureExports.ts index f2a4adfa0d..d9db125b9b 100644 --- a/tests/cases/fourslash/scriptLexicalStructureExports.ts +++ b/tests/cases/fourslash/scriptLexicalStructureExports.ts @@ -1,18 +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); +/// + + +////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 index 9d9e3e8b46..8b0d02bd9f 100644 --- a/tests/cases/fourslash/scriptLexicalStructureImports.ts +++ b/tests/cases/fourslash/scriptLexicalStructureImports.ts @@ -1,25 +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); +/// + + +////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); diff --git a/tests/cases/fourslash/scriptLexicalStructureItems.ts b/tests/cases/fourslash/scriptLexicalStructureItems.ts index e18f49c1db..67e14fe100 100644 --- a/tests/cases/fourslash/scriptLexicalStructureItems.ts +++ b/tests/cases/fourslash/scriptLexicalStructureItems.ts @@ -1,52 +1,52 @@ -/// - -////// Interface -////{| "itemName": "IPoint", "kind": "interface", "parentName": "" |}interface IPoint { -//// {| "itemName": "getDist", "kind": "method", "parentName": "IPoint" |}getDist(): number; -//// {| "itemName": "new()", "kind": "construct", "parentName": "IPoint" |}new(): IPoint; -//// {| "itemName": "()", "kind": "call", "parentName": "IPoint" |}(): any; -//// {| "itemName": "[]", "kind": "index", "parentName": "IPoint" |}[x:string]: number; -//// {| "itemName": "prop", "kind": "property", "parentName": "IPoint" |}prop: string; -////} -//// -/////// Module -////{| "itemName": "Shapes", "kind": "module", "parentName": "" |}module Shapes { -//// -//// // Class -//// {| "itemName": "Point", "kind": "class", "parentName": "Shapes" |}export class Point implements IPoint { -//// {| "itemName": "constructor", "kind": "constructor", "parentName": "Shapes.Point" |}constructor (public x: number, public y: number) { } -//// -//// // Instance member -//// {| "itemName": "getDist", "kind": "method", "parentName": "Shapes.Point" |}getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); } -//// -//// // Getter -//// {| "itemName": "value", "kind": "getter", "parentName": "Shapes.Point" |}get value(): number { return 0; } -//// -//// // Setter -//// {| "itemName": "value", "kind": "setter", "parentName": "Shapes.Point" |}set value(newValue: number) { return; } -//// -//// // Static member -//// {| "itemName": "origin", "kind": "property", "parentName": "Shapes.Point" |}static origin = new Point(0, 0); -//// -//// // Static method -//// {| "itemName": "getOrigin", "kind": "method", "parentName": "Shapes.Point" |}private static getOrigin() { return Point.origin;} -//// } -//// -//// {| "itemName": "Values", "kind": "enum", "parentName": "Shapes" |}enum Values { -//// value1, -//// {| "itemName": "value2", "kind": "property", "parentName": "Shapes.Values" |}value2, -//// value3, -//// } -////} -//// -////// Local variables -////{| "itemName": "p", "kind": "var", "parentName": "" |}var p: IPoint = new Shapes.Point(3, 4); -////{| "itemName": "dist", "kind": "var", "parentName": "" |}var dist = p.getDist(); - -test.markers().forEach((marker) => { - if (marker.data) { - verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); - } -}); - -verify.getScriptLexicalStructureListCount(23); +/// + +////// Interface +////{| "itemName": "IPoint", "kind": "interface", "parentName": "" |}interface IPoint { +//// {| "itemName": "getDist", "kind": "method", "parentName": "IPoint" |}getDist(): number; +//// {| "itemName": "new()", "kind": "construct", "parentName": "IPoint" |}new(): IPoint; +//// {| "itemName": "()", "kind": "call", "parentName": "IPoint" |}(): any; +//// {| "itemName": "[]", "kind": "index", "parentName": "IPoint" |}[x:string]: number; +//// {| "itemName": "prop", "kind": "property", "parentName": "IPoint" |}prop: string; +////} +//// +/////// Module +////{| "itemName": "Shapes", "kind": "module", "parentName": "" |}module Shapes { +//// +//// // Class +//// {| "itemName": "Point", "kind": "class", "parentName": "Shapes" |}export class Point implements IPoint { +//// {| "itemName": "constructor", "kind": "constructor", "parentName": "Shapes.Point" |}constructor (public x: number, public y: number) { } +//// +//// // Instance member +//// {| "itemName": "getDist", "kind": "method", "parentName": "Shapes.Point" |}getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); } +//// +//// // Getter +//// {| "itemName": "value", "kind": "getter", "parentName": "Shapes.Point" |}get value(): number { return 0; } +//// +//// // Setter +//// {| "itemName": "value", "kind": "setter", "parentName": "Shapes.Point" |}set value(newValue: number) { return; } +//// +//// // Static member +//// {| "itemName": "origin", "kind": "property", "parentName": "Shapes.Point" |}static origin = new Point(0, 0); +//// +//// // Static method +//// {| "itemName": "getOrigin", "kind": "method", "parentName": "Shapes.Point" |}private static getOrigin() { return Point.origin;} +//// } +//// +//// {| "itemName": "Values", "kind": "enum", "parentName": "Shapes" |}enum Values { +//// value1, +//// {| "itemName": "value2", "kind": "property", "parentName": "Shapes.Values" |}value2, +//// value3, +//// } +////} +//// +////// Local variables +////{| "itemName": "p", "kind": "var", "parentName": "" |}var p: IPoint = new Shapes.Point(3, 4); +////{| "itemName": "dist", "kind": "var", "parentName": "" |}var dist = p.getDist(); + +test.markers().forEach((marker) => { + if (marker.data) { + verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); + } +}); + +verify.getScriptLexicalStructureListCount(23); diff --git a/tests/cases/fourslash/scriptLexicalStructureItems2.ts b/tests/cases/fourslash/scriptLexicalStructureItems2.ts index 092527ec93..7022c082ce 100644 --- a/tests/cases/fourslash/scriptLexicalStructureItems2.ts +++ b/tests/cases/fourslash/scriptLexicalStructureItems2.ts @@ -1,12 +1,12 @@ -/// - - -/////**/ - -goTo.marker(); -edit.insertLine("module A"); -edit.insert("export class "); - -// should not crash -verify.getScriptLexicalStructureListCount(1); - +/// + + +/////**/ + +goTo.marker(); +edit.insertLine("module A"); +edit.insert("export class "); + +// should not crash +verify.getScriptLexicalStructureListCount(1); + diff --git a/tests/cases/fourslash/scriptLexicalStructureItemsContainsNoAnonymousFunctions.ts b/tests/cases/fourslash/scriptLexicalStructureItemsContainsNoAnonymousFunctions.ts index a408645017..b7430ad03d 100644 --- a/tests/cases/fourslash/scriptLexicalStructureItemsContainsNoAnonymousFunctions.ts +++ b/tests/cases/fourslash/scriptLexicalStructureItemsContainsNoAnonymousFunctions.ts @@ -1,44 +1,44 @@ -/// -// @Filename: scriptLexicalStructureItemsContainsNoAnonymouseFunctions_0.ts -/////*file1*/ -////(function() { -//// // this should not be included -//// var x = 0; -//// -//// // this should not be included either -//// function foo() { -//// -//// } -////})(); -//// -// @Filename: scriptLexicalStructureItemsContainsNoAnonymouseFunctions_1.ts -/////*file2*/ -////var x = function() { -//// // this should not be included -//// var x = 0; -//// -//// // this should not be included either -//// function foo() { -////}; -//// -// @Filename: scriptLexicalStructureItemsContainsNoAnonymouseFunctions_2.ts -////// Named functions should still show up -/////*file3*/ -////function foo() { -////} -////function bar() { -////} - -goTo.marker("file1"); -verify.getScriptLexicalStructureListCount(0); - -goTo.marker("file2"); -verify.getScriptLexicalStructureListContains("", "module"); -verify.getScriptLexicalStructureListContains("x", "var"); -verify.getScriptLexicalStructureListCount(2); - -goTo.marker("file3"); -verify.getScriptLexicalStructureListContains("", "module"); -verify.getScriptLexicalStructureListContains("foo", "function"); -verify.getScriptLexicalStructureListContains("bar", "function"); +/// +// @Filename: scriptLexicalStructureItemsContainsNoAnonymouseFunctions_0.ts +/////*file1*/ +////(function() { +//// // this should not be included +//// var x = 0; +//// +//// // this should not be included either +//// function foo() { +//// +//// } +////})(); +//// +// @Filename: scriptLexicalStructureItemsContainsNoAnonymouseFunctions_1.ts +/////*file2*/ +////var x = function() { +//// // this should not be included +//// var x = 0; +//// +//// // this should not be included either +//// function foo() { +////}; +//// +// @Filename: scriptLexicalStructureItemsContainsNoAnonymouseFunctions_2.ts +////// Named functions should still show up +/////*file3*/ +////function foo() { +////} +////function bar() { +////} + +goTo.marker("file1"); +verify.getScriptLexicalStructureListCount(0); + +goTo.marker("file2"); +verify.getScriptLexicalStructureListContains("", "module"); +verify.getScriptLexicalStructureListContains("x", "var"); +verify.getScriptLexicalStructureListCount(2); + +goTo.marker("file3"); +verify.getScriptLexicalStructureListContains("", "module"); +verify.getScriptLexicalStructureListContains("foo", "function"); +verify.getScriptLexicalStructureListContains("bar", "function"); verify.getScriptLexicalStructureListCount(5); \ No newline at end of file diff --git a/tests/cases/fourslash/scriptLexicalStructureMissingName1.ts b/tests/cases/fourslash/scriptLexicalStructureMissingName1.ts index 60d858b608..c5282d696f 100644 --- a/tests/cases/fourslash/scriptLexicalStructureMissingName1.ts +++ b/tests/cases/fourslash/scriptLexicalStructureMissingName1.ts @@ -1,4 +1,4 @@ -////export function +////export function /////** //// * This is a class. //// */ diff --git a/tests/cases/fourslash/scriptLexicalStructureMissingName2.ts b/tests/cases/fourslash/scriptLexicalStructureMissingName2.ts index 0ee0d1197b..b805427ff6 100644 --- a/tests/cases/fourslash/scriptLexicalStructureMissingName2.ts +++ b/tests/cases/fourslash/scriptLexicalStructureMissingName2.ts @@ -1,4 +1,4 @@ -/////** +/////** //// * This is a class. //// */ ////class /* But it has no name! */ { diff --git a/tests/cases/fourslash/scriptLexicalStructureModules.ts b/tests/cases/fourslash/scriptLexicalStructureModules.ts index ee0f91cc73..a5fc9b641f 100644 --- a/tests/cases/fourslash/scriptLexicalStructureModules.ts +++ b/tests/cases/fourslash/scriptLexicalStructureModules.ts @@ -1,4 +1,4 @@ - + ////{| "itemName": "\"X.Y.Z\"", "kind": "module" |} ////declare module "X.Y.Z" { ////} diff --git a/tests/cases/fourslash/scriptLexicalStructureMultilineStringIdentifiers.ts b/tests/cases/fourslash/scriptLexicalStructureMultilineStringIdentifiers.ts index 796a4caa2d..59eca486b6 100644 --- a/tests/cases/fourslash/scriptLexicalStructureMultilineStringIdentifiers.ts +++ b/tests/cases/fourslash/scriptLexicalStructureMultilineStringIdentifiers.ts @@ -1,4 +1,4 @@ - + ////{| "itemName": "\"Multiline\\r\\nMadness\"", "kind": "module" |} ////declare module "Multiline\r\nMadness" { ////} diff --git a/tests/cases/fourslash/scriptLexicalStructurePropertiesDefinedInConstructors.ts b/tests/cases/fourslash/scriptLexicalStructurePropertiesDefinedInConstructors.ts index e73db067bf..adda43066a 100644 --- a/tests/cases/fourslash/scriptLexicalStructurePropertiesDefinedInConstructors.ts +++ b/tests/cases/fourslash/scriptLexicalStructurePropertiesDefinedInConstructors.ts @@ -1,15 +1,15 @@ -/// - -////class List { -//// constructor(public a: boolean, public b: T, c: number) { -//// var local = 0; -//// } -////} - -verify.getScriptLexicalStructureListContains("List", "class"); -verify.getScriptLexicalStructureListContains("constructor", "constructor"); -verify.getScriptLexicalStructureListContains("a", "property"); -verify.getScriptLexicalStructureListContains("b", "property"); - -// no other items +/// + +////class List { +//// constructor(public a: boolean, public b: T, c: number) { +//// var local = 0; +//// } +////} + +verify.getScriptLexicalStructureListContains("List", "class"); +verify.getScriptLexicalStructureListContains("constructor", "constructor"); +verify.getScriptLexicalStructureListContains("a", "property"); +verify.getScriptLexicalStructureListContains("b", "property"); + +// no other items verify.getScriptLexicalStructureListCount(4); \ No newline at end of file diff --git a/tests/cases/fourslash/semanticClassificationInTemplateExpressions.ts b/tests/cases/fourslash/semanticClassificationInTemplateExpressions.ts index 19f6d1062c..7ac8bec282 100644 --- a/tests/cases/fourslash/semanticClassificationInTemplateExpressions.ts +++ b/tests/cases/fourslash/semanticClassificationInTemplateExpressions.ts @@ -1,4 +1,4 @@ -/// +/// ////module /*0*/M { //// export class /*1*/C { diff --git a/tests/cases/fourslash/semanticClassificationInstantiatedModuleWithVariableOfSameName1.ts b/tests/cases/fourslash/semanticClassificationInstantiatedModuleWithVariableOfSameName1.ts index 2b8b682455..2061c218ea 100644 --- a/tests/cases/fourslash/semanticClassificationInstantiatedModuleWithVariableOfSameName1.ts +++ b/tests/cases/fourslash/semanticClassificationInstantiatedModuleWithVariableOfSameName1.ts @@ -1,4 +1,4 @@ -/// +/// ////module /*0*/M { //// export interface /*1*/I { diff --git a/tests/cases/fourslash/semanticClassificationInstantiatedModuleWithVariableOfSameName2.ts b/tests/cases/fourslash/semanticClassificationInstantiatedModuleWithVariableOfSameName2.ts index 5d2ed9844c..f1f4fa8e67 100644 --- a/tests/cases/fourslash/semanticClassificationInstantiatedModuleWithVariableOfSameName2.ts +++ b/tests/cases/fourslash/semanticClassificationInstantiatedModuleWithVariableOfSameName2.ts @@ -1,4 +1,4 @@ -/// +/// ////module /*0*/M { //// export interface /*1*/I { diff --git a/tests/cases/fourslash/semanticClassificationModules.ts b/tests/cases/fourslash/semanticClassificationModules.ts index 86c2819983..6992639e4c 100644 --- a/tests/cases/fourslash/semanticClassificationModules.ts +++ b/tests/cases/fourslash/semanticClassificationModules.ts @@ -1,4 +1,4 @@ -/// +/// ////module /*0*/M { //// export var v; diff --git a/tests/cases/fourslash/semanticClassificationUninstantiatedModuleWithVariableOfSameName1.ts b/tests/cases/fourslash/semanticClassificationUninstantiatedModuleWithVariableOfSameName1.ts index e7486c2c0c..6c98c8340c 100644 --- a/tests/cases/fourslash/semanticClassificationUninstantiatedModuleWithVariableOfSameName1.ts +++ b/tests/cases/fourslash/semanticClassificationUninstantiatedModuleWithVariableOfSameName1.ts @@ -1,4 +1,4 @@ -/// +/// ////declare module /*0*/M { //// interface /*1*/I { diff --git a/tests/cases/fourslash/semanticClassificationUninstantiatedModuleWithVariableOfSameName2.ts b/tests/cases/fourslash/semanticClassificationUninstantiatedModuleWithVariableOfSameName2.ts index f90efd7518..419692b98c 100644 --- a/tests/cases/fourslash/semanticClassificationUninstantiatedModuleWithVariableOfSameName2.ts +++ b/tests/cases/fourslash/semanticClassificationUninstantiatedModuleWithVariableOfSameName2.ts @@ -1,4 +1,4 @@ -/// +/// ////module /*0*/M { //// export interface /*1*/I { diff --git a/tests/cases/fourslash/semanticClassificationWithUnionTypes.ts b/tests/cases/fourslash/semanticClassificationWithUnionTypes.ts index 40a7f40968..bc55c5d825 100644 --- a/tests/cases/fourslash/semanticClassificationWithUnionTypes.ts +++ b/tests/cases/fourslash/semanticClassificationWithUnionTypes.ts @@ -1,4 +1,4 @@ -////module /*0*/M { +////module /*0*/M { //// export interface /*1*/I { //// } ////} diff --git a/tests/cases/fourslash/server/definition.ts b/tests/cases/fourslash/server/definition.ts index 531e456284..f403965fe1 100644 --- a/tests/cases/fourslash/server/definition.ts +++ b/tests/cases/fourslash/server/definition.ts @@ -1,4 +1,4 @@ -/// +/// // @Filename: b.ts ////import n = require('a/*1*/'); diff --git a/tests/cases/fourslash/server/navbar.ts b/tests/cases/fourslash/server/navbar.ts index e18f49c1db..67e14fe100 100644 --- a/tests/cases/fourslash/server/navbar.ts +++ b/tests/cases/fourslash/server/navbar.ts @@ -1,52 +1,52 @@ -/// - -////// Interface -////{| "itemName": "IPoint", "kind": "interface", "parentName": "" |}interface IPoint { -//// {| "itemName": "getDist", "kind": "method", "parentName": "IPoint" |}getDist(): number; -//// {| "itemName": "new()", "kind": "construct", "parentName": "IPoint" |}new(): IPoint; -//// {| "itemName": "()", "kind": "call", "parentName": "IPoint" |}(): any; -//// {| "itemName": "[]", "kind": "index", "parentName": "IPoint" |}[x:string]: number; -//// {| "itemName": "prop", "kind": "property", "parentName": "IPoint" |}prop: string; -////} -//// -/////// Module -////{| "itemName": "Shapes", "kind": "module", "parentName": "" |}module Shapes { -//// -//// // Class -//// {| "itemName": "Point", "kind": "class", "parentName": "Shapes" |}export class Point implements IPoint { -//// {| "itemName": "constructor", "kind": "constructor", "parentName": "Shapes.Point" |}constructor (public x: number, public y: number) { } -//// -//// // Instance member -//// {| "itemName": "getDist", "kind": "method", "parentName": "Shapes.Point" |}getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); } -//// -//// // Getter -//// {| "itemName": "value", "kind": "getter", "parentName": "Shapes.Point" |}get value(): number { return 0; } -//// -//// // Setter -//// {| "itemName": "value", "kind": "setter", "parentName": "Shapes.Point" |}set value(newValue: number) { return; } -//// -//// // Static member -//// {| "itemName": "origin", "kind": "property", "parentName": "Shapes.Point" |}static origin = new Point(0, 0); -//// -//// // Static method -//// {| "itemName": "getOrigin", "kind": "method", "parentName": "Shapes.Point" |}private static getOrigin() { return Point.origin;} -//// } -//// -//// {| "itemName": "Values", "kind": "enum", "parentName": "Shapes" |}enum Values { -//// value1, -//// {| "itemName": "value2", "kind": "property", "parentName": "Shapes.Values" |}value2, -//// value3, -//// } -////} -//// -////// Local variables -////{| "itemName": "p", "kind": "var", "parentName": "" |}var p: IPoint = new Shapes.Point(3, 4); -////{| "itemName": "dist", "kind": "var", "parentName": "" |}var dist = p.getDist(); - -test.markers().forEach((marker) => { - if (marker.data) { - verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); - } -}); - -verify.getScriptLexicalStructureListCount(23); +/// + +////// Interface +////{| "itemName": "IPoint", "kind": "interface", "parentName": "" |}interface IPoint { +//// {| "itemName": "getDist", "kind": "method", "parentName": "IPoint" |}getDist(): number; +//// {| "itemName": "new()", "kind": "construct", "parentName": "IPoint" |}new(): IPoint; +//// {| "itemName": "()", "kind": "call", "parentName": "IPoint" |}(): any; +//// {| "itemName": "[]", "kind": "index", "parentName": "IPoint" |}[x:string]: number; +//// {| "itemName": "prop", "kind": "property", "parentName": "IPoint" |}prop: string; +////} +//// +/////// Module +////{| "itemName": "Shapes", "kind": "module", "parentName": "" |}module Shapes { +//// +//// // Class +//// {| "itemName": "Point", "kind": "class", "parentName": "Shapes" |}export class Point implements IPoint { +//// {| "itemName": "constructor", "kind": "constructor", "parentName": "Shapes.Point" |}constructor (public x: number, public y: number) { } +//// +//// // Instance member +//// {| "itemName": "getDist", "kind": "method", "parentName": "Shapes.Point" |}getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); } +//// +//// // Getter +//// {| "itemName": "value", "kind": "getter", "parentName": "Shapes.Point" |}get value(): number { return 0; } +//// +//// // Setter +//// {| "itemName": "value", "kind": "setter", "parentName": "Shapes.Point" |}set value(newValue: number) { return; } +//// +//// // Static member +//// {| "itemName": "origin", "kind": "property", "parentName": "Shapes.Point" |}static origin = new Point(0, 0); +//// +//// // Static method +//// {| "itemName": "getOrigin", "kind": "method", "parentName": "Shapes.Point" |}private static getOrigin() { return Point.origin;} +//// } +//// +//// {| "itemName": "Values", "kind": "enum", "parentName": "Shapes" |}enum Values { +//// value1, +//// {| "itemName": "value2", "kind": "property", "parentName": "Shapes.Values" |}value2, +//// value3, +//// } +////} +//// +////// Local variables +////{| "itemName": "p", "kind": "var", "parentName": "" |}var p: IPoint = new Shapes.Point(3, 4); +////{| "itemName": "dist", "kind": "var", "parentName": "" |}var dist = p.getDist(); + +test.markers().forEach((marker) => { + if (marker.data) { + verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); + } +}); + +verify.getScriptLexicalStructureListCount(23); diff --git a/tests/cases/fourslash/server/navto.ts b/tests/cases/fourslash/server/navto.ts index 0179c16855..ba907e985f 100644 --- a/tests/cases/fourslash/server/navto.ts +++ b/tests/cases/fourslash/server/navto.ts @@ -1,28 +1,28 @@ -/// - -/////// Module -////{| "itemName": "MyShapes", "kind": "module", "parentName": "", "matchKind": "substring" |}module MyShapes { -//// -//// // Class -//// {| "itemName": "MyPoint", "kind": "class", "parentName": "MyShapes", "matchKind": "substring" |}export class MyPoint { -//// // Instance member -//// {| "itemName": "MyoriginPointAttheHorizon", "kind": "property", "parentName": "MyPoint", "matchKind": "substring"|}private MyoriginPointAttheHorizon = 0.0; -//// -//// // Getter -//// {| "itemName": "MydistanceFromOrigin", "kind": "getter", "parentName": "MyPoint", "matchKind": "substring" |}get MydistanceFromOrigin(): number { return 0; } -//// -//// } -////} -//// -////// Local variables -////{| "itemName": "myPointThatIJustInitiated", "kind": "var", "parentName": "", "matchKind": "substring"|}var myPointThatIJustInitiated = new Shapes.Point(); - -//// Testing for substring matching of navigationItems -//var searchValue = "FromOrigin horizon INITIATED Shape Point"; - -test.markers().forEach((marker) => { - if (marker.data) { - var name = marker.data.itemName; - verify.navigationItemsListContains(name, marker.data.kind, name.substr(2), marker.data.matchKind, marker.fileName, marker.data.parentName); - } +/// + +/////// Module +////{| "itemName": "MyShapes", "kind": "module", "parentName": "", "matchKind": "substring" |}module MyShapes { +//// +//// // Class +//// {| "itemName": "MyPoint", "kind": "class", "parentName": "MyShapes", "matchKind": "substring" |}export class MyPoint { +//// // Instance member +//// {| "itemName": "MyoriginPointAttheHorizon", "kind": "property", "parentName": "MyPoint", "matchKind": "substring"|}private MyoriginPointAttheHorizon = 0.0; +//// +//// // Getter +//// {| "itemName": "MydistanceFromOrigin", "kind": "getter", "parentName": "MyPoint", "matchKind": "substring" |}get MydistanceFromOrigin(): number { return 0; } +//// +//// } +////} +//// +////// Local variables +////{| "itemName": "myPointThatIJustInitiated", "kind": "var", "parentName": "", "matchKind": "substring"|}var myPointThatIJustInitiated = new Shapes.Point(); + +//// Testing for substring matching of navigationItems +//var searchValue = "FromOrigin horizon INITIATED Shape Point"; + +test.markers().forEach((marker) => { + if (marker.data) { + var name = marker.data.itemName; + verify.navigationItemsListContains(name, marker.data.kind, name.substr(2), marker.data.matchKind, marker.fileName, marker.data.parentName); + } }); \ No newline at end of file diff --git a/tests/cases/fourslash/shims/getDefinitionAtPosition.ts b/tests/cases/fourslash/shims/getDefinitionAtPosition.ts index 54b799ba65..3aa31d1556 100644 --- a/tests/cases/fourslash/shims/getDefinitionAtPosition.ts +++ b/tests/cases/fourslash/shims/getDefinitionAtPosition.ts @@ -1,29 +1,29 @@ -/// - -// @Filename: goToDefinitionDifferentFile_Definition.ts -////var /*remoteVariableDefinition*/remoteVariable; -/////*remoteFunctionDefinition*/function remoteFunction() { } -/////*remoteClassDefinition*/class remoteClass { } -/////*remoteInterfaceDefinition*/interface remoteInterface{ } -/////*remoteModuleDefinition*/module remoteModule{ export var foo = 1;} - -// @Filename: goToDefinitionDifferentFile_Consumption.ts -/////*remoteVariableReference*/remoteVariable = 1; -/////*remoteFunctionReference*/remoteFunction(); -////var foo = new /*remoteClassReference*/remoteClass(); -////class fooCls implements /*remoteInterfaceReference*/remoteInterface { } -////var fooVar = /*remoteModuleReference*/remoteModule.foo; - -var markerList = [ - "remoteVariable", - "remoteFunction", - "remoteClass", - "remoteInterface", - "remoteModule", -]; - -markerList.forEach((marker) => { - goTo.marker(marker + 'Reference'); - goTo.definition(); - verify.caretAtMarker(marker + 'Definition'); -}); +/// + +// @Filename: goToDefinitionDifferentFile_Definition.ts +////var /*remoteVariableDefinition*/remoteVariable; +/////*remoteFunctionDefinition*/function remoteFunction() { } +/////*remoteClassDefinition*/class remoteClass { } +/////*remoteInterfaceDefinition*/interface remoteInterface{ } +/////*remoteModuleDefinition*/module remoteModule{ export var foo = 1;} + +// @Filename: goToDefinitionDifferentFile_Consumption.ts +/////*remoteVariableReference*/remoteVariable = 1; +/////*remoteFunctionReference*/remoteFunction(); +////var foo = new /*remoteClassReference*/remoteClass(); +////class fooCls implements /*remoteInterfaceReference*/remoteInterface { } +////var fooVar = /*remoteModuleReference*/remoteModule.foo; + +var markerList = [ + "remoteVariable", + "remoteFunction", + "remoteClass", + "remoteInterface", + "remoteModule", +]; + +markerList.forEach((marker) => { + goTo.marker(marker + 'Reference'); + goTo.definition(); + verify.caretAtMarker(marker + 'Definition'); +}); diff --git a/tests/cases/fourslash/shims/getEmitOutput.ts b/tests/cases/fourslash/shims/getEmitOutput.ts index 699514521e..7e86212d13 100644 --- a/tests/cases/fourslash/shims/getEmitOutput.ts +++ b/tests/cases/fourslash/shims/getEmitOutput.ts @@ -1,22 +1,22 @@ -/// - -// @BaselineFile: getEmitOutput.baseline -// @declaration: true - -// @Filename: inputFile1.ts -// @emitThisFile: true -//// var x: number = 5; -//// class Bar { -//// x : string; -//// y : number -//// } - -// @Filename: inputFile2.ts -// @emitThisFile: true -//// var x1: string = "hello world"; -//// class Foo{ -//// x : string; -//// y : number; -//// } - +/// + +// @BaselineFile: getEmitOutput.baseline +// @declaration: true + +// @Filename: inputFile1.ts +// @emitThisFile: true +//// var x: number = 5; +//// class Bar { +//// x : string; +//// y : number +//// } + +// @Filename: inputFile2.ts +// @emitThisFile: true +//// var x1: string = "hello world"; +//// class Foo{ +//// x : string; +//// y : number; +//// } + verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/shims/getIndentationAtPosition.ts b/tests/cases/fourslash/shims/getIndentationAtPosition.ts index 5e26781357..ba2936bd70 100644 --- a/tests/cases/fourslash/shims/getIndentationAtPosition.ts +++ b/tests/cases/fourslash/shims/getIndentationAtPosition.ts @@ -1,21 +1,21 @@ -/// - -////class Bar { -//// {| "indentation": 4|} -//// private foo: string = ""; -//// {| "indentation": 4|} -//// private f() { -//// var a: any[] = [[1, 2], [3, 4], 5]; -//// {| "indentation": 8|} -//// return ((1 + 1)); -//// } -//// {| "indentation": 4|} -//// private f2() { -//// if (true) { } { }; -//// } -////} +/// + +////class Bar { +//// {| "indentation": 4|} +//// private foo: string = ""; +//// {| "indentation": 4|} +//// private f() { +//// var a: any[] = [[1, 2], [3, 4], 5]; +//// {| "indentation": 8|} +//// return ((1 + 1)); +//// } +//// {| "indentation": 4|} +//// private f2() { +//// if (true) { } { }; +//// } +////} ////{| "indentation": 0|} test.markers().forEach((marker) => { - verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indentation); -}); + verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indentation); +}); diff --git a/tests/cases/fourslash/shims/getNavigateToItems.ts b/tests/cases/fourslash/shims/getNavigateToItems.ts index 9658c52324..5481f4295c 100644 --- a/tests/cases/fourslash/shims/getNavigateToItems.ts +++ b/tests/cases/fourslash/shims/getNavigateToItems.ts @@ -1,27 +1,27 @@ -/// - -/////// Module -////{| "itemName": "Shapes", "kind": "module", "parentName": "" |}module Shapes { -//// -//// // Class -//// {| "itemName": "Point", "kind": "class", "parentName": "Shapes" |}export class Point { -//// // Instance member -//// {| "itemName": "origin", "kind": "property", "parentName": "Point", "matchKind": "exact"|}private origin = 0.0; -//// -//// {| "itemName": "distFromZero", "kind": "property", "parentName": "Point", "matchKind": "exact"|}private distFromZero = 0.0; -//// -//// // Getter -//// {| "itemName": "distance", "kind": "getter", "parentName": "Point", "matchKind": "exact" |}get distance(): number { return 0; } -//// } -////} -//// -////// Local variables -////{| "itemName": "point", "kind": "var", "parentName": "", "matchKind": "exact"|}var point = new Shapes.Point(); - -//// Testing for exact matching of navigationItems - -test.markers().forEach((marker) => { - if (marker.data) { - verify.navigationItemsListContains(marker.data.itemName, marker.data.kind, marker.data.itemName, marker.data.matchKind, marker.fileName, marker.data.parentName); - } -}); +/// + +/////// Module +////{| "itemName": "Shapes", "kind": "module", "parentName": "" |}module Shapes { +//// +//// // Class +//// {| "itemName": "Point", "kind": "class", "parentName": "Shapes" |}export class Point { +//// // Instance member +//// {| "itemName": "origin", "kind": "property", "parentName": "Point", "matchKind": "exact"|}private origin = 0.0; +//// +//// {| "itemName": "distFromZero", "kind": "property", "parentName": "Point", "matchKind": "exact"|}private distFromZero = 0.0; +//// +//// // Getter +//// {| "itemName": "distance", "kind": "getter", "parentName": "Point", "matchKind": "exact" |}get distance(): number { return 0; } +//// } +////} +//// +////// Local variables +////{| "itemName": "point", "kind": "var", "parentName": "", "matchKind": "exact"|}var point = new Shapes.Point(); + +//// Testing for exact matching of navigationItems + +test.markers().forEach((marker) => { + if (marker.data) { + verify.navigationItemsListContains(marker.data.itemName, marker.data.kind, marker.data.itemName, marker.data.matchKind, marker.fileName, marker.data.parentName); + } +}); diff --git a/tests/cases/fourslash/shims/getRenameInfo.ts b/tests/cases/fourslash/shims/getRenameInfo.ts index b5c8ac6aac..b7a1f5d61a 100644 --- a/tests/cases/fourslash/shims/getRenameInfo.ts +++ b/tests/cases/fourslash/shims/getRenameInfo.ts @@ -1,5 +1,5 @@ -/// - +/// + /////// ////function /**/[|Bar|]() { diff --git a/tests/cases/fourslash/shims/getSemanticDiagnostics.ts b/tests/cases/fourslash/shims/getSemanticDiagnostics.ts index 6345c46421..804abbde33 100644 --- a/tests/cases/fourslash/shims/getSemanticDiagnostics.ts +++ b/tests/cases/fourslash/shims/getSemanticDiagnostics.ts @@ -1,11 +1,11 @@ -/// - -// @module: CommonJS -// @declaration: true -//// interface privateInterface {} -//// export class Bar implements /*1*/privateInterface/*2*/{ } - -verify.errorExistsBetweenMarkers("1", "2"); -verify.numberOfErrorsInCurrentFile(1); - - +/// + +// @module: CommonJS +// @declaration: true +//// interface privateInterface {} +//// export class Bar implements /*1*/privateInterface/*2*/{ } + +verify.errorExistsBetweenMarkers("1", "2"); +verify.numberOfErrorsInCurrentFile(1); + + diff --git a/tests/cases/fourslash/signatureHelpCallExpression.ts b/tests/cases/fourslash/signatureHelpCallExpression.ts index fd9758cfa5..61606b77bc 100644 --- a/tests/cases/fourslash/signatureHelpCallExpression.ts +++ b/tests/cases/fourslash/signatureHelpCallExpression.ts @@ -1,16 +1,16 @@ -/// - -////function fnTest(str: string, num: number) { } -////fnTest(/*1*/'', /*2*/5); - -goTo.marker('1'); -verify.signatureHelpCountIs(1); -verify.currentSignatureParameterCountIs(2); -verify.currentSignatureHelpIs('fnTest(str: string, num: number): void'); - -verify.currentParameterHelpArgumentNameIs('str'); -verify.currentParameterSpanIs("str: string"); - -goTo.marker('2'); -verify.currentParameterHelpArgumentNameIs('num'); -verify.currentParameterSpanIs("num: number"); +/// + +////function fnTest(str: string, num: number) { } +////fnTest(/*1*/'', /*2*/5); + +goTo.marker('1'); +verify.signatureHelpCountIs(1); +verify.currentSignatureParameterCountIs(2); +verify.currentSignatureHelpIs('fnTest(str: string, num: number): void'); + +verify.currentParameterHelpArgumentNameIs('str'); +verify.currentParameterSpanIs("str: string"); + +goTo.marker('2'); +verify.currentParameterHelpArgumentNameIs('num'); +verify.currentParameterSpanIs("num: number"); diff --git a/tests/cases/fourslash/signatureHelpConstructExpression.ts b/tests/cases/fourslash/signatureHelpConstructExpression.ts index 00efee0a47..a64c0123e6 100644 --- a/tests/cases/fourslash/signatureHelpConstructExpression.ts +++ b/tests/cases/fourslash/signatureHelpConstructExpression.ts @@ -1,17 +1,17 @@ -/// - -////class sampleCls { constructor(str: string, num: number) { } } -////var x = new sampleCls(/*1*/"", /*2*/5); - -goTo.marker('1'); -verify.signatureHelpCountIs(1); - -verify.currentSignatureParameterCountIs(2); -verify.currentSignatureHelpIs('sampleCls(str: string, num: number): sampleCls'); - -verify.currentParameterHelpArgumentNameIs('str'); -verify.currentParameterSpanIs("str: string"); - -goTo.marker('2'); -verify.currentParameterHelpArgumentNameIs('num'); -verify.currentParameterSpanIs("num: number"); +/// + +////class sampleCls { constructor(str: string, num: number) { } } +////var x = new sampleCls(/*1*/"", /*2*/5); + +goTo.marker('1'); +verify.signatureHelpCountIs(1); + +verify.currentSignatureParameterCountIs(2); +verify.currentSignatureHelpIs('sampleCls(str: string, num: number): sampleCls'); + +verify.currentParameterHelpArgumentNameIs('str'); +verify.currentParameterSpanIs("str: string"); + +goTo.marker('2'); +verify.currentParameterHelpArgumentNameIs('num'); +verify.currentParameterSpanIs("num: number"); diff --git a/tests/cases/fourslash/signatureHelpConstructorInheritance.ts b/tests/cases/fourslash/signatureHelpConstructorInheritance.ts index a2e683d69b..23f802f10b 100644 --- a/tests/cases/fourslash/signatureHelpConstructorInheritance.ts +++ b/tests/cases/fourslash/signatureHelpConstructorInheritance.ts @@ -1,22 +1,22 @@ -/// - -////class base { -//// constructor(s: string); -//// constructor(n: number); -//// constructor(a: any) { } -////} -////class B1 extends base { } -////class B2 extends B1 { } -////class B3 extends B2 { -//// constructor() { -//// super(/*indirectSuperCall*/3); -//// } -////} - - -goTo.marker('indirectSuperCall'); -verify.signatureHelpCountIs(2); -verify.currentSignatureParameterCountIs(1); -verify.currentSignatureHelpIs('B2(n: number): B2'); -verify.currentParameterHelpArgumentNameIs("n"); -verify.currentParameterSpanIs("n: number"); +/// + +////class base { +//// constructor(s: string); +//// constructor(n: number); +//// constructor(a: any) { } +////} +////class B1 extends base { } +////class B2 extends B1 { } +////class B3 extends B2 { +//// constructor() { +//// super(/*indirectSuperCall*/3); +//// } +////} + + +goTo.marker('indirectSuperCall'); +verify.signatureHelpCountIs(2); +verify.currentSignatureParameterCountIs(1); +verify.currentSignatureHelpIs('B2(n: number): B2'); +verify.currentParameterHelpArgumentNameIs("n"); +verify.currentParameterSpanIs("n: number"); diff --git a/tests/cases/fourslash/signatureHelpConstructorOverload.ts b/tests/cases/fourslash/signatureHelpConstructorOverload.ts index 9aab48f71a..b562d4f54c 100644 --- a/tests/cases/fourslash/signatureHelpConstructorOverload.ts +++ b/tests/cases/fourslash/signatureHelpConstructorOverload.ts @@ -1,16 +1,16 @@ -/// - -////class clsOverload { constructor(); constructor(test: string); constructor(test?: string) { } } -////var x = new clsOverload(/*1*/); -////var y = new clsOverload(/*2*/''); - -goTo.marker('1'); -verify.signatureHelpCountIs(2); -verify.currentSignatureParameterCountIs(0); -verify.currentSignatureHelpIs('clsOverload(): clsOverload'); - -goTo.marker('2'); -verify.currentSignatureParameterCountIs(1); -verify.currentSignatureHelpIs('clsOverload(test: string): clsOverload'); -verify.currentParameterHelpArgumentNameIs('test'); +/// + +////class clsOverload { constructor(); constructor(test: string); constructor(test?: string) { } } +////var x = new clsOverload(/*1*/); +////var y = new clsOverload(/*2*/''); + +goTo.marker('1'); +verify.signatureHelpCountIs(2); +verify.currentSignatureParameterCountIs(0); +verify.currentSignatureHelpIs('clsOverload(): clsOverload'); + +goTo.marker('2'); +verify.currentSignatureParameterCountIs(1); +verify.currentSignatureHelpIs('clsOverload(test: string): clsOverload'); +verify.currentParameterHelpArgumentNameIs('test'); verify.currentParameterSpanIs("test: string"); \ No newline at end of file diff --git a/tests/cases/fourslash/signatureHelpFunctionOverload.ts b/tests/cases/fourslash/signatureHelpFunctionOverload.ts index cc02ba1257..219e718f81 100644 --- a/tests/cases/fourslash/signatureHelpFunctionOverload.ts +++ b/tests/cases/fourslash/signatureHelpFunctionOverload.ts @@ -1,18 +1,18 @@ -/// - -////function functionOverload(); -////function functionOverload(test: string); -////function functionOverload(test?: string) { } -////functionOverload(/*functionOverload1*/); -////functionOverload(""/*functionOverload2*/); - -goTo.marker('functionOverload1'); -verify.signatureHelpCountIs(2); -verify.currentSignatureParameterCountIs(0); -verify.currentSignatureHelpIs('functionOverload(): any'); - -goTo.marker('functionOverload2'); -verify.currentSignatureParameterCountIs(1); -verify.currentSignatureHelpIs('functionOverload(test: string): any'); -verify.currentParameterHelpArgumentNameIs("test"); +/// + +////function functionOverload(); +////function functionOverload(test: string); +////function functionOverload(test?: string) { } +////functionOverload(/*functionOverload1*/); +////functionOverload(""/*functionOverload2*/); + +goTo.marker('functionOverload1'); +verify.signatureHelpCountIs(2); +verify.currentSignatureParameterCountIs(0); +verify.currentSignatureHelpIs('functionOverload(): any'); + +goTo.marker('functionOverload2'); +verify.currentSignatureParameterCountIs(1); +verify.currentSignatureHelpIs('functionOverload(test: string): any'); +verify.currentParameterHelpArgumentNameIs("test"); verify.currentParameterSpanIs("test: string"); \ No newline at end of file diff --git a/tests/cases/fourslash/signatureHelpFunctionParameter.ts b/tests/cases/fourslash/signatureHelpFunctionParameter.ts index b61e56dedc..9105ee067c 100644 --- a/tests/cases/fourslash/signatureHelpFunctionParameter.ts +++ b/tests/cases/fourslash/signatureHelpFunctionParameter.ts @@ -2,16 +2,16 @@ ////function parameterFunction(callback: (a: number, b: string) => void) { //// callback(/*parameterFunction1*/5, /*parameterFunction2*/""); -////} - -goTo.marker('parameterFunction1'); -verify.signatureHelpCountIs(1); -verify.currentSignatureParameterCountIs(2); -verify.currentSignatureHelpIs('callback(a: number, b: string): void'); -verify.currentParameterHelpArgumentNameIs("a"); -verify.currentParameterSpanIs("a: number"); - -goTo.marker('parameterFunction2'); -verify.currentSignatureHelpIs('callback(a: number, b: string): void'); -verify.currentParameterHelpArgumentNameIs("b"); +////} + +goTo.marker('parameterFunction1'); +verify.signatureHelpCountIs(1); +verify.currentSignatureParameterCountIs(2); +verify.currentSignatureHelpIs('callback(a: number, b: string): void'); +verify.currentParameterHelpArgumentNameIs("a"); +verify.currentParameterSpanIs("a: number"); + +goTo.marker('parameterFunction2'); +verify.currentSignatureHelpIs('callback(a: number, b: string): void'); +verify.currentParameterHelpArgumentNameIs("b"); verify.currentParameterSpanIs("b: string"); \ No newline at end of file diff --git a/tests/cases/fourslash/signatureHelpImplicitConstructor.ts b/tests/cases/fourslash/signatureHelpImplicitConstructor.ts index 4324767d00..c22087b9d1 100644 --- a/tests/cases/fourslash/signatureHelpImplicitConstructor.ts +++ b/tests/cases/fourslash/signatureHelpImplicitConstructor.ts @@ -2,9 +2,9 @@ ////class ImplicitConstructor { ////} -////var implicitConstructor = new ImplicitConstructor(/**/); - -goTo.marker(); -verify.signatureHelpCountIs(1); -verify.currentSignatureHelpIs("ImplicitConstructor(): ImplicitConstructor"); -verify.currentSignatureParameterCountIs(0); +////var implicitConstructor = new ImplicitConstructor(/**/); + +goTo.marker(); +verify.signatureHelpCountIs(1); +verify.currentSignatureHelpIs("ImplicitConstructor(): ImplicitConstructor"); +verify.currentSignatureParameterCountIs(0); diff --git a/tests/cases/fourslash/signatureHelpInFunctionCall.ts b/tests/cases/fourslash/signatureHelpInFunctionCall.ts index 566acc14fb..48c3b4a4cc 100644 --- a/tests/cases/fourslash/signatureHelpInFunctionCall.ts +++ b/tests/cases/fourslash/signatureHelpInFunctionCall.ts @@ -3,7 +3,7 @@ ////var items = []; ////items.forEach(item => { //// for (/**/ -////}); - -goTo.marker(); -verify.not.signatureHelpPresent(); +////}); + +goTo.marker(); +verify.not.signatureHelpPresent(); diff --git a/tests/cases/fourslash/signatureHelpNegativeTests2.ts b/tests/cases/fourslash/signatureHelpNegativeTests2.ts index 28f25063dd..a7341225c7 100644 --- a/tests/cases/fourslash/signatureHelpNegativeTests2.ts +++ b/tests/cases/fourslash/signatureHelpNegativeTests2.ts @@ -1,10 +1,10 @@ -/// - -////class clsOverload { constructor(); constructor(test: string); constructor(test?: string) { } } -////var x = new clsOverload/*beforeOpenParen*/()/*afterCloseParen*/; - -goTo.marker('beforeOpenParen'); -verify.not.signatureHelpPresent(); - -goTo.marker('afterCloseParen'); +/// + +////class clsOverload { constructor(); constructor(test: string); constructor(test?: string) { } } +////var x = new clsOverload/*beforeOpenParen*/()/*afterCloseParen*/; + +goTo.marker('beforeOpenParen'); +verify.not.signatureHelpPresent(); + +goTo.marker('afterCloseParen'); verify.not.signatureHelpPresent(); \ No newline at end of file diff --git a/tests/cases/fourslash/signatureHelpObjectCreationExpressionNoArgs_NotAvailable.ts b/tests/cases/fourslash/signatureHelpObjectCreationExpressionNoArgs_NotAvailable.ts index aea5271927..40a0a316a0 100644 --- a/tests/cases/fourslash/signatureHelpObjectCreationExpressionNoArgs_NotAvailable.ts +++ b/tests/cases/fourslash/signatureHelpObjectCreationExpressionNoArgs_NotAvailable.ts @@ -1,8 +1,8 @@ -/// - -////class sampleCls { constructor(str: string, num: number) { } } -////var x = new sampleCls/**/; - -goTo.marker(); -verify.signatureHelpCountIs(0); +/// + +////class sampleCls { constructor(str: string, num: number) { } } +////var x = new sampleCls/**/; + +goTo.marker(); +verify.signatureHelpCountIs(0); verify.not.signatureHelpPresent(); \ No newline at end of file diff --git a/tests/cases/fourslash/signatureHelpOnOverloadsDifferentArity.ts b/tests/cases/fourslash/signatureHelpOnOverloadsDifferentArity.ts index fe18f655ed..ff20d2ca5c 100644 --- a/tests/cases/fourslash/signatureHelpOnOverloadsDifferentArity.ts +++ b/tests/cases/fourslash/signatureHelpOnOverloadsDifferentArity.ts @@ -1,4 +1,4 @@ -/// +/// ////declare function f(s: string); ////declare function f(n: number); diff --git a/tests/cases/fourslash/signatureHelpOnOverloadsDifferentArity2.ts b/tests/cases/fourslash/signatureHelpOnOverloadsDifferentArity2.ts index 1f87f3b9a0..1290859d84 100644 --- a/tests/cases/fourslash/signatureHelpOnOverloadsDifferentArity2.ts +++ b/tests/cases/fourslash/signatureHelpOnOverloadsDifferentArity2.ts @@ -1,4 +1,4 @@ -/// +/// ////declare function f(s: string); ////declare function f(n: number); diff --git a/tests/cases/fourslash/signatureHelpOnOverloadsDifferentArity3.ts b/tests/cases/fourslash/signatureHelpOnOverloadsDifferentArity3.ts index f9754c7d1f..b98cfe6bbf 100644 --- a/tests/cases/fourslash/signatureHelpOnOverloadsDifferentArity3.ts +++ b/tests/cases/fourslash/signatureHelpOnOverloadsDifferentArity3.ts @@ -1,4 +1,4 @@ -/// +/// ////declare function f(); ////declare function f(s: string); diff --git a/tests/cases/fourslash/signatureHelpSimpleConstructorCall.ts b/tests/cases/fourslash/signatureHelpSimpleConstructorCall.ts index 81af0422f9..8a5fa60ace 100644 --- a/tests/cases/fourslash/signatureHelpSimpleConstructorCall.ts +++ b/tests/cases/fourslash/signatureHelpSimpleConstructorCall.ts @@ -4,14 +4,14 @@ //// constructor(str: string, num: number) { //// } ////} -////var x = new ConstructorCall(/*constructorCall1*/1,/*constructorCall2*/2); - -goTo.marker('constructorCall1'); -verify.signatureHelpCountIs(1); -verify.currentSignatureHelpIs("ConstructorCall(str: string, num: number): ConstructorCall"); -verify.currentParameterHelpArgumentNameIs("str"); -verify.currentParameterSpanIs("str: string"); +////var x = new ConstructorCall(/*constructorCall1*/1,/*constructorCall2*/2); + +goTo.marker('constructorCall1'); +verify.signatureHelpCountIs(1); +verify.currentSignatureHelpIs("ConstructorCall(str: string, num: number): ConstructorCall"); +verify.currentParameterHelpArgumentNameIs("str"); +verify.currentParameterSpanIs("str: string"); goTo.marker('constructorCall2'); -verify.currentSignatureHelpIs("ConstructorCall(str: string, num: number): ConstructorCall"); +verify.currentSignatureHelpIs("ConstructorCall(str: string, num: number): ConstructorCall"); verify.currentParameterHelpArgumentNameIs("num"); verify.currentParameterSpanIs("num: number"); diff --git a/tests/cases/fourslash/signatureHelpSimpleFunctionCall.ts b/tests/cases/fourslash/signatureHelpSimpleFunctionCall.ts index 6e5817ad90..0dc76c0eb0 100644 --- a/tests/cases/fourslash/signatureHelpSimpleFunctionCall.ts +++ b/tests/cases/fourslash/signatureHelpSimpleFunctionCall.ts @@ -5,15 +5,15 @@ ////} ////functionCall(/*functionCall1*/); ////functionCall("", /*functionCall2*/1); - - -goTo.marker('functionCall1'); -verify.signatureHelpCountIs(1); -verify.currentSignatureHelpIs("functionCall(str: string, num: number): void"); -verify.currentParameterHelpArgumentNameIs("str"); -verify.currentParameterSpanIs("str: string"); + + +goTo.marker('functionCall1'); +verify.signatureHelpCountIs(1); +verify.currentSignatureHelpIs("functionCall(str: string, num: number): void"); +verify.currentParameterHelpArgumentNameIs("str"); +verify.currentParameterSpanIs("str: string"); goTo.marker('functionCall2'); -verify.currentSignatureHelpIs("functionCall(str: string, num: number): void"); +verify.currentSignatureHelpIs("functionCall(str: string, num: number): void"); verify.currentParameterHelpArgumentNameIs("num"); verify.currentParameterSpanIs("num: number"); diff --git a/tests/cases/fourslash/signatureHelpSuperConstructorOverload.ts b/tests/cases/fourslash/signatureHelpSuperConstructorOverload.ts index aa2e3e4856..c65ce2824c 100644 --- a/tests/cases/fourslash/signatureHelpSuperConstructorOverload.ts +++ b/tests/cases/fourslash/signatureHelpSuperConstructorOverload.ts @@ -1,28 +1,28 @@ -/// - -////class SuperOverloadlBase { -//// constructor(); -//// constructor(test: string); -//// constructor(test?: string) { -//// } -////} -////class SuperOverLoad1 extends SuperOverloadlBase { -//// constructor() { -//// super(/*superOverload1*/); -//// } -////} -////class SuperOverLoad2 extends SuperOverloadlBase { -//// constructor() { -//// super(""/*superOverload2*/); -//// } -////} - -goTo.marker('superOverload1'); -verify.signatureHelpCountIs(2); -verify.currentSignatureHelpIs("SuperOverloadlBase(): SuperOverloadlBase"); -verify.currentSignatureParameterCountIs(0); -goTo.marker('superOverload2'); -verify.currentSignatureParameterCountIs(1); -verify.currentSignatureHelpIs("SuperOverloadlBase(test: string): SuperOverloadlBase"); -verify.currentParameterHelpArgumentNameIs("test"); +/// + +////class SuperOverloadlBase { +//// constructor(); +//// constructor(test: string); +//// constructor(test?: string) { +//// } +////} +////class SuperOverLoad1 extends SuperOverloadlBase { +//// constructor() { +//// super(/*superOverload1*/); +//// } +////} +////class SuperOverLoad2 extends SuperOverloadlBase { +//// constructor() { +//// super(""/*superOverload2*/); +//// } +////} + +goTo.marker('superOverload1'); +verify.signatureHelpCountIs(2); +verify.currentSignatureHelpIs("SuperOverloadlBase(): SuperOverloadlBase"); +verify.currentSignatureParameterCountIs(0); +goTo.marker('superOverload2'); +verify.currentSignatureParameterCountIs(1); +verify.currentSignatureHelpIs("SuperOverloadlBase(test: string): SuperOverloadlBase"); +verify.currentParameterHelpArgumentNameIs("test"); verify.currentParameterSpanIs("test: string"); \ No newline at end of file diff --git a/tests/cases/fourslash/signatureHelpWithInterfaceAsIdentifier.ts b/tests/cases/fourslash/signatureHelpWithInterfaceAsIdentifier.ts index 229d42c052..cf89b4f476 100644 --- a/tests/cases/fourslash/signatureHelpWithInterfaceAsIdentifier.ts +++ b/tests/cases/fourslash/signatureHelpWithInterfaceAsIdentifier.ts @@ -1,9 +1,9 @@ -/// - +/// + ////interface C { //// (): void; ////} -////C(/*1*/); - -goTo.marker('1'); +////C(/*1*/); + +goTo.marker('1'); verify.not.signatureHelpPresent(); \ No newline at end of file diff --git a/tests/cases/fourslash/signatureHelpWithUnknown.ts b/tests/cases/fourslash/signatureHelpWithUnknown.ts index 00a031b267..e2ade66348 100644 --- a/tests/cases/fourslash/signatureHelpWithUnknown.ts +++ b/tests/cases/fourslash/signatureHelpWithUnknown.ts @@ -1,6 +1,6 @@ -/// - -////eval(\/*1*/ - -goTo.marker("1"); -verify.signatureHelpCountIs(1); +/// + +////eval(\/*1*/ + +goTo.marker("1"); +verify.signatureHelpCountIs(1); diff --git a/tests/cases/fourslash/smartIndentActualIndentation.ts b/tests/cases/fourslash/smartIndentActualIndentation.ts index b2874d3c1d..da47aaf1bc 100644 --- a/tests/cases/fourslash/smartIndentActualIndentation.ts +++ b/tests/cases/fourslash/smartIndentActualIndentation.ts @@ -1,17 +1,17 @@ -/// - -//// class A { -//// /*1*/ -//// } - -////module M { -//// class C { -//// /*2*/ -//// } -////} - -goTo.marker("1"); -verify.indentationIs(12); - -goTo.marker("2"); -verify.indentationIs(16); +/// + +//// class A { +//// /*1*/ +//// } + +////module M { +//// class C { +//// /*2*/ +//// } +////} + +goTo.marker("1"); +verify.indentationIs(12); + +goTo.marker("2"); +verify.indentationIs(16); diff --git a/tests/cases/fourslash/smartIndentAfterAlignedFunctionArgument.ts b/tests/cases/fourslash/smartIndentAfterAlignedFunctionArgument.ts index d5aa2bc431..76566e996d 100644 --- a/tests/cases/fourslash/smartIndentAfterAlignedFunctionArgument.ts +++ b/tests/cases/fourslash/smartIndentAfterAlignedFunctionArgument.ts @@ -1,10 +1,10 @@ -/// - -////function foo(bar, -//// blah, baz, -//// /**/ -////) { }; - -goTo.marker(); -// keep indentation of 'blah' -verify.indentationIs(13); +/// + +////function foo(bar, +//// blah, baz, +//// /**/ +////) { }; + +goTo.marker(); +// keep indentation of 'blah' +verify.indentationIs(13); diff --git a/tests/cases/fourslash/smartIndentClass.ts b/tests/cases/fourslash/smartIndentClass.ts index 5e26781357..ba2936bd70 100644 --- a/tests/cases/fourslash/smartIndentClass.ts +++ b/tests/cases/fourslash/smartIndentClass.ts @@ -1,21 +1,21 @@ -/// - -////class Bar { -//// {| "indentation": 4|} -//// private foo: string = ""; -//// {| "indentation": 4|} -//// private f() { -//// var a: any[] = [[1, 2], [3, 4], 5]; -//// {| "indentation": 8|} -//// return ((1 + 1)); -//// } -//// {| "indentation": 4|} -//// private f2() { -//// if (true) { } { }; -//// } -////} +/// + +////class Bar { +//// {| "indentation": 4|} +//// private foo: string = ""; +//// {| "indentation": 4|} +//// private f() { +//// var a: any[] = [[1, 2], [3, 4], 5]; +//// {| "indentation": 8|} +//// return ((1 + 1)); +//// } +//// {| "indentation": 4|} +//// private f2() { +//// if (true) { } { }; +//// } +////} ////{| "indentation": 0|} test.markers().forEach((marker) => { - verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indentation); -}); + verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indentation); +}); diff --git a/tests/cases/fourslash/smartIndentCloseBrace.ts b/tests/cases/fourslash/smartIndentCloseBrace.ts index da2094d76c..1003907510 100644 --- a/tests/cases/fourslash/smartIndentCloseBrace.ts +++ b/tests/cases/fourslash/smartIndentCloseBrace.ts @@ -1,11 +1,11 @@ -/// - -////class A { -//// {| "indentation": 0|} } -////class B { -//// var x = 1; -//// {| "indentation": 0|} } +/// + +////class A { +//// {| "indentation": 0|} } +////class B { +//// var x = 1; +//// {| "indentation": 0|} } test.markers().forEach((marker) => { - verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indentation); -}); + verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indentation); +}); diff --git a/tests/cases/fourslash/smartIndentDoStatement.ts b/tests/cases/fourslash/smartIndentDoStatement.ts index 2dff10f927..d121344bed 100644 --- a/tests/cases/fourslash/smartIndentDoStatement.ts +++ b/tests/cases/fourslash/smartIndentDoStatement.ts @@ -1,17 +1,17 @@ /// //// do /*1*/ { //// } while (true) -//// -//// do { /*2*/ -//// } /*3*/while (true)/*4*/ - -function verifyIndentationAfterNewLine(marker: string, indentation: number): void { - goTo.marker(marker); - edit.insert("\r\n"); - verify.indentationIs(indentation); -} - -verifyIndentationAfterNewLine("1", 0); -verifyIndentationAfterNewLine("2", 4); -verifyIndentationAfterNewLine("3", 0); -verifyIndentationAfterNewLine("4", 0); +//// +//// do { /*2*/ +//// } /*3*/while (true)/*4*/ + +function verifyIndentationAfterNewLine(marker: string, indentation: number): void { + goTo.marker(marker); + edit.insert("\r\n"); + verify.indentationIs(indentation); +} + +verifyIndentationAfterNewLine("1", 0); +verifyIndentationAfterNewLine("2", 4); +verifyIndentationAfterNewLine("3", 0); +verifyIndentationAfterNewLine("4", 0); diff --git a/tests/cases/fourslash/smartIndentIfStatement.ts b/tests/cases/fourslash/smartIndentIfStatement.ts index fb377ec9c9..5a8c5014a7 100644 --- a/tests/cases/fourslash/smartIndentIfStatement.ts +++ b/tests/cases/fourslash/smartIndentIfStatement.ts @@ -1,20 +1,20 @@ -/// - -//// if /*1*/(true) { } -//// -//// if (true) /*2*/ { /*3*/ -//// } /*4*/ -//// -//// if (1 === /*5*/ 2) { } - -function verifyIndentationAfterNewLine(marker: string, indentation: number): void { - goTo.marker(marker); - edit.insert("\r\n"); - verify.indentationIs(indentation); -} - -verifyIndentationAfterNewLine("1", 4); -verifyIndentationAfterNewLine("2", 0); -verifyIndentationAfterNewLine("3", 4); -verifyIndentationAfterNewLine("4", 0); +/// + +//// if /*1*/(true) { } +//// +//// if (true) /*2*/ { /*3*/ +//// } /*4*/ +//// +//// if (1 === /*5*/ 2) { } + +function verifyIndentationAfterNewLine(marker: string, indentation: number): void { + goTo.marker(marker); + edit.insert("\r\n"); + verify.indentationIs(indentation); +} + +verifyIndentationAfterNewLine("1", 4); +verifyIndentationAfterNewLine("2", 0); +verifyIndentationAfterNewLine("3", 4); +verifyIndentationAfterNewLine("4", 0); verifyIndentationAfterNewLine("5", 4); \ No newline at end of file diff --git a/tests/cases/fourslash/smartIndentInCallExpressions.ts b/tests/cases/fourslash/smartIndentInCallExpressions.ts index 1e28932678..2733250761 100644 --- a/tests/cases/fourslash/smartIndentInCallExpressions.ts +++ b/tests/cases/fourslash/smartIndentInCallExpressions.ts @@ -1,4 +1,4 @@ -/// +/// ////module My.App { //// export var appModule = angular.module("app", [ diff --git a/tests/cases/fourslash/smartIndentInsideBlockInsideCase.ts b/tests/cases/fourslash/smartIndentInsideBlockInsideCase.ts index ecff8e8368..51c7426944 100644 --- a/tests/cases/fourslash/smartIndentInsideBlockInsideCase.ts +++ b/tests/cases/fourslash/smartIndentInsideBlockInsideCase.ts @@ -1,18 +1,18 @@ -/// - -////module SwitchTest { -//// var a = 3; -//// -//// if (a == 5) { -//// switch (a) { -//// case 1: -//// if (a == 5) { -//// /**/ -//// } -//// break; -//// } -//// } -////} - -goTo.marker(); -verify.indentationIs(20); +/// + +////module SwitchTest { +//// var a = 3; +//// +//// if (a == 5) { +//// switch (a) { +//// case 1: +//// if (a == 5) { +//// /**/ +//// } +//// break; +//// } +//// } +////} + +goTo.marker(); +verify.indentationIs(20); diff --git a/tests/cases/fourslash/smartIndentInterface.ts b/tests/cases/fourslash/smartIndentInterface.ts index 3a481ce759..29fdf77d11 100644 --- a/tests/cases/fourslash/smartIndentInterface.ts +++ b/tests/cases/fourslash/smartIndentInterface.ts @@ -1,14 +1,14 @@ -/// - -////interface Foo { -//// {| "indentation" : 4 |} -//// x: number; -//// {| "indentation" : 4 |} -//// foo(): number; -//// {| "indentation" : 4 |} -////} -////{| "indentation" : 0 |} +/// + +////interface Foo { +//// {| "indentation" : 4 |} +//// x: number; +//// {| "indentation" : 4 |} +//// foo(): number; +//// {| "indentation" : 4 |} +////} +////{| "indentation" : 0 |} test.markers().forEach((marker) => { - verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indentation); + verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indentation); }); \ No newline at end of file diff --git a/tests/cases/fourslash/smartIndentModule.ts b/tests/cases/fourslash/smartIndentModule.ts index 8cac1ade9c..12873c7125 100644 --- a/tests/cases/fourslash/smartIndentModule.ts +++ b/tests/cases/fourslash/smartIndentModule.ts @@ -1,12 +1,12 @@ -/// - -////module Foo { -//// /*insideModule*/ -////} -/////*afterModule*/ - -goTo.marker('insideModule'); -verify.indentationIs(4); - -goTo.marker('afterModule'); -verify.indentationIs(0); +/// + +////module Foo { +//// /*insideModule*/ +////} +/////*afterModule*/ + +goTo.marker('insideModule'); +verify.indentationIs(4); + +goTo.marker('afterModule'); +verify.indentationIs(0); diff --git a/tests/cases/fourslash/smartIndentNonterminatedArgumentListAtEOF.ts b/tests/cases/fourslash/smartIndentNonterminatedArgumentListAtEOF.ts index e4ab33fca3..b2b1f746a3 100644 --- a/tests/cases/fourslash/smartIndentNonterminatedArgumentListAtEOF.ts +++ b/tests/cases/fourslash/smartIndentNonterminatedArgumentListAtEOF.ts @@ -1,7 +1,7 @@ -/// - -////function foo(a, -/////**/ - -goTo.marker(); -verify.indentationIs(0); +/// + +////function foo(a, +/////**/ + +goTo.marker(); +verify.indentationIs(0); diff --git a/tests/cases/fourslash/smartIndentNonterminatedIfStatementAtEOF.ts b/tests/cases/fourslash/smartIndentNonterminatedIfStatementAtEOF.ts index 87989b9d85..0bf4bca5ec 100644 --- a/tests/cases/fourslash/smartIndentNonterminatedIfStatementAtEOF.ts +++ b/tests/cases/fourslash/smartIndentNonterminatedIfStatementAtEOF.ts @@ -1,7 +1,7 @@ -/// - -////if (true) -/////**/ - -goTo.marker(); -verify.indentationIs(4); +/// + +////if (true) +/////**/ + +goTo.marker(); +verify.indentationIs(4); diff --git a/tests/cases/fourslash/smartIndentOnFunctionParameters.ts b/tests/cases/fourslash/smartIndentOnFunctionParameters.ts index 012c4d93b4..8823bf4691 100644 --- a/tests/cases/fourslash/smartIndentOnFunctionParameters.ts +++ b/tests/cases/fourslash/smartIndentOnFunctionParameters.ts @@ -1,31 +1,31 @@ -/// - -////function foo(a, -//// /*2*/b,/*0*/ -//// //comment/*3*/ -//// /*4*/c -//// ) { -////}; -////var x = [ -//// /*5*///comment/*1*/ -//// 1,/*6*/ -//// 2/*7*/ -////] -goTo.marker("0"); -edit.insert("\r\n"); -verify.indentationIs(4); -goTo.marker("2"); -verify.currentLineContentIs(" b,"); -goTo.marker("3"); -verify.currentLineContentIs(" //comment"); -goTo.marker("4"); -verify.currentLineContentIs(" c"); -goTo.marker("1"); -edit.insert("\r\n"); -verify.indentationIs(4); -goTo.marker("5"); -verify.currentLineContentIs(" //comment"); -goTo.marker("6"); -verify.currentLineContentIs(" 1,"); -goTo.marker("7"); -verify.currentLineContentIs(" 2"); +/// + +////function foo(a, +//// /*2*/b,/*0*/ +//// //comment/*3*/ +//// /*4*/c +//// ) { +////}; +////var x = [ +//// /*5*///comment/*1*/ +//// 1,/*6*/ +//// 2/*7*/ +////] +goTo.marker("0"); +edit.insert("\r\n"); +verify.indentationIs(4); +goTo.marker("2"); +verify.currentLineContentIs(" b,"); +goTo.marker("3"); +verify.currentLineContentIs(" //comment"); +goTo.marker("4"); +verify.currentLineContentIs(" c"); +goTo.marker("1"); +edit.insert("\r\n"); +verify.indentationIs(4); +goTo.marker("5"); +verify.currentLineContentIs(" //comment"); +goTo.marker("6"); +verify.currentLineContentIs(" 1,"); +goTo.marker("7"); +verify.currentLineContentIs(" 2"); diff --git a/tests/cases/fourslash/smartIndentStartLineInLists.ts b/tests/cases/fourslash/smartIndentStartLineInLists.ts index 0150881ff3..3410b4012e 100644 --- a/tests/cases/fourslash/smartIndentStartLineInLists.ts +++ b/tests/cases/fourslash/smartIndentStartLineInLists.ts @@ -2,7 +2,7 @@ ////foo(function () { ////}).then(function () {/*1*/ ////}) - -goTo.marker("1"); -edit.insert("\r\n"); + +goTo.marker("1"); +edit.insert("\r\n"); verify.indentationIs(4); \ No newline at end of file diff --git a/tests/cases/fourslash/smartIndentStatementFor.ts b/tests/cases/fourslash/smartIndentStatementFor.ts index 0412fe66d4..a3fc2a9a0c 100644 --- a/tests/cases/fourslash/smartIndentStatementFor.ts +++ b/tests/cases/fourslash/smartIndentStatementFor.ts @@ -1,14 +1,14 @@ -/// - -////function Foo() { -//// for (var i = 0; i < 10; i++) { -//// /*insideStatement*/ -//// } -//// /*afterStatement*/ -////} - -goTo.marker('insideStatement'); -verify.indentationIs(8); - -goTo.marker('afterStatement'); -verify.indentationIs(4); +/// + +////function Foo() { +//// for (var i = 0; i < 10; i++) { +//// /*insideStatement*/ +//// } +//// /*afterStatement*/ +////} + +goTo.marker('insideStatement'); +verify.indentationIs(8); + +goTo.marker('afterStatement'); +verify.indentationIs(4); diff --git a/tests/cases/fourslash/smartIndentStatementForIn.ts b/tests/cases/fourslash/smartIndentStatementForIn.ts index 9e71075886..355f175b7d 100644 --- a/tests/cases/fourslash/smartIndentStatementForIn.ts +++ b/tests/cases/fourslash/smartIndentStatementForIn.ts @@ -1,15 +1,15 @@ -/// - -////function Foo() { -//// for (var i in []) -//// { -//// /*insideStatement*/ -//// } -//// /*afterStatement*/ -////} - -goTo.marker('insideStatement'); -verify.indentationIs(8); - -goTo.marker('afterStatement'); -verify.indentationIs(4); +/// + +////function Foo() { +//// for (var i in []) +//// { +//// /*insideStatement*/ +//// } +//// /*afterStatement*/ +////} + +goTo.marker('insideStatement'); +verify.indentationIs(8); + +goTo.marker('afterStatement'); +verify.indentationIs(4); diff --git a/tests/cases/fourslash/smartIndentStatementSwitch.ts b/tests/cases/fourslash/smartIndentStatementSwitch.ts index e8d2a02948..c2c2d09fd4 100644 --- a/tests/cases/fourslash/smartIndentStatementSwitch.ts +++ b/tests/cases/fourslash/smartIndentStatementSwitch.ts @@ -1,21 +1,21 @@ -/// - -////function Foo() { -//// var x; -//// switch (x) { -//// {| "indentation": 8 |} -//// } -//// {| "indentation": 4 |} -//// switch (x) { -//// {| "indentation": 8 |} -//// case 1: -//// {| "indentation": 12 |} -//// break; -//// {| "indentation": 12 |} // content of case clauses is always indented relatively to case clause -//// } -//// {| "indentation": 4 |} -////} +/// + +////function Foo() { +//// var x; +//// switch (x) { +//// {| "indentation": 8 |} +//// } +//// {| "indentation": 4 |} +//// switch (x) { +//// {| "indentation": 8 |} +//// case 1: +//// {| "indentation": 12 |} +//// break; +//// {| "indentation": 12 |} // content of case clauses is always indented relatively to case clause +//// } +//// {| "indentation": 4 |} +////} test.markers().forEach((marker) => { - verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indentation); + verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indentation); }); \ No newline at end of file diff --git a/tests/cases/fourslash/smartIndentStatementTryCatchFinally.ts b/tests/cases/fourslash/smartIndentStatementTryCatchFinally.ts index a3bcaf9ac4..e671dd9dc5 100644 --- a/tests/cases/fourslash/smartIndentStatementTryCatchFinally.ts +++ b/tests/cases/fourslash/smartIndentStatementTryCatchFinally.ts @@ -1,45 +1,45 @@ -/// - -////function tryCatch() { -//// {| "indentation": 4 |} -//// try { -//// {| "indentation": 8 |} -//// } -//// {| "indentation": 4 |} -//// catch (err) { -//// {| "indentation": 8 |} -//// } -//// {| "indentation": 4 |} -////} -//// -////function tryFinally() { -//// {| "indentation": 4 |} -//// try { -//// {| "indentation": 8 |} -//// } -//// {| "indentation": 4 |} -//// finally { -//// {| "indentation": 8 |} -//// } -//// {| "indentation": 4 |} -////} -//// -////function tryCatchFinally() { -//// {| "indentation": 4 |} -//// try { -//// {| "indentation": 8 |} -//// } -//// {| "indentation": 4 |} -//// catch (err) { -//// {| "indentation": 8 |} -//// } -//// {| "indentation": 4 |} -//// finally { -//// {| "indentation": 8 |} -//// } -//// {| "indentation": 4 |} -////} +/// + +////function tryCatch() { +//// {| "indentation": 4 |} +//// try { +//// {| "indentation": 8 |} +//// } +//// {| "indentation": 4 |} +//// catch (err) { +//// {| "indentation": 8 |} +//// } +//// {| "indentation": 4 |} +////} +//// +////function tryFinally() { +//// {| "indentation": 4 |} +//// try { +//// {| "indentation": 8 |} +//// } +//// {| "indentation": 4 |} +//// finally { +//// {| "indentation": 8 |} +//// } +//// {| "indentation": 4 |} +////} +//// +////function tryCatchFinally() { +//// {| "indentation": 4 |} +//// try { +//// {| "indentation": 8 |} +//// } +//// {| "indentation": 4 |} +//// catch (err) { +//// {| "indentation": 8 |} +//// } +//// {| "indentation": 4 |} +//// finally { +//// {| "indentation": 8 |} +//// } +//// {| "indentation": 4 |} +////} test.markers().forEach((marker) => { - verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indentation); + verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indentation); }); \ No newline at end of file diff --git a/tests/cases/fourslash/smartIndentStatementWith.ts b/tests/cases/fourslash/smartIndentStatementWith.ts index 799555b872..311ecafbb3 100644 --- a/tests/cases/fourslash/smartIndentStatementWith.ts +++ b/tests/cases/fourslash/smartIndentStatementWith.ts @@ -1,15 +1,15 @@ -/// - -////function Foo() { -//// var obj = { a: 'foo' }; -//// with (obj) { -//// /*insideStatement*/ -//// } -//// /*afterStatement*/ -////} - -goTo.marker('insideStatement'); -verify.indentationIs(8); - -goTo.marker('afterStatement'); -verify.indentationIs(4); +/// + +////function Foo() { +//// var obj = { a: 'foo' }; +//// with (obj) { +//// /*insideStatement*/ +//// } +//// /*afterStatement*/ +////} + +goTo.marker('insideStatement'); +verify.indentationIs(8); + +goTo.marker('afterStatement'); +verify.indentationIs(4); diff --git a/tests/cases/fourslash/spaceAfterReturn.ts b/tests/cases/fourslash/spaceAfterReturn.ts index 16b44d8102..b5d26ae981 100644 --- a/tests/cases/fourslash/spaceAfterReturn.ts +++ b/tests/cases/fourslash/spaceAfterReturn.ts @@ -1,15 +1,15 @@ -/// - -////function f( ) { -////return 1;/*1*/ -////return[1];/*2*/ -////return ;/*3*/ -////} - -format.document(); -goTo.marker("1"); -verify.currentLineContentIs(" return 1;"); -goTo.marker("2"); -verify.currentLineContentIs(" return [1];"); -goTo.marker("3"); +/// + +////function f( ) { +////return 1;/*1*/ +////return[1];/*2*/ +////return ;/*3*/ +////} + +format.document(); +goTo.marker("1"); +verify.currentLineContentIs(" return 1;"); +goTo.marker("2"); +verify.currentLineContentIs(" return [1];"); +goTo.marker("3"); verify.currentLineContentIs(" return;"); \ No newline at end of file diff --git a/tests/cases/fourslash/squiggleFunctionExpression.ts b/tests/cases/fourslash/squiggleFunctionExpression.ts index 3477f31db3..75cca339e9 100644 --- a/tests/cases/fourslash/squiggleFunctionExpression.ts +++ b/tests/cases/fourslash/squiggleFunctionExpression.ts @@ -1,9 +1,9 @@ -/// - -////function takesCallback(callback: (n) => any) { } -////takesCallback(function inner(n) { var /*1*/k/*2*/: string = 10; }); - -verify.errorExistsBetweenMarkers("1", "2"); -verify.not.errorExistsBeforeMarker("1"); -verify.not.errorExistsAfterMarker("2"); -verify.numberOfErrorsInCurrentFile(1); +/// + +////function takesCallback(callback: (n) => any) { } +////takesCallback(function inner(n) { var /*1*/k/*2*/: string = 10; }); + +verify.errorExistsBetweenMarkers("1", "2"); +verify.not.errorExistsBeforeMarker("1"); +verify.not.errorExistsAfterMarker("2"); +verify.numberOfErrorsInCurrentFile(1); diff --git a/tests/cases/fourslash/squiggleIllegalClassExtension.ts b/tests/cases/fourslash/squiggleIllegalClassExtension.ts index 21919835a6..357b4ef9ac 100644 --- a/tests/cases/fourslash/squiggleIllegalClassExtension.ts +++ b/tests/cases/fourslash/squiggleIllegalClassExtension.ts @@ -1,6 +1,6 @@ -/// - -////class Foo extends /*1*/Bar/*2*/ { } - -verify.errorExistsBetweenMarkers("1", "2"); -verify.numberOfErrorsInCurrentFile(1); +/// + +////class Foo extends /*1*/Bar/*2*/ { } + +verify.errorExistsBetweenMarkers("1", "2"); +verify.numberOfErrorsInCurrentFile(1); diff --git a/tests/cases/fourslash/squiggleIllegalInterfaceExtension.ts b/tests/cases/fourslash/squiggleIllegalInterfaceExtension.ts index 4946353360..636ce23f68 100644 --- a/tests/cases/fourslash/squiggleIllegalInterfaceExtension.ts +++ b/tests/cases/fourslash/squiggleIllegalInterfaceExtension.ts @@ -1,8 +1,8 @@ -/// - -////var n = '';/**/ -////interface x extends /*1*/string/*2*/ {} - -verify.not.errorExistsBeforeMarker(); -verify.errorExistsBetweenMarkers("1", "2"); -verify.numberOfErrorsInCurrentFile(1); +/// + +////var n = '';/**/ +////interface x extends /*1*/string/*2*/ {} + +verify.not.errorExistsBeforeMarker(); +verify.errorExistsBetweenMarkers("1", "2"); +verify.numberOfErrorsInCurrentFile(1); diff --git a/tests/cases/fourslash/squiggleIllegalSubclassOverride.ts b/tests/cases/fourslash/squiggleIllegalSubclassOverride.ts index fe9774d7bf..bb7b40fd25 100644 --- a/tests/cases/fourslash/squiggleIllegalSubclassOverride.ts +++ b/tests/cases/fourslash/squiggleIllegalSubclassOverride.ts @@ -1,12 +1,12 @@ -/// - -////class Foo { -//// public x: number; -////} -//// -////class /*1*/Bar/*2*/ extends Foo { -//// public x: string; -////} - -verify.errorExistsBetweenMarkers("1", "2"); +/// + +////class Foo { +//// public x: number; +////} +//// +////class /*1*/Bar/*2*/ extends Foo { +//// public x: string; +////} + +verify.errorExistsBetweenMarkers("1", "2"); verify.numberOfErrorsInCurrentFile(1); \ No newline at end of file diff --git a/tests/cases/fourslash/squiggleUnclosedStringLiteral.ts b/tests/cases/fourslash/squiggleUnclosedStringLiteral.ts index 3d2dca0303..cf4dc19ffb 100644 --- a/tests/cases/fourslash/squiggleUnclosedStringLiteral.ts +++ b/tests/cases/fourslash/squiggleUnclosedStringLiteral.ts @@ -1,11 +1,11 @@ -/// - -////var x = /*1*/"asd -/////*2*/var y = 2; -verify.errorExistsAfterMarker("1"); -verify.not.errorExistsAfterMarker("2"); -verify.numberOfErrorsInCurrentFile(1); - - - - +/// + +////var x = /*1*/"asd +/////*2*/var y = 2; +verify.errorExistsAfterMarker("1"); +verify.not.errorExistsAfterMarker("2"); +verify.numberOfErrorsInCurrentFile(1); + + + + diff --git a/tests/cases/fourslash/symbolNameAtUnparseableFunctionOverload.ts b/tests/cases/fourslash/symbolNameAtUnparseableFunctionOverload.ts index 2ad60dbb6b..59c78b5e5d 100644 --- a/tests/cases/fourslash/symbolNameAtUnparseableFunctionOverload.ts +++ b/tests/cases/fourslash/symbolNameAtUnparseableFunctionOverload.ts @@ -1,13 +1,13 @@ -/// - -//// class TestClass { -//// public function foo(x: string): void; -//// public function foo(): void; -//// foo(x: any): void { -//// this.bar(/**/x); // should not error -//// } -//// } -//// - -goTo.marker(); +/// + +//// class TestClass { +//// public function foo(x: string): void; +//// public function foo(): void; +//// foo(x: any): void { +//// this.bar(/**/x); // should not error +//// } +//// } +//// + +goTo.marker(); verify.quickInfoExists(); \ No newline at end of file diff --git a/tests/cases/fourslash/syntacticClassificationsObjectLiteral.ts b/tests/cases/fourslash/syntacticClassificationsObjectLiteral.ts index a7e8f7b7b0..59642468ce 100644 --- a/tests/cases/fourslash/syntacticClassificationsObjectLiteral.ts +++ b/tests/cases/fourslash/syntacticClassificationsObjectLiteral.ts @@ -1,4 +1,4 @@ -/// +/// ////var v = 10e0; ////var x = { diff --git a/tests/cases/fourslash/syntacticClassificationsTemplates1.ts b/tests/cases/fourslash/syntacticClassificationsTemplates1.ts index 4c79c047c8..8ee48fb8a1 100644 --- a/tests/cases/fourslash/syntacticClassificationsTemplates1.ts +++ b/tests/cases/fourslash/syntacticClassificationsTemplates1.ts @@ -1,4 +1,4 @@ -/// +/// ////var v = 10e0; ////var x = { diff --git a/tests/cases/fourslash/syntacticClassificationsTemplates2.ts b/tests/cases/fourslash/syntacticClassificationsTemplates2.ts index 19bad4b54a..913dc03901 100644 --- a/tests/cases/fourslash/syntacticClassificationsTemplates2.ts +++ b/tests/cases/fourslash/syntacticClassificationsTemplates2.ts @@ -1,4 +1,4 @@ -/// +/// ////var tiredOfCanonicalExamples = ////`goodbye "${ `hello world` }" diff --git a/tests/cases/fourslash/toggleDuplicateFunctionDeclaration.ts b/tests/cases/fourslash/toggleDuplicateFunctionDeclaration.ts index a68bc7f7d0..b8ed3ea9e5 100644 --- a/tests/cases/fourslash/toggleDuplicateFunctionDeclaration.ts +++ b/tests/cases/fourslash/toggleDuplicateFunctionDeclaration.ts @@ -1,12 +1,12 @@ -/// - -//// class D { } -//// D(); - -var funcDecl = 'declare function D();'; - -goTo.bof(); -edit.insert(funcDecl); - -goTo.bof(); -edit.deleteAtCaret(funcDecl.length); +/// + +//// class D { } +//// D(); + +var funcDecl = 'declare function D();'; + +goTo.bof(); +edit.insert(funcDecl); + +goTo.bof(); +edit.deleteAtCaret(funcDecl.length); diff --git a/tests/cases/fourslash/typeAboveNumberLiteralExpressionStatement.ts b/tests/cases/fourslash/typeAboveNumberLiteralExpressionStatement.ts index ece781cbcb..c28f7e5cba 100644 --- a/tests/cases/fourslash/typeAboveNumberLiteralExpressionStatement.ts +++ b/tests/cases/fourslash/typeAboveNumberLiteralExpressionStatement.ts @@ -1,9 +1,9 @@ -/// - -//// -//// // foo -//// 1; - - -goTo.bof(); -edit.insert("var x;\n"); +/// + +//// +//// // foo +//// 1; + + +goTo.bof(); +edit.insert("var x;\n"); diff --git a/tests/cases/fourslash/typeCheckAfterAddingGenericParameter.ts b/tests/cases/fourslash/typeCheckAfterAddingGenericParameter.ts index fa312f3c71..5f8d3ed9e3 100644 --- a/tests/cases/fourslash/typeCheckAfterAddingGenericParameter.ts +++ b/tests/cases/fourslash/typeCheckAfterAddingGenericParameter.ts @@ -1,22 +1,22 @@ -/// - -//// function f() { } -//// function f2(b: X): X { return null; } -//// class C { -//// public f() {} -//// f2(b): X { return null; } -//// } -//// -//// interface I { -//// f(); -//// f2(/*addParam*/a: X): X; -//// } -//// - -goTo.marker('addParam'); - -edit.insert(", X"); - -goTo.marker('addTypeParam'); - -edit.insert(", X"); +/// + +//// function f() { } +//// function f2(b: X): X { return null; } +//// class C { +//// public f() {} +//// f2(b): X { return null; } +//// } +//// +//// interface I { +//// f(); +//// f2(/*addParam*/a: X): X; +//// } +//// + +goTo.marker('addParam'); + +edit.insert(", X"); + +goTo.marker('addTypeParam'); + +edit.insert(", X"); diff --git a/tests/cases/fourslash/typeCheckObjectInArrayLiteral.ts b/tests/cases/fourslash/typeCheckObjectInArrayLiteral.ts index 621fe111bf..5e321ec6b5 100644 --- a/tests/cases/fourslash/typeCheckObjectInArrayLiteral.ts +++ b/tests/cases/fourslash/typeCheckObjectInArrayLiteral.ts @@ -1,7 +1,7 @@ -/// - -//// declare function create(initialValues); -//// create([{}]); - -goTo.position(0); -edit.insert(''); +/// + +//// declare function create(initialValues); +//// create([{}]); + +goTo.position(0); +edit.insert(''); diff --git a/tests/cases/fourslash/typeParameterListInQuickInfoAfterEdit.ts b/tests/cases/fourslash/typeParameterListInQuickInfoAfterEdit.ts index c5abd2e027..5724693832 100644 --- a/tests/cases/fourslash/typeParameterListInQuickInfoAfterEdit.ts +++ b/tests/cases/fourslash/typeParameterListInQuickInfoAfterEdit.ts @@ -1,20 +1,20 @@ -/// - -//// class Dictionary { -//// } -//// -//// module Maps { -//// class C1 extends D/*1*/ictionary { } -//// /*2*/ -//// } -//// - -// Sanity check: type name here should include the type parameter -goTo.marker('1'); -verify.quickInfoIs('class Dictionary'); - -// Add a similar class -- name does not match -goTo.marker('2'); -edit.insert("class C2 extends Dictionary { }"); -edit.moveLeft('ictionary { }'.length); -verify.quickInfoIs('class Dictionary'); +/// + +//// class Dictionary { +//// } +//// +//// module Maps { +//// class C1 extends D/*1*/ictionary { } +//// /*2*/ +//// } +//// + +// Sanity check: type name here should include the type parameter +goTo.marker('1'); +verify.quickInfoIs('class Dictionary'); + +// Add a similar class -- name does not match +goTo.marker('2'); +edit.insert("class C2 extends Dictionary { }"); +edit.moveLeft('ictionary { }'.length); +verify.quickInfoIs('class Dictionary'); diff --git a/tests/cases/fourslash/unclosedArrayErrorRecovery.ts b/tests/cases/fourslash/unclosedArrayErrorRecovery.ts index 3741b33ec5..3d9e4acea5 100644 --- a/tests/cases/fourslash/unclosedArrayErrorRecovery.ts +++ b/tests/cases/fourslash/unclosedArrayErrorRecovery.ts @@ -1,6 +1,6 @@ -/// - -////var table: number[; -/////**/table.push(1) - +/// + +////var table: number[; +/////**/table.push(1) + verify.not.errorExistsAfterMarker(); \ No newline at end of file diff --git a/tests/cases/fourslash/unclosedCommentsInConstructor.ts b/tests/cases/fourslash/unclosedCommentsInConstructor.ts index 8bda1505ba..a81bfb1fbf 100644 --- a/tests/cases/fourslash/unclosedCommentsInConstructor.ts +++ b/tests/cases/fourslash/unclosedCommentsInConstructor.ts @@ -1,8 +1,8 @@ -/// - -////class Foo { -//// constructor(/*/**/) { } -////} - -goTo.marker(); +/// + +////class Foo { +//// constructor(/*/**/) { } +////} + +goTo.marker(); // verify.completionListIsEmpty(); // TODO: difference between LS and FourSlash \ No newline at end of file diff --git a/tests/cases/fourslash/unclosedFunctionErrorRecovery.ts b/tests/cases/fourslash/unclosedFunctionErrorRecovery.ts index 0f5007da2d..790d9ea689 100644 --- a/tests/cases/fourslash/unclosedFunctionErrorRecovery.ts +++ b/tests/cases/fourslash/unclosedFunctionErrorRecovery.ts @@ -1,8 +1,8 @@ -/// - -////function alpha() { -//// -////function beta() { /*1*/alpha()/*2*/; } -//// - +/// + +////function alpha() { +//// +////function beta() { /*1*/alpha()/*2*/; } +//// + verify.not.errorExistsBetweenMarkers("1", "2"); \ No newline at end of file diff --git a/tests/cases/fourslash/unclosedFunctionErrorRecovery3.ts b/tests/cases/fourslash/unclosedFunctionErrorRecovery3.ts index f9bfe7bdc1..bcb79811a6 100644 --- a/tests/cases/fourslash/unclosedFunctionErrorRecovery3.ts +++ b/tests/cases/fourslash/unclosedFunctionErrorRecovery3.ts @@ -1,6 +1,6 @@ -/// - -//// class alpha { static beta() return 5; } } -//// /**/ var gamma = alpha.beta() * 5; - +/// + +//// class alpha { static beta() return 5; } } +//// /**/ var gamma = alpha.beta() * 5; + verify.not.errorExistsAfterMarker(); \ No newline at end of file diff --git a/tests/cases/fourslash/unclosedMultilineStringLiteralErrorRecovery.ts b/tests/cases/fourslash/unclosedMultilineStringLiteralErrorRecovery.ts index 357d419a92..cf3a51c9f0 100644 --- a/tests/cases/fourslash/unclosedMultilineStringLiteralErrorRecovery.ts +++ b/tests/cases/fourslash/unclosedMultilineStringLiteralErrorRecovery.ts @@ -1,10 +1,10 @@ -/// - -////function alpha() { -//// var x = "x\ -//// -//// /**/ -//// var y = 1; -////} - +/// + +////function alpha() { +//// var x = "x\ +//// +//// /**/ +//// var y = 1; +////} + verify.not.errorExistsAfterMarker(); \ No newline at end of file diff --git a/tests/cases/fourslash/unclosedStringLiteralAutoformating.ts b/tests/cases/fourslash/unclosedStringLiteralAutoformating.ts index 3c3afd9354..2f3c0e7494 100644 --- a/tests/cases/fourslash/unclosedStringLiteralAutoformating.ts +++ b/tests/cases/fourslash/unclosedStringLiteralAutoformating.ts @@ -1,10 +1,10 @@ -/// - -////var x = /*1*/"asd/*2*/ -////class Foo { -//// /**/ - -//verify.errorExistsBetweenMarkers("1", "2"); -goTo.marker(); -edit.insert("}"); +/// + +////var x = /*1*/"asd/*2*/ +////class Foo { +//// /**/ + +//verify.errorExistsBetweenMarkers("1", "2"); +goTo.marker(); +edit.insert("}"); verify.currentLineContentIs("}"); \ No newline at end of file diff --git a/tests/cases/fourslash/unclosedStringLiteralErrorRecovery2.ts b/tests/cases/fourslash/unclosedStringLiteralErrorRecovery2.ts index a6be78c6b5..ccae2bd4a7 100644 --- a/tests/cases/fourslash/unclosedStringLiteralErrorRecovery2.ts +++ b/tests/cases/fourslash/unclosedStringLiteralErrorRecovery2.ts @@ -1,12 +1,12 @@ -/// - -////function alpha() { -//// -//// var x = "x\ -//// var y = 1; -//// function beta() { } -//// beta(; -//// /**/ -////} -verify.not.errorExistsAfterMarker(); - +/// + +////function alpha() { +//// +//// var x = "x\ +//// var y = 1; +//// function beta() { } +//// beta(; +//// /**/ +////} +verify.not.errorExistsAfterMarker(); + diff --git a/tests/cases/fourslash/unclosedStringLiteralErrorRecovery3.ts b/tests/cases/fourslash/unclosedStringLiteralErrorRecovery3.ts index a2d94e683a..b1ef837a98 100644 --- a/tests/cases/fourslash/unclosedStringLiteralErrorRecovery3.ts +++ b/tests/cases/fourslash/unclosedStringLiteralErrorRecovery3.ts @@ -1,11 +1,11 @@ -/// - -////function alpha() { -//// -//// var x = "x\ -//// -//// /**/var y = 1; -//// -////} - +/// + +////function alpha() { +//// +//// var x = "x\ +//// +//// /**/var y = 1; +//// +////} + verify.not.errorExistsAfterMarker(); \ No newline at end of file diff --git a/tests/cases/fourslash/unclosedStringLiteralErrorRecovery4.ts b/tests/cases/fourslash/unclosedStringLiteralErrorRecovery4.ts index 48c49f5064..4d849a1533 100644 --- a/tests/cases/fourslash/unclosedStringLiteralErrorRecovery4.ts +++ b/tests/cases/fourslash/unclosedStringLiteralErrorRecovery4.ts @@ -1,9 +1,9 @@ -/// - -////function alpha() { -//// var x = "x -/////**/var y = "y"; -////} - -goTo.marker(); +/// + +////function alpha() { +//// var x = "x +/////**/var y = "y"; +////} + +goTo.marker(); verify.not.errorExistsAfterMarker(); \ No newline at end of file diff --git a/tests/cases/fourslash/underscoreTyping1.ts b/tests/cases/fourslash/underscoreTyping1.ts index fddafe5e88..be7d20427e 100644 --- a/tests/cases/fourslash/underscoreTyping1.ts +++ b/tests/cases/fourslash/underscoreTyping1.ts @@ -1,6 +1,6 @@ /// - -// @module: CommonJS + +// @module: CommonJS //// interface Dictionary { //// [x: string]: T; diff --git a/tests/cases/fourslash/unknownVariableErrorRecovery.ts b/tests/cases/fourslash/unknownVariableErrorRecovery.ts index b2e6adba98..c10df493f3 100644 --- a/tests/cases/fourslash/unknownVariableErrorRecovery.ts +++ b/tests/cases/fourslash/unknownVariableErrorRecovery.ts @@ -1,9 +1,9 @@ -/// - -////var foo = [1, 2, 3]; -////for (var bar = 0; foo[bar] < 5; bear/**/++ ) { -//// foo[bar] = 0; -////} - -verify.not.errorExistsAfterMarker(); - +/// + +////var foo = [1, 2, 3]; +////for (var bar = 0; foo[bar] < 5; bear/**/++ ) { +//// foo[bar] = 0; +////} + +verify.not.errorExistsAfterMarker(); + diff --git a/tests/cases/fourslash/whiteSpaceTrimming.ts b/tests/cases/fourslash/whiteSpaceTrimming.ts index 3e842e5a3a..a77726f3ec 100644 --- a/tests/cases/fourslash/whiteSpaceTrimming.ts +++ b/tests/cases/fourslash/whiteSpaceTrimming.ts @@ -1,10 +1,10 @@ -/// +/// ////if (true) { -//// // -//// /*err*/} - -goTo.marker('err'); -edit.insert("\n"); - -verify.currentFileContentIs("if (true) { \n // \n\n}"); +//// // +//// /*err*/} + +goTo.marker('err'); +edit.insert("\n"); + +verify.currentFileContentIs("if (true) { \n // \n\n}"); diff --git a/tests/cases/unittests/services/documentRegistry.ts b/tests/cases/unittests/services/documentRegistry.ts index 339c886632..8fc466b857 100644 --- a/tests/cases/unittests/services/documentRegistry.ts +++ b/tests/cases/unittests/services/documentRegistry.ts @@ -35,4 +35,40 @@ describe("DocumentRegistry", () => { assert(f3 === f4, "Changed module: Expected to have the same instance of the document"); }); + + it("Acquiring document gets correct version 1", () => { + var documentRegistry = ts.createDocumentRegistry(); + var defaultCompilerOptions = ts.getDefaultCompilerOptions(); + + // Simulate one LS getting the document. + var f1 = documentRegistry.acquireDocument("file1.ts", defaultCompilerOptions, ts.ScriptSnapshot.fromString("var x = 1;"), /* version */ "1"); + + // Simulate another LS getting the document at another version. + var f2 = documentRegistry.acquireDocument("file1.ts", defaultCompilerOptions, ts.ScriptSnapshot.fromString("var x = 1;"), /* version */ "2"); + + assert(f2.version === "2"); + }); + + it("Acquiring document gets correct version 2", () => { + var documentRegistry = ts.createDocumentRegistry(); + var defaultCompilerOptions = ts.getDefaultCompilerOptions(); + + var contents = "var x = 1;" + var snapshot = ts.ScriptSnapshot.fromString(contents); + + // Always treat any change as a full change. + snapshot.getChangeRange = old => ts.createTextChangeRange(ts.createTextSpan(0, contents.length), contents.length); + + // Simulate one LS getting the document. + var f1 = documentRegistry.acquireDocument("file1.ts", defaultCompilerOptions, snapshot, /* version */ "1"); + + // Simulate another LS getting that document. + var f2 = documentRegistry.acquireDocument("file1.ts", defaultCompilerOptions, snapshot, /* version */ "1"); + + // Now LS1 updates their document. + var f3 = documentRegistry.updateDocument("file1.ts", defaultCompilerOptions, snapshot, /* version */ "2"); + + // Now LS2 tries to update their document. + var f4 = documentRegistry.updateDocument("file1.ts", defaultCompilerOptions, snapshot, /* version */ "3"); + }); }); \ No newline at end of file diff --git a/tests/cases/unittests/services/preProcessFile.ts b/tests/cases/unittests/services/preProcessFile.ts index e0d397838e..c504f444f1 100644 --- a/tests/cases/unittests/services/preProcessFile.ts +++ b/tests/cases/unittests/services/preProcessFile.ts @@ -26,7 +26,7 @@ describe('PreProcessFile:', function () { var expectedImportedFile = expectedImportedFiles[i]; assert.equal(resultImportedFile.fileName, expectedImportedFile.fileName, "Imported file path does not match expected. Expected: " + expectedImportedFile.fileName + ". Actual: " + resultImportedFile.fileName + "."); - + assert.equal(resultImportedFile.pos, expectedImportedFile.pos, "Imported file position does not match expected. Expected: " + expectedImportedFile.pos + ". Actual: " + resultImportedFile.pos + "."); assert.equal(resultImportedFile.end, expectedImportedFile.end, "Imported file length does not match expected. Expected: " + expectedImportedFile.end + ". Actual: " + resultImportedFile.end + "."); @@ -37,7 +37,7 @@ describe('PreProcessFile:', function () { var expectedReferencedFile = expectedReferencedFiles[i]; assert.equal(resultReferencedFile.fileName, expectedReferencedFile.fileName, "Referenced file path does not match expected. Expected: " + expectedReferencedFile.fileName + ". Actual: " + resultReferencedFile.fileName + "."); - + assert.equal(resultReferencedFile.pos, expectedReferencedFile.pos, "Referenced file position does not match expected. Expected: " + expectedReferencedFile.pos + ". Actual: " + resultReferencedFile.pos + "."); assert.equal(resultReferencedFile.end, expectedReferencedFile.end, "Referenced file length does not match expected. Expected: " + expectedReferencedFile.end + ". Actual: " + resultReferencedFile.end + "."); @@ -108,6 +108,48 @@ describe('PreProcessFile:', function () { isLibFile: false }) }); + + it("Correctly return ES6 imports", function () { + test("import * as ns from \"m1\";" + "\n" + + "import def, * as ns from \"m2\";" + "\n" + + "import def from \"m3\";" + "\n" + + "import {a} from \"m4\";" + "\n" + + "import {a as A} from \"m5\";" + "\n" + + "import {a as A, b, c as C} from \"m6\";" + "\n" + + "import def , {a, b, c as C} from \"m7\";" + "\n", + true, + { + referencedFiles: [], + importedFiles: [ + { fileName: "m1", pos: 20, end: 22 }, + { fileName: "m2", pos: 51, end: 53 }, + { fileName: "m3", pos: 73, end: 75 }, + { fileName: "m4", pos: 95, end: 97 }, + { fileName: "m5", pos: 122, end: 124 }, + { fileName: "m6", pos: 160, end: 162 }, + { fileName: "m7", pos: 199, end: 201 } + ], + isLibFile: false + }) + }); + + it("Correctly return ES6 exports", function () { + test("export * from \"m1\";" + "\n" + + "export {a} from \"m2\";" + "\n" + + "export {a as A} from \"m3\";" + "\n" + + "export {a as A, b, c as C} from \"m4\";" + "\n", + true, + { + referencedFiles: [], + importedFiles: [ + { fileName: "m1", pos: 14, end: 16 }, + { fileName: "m2", pos: 36, end: 38 }, + { fileName: "m3", pos: 63, end: 65 }, + { fileName: "m4", pos: 101, end: 103 }, + ], + isLibFile: false + }) + }); }); });