diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c169dcb83ca..5c6a8b59119 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -230,7 +230,7 @@ namespace ts { getSuggestionForNonexistentSymbol: (location, name, meaning) => unescapeLeadingUnderscores(getSuggestionForNonexistentSymbol(location, escapeLeadingUnderscores(name), meaning)), getBaseConstraintOfType, resolveName(name, location, meaning) { - return resolveName(location, escapeLeadingUnderscores(name), meaning, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); + return resolveName(location, escapeLeadingUnderscores(name), meaning, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false); }, getJsxNamespace: () => unescapeLeadingUnderscores(getJsxNamespace()), }; @@ -865,17 +865,22 @@ namespace ts { } } - // Resolve a given name for a given meaning at a given location. An error is reported if the name was not found and - // the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with - // the given name can be found. + /** + * Resolve a given name for a given meaning at a given location. An error is reported if the name was not found and + * the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with + * the given name can be found. + * + * @param isUse If true, this will count towards --noUnusedLocals / --noUnusedParameters. + */ function resolveName( location: Node | undefined, name: __String, meaning: SymbolFlags, nameNotFoundMessage: DiagnosticMessage | undefined, nameArg: __String | Identifier, + isUse: boolean, suggestedNameNotFoundMessage?: DiagnosticMessage): Symbol { - return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, getSymbol, suggestedNameNotFoundMessage); + return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, getSymbol, suggestedNameNotFoundMessage); } function resolveNameHelper( @@ -884,6 +889,7 @@ namespace ts { meaning: SymbolFlags, nameNotFoundMessage: DiagnosticMessage, nameArg: __String | Identifier, + isUse: boolean, lookup: typeof getSymbol, suggestedNameNotFoundMessage?: DiagnosticMessage): Symbol { const originalLocation = location; // needed for did-you-mean error reporting, which gathers candidates starting from the original location @@ -1114,7 +1120,7 @@ namespace ts { // We just climbed up parents looking for the name, meaning that we started in a descendant node of `lastLocation`. // If `result === lastLocation.symbol`, that means that we are somewhere inside `lastLocation` looking up a name, and resolving to `lastLocation` itself. // That means that this is a self-reference of `lastLocation`, and shouldn't count this when considering whether `lastLocation` is used. - if (result && nameNotFoundMessage && noUnusedIdentifiers && result !== lastLocation.symbol) { + if (isUse && result && nameNotFoundMessage && noUnusedIdentifiers && result !== lastLocation.symbol) { result.isReferenced = true; } @@ -1267,7 +1273,7 @@ namespace ts { function checkAndReportErrorForUsingTypeAsNamespace(errorLocation: Node, name: __String, meaning: SymbolFlags): boolean { if (meaning === SymbolFlags.Namespace) { - const symbol = resolveSymbol(resolveName(errorLocation, name, SymbolFlags.Type & ~SymbolFlags.Value, /*nameNotFoundMessage*/undefined, /*nameArg*/ undefined)); + const symbol = resolveSymbol(resolveName(errorLocation, name, SymbolFlags.Type & ~SymbolFlags.Value, /*nameNotFoundMessage*/undefined, /*nameArg*/ undefined, /*isUse*/ false)); const parent = errorLocation.parent; if (symbol) { if (isQualifiedName(parent)) { @@ -1298,7 +1304,7 @@ namespace ts { error(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, unescapeLeadingUnderscores(name)); return true; } - const symbol = resolveSymbol(resolveName(errorLocation, name, SymbolFlags.Type & ~SymbolFlags.Value, /*nameNotFoundMessage*/undefined, /*nameArg*/ undefined)); + const symbol = resolveSymbol(resolveName(errorLocation, name, SymbolFlags.Type & ~SymbolFlags.Value, /*nameNotFoundMessage*/undefined, /*nameArg*/ undefined, /*isUse*/ false)); if (symbol && !(symbol.flags & SymbolFlags.NamespaceModule)) { error(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, unescapeLeadingUnderscores(name)); return true; @@ -1309,14 +1315,14 @@ namespace ts { function checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation: Node, name: __String, meaning: SymbolFlags): boolean { if (meaning & (SymbolFlags.Value & ~SymbolFlags.NamespaceModule & ~SymbolFlags.Type)) { - const symbol = resolveSymbol(resolveName(errorLocation, name, SymbolFlags.NamespaceModule & ~SymbolFlags.Value, /*nameNotFoundMessage*/undefined, /*nameArg*/ undefined)); + const symbol = resolveSymbol(resolveName(errorLocation, name, SymbolFlags.NamespaceModule & ~SymbolFlags.Value, /*nameNotFoundMessage*/undefined, /*nameArg*/ undefined, /*isUse*/ false)); if (symbol) { error(errorLocation, Diagnostics.Cannot_use_namespace_0_as_a_value, unescapeLeadingUnderscores(name)); return true; } } else if (meaning & (SymbolFlags.Type & ~SymbolFlags.NamespaceModule & ~SymbolFlags.Value)) { - const symbol = resolveSymbol(resolveName(errorLocation, name, SymbolFlags.NamespaceModule & ~SymbolFlags.Type, /*nameNotFoundMessage*/undefined, /*nameArg*/ undefined)); + const symbol = resolveSymbol(resolveName(errorLocation, name, SymbolFlags.NamespaceModule & ~SymbolFlags.Type, /*nameNotFoundMessage*/undefined, /*nameArg*/ undefined, /*isUse*/ false)); if (symbol) { error(errorLocation, Diagnostics.Cannot_use_namespace_0_as_a_type, unescapeLeadingUnderscores(name)); return true; @@ -1640,7 +1646,7 @@ namespace ts { if (name.kind === SyntaxKind.Identifier) { const message = meaning === SymbolFlags.Namespace ? Diagnostics.Cannot_find_namespace_0 : Diagnostics.Cannot_find_name_0; - symbol = resolveName(location || name, name.escapedText, meaning, ignoreErrors ? undefined : message, name); + symbol = resolveName(location || name, name.escapedText, meaning, ignoreErrors ? undefined : message, name, /*isUse*/ true); if (!symbol) { return undefined; } @@ -2314,7 +2320,7 @@ namespace ts { } const firstIdentifier = getFirstIdentifier(entityName); - const symbol = resolveName(enclosingDeclaration, firstIdentifier.escapedText, meaning, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined); + const symbol = resolveName(enclosingDeclaration, firstIdentifier.escapedText, meaning, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false); // Verify if the symbol is accessible return (symbol && hasVisibleDeclarations(symbol, /*shouldComputeAliasToMakeVisible*/ true)) || { @@ -3971,7 +3977,7 @@ namespace ts { function collectLinkedAliases(node: Identifier): Node[] { let exportSymbol: Symbol; if (node.parent && node.parent.kind === SyntaxKind.ExportAssignment) { - exportSymbol = resolveName(node.parent, node.escapedText, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias, Diagnostics.Cannot_find_name_0, node); + exportSymbol = resolveName(node.parent, node.escapedText, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias, Diagnostics.Cannot_find_name_0, node, /*isUse*/ false); } else if (node.parent.kind === SyntaxKind.ExportSpecifier) { exportSymbol = getTargetOfExportSpecifier(node.parent, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias); @@ -3993,7 +3999,7 @@ namespace ts { const internalModuleReference = (declaration).moduleReference; const firstIdentifier = getFirstIdentifier(internalModuleReference); const importSymbol = resolveName(declaration, firstIdentifier.escapedText, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace, - undefined, undefined); + undefined, undefined, /*isUse*/ false); if (importSymbol) { buildVisibleNodeList(importSymbol.declarations); } @@ -6408,7 +6414,7 @@ namespace ts { let paramSymbol = param.symbol; // Include parameter symbol instead of property symbol in the signature if (paramSymbol && !!(paramSymbol.flags & SymbolFlags.Property) && !isBindingPattern(param.name)) { - const resolvedSymbol = resolveName(param, paramSymbol.escapedName, SymbolFlags.Value, undefined, undefined); + const resolvedSymbol = resolveName(param, paramSymbol.escapedName, SymbolFlags.Value, undefined, undefined, /*isUse*/ false); paramSymbol = resolvedSymbol; } if (i === 0 && paramSymbol.escapedName === "this") { @@ -7085,7 +7091,8 @@ namespace ts { } function getGlobalSymbol(name: __String, meaning: SymbolFlags, diagnostic: DiagnosticMessage): Symbol { - return resolveName(undefined, name, meaning, diagnostic, name); + // Don't track references for global symbols anyway, so value if `isReference` is arbitrary + return resolveName(undefined, name, meaning, diagnostic, name, /*isUse*/ false); } function getGlobalType(name: __String, arity: 0, reportErrors: boolean): ObjectType; @@ -10832,7 +10839,15 @@ namespace ts { function getResolvedSymbol(node: Identifier): Symbol { const links = getNodeLinks(node); if (!links.resolvedSymbol) { - links.resolvedSymbol = !nodeIsMissing(node) && resolveName(node, node.escapedText, SymbolFlags.Value | SymbolFlags.ExportValue, Diagnostics.Cannot_find_name_0, node, Diagnostics.Cannot_find_name_0_Did_you_mean_1) || unknownSymbol; + links.resolvedSymbol = !nodeIsMissing(node) && + resolveName( + node, + node.escapedText, + SymbolFlags.Value | SymbolFlags.ExportValue, + Diagnostics.Cannot_find_name_0, + node, + !isWriteOnlyAccess(node), + Diagnostics.Cannot_find_name_0_Did_you_mean_1) || unknownSymbol; } return links.resolvedSymbol; } @@ -14428,7 +14443,7 @@ namespace ts { // And if there is no reactNamespace/jsxFactory's symbol in scope when targeting React emit, we should issue an error. const reactRefErr = diagnostics && compilerOptions.jsx === JsxEmit.React ? Diagnostics.Cannot_find_name_0 : undefined; const reactNamespace = getJsxNamespace(); - const reactSym = resolveName(node.tagName, reactNamespace, SymbolFlags.Value, reactRefErr, reactNamespace); + const reactSym = resolveName(node.tagName, reactNamespace, SymbolFlags.Value, reactRefErr, reactNamespace, /*isUse*/ true); if (reactSym) { // Mark local symbol as referenced here because it might not have been marked // if jsx emit was not react as there wont be error being emitted @@ -14704,7 +14719,7 @@ namespace ts { checkPropertyNotUsedBeforeDeclaration(prop, node, right); - markPropertyAsReferenced(prop); + markPropertyAsReferenced(prop, node); getNodeLinks(node).resolvedSymbol = prop; @@ -14804,7 +14819,7 @@ namespace ts { } function getSuggestionForNonexistentSymbol(location: Node, name: __String, meaning: SymbolFlags): __String { - const result = resolveNameHelper(location, name, meaning, /*nameNotFoundMessage*/ undefined, name, (symbols, name, meaning) => { + const result = resolveNameHelper(location, name, meaning, /*nameNotFoundMessage*/ undefined, name, /*isUse*/ false, (symbols, name, meaning) => { const symbol = getSymbol(symbols, name, meaning); if (symbol) { // Sometimes the symbol is found when location is a return type of a function: `typeof x` and `x` is declared in the body of the function @@ -14884,11 +14899,12 @@ namespace ts { return bestCandidate; } - function markPropertyAsReferenced(prop: Symbol) { + function markPropertyAsReferenced(prop: Symbol, nodeForCheckWriteOnly: Node | undefined) { if (prop && noUnusedIdentifiers && (prop.flags & SymbolFlags.ClassMember) && - prop.valueDeclaration && hasModifier(prop.valueDeclaration, ModifierFlags.Private)) { + prop.valueDeclaration && hasModifier(prop.valueDeclaration, ModifierFlags.Private) + && !(nodeForCheckWriteOnly && isWriteOnlyAccess(nodeForCheckWriteOnly))) { if (getCheckFlags(prop) & CheckFlags.Instantiated) { getSymbolLinks(prop).target.isReferenced = true; } @@ -15153,7 +15169,6 @@ namespace ts { let argCount: number; // Apparent number of arguments we will have in this call let typeArguments: NodeArray; // Type arguments (undefined if none) let callIsIncomplete: boolean; // In incomplete call we want to be lenient when we have too few arguments - let isDecorator: boolean; let spreadArgIndex = -1; if (isJsxOpeningLikeElement(node)) { @@ -15187,7 +15202,6 @@ namespace ts { } } else if (node.kind === SyntaxKind.Decorator) { - isDecorator = true; typeArguments = undefined; argCount = getEffectiveArgumentCount(node, /*args*/ undefined, signature); } @@ -16582,7 +16596,7 @@ namespace ts { } // Make sure require is not a local function if (!isIdentifier(node.expression)) throw Debug.fail(); - const resolvedRequire = resolveName(node.expression, node.expression.escapedText, SymbolFlags.Value, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); + const resolvedRequire = resolveName(node.expression, node.expression.escapedText, SymbolFlags.Value, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true); if (!resolvedRequire) { // project does not contain symbol named 'require' - assume commonjs require return true; @@ -19579,8 +19593,11 @@ namespace ts { } function markEntityNameOrEntityExpressionAsReference(typeName: EntityNameOrEntityNameExpression) { - const rootName = typeName && getFirstIdentifier(typeName); - const rootSymbol = rootName && resolveName(rootName, rootName.escapedText, (typeName.kind === SyntaxKind.Identifier ? SymbolFlags.Type : SymbolFlags.Namespace) | SymbolFlags.Alias, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); + if (!typeName) return; + + const rootName = getFirstIdentifier(typeName); + const meaning = (typeName.kind === SyntaxKind.Identifier ? SymbolFlags.Type : SymbolFlags.Namespace) | SymbolFlags.Alias; + const rootSymbol = resolveName(rootName, rootName.escapedText, meaning, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isRefernce*/ true); if (rootSymbol && rootSymbol.flags & SymbolFlags.Alias && symbolIsValue(rootSymbol) @@ -19874,7 +19891,7 @@ namespace ts { !isParameterPropertyDeclaration(parameter) && !parameterIsThisKeyword(parameter) && !parameterNameStartsWithUnderscore(name)) { - error(name, Diagnostics._0_is_declared_but_never_used, unescapeLeadingUnderscores(local.escapedName)); + error(name, Diagnostics._0_is_declared_but_its_value_is_never_read, unescapeLeadingUnderscores(local.escapedName)); } } else if (compilerOptions.noUnusedLocals) { @@ -19903,7 +19920,7 @@ namespace ts { } if (!isRemovedPropertyFromObjectSpread(node.kind === SyntaxKind.Identifier ? node.parent : node)) { - error(node, Diagnostics._0_is_declared_but_never_used, name); + error(node, Diagnostics._0_is_declared_but_its_value_is_never_read, name); } } @@ -19921,13 +19938,13 @@ namespace ts { for (const member of node.members) { if (member.kind === SyntaxKind.MethodDeclaration || member.kind === SyntaxKind.PropertyDeclaration) { if (!member.symbol.isReferenced && hasModifier(member, ModifierFlags.Private)) { - error(member.name, Diagnostics._0_is_declared_but_never_used, unescapeLeadingUnderscores(member.symbol.escapedName)); + error(member.name, Diagnostics._0_is_declared_but_its_value_is_never_read, unescapeLeadingUnderscores(member.symbol.escapedName)); } } else if (member.kind === SyntaxKind.Constructor) { for (const parameter of (member).parameters) { if (!parameter.symbol.isReferenced && hasModifier(parameter, ModifierFlags.Private)) { - error(parameter.name, Diagnostics.Property_0_is_declared_but_never_used, unescapeLeadingUnderscores(parameter.symbol.escapedName)); + error(parameter.name, Diagnostics.Property_0_is_declared_but_its_value_is_never_read, unescapeLeadingUnderscores(parameter.symbol.escapedName)); } } } @@ -19948,7 +19965,7 @@ namespace ts { } for (const typeParameter of node.typeParameters) { if (!getMergedSymbol(typeParameter.symbol).isReferenced) { - error(typeParameter.name, Diagnostics._0_is_declared_but_never_used, unescapeLeadingUnderscores(typeParameter.symbol.escapedName)); + error(typeParameter.name, Diagnostics._0_is_declared_but_its_value_is_never_read, unescapeLeadingUnderscores(typeParameter.symbol.escapedName)); } } } @@ -20179,7 +20196,7 @@ namespace ts { const symbol = getSymbolOfNode(node); if (symbol.flags & SymbolFlags.FunctionScopedVariable) { if (!isIdentifier(node.name)) throw Debug.fail(); - const localDeclarationSymbol = resolveName(node, node.name.escapedText, SymbolFlags.Variable, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined); + const localDeclarationSymbol = resolveName(node, node.name.escapedText, SymbolFlags.Variable, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false); if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & SymbolFlags.BlockScopedVariable) { @@ -20234,7 +20251,7 @@ namespace ts { else if (n.kind === SyntaxKind.Identifier) { // check FunctionLikeDeclaration.locals (stores parameters\function local variable) // if it contains entry with a specified name - const symbol = resolveName(n, (n).escapedText, SymbolFlags.Value | SymbolFlags.Alias, /*nameNotFoundMessage*/undefined, /*nameArg*/undefined); + const symbol = resolveName(n, (n).escapedText, SymbolFlags.Value | SymbolFlags.Alias, /*nameNotFoundMessage*/undefined, /*nameArg*/undefined, /*isUse*/ false); if (!symbol || symbol === unknownSymbol || !symbol.valueDeclaration) { return; } @@ -20318,7 +20335,7 @@ namespace ts { const parentType = getTypeForBindingElementParent(parent); const name = node.propertyName || node.name; const property = getPropertyOfType(parentType, getTextOfPropertyName(name)); - markPropertyAsReferenced(property); + markPropertyAsReferenced(property, /*nodeForCheckWriteOnly*/ undefined); // A destructuring is never a write-only reference. if (parent.initializer && property) { checkPropertyAccessibility(parent, parent.initializer, parentType, property); } @@ -22254,7 +22271,7 @@ namespace ts { const exportedName = node.propertyName || node.name; // find immediate value referenced by exported name (SymbolFlags.Alias is set so we don't chase down aliases) const symbol = resolveName(exportedName, exportedName.escapedText, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias, - /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); + /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true); if (symbol && (symbol === undefinedSymbol || isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) { error(exportedName, Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, unescapeLeadingUnderscores(exportedName.escapedText)); } @@ -23359,7 +23376,7 @@ namespace ts { const container = getEnclosingBlockScopeContainer(symbol.valueDeclaration); if (isStatementWithLocals(container)) { const nodeLinks = getNodeLinks(symbol.valueDeclaration); - if (!!resolveName(container.parent, symbol.escapedName, SymbolFlags.Value, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined)) { + if (resolveName(container.parent, symbol.escapedName, SymbolFlags.Value, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)) { // redeclaration - always should be renamed links.isDeclarationWithCollidingName = true; } @@ -23669,7 +23686,7 @@ namespace ts { } } - return resolveName(location, reference.escapedText, SymbolFlags.Value | SymbolFlags.ExportValue | SymbolFlags.Alias, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined); + return resolveName(location, reference.escapedText, SymbolFlags.Value | SymbolFlags.ExportValue | SymbolFlags.Alias, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true); } function getReferencedValueDeclaration(reference: Identifier): Declaration { @@ -23992,7 +24009,7 @@ namespace ts { return quickResult; } - let lastStatic: Node, lastPrivate: Node, lastProtected: Node, lastDeclare: Node, lastAsync: Node, lastReadonly: Node; + let lastStatic: Node, lastDeclare: Node, lastAsync: Node, lastReadonly: Node; let flags = ModifierFlags.None; for (const modifier of node.modifiers) { if (modifier.kind !== SyntaxKind.ReadonlyKeyword) { @@ -24014,13 +24031,6 @@ namespace ts { case SyntaxKind.PrivateKeyword: const text = visibilityToString(modifierToFlag(modifier.kind)); - if (modifier.kind === SyntaxKind.ProtectedKeyword) { - lastProtected = modifier; - } - else if (modifier.kind === SyntaxKind.PrivateKeyword) { - lastPrivate = modifier; - } - if (flags & ModifierFlags.AccessibilityModifier) { return grammarErrorOnNode(modifier, Diagnostics.Accessibility_modifier_already_seen); } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 9c0b549da50..af7f6d6c949 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3102,7 +3102,7 @@ "category": "Message", "code": 6132 }, - "'{0}' is declared but never used.": { + "'{0}' is declared but its value is never read.": { "category": "Error", "code": 6133 }, @@ -3122,7 +3122,7 @@ "category": "Error", "code": 6137 }, - "Property '{0}' is declared but never used.": { + "Property '{0}' is declared but its value is never read.": { "category": "Error", "code": 6138 }, diff --git a/src/compiler/transformers/es2017.ts b/src/compiler/transformers/es2017.ts index 85a44e35983..90c9063c140 100644 --- a/src/compiler/transformers/es2017.ts +++ b/src/compiler/transformers/es2017.ts @@ -21,9 +21,6 @@ namespace ts { const compilerOptions = context.getCompilerOptions(); const languageVersion = getEmitScriptTarget(compilerOptions); - // These variables contain state that changes as we descend into the tree. - let currentSourceFile: SourceFile; - /** * Keeps track of whether expression substitution has been enabled for specific edge cases. * They are persisted between each SourceFile transformation and should not be reset. @@ -51,12 +48,8 @@ namespace ts { return node; } - currentSourceFile = node; - const visited = visitEachChild(node, visitor, context); addEmitHelpers(visited, context.readEmitHelpers()); - - currentSourceFile = undefined; return visited; } diff --git a/src/compiler/transformers/generators.ts b/src/compiler/transformers/generators.ts index 20195adeef4..06ecae3a63f 100644 --- a/src/compiler/transformers/generators.ts +++ b/src/compiler/transformers/generators.ts @@ -244,7 +244,6 @@ namespace ts { const previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; - let currentSourceFile: SourceFile; let renamedCatchVariables: Map; let renamedCatchVariableDeclarations: Identifier[]; @@ -300,12 +299,9 @@ namespace ts { return node; } - currentSourceFile = node; const visited = visitEachChild(node, visitor, context); addEmitHelpers(visited, context.readEmitHelpers()); - - currentSourceFile = undefined; return visited; } diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index d5e584c7ac5..b109b166f5c 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -100,7 +100,6 @@ namespace ts { const commandLine = parseCommandLine(args); let configFileName: string; // Configuration file name (if any) let cachedConfigFileText: string; // Cached configuration file text, used for reparsing (if any) - let configFileWatcher: FileWatcher; // Configuration file watcher let directoryWatcher: FileWatcher; // Directory watcher to monitor source file addition/removal let cachedProgram: Program; // Program cached from last compilation let rootFileNames: string[]; // Root fileNames for compilation @@ -189,7 +188,7 @@ namespace ts { return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); } if (configFileName) { - configFileWatcher = sys.watchFile(configFileName, configFileChanged); + sys.watchFile(configFileName, configFileChanged); } if (sys.watchDirectory && configFileName) { const directory = ts.getDirectoryPath(configFileName); diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index ee450344827..64d5bcaac62 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -500,13 +500,11 @@ namespace ts { case SyntaxKind.ArrowFunction: return true; default: - staticAssertNever(node); + assertTypeIsNever(node); return false; } } - function staticAssertNever(_: never): void {} - // Gets the nearest enclosing block scope container that has the provided node // as a descendant, that is not the provided node. export function getEnclosingBlockScopeContainer(node: Node): Node { @@ -3504,6 +3502,46 @@ namespace ts { export function getCombinedLocalAndExportSymbolFlags(symbol: Symbol): SymbolFlags { return symbol.exportSymbol ? symbol.exportSymbol.flags | symbol.flags : symbol.flags; } + + export function isWriteOnlyAccess(node: Node) { + return accessKind(node) === AccessKind.Write; + } + + export function isWriteAccess(node: Node) { + return accessKind(node) !== AccessKind.Read; + } + + const enum AccessKind { + /** Only reads from a variable. */ + Read, + /** Only writes to a variable without using the result. E.g.: `x++;`. */ + Write, + /** Writes to a variable and uses the result as an expression. E.g.: `f(x++);`. */ + ReadWrite + } + function accessKind(node: Node): AccessKind { + const { parent } = node; + if (!parent) return AccessKind.Read; + + switch (parent.kind) { + case SyntaxKind.PostfixUnaryExpression: + case SyntaxKind.PrefixUnaryExpression: + const { operator } = parent as PrefixUnaryExpression | PostfixUnaryExpression; + return operator === SyntaxKind.PlusPlusToken || operator === SyntaxKind.MinusMinusToken ? writeOrReadWrite() : AccessKind.Read; + case SyntaxKind.BinaryExpression: + const { left, operatorToken } = parent as BinaryExpression; + return left === node && isAssignmentOperator(operatorToken.kind) ? writeOrReadWrite() : AccessKind.Read; + case SyntaxKind.PropertyAccessExpression: + return (parent as PropertyAccessExpression).name !== node ? AccessKind.Read : accessKind(parent); + default: + return AccessKind.Read; + } + + function writeOrReadWrite(): AccessKind { + // If grandparent is not an ExpressionStatement, this is used as an expression in addition to having a side effect. + return parent.parent && parent.parent.kind === SyntaxKind.ExpressionStatement ? AccessKind.Write : AccessKind.ReadWrite; + } + } } namespace ts { diff --git a/src/harness/compilerRunner.ts b/src/harness/compilerRunner.ts index a600c7dd857..dc3aa64c6ac 100644 --- a/src/harness/compilerRunner.ts +++ b/src/harness/compilerRunner.ts @@ -11,19 +11,13 @@ const enum CompilerTestType { class CompilerBaselineRunner extends RunnerBase { private basePath = "tests/cases"; private testSuiteName: TestRunnerKind; - private errors: boolean; private emit: boolean; - private decl: boolean; - private output: boolean; public options: string; constructor(public testType: CompilerTestType) { super(); - this.errors = true; this.emit = true; - this.decl = true; - this.output = true; if (testType === CompilerTestType.Conformance) { this.testSuiteName = "conformance"; } @@ -214,26 +208,14 @@ class CompilerBaselineRunner extends RunnerBase { private parseOptions() { if (this.options && this.options.length > 0) { - this.errors = false; this.emit = false; - this.decl = false; - this.output = false; const opts = this.options.split(","); for (let i = 0; i < opts.length; i++) { switch (opts[i]) { - case "error": - this.errors = true; - break; case "emit": this.emit = true; break; - case "decl": - this.decl = true; - break; - case "output": - this.output = true; - break; default: throw new Error("unsupported flag"); } diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 598cfc2fd7e..d89a4677ef9 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -2758,11 +2758,11 @@ namespace FourSlash { } } - private getSelection() { - return ({ + private getSelection(): ts.TextRange { + return { pos: this.currentCaretPosition, end: this.selectionEnd === -1 ? this.currentCaretPosition : this.selectionEnd - }); + }; } public verifyRefactorAvailable(negative: boolean, name: string, actionName?: string) { @@ -2803,7 +2803,7 @@ namespace FourSlash { } } - public applyRefactor({ refactorName, actionName, actionDescription }: FourSlashInterface.ApplyRefactorOptions) { + public applyRefactor({ refactorName, actionName, actionDescription, newContent: newContentWithRenameMarker }: FourSlashInterface.ApplyRefactorOptions) { const range = this.getSelection(); const refactors = this.languageService.getApplicableRefactors(this.activeFile.fileName, range); const refactor = refactors.find(r => r.name === refactorName); @@ -2823,6 +2823,35 @@ namespace FourSlash { for (const edit of editInfo.edits) { this.applyEdits(edit.fileName, edit.textChanges, /*isFormattingEdit*/ false); } + + const { renamePosition, newContent } = parseNewContent(); + + this.verifyCurrentFileContent(newContent); + + if (renamePosition === undefined) { + if (editInfo.renameLocation !== undefined) { + this.raiseError(`Did not expect a rename location, got ${editInfo.renameLocation}`); + } + } + else { + // TODO: test editInfo.renameFilename value + assert.isDefined(editInfo.renameFilename); + if (renamePosition !== editInfo.renameLocation) { + this.raiseError(`Expected rename position of ${renamePosition}, but got ${editInfo.renameLocation}`); + } + } + + function parseNewContent(): { renamePosition: number | undefined, newContent: string } { + const renamePosition = newContentWithRenameMarker.indexOf("/*RENAME*/"); + if (renamePosition === -1) { + return { renamePosition: undefined, newContent: newContentWithRenameMarker }; + } + else { + const newContent = newContentWithRenameMarker.slice(0, renamePosition) + newContentWithRenameMarker.slice(renamePosition + "/*RENAME*/".length); + return { renamePosition, newContent }; + } + } + } public verifyFileAfterApplyingRefactorAtMarker( @@ -4319,6 +4348,7 @@ namespace FourSlashInterface { refactorName: string; actionName: string; actionDescription: string; + newContent: string; } export interface CompletionsAtOptions { diff --git a/src/harness/unittests/compileOnSave.ts b/src/harness/unittests/compileOnSave.ts index e4b84e848c6..1545390de8d 100644 --- a/src/harness/unittests/compileOnSave.ts +++ b/src/harness/unittests/compileOnSave.ts @@ -55,7 +55,6 @@ namespace ts.projectSystem { let configFile: FileOrFolder; let changeModuleFile1ShapeRequest1: server.protocol.Request; let changeModuleFile1InternalRequest1: server.protocol.Request; - let changeModuleFile1ShapeRequest2: server.protocol.Request; // A compile on save affected file request using file1 let moduleFile1FileListRequest: server.protocol.Request; @@ -112,16 +111,6 @@ namespace ts.projectSystem { insertString: `var T1: number;` }); - // Change the content of file1 to `export var T: number;export function Foo() { };` - changeModuleFile1ShapeRequest2 = makeSessionRequest(CommandNames.Change, { - file: moduleFile1.path, - line: 1, - offset: 1, - endLine: 1, - endOffset: 1, - insertString: `export var T2: number;` - }); - moduleFile1FileListRequest = makeSessionRequest(CommandNames.CompileOnSaveAffectedFileList, { file: moduleFile1.path, projectFileName: configFile.path }); }); diff --git a/src/harness/unittests/extractMethods.ts b/src/harness/unittests/extractMethods.ts index 75404d12bf0..c836698aeb4 100644 --- a/src/harness/unittests/extractMethods.ts +++ b/src/harness/unittests/extractMethods.ts @@ -224,7 +224,7 @@ namespace ts { testExtractRange(` function f() { while (true) { - [#| + [#| if (x) { return; } |] @@ -234,7 +234,7 @@ namespace ts { testExtractRange(` function f() { while (true) { - [#| + [#| [$|if (x) { } return;|] @@ -655,6 +655,60 @@ function test(x: number) { finally { [#|return 1;|] } +}`); + // Extraction position - namespace + testExtractMethod("extractMethod23", + `namespace NS { + function M1() { } + function M2() { + [#|return 1;|] + } + function M3() { } +}`); + // Extraction position - function + testExtractMethod("extractMethod24", + `function Outer() { + function M1() { } + function M2() { + [#|return 1;|] + } + function M3() { } +}`); + // Extraction position - file + testExtractMethod("extractMethod25", + `function M1() { } +function M2() { + [#|return 1;|] +} +function M3() { }`); + // Extraction position - class without ctor + testExtractMethod("extractMethod26", + `class C { + M1() { } + M2() { + [#|return 1;|] + } + M3() { } +}`); + // Extraction position - class with ctor in middle + testExtractMethod("extractMethod27", + `class C { + M1() { } + M2() { + [#|return 1;|] + } + constructor() { } + M3() { } +}`); + // Extraction position - class with ctor at end + testExtractMethod("extractMethod28", + `class C { + M1() { } + M2() { + [#|return 1;|] + } + M3() { } + constructor() { } }`); }); @@ -691,9 +745,12 @@ function test(x: number) { data.push(`// ==ORIGINAL==`); data.push(sourceFile.text); for (const r of results) { - const changes = refactor.extractMethod.getPossibleExtractions(result.targetRange, context, results.indexOf(r))[0].changes; + const { renameLocation, edits } = refactor.extractMethod.getExtractionAtIndex(result.targetRange, context, results.indexOf(r)); + assert.lengthOf(edits, 1); data.push(`// ==SCOPE::${r.scopeDescription}==`); - data.push(textChanges.applyChanges(sourceFile.text, changes[0].textChanges)); + const newText = textChanges.applyChanges(sourceFile.text, edits[0].textChanges); + const newTextWithRename = newText.slice(0, renameLocation) + "/*RENAME*/" + newText.slice(renameLocation); + data.push(newTextWithRename); } return data.join(newLineCharacter); }); diff --git a/src/harness/unittests/typingsInstaller.ts b/src/harness/unittests/typingsInstaller.ts index de8ceb7f984..df0c1dd9095 100644 --- a/src/harness/unittests/typingsInstaller.ts +++ b/src/harness/unittests/typingsInstaller.ts @@ -366,13 +366,11 @@ namespace ts.projectSystem { }; const host = createServerHost([file1, file2]); - let enqueueIsCalled = false; const installer = new (class extends Installer { constructor() { super(host, { typesRegistry: createTypesRegistry("jquery") }); } enqueueInstallTypingsRequest(project: server.Project, typeAcquisition: TypeAcquisition, unresolvedImports: server.SortedReadonlyArray) { - enqueueIsCalled = true; super.enqueueInstallTypingsRequest(project, typeAcquisition, unresolvedImports); } installWorker(_requestId: number, _args: string[], _cwd: string, cb: TI.RequestCompletedAction): void { diff --git a/src/server/client.ts b/src/server/client.ts index 4acd862a89a..0ffac42dae4 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -586,9 +586,7 @@ namespace ts.server { const response = this.processResponse(request); if (!response.body) { - return { - edits: [] - }; + return { edits: [], renameFilename: undefined, renameLocation: undefined }; } const edits: FileTextChanges[] = this.convertCodeEditsToTextChanges(response.body.edits); diff --git a/src/server/server.ts b/src/server/server.ts index 6b6535c8cac..f031d5f0cfc 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -585,7 +585,6 @@ namespace ts.server { function createPollingWatchedFileSet(interval = 2500, chunkSize = 30) { const watchedFiles: WatchedFile[] = []; let nextFileToCheck = 0; - let watchTimer: any; return { getModifiedTime, poll, startWatchTimer, addFile, removeFile }; function getModifiedTime(fileName: string): Date { @@ -622,7 +621,7 @@ namespace ts.server { // stat due to inconsistencies of fs.watch // and efficiency of stat on modern filesystems function startWatchTimer() { - watchTimer = setInterval(() => { + setInterval(() => { let count = 0; let nextToCheck = nextFileToCheck; let firstCheck = -1; diff --git a/src/services/codefixes/fixUnusedIdentifier.ts b/src/services/codefixes/fixUnusedIdentifier.ts index 530a4543ec4..090aefbb8ca 100644 --- a/src/services/codefixes/fixUnusedIdentifier.ts +++ b/src/services/codefixes/fixUnusedIdentifier.ts @@ -2,8 +2,8 @@ namespace ts.codefix { registerCodeFix({ errorCodes: [ - Diagnostics._0_is_declared_but_never_used.code, - Diagnostics.Property_0_is_declared_but_never_used.code + Diagnostics._0_is_declared_but_its_value_is_never_read.code, + Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code ], getCodeActions: (context: CodeFixContext) => { const sourceFile = context.sourceFile; diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index b12b0f85fda..80194c5649b 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -175,7 +175,7 @@ namespace ts.FindAllReferences { return { fileName: node.getSourceFile().fileName, textSpan: getTextSpan(node), - isWriteAccess: isWriteAccess(node), + isWriteAccess: isWriteAccessForReference(node), isDefinition: node.kind === SyntaxKind.DefaultKeyword || isAnyDeclarationName(node) || isLiteralComputedPropertyDeclarationName(node), @@ -224,7 +224,7 @@ namespace ts.FindAllReferences { const { node, isInString } = entry; const fileName = entry.node.getSourceFile().fileName; - const writeAccess = isWriteAccess(node); + const writeAccess = isWriteAccessForReference(node); const span: HighlightSpan = { textSpan: getTextSpan(node), kind: writeAccess ? HighlightSpanKind.writtenReference : HighlightSpanKind.reference, @@ -244,21 +244,8 @@ namespace ts.FindAllReferences { } /** 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.DefaultKeyword || isAnyDeclarationName(node)) { - return true; - } - - const { parent } = node; - switch (parent && parent.kind) { - case SyntaxKind.PostfixUnaryExpression: - case SyntaxKind.PrefixUnaryExpression: - return true; - case SyntaxKind.BinaryExpression: - return (parent).left === node && isAssignmentOperator((parent).operatorToken.kind); - default: - return false; - } + function isWriteAccessForReference(node: Node): boolean { + return node.kind === SyntaxKind.DefaultKeyword || isAnyDeclarationName(node) || isWriteAccess(node); } } diff --git a/src/services/preProcess.ts b/src/services/preProcess.ts index 106759a3a28..8f6a468be64 100644 --- a/src/services/preProcess.ts +++ b/src/services/preProcess.ts @@ -273,13 +273,11 @@ namespace ts { // skip open bracket token = nextToken(); - let i = 0; // scan until ']' or EOF while (token !== SyntaxKind.CloseBracketToken && token !== SyntaxKind.EndOfFileToken) { // record string literals as module names if (token === SyntaxKind.StringLiteral) { recordModuleName(); - i++; } token = nextToken(); diff --git a/src/services/refactors/convertFunctionToEs6Class.ts b/src/services/refactors/convertFunctionToEs6Class.ts index 40ef4ed2a2e..e4cd1a42083 100644 --- a/src/services/refactors/convertFunctionToEs6Class.ts +++ b/src/services/refactors/convertFunctionToEs6Class.ts @@ -97,7 +97,9 @@ namespace ts.refactor.convertFunctionToES6Class { } return { - edits: changeTracker.getChanges() + edits: changeTracker.getChanges(), + renameFilename: undefined, + renameLocation: undefined, }; function deleteNode(node: Node, inList = false) { diff --git a/src/services/refactors/extractMethod.ts b/src/services/refactors/extractMethod.ts index 8521e2fac0b..7b5e1e40c7e 100644 --- a/src/services/refactors/extractMethod.ts +++ b/src/services/refactors/extractMethod.ts @@ -31,16 +31,16 @@ namespace ts.refactor.extractMethod { const usedNames: Map = createMap(); let i = 0; - for (const extr of extractions) { + for (const { scopeDescription, errors } of extractions) { // Skip these since we don't have a way to report errors yet - if (extr.errors && extr.errors.length) { + if (errors.length) { continue; } // Don't issue refactorings with duplicated names. // Scopes come back in "innermost first" order, so extractions will // preferentially go into nearer scopes - const description = formatStringFromArgs(Diagnostics.Extract_to_0.message, [extr.scopeDescription]); + const description = formatStringFromArgs(Diagnostics.Extract_to_0.message, [scopeDescription]); if (!usedNames.has(description)) { usedNames.set(description, true); actions.push({ @@ -75,10 +75,7 @@ namespace ts.refactor.extractMethod { const index = +parsedIndexMatch[1]; Debug.assert(isFinite(index), "Expected to parse a finite number from the scope index"); - const extractions = getPossibleExtractions(targetRange, context, index); - // Scope is no longer valid from when the user issued the refactor (??) - Debug.assert(extractions !== undefined, "The extraction went missing? How?"); - return ({ edits: extractions[0].changes }); + return getExtractionAtIndex(targetRange, context, index); } // Move these into diagnostic messages if they become user-facing @@ -102,7 +99,7 @@ namespace ts.refactor.extractMethod { export const CannotExtractAmbientBlock = createMessage("Cannot extract code from ambient contexts"); } - export enum RangeFacts { + enum RangeFacts { None = 0, HasReturn = 1 << 0, IsGenerator = 1 << 1, @@ -117,7 +114,7 @@ namespace ts.refactor.extractMethod { /** * Represents an expression or a list of statements that should be extracted with some extra information */ - export interface TargetRange { + interface TargetRange { readonly range: Expression | Statement[]; readonly facts: RangeFacts; /** @@ -130,7 +127,7 @@ namespace ts.refactor.extractMethod { /** * Result of 'getRangeToExtract' operation: contains either a range or a list of errors */ - export type RangeToExtract = { + type RangeToExtract = { readonly targetRange?: never; readonly errors: ReadonlyArray; } | { @@ -141,18 +138,7 @@ namespace ts.refactor.extractMethod { /* * Scopes that can store newly extracted method */ - export type Scope = FunctionLikeDeclaration | SourceFile | ModuleBlock | ClassLikeDeclaration; - - /** - * Result of 'extractRange' operation for a specific scope. - * Stores either a list of changes that should be applied to extract a range or a list of errors - */ - export interface ExtractResultForScope { - readonly scope: Scope; - readonly scopeDescription: string; - readonly changes?: FileTextChanges[]; - readonly errors?: Diagnostic[]; - } + type Scope = FunctionLikeDeclaration | SourceFile | ModuleBlock | ClassLikeDeclaration; /** * getRangeToExtract takes a span inside a text file and returns either an expression or an array @@ -160,6 +146,7 @@ namespace ts.refactor.extractMethod { * process may fail, in which case a set of errors is returned instead (these are currently * not shown to the user, but can be used by us diagnostically) */ + // exported only for tests export function getRangeToExtract(sourceFile: SourceFile, span: TextSpan): RangeToExtract { const length = span.length || 0; // Walk up starting from the the start position until we find a non-SourceFile node that subsumes the selected span. @@ -458,7 +445,7 @@ namespace ts.refactor.extractMethod { * you may be able to extract into a class method *or* local closure *or* namespace function, * depending on what's in the extracted body. */ - export function collectEnclosingScopes(range: TargetRange): Scope[] | undefined { + function collectEnclosingScopes(range: TargetRange): Scope[] | undefined { let current: Node = isReadonlyArray(range.range) ? firstOrUndefined(range.range) : range.range; if (range.facts & RangeFacts.UsesThis) { // if range uses this as keyword or as type inside the class then it can only be extracted to a method of the containing class @@ -494,12 +481,32 @@ namespace ts.refactor.extractMethod { return scopes; } + // exported only for tests + export function getExtractionAtIndex(targetRange: TargetRange, context: RefactorContext, requestedChangesIndex: number): RefactorEditInfo { + const { scopes, readsAndWrites: { target, usagesPerScope, errorsPerScope } } = getPossibleExtractionsWorker(targetRange, context); + Debug.assert(!errorsPerScope[requestedChangesIndex].length, "The extraction went missing? How?"); + context.cancellationToken.throwIfCancellationRequested(); + return extractFunctionInScope(target, scopes[requestedChangesIndex], usagesPerScope[requestedChangesIndex], targetRange, context); + } + + interface PossibleExtraction { + readonly scopeDescription: string; + readonly errors: ReadonlyArray; + } /** * Given a piece of text to extract ('targetRange'), computes a list of possible extractions. * Each returned ExtractResultForScope corresponds to a possible target scope and is either a set of changes * or an error explaining why we can't extract into that scope. */ - export function getPossibleExtractions(targetRange: TargetRange, context: RefactorContext, requestedChangesIndex: number = undefined): ReadonlyArray | undefined { + // exported only for tests + export function getPossibleExtractions(targetRange: TargetRange, context: RefactorContext): ReadonlyArray | undefined { + const { scopes, readsAndWrites: { errorsPerScope } } = getPossibleExtractionsWorker(targetRange, context); + // Need the inner type annotation to avoid https://github.com/Microsoft/TypeScript/issues/7547 + return scopes.map((scope, i): PossibleExtraction => + ({ scopeDescription: getDescriptionForScope(scope), errors: errorsPerScope[i] })); + } + + function getPossibleExtractionsWorker(targetRange: TargetRange, context: RefactorContext): { readonly scopes: Scope[], readonly readsAndWrites: ReadsAndWrites } { const { file: sourceFile } = context; if (targetRange === undefined) { @@ -512,35 +519,14 @@ namespace ts.refactor.extractMethod { } const enclosingTextRange = getEnclosingTextRange(targetRange, sourceFile); - const { target, usagesPerScope, errorsPerScope } = collectReadsAndWrites( + const readsAndWrites = collectReadsAndWrites( targetRange, scopes, enclosingTextRange, sourceFile, context.program.getTypeChecker(), context.cancellationToken); - - context.cancellationToken.throwIfCancellationRequested(); - - if (requestedChangesIndex !== undefined) { - if (errorsPerScope[requestedChangesIndex].length) { - return undefined; - } - return [extractFunctionInScope(target, scopes[requestedChangesIndex], usagesPerScope[requestedChangesIndex], targetRange, context)]; - } - else { - return scopes.map((scope, i) => { - const errors = errorsPerScope[i]; - if (errors.length) { - return { - scope, - scopeDescription: getDescriptionForScope(scope), - errors - }; - } - return { scope, scopeDescription: getDescriptionForScope(scope) }; - }); - } + return { scopes, readsAndWrites }; } function getDescriptionForScope(scope: Scope): string { @@ -583,34 +569,33 @@ namespace ts.refactor.extractMethod { : scope.externalModuleIndicator ? "module scope" : "global scope"; } - function getUniqueName(isNameOkay: (name: string) => boolean) { + function getUniqueName(fileText: string): string { let functionNameText = "newFunction"; - if (isNameOkay(functionNameText)) { - return functionNameText; - } - let i = 1; - while (!isNameOkay(functionNameText = `newFunction_${i}`)) { - i++; + for (let i = 1; fileText.indexOf(functionNameText) !== -1; i++) { + functionNameText = `newFunction_${i}`; } return functionNameText; } - export function extractFunctionInScope( + /** + * Result of 'extractRange' operation for a specific scope. + * Stores either a list of changes that should be applied to extract a range or a list of errors + */ + function extractFunctionInScope( node: Statement | Expression | Block, scope: Scope, { usages: usagesInScope, typeParameterUsages, substitutions }: ScopeUsages, range: TargetRange, - context: RefactorContext): ExtractResultForScope { + context: RefactorContext): RefactorEditInfo { const checker = context.program.getTypeChecker(); // Make a unique name for the extracted function const file = scope.getSourceFile(); - const functionNameText: string = getUniqueName(n => !file.identifiers.has(n)); + const functionNameText = getUniqueName(file.text); const isJS = isInJavaScriptFile(scope); - const functionName = createIdentifier(functionNameText as string); - const functionReference = createIdentifier(functionNameText as string); + const functionName = createIdentifier(functionNameText); let returnType: TypeNode = undefined; const parameters: ParameterDeclaration[] = []; @@ -660,7 +645,7 @@ namespace ts.refactor.extractMethod { returnType = checker.typeToTypeNode(contextualType); } - const { body, returnValueProperty } = transformFunctionBody(node); + const { body, returnValueProperty } = transformFunctionBody(node, writes, substitutions, !!(range.facts & RangeFacts.HasReturn)); let newFunction: MethodDeclaration | FunctionDeclaration; if (isClassLike(scope)) { @@ -698,13 +683,21 @@ namespace ts.refactor.extractMethod { } const changeTracker = textChanges.ChangeTracker.fromContext(context); - // insert function at the end of the scope - changeTracker.insertNodeBefore(context.file, scope.getLastToken(), newFunction, { prefix: context.newLineCharacter, suffix: context.newLineCharacter }); + const minInsertionPos = (isReadonlyArray(range.range) ? lastOrUndefined(range.range) : range.range).end; + const nodeToInsertBefore = getNodeToInsertBefore(minInsertionPos, scope); + if (nodeToInsertBefore) { + changeTracker.insertNodeBefore(context.file, nodeToInsertBefore, newFunction, { suffix: context.newLineCharacter + context.newLineCharacter }); + } + else { + changeTracker.insertNodeBefore(context.file, scope.getLastToken(), newFunction, { prefix: context.newLineCharacter, suffix: context.newLineCharacter }); + } const newNodes: Node[] = []; // replace range with function call + const called = getCalledExpression(scope, range, functionNameText); + let call: Expression = createCall( - isClassLike(scope) ? createPropertyAccess(range.facts & RangeFacts.InStaticRegion ? createIdentifier(scope.name.getText()) : createThis(), functionReference) : functionReference, + called, callTypeArguments, // Note that no attempt is made to take advantage of type argument inference callArguments); if (range.facts & RangeFacts.IsGenerator) { @@ -773,114 +766,174 @@ namespace ts.refactor.extractMethod { changeTracker.replaceNodeWithNodes(context.file, range.range, newNodes, { nodeSeparator: context.newLineCharacter }); } - return { - scope, - scopeDescription: getDescriptionForScope(scope), - changes: changeTracker.getChanges() - }; + const edits = changeTracker.getChanges(); + const renameRange = isReadonlyArray(range.range) ? range.range[0] : range.range; - function getFirstDeclaration(type: Type): Declaration | undefined { - let firstDeclaration = undefined; + const renameFilename = renameRange.getSourceFile().fileName; + const renameLocation = getRenameLocation(edits, renameFilename, functionNameText); + return { renameFilename, renameLocation, edits }; + } - const symbol = type.symbol; - if (symbol && symbol.declarations) { - for (const declaration of symbol.declarations) { - if (firstDeclaration === undefined || declaration.pos < firstDeclaration.pos) { - firstDeclaration = declaration; - } + function getRenameLocation(edits: ReadonlyArray, renameFilename: string, functionNameText: string): number { + let delta = 0; + for (const { fileName, textChanges } of edits) { + Debug.assert(fileName === renameFilename); + for (const change of textChanges) { + const { span, newText } = change; + // TODO(acasey): We are assuming that the call expression comes before the function declaration, + // because we want the new cursor to be on the call expression, + // which is closer to where the user was before extracting the function. + const index = newText.indexOf(functionNameText); + if (index !== -1) { + return span.start + delta + index; + } + delta += newText.length - span.length; + } + } + throw new Error(); // Didn't find the text we inserted? + } + + function getFirstDeclaration(type: Type): Declaration | undefined { + let firstDeclaration = undefined; + + const symbol = type.symbol; + if (symbol && symbol.declarations) { + for (const declaration of symbol.declarations) { + if (firstDeclaration === undefined || declaration.pos < firstDeclaration.pos) { + firstDeclaration = declaration; } } - - return firstDeclaration; } - function compareTypesByDeclarationOrder( - {type: type1, declaration: declaration1}: {type: Type, declaration?: Declaration}, - {type: type2, declaration: declaration2}: {type: Type, declaration?: Declaration}) { + return firstDeclaration; + } - if (declaration1) { - if (declaration2) { - const positionDiff = declaration1.pos - declaration2.pos; - if (positionDiff !== 0) { - return positionDiff; - } + function compareTypesByDeclarationOrder( + {type: type1, declaration: declaration1}: {type: Type, declaration?: Declaration}, + {type: type2, declaration: declaration2}: {type: Type, declaration?: Declaration}) { + + if (declaration1) { + if (declaration2) { + const positionDiff = declaration1.pos - declaration2.pos; + if (positionDiff !== 0) { + return positionDiff; } - else { - return 1; // Sort undeclared type parameters to the front. - } - } - else if (declaration2) { - return -1; // Sort undeclared type parameters to the front. - } - - const name1 = type1.symbol ? type1.symbol.getName() : ""; - const name2 = type2.symbol ? type2.symbol.getName() : ""; - const nameDiff = compareStrings(name1, name2); - if (nameDiff !== 0) { - return nameDiff; - } - - // IDs are guaranteed to be unique, so this ensures a total ordering. - return type1.id - type2.id; - } - - function getPropertyAssignmentsForWrites(writes: UsageEntry[]) { - return writes.map(w => createShorthandPropertyAssignment(w.symbol.name)); - } - - function generateReturnValueProperty() { - return "__return"; - } - - function transformFunctionBody(body: Node) { - if (isBlock(body) && !writes && substitutions.size === 0) { - // already block, no writes to propagate back, no substitutions - can use node as is - return { body: createBlock(body.statements, /*multLine*/ true), returnValueProperty: undefined }; - } - let returnValueProperty: string; - const statements = createNodeArray(isBlock(body) ? body.statements.slice(0) : [isStatement(body) ? body : createReturn(body)]); - // rewrite body if either there are writes that should be propagated back via return statements or there are substitutions - if (writes || substitutions.size) { - const rewrittenStatements = visitNodes(statements, visitor).slice(); - if (writes && !(range.facts & RangeFacts.HasReturn) && isStatement(body)) { - // add return at the end to propagate writes back in case if control flow falls out of the function body - // it is ok to know that range has at least one return since it we only allow unconditional returns - const assignments = getPropertyAssignmentsForWrites(writes); - if (assignments.length === 1) { - rewrittenStatements.push(createReturn(assignments[0].name)); - } - else { - rewrittenStatements.push(createReturn(createObjectLiteral(assignments))); - } - } - return { body: createBlock(rewrittenStatements, /*multiLine*/ true), returnValueProperty }; } else { - return { body: createBlock(statements, /*multiLine*/ true), returnValueProperty: undefined }; - } - - function visitor(node: Node): VisitResult { - if (node.kind === SyntaxKind.ReturnStatement && writes) { - const assignments: ObjectLiteralElementLike[] = getPropertyAssignmentsForWrites(writes); - if ((node).expression) { - if (!returnValueProperty) { - returnValueProperty = generateReturnValueProperty(); - } - assignments.unshift(createPropertyAssignment(returnValueProperty, visitNode((node).expression, visitor))); - } - if (assignments.length === 1) { - return createReturn(assignments[0].name as Expression); - } - else { - return createReturn(createObjectLiteral(assignments)); - } - } - else { - const substitution = substitutions.get(getNodeId(node).toString()); - return substitution || visitEachChild(node, visitor, nullTransformationContext); - } + return 1; // Sort undeclared type parameters to the front. } } + else if (declaration2) { + return -1; // Sort undeclared type parameters to the front. + } + + const name1 = type1.symbol ? type1.symbol.getName() : ""; + const name2 = type2.symbol ? type2.symbol.getName() : ""; + const nameDiff = compareStrings(name1, name2); + if (nameDiff !== 0) { + return nameDiff; + } + + // IDs are guaranteed to be unique, so this ensures a total ordering. + return type1.id - type2.id; + } + + function getCalledExpression(scope: Node, range: TargetRange, functionNameText: string): Expression { + const functionReference = createIdentifier(functionNameText); + if (isClassLike(scope)) { + const lhs = range.facts & RangeFacts.InStaticRegion ? createIdentifier(scope.name.text) : createThis(); + return createPropertyAccess(lhs, functionReference); + } + else { + return functionReference; + } + } + + function transformFunctionBody(body: Node, writes: ReadonlyArray, substitutions: ReadonlyMap, hasReturn: boolean): { body: Block, returnValueProperty: string } { + if (isBlock(body) && !writes && substitutions.size === 0) { + // already block, no writes to propagate back, no substitutions - can use node as is + return { body: createBlock(body.statements, /*multLine*/ true), returnValueProperty: undefined }; + } + let returnValueProperty: string; + const statements = createNodeArray(isBlock(body) ? body.statements.slice(0) : [isStatement(body) ? body : createReturn(body)]); + // rewrite body if either there are writes that should be propagated back via return statements or there are substitutions + if (writes || substitutions.size) { + const rewrittenStatements = visitNodes(statements, visitor).slice(); + if (writes && !hasReturn && isStatement(body)) { + // add return at the end to propagate writes back in case if control flow falls out of the function body + // it is ok to know that range has at least one return since it we only allow unconditional returns + const assignments = getPropertyAssignmentsForWrites(writes); + if (assignments.length === 1) { + rewrittenStatements.push(createReturn(assignments[0].name)); + } + else { + rewrittenStatements.push(createReturn(createObjectLiteral(assignments))); + } + } + return { body: createBlock(rewrittenStatements, /*multiLine*/ true), returnValueProperty }; + } + else { + return { body: createBlock(statements, /*multiLine*/ true), returnValueProperty: undefined }; + } + + function visitor(node: Node): VisitResult { + if (node.kind === SyntaxKind.ReturnStatement && writes) { + const assignments: ObjectLiteralElementLike[] = getPropertyAssignmentsForWrites(writes); + if ((node).expression) { + if (!returnValueProperty) { + returnValueProperty = "__return"; + } + assignments.unshift(createPropertyAssignment(returnValueProperty, visitNode((node).expression, visitor))); + } + if (assignments.length === 1) { + return createReturn(assignments[0].name as Expression); + } + else { + return createReturn(createObjectLiteral(assignments)); + } + } + else { + const substitution = substitutions.get(getNodeId(node).toString()); + return substitution || visitEachChild(node, visitor, nullTransformationContext); + } + } + } + + function getStatementsOrClassElements(scope: Scope): ReadonlyArray | ReadonlyArray { + if (isFunctionLike(scope)) { + const body = scope.body; + if (isBlock(body)) { + return body.statements; + } + } + else if (isModuleBlock(scope) || isSourceFile(scope)) { + return scope.statements; + } + else if (isClassLike(scope)) { + return scope.members; + } + else { + assertTypeIsNever(scope); + } + + return emptyArray; + } + + /** + * If `scope` contains a function after `minPos`, then return the first such function. + * Otherwise, return `undefined`. + */ + function getNodeToInsertBefore(minPos: number, scope: Scope): Node | undefined { + const children = getStatementsOrClassElements(scope); + for (const child of children) { + if (child.pos >= minPos && isFunctionLike(child) && !isConstructorDeclaration(child)) { + return child; + } + } + } + + function getPropertyAssignmentsForWrites(writes: ReadonlyArray): ShorthandPropertyAssignment[] { + return writes.map(w => createShorthandPropertyAssignment(w.symbol.name)); } function isReadonlyArray(v: any): v is ReadonlyArray { @@ -909,25 +962,30 @@ namespace ts.refactor.extractMethod { Write = 2 } - export interface UsageEntry { + interface UsageEntry { readonly usage: Usage; readonly symbol: Symbol; readonly node: Node; } - export interface ScopeUsages { - usages: Map; - typeParameterUsages: Map; // Key is type ID - substitutions: Map; + interface ScopeUsages { + readonly usages: Map; + readonly typeParameterUsages: Map; // Key is type ID + readonly substitutions: Map; } + interface ReadsAndWrites { + readonly target: Expression | Block; + readonly usagesPerScope: ReadonlyArray; + readonly errorsPerScope: ReadonlyArray>; + } function collectReadsAndWrites( targetRange: TargetRange, scopes: Scope[], enclosingTextRange: TextRange, sourceFile: SourceFile, checker: TypeChecker, - cancellationToken: CancellationToken) { + cancellationToken: CancellationToken): ReadsAndWrites { const allTypeParameterUsages = createMap(); // Key is type ID const usagesPerScope: ScopeUsages[] = []; diff --git a/src/services/types.ts b/src/services/types.ts index 8a23bfec1c5..a971995f050 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -414,8 +414,8 @@ namespace ts { */ export interface RefactorEditInfo { edits: FileTextChanges[]; - renameFilename?: string; - renameLocation?: number; + renameFilename: string | undefined; + renameLocation: number | undefined; } export interface TextInsertion { diff --git a/tests/baselines/reference/extendsUntypedModule.errors.txt b/tests/baselines/reference/extendsUntypedModule.errors.txt index 4667f16b74a..8df9e8a1c36 100644 --- a/tests/baselines/reference/extendsUntypedModule.errors.txt +++ b/tests/baselines/reference/extendsUntypedModule.errors.txt @@ -1,11 +1,11 @@ -/a.ts(2,8): error TS6133: 'Bar' is declared but never used. +/a.ts(2,8): error TS6133: 'Bar' is declared but its value is never read. ==== /a.ts (1 errors) ==== import Foo from "foo"; import Bar from "bar"; // error: unused ~~~ -!!! error TS6133: 'Bar' is declared but never used. +!!! error TS6133: 'Bar' is declared but its value is never read. export class A extends Foo { } ==== /node_modules/foo/index.js (0 errors) ==== diff --git a/tests/baselines/reference/extractMethod/extractMethod1.ts b/tests/baselines/reference/extractMethod/extractMethod1.ts index 660380c1253..86c28b5f4d2 100644 --- a/tests/baselines/reference/extractMethod/extractMethod1.ts +++ b/tests/baselines/reference/extractMethod/extractMethod1.ts @@ -23,7 +23,7 @@ namespace A { function a() { let a = 1; - newFunction(); + /*RENAME*/newFunction(); function newFunction() { let y = 5; @@ -43,7 +43,7 @@ namespace A { function a() { let a = 1; - a = newFunction(a); + a = /*RENAME*/newFunction(a); } function newFunction(a: number) { @@ -64,7 +64,7 @@ namespace A { function a() { let a = 1; - a = newFunction(a); + a = /*RENAME*/newFunction(a); } } @@ -85,7 +85,7 @@ namespace A { function a() { let a = 1; - a = newFunction(x, a, foo); + a = /*RENAME*/newFunction(x, a, foo); } } } diff --git a/tests/baselines/reference/extractMethod/extractMethod10.ts b/tests/baselines/reference/extractMethod/extractMethod10.ts index 13108a08131..e3eb73b661e 100644 --- a/tests/baselines/reference/extractMethod/extractMethod10.ts +++ b/tests/baselines/reference/extractMethod/extractMethod10.ts @@ -15,7 +15,7 @@ namespace A { class C { a() { let z = 1; - return this.newFunction(); + return this./*RENAME*/newFunction(); } private newFunction() { @@ -30,7 +30,7 @@ namespace A { class C { a() { let z = 1; - return newFunction(); + return /*RENAME*/newFunction(); } } @@ -45,7 +45,7 @@ namespace A { class C { a() { let z = 1; - return newFunction(); + return /*RENAME*/newFunction(); } } } diff --git a/tests/baselines/reference/extractMethod/extractMethod11.ts b/tests/baselines/reference/extractMethod/extractMethod11.ts index 5a2e0da826a..43fdd75b76f 100644 --- a/tests/baselines/reference/extractMethod/extractMethod11.ts +++ b/tests/baselines/reference/extractMethod/extractMethod11.ts @@ -18,7 +18,7 @@ namespace A { a() { let z = 1; var __return: any; - ({ __return, z } = this.newFunction(z)); + ({ __return, z } = this./*RENAME*/newFunction(z)); return __return; } @@ -37,7 +37,7 @@ namespace A { a() { let z = 1; var __return: any; - ({ __return, z } = newFunction(z)); + ({ __return, z } = /*RENAME*/newFunction(z)); return __return; } } @@ -56,7 +56,7 @@ namespace A { a() { let z = 1; var __return: any; - ({ __return, y, z } = newFunction(y, z)); + ({ __return, y, z } = /*RENAME*/newFunction(y, z)); return __return; } } diff --git a/tests/baselines/reference/extractMethod/extractMethod12.ts b/tests/baselines/reference/extractMethod/extractMethod12.ts index 98428a67bd0..2f3082cf280 100644 --- a/tests/baselines/reference/extractMethod/extractMethod12.ts +++ b/tests/baselines/reference/extractMethod/extractMethod12.ts @@ -21,7 +21,7 @@ namespace A { a() { let z = 1; var __return: any; - ({ __return, z } = this.newFunction(z)); + ({ __return, z } = this./*RENAME*/newFunction(z)); return __return; } diff --git a/tests/baselines/reference/extractMethod/extractMethod13.ts b/tests/baselines/reference/extractMethod/extractMethod13.ts index 44968ac4dcf..121d7eeecfa 100644 --- a/tests/baselines/reference/extractMethod/extractMethod13.ts +++ b/tests/baselines/reference/extractMethod/extractMethod13.ts @@ -20,7 +20,7 @@ (u2a: U2a, u2b: U2b) => { function F2(t2a: T2a, t2b: T2b) { (u3a: U3a, u3b: U3b) => { - newFunction(u3a); + /*RENAME*/newFunction(u3a); } function newFunction(u3a: U3a) { @@ -40,7 +40,7 @@ (u2a: U2a, u2b: U2b) => { function F2(t2a: T2a, t2b: T2b) { (u3a: U3a, u3b: U3b) => { - newFunction(t2a, u2a, u3a); + /*RENAME*/newFunction(t2a, u2a, u3a); } } } @@ -60,7 +60,7 @@ (u2a: U2a, u2b: U2b) => { function F2(t2a: T2a, t2b: T2b) { (u3a: U3a, u3b: U3b) => { - newFunction(t1a, t2a, u1a, u2a, u3a); + /*RENAME*/newFunction(t1a, t2a, u1a, u2a, u3a); } } } diff --git a/tests/baselines/reference/extractMethod/extractMethod14.ts b/tests/baselines/reference/extractMethod/extractMethod14.ts index 4db0e748907..d3dcded2c42 100644 --- a/tests/baselines/reference/extractMethod/extractMethod14.ts +++ b/tests/baselines/reference/extractMethod/extractMethod14.ts @@ -8,7 +8,7 @@ function F(t1: T) { // ==SCOPE::inner function in function 'F'== function F(t1: T) { function F(t2: T) { - newFunction(); + /*RENAME*/newFunction(); function newFunction() { t1.toString(); @@ -19,7 +19,7 @@ function F(t1: T) { // ==SCOPE::inner function in function 'F'== function F(t1: T) { function F(t2: T) { - newFunction(t2); + /*RENAME*/newFunction(t2); } function newFunction(t2: T) { @@ -30,7 +30,7 @@ function F(t1: T) { // ==SCOPE::function in global scope== function F(t1: T) { function F(t2: T) { - newFunction(t1, t2); + /*RENAME*/newFunction(t1, t2); } } function newFunction(t1: T, t2: T) { diff --git a/tests/baselines/reference/extractMethod/extractMethod15.ts b/tests/baselines/reference/extractMethod/extractMethod15.ts index 7d1c8aa4507..50516445c87 100644 --- a/tests/baselines/reference/extractMethod/extractMethod15.ts +++ b/tests/baselines/reference/extractMethod/extractMethod15.ts @@ -7,7 +7,7 @@ function F(t1: T) { // ==SCOPE::inner function in function 'F'== function F(t1: T) { function F(t2: U) { - newFunction(); + /*RENAME*/newFunction(); function newFunction() { t2.toString(); @@ -17,7 +17,7 @@ function F(t1: T) { // ==SCOPE::inner function in function 'F'== function F(t1: T) { function F(t2: U) { - newFunction(t2); + /*RENAME*/newFunction(t2); } function newFunction(t2: U) { @@ -27,7 +27,7 @@ function F(t1: T) { // ==SCOPE::function in global scope== function F(t1: T) { function F(t2: U) { - newFunction(t2); + /*RENAME*/newFunction(t2); } } function newFunction(t2: U) { diff --git a/tests/baselines/reference/extractMethod/extractMethod16.ts b/tests/baselines/reference/extractMethod/extractMethod16.ts index 2ecb0703660..e58bbf576c6 100644 --- a/tests/baselines/reference/extractMethod/extractMethod16.ts +++ b/tests/baselines/reference/extractMethod/extractMethod16.ts @@ -4,7 +4,7 @@ function F() { } // ==SCOPE::inner function in function 'F'== function F() { - const array: T[] = newFunction(); + const array: T[] = /*RENAME*/newFunction(); function newFunction(): T[] { return []; @@ -12,7 +12,7 @@ function F() { } // ==SCOPE::function in global scope== function F() { - const array: T[] = newFunction(); + const array: T[] = /*RENAME*/newFunction(); } function newFunction(): T[] { return []; diff --git a/tests/baselines/reference/extractMethod/extractMethod17.ts b/tests/baselines/reference/extractMethod/extractMethod17.ts index d0401b6b472..f79abcca792 100644 --- a/tests/baselines/reference/extractMethod/extractMethod17.ts +++ b/tests/baselines/reference/extractMethod/extractMethod17.ts @@ -7,7 +7,7 @@ class C { // ==SCOPE::method in class 'C'== class C { M(t1: T1, t2: T2) { - this.newFunction(t1); + this./*RENAME*/newFunction(t1); } private newFunction(t1: T1) { @@ -17,7 +17,7 @@ class C { // ==SCOPE::function in global scope== class C { M(t1: T1, t2: T2) { - newFunction(t1); + /*RENAME*/newFunction(t1); } } function newFunction(t1: T1) { diff --git a/tests/baselines/reference/extractMethod/extractMethod18.ts b/tests/baselines/reference/extractMethod/extractMethod18.ts index 85ef9a5d5c0..122eced75d5 100644 --- a/tests/baselines/reference/extractMethod/extractMethod18.ts +++ b/tests/baselines/reference/extractMethod/extractMethod18.ts @@ -7,7 +7,7 @@ class C { // ==SCOPE::method in class 'C'== class C { M(t1: T1, t2: T2) { - this.newFunction(t1); + this./*RENAME*/newFunction(t1); } private newFunction(t1: T1) { @@ -17,7 +17,7 @@ class C { // ==SCOPE::function in global scope== class C { M(t1: T1, t2: T2) { - newFunction(t1); + /*RENAME*/newFunction(t1); } } function newFunction(t1: T1) { diff --git a/tests/baselines/reference/extractMethod/extractMethod19.ts b/tests/baselines/reference/extractMethod/extractMethod19.ts index 80d3c61d1ee..61d35f97db5 100644 --- a/tests/baselines/reference/extractMethod/extractMethod19.ts +++ b/tests/baselines/reference/extractMethod/extractMethod19.ts @@ -4,7 +4,7 @@ function F(v: V) { } // ==SCOPE::inner function in function 'F'== function F(v: V) { - newFunction(); + /*RENAME*/newFunction(); function newFunction() { v.toString(); @@ -12,7 +12,7 @@ function F(v: V) { } // ==SCOPE::function in global scope== function F(v: V) { - newFunction(v); + /*RENAME*/newFunction(v); } function newFunction(v: V) { v.toString(); diff --git a/tests/baselines/reference/extractMethod/extractMethod2.ts b/tests/baselines/reference/extractMethod/extractMethod2.ts index 17ca6a6ba22..b83cc6f32c6 100644 --- a/tests/baselines/reference/extractMethod/extractMethod2.ts +++ b/tests/baselines/reference/extractMethod/extractMethod2.ts @@ -20,7 +20,7 @@ namespace A { namespace B { function a() { - return newFunction(); + return /*RENAME*/newFunction(); function newFunction() { let y = 5; @@ -38,7 +38,7 @@ namespace A { namespace B { function a() { - return newFunction(); + return /*RENAME*/newFunction(); } function newFunction() { @@ -56,7 +56,7 @@ namespace A { namespace B { function a() { - return newFunction(); + return /*RENAME*/newFunction(); } } @@ -74,7 +74,7 @@ namespace A { namespace B { function a() { - return newFunction(x, foo); + return /*RENAME*/newFunction(x, foo); } } } diff --git a/tests/baselines/reference/extractMethod/extractMethod20.ts b/tests/baselines/reference/extractMethod/extractMethod20.ts index 7d65bfca1a9..6e0148e0991 100644 --- a/tests/baselines/reference/extractMethod/extractMethod20.ts +++ b/tests/baselines/reference/extractMethod/extractMethod20.ts @@ -8,7 +8,7 @@ const _ = class { // ==SCOPE::method in anonymous class expression== const _ = class { a() { - return this.newFunction(); + return this./*RENAME*/newFunction(); } private newFunction() { @@ -19,7 +19,7 @@ const _ = class { // ==SCOPE::function in global scope== const _ = class { a() { - return newFunction(); + return /*RENAME*/newFunction(); } } function newFunction() { diff --git a/tests/baselines/reference/extractMethod/extractMethod21.ts b/tests/baselines/reference/extractMethod/extractMethod21.ts index 6fb5fc43155..2c4ffd1bdb8 100644 --- a/tests/baselines/reference/extractMethod/extractMethod21.ts +++ b/tests/baselines/reference/extractMethod/extractMethod21.ts @@ -7,7 +7,7 @@ function foo() { // ==SCOPE::inner function in function 'foo'== function foo() { let x = 10; - return newFunction(); + return /*RENAME*/newFunction(); function newFunction() { x++; @@ -17,7 +17,7 @@ function foo() { // ==SCOPE::function in global scope== function foo() { let x = 10; - x = newFunction(x); + x = /*RENAME*/newFunction(x); return; } function newFunction(x: number) { diff --git a/tests/baselines/reference/extractMethod/extractMethod22.ts b/tests/baselines/reference/extractMethod/extractMethod22.ts index 1bb76ef67ba..990bfdf0575 100644 --- a/tests/baselines/reference/extractMethod/extractMethod22.ts +++ b/tests/baselines/reference/extractMethod/extractMethod22.ts @@ -11,7 +11,7 @@ function test() { try { } finally { - return newFunction(); + return /*RENAME*/newFunction(); } function newFunction() { @@ -23,7 +23,7 @@ function test() { try { } finally { - return newFunction(); + return /*RENAME*/newFunction(); } } function newFunction() { diff --git a/tests/baselines/reference/extractMethod/extractMethod23.ts b/tests/baselines/reference/extractMethod/extractMethod23.ts new file mode 100644 index 00000000000..b9bc4264ea6 --- /dev/null +++ b/tests/baselines/reference/extractMethod/extractMethod23.ts @@ -0,0 +1,43 @@ +// ==ORIGINAL== +namespace NS { + function M1() { } + function M2() { + return 1; + } + function M3() { } +} +// ==SCOPE::inner function in function 'M2'== +namespace NS { + function M1() { } + function M2() { + return /*RENAME*/newFunction(); + + function newFunction() { + return 1; + } + } + function M3() { } +} +// ==SCOPE::function in namespace 'NS'== +namespace NS { + function M1() { } + function M2() { + return /*RENAME*/newFunction(); + } + function newFunction() { + return 1; + } + + function M3() { } +} +// ==SCOPE::function in global scope== +namespace NS { + function M1() { } + function M2() { + return /*RENAME*/newFunction(); + } + function M3() { } +} +function newFunction() { + return 1; +} diff --git a/tests/baselines/reference/extractMethod/extractMethod24.ts b/tests/baselines/reference/extractMethod/extractMethod24.ts new file mode 100644 index 00000000000..a9dc25d32ea --- /dev/null +++ b/tests/baselines/reference/extractMethod/extractMethod24.ts @@ -0,0 +1,43 @@ +// ==ORIGINAL== +function Outer() { + function M1() { } + function M2() { + return 1; + } + function M3() { } +} +// ==SCOPE::inner function in function 'M2'== +function Outer() { + function M1() { } + function M2() { + return /*RENAME*/newFunction(); + + function newFunction() { + return 1; + } + } + function M3() { } +} +// ==SCOPE::inner function in function 'Outer'== +function Outer() { + function M1() { } + function M2() { + return /*RENAME*/newFunction(); + } + function newFunction() { + return 1; + } + + function M3() { } +} +// ==SCOPE::function in global scope== +function Outer() { + function M1() { } + function M2() { + return /*RENAME*/newFunction(); + } + function M3() { } +} +function newFunction() { + return 1; +} diff --git a/tests/baselines/reference/extractMethod/extractMethod25.ts b/tests/baselines/reference/extractMethod/extractMethod25.ts new file mode 100644 index 00000000000..dc376781346 --- /dev/null +++ b/tests/baselines/reference/extractMethod/extractMethod25.ts @@ -0,0 +1,26 @@ +// ==ORIGINAL== +function M1() { } +function M2() { + return 1; +} +function M3() { } +// ==SCOPE::inner function in function 'M2'== +function M1() { } +function M2() { + return /*RENAME*/newFunction(); + + function newFunction() { + return 1; + } +} +function M3() { } +// ==SCOPE::function in global scope== +function M1() { } +function M2() { + return /*RENAME*/newFunction(); +} +function newFunction() { + return 1; +} + +function M3() { } \ No newline at end of file diff --git a/tests/baselines/reference/extractMethod/extractMethod26.ts b/tests/baselines/reference/extractMethod/extractMethod26.ts new file mode 100644 index 00000000000..b49e8ab9508 --- /dev/null +++ b/tests/baselines/reference/extractMethod/extractMethod26.ts @@ -0,0 +1,31 @@ +// ==ORIGINAL== +class C { + M1() { } + M2() { + return 1; + } + M3() { } +} +// ==SCOPE::method in class 'C'== +class C { + M1() { } + M2() { + return this./*RENAME*/newFunction(); + } + private newFunction() { + return 1; + } + + M3() { } +} +// ==SCOPE::function in global scope== +class C { + M1() { } + M2() { + return /*RENAME*/newFunction(); + } + M3() { } +} +function newFunction() { + return 1; +} diff --git a/tests/baselines/reference/extractMethod/extractMethod27.ts b/tests/baselines/reference/extractMethod/extractMethod27.ts new file mode 100644 index 00000000000..0ec214bb5ed --- /dev/null +++ b/tests/baselines/reference/extractMethod/extractMethod27.ts @@ -0,0 +1,34 @@ +// ==ORIGINAL== +class C { + M1() { } + M2() { + return 1; + } + constructor() { } + M3() { } +} +// ==SCOPE::method in class 'C'== +class C { + M1() { } + M2() { + return this./*RENAME*/newFunction(); + } + constructor() { } + private newFunction() { + return 1; + } + + M3() { } +} +// ==SCOPE::function in global scope== +class C { + M1() { } + M2() { + return /*RENAME*/newFunction(); + } + constructor() { } + M3() { } +} +function newFunction() { + return 1; +} diff --git a/tests/baselines/reference/extractMethod/extractMethod28.ts b/tests/baselines/reference/extractMethod/extractMethod28.ts new file mode 100644 index 00000000000..ab6ce220bd7 --- /dev/null +++ b/tests/baselines/reference/extractMethod/extractMethod28.ts @@ -0,0 +1,34 @@ +// ==ORIGINAL== +class C { + M1() { } + M2() { + return 1; + } + M3() { } + constructor() { } +} +// ==SCOPE::method in class 'C'== +class C { + M1() { } + M2() { + return this./*RENAME*/newFunction(); + } + private newFunction() { + return 1; + } + + M3() { } + constructor() { } +} +// ==SCOPE::function in global scope== +class C { + M1() { } + M2() { + return /*RENAME*/newFunction(); + } + M3() { } + constructor() { } +} +function newFunction() { + return 1; +} diff --git a/tests/baselines/reference/extractMethod/extractMethod3.ts b/tests/baselines/reference/extractMethod/extractMethod3.ts index 0d8481c9841..0af79791fe7 100644 --- a/tests/baselines/reference/extractMethod/extractMethod3.ts +++ b/tests/baselines/reference/extractMethod/extractMethod3.ts @@ -18,7 +18,7 @@ namespace A { namespace B { function* a(z: number) { - return yield* newFunction(); + return yield* /*RENAME*/newFunction(); function* newFunction() { let y = 5; @@ -35,7 +35,7 @@ namespace A { namespace B { function* a(z: number) { - return yield* newFunction(z); + return yield* /*RENAME*/newFunction(z); } function* newFunction(z: number) { @@ -52,7 +52,7 @@ namespace A { namespace B { function* a(z: number) { - return yield* newFunction(z); + return yield* /*RENAME*/newFunction(z); } } @@ -69,7 +69,7 @@ namespace A { namespace B { function* a(z: number) { - return yield* newFunction(z, foo); + return yield* /*RENAME*/newFunction(z, foo); } } } diff --git a/tests/baselines/reference/extractMethod/extractMethod4.ts b/tests/baselines/reference/extractMethod/extractMethod4.ts index 4f6a5d85f89..e0a636135d4 100644 --- a/tests/baselines/reference/extractMethod/extractMethod4.ts +++ b/tests/baselines/reference/extractMethod/extractMethod4.ts @@ -20,7 +20,7 @@ namespace A { namespace B { async function a(z: number, z1: any) { - return await newFunction(); + return await /*RENAME*/newFunction(); async function newFunction() { let y = 5; @@ -39,7 +39,7 @@ namespace A { namespace B { async function a(z: number, z1: any) { - return await newFunction(z, z1); + return await /*RENAME*/newFunction(z, z1); } async function newFunction(z: number, z1: any) { @@ -58,7 +58,7 @@ namespace A { namespace B { async function a(z: number, z1: any) { - return await newFunction(z, z1); + return await /*RENAME*/newFunction(z, z1); } } @@ -77,7 +77,7 @@ namespace A { namespace B { async function a(z: number, z1: any) { - return await newFunction(z, z1, foo); + return await /*RENAME*/newFunction(z, z1, foo); } } } diff --git a/tests/baselines/reference/extractMethod/extractMethod5.ts b/tests/baselines/reference/extractMethod/extractMethod5.ts index 10ff0005f73..fc15f6762e5 100644 --- a/tests/baselines/reference/extractMethod/extractMethod5.ts +++ b/tests/baselines/reference/extractMethod/extractMethod5.ts @@ -23,7 +23,7 @@ namespace A { function a() { let a = 1; - newFunction(); + /*RENAME*/newFunction(); function newFunction() { let y = 5; @@ -43,7 +43,7 @@ namespace A { function a() { let a = 1; - a = newFunction(a); + a = /*RENAME*/newFunction(a); } function newFunction(a: number) { @@ -64,7 +64,7 @@ namespace A { function a() { let a = 1; - a = newFunction(a); + a = /*RENAME*/newFunction(a); } } @@ -85,7 +85,7 @@ namespace A { function a() { let a = 1; - a = newFunction(x, a); + a = /*RENAME*/newFunction(x, a); } } } diff --git a/tests/baselines/reference/extractMethod/extractMethod6.ts b/tests/baselines/reference/extractMethod/extractMethod6.ts index 40135e6ec97..37112b80e9e 100644 --- a/tests/baselines/reference/extractMethod/extractMethod6.ts +++ b/tests/baselines/reference/extractMethod/extractMethod6.ts @@ -23,7 +23,7 @@ namespace A { function a() { let a = 1; - return newFunction(); + return /*RENAME*/newFunction(); function newFunction() { let y = 5; @@ -44,7 +44,7 @@ namespace A { let a = 1; var __return: any; - ({ __return, a } = newFunction(a)); + ({ __return, a } = /*RENAME*/newFunction(a)); return __return; } @@ -66,7 +66,7 @@ namespace A { let a = 1; var __return: any; - ({ __return, a } = newFunction(a)); + ({ __return, a } = /*RENAME*/newFunction(a)); return __return; } } @@ -88,7 +88,7 @@ namespace A { let a = 1; var __return: any; - ({ __return, a } = newFunction(x, a)); + ({ __return, a } = /*RENAME*/newFunction(x, a)); return __return; } } diff --git a/tests/baselines/reference/extractMethod/extractMethod7.ts b/tests/baselines/reference/extractMethod/extractMethod7.ts index d01532da796..8859b7b4fdd 100644 --- a/tests/baselines/reference/extractMethod/extractMethod7.ts +++ b/tests/baselines/reference/extractMethod/extractMethod7.ts @@ -27,7 +27,7 @@ namespace A { function a() { let a = 1; - return newFunction(); + return /*RENAME*/newFunction(); function newFunction() { let y = 5; @@ -50,7 +50,7 @@ namespace A { let a = 1; var __return: any; - ({ __return, a } = newFunction(a)); + ({ __return, a } = /*RENAME*/newFunction(a)); return __return; } @@ -74,7 +74,7 @@ namespace A { let a = 1; var __return: any; - ({ __return, a } = newFunction(a)); + ({ __return, a } = /*RENAME*/newFunction(a)); return __return; } } @@ -98,7 +98,7 @@ namespace A { let a = 1; var __return: any; - ({ __return, a } = newFunction(x, a)); + ({ __return, a } = /*RENAME*/newFunction(x, a)); return __return; } } diff --git a/tests/baselines/reference/extractMethod/extractMethod8.ts b/tests/baselines/reference/extractMethod/extractMethod8.ts index d59ca5dc238..cb06470d385 100644 --- a/tests/baselines/reference/extractMethod/extractMethod8.ts +++ b/tests/baselines/reference/extractMethod/extractMethod8.ts @@ -14,7 +14,7 @@ namespace A { namespace B { function a() { let a1 = 1; - return newFunction() + 100; + return /*RENAME*/newFunction() + 100; function newFunction() { return 1 + a1 + x; @@ -28,7 +28,7 @@ namespace A { namespace B { function a() { let a1 = 1; - return newFunction(a1) + 100; + return /*RENAME*/newFunction(a1) + 100; } function newFunction(a1: number) { @@ -42,7 +42,7 @@ namespace A { namespace B { function a() { let a1 = 1; - return newFunction(a1) + 100; + return /*RENAME*/newFunction(a1) + 100; } } @@ -56,7 +56,7 @@ namespace A { namespace B { function a() { let a1 = 1; - return newFunction(a1, x) + 100; + return /*RENAME*/newFunction(a1, x) + 100; } } } diff --git a/tests/baselines/reference/extractMethod/extractMethod9.ts b/tests/baselines/reference/extractMethod/extractMethod9.ts index 342e3c10eee..022dab82363 100644 --- a/tests/baselines/reference/extractMethod/extractMethod9.ts +++ b/tests/baselines/reference/extractMethod/extractMethod9.ts @@ -13,7 +13,7 @@ namespace A { export interface I { x: number }; namespace B { function a() { - return newFunction(); + return /*RENAME*/newFunction(); function newFunction() { let a1: I = { x: 1 }; @@ -27,7 +27,7 @@ namespace A { export interface I { x: number }; namespace B { function a() { - return newFunction(); + return /*RENAME*/newFunction(); } function newFunction() { @@ -41,7 +41,7 @@ namespace A { export interface I { x: number }; namespace B { function a() { - return newFunction(); + return /*RENAME*/newFunction(); } } @@ -55,7 +55,7 @@ namespace A { export interface I { x: number }; namespace B { function a() { - return newFunction(); + return /*RENAME*/newFunction(); } } } diff --git a/tests/baselines/reference/noUnusedLocals_selfReference.errors.txt b/tests/baselines/reference/noUnusedLocals_selfReference.errors.txt index af40081e71c..e4a0d478cb4 100644 --- a/tests/baselines/reference/noUnusedLocals_selfReference.errors.txt +++ b/tests/baselines/reference/noUnusedLocals_selfReference.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/noUnusedLocals_selfReference.ts(3,10): error TS6133: 'f' is declared but never used. -tests/cases/compiler/noUnusedLocals_selfReference.ts(4,7): error TS6133: 'C' is declared but never used. -tests/cases/compiler/noUnusedLocals_selfReference.ts(7,6): error TS6133: 'E' is declared but never used. +tests/cases/compiler/noUnusedLocals_selfReference.ts(3,10): error TS6133: 'f' is declared but its value is never read. +tests/cases/compiler/noUnusedLocals_selfReference.ts(4,7): error TS6133: 'C' is declared but its value is never read. +tests/cases/compiler/noUnusedLocals_selfReference.ts(7,6): error TS6133: 'E' is declared but its value is never read. ==== tests/cases/compiler/noUnusedLocals_selfReference.ts (3 errors) ==== @@ -8,15 +8,15 @@ tests/cases/compiler/noUnusedLocals_selfReference.ts(7,6): error TS6133: 'E' is function f() { f; } ~ -!!! error TS6133: 'f' is declared but never used. +!!! error TS6133: 'f' is declared but its value is never read. class C { ~ -!!! error TS6133: 'C' is declared but never used. +!!! error TS6133: 'C' is declared but its value is never read. m() { C; } } enum E { A = 0, B = E.A } ~ -!!! error TS6133: 'E' is declared but never used. +!!! error TS6133: 'E' is declared but its value is never read. // Does not detect mutual recursion. function g() { D; } diff --git a/tests/baselines/reference/noUnusedLocals_writeOnly.errors.txt b/tests/baselines/reference/noUnusedLocals_writeOnly.errors.txt new file mode 100644 index 00000000000..355bec02eb9 --- /dev/null +++ b/tests/baselines/reference/noUnusedLocals_writeOnly.errors.txt @@ -0,0 +1,16 @@ +tests/cases/compiler/noUnusedLocals_writeOnly.ts(1,12): error TS6133: 'x' is declared but its value is never read. + + +==== tests/cases/compiler/noUnusedLocals_writeOnly.ts (1 errors) ==== + function f(x = 0) { + ~ +!!! error TS6133: 'x' is declared but its value is never read. + x = 1; + x++; + x /= 2; + + let y = 0; + // This is a write access to y, but not a write-*only* access. + f(y++); + } + \ No newline at end of file diff --git a/tests/baselines/reference/noUnusedLocals_writeOnly.js b/tests/baselines/reference/noUnusedLocals_writeOnly.js new file mode 100644 index 00000000000..40529f690cd --- /dev/null +++ b/tests/baselines/reference/noUnusedLocals_writeOnly.js @@ -0,0 +1,22 @@ +//// [noUnusedLocals_writeOnly.ts] +function f(x = 0) { + x = 1; + x++; + x /= 2; + + let y = 0; + // This is a write access to y, but not a write-*only* access. + f(y++); +} + + +//// [noUnusedLocals_writeOnly.js] +function f(x) { + if (x === void 0) { x = 0; } + x = 1; + x++; + x /= 2; + var y = 0; + // This is a write access to y, but not a write-*only* access. + f(y++); +} diff --git a/tests/baselines/reference/noUnusedLocals_writeOnlyProperty.errors.txt b/tests/baselines/reference/noUnusedLocals_writeOnlyProperty.errors.txt new file mode 100644 index 00000000000..3f947c71473 --- /dev/null +++ b/tests/baselines/reference/noUnusedLocals_writeOnlyProperty.errors.txt @@ -0,0 +1,13 @@ +tests/cases/compiler/noUnusedLocals_writeOnlyProperty.ts(2,13): error TS6133: 'x' is declared but its value is never read. + + +==== tests/cases/compiler/noUnusedLocals_writeOnlyProperty.ts (1 errors) ==== + class C { + private x; + ~ +!!! error TS6133: 'x' is declared but its value is never read. + m() { + this.x = 0; + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/noUnusedLocals_writeOnlyProperty.js b/tests/baselines/reference/noUnusedLocals_writeOnlyProperty.js new file mode 100644 index 00000000000..1ac4efa8dde --- /dev/null +++ b/tests/baselines/reference/noUnusedLocals_writeOnlyProperty.js @@ -0,0 +1,18 @@ +//// [noUnusedLocals_writeOnlyProperty.ts] +class C { + private x; + m() { + this.x = 0; + } +} + + +//// [noUnusedLocals_writeOnlyProperty.js] +var C = /** @class */ (function () { + function C() { + } + C.prototype.m = function () { + this.x = 0; + }; + return C; +}()); diff --git a/tests/baselines/reference/unusedClassesinModule1.errors.txt b/tests/baselines/reference/unusedClassesinModule1.errors.txt index b3e8c3009cd..b7d0da8fc2d 100644 --- a/tests/baselines/reference/unusedClassesinModule1.errors.txt +++ b/tests/baselines/reference/unusedClassesinModule1.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/unusedClassesinModule1.ts(2,11): error TS6133: 'Calculator' is declared but never used. +tests/cases/compiler/unusedClassesinModule1.ts(2,11): error TS6133: 'Calculator' is declared but its value is never read. ==== tests/cases/compiler/unusedClassesinModule1.ts (1 errors) ==== module A { class Calculator { ~~~~~~~~~~ -!!! error TS6133: 'Calculator' is declared but never used. +!!! error TS6133: 'Calculator' is declared but its value is never read. public handelChar() { } } diff --git a/tests/baselines/reference/unusedClassesinNamespace1.errors.txt b/tests/baselines/reference/unusedClassesinNamespace1.errors.txt index 57f3e003242..2df9f918e7d 100644 --- a/tests/baselines/reference/unusedClassesinNamespace1.errors.txt +++ b/tests/baselines/reference/unusedClassesinNamespace1.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/unusedClassesinNamespace1.ts(2,11): error TS6133: 'c1' is declared but never used. +tests/cases/compiler/unusedClassesinNamespace1.ts(2,11): error TS6133: 'c1' is declared but its value is never read. ==== tests/cases/compiler/unusedClassesinNamespace1.ts (1 errors) ==== namespace Validation { class c1 { ~~ -!!! error TS6133: 'c1' is declared but never used. +!!! error TS6133: 'c1' is declared but its value is never read. } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedClassesinNamespace2.errors.txt b/tests/baselines/reference/unusedClassesinNamespace2.errors.txt index e8f9c659d0d..2425ea02e51 100644 --- a/tests/baselines/reference/unusedClassesinNamespace2.errors.txt +++ b/tests/baselines/reference/unusedClassesinNamespace2.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/unusedClassesinNamespace2.ts(2,11): error TS6133: 'c1' is declared but never used. +tests/cases/compiler/unusedClassesinNamespace2.ts(2,11): error TS6133: 'c1' is declared but its value is never read. ==== tests/cases/compiler/unusedClassesinNamespace2.ts (1 errors) ==== namespace Validation { class c1 { ~~ -!!! error TS6133: 'c1' is declared but never used. +!!! error TS6133: 'c1' is declared but its value is never read. } diff --git a/tests/baselines/reference/unusedClassesinNamespace4.errors.txt b/tests/baselines/reference/unusedClassesinNamespace4.errors.txt index b2ddfe3f3f6..719689fbca3 100644 --- a/tests/baselines/reference/unusedClassesinNamespace4.errors.txt +++ b/tests/baselines/reference/unusedClassesinNamespace4.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/unusedClassesinNamespace4.ts(10,11): error TS6133: 'c3' is declared but never used. +tests/cases/compiler/unusedClassesinNamespace4.ts(10,11): error TS6133: 'c3' is declared but its value is never read. ==== tests/cases/compiler/unusedClassesinNamespace4.ts (1 errors) ==== @@ -13,7 +13,7 @@ tests/cases/compiler/unusedClassesinNamespace4.ts(10,11): error TS6133: 'c3' is class c3 extends c1 { ~~ -!!! error TS6133: 'c3' is declared but never used. +!!! error TS6133: 'c3' is declared but its value is never read. } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedClassesinNamespace5.errors.txt b/tests/baselines/reference/unusedClassesinNamespace5.errors.txt index 29c08c9a107..7f7f5cf1b7a 100644 --- a/tests/baselines/reference/unusedClassesinNamespace5.errors.txt +++ b/tests/baselines/reference/unusedClassesinNamespace5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/unusedClassesinNamespace5.ts(10,11): error TS6133: 'c3' is declared but never used. +tests/cases/compiler/unusedClassesinNamespace5.ts(10,11): error TS6133: 'c3' is declared but its value is never read. ==== tests/cases/compiler/unusedClassesinNamespace5.ts (1 errors) ==== @@ -13,7 +13,7 @@ tests/cases/compiler/unusedClassesinNamespace5.ts(10,11): error TS6133: 'c3' is class c3 { ~~ -!!! error TS6133: 'c3' is declared but never used. +!!! error TS6133: 'c3' is declared but its value is never read. public x: c1; } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedDestructuringParameters.errors.txt b/tests/baselines/reference/unusedDestructuringParameters.errors.txt index b6814df6b7a..24a7b3838cd 100644 --- a/tests/baselines/reference/unusedDestructuringParameters.errors.txt +++ b/tests/baselines/reference/unusedDestructuringParameters.errors.txt @@ -1,15 +1,15 @@ -tests/cases/compiler/unusedDestructuringParameters.ts(1,13): error TS6133: 'a' is declared but never used. -tests/cases/compiler/unusedDestructuringParameters.ts(3,14): error TS6133: 'a' is declared but never used. +tests/cases/compiler/unusedDestructuringParameters.ts(1,13): error TS6133: 'a' is declared but its value is never read. +tests/cases/compiler/unusedDestructuringParameters.ts(3,14): error TS6133: 'a' is declared but its value is never read. ==== tests/cases/compiler/unusedDestructuringParameters.ts (2 errors) ==== const f = ([a]) => { }; ~ -!!! error TS6133: 'a' is declared but never used. +!!! error TS6133: 'a' is declared but its value is never read. f([1]); const f2 = ({a}) => { }; ~ -!!! error TS6133: 'a' is declared but never used. +!!! error TS6133: 'a' is declared but its value is never read. f2({ a: 10 }); const f3 = ([_]) => { }; f3([10]); \ No newline at end of file diff --git a/tests/baselines/reference/unusedFunctionsinNamespaces1.errors.txt b/tests/baselines/reference/unusedFunctionsinNamespaces1.errors.txt index 6d59137b4b7..202977c6fb7 100644 --- a/tests/baselines/reference/unusedFunctionsinNamespaces1.errors.txt +++ b/tests/baselines/reference/unusedFunctionsinNamespaces1.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/unusedFunctionsinNamespaces1.ts(2,14): error TS6133: 'function1' is declared but never used. +tests/cases/compiler/unusedFunctionsinNamespaces1.ts(2,14): error TS6133: 'function1' is declared but its value is never read. ==== tests/cases/compiler/unusedFunctionsinNamespaces1.ts (1 errors) ==== namespace Validation { function function1() { ~~~~~~~~~ -!!! error TS6133: 'function1' is declared but never used. +!!! error TS6133: 'function1' is declared but its value is never read. } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedFunctionsinNamespaces2.errors.txt b/tests/baselines/reference/unusedFunctionsinNamespaces2.errors.txt index 68fffcc4f51..eec94fee215 100644 --- a/tests/baselines/reference/unusedFunctionsinNamespaces2.errors.txt +++ b/tests/baselines/reference/unusedFunctionsinNamespaces2.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/unusedFunctionsinNamespaces2.ts(2,9): error TS6133: 'function1' is declared but never used. +tests/cases/compiler/unusedFunctionsinNamespaces2.ts(2,9): error TS6133: 'function1' is declared but its value is never read. ==== tests/cases/compiler/unusedFunctionsinNamespaces2.ts (1 errors) ==== namespace Validation { var function1 = function() { ~~~~~~~~~ -!!! error TS6133: 'function1' is declared but never used. +!!! error TS6133: 'function1' is declared but its value is never read. } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedFunctionsinNamespaces3.errors.txt b/tests/baselines/reference/unusedFunctionsinNamespaces3.errors.txt index 0046d4eb116..8761ec400b1 100644 --- a/tests/baselines/reference/unusedFunctionsinNamespaces3.errors.txt +++ b/tests/baselines/reference/unusedFunctionsinNamespaces3.errors.txt @@ -1,13 +1,13 @@ -tests/cases/compiler/unusedFunctionsinNamespaces3.ts(2,9): error TS6133: 'function1' is declared but never used. -tests/cases/compiler/unusedFunctionsinNamespaces3.ts(2,30): error TS6133: 'param1' is declared but never used. +tests/cases/compiler/unusedFunctionsinNamespaces3.ts(2,9): error TS6133: 'function1' is declared but its value is never read. +tests/cases/compiler/unusedFunctionsinNamespaces3.ts(2,30): error TS6133: 'param1' is declared but its value is never read. ==== tests/cases/compiler/unusedFunctionsinNamespaces3.ts (2 errors) ==== namespace Validation { var function1 = function(param1:string) { ~~~~~~~~~ -!!! error TS6133: 'function1' is declared but never used. +!!! error TS6133: 'function1' is declared but its value is never read. ~~~~~~ -!!! error TS6133: 'param1' is declared but never used. +!!! error TS6133: 'param1' is declared but its value is never read. } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedFunctionsinNamespaces4.errors.txt b/tests/baselines/reference/unusedFunctionsinNamespaces4.errors.txt index c012f671427..feb8f8158db 100644 --- a/tests/baselines/reference/unusedFunctionsinNamespaces4.errors.txt +++ b/tests/baselines/reference/unusedFunctionsinNamespaces4.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/unusedFunctionsinNamespaces4.ts(2,9): error TS6133: 'function1' is declared but never used. +tests/cases/compiler/unusedFunctionsinNamespaces4.ts(2,9): error TS6133: 'function1' is declared but its value is never read. ==== tests/cases/compiler/unusedFunctionsinNamespaces4.ts (1 errors) ==== namespace Validation { var function1 = function() { ~~~~~~~~~ -!!! error TS6133: 'function1' is declared but never used. +!!! error TS6133: 'function1' is declared but its value is never read. } export function function2() { diff --git a/tests/baselines/reference/unusedFunctionsinNamespaces5.errors.txt b/tests/baselines/reference/unusedFunctionsinNamespaces5.errors.txt index 0c7a6321922..8f7f617e559 100644 --- a/tests/baselines/reference/unusedFunctionsinNamespaces5.errors.txt +++ b/tests/baselines/reference/unusedFunctionsinNamespaces5.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/unusedFunctionsinNamespaces5.ts(9,14): error TS6133: 'function3' is declared but never used. -tests/cases/compiler/unusedFunctionsinNamespaces5.ts(13,14): error TS6133: 'function4' is declared but never used. +tests/cases/compiler/unusedFunctionsinNamespaces5.ts(9,14): error TS6133: 'function3' is declared but its value is never read. +tests/cases/compiler/unusedFunctionsinNamespaces5.ts(13,14): error TS6133: 'function4' is declared but its value is never read. ==== tests/cases/compiler/unusedFunctionsinNamespaces5.ts (2 errors) ==== @@ -13,13 +13,13 @@ tests/cases/compiler/unusedFunctionsinNamespaces5.ts(13,14): error TS6133: 'func function function3() { ~~~~~~~~~ -!!! error TS6133: 'function3' is declared but never used. +!!! error TS6133: 'function3' is declared but its value is never read. function1(); } function function4() { ~~~~~~~~~ -!!! error TS6133: 'function4' is declared but never used. +!!! error TS6133: 'function4' is declared but its value is never read. } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedFunctionsinNamespaces6.errors.txt b/tests/baselines/reference/unusedFunctionsinNamespaces6.errors.txt index a3ab17655b2..de5f7ae4d87 100644 --- a/tests/baselines/reference/unusedFunctionsinNamespaces6.errors.txt +++ b/tests/baselines/reference/unusedFunctionsinNamespaces6.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/unusedFunctionsinNamespaces6.ts(13,14): error TS6133: 'function4' is declared but never used. +tests/cases/compiler/unusedFunctionsinNamespaces6.ts(13,14): error TS6133: 'function4' is declared but its value is never read. ==== tests/cases/compiler/unusedFunctionsinNamespaces6.ts (1 errors) ==== @@ -16,7 +16,7 @@ tests/cases/compiler/unusedFunctionsinNamespaces6.ts(13,14): error TS6133: 'func function function4() { ~~~~~~~~~ -!!! error TS6133: 'function4' is declared but never used. +!!! error TS6133: 'function4' is declared but its value is never read. } diff --git a/tests/baselines/reference/unusedIdentifiersConsolidated1.errors.txt b/tests/baselines/reference/unusedIdentifiersConsolidated1.errors.txt index 51db8356293..c327dc4b19b 100644 --- a/tests/baselines/reference/unusedIdentifiersConsolidated1.errors.txt +++ b/tests/baselines/reference/unusedIdentifiersConsolidated1.errors.txt @@ -1,55 +1,58 @@ -tests/cases/compiler/unusedIdentifiersConsolidated1.ts(1,18): error TS6133: 'person' is declared but never used. -tests/cases/compiler/unusedIdentifiersConsolidated1.ts(2,9): error TS6133: 'unused' is declared but never used. -tests/cases/compiler/unusedIdentifiersConsolidated1.ts(5,32): error TS6133: 'unusedtypeparameter' is declared but never used. -tests/cases/compiler/unusedIdentifiersConsolidated1.ts(6,13): error TS6133: 'unusedprivatevariable' is declared but never used. -tests/cases/compiler/unusedIdentifiersConsolidated1.ts(11,17): error TS6133: 'message' is declared but never used. -tests/cases/compiler/unusedIdentifiersConsolidated1.ts(12,13): error TS6133: 'unused2' is declared but never used. -tests/cases/compiler/unusedIdentifiersConsolidated1.ts(16,20): error TS6133: 'person' is declared but never used. -tests/cases/compiler/unusedIdentifiersConsolidated1.ts(17,13): error TS6133: 'unused' is declared but never used. -tests/cases/compiler/unusedIdentifiersConsolidated1.ts(24,13): error TS6133: 'unUsedPrivateFunction' is declared but never used. -tests/cases/compiler/unusedIdentifiersConsolidated1.ts(37,11): error TS6133: 'numberRegexp' is declared but never used. -tests/cases/compiler/unusedIdentifiersConsolidated1.ts(44,17): error TS6133: 'unUsedPrivateFunction' is declared but never used. -tests/cases/compiler/unusedIdentifiersConsolidated1.ts(57,15): error TS6133: 'usedLocallyInterface2' is declared but never used. -tests/cases/compiler/unusedIdentifiersConsolidated1.ts(64,11): error TS6133: 'dummy' is declared but never used. -tests/cases/compiler/unusedIdentifiersConsolidated1.ts(67,15): error TS6133: 'unusedInterface' is declared but never used. -tests/cases/compiler/unusedIdentifiersConsolidated1.ts(79,11): error TS6133: 'class3' is declared but never used. -tests/cases/compiler/unusedIdentifiersConsolidated1.ts(99,15): error TS6133: 'interface5' is declared but never used. +tests/cases/compiler/unusedIdentifiersConsolidated1.ts(1,18): error TS6133: 'person' is declared but its value is never read. +tests/cases/compiler/unusedIdentifiersConsolidated1.ts(2,9): error TS6133: 'unused' is declared but its value is never read. +tests/cases/compiler/unusedIdentifiersConsolidated1.ts(5,32): error TS6133: 'unusedtypeparameter' is declared but its value is never read. +tests/cases/compiler/unusedIdentifiersConsolidated1.ts(6,13): error TS6133: 'unusedprivatevariable' is declared but its value is never read. +tests/cases/compiler/unusedIdentifiersConsolidated1.ts(7,13): error TS6133: 'greeting' is declared but its value is never read. +tests/cases/compiler/unusedIdentifiersConsolidated1.ts(11,17): error TS6133: 'message' is declared but its value is never read. +tests/cases/compiler/unusedIdentifiersConsolidated1.ts(12,13): error TS6133: 'unused2' is declared but its value is never read. +tests/cases/compiler/unusedIdentifiersConsolidated1.ts(16,20): error TS6133: 'person' is declared but its value is never read. +tests/cases/compiler/unusedIdentifiersConsolidated1.ts(17,13): error TS6133: 'unused' is declared but its value is never read. +tests/cases/compiler/unusedIdentifiersConsolidated1.ts(24,13): error TS6133: 'unUsedPrivateFunction' is declared but its value is never read. +tests/cases/compiler/unusedIdentifiersConsolidated1.ts(37,11): error TS6133: 'numberRegexp' is declared but its value is never read. +tests/cases/compiler/unusedIdentifiersConsolidated1.ts(44,17): error TS6133: 'unUsedPrivateFunction' is declared but its value is never read. +tests/cases/compiler/unusedIdentifiersConsolidated1.ts(57,15): error TS6133: 'usedLocallyInterface2' is declared but its value is never read. +tests/cases/compiler/unusedIdentifiersConsolidated1.ts(64,11): error TS6133: 'dummy' is declared but its value is never read. +tests/cases/compiler/unusedIdentifiersConsolidated1.ts(67,15): error TS6133: 'unusedInterface' is declared but its value is never read. +tests/cases/compiler/unusedIdentifiersConsolidated1.ts(79,11): error TS6133: 'class3' is declared but its value is never read. +tests/cases/compiler/unusedIdentifiersConsolidated1.ts(99,15): error TS6133: 'interface5' is declared but its value is never read. -==== tests/cases/compiler/unusedIdentifiersConsolidated1.ts (16 errors) ==== +==== tests/cases/compiler/unusedIdentifiersConsolidated1.ts (17 errors) ==== function greeter(person: string) { ~~~~~~ -!!! error TS6133: 'person' is declared but never used. +!!! error TS6133: 'person' is declared but its value is never read. var unused = 20; ~~~~~~ -!!! error TS6133: 'unused' is declared but never used. +!!! error TS6133: 'unused' is declared but its value is never read. } class Dummy { ~~~~~~~~~~~~~~~~~~~ -!!! error TS6133: 'unusedtypeparameter' is declared but never used. +!!! error TS6133: 'unusedtypeparameter' is declared but its value is never read. private unusedprivatevariable: string; ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS6133: 'unusedprivatevariable' is declared but never used. +!!! error TS6133: 'unusedprivatevariable' is declared but its value is never read. private greeting: string; + ~~~~~~~~ +!!! error TS6133: 'greeting' is declared but its value is never read. public unusedpublicvariable: string; public typedvariable: usedtypeparameter; constructor(message: string) { ~~~~~~~ -!!! error TS6133: 'message' is declared but never used. +!!! error TS6133: 'message' is declared but its value is never read. var unused2 = 22; ~~~~~~~ -!!! error TS6133: 'unused2' is declared but never used. +!!! error TS6133: 'unused2' is declared but its value is never read. this.greeting = "Dummy Message"; } public greeter(person: string) { ~~~~~~ -!!! error TS6133: 'person' is declared but never used. +!!! error TS6133: 'person' is declared but its value is never read. var unused = 20; ~~~~~~ -!!! error TS6133: 'unused' is declared but never used. +!!! error TS6133: 'unused' is declared but its value is never read. this.usedPrivateFunction(); } @@ -58,7 +61,7 @@ tests/cases/compiler/unusedIdentifiersConsolidated1.ts(99,15): error TS6133: 'in private unUsedPrivateFunction() { ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS6133: 'unUsedPrivateFunction' is declared but never used. +!!! error TS6133: 'unUsedPrivateFunction' is declared but its value is never read. } } @@ -73,7 +76,7 @@ tests/cases/compiler/unusedIdentifiersConsolidated1.ts(99,15): error TS6133: 'in const lettersRegexp = /^[A-Za-z]+$/; const numberRegexp = /^[0-9]+$/; ~~~~~~~~~~~~ -!!! error TS6133: 'numberRegexp' is declared but never used. +!!! error TS6133: 'numberRegexp' is declared but its value is never read. export class LettersOnlyValidator implements StringValidator { isAcceptable(s2: string) { @@ -82,7 +85,7 @@ tests/cases/compiler/unusedIdentifiersConsolidated1.ts(99,15): error TS6133: 'in private unUsedPrivateFunction() { ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS6133: 'unUsedPrivateFunction' is declared but never used. +!!! error TS6133: 'unUsedPrivateFunction' is declared but its value is never read. } } @@ -97,7 +100,7 @@ tests/cases/compiler/unusedIdentifiersConsolidated1.ts(99,15): error TS6133: 'in interface usedLocallyInterface2 { ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS6133: 'usedLocallyInterface2' is declared but never used. +!!! error TS6133: 'usedLocallyInterface2' is declared but its value is never read. someFunction(s1: string): void; } @@ -106,12 +109,12 @@ tests/cases/compiler/unusedIdentifiersConsolidated1.ts(99,15): error TS6133: 'in class dummy implements usedLocallyInterface { ~~~~~ -!!! error TS6133: 'dummy' is declared but never used. +!!! error TS6133: 'dummy' is declared but its value is never read. } interface unusedInterface { ~~~~~~~~~~~~~~~ -!!! error TS6133: 'unusedInterface' is declared but never used. +!!! error TS6133: 'unusedInterface' is declared but its value is never read. } } @@ -125,7 +128,7 @@ tests/cases/compiler/unusedIdentifiersConsolidated1.ts(99,15): error TS6133: 'in class class3 { ~~~~~~ -!!! error TS6133: 'class3' is declared but never used. +!!! error TS6133: 'class3' is declared but its value is never read. } export class class4 { @@ -147,6 +150,6 @@ tests/cases/compiler/unusedIdentifiersConsolidated1.ts(99,15): error TS6133: 'in interface interface5 { ~~~~~~~~~~ -!!! error TS6133: 'interface5' is declared but never used. +!!! error TS6133: 'interface5' is declared but its value is never read. } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedImports1.errors.txt b/tests/baselines/reference/unusedImports1.errors.txt index ad5d52a861e..36963513146 100644 --- a/tests/baselines/reference/unusedImports1.errors.txt +++ b/tests/baselines/reference/unusedImports1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/file2.ts(1,9): error TS6133: 'Calculator' is declared but never used. +tests/cases/compiler/file2.ts(1,9): error TS6133: 'Calculator' is declared but its value is never read. ==== tests/cases/compiler/file1.ts (0 errors) ==== @@ -9,4 +9,4 @@ tests/cases/compiler/file2.ts(1,9): error TS6133: 'Calculator' is declared but n ==== tests/cases/compiler/file2.ts (1 errors) ==== import {Calculator} from "./file1" ~~~~~~~~~~ -!!! error TS6133: 'Calculator' is declared but never used. \ No newline at end of file +!!! error TS6133: 'Calculator' is declared but its value is never read. \ No newline at end of file diff --git a/tests/baselines/reference/unusedImports10.errors.txt b/tests/baselines/reference/unusedImports10.errors.txt index 916f9f8e46d..b9688a01185 100644 --- a/tests/baselines/reference/unusedImports10.errors.txt +++ b/tests/baselines/reference/unusedImports10.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/unusedImports10.ts(9,12): error TS6133: 'a' is declared but never used. +tests/cases/compiler/unusedImports10.ts(9,12): error TS6133: 'a' is declared but its value is never read. ==== tests/cases/compiler/unusedImports10.ts (1 errors) ==== @@ -12,5 +12,5 @@ tests/cases/compiler/unusedImports10.ts(9,12): error TS6133: 'a' is declared but module B { import a = A; ~ -!!! error TS6133: 'a' is declared but never used. +!!! error TS6133: 'a' is declared but its value is never read. } \ No newline at end of file diff --git a/tests/baselines/reference/unusedImports12.errors.txt b/tests/baselines/reference/unusedImports12.errors.txt index 7c4e581bf2f..56df4edc5e3 100644 --- a/tests/baselines/reference/unusedImports12.errors.txt +++ b/tests/baselines/reference/unusedImports12.errors.txt @@ -1,25 +1,25 @@ -tests/cases/compiler/a.ts(1,10): error TS6133: 'Member' is declared but never used. -tests/cases/compiler/a.ts(2,8): error TS6133: 'd' is declared but never used. -tests/cases/compiler/a.ts(2,23): error TS6133: 'M' is declared but never used. -tests/cases/compiler/a.ts(3,13): error TS6133: 'ns' is declared but never used. -tests/cases/compiler/a.ts(4,8): error TS6133: 'r' is declared but never used. +tests/cases/compiler/a.ts(1,10): error TS6133: 'Member' is declared but its value is never read. +tests/cases/compiler/a.ts(2,8): error TS6133: 'd' is declared but its value is never read. +tests/cases/compiler/a.ts(2,23): error TS6133: 'M' is declared but its value is never read. +tests/cases/compiler/a.ts(3,13): error TS6133: 'ns' is declared but its value is never read. +tests/cases/compiler/a.ts(4,8): error TS6133: 'r' is declared but its value is never read. ==== tests/cases/compiler/a.ts (5 errors) ==== import { Member } from './b'; ~~~~~~ -!!! error TS6133: 'Member' is declared but never used. +!!! error TS6133: 'Member' is declared but its value is never read. import d, { Member as M } from './b'; ~ -!!! error TS6133: 'd' is declared but never used. +!!! error TS6133: 'd' is declared but its value is never read. ~ -!!! error TS6133: 'M' is declared but never used. +!!! error TS6133: 'M' is declared but its value is never read. import * as ns from './b'; ~~ -!!! error TS6133: 'ns' is declared but never used. +!!! error TS6133: 'ns' is declared but its value is never read. import r = require("./b"); ~ -!!! error TS6133: 'r' is declared but never used. +!!! error TS6133: 'r' is declared but its value is never read. ==== tests/cases/compiler/b.ts (0 errors) ==== export class Member {} diff --git a/tests/baselines/reference/unusedImports2.errors.txt b/tests/baselines/reference/unusedImports2.errors.txt index 6755a432b48..c037eea2f51 100644 --- a/tests/baselines/reference/unusedImports2.errors.txt +++ b/tests/baselines/reference/unusedImports2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/file2.ts(2,9): error TS6133: 'test' is declared but never used. +tests/cases/compiler/file2.ts(2,9): error TS6133: 'test' is declared but its value is never read. ==== tests/cases/compiler/file1.ts (0 errors) ==== @@ -14,7 +14,7 @@ tests/cases/compiler/file2.ts(2,9): error TS6133: 'test' is declared but never u import {Calculator} from "./file1" import {test} from "./file1" ~~~~ -!!! error TS6133: 'test' is declared but never used. +!!! error TS6133: 'test' is declared but its value is never read. var x = new Calculator(); x.handleChar(); \ No newline at end of file diff --git a/tests/baselines/reference/unusedImports3.errors.txt b/tests/baselines/reference/unusedImports3.errors.txt index b63087466fe..5271d72cf77 100644 --- a/tests/baselines/reference/unusedImports3.errors.txt +++ b/tests/baselines/reference/unusedImports3.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/file2.ts(1,9): error TS6133: 'Calculator' is declared but never used. +tests/cases/compiler/file2.ts(1,9): error TS6133: 'Calculator' is declared but its value is never read. ==== tests/cases/compiler/file1.ts (0 errors) ==== @@ -17,7 +17,7 @@ tests/cases/compiler/file2.ts(1,9): error TS6133: 'Calculator' is declared but n ==== tests/cases/compiler/file2.ts (1 errors) ==== import {Calculator, test, test2} from "./file1" ~~~~~~~~~~ -!!! error TS6133: 'Calculator' is declared but never used. +!!! error TS6133: 'Calculator' is declared but its value is never read. test(); test2(); \ No newline at end of file diff --git a/tests/baselines/reference/unusedImports4.errors.txt b/tests/baselines/reference/unusedImports4.errors.txt index c57bc534137..7f475e2967e 100644 --- a/tests/baselines/reference/unusedImports4.errors.txt +++ b/tests/baselines/reference/unusedImports4.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/file2.ts(1,21): error TS6133: 'test' is declared but never used. +tests/cases/compiler/file2.ts(1,21): error TS6133: 'test' is declared but its value is never read. ==== tests/cases/compiler/file1.ts (0 errors) ==== @@ -17,7 +17,7 @@ tests/cases/compiler/file2.ts(1,21): error TS6133: 'test' is declared but never ==== tests/cases/compiler/file2.ts (1 errors) ==== import {Calculator, test, test2} from "./file1" ~~~~ -!!! error TS6133: 'test' is declared but never used. +!!! error TS6133: 'test' is declared but its value is never read. var x = new Calculator(); x.handleChar(); diff --git a/tests/baselines/reference/unusedImports5.errors.txt b/tests/baselines/reference/unusedImports5.errors.txt index 10fc097237c..4b433db9b7c 100644 --- a/tests/baselines/reference/unusedImports5.errors.txt +++ b/tests/baselines/reference/unusedImports5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/file2.ts(1,27): error TS6133: 'test2' is declared but never used. +tests/cases/compiler/file2.ts(1,27): error TS6133: 'test2' is declared but its value is never read. ==== tests/cases/compiler/file1.ts (0 errors) ==== @@ -17,7 +17,7 @@ tests/cases/compiler/file2.ts(1,27): error TS6133: 'test2' is declared but never ==== tests/cases/compiler/file2.ts (1 errors) ==== import {Calculator, test, test2} from "./file1" ~~~~~ -!!! error TS6133: 'test2' is declared but never used. +!!! error TS6133: 'test2' is declared but its value is never read. var x = new Calculator(); x.handleChar(); diff --git a/tests/baselines/reference/unusedImports6.errors.txt b/tests/baselines/reference/unusedImports6.errors.txt index ed9b9c43ee8..28b2d1a2875 100644 --- a/tests/baselines/reference/unusedImports6.errors.txt +++ b/tests/baselines/reference/unusedImports6.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/file2.ts(1,8): error TS6133: 'd' is declared but never used. +tests/cases/compiler/file2.ts(1,8): error TS6133: 'd' is declared but its value is never read. ==== tests/cases/compiler/file1.ts (0 errors) ==== @@ -17,7 +17,7 @@ tests/cases/compiler/file2.ts(1,8): error TS6133: 'd' is declared but never used ==== tests/cases/compiler/file2.ts (1 errors) ==== import d from "./file1" ~ -!!! error TS6133: 'd' is declared but never used. +!!! error TS6133: 'd' is declared but its value is never read. diff --git a/tests/baselines/reference/unusedImports7.errors.txt b/tests/baselines/reference/unusedImports7.errors.txt index ac3a82a7f4d..9482a2c6f47 100644 --- a/tests/baselines/reference/unusedImports7.errors.txt +++ b/tests/baselines/reference/unusedImports7.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/file2.ts(1,13): error TS6133: 'n' is declared but never used. +tests/cases/compiler/file2.ts(1,13): error TS6133: 'n' is declared but its value is never read. ==== tests/cases/compiler/file1.ts (0 errors) ==== @@ -17,6 +17,6 @@ tests/cases/compiler/file2.ts(1,13): error TS6133: 'n' is declared but never use ==== tests/cases/compiler/file2.ts (1 errors) ==== import * as n from "./file1" ~ -!!! error TS6133: 'n' is declared but never used. +!!! error TS6133: 'n' is declared but its value is never read. \ No newline at end of file diff --git a/tests/baselines/reference/unusedImports8.errors.txt b/tests/baselines/reference/unusedImports8.errors.txt index 1c9d7a5ae8c..a6cbaae8ff6 100644 --- a/tests/baselines/reference/unusedImports8.errors.txt +++ b/tests/baselines/reference/unusedImports8.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/file2.ts(1,50): error TS6133: 't2' is declared but never used. +tests/cases/compiler/file2.ts(1,50): error TS6133: 't2' is declared but its value is never read. ==== tests/cases/compiler/file1.ts (0 errors) ==== @@ -17,7 +17,7 @@ tests/cases/compiler/file2.ts(1,50): error TS6133: 't2' is declared but never us ==== tests/cases/compiler/file2.ts (1 errors) ==== import {Calculator as calc, test as t1, test2 as t2} from "./file1" ~~ -!!! error TS6133: 't2' is declared but never used. +!!! error TS6133: 't2' is declared but its value is never read. var x = new calc(); x.handleChar(); diff --git a/tests/baselines/reference/unusedImports9.errors.txt b/tests/baselines/reference/unusedImports9.errors.txt index d46f0b68284..2452962b289 100644 --- a/tests/baselines/reference/unusedImports9.errors.txt +++ b/tests/baselines/reference/unusedImports9.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/file2.ts(1,8): error TS6133: 'c' is declared but never used. +tests/cases/compiler/file2.ts(1,8): error TS6133: 'c' is declared but its value is never read. ==== tests/cases/compiler/file2.ts (1 errors) ==== import c = require('./file1') ~ -!!! error TS6133: 'c' is declared but never used. +!!! error TS6133: 'c' is declared but its value is never read. ==== tests/cases/compiler/file1.ts (0 errors) ==== export class Calculator { handleChar() {} diff --git a/tests/baselines/reference/unusedInterfaceinNamespace1.errors.txt b/tests/baselines/reference/unusedInterfaceinNamespace1.errors.txt index eac7c6301df..613852735de 100644 --- a/tests/baselines/reference/unusedInterfaceinNamespace1.errors.txt +++ b/tests/baselines/reference/unusedInterfaceinNamespace1.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/unusedInterfaceinNamespace1.ts(2,15): error TS6133: 'i1' is declared but never used. +tests/cases/compiler/unusedInterfaceinNamespace1.ts(2,15): error TS6133: 'i1' is declared but its value is never read. ==== tests/cases/compiler/unusedInterfaceinNamespace1.ts (1 errors) ==== namespace Validation { interface i1 { ~~ -!!! error TS6133: 'i1' is declared but never used. +!!! error TS6133: 'i1' is declared but its value is never read. } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedInterfaceinNamespace2.errors.txt b/tests/baselines/reference/unusedInterfaceinNamespace2.errors.txt index 1e8ea56ea0e..9ce75e393fe 100644 --- a/tests/baselines/reference/unusedInterfaceinNamespace2.errors.txt +++ b/tests/baselines/reference/unusedInterfaceinNamespace2.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/unusedInterfaceinNamespace2.ts(2,15): error TS6133: 'i1' is declared but never used. +tests/cases/compiler/unusedInterfaceinNamespace2.ts(2,15): error TS6133: 'i1' is declared but its value is never read. ==== tests/cases/compiler/unusedInterfaceinNamespace2.ts (1 errors) ==== namespace Validation { interface i1 { ~~ -!!! error TS6133: 'i1' is declared but never used. +!!! error TS6133: 'i1' is declared but its value is never read. } diff --git a/tests/baselines/reference/unusedInterfaceinNamespace3.errors.txt b/tests/baselines/reference/unusedInterfaceinNamespace3.errors.txt index 519244e4c5d..b1b1cbb9b86 100644 --- a/tests/baselines/reference/unusedInterfaceinNamespace3.errors.txt +++ b/tests/baselines/reference/unusedInterfaceinNamespace3.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/unusedInterfaceinNamespace3.ts(10,15): error TS6133: 'i3' is declared but never used. +tests/cases/compiler/unusedInterfaceinNamespace3.ts(10,15): error TS6133: 'i3' is declared but its value is never read. ==== tests/cases/compiler/unusedInterfaceinNamespace3.ts (1 errors) ==== @@ -13,7 +13,7 @@ tests/cases/compiler/unusedInterfaceinNamespace3.ts(10,15): error TS6133: 'i3' i interface i3 extends i1 { ~~ -!!! error TS6133: 'i3' is declared but never used. +!!! error TS6133: 'i3' is declared but its value is never read. } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedLocalsAndObjectSpread.errors.txt b/tests/baselines/reference/unusedLocalsAndObjectSpread.errors.txt index 4dfd37f7668..c3f89f32488 100644 --- a/tests/baselines/reference/unusedLocalsAndObjectSpread.errors.txt +++ b/tests/baselines/reference/unusedLocalsAndObjectSpread.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/unusedLocalsAndObjectSpread.ts(20,18): error TS6133: 'bar' is declared but never used. -tests/cases/compiler/unusedLocalsAndObjectSpread.ts(27,21): error TS6133: 'bar' is declared but never used. +tests/cases/compiler/unusedLocalsAndObjectSpread.ts(20,18): error TS6133: 'bar' is declared but its value is never read. +tests/cases/compiler/unusedLocalsAndObjectSpread.ts(27,21): error TS6133: 'bar' is declared but its value is never read. ==== tests/cases/compiler/unusedLocalsAndObjectSpread.ts (2 errors) ==== @@ -24,7 +24,7 @@ tests/cases/compiler/unusedLocalsAndObjectSpread.ts(27,21): error TS6133: 'bar' // 'a' is declared but never used const {a, ...bar} = foo; // bar should be unused ~~~ -!!! error TS6133: 'bar' is declared but never used. +!!! error TS6133: 'bar' is declared but its value is never read. //console.log(bar); } @@ -33,7 +33,7 @@ tests/cases/compiler/unusedLocalsAndObjectSpread.ts(27,21): error TS6133: 'bar' // '_' is declared but never used const {a: _, ...bar} = foo; // bar should be unused ~~~ -!!! error TS6133: 'bar' is declared but never used. +!!! error TS6133: 'bar' is declared but its value is never read. //console.log(bar); } \ No newline at end of file diff --git a/tests/baselines/reference/unusedLocalsAndObjectSpread2.errors.txt b/tests/baselines/reference/unusedLocalsAndObjectSpread2.errors.txt index 57d265e3b7e..2e29bf04608 100644 --- a/tests/baselines/reference/unusedLocalsAndObjectSpread2.errors.txt +++ b/tests/baselines/reference/unusedLocalsAndObjectSpread2.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/unusedLocalsAndObjectSpread2.ts(5,6): error TS6133: 'rest' is declared but never used. -tests/cases/compiler/unusedLocalsAndObjectSpread2.ts(8,10): error TS6133: 'foo' is declared but never used. -tests/cases/compiler/unusedLocalsAndObjectSpread2.ts(12,8): error TS6133: 'rest' is declared but never used. +tests/cases/compiler/unusedLocalsAndObjectSpread2.ts(5,6): error TS6133: 'rest' is declared but its value is never read. +tests/cases/compiler/unusedLocalsAndObjectSpread2.ts(8,10): error TS6133: 'foo' is declared but its value is never read. +tests/cases/compiler/unusedLocalsAndObjectSpread2.ts(12,8): error TS6133: 'rest' is declared but its value is never read. ==== tests/cases/compiler/unusedLocalsAndObjectSpread2.ts (3 errors) ==== @@ -10,18 +10,18 @@ tests/cases/compiler/unusedLocalsAndObjectSpread2.ts(12,8): error TS6133: 'rest' active: _a, // here! ...rest, ~~~~ -!!! error TS6133: 'rest' is declared but never used. +!!! error TS6133: 'rest' is declared but its value is never read. } = props; function foo() { ~~~ -!!! error TS6133: 'foo' is declared but never used. +!!! error TS6133: 'foo' is declared but its value is never read. const { children, active: _a, ...rest, ~~~~ -!!! error TS6133: 'rest' is declared but never used. +!!! error TS6133: 'rest' is declared but its value is never read. } = props; } diff --git a/tests/baselines/reference/unusedLocalsAndParameters.errors.txt b/tests/baselines/reference/unusedLocalsAndParameters.errors.txt index 2416b29c216..01fcdd4f225 100644 --- a/tests/baselines/reference/unusedLocalsAndParameters.errors.txt +++ b/tests/baselines/reference/unusedLocalsAndParameters.errors.txt @@ -1,27 +1,27 @@ -tests/cases/compiler/unusedLocalsAndParameters.ts(4,12): error TS6133: 'a' is declared but never used. -tests/cases/compiler/unusedLocalsAndParameters.ts(9,22): error TS6133: 'a' is declared but never used. -tests/cases/compiler/unusedLocalsAndParameters.ts(15,5): error TS6133: 'farrow' is declared but never used. -tests/cases/compiler/unusedLocalsAndParameters.ts(15,15): error TS6133: 'a' is declared but never used. -tests/cases/compiler/unusedLocalsAndParameters.ts(18,7): error TS6133: 'C' is declared but never used. -tests/cases/compiler/unusedLocalsAndParameters.ts(20,12): error TS6133: 'a' is declared but never used. +tests/cases/compiler/unusedLocalsAndParameters.ts(4,12): error TS6133: 'a' is declared but its value is never read. +tests/cases/compiler/unusedLocalsAndParameters.ts(9,22): error TS6133: 'a' is declared but its value is never read. +tests/cases/compiler/unusedLocalsAndParameters.ts(15,5): error TS6133: 'farrow' is declared but its value is never read. +tests/cases/compiler/unusedLocalsAndParameters.ts(15,15): error TS6133: 'a' is declared but its value is never read. +tests/cases/compiler/unusedLocalsAndParameters.ts(18,7): error TS6133: 'C' is declared but its value is never read. +tests/cases/compiler/unusedLocalsAndParameters.ts(20,12): error TS6133: 'a' is declared but its value is never read. tests/cases/compiler/unusedLocalsAndParameters.ts(23,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/unusedLocalsAndParameters.ts(23,11): error TS6133: 'v' is declared but never used. -tests/cases/compiler/unusedLocalsAndParameters.ts(27,5): error TS6133: 'E' is declared but never used. -tests/cases/compiler/unusedLocalsAndParameters.ts(29,12): error TS6133: 'a' is declared but never used. +tests/cases/compiler/unusedLocalsAndParameters.ts(23,11): error TS6133: 'v' is declared but its value is never read. +tests/cases/compiler/unusedLocalsAndParameters.ts(27,5): error TS6133: 'E' is declared but its value is never read. +tests/cases/compiler/unusedLocalsAndParameters.ts(29,12): error TS6133: 'a' is declared but its value is never read. tests/cases/compiler/unusedLocalsAndParameters.ts(32,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/unusedLocalsAndParameters.ts(32,11): error TS6133: 'v' is declared but never used. -tests/cases/compiler/unusedLocalsAndParameters.ts(38,12): error TS6133: 'a' is declared but never used. +tests/cases/compiler/unusedLocalsAndParameters.ts(32,11): error TS6133: 'v' is declared but its value is never read. +tests/cases/compiler/unusedLocalsAndParameters.ts(38,12): error TS6133: 'a' is declared but its value is never read. tests/cases/compiler/unusedLocalsAndParameters.ts(41,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/unusedLocalsAndParameters.ts(41,11): error TS6133: 'v' is declared but never used. -tests/cases/compiler/unusedLocalsAndParameters.ts(48,10): error TS6133: 'i' is declared but never used. -tests/cases/compiler/unusedLocalsAndParameters.ts(52,10): error TS6133: 'i' is declared but never used. -tests/cases/compiler/unusedLocalsAndParameters.ts(56,17): error TS6133: 'n' is declared but never used. -tests/cases/compiler/unusedLocalsAndParameters.ts(63,11): error TS6133: 'c' is declared but never used. -tests/cases/compiler/unusedLocalsAndParameters.ts(68,11): error TS6133: 'a' is declared but never used. -tests/cases/compiler/unusedLocalsAndParameters.ts(71,11): error TS6133: 'c' is declared but never used. -tests/cases/compiler/unusedLocalsAndParameters.ts(74,11): error TS6133: 'c' is declared but never used. -tests/cases/compiler/unusedLocalsAndParameters.ts(79,11): error TS6133: 'N' is declared but never used. -tests/cases/compiler/unusedLocalsAndParameters.ts(80,9): error TS6133: 'x' is declared but never used. +tests/cases/compiler/unusedLocalsAndParameters.ts(41,11): error TS6133: 'v' is declared but its value is never read. +tests/cases/compiler/unusedLocalsAndParameters.ts(48,10): error TS6133: 'i' is declared but its value is never read. +tests/cases/compiler/unusedLocalsAndParameters.ts(52,10): error TS6133: 'i' is declared but its value is never read. +tests/cases/compiler/unusedLocalsAndParameters.ts(56,17): error TS6133: 'n' is declared but its value is never read. +tests/cases/compiler/unusedLocalsAndParameters.ts(63,11): error TS6133: 'c' is declared but its value is never read. +tests/cases/compiler/unusedLocalsAndParameters.ts(68,11): error TS6133: 'a' is declared but its value is never read. +tests/cases/compiler/unusedLocalsAndParameters.ts(71,11): error TS6133: 'c' is declared but its value is never read. +tests/cases/compiler/unusedLocalsAndParameters.ts(74,11): error TS6133: 'c' is declared but its value is never read. +tests/cases/compiler/unusedLocalsAndParameters.ts(79,11): error TS6133: 'N' is declared but its value is never read. +tests/cases/compiler/unusedLocalsAndParameters.ts(80,9): error TS6133: 'x' is declared but its value is never read. ==== tests/cases/compiler/unusedLocalsAndParameters.ts (24 errors) ==== @@ -30,14 +30,14 @@ tests/cases/compiler/unusedLocalsAndParameters.ts(80,9): error TS6133: 'x' is de // function declaration paramter function f(a) { ~ -!!! error TS6133: 'a' is declared but never used. +!!! error TS6133: 'a' is declared but its value is never read. } f(0); // function expression paramter var fexp = function (a) { ~ -!!! error TS6133: 'a' is declared but never used. +!!! error TS6133: 'a' is declared but its value is never read. }; fexp(0); @@ -45,42 +45,42 @@ tests/cases/compiler/unusedLocalsAndParameters.ts(80,9): error TS6133: 'x' is de // arrow function paramter var farrow = (a) => { ~~~~~~ -!!! error TS6133: 'farrow' is declared but never used. +!!! error TS6133: 'farrow' is declared but its value is never read. ~ -!!! error TS6133: 'a' is declared but never used. +!!! error TS6133: 'a' is declared but its value is never read. }; class C { ~ -!!! error TS6133: 'C' is declared but never used. +!!! error TS6133: 'C' is declared but its value is never read. // Method declaration paramter method(a) { ~ -!!! error TS6133: 'a' is declared but never used. +!!! error TS6133: 'a' is declared but its value is never read. } // Accessor declaration paramter set x(v: number) { ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~ -!!! error TS6133: 'v' is declared but never used. +!!! error TS6133: 'v' is declared but its value is never read. } } var E = class { ~ -!!! error TS6133: 'E' is declared but never used. +!!! error TS6133: 'E' is declared but its value is never read. // Method declaration paramter method(a) { ~ -!!! error TS6133: 'a' is declared but never used. +!!! error TS6133: 'a' is declared but its value is never read. } // Accessor declaration paramter set x(v: number) { ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~ -!!! error TS6133: 'v' is declared but never used. +!!! error TS6133: 'v' is declared but its value is never read. } } @@ -88,14 +88,14 @@ tests/cases/compiler/unusedLocalsAndParameters.ts(80,9): error TS6133: 'x' is de // Object literal method declaration paramter method(a) { ~ -!!! error TS6133: 'a' is declared but never used. +!!! error TS6133: 'a' is declared but its value is never read. }, // Accessor declaration paramter set x(v: number) { ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~ -!!! error TS6133: 'v' is declared but never used. +!!! error TS6133: 'v' is declared but its value is never read. } }; @@ -104,19 +104,19 @@ tests/cases/compiler/unusedLocalsAndParameters.ts(80,9): error TS6133: 'x' is de // in a for..in statment for (let i in o) { ~ -!!! error TS6133: 'i' is declared but never used. +!!! error TS6133: 'i' is declared but its value is never read. } // in a for..of statment for (let i of [1, 2, 3]) { ~ -!!! error TS6133: 'i' is declared but never used. +!!! error TS6133: 'i' is declared but its value is never read. } // in a for. statment for (let i = 0, n; i < 10; i++) { ~ -!!! error TS6133: 'n' is declared but never used. +!!! error TS6133: 'n' is declared but its value is never read. } // in a block @@ -125,34 +125,34 @@ tests/cases/compiler/unusedLocalsAndParameters.ts(80,9): error TS6133: 'x' is de if (condition) { const c = 0; ~ -!!! error TS6133: 'c' is declared but never used. +!!! error TS6133: 'c' is declared but its value is never read. } // in try/catch/finally try { const a = 0; ~ -!!! error TS6133: 'a' is declared but never used. +!!! error TS6133: 'a' is declared but its value is never read. } catch (e) { const c = 1; ~ -!!! error TS6133: 'c' is declared but never used. +!!! error TS6133: 'c' is declared but its value is never read. } finally { const c = 0; ~ -!!! error TS6133: 'c' is declared but never used. +!!! error TS6133: 'c' is declared but its value is never read. } // in a namespace namespace N { ~ -!!! error TS6133: 'N' is declared but never used. +!!! error TS6133: 'N' is declared but its value is never read. var x; ~ -!!! error TS6133: 'x' is declared but never used. +!!! error TS6133: 'x' is declared but its value is never read. } \ No newline at end of file diff --git a/tests/baselines/reference/unusedLocalsAndParametersTypeAliases2.errors.txt b/tests/baselines/reference/unusedLocalsAndParametersTypeAliases2.errors.txt index e5c6f476480..e30dc92d394 100644 --- a/tests/baselines/reference/unusedLocalsAndParametersTypeAliases2.errors.txt +++ b/tests/baselines/reference/unusedLocalsAndParametersTypeAliases2.errors.txt @@ -1,21 +1,21 @@ -tests/cases/compiler/unusedLocalsAndParametersTypeAliases2.ts(2,6): error TS6133: 'handler1' is declared but never used. -tests/cases/compiler/unusedLocalsAndParametersTypeAliases2.ts(5,10): error TS6133: 'foo' is declared but never used. -tests/cases/compiler/unusedLocalsAndParametersTypeAliases2.ts(6,10): error TS6133: 'handler2' is declared but never used. +tests/cases/compiler/unusedLocalsAndParametersTypeAliases2.ts(2,6): error TS6133: 'handler1' is declared but its value is never read. +tests/cases/compiler/unusedLocalsAndParametersTypeAliases2.ts(5,10): error TS6133: 'foo' is declared but its value is never read. +tests/cases/compiler/unusedLocalsAndParametersTypeAliases2.ts(6,10): error TS6133: 'handler2' is declared but its value is never read. ==== tests/cases/compiler/unusedLocalsAndParametersTypeAliases2.ts (3 errors) ==== // unused type handler1 = () => void; ~~~~~~~~ -!!! error TS6133: 'handler1' is declared but never used. +!!! error TS6133: 'handler1' is declared but its value is never read. function foo() { ~~~ -!!! error TS6133: 'foo' is declared but never used. +!!! error TS6133: 'foo' is declared but its value is never read. type handler2 = () => void; ~~~~~~~~ -!!! error TS6133: 'handler2' is declared but never used. +!!! error TS6133: 'handler2' is declared but its value is never read. foo(); } diff --git a/tests/baselines/reference/unusedLocalsInMethod1.errors.txt b/tests/baselines/reference/unusedLocalsInMethod1.errors.txt index 8406a009324..53802457794 100644 --- a/tests/baselines/reference/unusedLocalsInMethod1.errors.txt +++ b/tests/baselines/reference/unusedLocalsInMethod1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/unusedLocalsInMethod1.ts(3,13): error TS6133: 'x' is declared but never used. +tests/cases/compiler/unusedLocalsInMethod1.ts(3,13): error TS6133: 'x' is declared but its value is never read. ==== tests/cases/compiler/unusedLocalsInMethod1.ts (1 errors) ==== @@ -6,6 +6,6 @@ tests/cases/compiler/unusedLocalsInMethod1.ts(3,13): error TS6133: 'x' is declar public function1() { var x = 10; ~ -!!! error TS6133: 'x' is declared but never used. +!!! error TS6133: 'x' is declared but its value is never read. } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedLocalsInMethod2.errors.txt b/tests/baselines/reference/unusedLocalsInMethod2.errors.txt index 9aaa52ceee1..2aec1afb13a 100644 --- a/tests/baselines/reference/unusedLocalsInMethod2.errors.txt +++ b/tests/baselines/reference/unusedLocalsInMethod2.errors.txt @@ -1,12 +1,15 @@ -tests/cases/compiler/unusedLocalsInMethod2.ts(3,13): error TS6133: 'x' is declared but never used. +tests/cases/compiler/unusedLocalsInMethod2.ts(3,13): error TS6133: 'x' is declared but its value is never read. +tests/cases/compiler/unusedLocalsInMethod2.ts(3,16): error TS6133: 'y' is declared but its value is never read. -==== tests/cases/compiler/unusedLocalsInMethod2.ts (1 errors) ==== +==== tests/cases/compiler/unusedLocalsInMethod2.ts (2 errors) ==== class greeter { public function1() { var x, y = 10; ~ -!!! error TS6133: 'x' is declared but never used. +!!! error TS6133: 'x' is declared but its value is never read. + ~ +!!! error TS6133: 'y' is declared but its value is never read. y++; } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedLocalsInMethod3.errors.txt b/tests/baselines/reference/unusedLocalsInMethod3.errors.txt index 3486f9d894e..6e34814457b 100644 --- a/tests/baselines/reference/unusedLocalsInMethod3.errors.txt +++ b/tests/baselines/reference/unusedLocalsInMethod3.errors.txt @@ -1,12 +1,15 @@ -tests/cases/compiler/unusedLocalsInMethod3.ts(3,13): error TS6133: 'x' is declared but never used. +tests/cases/compiler/unusedLocalsInMethod3.ts(3,13): error TS6133: 'x' is declared but its value is never read. +tests/cases/compiler/unusedLocalsInMethod3.ts(3,16): error TS6133: 'y' is declared but its value is never read. -==== tests/cases/compiler/unusedLocalsInMethod3.ts (1 errors) ==== +==== tests/cases/compiler/unusedLocalsInMethod3.ts (2 errors) ==== class greeter { public function1() { var x, y; ~ -!!! error TS6133: 'x' is declared but never used. +!!! error TS6133: 'x' is declared but its value is never read. + ~ +!!! error TS6133: 'y' is declared but its value is never read. y = 1; } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration1.errors.txt b/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration1.errors.txt index f3ace8acc9a..da5bc7382e3 100644 --- a/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration1.errors.txt +++ b/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration1.errors.txt @@ -1,25 +1,28 @@ -tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration1.ts(1,18): error TS6133: 'person' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration1.ts(2,9): error TS6133: 'unused' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration1.ts(3,14): error TS6133: 'maker' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration1.ts(3,20): error TS6133: 'child' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration1.ts(4,13): error TS6133: 'unused2' is declared but never used. +tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration1.ts(1,18): error TS6133: 'person' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration1.ts(1,34): error TS6133: 'person2' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration1.ts(2,9): error TS6133: 'unused' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration1.ts(3,14): error TS6133: 'maker' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration1.ts(3,20): error TS6133: 'child' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration1.ts(4,13): error TS6133: 'unused2' is declared but its value is never read. -==== tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration1.ts (5 errors) ==== +==== tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration1.ts (6 errors) ==== function greeter(person: string, person2: string) { ~~~~~~ -!!! error TS6133: 'person' is declared but never used. +!!! error TS6133: 'person' is declared but its value is never read. + ~~~~~~~ +!!! error TS6133: 'person2' is declared but its value is never read. var unused = 20; ~~~~~~ -!!! error TS6133: 'unused' is declared but never used. +!!! error TS6133: 'unused' is declared but its value is never read. function maker(child: string): void { ~~~~~ -!!! error TS6133: 'maker' is declared but never used. +!!! error TS6133: 'maker' is declared but its value is never read. ~~~~~ -!!! error TS6133: 'child' is declared but never used. +!!! error TS6133: 'child' is declared but its value is never read. var unused2 = 22; ~~~~~~~ -!!! error TS6133: 'unused2' is declared but never used. +!!! error TS6133: 'unused2' is declared but its value is never read. } person2 = "dummy value"; } \ No newline at end of file diff --git a/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration2.errors.txt b/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration2.errors.txt index aacf8b9889f..e5326d2c41f 100644 --- a/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration2.errors.txt +++ b/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration2.errors.txt @@ -1,34 +1,34 @@ -tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration2.ts(1,18): error TS6133: 'person' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration2.ts(2,9): error TS6133: 'unused' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration2.ts(3,14): error TS6133: 'maker' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration2.ts(3,20): error TS6133: 'child' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration2.ts(4,13): error TS6133: 'unused2' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration2.ts(6,21): error TS6133: 'child2' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration2.ts(7,13): error TS6133: 'unused3' is declared but never used. +tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration2.ts(1,18): error TS6133: 'person' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration2.ts(2,9): error TS6133: 'unused' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration2.ts(3,14): error TS6133: 'maker' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration2.ts(3,20): error TS6133: 'child' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration2.ts(4,13): error TS6133: 'unused2' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration2.ts(6,21): error TS6133: 'child2' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration2.ts(7,13): error TS6133: 'unused3' is declared but its value is never read. ==== tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration2.ts (7 errors) ==== function greeter(person: string, person2: string) { ~~~~~~ -!!! error TS6133: 'person' is declared but never used. +!!! error TS6133: 'person' is declared but its value is never read. var unused = 20; ~~~~~~ -!!! error TS6133: 'unused' is declared but never used. +!!! error TS6133: 'unused' is declared but its value is never read. function maker(child: string): void { ~~~~~ -!!! error TS6133: 'maker' is declared but never used. +!!! error TS6133: 'maker' is declared but its value is never read. ~~~~~ -!!! error TS6133: 'child' is declared but never used. +!!! error TS6133: 'child' is declared but its value is never read. var unused2 = 22; ~~~~~~~ -!!! error TS6133: 'unused2' is declared but never used. +!!! error TS6133: 'unused2' is declared but its value is never read. } function maker2(child2: string): void { ~~~~~~ -!!! error TS6133: 'child2' is declared but never used. +!!! error TS6133: 'child2' is declared but its value is never read. var unused3 = 23; ~~~~~~~ -!!! error TS6133: 'unused3' is declared but never used. +!!! error TS6133: 'unused3' is declared but its value is never read. } maker2(person2); } \ No newline at end of file diff --git a/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionExpression1.errors.txt b/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionExpression1.errors.txt index b8ebdd2ad75..ac9b5c8632c 100644 --- a/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionExpression1.errors.txt +++ b/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionExpression1.errors.txt @@ -1,25 +1,28 @@ -tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionExpression1.ts(1,25): error TS6133: 'person' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionExpression1.ts(2,9): error TS6133: 'unused' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionExpression1.ts(3,14): error TS6133: 'maker' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionExpression1.ts(3,20): error TS6133: 'child' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionExpression1.ts(4,13): error TS6133: 'unused2' is declared but never used. +tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionExpression1.ts(1,25): error TS6133: 'person' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionExpression1.ts(1,41): error TS6133: 'person2' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionExpression1.ts(2,9): error TS6133: 'unused' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionExpression1.ts(3,14): error TS6133: 'maker' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionExpression1.ts(3,20): error TS6133: 'child' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionExpression1.ts(4,13): error TS6133: 'unused2' is declared but its value is never read. -==== tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionExpression1.ts (5 errors) ==== +==== tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionExpression1.ts (6 errors) ==== var greeter = function (person: string, person2: string) { ~~~~~~ -!!! error TS6133: 'person' is declared but never used. +!!! error TS6133: 'person' is declared but its value is never read. + ~~~~~~~ +!!! error TS6133: 'person2' is declared but its value is never read. var unused = 20; ~~~~~~ -!!! error TS6133: 'unused' is declared but never used. +!!! error TS6133: 'unused' is declared but its value is never read. function maker(child: string): void { ~~~~~ -!!! error TS6133: 'maker' is declared but never used. +!!! error TS6133: 'maker' is declared but its value is never read. ~~~~~ -!!! error TS6133: 'child' is declared but never used. +!!! error TS6133: 'child' is declared but its value is never read. var unused2 = 22; ~~~~~~~ -!!! error TS6133: 'unused2' is declared but never used. +!!! error TS6133: 'unused2' is declared but its value is never read. } person2 = "dummy value"; } \ No newline at end of file diff --git a/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionExpression2.errors.txt b/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionExpression2.errors.txt index b405993b0f5..c709d189d17 100644 --- a/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionExpression2.errors.txt +++ b/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionExpression2.errors.txt @@ -1,34 +1,34 @@ -tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionExpression2.ts(1,25): error TS6133: 'person' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionExpression2.ts(2,9): error TS6133: 'unused' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionExpression2.ts(3,14): error TS6133: 'maker' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionExpression2.ts(3,20): error TS6133: 'child' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionExpression2.ts(4,13): error TS6133: 'unused2' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionExpression2.ts(6,21): error TS6133: 'child2' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionExpression2.ts(7,13): error TS6133: 'unused3' is declared but never used. +tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionExpression2.ts(1,25): error TS6133: 'person' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionExpression2.ts(2,9): error TS6133: 'unused' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionExpression2.ts(3,14): error TS6133: 'maker' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionExpression2.ts(3,20): error TS6133: 'child' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionExpression2.ts(4,13): error TS6133: 'unused2' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionExpression2.ts(6,21): error TS6133: 'child2' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionExpression2.ts(7,13): error TS6133: 'unused3' is declared but its value is never read. ==== tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionExpression2.ts (7 errors) ==== var greeter = function (person: string, person2: string) { ~~~~~~ -!!! error TS6133: 'person' is declared but never used. +!!! error TS6133: 'person' is declared but its value is never read. var unused = 20; ~~~~~~ -!!! error TS6133: 'unused' is declared but never used. +!!! error TS6133: 'unused' is declared but its value is never read. function maker(child: string): void { ~~~~~ -!!! error TS6133: 'maker' is declared but never used. +!!! error TS6133: 'maker' is declared but its value is never read. ~~~~~ -!!! error TS6133: 'child' is declared but never used. +!!! error TS6133: 'child' is declared but its value is never read. var unused2 = 22; ~~~~~~~ -!!! error TS6133: 'unused2' is declared but never used. +!!! error TS6133: 'unused2' is declared but its value is never read. } function maker2(child2: string): void { ~~~~~~ -!!! error TS6133: 'child2' is declared but never used. +!!! error TS6133: 'child2' is declared but its value is never read. var unused3 = 23; ~~~~~~~ -!!! error TS6133: 'unused3' is declared but never used. +!!! error TS6133: 'unused3' is declared but its value is never read. } maker2(person2); } \ No newline at end of file diff --git a/tests/baselines/reference/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration1.errors.txt b/tests/baselines/reference/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration1.errors.txt index 094ed3d338c..b68f8dbc94c 100644 --- a/tests/baselines/reference/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration1.errors.txt +++ b/tests/baselines/reference/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration1.errors.txt @@ -1,25 +1,28 @@ -tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration1.ts(1,18): error TS6133: 'person' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration1.ts(2,9): error TS6133: 'unused' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration1.ts(3,9): error TS6133: 'maker' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration1.ts(3,27): error TS6133: 'child' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration1.ts(4,13): error TS6133: 'unused2' is declared but never used. +tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration1.ts(1,18): error TS6133: 'person' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration1.ts(1,34): error TS6133: 'person2' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration1.ts(2,9): error TS6133: 'unused' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration1.ts(3,9): error TS6133: 'maker' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration1.ts(3,27): error TS6133: 'child' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration1.ts(4,13): error TS6133: 'unused2' is declared but its value is never read. -==== tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration1.ts (5 errors) ==== +==== tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration1.ts (6 errors) ==== function greeter(person: string, person2: string) { ~~~~~~ -!!! error TS6133: 'person' is declared but never used. +!!! error TS6133: 'person' is declared but its value is never read. + ~~~~~~~ +!!! error TS6133: 'person2' is declared but its value is never read. var unused = 20; ~~~~~~ -!!! error TS6133: 'unused' is declared but never used. +!!! error TS6133: 'unused' is declared but its value is never read. var maker = function (child: string): void { ~~~~~ -!!! error TS6133: 'maker' is declared but never used. +!!! error TS6133: 'maker' is declared but its value is never read. ~~~~~ -!!! error TS6133: 'child' is declared but never used. +!!! error TS6133: 'child' is declared but its value is never read. var unused2 = 22; ~~~~~~~ -!!! error TS6133: 'unused2' is declared but never used. +!!! error TS6133: 'unused2' is declared but its value is never read. } person2 = "dummy value"; } \ No newline at end of file diff --git a/tests/baselines/reference/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration2.errors.txt b/tests/baselines/reference/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration2.errors.txt index a9887731ce3..58e9c46047c 100644 --- a/tests/baselines/reference/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration2.errors.txt +++ b/tests/baselines/reference/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration2.errors.txt @@ -1,34 +1,34 @@ -tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration2.ts(1,18): error TS6133: 'person' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration2.ts(2,9): error TS6133: 'unused' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration2.ts(3,9): error TS6133: 'maker' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration2.ts(3,26): error TS6133: 'child' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration2.ts(4,13): error TS6133: 'unused2' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration2.ts(6,27): error TS6133: 'child2' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration2.ts(7,13): error TS6133: 'unused3' is declared but never used. +tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration2.ts(1,18): error TS6133: 'person' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration2.ts(2,9): error TS6133: 'unused' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration2.ts(3,9): error TS6133: 'maker' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration2.ts(3,26): error TS6133: 'child' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration2.ts(4,13): error TS6133: 'unused2' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration2.ts(6,27): error TS6133: 'child2' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration2.ts(7,13): error TS6133: 'unused3' is declared but its value is never read. ==== tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionDeclaration2.ts (7 errors) ==== function greeter(person: string, person2: string) { ~~~~~~ -!!! error TS6133: 'person' is declared but never used. +!!! error TS6133: 'person' is declared but its value is never read. var unused = 20; ~~~~~~ -!!! error TS6133: 'unused' is declared but never used. +!!! error TS6133: 'unused' is declared but its value is never read. var maker = function(child: string): void { ~~~~~ -!!! error TS6133: 'maker' is declared but never used. +!!! error TS6133: 'maker' is declared but its value is never read. ~~~~~ -!!! error TS6133: 'child' is declared but never used. +!!! error TS6133: 'child' is declared but its value is never read. var unused2 = 22; ~~~~~~~ -!!! error TS6133: 'unused2' is declared but never used. +!!! error TS6133: 'unused2' is declared but its value is never read. } var maker2 = function(child2: string): void { ~~~~~~ -!!! error TS6133: 'child2' is declared but never used. +!!! error TS6133: 'child2' is declared but its value is never read. var unused3 = 23; ~~~~~~~ -!!! error TS6133: 'unused3' is declared but never used. +!!! error TS6133: 'unused3' is declared but its value is never read. } maker2(person2); } \ No newline at end of file diff --git a/tests/baselines/reference/unusedLocalsOnFunctionExpressionWithinFunctionExpression1.errors.txt b/tests/baselines/reference/unusedLocalsOnFunctionExpressionWithinFunctionExpression1.errors.txt index 3ff247c3423..35f63193f48 100644 --- a/tests/baselines/reference/unusedLocalsOnFunctionExpressionWithinFunctionExpression1.errors.txt +++ b/tests/baselines/reference/unusedLocalsOnFunctionExpressionWithinFunctionExpression1.errors.txt @@ -1,25 +1,28 @@ -tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionExpression1.ts(1,25): error TS6133: 'person' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionExpression1.ts(2,9): error TS6133: 'unused' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionExpression1.ts(3,9): error TS6133: 'maker' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionExpression1.ts(3,27): error TS6133: 'child' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionExpression1.ts(4,13): error TS6133: 'unused2' is declared but never used. +tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionExpression1.ts(1,25): error TS6133: 'person' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionExpression1.ts(1,41): error TS6133: 'person2' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionExpression1.ts(2,9): error TS6133: 'unused' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionExpression1.ts(3,9): error TS6133: 'maker' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionExpression1.ts(3,27): error TS6133: 'child' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionExpression1.ts(4,13): error TS6133: 'unused2' is declared but its value is never read. -==== tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionExpression1.ts (5 errors) ==== +==== tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionExpression1.ts (6 errors) ==== var greeter = function (person: string, person2: string) { ~~~~~~ -!!! error TS6133: 'person' is declared but never used. +!!! error TS6133: 'person' is declared but its value is never read. + ~~~~~~~ +!!! error TS6133: 'person2' is declared but its value is never read. var unused = 20; ~~~~~~ -!!! error TS6133: 'unused' is declared but never used. +!!! error TS6133: 'unused' is declared but its value is never read. var maker = function (child: string): void { ~~~~~ -!!! error TS6133: 'maker' is declared but never used. +!!! error TS6133: 'maker' is declared but its value is never read. ~~~~~ -!!! error TS6133: 'child' is declared but never used. +!!! error TS6133: 'child' is declared but its value is never read. var unused2 = 22; ~~~~~~~ -!!! error TS6133: 'unused2' is declared but never used. +!!! error TS6133: 'unused2' is declared but its value is never read. } person2 = "dummy value"; } \ No newline at end of file diff --git a/tests/baselines/reference/unusedLocalsOnFunctionExpressionWithinFunctionExpression2.errors.txt b/tests/baselines/reference/unusedLocalsOnFunctionExpressionWithinFunctionExpression2.errors.txt index e5097afa44b..57fb73eb6ca 100644 --- a/tests/baselines/reference/unusedLocalsOnFunctionExpressionWithinFunctionExpression2.errors.txt +++ b/tests/baselines/reference/unusedLocalsOnFunctionExpressionWithinFunctionExpression2.errors.txt @@ -1,34 +1,34 @@ -tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionExpression2.ts(1,25): error TS6133: 'person' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionExpression2.ts(2,9): error TS6133: 'unused' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionExpression2.ts(3,9): error TS6133: 'maker' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionExpression2.ts(3,27): error TS6133: 'child' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionExpression2.ts(4,13): error TS6133: 'unused2' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionExpression2.ts(6,28): error TS6133: 'child2' is declared but never used. -tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionExpression2.ts(7,13): error TS6133: 'unused3' is declared but never used. +tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionExpression2.ts(1,25): error TS6133: 'person' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionExpression2.ts(2,9): error TS6133: 'unused' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionExpression2.ts(3,9): error TS6133: 'maker' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionExpression2.ts(3,27): error TS6133: 'child' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionExpression2.ts(4,13): error TS6133: 'unused2' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionExpression2.ts(6,28): error TS6133: 'child2' is declared but its value is never read. +tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionExpression2.ts(7,13): error TS6133: 'unused3' is declared but its value is never read. ==== tests/cases/compiler/unusedLocalsOnFunctionExpressionWithinFunctionExpression2.ts (7 errors) ==== var greeter = function (person: string, person2: string) { ~~~~~~ -!!! error TS6133: 'person' is declared but never used. +!!! error TS6133: 'person' is declared but its value is never read. var unused = 20; ~~~~~~ -!!! error TS6133: 'unused' is declared but never used. +!!! error TS6133: 'unused' is declared but its value is never read. var maker = function (child: string): void { ~~~~~ -!!! error TS6133: 'maker' is declared but never used. +!!! error TS6133: 'maker' is declared but its value is never read. ~~~~~ -!!! error TS6133: 'child' is declared but never used. +!!! error TS6133: 'child' is declared but its value is never read. var unused2 = 22; ~~~~~~~ -!!! error TS6133: 'unused2' is declared but never used. +!!! error TS6133: 'unused2' is declared but its value is never read. } var maker2 = function (child2: string): void { ~~~~~~ -!!! error TS6133: 'child2' is declared but never used. +!!! error TS6133: 'child2' is declared but its value is never read. var unused3 = 23; ~~~~~~~ -!!! error TS6133: 'unused3' is declared but never used. +!!! error TS6133: 'unused3' is declared but its value is never read. } maker2(person2); } \ No newline at end of file diff --git a/tests/baselines/reference/unusedLocalsStartingWithUnderscore.errors.txt b/tests/baselines/reference/unusedLocalsStartingWithUnderscore.errors.txt index 32f2acfe78b..b8a0a50fea6 100644 --- a/tests/baselines/reference/unusedLocalsStartingWithUnderscore.errors.txt +++ b/tests/baselines/reference/unusedLocalsStartingWithUnderscore.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/unusedLocalsStartingWithUnderscore.ts(6,9): error TS6133: '_' is declared but never used. +tests/cases/compiler/unusedLocalsStartingWithUnderscore.ts(6,9): error TS6133: '_' is declared but its value is never read. ==== tests/cases/compiler/unusedLocalsStartingWithUnderscore.ts (1 errors) ==== @@ -9,7 +9,7 @@ tests/cases/compiler/unusedLocalsStartingWithUnderscore.ts(6,9): error TS6133: ' namespace M { let _; ~ -!!! error TS6133: '_' is declared but never used. +!!! error TS6133: '_' is declared but its value is never read. for (const _ of []) { } for (const _ in []) { } diff --git a/tests/baselines/reference/unusedLocalsinConstructor1.errors.txt b/tests/baselines/reference/unusedLocalsinConstructor1.errors.txt index 4831c09f40d..b0eb68286b5 100644 --- a/tests/baselines/reference/unusedLocalsinConstructor1.errors.txt +++ b/tests/baselines/reference/unusedLocalsinConstructor1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/unusedLocalsinConstructor1.ts(3,13): error TS6133: 'unused' is declared but never used. +tests/cases/compiler/unusedLocalsinConstructor1.ts(3,13): error TS6133: 'unused' is declared but its value is never read. ==== tests/cases/compiler/unusedLocalsinConstructor1.ts (1 errors) ==== @@ -6,6 +6,6 @@ tests/cases/compiler/unusedLocalsinConstructor1.ts(3,13): error TS6133: 'unused' constructor() { var unused = 20; ~~~~~~ -!!! error TS6133: 'unused' is declared but never used. +!!! error TS6133: 'unused' is declared but its value is never read. } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedLocalsinConstructor2.errors.txt b/tests/baselines/reference/unusedLocalsinConstructor2.errors.txt index 83127b6ecd9..32fb8bfccc8 100644 --- a/tests/baselines/reference/unusedLocalsinConstructor2.errors.txt +++ b/tests/baselines/reference/unusedLocalsinConstructor2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/unusedLocalsinConstructor2.ts(3,13): error TS6133: 'unused' is declared but never used. +tests/cases/compiler/unusedLocalsinConstructor2.ts(3,13): error TS6133: 'unused' is declared but its value is never read. ==== tests/cases/compiler/unusedLocalsinConstructor2.ts (1 errors) ==== @@ -6,7 +6,7 @@ tests/cases/compiler/unusedLocalsinConstructor2.ts(3,13): error TS6133: 'unused' constructor() { var unused = 20; ~~~~~~ -!!! error TS6133: 'unused' is declared but never used. +!!! error TS6133: 'unused' is declared but its value is never read. var used = "dummy"; used = used + "second part"; } diff --git a/tests/baselines/reference/unusedModuleInModule.errors.txt b/tests/baselines/reference/unusedModuleInModule.errors.txt index c558e7446fe..bd8040ce590 100644 --- a/tests/baselines/reference/unusedModuleInModule.errors.txt +++ b/tests/baselines/reference/unusedModuleInModule.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/unusedModuleInModule.ts(2,12): error TS6133: 'B' is declared but never used. +tests/cases/compiler/unusedModuleInModule.ts(2,12): error TS6133: 'B' is declared but its value is never read. ==== tests/cases/compiler/unusedModuleInModule.ts (1 errors) ==== module A { module B {} ~ -!!! error TS6133: 'B' is declared but never used. +!!! error TS6133: 'B' is declared but its value is never read. } \ No newline at end of file diff --git a/tests/baselines/reference/unusedMultipleParameter1InContructor.errors.txt b/tests/baselines/reference/unusedMultipleParameter1InContructor.errors.txt index 5c2ccfc29e0..59a5af15888 100644 --- a/tests/baselines/reference/unusedMultipleParameter1InContructor.errors.txt +++ b/tests/baselines/reference/unusedMultipleParameter1InContructor.errors.txt @@ -1,15 +1,18 @@ -tests/cases/compiler/unusedMultipleParameter1InContructor.ts(2,17): error TS6133: 'person' is declared but never used. -tests/cases/compiler/unusedMultipleParameter1InContructor.ts(3,13): error TS6133: 'unused' is declared but never used. +tests/cases/compiler/unusedMultipleParameter1InContructor.ts(2,17): error TS6133: 'person' is declared but its value is never read. +tests/cases/compiler/unusedMultipleParameter1InContructor.ts(2,33): error TS6133: 'person2' is declared but its value is never read. +tests/cases/compiler/unusedMultipleParameter1InContructor.ts(3,13): error TS6133: 'unused' is declared but its value is never read. -==== tests/cases/compiler/unusedMultipleParameter1InContructor.ts (2 errors) ==== +==== tests/cases/compiler/unusedMultipleParameter1InContructor.ts (3 errors) ==== class Dummy { constructor(person: string, person2: string) { ~~~~~~ -!!! error TS6133: 'person' is declared but never used. +!!! error TS6133: 'person' is declared but its value is never read. + ~~~~~~~ +!!! error TS6133: 'person2' is declared but its value is never read. var unused = 20; ~~~~~~ -!!! error TS6133: 'unused' is declared but never used. +!!! error TS6133: 'unused' is declared but its value is never read. person2 = "Dummy value"; } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedMultipleParameter1InFunctionExpression.errors.txt b/tests/baselines/reference/unusedMultipleParameter1InFunctionExpression.errors.txt index 1405f9aae2c..26bc6f2c859 100644 --- a/tests/baselines/reference/unusedMultipleParameter1InFunctionExpression.errors.txt +++ b/tests/baselines/reference/unusedMultipleParameter1InFunctionExpression.errors.txt @@ -1,13 +1,16 @@ -tests/cases/compiler/unusedMultipleParameter1InFunctionExpression.ts(1,21): error TS6133: 'person' is declared but never used. -tests/cases/compiler/unusedMultipleParameter1InFunctionExpression.ts(2,9): error TS6133: 'unused' is declared but never used. +tests/cases/compiler/unusedMultipleParameter1InFunctionExpression.ts(1,21): error TS6133: 'person' is declared but its value is never read. +tests/cases/compiler/unusedMultipleParameter1InFunctionExpression.ts(1,37): error TS6133: 'person2' is declared but its value is never read. +tests/cases/compiler/unusedMultipleParameter1InFunctionExpression.ts(2,9): error TS6133: 'unused' is declared but its value is never read. -==== tests/cases/compiler/unusedMultipleParameter1InFunctionExpression.ts (2 errors) ==== +==== tests/cases/compiler/unusedMultipleParameter1InFunctionExpression.ts (3 errors) ==== var func = function(person: string, person2: string) { ~~~~~~ -!!! error TS6133: 'person' is declared but never used. +!!! error TS6133: 'person' is declared but its value is never read. + ~~~~~~~ +!!! error TS6133: 'person2' is declared but its value is never read. var unused = 20; ~~~~~~ -!!! error TS6133: 'unused' is declared but never used. +!!! error TS6133: 'unused' is declared but its value is never read. person2 = "Dummy value"; } \ No newline at end of file diff --git a/tests/baselines/reference/unusedMultipleParameter2InContructor.errors.txt b/tests/baselines/reference/unusedMultipleParameter2InContructor.errors.txt index 9c28c969d3a..0279c8912f0 100644 --- a/tests/baselines/reference/unusedMultipleParameter2InContructor.errors.txt +++ b/tests/baselines/reference/unusedMultipleParameter2InContructor.errors.txt @@ -1,18 +1,21 @@ -tests/cases/compiler/unusedMultipleParameter2InContructor.ts(2,17): error TS6133: 'person' is declared but never used. -tests/cases/compiler/unusedMultipleParameter2InContructor.ts(2,50): error TS6133: 'person3' is declared but never used. -tests/cases/compiler/unusedMultipleParameter2InContructor.ts(3,13): error TS6133: 'unused' is declared but never used. +tests/cases/compiler/unusedMultipleParameter2InContructor.ts(2,17): error TS6133: 'person' is declared but its value is never read. +tests/cases/compiler/unusedMultipleParameter2InContructor.ts(2,33): error TS6133: 'person2' is declared but its value is never read. +tests/cases/compiler/unusedMultipleParameter2InContructor.ts(2,50): error TS6133: 'person3' is declared but its value is never read. +tests/cases/compiler/unusedMultipleParameter2InContructor.ts(3,13): error TS6133: 'unused' is declared but its value is never read. -==== tests/cases/compiler/unusedMultipleParameter2InContructor.ts (3 errors) ==== +==== tests/cases/compiler/unusedMultipleParameter2InContructor.ts (4 errors) ==== class Dummy { constructor(person: string, person2: string, person3: string) { ~~~~~~ -!!! error TS6133: 'person' is declared but never used. +!!! error TS6133: 'person' is declared but its value is never read. + ~~~~~~~ +!!! error TS6133: 'person2' is declared but its value is never read. ~~~~~~~ -!!! error TS6133: 'person3' is declared but never used. +!!! error TS6133: 'person3' is declared but its value is never read. var unused = 20; ~~~~~~ -!!! error TS6133: 'unused' is declared but never used. +!!! error TS6133: 'unused' is declared but its value is never read. person2 = "Dummy value"; } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedMultipleParameter2InFunctionExpression.errors.txt b/tests/baselines/reference/unusedMultipleParameter2InFunctionExpression.errors.txt index 98bc39e16fb..a2dccf10132 100644 --- a/tests/baselines/reference/unusedMultipleParameter2InFunctionExpression.errors.txt +++ b/tests/baselines/reference/unusedMultipleParameter2InFunctionExpression.errors.txt @@ -1,16 +1,19 @@ -tests/cases/compiler/unusedMultipleParameter2InFunctionExpression.ts(1,21): error TS6133: 'person' is declared but never used. -tests/cases/compiler/unusedMultipleParameter2InFunctionExpression.ts(1,54): error TS6133: 'person3' is declared but never used. -tests/cases/compiler/unusedMultipleParameter2InFunctionExpression.ts(2,9): error TS6133: 'unused' is declared but never used. +tests/cases/compiler/unusedMultipleParameter2InFunctionExpression.ts(1,21): error TS6133: 'person' is declared but its value is never read. +tests/cases/compiler/unusedMultipleParameter2InFunctionExpression.ts(1,37): error TS6133: 'person2' is declared but its value is never read. +tests/cases/compiler/unusedMultipleParameter2InFunctionExpression.ts(1,54): error TS6133: 'person3' is declared but its value is never read. +tests/cases/compiler/unusedMultipleParameter2InFunctionExpression.ts(2,9): error TS6133: 'unused' is declared but its value is never read. -==== tests/cases/compiler/unusedMultipleParameter2InFunctionExpression.ts (3 errors) ==== +==== tests/cases/compiler/unusedMultipleParameter2InFunctionExpression.ts (4 errors) ==== var func = function(person: string, person2: string, person3: string) { ~~~~~~ -!!! error TS6133: 'person' is declared but never used. +!!! error TS6133: 'person' is declared but its value is never read. + ~~~~~~~ +!!! error TS6133: 'person2' is declared but its value is never read. ~~~~~~~ -!!! error TS6133: 'person3' is declared but never used. +!!! error TS6133: 'person3' is declared but its value is never read. var unused = 20; ~~~~~~ -!!! error TS6133: 'unused' is declared but never used. +!!! error TS6133: 'unused' is declared but its value is never read. person2 = "Dummy value"; } \ No newline at end of file diff --git a/tests/baselines/reference/unusedMultipleParameters1InFunctionDeclaration.errors.txt b/tests/baselines/reference/unusedMultipleParameters1InFunctionDeclaration.errors.txt index 38e6a8bbcd9..77dd37f96f9 100644 --- a/tests/baselines/reference/unusedMultipleParameters1InFunctionDeclaration.errors.txt +++ b/tests/baselines/reference/unusedMultipleParameters1InFunctionDeclaration.errors.txt @@ -1,13 +1,16 @@ -tests/cases/compiler/unusedMultipleParameters1InFunctionDeclaration.ts(1,18): error TS6133: 'person' is declared but never used. -tests/cases/compiler/unusedMultipleParameters1InFunctionDeclaration.ts(2,9): error TS6133: 'unused' is declared but never used. +tests/cases/compiler/unusedMultipleParameters1InFunctionDeclaration.ts(1,18): error TS6133: 'person' is declared but its value is never read. +tests/cases/compiler/unusedMultipleParameters1InFunctionDeclaration.ts(1,34): error TS6133: 'person2' is declared but its value is never read. +tests/cases/compiler/unusedMultipleParameters1InFunctionDeclaration.ts(2,9): error TS6133: 'unused' is declared but its value is never read. -==== tests/cases/compiler/unusedMultipleParameters1InFunctionDeclaration.ts (2 errors) ==== +==== tests/cases/compiler/unusedMultipleParameters1InFunctionDeclaration.ts (3 errors) ==== function greeter(person: string, person2: string) { ~~~~~~ -!!! error TS6133: 'person' is declared but never used. +!!! error TS6133: 'person' is declared but its value is never read. + ~~~~~~~ +!!! error TS6133: 'person2' is declared but its value is never read. var unused = 20; ~~~~~~ -!!! error TS6133: 'unused' is declared but never used. +!!! error TS6133: 'unused' is declared but its value is never read. person2 = "dummy value"; } \ No newline at end of file diff --git a/tests/baselines/reference/unusedMultipleParameters1InMethodDeclaration.errors.txt b/tests/baselines/reference/unusedMultipleParameters1InMethodDeclaration.errors.txt index e3e75de1fbd..58cfcee24dc 100644 --- a/tests/baselines/reference/unusedMultipleParameters1InMethodDeclaration.errors.txt +++ b/tests/baselines/reference/unusedMultipleParameters1InMethodDeclaration.errors.txt @@ -1,15 +1,18 @@ -tests/cases/compiler/unusedMultipleParameters1InMethodDeclaration.ts(2,20): error TS6133: 'person' is declared but never used. -tests/cases/compiler/unusedMultipleParameters1InMethodDeclaration.ts(3,13): error TS6133: 'unused' is declared but never used. +tests/cases/compiler/unusedMultipleParameters1InMethodDeclaration.ts(2,20): error TS6133: 'person' is declared but its value is never read. +tests/cases/compiler/unusedMultipleParameters1InMethodDeclaration.ts(2,36): error TS6133: 'person2' is declared but its value is never read. +tests/cases/compiler/unusedMultipleParameters1InMethodDeclaration.ts(3,13): error TS6133: 'unused' is declared but its value is never read. -==== tests/cases/compiler/unusedMultipleParameters1InMethodDeclaration.ts (2 errors) ==== +==== tests/cases/compiler/unusedMultipleParameters1InMethodDeclaration.ts (3 errors) ==== class Dummy { public greeter(person: string, person2: string) { ~~~~~~ -!!! error TS6133: 'person' is declared but never used. +!!! error TS6133: 'person' is declared but its value is never read. + ~~~~~~~ +!!! error TS6133: 'person2' is declared but its value is never read. var unused = 20; ~~~~~~ -!!! error TS6133: 'unused' is declared but never used. +!!! error TS6133: 'unused' is declared but its value is never read. person2 = "dummy value"; } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedMultipleParameters2InFunctionDeclaration.errors.txt b/tests/baselines/reference/unusedMultipleParameters2InFunctionDeclaration.errors.txt index 39e21691460..6f34c67054f 100644 --- a/tests/baselines/reference/unusedMultipleParameters2InFunctionDeclaration.errors.txt +++ b/tests/baselines/reference/unusedMultipleParameters2InFunctionDeclaration.errors.txt @@ -1,16 +1,19 @@ -tests/cases/compiler/unusedMultipleParameters2InFunctionDeclaration.ts(1,18): error TS6133: 'person' is declared but never used. -tests/cases/compiler/unusedMultipleParameters2InFunctionDeclaration.ts(1,51): error TS6133: 'person3' is declared but never used. -tests/cases/compiler/unusedMultipleParameters2InFunctionDeclaration.ts(2,9): error TS6133: 'unused' is declared but never used. +tests/cases/compiler/unusedMultipleParameters2InFunctionDeclaration.ts(1,18): error TS6133: 'person' is declared but its value is never read. +tests/cases/compiler/unusedMultipleParameters2InFunctionDeclaration.ts(1,34): error TS6133: 'person2' is declared but its value is never read. +tests/cases/compiler/unusedMultipleParameters2InFunctionDeclaration.ts(1,51): error TS6133: 'person3' is declared but its value is never read. +tests/cases/compiler/unusedMultipleParameters2InFunctionDeclaration.ts(2,9): error TS6133: 'unused' is declared but its value is never read. -==== tests/cases/compiler/unusedMultipleParameters2InFunctionDeclaration.ts (3 errors) ==== +==== tests/cases/compiler/unusedMultipleParameters2InFunctionDeclaration.ts (4 errors) ==== function greeter(person: string, person2: string, person3: string) { ~~~~~~ -!!! error TS6133: 'person' is declared but never used. +!!! error TS6133: 'person' is declared but its value is never read. + ~~~~~~~ +!!! error TS6133: 'person2' is declared but its value is never read. ~~~~~~~ -!!! error TS6133: 'person3' is declared but never used. +!!! error TS6133: 'person3' is declared but its value is never read. var unused = 20; ~~~~~~ -!!! error TS6133: 'unused' is declared but never used. +!!! error TS6133: 'unused' is declared but its value is never read. person2 = "dummy value"; } \ No newline at end of file diff --git a/tests/baselines/reference/unusedMultipleParameters2InMethodDeclaration.errors.txt b/tests/baselines/reference/unusedMultipleParameters2InMethodDeclaration.errors.txt index 32496974c6b..6779fb83aec 100644 --- a/tests/baselines/reference/unusedMultipleParameters2InMethodDeclaration.errors.txt +++ b/tests/baselines/reference/unusedMultipleParameters2InMethodDeclaration.errors.txt @@ -1,18 +1,21 @@ -tests/cases/compiler/unusedMultipleParameters2InMethodDeclaration.ts(2,20): error TS6133: 'person' is declared but never used. -tests/cases/compiler/unusedMultipleParameters2InMethodDeclaration.ts(2,53): error TS6133: 'person3' is declared but never used. -tests/cases/compiler/unusedMultipleParameters2InMethodDeclaration.ts(3,13): error TS6133: 'unused' is declared but never used. +tests/cases/compiler/unusedMultipleParameters2InMethodDeclaration.ts(2,20): error TS6133: 'person' is declared but its value is never read. +tests/cases/compiler/unusedMultipleParameters2InMethodDeclaration.ts(2,36): error TS6133: 'person2' is declared but its value is never read. +tests/cases/compiler/unusedMultipleParameters2InMethodDeclaration.ts(2,53): error TS6133: 'person3' is declared but its value is never read. +tests/cases/compiler/unusedMultipleParameters2InMethodDeclaration.ts(3,13): error TS6133: 'unused' is declared but its value is never read. -==== tests/cases/compiler/unusedMultipleParameters2InMethodDeclaration.ts (3 errors) ==== +==== tests/cases/compiler/unusedMultipleParameters2InMethodDeclaration.ts (4 errors) ==== class Dummy { public greeter(person: string, person2: string, person3: string) { ~~~~~~ -!!! error TS6133: 'person' is declared but never used. +!!! error TS6133: 'person' is declared but its value is never read. + ~~~~~~~ +!!! error TS6133: 'person2' is declared but its value is never read. ~~~~~~~ -!!! error TS6133: 'person3' is declared but never used. +!!! error TS6133: 'person3' is declared but its value is never read. var unused = 20; ~~~~~~ -!!! error TS6133: 'unused' is declared but never used. +!!! error TS6133: 'unused' is declared but its value is never read. person2 = "dummy value"; } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedNamespaceInModule.errors.txt b/tests/baselines/reference/unusedNamespaceInModule.errors.txt index 3d722a113ea..afc118b094a 100644 --- a/tests/baselines/reference/unusedNamespaceInModule.errors.txt +++ b/tests/baselines/reference/unusedNamespaceInModule.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/unusedNamespaceInModule.ts(2,15): error TS6133: 'B' is declared but never used. +tests/cases/compiler/unusedNamespaceInModule.ts(2,15): error TS6133: 'B' is declared but its value is never read. ==== tests/cases/compiler/unusedNamespaceInModule.ts (1 errors) ==== module A { namespace B { } ~ -!!! error TS6133: 'B' is declared but never used. +!!! error TS6133: 'B' is declared but its value is never read. export namespace C {} } \ No newline at end of file diff --git a/tests/baselines/reference/unusedNamespaceInNamespace.errors.txt b/tests/baselines/reference/unusedNamespaceInNamespace.errors.txt index 1bf7d15d3c2..ff031f5af41 100644 --- a/tests/baselines/reference/unusedNamespaceInNamespace.errors.txt +++ b/tests/baselines/reference/unusedNamespaceInNamespace.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/unusedNamespaceInNamespace.ts(2,15): error TS6133: 'B' is declared but never used. +tests/cases/compiler/unusedNamespaceInNamespace.ts(2,15): error TS6133: 'B' is declared but its value is never read. ==== tests/cases/compiler/unusedNamespaceInNamespace.ts (1 errors) ==== namespace A { namespace B { } ~ -!!! error TS6133: 'B' is declared but never used. +!!! error TS6133: 'B' is declared but its value is never read. export namespace C {} } \ No newline at end of file diff --git a/tests/baselines/reference/unusedParameterProperty1.errors.txt b/tests/baselines/reference/unusedParameterProperty1.errors.txt index fb400332c0d..ba9bb4af3ae 100644 --- a/tests/baselines/reference/unusedParameterProperty1.errors.txt +++ b/tests/baselines/reference/unusedParameterProperty1.errors.txt @@ -1,12 +1,15 @@ -tests/cases/compiler/unusedParameterProperty1.ts(2,25): error TS6138: Property 'used' is declared but never used. +tests/cases/compiler/unusedParameterProperty1.ts(2,25): error TS6138: Property 'used' is declared but its value is never read. +tests/cases/compiler/unusedParameterProperty1.ts(3,13): error TS6133: 'foge' is declared but its value is never read. -==== tests/cases/compiler/unusedParameterProperty1.ts (1 errors) ==== +==== tests/cases/compiler/unusedParameterProperty1.ts (2 errors) ==== class A { constructor(private used: string) { ~~~~ -!!! error TS6138: Property 'used' is declared but never used. +!!! error TS6138: Property 'used' is declared but its value is never read. let foge = used; + ~~~~ +!!! error TS6133: 'foge' is declared but its value is never read. foge += ""; } } diff --git a/tests/baselines/reference/unusedParameterProperty2.errors.txt b/tests/baselines/reference/unusedParameterProperty2.errors.txt index 9fa8c4c79f8..853b459c772 100644 --- a/tests/baselines/reference/unusedParameterProperty2.errors.txt +++ b/tests/baselines/reference/unusedParameterProperty2.errors.txt @@ -1,12 +1,15 @@ -tests/cases/compiler/unusedParameterProperty2.ts(2,25): error TS6138: Property 'used' is declared but never used. +tests/cases/compiler/unusedParameterProperty2.ts(2,25): error TS6138: Property 'used' is declared but its value is never read. +tests/cases/compiler/unusedParameterProperty2.ts(3,13): error TS6133: 'foge' is declared but its value is never read. -==== tests/cases/compiler/unusedParameterProperty2.ts (1 errors) ==== +==== tests/cases/compiler/unusedParameterProperty2.ts (2 errors) ==== class A { constructor(private used) { ~~~~ -!!! error TS6138: Property 'used' is declared but never used. +!!! error TS6138: Property 'used' is declared but its value is never read. let foge = used; + ~~~~ +!!! error TS6133: 'foge' is declared but its value is never read. foge += ""; } } diff --git a/tests/baselines/reference/unusedParameterUsedInTypeOf.js b/tests/baselines/reference/unusedParameterUsedInTypeOf.js index 544057eb4d1..42639a7398e 100644 --- a/tests/baselines/reference/unusedParameterUsedInTypeOf.js +++ b/tests/baselines/reference/unusedParameterUsedInTypeOf.js @@ -1,9 +1,9 @@ //// [unusedParameterUsedInTypeOf.ts] function f1 (a: number, b: typeof a) { - b++; + return b; } //// [unusedParameterUsedInTypeOf.js] function f1(a, b) { - b++; + return b; } diff --git a/tests/baselines/reference/unusedParameterUsedInTypeOf.symbols b/tests/baselines/reference/unusedParameterUsedInTypeOf.symbols index 9479eb8af01..c2bc4a126ef 100644 --- a/tests/baselines/reference/unusedParameterUsedInTypeOf.symbols +++ b/tests/baselines/reference/unusedParameterUsedInTypeOf.symbols @@ -5,6 +5,6 @@ function f1 (a: number, b: typeof a) { >b : Symbol(b, Decl(unusedParameterUsedInTypeOf.ts, 0, 23)) >a : Symbol(a, Decl(unusedParameterUsedInTypeOf.ts, 0, 13)) - b++; + return b; >b : Symbol(b, Decl(unusedParameterUsedInTypeOf.ts, 0, 23)) } diff --git a/tests/baselines/reference/unusedParameterUsedInTypeOf.types b/tests/baselines/reference/unusedParameterUsedInTypeOf.types index d8f181cc07b..8e0cef7962b 100644 --- a/tests/baselines/reference/unusedParameterUsedInTypeOf.types +++ b/tests/baselines/reference/unusedParameterUsedInTypeOf.types @@ -1,11 +1,10 @@ === tests/cases/compiler/unusedParameterUsedInTypeOf.ts === function f1 (a: number, b: typeof a) { ->f1 : (a: number, b: number) => void +>f1 : (a: number, b: number) => number >a : number >b : number >a : number - b++; ->b++ : number + return b; >b : number } diff --git a/tests/baselines/reference/unusedParametersInLambda1.errors.txt b/tests/baselines/reference/unusedParametersInLambda1.errors.txt index a5a58045c5a..94ca0e83cf9 100644 --- a/tests/baselines/reference/unusedParametersInLambda1.errors.txt +++ b/tests/baselines/reference/unusedParametersInLambda1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/unusedParametersInLambda1.ts(3,17): error TS6133: 'X' is declared but never used. +tests/cases/compiler/unusedParametersInLambda1.ts(3,17): error TS6133: 'X' is declared but its value is never read. ==== tests/cases/compiler/unusedParametersInLambda1.ts (1 errors) ==== @@ -6,7 +6,7 @@ tests/cases/compiler/unusedParametersInLambda1.ts(3,17): error TS6133: 'X' is de public f1() { return (X) => { ~ -!!! error TS6133: 'X' is declared but never used. +!!! error TS6133: 'X' is declared but its value is never read. } } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedParametersInLambda2.errors.txt b/tests/baselines/reference/unusedParametersInLambda2.errors.txt index 055e0cbeb63..16f4c3f2640 100644 --- a/tests/baselines/reference/unusedParametersInLambda2.errors.txt +++ b/tests/baselines/reference/unusedParametersInLambda2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/unusedParametersInLambda2.ts(3,17): error TS6133: 'X' is declared but never used. +tests/cases/compiler/unusedParametersInLambda2.ts(3,17): error TS6133: 'X' is declared but its value is never read. ==== tests/cases/compiler/unusedParametersInLambda2.ts (1 errors) ==== @@ -6,7 +6,7 @@ tests/cases/compiler/unusedParametersInLambda2.ts(3,17): error TS6133: 'X' is de public f1() { return (X, Y) => { ~ -!!! error TS6133: 'X' is declared but never used. +!!! error TS6133: 'X' is declared but its value is never read. Y; } } diff --git a/tests/baselines/reference/unusedParametersWithUnderscore.errors.txt b/tests/baselines/reference/unusedParametersWithUnderscore.errors.txt index 136c3c0e367..841e8ec95fd 100644 --- a/tests/baselines/reference/unusedParametersWithUnderscore.errors.txt +++ b/tests/baselines/reference/unusedParametersWithUnderscore.errors.txt @@ -1,21 +1,21 @@ -tests/cases/compiler/unusedParametersWithUnderscore.ts(1,12): error TS6133: 'a' is declared but never used. -tests/cases/compiler/unusedParametersWithUnderscore.ts(1,19): error TS6133: 'c' is declared but never used. -tests/cases/compiler/unusedParametersWithUnderscore.ts(1,27): error TS6133: 'd' is declared but never used. -tests/cases/compiler/unusedParametersWithUnderscore.ts(1,29): error TS6133: 'e___' is declared but never used. -tests/cases/compiler/unusedParametersWithUnderscore.ts(11,16): error TS6133: 'arg' is declared but never used. -tests/cases/compiler/unusedParametersWithUnderscore.ts(17,13): error TS6133: 'arg' is declared but never used. +tests/cases/compiler/unusedParametersWithUnderscore.ts(1,12): error TS6133: 'a' is declared but its value is never read. +tests/cases/compiler/unusedParametersWithUnderscore.ts(1,19): error TS6133: 'c' is declared but its value is never read. +tests/cases/compiler/unusedParametersWithUnderscore.ts(1,27): error TS6133: 'd' is declared but its value is never read. +tests/cases/compiler/unusedParametersWithUnderscore.ts(1,29): error TS6133: 'e___' is declared but its value is never read. +tests/cases/compiler/unusedParametersWithUnderscore.ts(11,16): error TS6133: 'arg' is declared but its value is never read. +tests/cases/compiler/unusedParametersWithUnderscore.ts(17,13): error TS6133: 'arg' is declared but its value is never read. ==== tests/cases/compiler/unusedParametersWithUnderscore.ts (6 errors) ==== function f(a, _b, c, ___, d,e___, _f) { ~ -!!! error TS6133: 'a' is declared but never used. +!!! error TS6133: 'a' is declared but its value is never read. ~ -!!! error TS6133: 'c' is declared but never used. +!!! error TS6133: 'c' is declared but its value is never read. ~ -!!! error TS6133: 'd' is declared but never used. +!!! error TS6133: 'd' is declared but its value is never read. ~~~~ -!!! error TS6133: 'e___' is declared but never used. +!!! error TS6133: 'e___' is declared but its value is never read. } @@ -27,7 +27,7 @@ tests/cases/compiler/unusedParametersWithUnderscore.ts(17,13): error TS6133: 'ar function f4(...arg) { ~~~ -!!! error TS6133: 'arg' is declared but never used. +!!! error TS6133: 'arg' is declared but its value is never read. } function f5(..._arg) { @@ -35,7 +35,7 @@ tests/cases/compiler/unusedParametersWithUnderscore.ts(17,13): error TS6133: 'ar function f6(arg?, _arg?) { ~~~ -!!! error TS6133: 'arg' is declared but never used. +!!! error TS6133: 'arg' is declared but its value is never read. } var f7 = _ => undefined; diff --git a/tests/baselines/reference/unusedParametersinConstructor1.errors.txt b/tests/baselines/reference/unusedParametersinConstructor1.errors.txt index c505cc96f2f..a68bdccdc31 100644 --- a/tests/baselines/reference/unusedParametersinConstructor1.errors.txt +++ b/tests/baselines/reference/unusedParametersinConstructor1.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/unusedParametersinConstructor1.ts(2,17): error TS6133: 'param1' is declared but never used. +tests/cases/compiler/unusedParametersinConstructor1.ts(2,17): error TS6133: 'param1' is declared but its value is never read. ==== tests/cases/compiler/unusedParametersinConstructor1.ts (1 errors) ==== class greeter { constructor(param1: string) { ~~~~~~ -!!! error TS6133: 'param1' is declared but never used. +!!! error TS6133: 'param1' is declared but its value is never read. } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedParametersinConstructor2.errors.txt b/tests/baselines/reference/unusedParametersinConstructor2.errors.txt index f1c7bf1b49a..67cf295edda 100644 --- a/tests/baselines/reference/unusedParametersinConstructor2.errors.txt +++ b/tests/baselines/reference/unusedParametersinConstructor2.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/unusedParametersinConstructor2.ts(2,17): error TS6133: 'param1' is declared but never used. +tests/cases/compiler/unusedParametersinConstructor2.ts(2,17): error TS6133: 'param1' is declared but its value is never read. ==== tests/cases/compiler/unusedParametersinConstructor2.ts (1 errors) ==== class greeter { constructor(param1: string, param2: string) { ~~~~~~ -!!! error TS6133: 'param1' is declared but never used. +!!! error TS6133: 'param1' is declared but its value is never read. param2 = param2 + "dummy value"; } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedParametersinConstructor3.errors.txt b/tests/baselines/reference/unusedParametersinConstructor3.errors.txt index 1e79539d342..ca88555f45c 100644 --- a/tests/baselines/reference/unusedParametersinConstructor3.errors.txt +++ b/tests/baselines/reference/unusedParametersinConstructor3.errors.txt @@ -1,14 +1,14 @@ -tests/cases/compiler/unusedParametersinConstructor3.ts(2,17): error TS6133: 'param1' is declared but never used. -tests/cases/compiler/unusedParametersinConstructor3.ts(2,49): error TS6133: 'param3' is declared but never used. +tests/cases/compiler/unusedParametersinConstructor3.ts(2,17): error TS6133: 'param1' is declared but its value is never read. +tests/cases/compiler/unusedParametersinConstructor3.ts(2,49): error TS6133: 'param3' is declared but its value is never read. ==== tests/cases/compiler/unusedParametersinConstructor3.ts (2 errors) ==== class greeter { constructor(param1: string, param2: string, param3: string) { ~~~~~~ -!!! error TS6133: 'param1' is declared but never used. +!!! error TS6133: 'param1' is declared but its value is never read. ~~~~~~ -!!! error TS6133: 'param3' is declared but never used. +!!! error TS6133: 'param3' is declared but its value is never read. param2 = param2 + "dummy value"; } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedPrivateMethodInClass1.errors.txt b/tests/baselines/reference/unusedPrivateMethodInClass1.errors.txt index 7271fd48d70..110155a2734 100644 --- a/tests/baselines/reference/unusedPrivateMethodInClass1.errors.txt +++ b/tests/baselines/reference/unusedPrivateMethodInClass1.errors.txt @@ -1,12 +1,15 @@ -tests/cases/compiler/unusedPrivateMethodInClass1.ts(2,13): error TS6133: 'function1' is declared but never used. +tests/cases/compiler/unusedPrivateMethodInClass1.ts(2,13): error TS6133: 'function1' is declared but its value is never read. +tests/cases/compiler/unusedPrivateMethodInClass1.ts(3,13): error TS6133: 'y' is declared but its value is never read. -==== tests/cases/compiler/unusedPrivateMethodInClass1.ts (1 errors) ==== +==== tests/cases/compiler/unusedPrivateMethodInClass1.ts (2 errors) ==== class greeter { private function1() { ~~~~~~~~~ -!!! error TS6133: 'function1' is declared but never used. +!!! error TS6133: 'function1' is declared but its value is never read. var y = 10; + ~ +!!! error TS6133: 'y' is declared but its value is never read. y++; } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedPrivateMethodInClass2.errors.txt b/tests/baselines/reference/unusedPrivateMethodInClass2.errors.txt index ee52b95765f..16873219a6c 100644 --- a/tests/baselines/reference/unusedPrivateMethodInClass2.errors.txt +++ b/tests/baselines/reference/unusedPrivateMethodInClass2.errors.txt @@ -1,20 +1,26 @@ -tests/cases/compiler/unusedPrivateMethodInClass2.ts(2,13): error TS6133: 'function1' is declared but never used. -tests/cases/compiler/unusedPrivateMethodInClass2.ts(7,13): error TS6133: 'function2' is declared but never used. +tests/cases/compiler/unusedPrivateMethodInClass2.ts(2,13): error TS6133: 'function1' is declared but its value is never read. +tests/cases/compiler/unusedPrivateMethodInClass2.ts(3,13): error TS6133: 'y' is declared but its value is never read. +tests/cases/compiler/unusedPrivateMethodInClass2.ts(7,13): error TS6133: 'function2' is declared but its value is never read. +tests/cases/compiler/unusedPrivateMethodInClass2.ts(8,13): error TS6133: 'y' is declared but its value is never read. -==== tests/cases/compiler/unusedPrivateMethodInClass2.ts (2 errors) ==== +==== tests/cases/compiler/unusedPrivateMethodInClass2.ts (4 errors) ==== class greeter { private function1() { ~~~~~~~~~ -!!! error TS6133: 'function1' is declared but never used. +!!! error TS6133: 'function1' is declared but its value is never read. var y = 10; + ~ +!!! error TS6133: 'y' is declared but its value is never read. y++; } private function2() { ~~~~~~~~~ -!!! error TS6133: 'function2' is declared but never used. +!!! error TS6133: 'function2' is declared but its value is never read. var y = 10; + ~ +!!! error TS6133: 'y' is declared but its value is never read. y++; } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedPrivateMethodInClass3.errors.txt b/tests/baselines/reference/unusedPrivateMethodInClass3.errors.txt index 87bc63dd87f..492492836d0 100644 --- a/tests/baselines/reference/unusedPrivateMethodInClass3.errors.txt +++ b/tests/baselines/reference/unusedPrivateMethodInClass3.errors.txt @@ -1,25 +1,34 @@ -tests/cases/compiler/unusedPrivateMethodInClass3.ts(2,13): error TS6133: 'function1' is declared but never used. -tests/cases/compiler/unusedPrivateMethodInClass3.ts(7,13): error TS6133: 'function2' is declared but never used. +tests/cases/compiler/unusedPrivateMethodInClass3.ts(2,13): error TS6133: 'function1' is declared but its value is never read. +tests/cases/compiler/unusedPrivateMethodInClass3.ts(3,13): error TS6133: 'y' is declared but its value is never read. +tests/cases/compiler/unusedPrivateMethodInClass3.ts(7,13): error TS6133: 'function2' is declared but its value is never read. +tests/cases/compiler/unusedPrivateMethodInClass3.ts(8,13): error TS6133: 'y' is declared but its value is never read. +tests/cases/compiler/unusedPrivateMethodInClass3.ts(13,13): error TS6133: 'y' is declared but its value is never read. -==== tests/cases/compiler/unusedPrivateMethodInClass3.ts (2 errors) ==== +==== tests/cases/compiler/unusedPrivateMethodInClass3.ts (5 errors) ==== class greeter { private function1() { ~~~~~~~~~ -!!! error TS6133: 'function1' is declared but never used. +!!! error TS6133: 'function1' is declared but its value is never read. var y = 10; + ~ +!!! error TS6133: 'y' is declared but its value is never read. y++; } private function2() { ~~~~~~~~~ -!!! error TS6133: 'function2' is declared but never used. +!!! error TS6133: 'function2' is declared but its value is never read. var y = 10; + ~ +!!! error TS6133: 'y' is declared but its value is never read. y++; } public function3() { var y = 10; + ~ +!!! error TS6133: 'y' is declared but its value is never read. y++; } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedPrivateMethodInClass4.errors.txt b/tests/baselines/reference/unusedPrivateMethodInClass4.errors.txt index 8709a83374e..bcf8a5d25c7 100644 --- a/tests/baselines/reference/unusedPrivateMethodInClass4.errors.txt +++ b/tests/baselines/reference/unusedPrivateMethodInClass4.errors.txt @@ -1,22 +1,31 @@ -tests/cases/compiler/unusedPrivateMethodInClass4.ts(2,13): error TS6133: 'function1' is declared but never used. +tests/cases/compiler/unusedPrivateMethodInClass4.ts(2,13): error TS6133: 'function1' is declared but its value is never read. +tests/cases/compiler/unusedPrivateMethodInClass4.ts(3,13): error TS6133: 'y' is declared but its value is never read. +tests/cases/compiler/unusedPrivateMethodInClass4.ts(8,13): error TS6133: 'y' is declared but its value is never read. +tests/cases/compiler/unusedPrivateMethodInClass4.ts(13,13): error TS6133: 'y' is declared but its value is never read. -==== tests/cases/compiler/unusedPrivateMethodInClass4.ts (1 errors) ==== +==== tests/cases/compiler/unusedPrivateMethodInClass4.ts (4 errors) ==== class greeter { private function1() { ~~~~~~~~~ -!!! error TS6133: 'function1' is declared but never used. +!!! error TS6133: 'function1' is declared but its value is never read. var y = 10; + ~ +!!! error TS6133: 'y' is declared but its value is never read. y++; } private function2() { var y = 10; + ~ +!!! error TS6133: 'y' is declared but its value is never read. y++; } public function3() { var y = 10; + ~ +!!! error TS6133: 'y' is declared but its value is never read. y++; this.function2(); } diff --git a/tests/baselines/reference/unusedPrivateVariableInClass1.errors.txt b/tests/baselines/reference/unusedPrivateVariableInClass1.errors.txt index 68033811c15..08ebd8d1656 100644 --- a/tests/baselines/reference/unusedPrivateVariableInClass1.errors.txt +++ b/tests/baselines/reference/unusedPrivateVariableInClass1.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/unusedPrivateVariableInClass1.ts(2,13): error TS6133: 'x' is declared but never used. +tests/cases/compiler/unusedPrivateVariableInClass1.ts(2,13): error TS6133: 'x' is declared but its value is never read. ==== tests/cases/compiler/unusedPrivateVariableInClass1.ts (1 errors) ==== class greeter { private x: string; ~ -!!! error TS6133: 'x' is declared but never used. +!!! error TS6133: 'x' is declared but its value is never read. } \ No newline at end of file diff --git a/tests/baselines/reference/unusedPrivateVariableInClass2.errors.txt b/tests/baselines/reference/unusedPrivateVariableInClass2.errors.txt index 922263e0c5f..d13c7f0b6b5 100644 --- a/tests/baselines/reference/unusedPrivateVariableInClass2.errors.txt +++ b/tests/baselines/reference/unusedPrivateVariableInClass2.errors.txt @@ -1,13 +1,13 @@ -tests/cases/compiler/unusedPrivateVariableInClass2.ts(2,13): error TS6133: 'x' is declared but never used. -tests/cases/compiler/unusedPrivateVariableInClass2.ts(3,13): error TS6133: 'y' is declared but never used. +tests/cases/compiler/unusedPrivateVariableInClass2.ts(2,13): error TS6133: 'x' is declared but its value is never read. +tests/cases/compiler/unusedPrivateVariableInClass2.ts(3,13): error TS6133: 'y' is declared but its value is never read. ==== tests/cases/compiler/unusedPrivateVariableInClass2.ts (2 errors) ==== class greeter { private x: string; ~ -!!! error TS6133: 'x' is declared but never used. +!!! error TS6133: 'x' is declared but its value is never read. private y: string; ~ -!!! error TS6133: 'y' is declared but never used. +!!! error TS6133: 'y' is declared but its value is never read. } \ No newline at end of file diff --git a/tests/baselines/reference/unusedPrivateVariableInClass3.errors.txt b/tests/baselines/reference/unusedPrivateVariableInClass3.errors.txt index 686b5317436..ffa32a1c2c0 100644 --- a/tests/baselines/reference/unusedPrivateVariableInClass3.errors.txt +++ b/tests/baselines/reference/unusedPrivateVariableInClass3.errors.txt @@ -1,14 +1,14 @@ -tests/cases/compiler/unusedPrivateVariableInClass3.ts(2,13): error TS6133: 'x' is declared but never used. -tests/cases/compiler/unusedPrivateVariableInClass3.ts(3,13): error TS6133: 'y' is declared but never used. +tests/cases/compiler/unusedPrivateVariableInClass3.ts(2,13): error TS6133: 'x' is declared but its value is never read. +tests/cases/compiler/unusedPrivateVariableInClass3.ts(3,13): error TS6133: 'y' is declared but its value is never read. ==== tests/cases/compiler/unusedPrivateVariableInClass3.ts (2 errors) ==== class greeter { private x: string; ~ -!!! error TS6133: 'x' is declared but never used. +!!! error TS6133: 'x' is declared but its value is never read. private y: string; ~ -!!! error TS6133: 'y' is declared but never used. +!!! error TS6133: 'y' is declared but its value is never read. public z: string; } \ No newline at end of file diff --git a/tests/baselines/reference/unusedPrivateVariableInClass4.errors.txt b/tests/baselines/reference/unusedPrivateVariableInClass4.errors.txt index 5586b628c50..33c3f7237af 100644 --- a/tests/baselines/reference/unusedPrivateVariableInClass4.errors.txt +++ b/tests/baselines/reference/unusedPrivateVariableInClass4.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/unusedPrivateVariableInClass4.ts(3,13): error TS6133: 'y' is declared but never used. +tests/cases/compiler/unusedPrivateVariableInClass4.ts(3,13): error TS6133: 'y' is declared but its value is never read. ==== tests/cases/compiler/unusedPrivateVariableInClass4.ts (1 errors) ==== @@ -6,10 +6,10 @@ tests/cases/compiler/unusedPrivateVariableInClass4.ts(3,13): error TS6133: 'y' i private x: string; private y: string; ~ -!!! error TS6133: 'y' is declared but never used. +!!! error TS6133: 'y' is declared but its value is never read. public z: string; public method1() { - this.x = "dummy value"; + this.x; } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedPrivateVariableInClass4.js b/tests/baselines/reference/unusedPrivateVariableInClass4.js index 21c910f702c..e782b0791aa 100644 --- a/tests/baselines/reference/unusedPrivateVariableInClass4.js +++ b/tests/baselines/reference/unusedPrivateVariableInClass4.js @@ -5,7 +5,7 @@ class greeter { public z: string; public method1() { - this.x = "dummy value"; + this.x; } } @@ -14,7 +14,7 @@ var greeter = /** @class */ (function () { function greeter() { } greeter.prototype.method1 = function () { - this.x = "dummy value"; + this.x; }; return greeter; }()); diff --git a/tests/baselines/reference/unusedPrivateVariableInClass5.errors.txt b/tests/baselines/reference/unusedPrivateVariableInClass5.errors.txt index 9379b84ce82..96c4f74f956 100644 --- a/tests/baselines/reference/unusedPrivateVariableInClass5.errors.txt +++ b/tests/baselines/reference/unusedPrivateVariableInClass5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/unusedPrivateVariableInClass5.ts(3,13): error TS6133: 'y' is declared but never used. +tests/cases/compiler/unusedPrivateVariableInClass5.ts(3,13): error TS6133: 'y' is declared but its value is never read. ==== tests/cases/compiler/unusedPrivateVariableInClass5.ts (1 errors) ==== @@ -6,10 +6,10 @@ tests/cases/compiler/unusedPrivateVariableInClass5.ts(3,13): error TS6133: 'y' i private x: string; private y: string; ~ -!!! error TS6133: 'y' is declared but never used. +!!! error TS6133: 'y' is declared but its value is never read. public z: string; constructor() { - this.x = "dummy value"; + this.x; } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedPrivateVariableInClass5.js b/tests/baselines/reference/unusedPrivateVariableInClass5.js index a0ad7bf0021..4d000350197 100644 --- a/tests/baselines/reference/unusedPrivateVariableInClass5.js +++ b/tests/baselines/reference/unusedPrivateVariableInClass5.js @@ -5,14 +5,14 @@ class greeter { public z: string; constructor() { - this.x = "dummy value"; + this.x; } } //// [unusedPrivateVariableInClass5.js] var greeter = /** @class */ (function () { function greeter() { - this.x = "dummy value"; + this.x; } return greeter; }()); diff --git a/tests/baselines/reference/unusedSetterInClass.errors.txt b/tests/baselines/reference/unusedSetterInClass.errors.txt new file mode 100644 index 00000000000..d7cd764b293 --- /dev/null +++ b/tests/baselines/reference/unusedSetterInClass.errors.txt @@ -0,0 +1,13 @@ +tests/cases/compiler/unusedSetterInClass.ts(2,13): error TS6133: '_fullName' is declared but its value is never read. + + +==== tests/cases/compiler/unusedSetterInClass.ts (1 errors) ==== + class Employee { + private _fullName: string; + ~~~~~~~~~ +!!! error TS6133: '_fullName' is declared but its value is never read. + + set fullName(newName: string) { + this._fullName = newName; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/unusedSingleParameterInContructor.errors.txt b/tests/baselines/reference/unusedSingleParameterInContructor.errors.txt index c963394abca..7a8976b664d 100644 --- a/tests/baselines/reference/unusedSingleParameterInContructor.errors.txt +++ b/tests/baselines/reference/unusedSingleParameterInContructor.errors.txt @@ -1,14 +1,14 @@ -tests/cases/compiler/unusedSingleParameterInContructor.ts(2,17): error TS6133: 'person' is declared but never used. -tests/cases/compiler/unusedSingleParameterInContructor.ts(3,13): error TS6133: 'unused' is declared but never used. +tests/cases/compiler/unusedSingleParameterInContructor.ts(2,17): error TS6133: 'person' is declared but its value is never read. +tests/cases/compiler/unusedSingleParameterInContructor.ts(3,13): error TS6133: 'unused' is declared but its value is never read. ==== tests/cases/compiler/unusedSingleParameterInContructor.ts (2 errors) ==== class Dummy { constructor(person: string) { ~~~~~~ -!!! error TS6133: 'person' is declared but never used. +!!! error TS6133: 'person' is declared but its value is never read. var unused = 20; ~~~~~~ -!!! error TS6133: 'unused' is declared but never used. +!!! error TS6133: 'unused' is declared but its value is never read. } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedSingleParameterInFunctionDeclaration.errors.txt b/tests/baselines/reference/unusedSingleParameterInFunctionDeclaration.errors.txt index 374f963802f..f02dc30f455 100644 --- a/tests/baselines/reference/unusedSingleParameterInFunctionDeclaration.errors.txt +++ b/tests/baselines/reference/unusedSingleParameterInFunctionDeclaration.errors.txt @@ -1,12 +1,12 @@ -tests/cases/compiler/unusedSingleParameterInFunctionDeclaration.ts(1,18): error TS6133: 'person' is declared but never used. -tests/cases/compiler/unusedSingleParameterInFunctionDeclaration.ts(2,9): error TS6133: 'unused' is declared but never used. +tests/cases/compiler/unusedSingleParameterInFunctionDeclaration.ts(1,18): error TS6133: 'person' is declared but its value is never read. +tests/cases/compiler/unusedSingleParameterInFunctionDeclaration.ts(2,9): error TS6133: 'unused' is declared but its value is never read. ==== tests/cases/compiler/unusedSingleParameterInFunctionDeclaration.ts (2 errors) ==== function greeter(person: string) { ~~~~~~ -!!! error TS6133: 'person' is declared but never used. +!!! error TS6133: 'person' is declared but its value is never read. var unused = 20; ~~~~~~ -!!! error TS6133: 'unused' is declared but never used. +!!! error TS6133: 'unused' is declared but its value is never read. } \ No newline at end of file diff --git a/tests/baselines/reference/unusedSingleParameterInFunctionExpression.errors.txt b/tests/baselines/reference/unusedSingleParameterInFunctionExpression.errors.txt index 4adb424b3d4..a63003422ca 100644 --- a/tests/baselines/reference/unusedSingleParameterInFunctionExpression.errors.txt +++ b/tests/baselines/reference/unusedSingleParameterInFunctionExpression.errors.txt @@ -1,12 +1,12 @@ -tests/cases/compiler/unusedSingleParameterInFunctionExpression.ts(1,21): error TS6133: 'person' is declared but never used. -tests/cases/compiler/unusedSingleParameterInFunctionExpression.ts(2,9): error TS6133: 'unused' is declared but never used. +tests/cases/compiler/unusedSingleParameterInFunctionExpression.ts(1,21): error TS6133: 'person' is declared but its value is never read. +tests/cases/compiler/unusedSingleParameterInFunctionExpression.ts(2,9): error TS6133: 'unused' is declared but its value is never read. ==== tests/cases/compiler/unusedSingleParameterInFunctionExpression.ts (2 errors) ==== var func = function(person: string) { ~~~~~~ -!!! error TS6133: 'person' is declared but never used. +!!! error TS6133: 'person' is declared but its value is never read. var unused = 20; ~~~~~~ -!!! error TS6133: 'unused' is declared but never used. +!!! error TS6133: 'unused' is declared but its value is never read. } \ No newline at end of file diff --git a/tests/baselines/reference/unusedSingleParameterInMethodDeclaration.errors.txt b/tests/baselines/reference/unusedSingleParameterInMethodDeclaration.errors.txt index 903e4d87668..717b41e4d2a 100644 --- a/tests/baselines/reference/unusedSingleParameterInMethodDeclaration.errors.txt +++ b/tests/baselines/reference/unusedSingleParameterInMethodDeclaration.errors.txt @@ -1,14 +1,14 @@ -tests/cases/compiler/unusedSingleParameterInMethodDeclaration.ts(2,20): error TS6133: 'person' is declared but never used. -tests/cases/compiler/unusedSingleParameterInMethodDeclaration.ts(3,13): error TS6133: 'unused' is declared but never used. +tests/cases/compiler/unusedSingleParameterInMethodDeclaration.ts(2,20): error TS6133: 'person' is declared but its value is never read. +tests/cases/compiler/unusedSingleParameterInMethodDeclaration.ts(3,13): error TS6133: 'unused' is declared but its value is never read. ==== tests/cases/compiler/unusedSingleParameterInMethodDeclaration.ts (2 errors) ==== class Dummy { public greeter(person: string) { ~~~~~~ -!!! error TS6133: 'person' is declared but never used. +!!! error TS6133: 'person' is declared but its value is never read. var unused = 20; ~~~~~~ -!!! error TS6133: 'unused' is declared but never used. +!!! error TS6133: 'unused' is declared but its value is never read. } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedSwitchStatment.errors.txt b/tests/baselines/reference/unusedSwitchStatment.errors.txt index f47cad32eba..29dc18b5d9a 100644 --- a/tests/baselines/reference/unusedSwitchStatment.errors.txt +++ b/tests/baselines/reference/unusedSwitchStatment.errors.txt @@ -1,29 +1,30 @@ tests/cases/compiler/unusedSwitchStatment.ts(2,10): error TS2678: Type '0' is not comparable to type '1'. -tests/cases/compiler/unusedSwitchStatment.ts(3,13): error TS6133: 'x' is declared but never used. -tests/cases/compiler/unusedSwitchStatment.ts(6,15): error TS6133: 'c' is declared but never used. -tests/cases/compiler/unusedSwitchStatment.ts(9,13): error TS6133: 'z' is declared but never used. +tests/cases/compiler/unusedSwitchStatment.ts(3,13): error TS6133: 'x' is declared but its value is never read. +tests/cases/compiler/unusedSwitchStatment.ts(6,15): error TS6133: 'c' is declared but its value is never read. +tests/cases/compiler/unusedSwitchStatment.ts(9,13): error TS6133: 'z' is declared but its value is never read. tests/cases/compiler/unusedSwitchStatment.ts(14,10): error TS2678: Type '0' is not comparable to type '2'. +tests/cases/compiler/unusedSwitchStatment.ts(15,13): error TS6133: 'x' is declared but its value is never read. tests/cases/compiler/unusedSwitchStatment.ts(16,10): error TS2678: Type '1' is not comparable to type '2'. -==== tests/cases/compiler/unusedSwitchStatment.ts (6 errors) ==== +==== tests/cases/compiler/unusedSwitchStatment.ts (7 errors) ==== switch (1) { case 0: ~ !!! error TS2678: Type '0' is not comparable to type '1'. let x; ~ -!!! error TS6133: 'x' is declared but never used. +!!! error TS6133: 'x' is declared but its value is never read. break; case 1: const c = 1; ~ -!!! error TS6133: 'c' is declared but never used. +!!! error TS6133: 'c' is declared but its value is never read. break; default: let z = 2; ~ -!!! error TS6133: 'z' is declared but never used. +!!! error TS6133: 'z' is declared but its value is never read. } @@ -32,6 +33,8 @@ tests/cases/compiler/unusedSwitchStatment.ts(16,10): error TS2678: Type '1' is n ~ !!! error TS2678: Type '0' is not comparable to type '2'. let x; + ~ +!!! error TS6133: 'x' is declared but its value is never read. case 1: ~ !!! error TS2678: Type '1' is not comparable to type '2'. diff --git a/tests/baselines/reference/unusedTypeParameterInFunction1.errors.txt b/tests/baselines/reference/unusedTypeParameterInFunction1.errors.txt index 7ecdae21390..93af5cf16b6 100644 --- a/tests/baselines/reference/unusedTypeParameterInFunction1.errors.txt +++ b/tests/baselines/reference/unusedTypeParameterInFunction1.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/unusedTypeParameterInFunction1.ts(1,13): error TS6133: 'T' is declared but never used. +tests/cases/compiler/unusedTypeParameterInFunction1.ts(1,13): error TS6133: 'T' is declared but its value is never read. ==== tests/cases/compiler/unusedTypeParameterInFunction1.ts (1 errors) ==== function f1() { ~ -!!! error TS6133: 'T' is declared but never used. +!!! error TS6133: 'T' is declared but its value is never read. } \ No newline at end of file diff --git a/tests/baselines/reference/unusedTypeParameterInFunction2.errors.txt b/tests/baselines/reference/unusedTypeParameterInFunction2.errors.txt index 06926092f2b..848f242be19 100644 --- a/tests/baselines/reference/unusedTypeParameterInFunction2.errors.txt +++ b/tests/baselines/reference/unusedTypeParameterInFunction2.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/unusedTypeParameterInFunction2.ts(1,16): error TS6133: 'Y' is declared but never used. +tests/cases/compiler/unusedTypeParameterInFunction2.ts(1,16): error TS6133: 'Y' is declared but its value is never read. ==== tests/cases/compiler/unusedTypeParameterInFunction2.ts (1 errors) ==== function f1() { ~ -!!! error TS6133: 'Y' is declared but never used. +!!! error TS6133: 'Y' is declared but its value is never read. var a: X; a; } \ No newline at end of file diff --git a/tests/baselines/reference/unusedTypeParameterInFunction3.errors.txt b/tests/baselines/reference/unusedTypeParameterInFunction3.errors.txt index 5eb2f012f5e..3acdc7b523b 100644 --- a/tests/baselines/reference/unusedTypeParameterInFunction3.errors.txt +++ b/tests/baselines/reference/unusedTypeParameterInFunction3.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/unusedTypeParameterInFunction3.ts(1,16): error TS6133: 'Y' is declared but never used. +tests/cases/compiler/unusedTypeParameterInFunction3.ts(1,16): error TS6133: 'Y' is declared but its value is never read. ==== tests/cases/compiler/unusedTypeParameterInFunction3.ts (1 errors) ==== function f1() { ~ -!!! error TS6133: 'Y' is declared but never used. +!!! error TS6133: 'Y' is declared but its value is never read. var a: X; var b: Z; a; diff --git a/tests/baselines/reference/unusedTypeParameterInFunction4.errors.txt b/tests/baselines/reference/unusedTypeParameterInFunction4.errors.txt index 7ff8090f3c3..82eaffa100a 100644 --- a/tests/baselines/reference/unusedTypeParameterInFunction4.errors.txt +++ b/tests/baselines/reference/unusedTypeParameterInFunction4.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/unusedTypeParameterInFunction4.ts(1,13): error TS6133: 'X' is declared but never used. +tests/cases/compiler/unusedTypeParameterInFunction4.ts(1,13): error TS6133: 'X' is declared but its value is never read. ==== tests/cases/compiler/unusedTypeParameterInFunction4.ts (1 errors) ==== function f1() { ~ -!!! error TS6133: 'X' is declared but never used. +!!! error TS6133: 'X' is declared but its value is never read. var a: Y; var b: Z; a; diff --git a/tests/baselines/reference/unusedTypeParameterInInterface1.errors.txt b/tests/baselines/reference/unusedTypeParameterInInterface1.errors.txt index d1aa6fc03da..f0796d8fcd7 100644 --- a/tests/baselines/reference/unusedTypeParameterInInterface1.errors.txt +++ b/tests/baselines/reference/unusedTypeParameterInInterface1.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/unusedTypeParameterInInterface1.ts(1,15): error TS6133: 'T' is declared but never used. +tests/cases/compiler/unusedTypeParameterInInterface1.ts(1,15): error TS6133: 'T' is declared but its value is never read. ==== tests/cases/compiler/unusedTypeParameterInInterface1.ts (1 errors) ==== interface int { ~ -!!! error TS6133: 'T' is declared but never used. +!!! error TS6133: 'T' is declared but its value is never read. } \ No newline at end of file diff --git a/tests/baselines/reference/unusedTypeParameterInInterface2.errors.txt b/tests/baselines/reference/unusedTypeParameterInInterface2.errors.txt index c36cffdca41..1fa66c920a8 100644 --- a/tests/baselines/reference/unusedTypeParameterInInterface2.errors.txt +++ b/tests/baselines/reference/unusedTypeParameterInInterface2.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/unusedTypeParameterInInterface2.ts(1,18): error TS6133: 'U' is declared but never used. +tests/cases/compiler/unusedTypeParameterInInterface2.ts(1,18): error TS6133: 'U' is declared but its value is never read. ==== tests/cases/compiler/unusedTypeParameterInInterface2.ts (1 errors) ==== interface int { ~ -!!! error TS6133: 'U' is declared but never used. +!!! error TS6133: 'U' is declared but its value is never read. f1(a: T): string; c: V; } \ No newline at end of file diff --git a/tests/baselines/reference/unusedTypeParameterInLambda1.errors.txt b/tests/baselines/reference/unusedTypeParameterInLambda1.errors.txt index 687e0809f97..144ee86a0f5 100644 --- a/tests/baselines/reference/unusedTypeParameterInLambda1.errors.txt +++ b/tests/baselines/reference/unusedTypeParameterInLambda1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/unusedTypeParameterInLambda1.ts(3,17): error TS6133: 'T' is declared but never used. +tests/cases/compiler/unusedTypeParameterInLambda1.ts(3,17): error TS6133: 'T' is declared but its value is never read. ==== tests/cases/compiler/unusedTypeParameterInLambda1.ts (1 errors) ==== @@ -6,7 +6,7 @@ tests/cases/compiler/unusedTypeParameterInLambda1.ts(3,17): error TS6133: 'T' is public f1() { return () => { ~ -!!! error TS6133: 'T' is declared but never used. +!!! error TS6133: 'T' is declared but its value is never read. } } diff --git a/tests/baselines/reference/unusedTypeParameterInLambda2.errors.txt b/tests/baselines/reference/unusedTypeParameterInLambda2.errors.txt index bdadc908059..c185808338e 100644 --- a/tests/baselines/reference/unusedTypeParameterInLambda2.errors.txt +++ b/tests/baselines/reference/unusedTypeParameterInLambda2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/unusedTypeParameterInLambda2.ts(3,17): error TS6133: 'T' is declared but never used. +tests/cases/compiler/unusedTypeParameterInLambda2.ts(3,17): error TS6133: 'T' is declared but its value is never read. ==== tests/cases/compiler/unusedTypeParameterInLambda2.ts (1 errors) ==== @@ -6,7 +6,7 @@ tests/cases/compiler/unusedTypeParameterInLambda2.ts(3,17): error TS6133: 'T' is public f1() { return () => { ~ -!!! error TS6133: 'T' is declared but never used. +!!! error TS6133: 'T' is declared but its value is never read. var a: X; a; } diff --git a/tests/baselines/reference/unusedTypeParameterInLambda3.errors.txt b/tests/baselines/reference/unusedTypeParameterInLambda3.errors.txt index 5477f611e72..8b6f98ef681 100644 --- a/tests/baselines/reference/unusedTypeParameterInLambda3.errors.txt +++ b/tests/baselines/reference/unusedTypeParameterInLambda3.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/unusedTypeParameterInLambda3.ts(5,15): error TS6133: 'U' is declared but never used. +tests/cases/compiler/unusedTypeParameterInLambda3.ts(5,15): error TS6133: 'U' is declared but its value is never read. ==== tests/cases/compiler/unusedTypeParameterInLambda3.ts (1 errors) ==== @@ -8,5 +8,5 @@ tests/cases/compiler/unusedTypeParameterInLambda3.ts(5,15): error TS6133: 'U' is var y: new (a:T)=>void; ~ -!!! error TS6133: 'U' is declared but never used. +!!! error TS6133: 'U' is declared but its value is never read. \ No newline at end of file diff --git a/tests/baselines/reference/unusedTypeParameterInMethod1.errors.txt b/tests/baselines/reference/unusedTypeParameterInMethod1.errors.txt index eab59fddec2..dcf6fda8254 100644 --- a/tests/baselines/reference/unusedTypeParameterInMethod1.errors.txt +++ b/tests/baselines/reference/unusedTypeParameterInMethod1.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/unusedTypeParameterInMethod1.ts(2,15): error TS6133: 'X' is declared but never used. +tests/cases/compiler/unusedTypeParameterInMethod1.ts(2,15): error TS6133: 'X' is declared but its value is never read. ==== tests/cases/compiler/unusedTypeParameterInMethod1.ts (1 errors) ==== class A { public f1() { ~ -!!! error TS6133: 'X' is declared but never used. +!!! error TS6133: 'X' is declared but its value is never read. var a: Y; var b: Z; a; diff --git a/tests/baselines/reference/unusedTypeParameterInMethod2.errors.txt b/tests/baselines/reference/unusedTypeParameterInMethod2.errors.txt index 219d5f99e61..9e5936a2bc4 100644 --- a/tests/baselines/reference/unusedTypeParameterInMethod2.errors.txt +++ b/tests/baselines/reference/unusedTypeParameterInMethod2.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/unusedTypeParameterInMethod2.ts(2,18): error TS6133: 'Y' is declared but never used. +tests/cases/compiler/unusedTypeParameterInMethod2.ts(2,18): error TS6133: 'Y' is declared but its value is never read. ==== tests/cases/compiler/unusedTypeParameterInMethod2.ts (1 errors) ==== class A { public f1() { ~ -!!! error TS6133: 'Y' is declared but never used. +!!! error TS6133: 'Y' is declared but its value is never read. var a: X; var b: Z; a; diff --git a/tests/baselines/reference/unusedTypeParameterInMethod3.errors.txt b/tests/baselines/reference/unusedTypeParameterInMethod3.errors.txt index f9257169897..102cd56f281 100644 --- a/tests/baselines/reference/unusedTypeParameterInMethod3.errors.txt +++ b/tests/baselines/reference/unusedTypeParameterInMethod3.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/unusedTypeParameterInMethod3.ts(2,21): error TS6133: 'Z' is declared but never used. +tests/cases/compiler/unusedTypeParameterInMethod3.ts(2,21): error TS6133: 'Z' is declared but its value is never read. ==== tests/cases/compiler/unusedTypeParameterInMethod3.ts (1 errors) ==== class A { public f1() { ~ -!!! error TS6133: 'Z' is declared but never used. +!!! error TS6133: 'Z' is declared but its value is never read. var a: X; var b: Y; a; diff --git a/tests/baselines/reference/unusedTypeParameterInMethod4.errors.txt b/tests/baselines/reference/unusedTypeParameterInMethod4.errors.txt index ab2dbbc868e..bb121372e91 100644 --- a/tests/baselines/reference/unusedTypeParameterInMethod4.errors.txt +++ b/tests/baselines/reference/unusedTypeParameterInMethod4.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/unusedTypeParameterInMethod4.ts(2,15): error TS6133: 'X' is declared but never used. +tests/cases/compiler/unusedTypeParameterInMethod4.ts(2,15): error TS6133: 'X' is declared but its value is never read. ==== tests/cases/compiler/unusedTypeParameterInMethod4.ts (1 errors) ==== class A { public f1() { ~ -!!! error TS6133: 'X' is declared but never used. +!!! error TS6133: 'X' is declared but its value is never read. } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedTypeParameterInMethod5.errors.txt b/tests/baselines/reference/unusedTypeParameterInMethod5.errors.txt index 6bc5f88407c..7afa26fd323 100644 --- a/tests/baselines/reference/unusedTypeParameterInMethod5.errors.txt +++ b/tests/baselines/reference/unusedTypeParameterInMethod5.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/unusedTypeParameterInMethod5.ts(2,26): error TS6133: 'X' is declared but never used. +tests/cases/compiler/unusedTypeParameterInMethod5.ts(2,26): error TS6133: 'X' is declared but its value is never read. ==== tests/cases/compiler/unusedTypeParameterInMethod5.ts (1 errors) ==== class A { public f1 = function() { ~ -!!! error TS6133: 'X' is declared but never used. +!!! error TS6133: 'X' is declared but its value is never read. } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedTypeParameters1.errors.txt b/tests/baselines/reference/unusedTypeParameters1.errors.txt index 0868ebbe9be..3a6222497f0 100644 --- a/tests/baselines/reference/unusedTypeParameters1.errors.txt +++ b/tests/baselines/reference/unusedTypeParameters1.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/unusedTypeParameters1.ts(1,15): error TS6133: 'typeparameter1' is declared but never used. +tests/cases/compiler/unusedTypeParameters1.ts(1,15): error TS6133: 'typeparameter1' is declared but its value is never read. ==== tests/cases/compiler/unusedTypeParameters1.ts (1 errors) ==== class greeter { ~~~~~~~~~~~~~~ -!!! error TS6133: 'typeparameter1' is declared but never used. +!!! error TS6133: 'typeparameter1' is declared but its value is never read. } \ No newline at end of file diff --git a/tests/baselines/reference/unusedTypeParameters10.errors.txt b/tests/baselines/reference/unusedTypeParameters10.errors.txt index 7bfd5676df3..2e76b39ab96 100644 --- a/tests/baselines/reference/unusedTypeParameters10.errors.txt +++ b/tests/baselines/reference/unusedTypeParameters10.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/unusedTypeParameters10.ts(1,12): error TS6133: 'T' is declared but never used. +tests/cases/compiler/unusedTypeParameters10.ts(1,12): error TS6133: 'T' is declared but its value is never read. ==== tests/cases/compiler/unusedTypeParameters10.ts (1 errors) ==== type Alias = { }; ~ -!!! error TS6133: 'T' is declared but never used. +!!! error TS6133: 'T' is declared but its value is never read. type Alias2 = { x: T }; \ No newline at end of file diff --git a/tests/baselines/reference/unusedTypeParameters2.errors.txt b/tests/baselines/reference/unusedTypeParameters2.errors.txt index 97335fc6ecf..0ce28313c75 100644 --- a/tests/baselines/reference/unusedTypeParameters2.errors.txt +++ b/tests/baselines/reference/unusedTypeParameters2.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/unusedTypeParameters2.ts(1,15): error TS6133: 'typeparameter1' is declared but never used. +tests/cases/compiler/unusedTypeParameters2.ts(1,15): error TS6133: 'typeparameter1' is declared but its value is never read. ==== tests/cases/compiler/unusedTypeParameters2.ts (1 errors) ==== class greeter { ~~~~~~~~~~~~~~ -!!! error TS6133: 'typeparameter1' is declared but never used. +!!! error TS6133: 'typeparameter1' is declared but its value is never read. private x: typeparameter2; public function1() { diff --git a/tests/baselines/reference/unusedTypeParameters3.errors.txt b/tests/baselines/reference/unusedTypeParameters3.errors.txt index 31840f2cc42..6f5797365a2 100644 --- a/tests/baselines/reference/unusedTypeParameters3.errors.txt +++ b/tests/baselines/reference/unusedTypeParameters3.errors.txt @@ -1,13 +1,13 @@ -tests/cases/compiler/unusedTypeParameters3.ts(1,15): error TS6133: 'typeparameter1' is declared but never used. -tests/cases/compiler/unusedTypeParameters3.ts(1,47): error TS6133: 'typeparameter3' is declared but never used. +tests/cases/compiler/unusedTypeParameters3.ts(1,15): error TS6133: 'typeparameter1' is declared but its value is never read. +tests/cases/compiler/unusedTypeParameters3.ts(1,47): error TS6133: 'typeparameter3' is declared but its value is never read. ==== tests/cases/compiler/unusedTypeParameters3.ts (2 errors) ==== class greeter { ~~~~~~~~~~~~~~ -!!! error TS6133: 'typeparameter1' is declared but never used. +!!! error TS6133: 'typeparameter1' is declared but its value is never read. ~~~~~~~~~~~~~~ -!!! error TS6133: 'typeparameter3' is declared but never used. +!!! error TS6133: 'typeparameter3' is declared but its value is never read. private x: typeparameter2; public function1() { diff --git a/tests/baselines/reference/unusedTypeParameters4.errors.txt b/tests/baselines/reference/unusedTypeParameters4.errors.txt index 149c764895c..3e56c270f43 100644 --- a/tests/baselines/reference/unusedTypeParameters4.errors.txt +++ b/tests/baselines/reference/unusedTypeParameters4.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/unusedTypeParameters4.ts(2,13): error TS6133: 'U' is declared but never used. +tests/cases/compiler/unusedTypeParameters4.ts(2,13): error TS6133: 'U' is declared but its value is never read. ==== tests/cases/compiler/unusedTypeParameters4.ts (1 errors) ==== var x: { new (a: T): void; ~ -!!! error TS6133: 'U' is declared but never used. +!!! error TS6133: 'U' is declared but its value is never read. } \ No newline at end of file diff --git a/tests/baselines/reference/unusedTypeParameters5.errors.txt b/tests/baselines/reference/unusedTypeParameters5.errors.txt index ed19d33fd97..069caedf0dd 100644 --- a/tests/baselines/reference/unusedTypeParameters5.errors.txt +++ b/tests/baselines/reference/unusedTypeParameters5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/unusedTypeParameters5.ts(6,16): error TS6133: 'K' is declared but never used. +tests/cases/compiler/unusedTypeParameters5.ts(6,16): error TS6133: 'K' is declared but its value is never read. ==== tests/cases/compiler/unusedTypeParameters5.ts (1 errors) ==== @@ -9,5 +9,5 @@ tests/cases/compiler/unusedTypeParameters5.ts(6,16): error TS6133: 'K' is declar var x: { new (a: T): A; ~ -!!! error TS6133: 'K' is declared but never used. +!!! error TS6133: 'K' is declared but its value is never read. } \ No newline at end of file diff --git a/tests/baselines/reference/unusedTypeParameters8.errors.txt b/tests/baselines/reference/unusedTypeParameters8.errors.txt index 5b466a9b806..e1381ec0002 100644 --- a/tests/baselines/reference/unusedTypeParameters8.errors.txt +++ b/tests/baselines/reference/unusedTypeParameters8.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/b.ts(1,13): error TS6133: 'T' is declared but never used. +tests/cases/compiler/b.ts(1,13): error TS6133: 'T' is declared but its value is never read. ==== tests/cases/compiler/a.ts (0 errors) ==== @@ -7,4 +7,4 @@ tests/cases/compiler/b.ts(1,13): error TS6133: 'T' is declared but never used. ==== tests/cases/compiler/b.ts (1 errors) ==== interface C { } ~ -!!! error TS6133: 'T' is declared but never used. \ No newline at end of file +!!! error TS6133: 'T' is declared but its value is never read. \ No newline at end of file diff --git a/tests/baselines/reference/unusedVariablesinBlocks1.errors.txt b/tests/baselines/reference/unusedVariablesinBlocks1.errors.txt index e1906041a89..1fa2e52b3f3 100644 --- a/tests/baselines/reference/unusedVariablesinBlocks1.errors.txt +++ b/tests/baselines/reference/unusedVariablesinBlocks1.errors.txt @@ -1,13 +1,16 @@ -tests/cases/compiler/unusedVariablesinBlocks1.ts(2,9): error TS6133: 'x' is declared but never used. +tests/cases/compiler/unusedVariablesinBlocks1.ts(2,9): error TS6133: 'x' is declared but its value is never read. +tests/cases/compiler/unusedVariablesinBlocks1.ts(4,13): error TS6133: 'x' is declared but its value is never read. -==== tests/cases/compiler/unusedVariablesinBlocks1.ts (1 errors) ==== +==== tests/cases/compiler/unusedVariablesinBlocks1.ts (2 errors) ==== function f1 () { let x = 10; ~ -!!! error TS6133: 'x' is declared but never used. +!!! error TS6133: 'x' is declared but its value is never read. { let x = 11; + ~ +!!! error TS6133: 'x' is declared but its value is never read. x++; } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedVariablesinBlocks2.errors.txt b/tests/baselines/reference/unusedVariablesinBlocks2.errors.txt index 610b379d607..f9c83abca18 100644 --- a/tests/baselines/reference/unusedVariablesinBlocks2.errors.txt +++ b/tests/baselines/reference/unusedVariablesinBlocks2.errors.txt @@ -1,13 +1,16 @@ -tests/cases/compiler/unusedVariablesinBlocks2.ts(4,13): error TS6133: 'x' is declared but never used. +tests/cases/compiler/unusedVariablesinBlocks2.ts(2,9): error TS6133: 'x' is declared but its value is never read. +tests/cases/compiler/unusedVariablesinBlocks2.ts(4,13): error TS6133: 'x' is declared but its value is never read. -==== tests/cases/compiler/unusedVariablesinBlocks2.ts (1 errors) ==== +==== tests/cases/compiler/unusedVariablesinBlocks2.ts (2 errors) ==== function f1 () { let x = 10; + ~ +!!! error TS6133: 'x' is declared but its value is never read. { let x = 11; ~ -!!! error TS6133: 'x' is declared but never used. +!!! error TS6133: 'x' is declared but its value is never read. } x++; } \ No newline at end of file diff --git a/tests/baselines/reference/unusedVariablesinForLoop.errors.txt b/tests/baselines/reference/unusedVariablesinForLoop.errors.txt index 74f1450b6f7..1385f1e2327 100644 --- a/tests/baselines/reference/unusedVariablesinForLoop.errors.txt +++ b/tests/baselines/reference/unusedVariablesinForLoop.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/unusedVariablesinForLoop.ts(2,13): error TS6133: 'i' is declared but never used. +tests/cases/compiler/unusedVariablesinForLoop.ts(2,13): error TS6133: 'i' is declared but its value is never read. ==== tests/cases/compiler/unusedVariablesinForLoop.ts (1 errors) ==== function f1 () { for(var i = 0; ;) { ~ -!!! error TS6133: 'i' is declared but never used. +!!! error TS6133: 'i' is declared but its value is never read. } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedVariablesinForLoop2.errors.txt b/tests/baselines/reference/unusedVariablesinForLoop2.errors.txt index d42f71286a0..bdd4706854a 100644 --- a/tests/baselines/reference/unusedVariablesinForLoop2.errors.txt +++ b/tests/baselines/reference/unusedVariablesinForLoop2.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/unusedVariablesinForLoop2.ts(2,16): error TS6133: 'elem' is declared but never used. +tests/cases/compiler/unusedVariablesinForLoop2.ts(2,16): error TS6133: 'elem' is declared but its value is never read. ==== tests/cases/compiler/unusedVariablesinForLoop2.ts (1 errors) ==== function f1 () { for (const elem in ["a", "b", "c"]) { ~~~~ -!!! error TS6133: 'elem' is declared but never used. +!!! error TS6133: 'elem' is declared but its value is never read. } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedVariablesinForLoop3.errors.txt b/tests/baselines/reference/unusedVariablesinForLoop3.errors.txt index ec3e96584e2..a2a9d273200 100644 --- a/tests/baselines/reference/unusedVariablesinForLoop3.errors.txt +++ b/tests/baselines/reference/unusedVariablesinForLoop3.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/unusedVariablesinForLoop3.ts(2,16): error TS6133: 'elem' is declared but never used. +tests/cases/compiler/unusedVariablesinForLoop3.ts(2,16): error TS6133: 'elem' is declared but its value is never read. ==== tests/cases/compiler/unusedVariablesinForLoop3.ts (1 errors) ==== function f1 () { for (const elem of ["a", "b", "c"]) { ~~~~ -!!! error TS6133: 'elem' is declared but never used. +!!! error TS6133: 'elem' is declared but its value is never read. } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedVariablesinForLoop4.errors.txt b/tests/baselines/reference/unusedVariablesinForLoop4.errors.txt index c20a6c1ba20..df6ffe9934b 100644 --- a/tests/baselines/reference/unusedVariablesinForLoop4.errors.txt +++ b/tests/baselines/reference/unusedVariablesinForLoop4.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/unusedVariablesinForLoop4.ts(4,13): error TS6133: 'x' is declared but never used. +tests/cases/compiler/unusedVariablesinForLoop4.ts(4,13): error TS6133: 'x' is declared but its value is never read. ==== tests/cases/compiler/unusedVariablesinForLoop4.ts (1 errors) ==== @@ -7,6 +7,6 @@ tests/cases/compiler/unusedVariablesinForLoop4.ts(4,13): error TS6133: 'x' is de elem; var x = 20; ~ -!!! error TS6133: 'x' is declared but never used. +!!! error TS6133: 'x' is declared but its value is never read. } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedVariablesinModules1.errors.txt b/tests/baselines/reference/unusedVariablesinModules1.errors.txt index 7a8704a89ca..0421c9ff2b0 100644 --- a/tests/baselines/reference/unusedVariablesinModules1.errors.txt +++ b/tests/baselines/reference/unusedVariablesinModules1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/unusedVariablesinModules1.ts(3,5): error TS6133: 'x' is declared but never used. +tests/cases/compiler/unusedVariablesinModules1.ts(3,5): error TS6133: 'x' is declared but its value is never read. ==== tests/cases/compiler/unusedVariablesinModules1.ts (1 errors) ==== @@ -6,6 +6,6 @@ tests/cases/compiler/unusedVariablesinModules1.ts(3,5): error TS6133: 'x' is dec var x: string; ~ -!!! error TS6133: 'x' is declared but never used. +!!! error TS6133: 'x' is declared but its value is never read. export var y: string; \ No newline at end of file diff --git a/tests/baselines/reference/unusedVariablesinNamespaces1.errors.txt b/tests/baselines/reference/unusedVariablesinNamespaces1.errors.txt index 25c06c216fb..8ba5fc3c39a 100644 --- a/tests/baselines/reference/unusedVariablesinNamespaces1.errors.txt +++ b/tests/baselines/reference/unusedVariablesinNamespaces1.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/unusedVariablesinNamespaces1.ts(2,11): error TS6133: 'lettersRegexp' is declared but never used. +tests/cases/compiler/unusedVariablesinNamespaces1.ts(2,11): error TS6133: 'lettersRegexp' is declared but its value is never read. ==== tests/cases/compiler/unusedVariablesinNamespaces1.ts (1 errors) ==== namespace Validation { const lettersRegexp = /^[A-Za-z]+$/; ~~~~~~~~~~~~~ -!!! error TS6133: 'lettersRegexp' is declared but never used. +!!! error TS6133: 'lettersRegexp' is declared but its value is never read. } \ No newline at end of file diff --git a/tests/baselines/reference/unusedVariablesinNamespaces2.errors.txt b/tests/baselines/reference/unusedVariablesinNamespaces2.errors.txt index a3af55498dc..df5fa298266 100644 --- a/tests/baselines/reference/unusedVariablesinNamespaces2.errors.txt +++ b/tests/baselines/reference/unusedVariablesinNamespaces2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/unusedVariablesinNamespaces2.ts(3,11): error TS6133: 'numberRegexp' is declared but never used. +tests/cases/compiler/unusedVariablesinNamespaces2.ts(3,11): error TS6133: 'numberRegexp' is declared but its value is never read. ==== tests/cases/compiler/unusedVariablesinNamespaces2.ts (1 errors) ==== @@ -6,7 +6,7 @@ tests/cases/compiler/unusedVariablesinNamespaces2.ts(3,11): error TS6133: 'numbe const lettersRegexp = /^[A-Za-z]+$/; const numberRegexp = /^[0-9]+$/; ~~~~~~~~~~~~ -!!! error TS6133: 'numberRegexp' is declared but never used. +!!! error TS6133: 'numberRegexp' is declared but its value is never read. export class LettersOnlyValidator { isAcceptable(s2: string) { diff --git a/tests/baselines/reference/unusedVariablesinNamespaces3.errors.txt b/tests/baselines/reference/unusedVariablesinNamespaces3.errors.txt index 64d94a86ade..b1c7644019a 100644 --- a/tests/baselines/reference/unusedVariablesinNamespaces3.errors.txt +++ b/tests/baselines/reference/unusedVariablesinNamespaces3.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/unusedVariablesinNamespaces3.ts(3,11): error TS6133: 'numberRegexp' is declared but never used. +tests/cases/compiler/unusedVariablesinNamespaces3.ts(3,11): error TS6133: 'numberRegexp' is declared but its value is never read. ==== tests/cases/compiler/unusedVariablesinNamespaces3.ts (1 errors) ==== @@ -6,7 +6,7 @@ tests/cases/compiler/unusedVariablesinNamespaces3.ts(3,11): error TS6133: 'numbe const lettersRegexp = /^[A-Za-z]+$/; const numberRegexp = /^[0-9]+$/; ~~~~~~~~~~~~ -!!! error TS6133: 'numberRegexp' is declared but never used. +!!! error TS6133: 'numberRegexp' is declared but its value is never read. export const anotherUnusedVariable = "Dummy value"; export class LettersOnlyValidator { diff --git a/tests/cases/compiler/noUnusedLocals_writeOnly.ts b/tests/cases/compiler/noUnusedLocals_writeOnly.ts new file mode 100644 index 00000000000..228a7e0b6b0 --- /dev/null +++ b/tests/cases/compiler/noUnusedLocals_writeOnly.ts @@ -0,0 +1,12 @@ +// @noUnusedLocals: true +// @noUnusedParameters: true + +function f(x = 0) { + x = 1; + x++; + x /= 2; + + let y = 0; + // This is a write access to y, but not a write-*only* access. + f(y++); +} diff --git a/tests/cases/compiler/noUnusedLocals_writeOnlyProperty.ts b/tests/cases/compiler/noUnusedLocals_writeOnlyProperty.ts new file mode 100644 index 00000000000..84e005afd54 --- /dev/null +++ b/tests/cases/compiler/noUnusedLocals_writeOnlyProperty.ts @@ -0,0 +1,8 @@ +// @noUnusedLocals: true + +class C { + private x; + m() { + this.x = 0; + } +} diff --git a/tests/cases/compiler/unusedParameterUsedInTypeOf.ts b/tests/cases/compiler/unusedParameterUsedInTypeOf.ts index b69b2412314..f1cf83d56c4 100644 --- a/tests/cases/compiler/unusedParameterUsedInTypeOf.ts +++ b/tests/cases/compiler/unusedParameterUsedInTypeOf.ts @@ -3,5 +3,5 @@ //@noUnusedParameters:true function f1 (a: number, b: typeof a) { - b++; + return b; } \ No newline at end of file diff --git a/tests/cases/compiler/unusedPrivateVariableInClass4.ts b/tests/cases/compiler/unusedPrivateVariableInClass4.ts index 23598d5a491..e737d9ac477 100644 --- a/tests/cases/compiler/unusedPrivateVariableInClass4.ts +++ b/tests/cases/compiler/unusedPrivateVariableInClass4.ts @@ -7,6 +7,6 @@ class greeter { public z: string; public method1() { - this.x = "dummy value"; + this.x; } } \ No newline at end of file diff --git a/tests/cases/compiler/unusedPrivateVariableInClass5.ts b/tests/cases/compiler/unusedPrivateVariableInClass5.ts index 51e64afca1d..4234f16bdbc 100644 --- a/tests/cases/compiler/unusedPrivateVariableInClass5.ts +++ b/tests/cases/compiler/unusedPrivateVariableInClass5.ts @@ -7,6 +7,6 @@ class greeter { public z: string; constructor() { - this.x = "dummy value"; + this.x; } } \ No newline at end of file diff --git a/tests/cases/fourslash/extract-method-formatting.ts b/tests/cases/fourslash/extract-method-formatting.ts index a346ad3bbd9..e4193fd8db3 100644 --- a/tests/cases/fourslash/extract-method-formatting.ts +++ b/tests/cases/fourslash/extract-method-formatting.ts @@ -10,10 +10,8 @@ edit.applyRefactor({ refactorName: "Extract Method", actionName: "scope_1", actionDescription: "Extract to function in global scope", -}); -verify.currentFileContentIs( -`function f(x: number): number { - return newFunction(x); + newContent: `function f(x: number): number { + return /*RENAME*/newFunction(x); } function newFunction(x: number) { switch (x) { @@ -21,4 +19,5 @@ function newFunction(x: number) { return 0; } } -`); +` +}); diff --git a/tests/cases/fourslash/extract-method-uniqueName.ts b/tests/cases/fourslash/extract-method-uniqueName.ts new file mode 100644 index 00000000000..44f026ae8a8 --- /dev/null +++ b/tests/cases/fourslash/extract-method-uniqueName.ts @@ -0,0 +1,20 @@ +/// + +////// newFunction +/////*start*/1 + 1/*end*/; + +goTo.select('start', 'end') +edit.applyRefactor({ + refactorName: "Extract Method", + actionName: "scope_0", + actionDescription: "Extract to function in global scope", + newContent: +`// newFunction +/*RENAME*/newFunction_1(); + +function newFunction_1() { + // newFunction + 1 + 1; +} +` +}); diff --git a/tests/cases/fourslash/extract-method1.ts b/tests/cases/fourslash/extract-method1.ts index 64dffc15a90..a8d421923b1 100644 --- a/tests/cases/fourslash/extract-method1.ts +++ b/tests/cases/fourslash/extract-method1.ts @@ -17,11 +17,10 @@ edit.applyRefactor({ refactorName: "Extract Method", actionName: "scope_0", actionDescription: "Extract to method in class 'Foo'", -}); -verify.currentFileContentIs( + newContent: `class Foo { someMethod(m: number) { - this.newFunction(m); + this./*RENAME*/newFunction(m); var q = 10; return q; } @@ -33,4 +32,5 @@ verify.currentFileContentIs( var z = y + x; console.log(z); } -}`); +}` +}); diff --git a/tests/cases/fourslash/extract-method10.ts b/tests/cases/fourslash/extract-method10.ts index 73ef3029e24..215196d6c51 100644 --- a/tests/cases/fourslash/extract-method10.ts +++ b/tests/cases/fourslash/extract-method10.ts @@ -8,4 +8,11 @@ edit.applyRefactor({ refactorName: "Extract Method", actionName: 'scope_0', actionDescription: "Extract to function in module scope", + newContent: +`export {}; // Make this a module +(x => x)(/*RENAME*/newFunction())(1); +function newFunction(): (x: any) => any { + return x => x; +} +` }); diff --git a/tests/cases/fourslash/extract-method13.ts b/tests/cases/fourslash/extract-method13.ts index 707921546c5..274753fd5cd 100644 --- a/tests/cases/fourslash/extract-method13.ts +++ b/tests/cases/fourslash/extract-method13.ts @@ -14,25 +14,45 @@ edit.applyRefactor({ refactorName: "Extract Method", actionName: "scope_0", actionDescription: "Extract to method in class 'C'", -}); + newContent: +`class C { + static j = 1 + 1; + constructor(q: string = C./*RENAME*/newFunction()) { + } -goTo.select('c', 'd'); -edit.applyRefactor({ - refactorName: "Extract Method", - actionName: "scope_0", - actionDescription: "Extract to method in class 'C'", + private static newFunction(): string { + return "a" + "b"; + } +}` }); verify.currentFileContentIs(`class C { - static j = C.newFunction_1(); + static j = 1 + 1; constructor(q: string = C.newFunction()) { } private static newFunction(): string { return "a" + "b"; } +}`); + +goTo.select('c', 'd'); +edit.applyRefactor({ + refactorName: "Extract Method", + actionName: "scope_0", + actionDescription: "Extract to method in class 'C'", + newContent: +`class C { + static j = C./*RENAME*/newFunction_1(); + constructor(q: string = C.newFunction()) { + } private static newFunction_1() { return 1 + 1; } -}`); \ No newline at end of file + + private static newFunction(): string { + return "a" + "b"; + } +}` +}); diff --git a/tests/cases/fourslash/extract-method14.ts b/tests/cases/fourslash/extract-method14.ts index 770ed3d0fcb..27a561743c6 100644 --- a/tests/cases/fourslash/extract-method14.ts +++ b/tests/cases/fourslash/extract-method14.ts @@ -15,14 +15,15 @@ edit.applyRefactor({ refactorName: "Extract Method", actionName: "scope_1", actionDescription: "Extract to function in global scope", -}); -verify.currentFileContentIs(`function foo() { + newContent: +`function foo() { var i = 10; var __return: any; - ({ __return, i } = newFunction(i)); + ({ __return, i } = n/*RENAME*/ewFunction(i)); return __return; } function newFunction(i) { return { __return: i++, i }; } -`); \ No newline at end of file +` +}); diff --git a/tests/cases/fourslash/extract-method15.ts b/tests/cases/fourslash/extract-method15.ts index 8d3db633b11..c3db3186cdf 100644 --- a/tests/cases/fourslash/extract-method15.ts +++ b/tests/cases/fourslash/extract-method15.ts @@ -13,14 +13,14 @@ edit.applyRefactor({ refactorName: "Extract Method", actionName: "scope_1", actionDescription: "Extract to function in global scope", -}); - -verify.currentFileContentIs(`function foo() { + newContent: +`function foo() { var i = 10; - i = newFunction(i); + i = /*RENAME*/newFunction(i); } function newFunction(i: number) { i++; return i; } -`); +` +}); diff --git a/tests/cases/fourslash/extract-method18.ts b/tests/cases/fourslash/extract-method18.ts index 6d4d06ca7bf..8ff1cc3028d 100644 --- a/tests/cases/fourslash/extract-method18.ts +++ b/tests/cases/fourslash/extract-method18.ts @@ -13,12 +13,13 @@ edit.applyRefactor({ refactorName: "Extract Method", actionName: "scope_1", actionDescription: "Extract to function in global scope", -}); -verify.currentFileContentIs(`function fn() { + newContent: +`function fn() { const x = { m: 1 }; - newFunction(x); + /*RENAME*/newFunction(x); } function newFunction(x: { m: number; }) { x.m = 3; } -`); +` +}); diff --git a/tests/cases/fourslash/extract-method19.ts b/tests/cases/fourslash/extract-method19.ts index da999fcc093..56d6b02560f 100644 --- a/tests/cases/fourslash/extract-method19.ts +++ b/tests/cases/fourslash/extract-method19.ts @@ -13,13 +13,14 @@ edit.applyRefactor({ refactorName: "Extract Method", actionName: "scope_0", actionDescription: "Extract to inner function in function 'fn'", -}); -verify.currentFileContentIs(`function fn() { - newFunction_1(); + newContent: +`function fn() { + /*RENAME*/newFunction_1(); function newFunction_1() { console.log("hi"); } } -function newFunction() { }`); +function newFunction() { }` +}); diff --git a/tests/cases/fourslash/extract-method2.ts b/tests/cases/fourslash/extract-method2.ts index 021716b6e48..6fbe7394c2f 100644 --- a/tests/cases/fourslash/extract-method2.ts +++ b/tests/cases/fourslash/extract-method2.ts @@ -14,18 +14,18 @@ edit.applyRefactor({ refactorName: "Extract Method", actionName: "scope_2", actionDescription: "Extract to function in global scope", -}); -verify.currentFileContentIs( + newContent: `namespace NS { class Q { foo() { console.log('100'); const m = 10, j = "hello", k = {x: "what"}; - const q = newFunction(m, j, k); + const q = /*RENAME*/newFunction(m, j, k); } } } function newFunction(m: number, j: string, k: { x: string; }) { return m + j + k; } -`); +` +}); diff --git a/tests/cases/fourslash/extract-method21.ts b/tests/cases/fourslash/extract-method21.ts index f19d4b05912..8e3baf61949 100644 --- a/tests/cases/fourslash/extract-method21.ts +++ b/tests/cases/fourslash/extract-method21.ts @@ -16,14 +16,14 @@ edit.applyRefactor({ refactorName: "Extract Method", actionName: "scope_0", actionDescription: "Extract to method in class 'Foo'", -}); - -verify.currentFileContentIs(`class Foo { + newContent: +`class Foo { static method() { - return Foo.newFunction(); + return Foo./*RENAME*/newFunction(); } private static newFunction() { return 1; } -}`); \ No newline at end of file +}` +}); diff --git a/tests/cases/fourslash/extract-method24.ts b/tests/cases/fourslash/extract-method24.ts index e5f923bb80d..5706c5c7a54 100644 --- a/tests/cases/fourslash/extract-method24.ts +++ b/tests/cases/fourslash/extract-method24.ts @@ -11,13 +11,14 @@ edit.applyRefactor({ refactorName: "Extract Method", actionName: "scope_1", actionDescription: "Extract to function in global scope", -}); -verify.currentFileContentIs(`function M() { + newContent: +`function M() { let a = [1,2,3]; let x = 0; - console.log(newFunction(a, x)); + console.log(/*RENAME*/newFunction(a, x)); } function newFunction(a: number[], x: number): any { return a[x]; } -`); \ No newline at end of file +` +}); diff --git a/tests/cases/fourslash/extract-method25.ts b/tests/cases/fourslash/extract-method25.ts index d18d0691e61..4fb2193adf3 100644 --- a/tests/cases/fourslash/extract-method25.ts +++ b/tests/cases/fourslash/extract-method25.ts @@ -12,12 +12,13 @@ edit.applyRefactor({ refactorName: "Extract Method", actionName: "scope_0", actionDescription: "Extract to inner function in function 'fn'", -}); -verify.currentFileContentIs(`function fn() { - var q = newFunction() + newContent: +`function fn() { + var q = /*RENAME*/newFunction() q[0]++ function newFunction() { return [0]; } -}`); +}` +}); diff --git a/tests/cases/fourslash/extract-method5.ts b/tests/cases/fourslash/extract-method5.ts index 014dfb35d08..b27d9a8209b 100644 --- a/tests/cases/fourslash/extract-method5.ts +++ b/tests/cases/fourslash/extract-method5.ts @@ -13,13 +13,12 @@ edit.applyRefactor({ refactorName: "Extract Method", actionName: "scope_0", actionDescription: "Extract to inner function in function 'f'", -}); -// TODO: GH#18091 (fix formatting to use `2 ? 1 :` and not `2?1:`) -verify.currentFileContentIs( + newContent: `function f() { - var x: 1 | 2 | 3 = newFunction(); + var x: 1 | 2 | 3 = /*RENAME*/newFunction(); function newFunction(): 1 | 2 | 3 { return 1 + 1 === 2 ? 1 : 2; } -}`); \ No newline at end of file +}` +}); diff --git a/tests/cases/fourslash/extract-method7.ts b/tests/cases/fourslash/extract-method7.ts index d8459bf77ad..c28e12dce8c 100644 --- a/tests/cases/fourslash/extract-method7.ts +++ b/tests/cases/fourslash/extract-method7.ts @@ -11,10 +11,11 @@ edit.applyRefactor({ refactorName: "Extract Method", actionName: "scope_0", actionDescription: "Extract to function in global scope", -}); -verify.currentFileContentIs(`function fn(x = newFunction()) { + newContent: +`function fn(x = /*RENAME*/newFunction()) { } function newFunction() { return 1 + 1; } -`); +` +}); diff --git a/tests/cases/fourslash/findAllRefsParameterPropertyDeclaration1.ts b/tests/cases/fourslash/findAllRefsParameterPropertyDeclaration1.ts index fa1254118a1..89bb40b6830 100644 --- a/tests/cases/fourslash/findAllRefsParameterPropertyDeclaration1.ts +++ b/tests/cases/fourslash/findAllRefsParameterPropertyDeclaration1.ts @@ -3,7 +3,7 @@ //// class Foo { //// constructor(private [|{| "isWriteAccess": true, "isDefinition": true |}privateParam|]: number) { //// let localPrivate = [|privateParam|]; -//// this.[|privateParam|] += 10; +//// this.[|{| "isWriteAccess": true |}privateParam|] += 10; //// } //// } diff --git a/tests/cases/fourslash/findAllRefsParameterPropertyDeclaration2.ts b/tests/cases/fourslash/findAllRefsParameterPropertyDeclaration2.ts index 45d814f909e..519ca74c5c4 100644 --- a/tests/cases/fourslash/findAllRefsParameterPropertyDeclaration2.ts +++ b/tests/cases/fourslash/findAllRefsParameterPropertyDeclaration2.ts @@ -3,7 +3,7 @@ //// class Foo { //// constructor(public [|{| "isWriteAccess": true, "isDefinition": true |}publicParam|]: number) { //// let localPublic = [|publicParam|]; -//// this.[|publicParam|] += 10; +//// this.[|{| "isWriteAccess": true |}publicParam|] += 10; //// } //// } diff --git a/tests/cases/fourslash/findAllRefsParameterPropertyDeclaration3.ts b/tests/cases/fourslash/findAllRefsParameterPropertyDeclaration3.ts index 3520fecb8ad..7addc2ba7a0 100644 --- a/tests/cases/fourslash/findAllRefsParameterPropertyDeclaration3.ts +++ b/tests/cases/fourslash/findAllRefsParameterPropertyDeclaration3.ts @@ -3,7 +3,7 @@ //// class Foo { //// constructor(protected [|{| "isWriteAccess": true, "isDefinition": true |}protectedParam|]: number) { //// let localProtected = [|protectedParam|]; -//// this.[|protectedParam|] += 10; +//// this.[|{| "isWriteAccess": true |}protectedParam|] += 10; //// } //// } diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index 119780872e9..7901d9550cb 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -310,7 +310,7 @@ declare namespace FourSlashInterface { enableFormatting(): void; disableFormatting(): void; - applyRefactor(options: { refactorName: string, actionName: string, actionDescription: string }): void; + applyRefactor(options: { refactorName: string, actionName: string, actionDescription: string, newContent: string }): void; } class debug { printCurrentParameterHelp(): void; diff --git a/tests/cases/fourslash/localGetReferences.ts b/tests/cases/fourslash/localGetReferences.ts index 4648471648a..a434a6b0820 100644 --- a/tests/cases/fourslash/localGetReferences.ts +++ b/tests/cases/fourslash/localGetReferences.ts @@ -14,10 +14,10 @@ //// constructor (public [|{| "isWriteAccess": true, "isDefinition": true |}clsParam|]: number) { //// //Increments //// [|{| "isWriteAccess": true |}globalVar|]++; -//// this.[|clsVar|]++; -//// fooCls.[|clsSVar|]++; +//// this.[|{| "isWriteAccess": true |}clsVar|]++; +//// fooCls.[|{| "isWriteAccess": true |}clsSVar|]++; //// // References to a class parameter. -//// this.[|clsParam|]++; +//// this.[|{| "isWriteAccess": true |}clsParam|]++; //// modTest.modVar++; //// } ////} @@ -28,7 +28,7 @@ //// var [|{| "isWriteAccess": true, "isDefinition": true |}fnVar|] = 1; //// //// //Increments -//// fooCls.[|clsSVar|]++; +//// fooCls.[|{| "isWriteAccess": true |}clsSVar|]++; //// [|{| "isWriteAccess": true |}globalVar|]++; //// modTest.modVar++; //// [|{| "isWriteAccess": true |}fnVar|]++; @@ -43,7 +43,7 @@ //// //// //Increments //// [|{| "isWriteAccess": true |}globalVar|]++; -//// fooCls.[|clsSVar|]++; +//// fooCls.[|{| "isWriteAccess": true |}clsSVar|]++; //// modVar++; //// //// class testCls { @@ -55,7 +55,7 @@ //// //// //Increments //// [|{| "isWriteAccess": true |}globalVar|]++; -//// fooCls.[|clsSVar|]++; +//// fooCls.[|{| "isWriteAccess": true |}clsSVar|]++; //// modVar++; //// } //// @@ -74,7 +74,7 @@ ////[|foo|]([|globalVar|]); //// //////Increments -////fooCls.[|clsSVar|]++; +////fooCls.[|{| "isWriteAccess": true |}clsSVar|]++; ////modTest.modVar++; ////[|{| "isWriteAccess": true |}globalVar|] = [|globalVar|] + [|globalVar|]; //// diff --git a/tests/cases/fourslash/referenceInParameterPropertyDeclaration.ts b/tests/cases/fourslash/referenceInParameterPropertyDeclaration.ts index 79bf6172863..63494352ff4 100644 --- a/tests/cases/fourslash/referenceInParameterPropertyDeclaration.ts +++ b/tests/cases/fourslash/referenceInParameterPropertyDeclaration.ts @@ -7,13 +7,13 @@ //// protected [|{| "isWriteAccess": true, "isDefinition": true, "type": "boolean" |}protectedParam|]: boolean) { //// //// let localPrivate = [|privateParam|]; -//// this.[|privateParam|] += 10; +//// this.[|{| "isWriteAccess": true |}privateParam|] += 10; //// //// let localPublic = [|publicParam|]; -//// this.[|publicParam|] += " Hello!"; +//// this.[|{| "isWriteAccess": true |}publicParam|] += " Hello!"; //// //// let localProtected = [|protectedParam|]; -//// this.[|protectedParam|] = false; +//// this.[|{| "isWriteAccess": true |}protectedParam|] = false; //// } //// } diff --git a/tests/cases/fourslash/referencesForClassLocal.ts b/tests/cases/fourslash/referencesForClassLocal.ts index 4108c060a39..9e2576413f2 100644 --- a/tests/cases/fourslash/referencesForClassLocal.ts +++ b/tests/cases/fourslash/referencesForClassLocal.ts @@ -8,11 +8,11 @@ //// private [|{| "isWriteAccess": true, "isDefinition": true |}n|] = 0; //// //// public bar() { -//// this.[|n|] = 9; +//// this.[|{| "isWriteAccess": true |}n|] = 9; //// } //// //// constructor() { -//// this.[|n|] = 4; +//// this.[|{| "isWriteAccess": true |}n|] = 4; //// } //// //// public bar2() { diff --git a/tests/cases/fourslash/referencesForClassParameter.ts b/tests/cases/fourslash/referencesForClassParameter.ts index e1a33dc5ac4..24eb9e5496e 100644 --- a/tests/cases/fourslash/referencesForClassParameter.ts +++ b/tests/cases/fourslash/referencesForClassParameter.ts @@ -11,13 +11,13 @@ //// } //// //// public f(p) { -//// this.[|p|] = p; +//// this.[|{| "isWriteAccess": true |}p|] = p; //// } //// ////} //// ////var n = new foo(undefined); -////n.[|p|] = null; +////n.[|{| "isWriteAccess": true |}p|] = null; const ranges = test.ranges(); const [r0, r1, r2] = ranges; diff --git a/tests/cases/fourslash/referencesForOverrides.ts b/tests/cases/fourslash/referencesForOverrides.ts index 5ce6bc5ed04..a3cfffa8bd4 100644 --- a/tests/cases/fourslash/referencesForOverrides.ts +++ b/tests/cases/fourslash/referencesForOverrides.ts @@ -70,7 +70,7 @@ //// w.[|icfoo|](); //// //// var z = new Test.BarBlah(); -//// z.[|field|] = ""; +//// z.[|{| "isWriteAccess": true |}field|] = ""; //// z.[|method|](); //// } ////} diff --git a/tests/cases/fourslash/referencesForStatic.ts b/tests/cases/fourslash/referencesForStatic.ts index 17c33daac32..1c82d2fde6c 100644 --- a/tests/cases/fourslash/referencesForStatic.ts +++ b/tests/cases/fourslash/referencesForStatic.ts @@ -9,7 +9,7 @@ //// static [|{| "isWriteAccess": true, "isDefinition": true |}n|] = ''; //// //// public bar() { -//// foo.[|n|] = "'"; +//// foo.[|{| "isWriteAccess": true |}n|] = "'"; //// if(foo.[|n|]) { //// var x = foo.[|n|]; //// } @@ -19,7 +19,7 @@ ////class foo2 { //// private x = foo.[|n|]; //// constructor() { -//// foo.[|n|] = x; +//// foo.[|{| "isWriteAccess": true |}n|] = x; //// } //// //// function b(n) { diff --git a/tests/cases/fourslash/referencesForStringLiteralPropertyNames4.ts b/tests/cases/fourslash/referencesForStringLiteralPropertyNames4.ts index 4293435de1d..c289a17c91c 100644 --- a/tests/cases/fourslash/referencesForStringLiteralPropertyNames4.ts +++ b/tests/cases/fourslash/referencesForStringLiteralPropertyNames4.ts @@ -2,7 +2,7 @@ ////var x = { "[|{| "isWriteAccess": true, "isDefinition": true |}someProperty|]": 0 } ////x["[|someProperty|]"] = 3; -////x.[|someProperty|] = 5; +////x.[|{| "isWriteAccess": true |}someProperty|] = 5; const ranges = test.ranges(); const [r0, r1, r2] = ranges; diff --git a/tests/cases/fourslash/remoteGetReferences.ts b/tests/cases/fourslash/remoteGetReferences.ts index 292864f9ed4..a09e3fb3b01 100644 --- a/tests/cases/fourslash/remoteGetReferences.ts +++ b/tests/cases/fourslash/remoteGetReferences.ts @@ -93,7 +93,7 @@ ////remotefoo([|remoteglobalVar|]); //// //////Increments -////[|remotefooCls|].[|remoteclsSVar|]++; +////[|remotefooCls|].[|{| "isWriteAccess": true |}remoteclsSVar|]++; ////remotemodTest.remotemodVar++; ////[|{| "isWriteAccess": true |}remoteglobalVar|] = [|remoteglobalVar|] + [|remoteglobalVar|]; //// @@ -129,8 +129,8 @@ //// constructor(public remoteclsParam: number) { //// //Increments //// [|{| "isWriteAccess": true |}remoteglobalVar|]++; -//// this.[|remoteclsVar|]++; -//// [|remotefooCls|].[|remoteclsSVar|]++; +//// this.[|{| "isWriteAccess": true |}remoteclsVar|]++; +//// [|remotefooCls|].[|{| "isWriteAccess": true |}remoteclsSVar|]++; //// this.remoteclsParam++; //// remotemodTest.remotemodVar++; //// } @@ -141,7 +141,7 @@ //// var remotefnVar = 1; //// //// //Increments -//// [|remotefooCls|].[|remoteclsSVar|]++; +//// [|remotefooCls|].[|{| "isWriteAccess": true |}remoteclsSVar|]++; //// [|{| "isWriteAccess": true |}remoteglobalVar|]++; //// remotemodTest.remotemodVar++; //// remotefnVar++; @@ -156,7 +156,7 @@ //// //// //Increments //// [|{| "isWriteAccess": true |}remoteglobalVar|]++; -//// [|remotefooCls|].[|remoteclsSVar|]++; +//// [|remotefooCls|].[|{| "isWriteAccess": true |}remoteclsSVar|]++; //// remotemodVar++; //// //// class remotetestCls { @@ -168,7 +168,7 @@ //// //// //Increments //// [|{| "isWriteAccess": true |}remoteglobalVar|]++; -//// [|remotefooCls|].[|remoteclsSVar|]++; +//// [|remotefooCls|].[|{| "isWriteAccess": true |}remoteclsSVar|]++; //// remotemodVar++; //// } //// diff --git a/tests/cases/fourslash/unusedLocalsInFunction4.ts b/tests/cases/fourslash/unusedLocalsInFunction4.ts index a458d6d824c..62d128ea9e7 100644 --- a/tests/cases/fourslash/unusedLocalsInFunction4.ts +++ b/tests/cases/fourslash/unusedLocalsInFunction4.ts @@ -3,8 +3,7 @@ // @noUnusedLocals: true ////function greeter() { //// [| var x,y = 0,z = 1; |] -//// y++; -//// z++; +//// use(y, z); ////} verify.rangeAfterCodeFix("var y = 0,z = 1;"); diff --git a/tests/cases/fourslash/unusedLocalsInMethodFS1.ts b/tests/cases/fourslash/unusedLocalsInMethodFS1.ts index dc73ab86663..ecfb7455276 100644 --- a/tests/cases/fourslash/unusedLocalsInMethodFS1.ts +++ b/tests/cases/fourslash/unusedLocalsInMethodFS1.ts @@ -4,8 +4,8 @@ // @noUnusedParameters: true ////class greeter { //// public function1() { -//// [| var /*0*/x,/*1*/ y = 10; |] -//// y++; +//// [| var /*0*/x,/*1*/ y = 10; |] +//// use(y); //// } ////} diff --git a/tests/cases/fourslash/unusedLocalsInMethodFS2.ts b/tests/cases/fourslash/unusedLocalsInMethodFS2.ts index 012bf87a222..d06e803bf7f 100644 --- a/tests/cases/fourslash/unusedLocalsInMethodFS2.ts +++ b/tests/cases/fourslash/unusedLocalsInMethodFS2.ts @@ -5,7 +5,7 @@ ////class greeter { //// public function1() { //// [| var x, y; |] -//// y = 1; +//// use(y); //// } ////} diff --git a/tests/cases/fourslash/unusedParameterInFunction2.ts b/tests/cases/fourslash/unusedParameterInFunction2.ts index 81e73450622..6d1a772b0a8 100644 --- a/tests/cases/fourslash/unusedParameterInFunction2.ts +++ b/tests/cases/fourslash/unusedParameterInFunction2.ts @@ -2,7 +2,7 @@ // @noUnusedParameters: true ////function [|greeter(x,y)|] { -//// x++; +//// use(x); ////} verify.rangeAfterCodeFix("greeter(x)", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0); \ No newline at end of file diff --git a/tests/cases/fourslash/unusedParameterInFunction4.ts b/tests/cases/fourslash/unusedParameterInFunction4.ts index 4ea96b3bd18..e3ee2585384 100644 --- a/tests/cases/fourslash/unusedParameterInFunction4.ts +++ b/tests/cases/fourslash/unusedParameterInFunction4.ts @@ -2,8 +2,7 @@ // @noUnusedParameters: true ////[|function greeter(x,y,z) |] { -//// x++; -//// z++; +//// use(x, z); ////} verify.rangeAfterCodeFix("function greeter(x,z)", /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 0); \ No newline at end of file diff --git a/tests/cases/fourslash/unusedVariableInNamespace2.ts b/tests/cases/fourslash/unusedVariableInNamespace2.ts index 992c229014a..61fc3ec137c 100644 --- a/tests/cases/fourslash/unusedVariableInNamespace2.ts +++ b/tests/cases/fourslash/unusedVariableInNamespace2.ts @@ -4,8 +4,7 @@ ////namespace greeter { //// [|let a = "dummy entry", b, c = 0;|] //// export function function1() { -//// a = "dummy"; -//// c++; +//// use(a, c); //// } ////} diff --git a/tests/cases/fourslash/unusedVariableInNamespace3.ts b/tests/cases/fourslash/unusedVariableInNamespace3.ts index 0039036b2f8..7d2f3d251f3 100644 --- a/tests/cases/fourslash/unusedVariableInNamespace3.ts +++ b/tests/cases/fourslash/unusedVariableInNamespace3.ts @@ -4,8 +4,7 @@ ////namespace greeter { //// [|let a = "dummy entry", b, c = 0;|] //// export function function1() { -//// a = "dummy"; -//// b = 0; +//// use(a, b); //// } ////}