diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 0f4db171ab0fb..0b29eb58b293f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -22784,7 +22784,7 @@ namespace ts { function errorUnusedLocal(declaration: Declaration, name: string, addDiagnostic: AddUnusedDiagnostic) { const node = getNameOfDeclaration(declaration) || declaration; const message = isTypeDeclaration(declaration) ? Diagnostics._0_is_declared_but_never_used : Diagnostics._0_is_declared_but_its_value_is_never_read; - addDiagnostic(UnusedKind.Local, createDiagnosticForNodeSpan(getSourceFileOfNode(declaration), declaration, node, message, name)); + addDiagnostic(UnusedKind.Local, createDiagnosticForNode(node, message, name)); } function parameterNameStartsWithUnderscore(parameterName: DeclarationName) { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 8b4e12dc2220b..76dc3e60b8246 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -641,11 +641,6 @@ namespace ts { return createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2, arg3); } - export function createDiagnosticForNodeSpan(sourceFile: SourceFile, startNode: Node, endNode: Node, message: DiagnosticMessage, arg0?: string | number, arg1?: string | number, arg2?: string | number, arg3?: string | number): DiagnosticWithLocation { - const start = skipTrivia(sourceFile.text, startNode.pos); - return createFileDiagnostic(sourceFile, start, endNode.end - start, message, arg0, arg1, arg2, arg3); - } - export function createDiagnosticForNodeFromMessageChain(node: Node, messageChain: DiagnosticMessageChain): DiagnosticWithLocation { const sourceFile = getSourceFileOfNode(node); const span = getErrorSpanForNode(sourceFile, node); diff --git a/tests/baselines/reference/noUnusedLocals_selfReference.errors.txt b/tests/baselines/reference/noUnusedLocals_selfReference.errors.txt index ff2291c84d655..edb5049bbbf9d 100644 --- a/tests/baselines/reference/noUnusedLocals_selfReference.errors.txt +++ b/tests/baselines/reference/noUnusedLocals_selfReference.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/noUnusedLocals_selfReference.ts(3,1): error TS6133: 'f' is declared but its value is never read. -tests/cases/compiler/noUnusedLocals_selfReference.ts(5,5): error TS6133: 'g' is declared but its value is never read. -tests/cases/compiler/noUnusedLocals_selfReference.ts(9,1): error TS6196: 'C' is declared but never used. -tests/cases/compiler/noUnusedLocals_selfReference.ts(12,1): error TS6196: 'E' is declared but never used. -tests/cases/compiler/noUnusedLocals_selfReference.ts(13,1): error TS6196: 'I' is declared but never used. -tests/cases/compiler/noUnusedLocals_selfReference.ts(14,1): error TS6196: 'T' is declared but never used. -tests/cases/compiler/noUnusedLocals_selfReference.ts(15,1): error TS6133: 'N' is declared but its value is never read. +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(5,14): error TS6133: 'g' is declared but its value is never read. +tests/cases/compiler/noUnusedLocals_selfReference.ts(9,7): error TS6196: 'C' is declared but never used. +tests/cases/compiler/noUnusedLocals_selfReference.ts(12,6): error TS6196: 'E' is declared but never used. +tests/cases/compiler/noUnusedLocals_selfReference.ts(13,11): error TS6196: 'I' is declared but never used. +tests/cases/compiler/noUnusedLocals_selfReference.ts(14,6): error TS6196: 'T' is declared but never used. +tests/cases/compiler/noUnusedLocals_selfReference.ts(15,11): error TS6133: 'N' is declared but its value is never read. tests/cases/compiler/noUnusedLocals_selfReference.ts(22,19): error TS6133: 'm' is declared but its value is never read. @@ -12,31 +12,31 @@ tests/cases/compiler/noUnusedLocals_selfReference.ts(22,19): error TS6133: 'm' i export {}; // Make this a module scope, so these are local variables. function f() { - ~~~~~~~~~~ + ~ !!! error TS6133: 'f' is declared but its value is never read. f; function g() { - ~~~~~~~~~~ + ~ !!! error TS6133: 'g' is declared but its value is never read. g; } } class C { - ~~~~~~~ + ~ !!! error TS6196: 'C' is declared but never used. m() { C; } } enum E { A = 0, B = E.A } - ~~~~~~ + ~ !!! error TS6196: 'E' is declared but never used. interface I { x: I }; - ~~~~~~~~~~~ + ~ !!! error TS6196: 'I' is declared but never used. type T = { x: T }; - ~~~~~~ + ~ !!! error TS6196: 'T' is declared but never used. namespace N { N; } - ~~~~~~~~~~~ + ~ !!! error TS6133: 'N' is declared but its value is never read. // Avoid a false positive. diff --git a/tests/baselines/reference/noUnusedLocals_selfReference_skipsBlockLocations.errors.txt b/tests/baselines/reference/noUnusedLocals_selfReference_skipsBlockLocations.errors.txt index f99b2522f1424..9ea0147978ab5 100644 --- a/tests/baselines/reference/noUnusedLocals_selfReference_skipsBlockLocations.errors.txt +++ b/tests/baselines/reference/noUnusedLocals_selfReference_skipsBlockLocations.errors.txt @@ -1,12 +1,12 @@ -tests/cases/compiler/noUnusedLocals_selfReference_skipsBlockLocations.ts(2,5): error TS6133: 'f' is declared but its value is never read. -tests/cases/compiler/noUnusedLocals_selfReference_skipsBlockLocations.ts(8,13): error TS6133: 'g' is declared but its value is never read. -tests/cases/compiler/noUnusedLocals_selfReference_skipsBlockLocations.ts(12,13): error TS6133: 'h' is declared but its value is never read. +tests/cases/compiler/noUnusedLocals_selfReference_skipsBlockLocations.ts(2,14): error TS6133: 'f' is declared but its value is never read. +tests/cases/compiler/noUnusedLocals_selfReference_skipsBlockLocations.ts(8,22): error TS6133: 'g' is declared but its value is never read. +tests/cases/compiler/noUnusedLocals_selfReference_skipsBlockLocations.ts(12,22): error TS6133: 'h' is declared but its value is never read. ==== tests/cases/compiler/noUnusedLocals_selfReference_skipsBlockLocations.ts (3 errors) ==== namespace n { function f() { - ~~~~~~~~~~ + ~ !!! error TS6133: 'f' is declared but its value is never read. f; } @@ -14,13 +14,13 @@ tests/cases/compiler/noUnusedLocals_selfReference_skipsBlockLocations.ts(12,13): switch (0) { case 0: function g() { - ~~~~~~~~~~ + ~ !!! error TS6133: 'g' is declared but its value is never read. g; } default: function h() { - ~~~~~~~~~~ + ~ !!! error TS6133: 'h' is declared but its value is never read. h; } diff --git a/tests/baselines/reference/unusedClassesinModule1.errors.txt b/tests/baselines/reference/unusedClassesinModule1.errors.txt index 488c434c5374b..663955b275031 100644 --- a/tests/baselines/reference/unusedClassesinModule1.errors.txt +++ b/tests/baselines/reference/unusedClassesinModule1.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/unusedClassesinModule1.ts(2,5): error TS6196: 'Calculator' is declared but never used. +tests/cases/compiler/unusedClassesinModule1.ts(2,11): error TS6196: 'Calculator' is declared but never used. ==== tests/cases/compiler/unusedClassesinModule1.ts (1 errors) ==== module A { class Calculator { - ~~~~~~~~~~~~~~~~ + ~~~~~~~~~~ !!! error TS6196: 'Calculator' is declared but never used. public handelChar() { } diff --git a/tests/baselines/reference/unusedClassesinNamespace1.errors.txt b/tests/baselines/reference/unusedClassesinNamespace1.errors.txt index 44050f75b5422..10a2d2b1204a9 100644 --- a/tests/baselines/reference/unusedClassesinNamespace1.errors.txt +++ b/tests/baselines/reference/unusedClassesinNamespace1.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/unusedClassesinNamespace1.ts(2,5): error TS6196: 'c1' is declared but never used. +tests/cases/compiler/unusedClassesinNamespace1.ts(2,11): error TS6196: 'c1' is declared but never used. ==== tests/cases/compiler/unusedClassesinNamespace1.ts (1 errors) ==== namespace Validation { class c1 { - ~~~~~~~~ + ~~ !!! error TS6196: 'c1' is declared but never used. } diff --git a/tests/baselines/reference/unusedClassesinNamespace2.errors.txt b/tests/baselines/reference/unusedClassesinNamespace2.errors.txt index 6c6f5f815b6ae..d69339f212eb5 100644 --- a/tests/baselines/reference/unusedClassesinNamespace2.errors.txt +++ b/tests/baselines/reference/unusedClassesinNamespace2.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/unusedClassesinNamespace2.ts(2,5): error TS6196: 'c1' is declared but never used. +tests/cases/compiler/unusedClassesinNamespace2.ts(2,11): error TS6196: 'c1' is declared but never used. ==== tests/cases/compiler/unusedClassesinNamespace2.ts (1 errors) ==== namespace Validation { class c1 { - ~~~~~~~~ + ~~ !!! error TS6196: 'c1' is declared but never used. } diff --git a/tests/baselines/reference/unusedClassesinNamespace4.errors.txt b/tests/baselines/reference/unusedClassesinNamespace4.errors.txt index 209654569c92a..ad869daed7d2b 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,5): error TS6196: 'c3' is declared but never used. +tests/cases/compiler/unusedClassesinNamespace4.ts(10,11): error TS6196: 'c3' is declared but never used. ==== tests/cases/compiler/unusedClassesinNamespace4.ts (1 errors) ==== @@ -12,7 +12,7 @@ tests/cases/compiler/unusedClassesinNamespace4.ts(10,5): error TS6196: 'c3' is d } class c3 extends c1 { - ~~~~~~~~ + ~~ !!! error TS6196: 'c3' is declared but never used. } diff --git a/tests/baselines/reference/unusedClassesinNamespace5.errors.txt b/tests/baselines/reference/unusedClassesinNamespace5.errors.txt index 58cfa66160356..cc4798de01004 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,5): error TS6196: 'c3' is declared but never used. +tests/cases/compiler/unusedClassesinNamespace5.ts(10,11): error TS6196: 'c3' is declared but never used. ==== tests/cases/compiler/unusedClassesinNamespace5.ts (1 errors) ==== @@ -12,7 +12,7 @@ tests/cases/compiler/unusedClassesinNamespace5.ts(10,5): error TS6196: 'c3' is d } class c3 { - ~~~~~~~~ + ~~ !!! error TS6196: 'c3' is declared but never used. public x: c1; } diff --git a/tests/baselines/reference/unusedDestructuring.errors.txt b/tests/baselines/reference/unusedDestructuring.errors.txt index 67b97697323a5..14f71a459ab9a 100644 --- a/tests/baselines/reference/unusedDestructuring.errors.txt +++ b/tests/baselines/reference/unusedDestructuring.errors.txt @@ -3,7 +3,7 @@ tests/cases/compiler/unusedDestructuring.ts(4,9): error TS6133: 'c' is declared tests/cases/compiler/unusedDestructuring.ts(6,7): error TS6133: 'e' is declared but its value is never read. tests/cases/compiler/unusedDestructuring.ts(7,7): error TS6133: 'g' is declared but its value is never read. tests/cases/compiler/unusedDestructuring.ts(8,1): error TS6199: All variables are unused. -tests/cases/compiler/unusedDestructuring.ts(10,1): error TS6133: 'f' is declared but its value is never read. +tests/cases/compiler/unusedDestructuring.ts(10,10): error TS6133: 'f' is declared but its value is never read. tests/cases/compiler/unusedDestructuring.ts(10,12): error TS6198: All destructured elements are unused. tests/cases/compiler/unusedDestructuring.ts(10,24): error TS6133: 'c' is declared but its value is never read. tests/cases/compiler/unusedDestructuring.ts(10,32): error TS6133: 'e' is declared but its value is never read. @@ -30,7 +30,7 @@ tests/cases/compiler/unusedDestructuring.ts(10,32): error TS6133: 'e' is declare !!! error TS6199: All variables are unused. function f({ a, b }, { c, d }, { e }) { - ~~~~~~~~~~ + ~ !!! error TS6133: 'f' is declared but its value is never read. ~~~~~~~~ !!! error TS6198: All destructured elements are unused. diff --git a/tests/baselines/reference/unusedFunctionsinNamespaces1.errors.txt b/tests/baselines/reference/unusedFunctionsinNamespaces1.errors.txt index 7dee9ad072319..202977c6fb776 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,5): error TS6133: 'function1' is declared but its value is never read. +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 its value is never read. } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedFunctionsinNamespaces5.errors.txt b/tests/baselines/reference/unusedFunctionsinNamespaces5.errors.txt index 07f22fa39dcc2..8f7f617e55925 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,5): error TS6133: 'function3' is declared but its value is never read. -tests/cases/compiler/unusedFunctionsinNamespaces5.ts(13,5): error TS6133: 'function4' is declared but its value is never read. +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) ==== @@ -12,13 +12,13 @@ tests/cases/compiler/unusedFunctionsinNamespaces5.ts(13,5): error TS6133: 'funct } function function3() { - ~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~ !!! error TS6133: 'function3' is declared but its value is never read. function1(); } function function4() { - ~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~ !!! error TS6133: 'function4' is declared but its value is never read. } diff --git a/tests/baselines/reference/unusedFunctionsinNamespaces6.errors.txt b/tests/baselines/reference/unusedFunctionsinNamespaces6.errors.txt index fe84d72524eae..de5f7ae4d87fe 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,5): error TS6133: 'function4' is declared but its value is never read. +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) ==== @@ -15,7 +15,7 @@ tests/cases/compiler/unusedFunctionsinNamespaces6.ts(13,5): error TS6133: 'funct } function function4() { - ~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~ !!! 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 3ddd1f12b1bb5..c100fed6949d0 100644 --- a/tests/baselines/reference/unusedIdentifiersConsolidated1.errors.txt +++ b/tests/baselines/reference/unusedIdentifiersConsolidated1.errors.txt @@ -10,11 +10,11 @@ tests/cases/compiler/unusedIdentifiersConsolidated1.ts(17,13): error TS6133: 'un 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,5): error TS6196: 'usedLocallyInterface2' is declared but never used. -tests/cases/compiler/unusedIdentifiersConsolidated1.ts(64,5): error TS6196: 'dummy' is declared but never used. -tests/cases/compiler/unusedIdentifiersConsolidated1.ts(67,5): error TS6196: 'unusedInterface' is declared but never used. -tests/cases/compiler/unusedIdentifiersConsolidated1.ts(79,5): error TS6196: 'class3' is declared but never used. -tests/cases/compiler/unusedIdentifiersConsolidated1.ts(99,5): error TS6196: 'interface5' is declared but never used. +tests/cases/compiler/unusedIdentifiersConsolidated1.ts(57,15): error TS6196: 'usedLocallyInterface2' is declared but never used. +tests/cases/compiler/unusedIdentifiersConsolidated1.ts(64,11): error TS6196: 'dummy' is declared but never used. +tests/cases/compiler/unusedIdentifiersConsolidated1.ts(67,15): error TS6196: 'unusedInterface' is declared but never used. +tests/cases/compiler/unusedIdentifiersConsolidated1.ts(79,11): error TS6196: 'class3' is declared but never used. +tests/cases/compiler/unusedIdentifiersConsolidated1.ts(99,15): error TS6196: 'interface5' is declared but never used. ==== tests/cases/compiler/unusedIdentifiersConsolidated1.ts (17 errors) ==== @@ -99,7 +99,7 @@ tests/cases/compiler/unusedIdentifiersConsolidated1.ts(99,5): error TS6196: 'int } interface usedLocallyInterface2 { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~ !!! error TS6196: 'usedLocallyInterface2' is declared but never used. someFunction(s1: string): void; } @@ -108,12 +108,12 @@ tests/cases/compiler/unusedIdentifiersConsolidated1.ts(99,5): error TS6196: 'int } class dummy implements usedLocallyInterface { - ~~~~~~~~~~~ + ~~~~~ !!! error TS6196: 'dummy' is declared but never used. } interface unusedInterface { - ~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~ !!! error TS6196: 'unusedInterface' is declared but never used. } } @@ -127,7 +127,7 @@ tests/cases/compiler/unusedIdentifiersConsolidated1.ts(99,5): error TS6196: 'int } class class3 { - ~~~~~~~~~~~~ + ~~~~~~ !!! error TS6196: 'class3' is declared but never used. } @@ -149,7 +149,7 @@ tests/cases/compiler/unusedIdentifiersConsolidated1.ts(99,5): error TS6196: 'int export let a: interface3; interface interface5 { - ~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~ !!! error TS6196: 'interface5' is declared but never used. } } \ No newline at end of file diff --git a/tests/baselines/reference/unusedImports10.errors.txt b/tests/baselines/reference/unusedImports10.errors.txt index e6c405d221cfb..b9688a0118557 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,5): error TS6133: 'a' is declared but its value is never read. +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) ==== @@ -11,6 +11,6 @@ tests/cases/compiler/unusedImports10.ts(9,5): error TS6133: 'a' is declared but module B { import a = A; - ~~~~~~~~ + ~ !!! 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 5bdd99d604464..e3b6da00db879 100644 --- a/tests/baselines/reference/unusedImports12.errors.txt +++ b/tests/baselines/reference/unusedImports12.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/a.ts(1,1): error TS6133: 'Member' is declared but its value is never read. tests/cases/compiler/a.ts(2,1): error TS6192: All imports in import declaration are unused. tests/cases/compiler/a.ts(3,1): error TS6133: 'ns' is declared but its value is never read. -tests/cases/compiler/a.ts(4,1): error TS6133: 'r' 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 (4 errors) ==== @@ -15,7 +15,7 @@ tests/cases/compiler/a.ts(4,1): error TS6133: 'r' is declared but its value is n ~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS6133: 'ns' is declared but its value is never read. import r = require("./b"); - ~~~~~~~~ + ~ !!! error TS6133: 'r' is declared but its value is never read. ==== tests/cases/compiler/b.ts (0 errors) ==== diff --git a/tests/baselines/reference/unusedImports8.errors.txt b/tests/baselines/reference/unusedImports8.errors.txt index 5cac8a8ee153b..a6cbaae8ff600 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,41): error TS6133: 't2' is declared but its value is never read. +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) ==== @@ -16,7 +16,7 @@ tests/cases/compiler/file2.ts(1,41): error TS6133: 't2' is declared but its valu ==== 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 its value is never read. var x = new calc(); diff --git a/tests/baselines/reference/unusedImports9.errors.txt b/tests/baselines/reference/unusedImports9.errors.txt index 02bee34686e10..2452962b28990 100644 --- a/tests/baselines/reference/unusedImports9.errors.txt +++ b/tests/baselines/reference/unusedImports9.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/file2.ts(1,1): error TS6133: 'c' is declared but its value is never read. +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 its value is never read. ==== tests/cases/compiler/file1.ts (0 errors) ==== export class Calculator { diff --git a/tests/baselines/reference/unusedImports_entireImportDeclaration.errors.txt b/tests/baselines/reference/unusedImports_entireImportDeclaration.errors.txt index cd58ce714b06e..d0418446be3ec 100644 --- a/tests/baselines/reference/unusedImports_entireImportDeclaration.errors.txt +++ b/tests/baselines/reference/unusedImports_entireImportDeclaration.errors.txt @@ -1,8 +1,8 @@ /b.ts(1,1): error TS6192: All imports in import declaration are unused. /b.ts(2,1): error TS6192: All imports in import declaration are unused. -/b.ts(4,14): error TS6133: 'a2' is declared but its value is never read. -/b.ts(4,23): error TS6133: 'b2' is declared but its value is never read. -/b.ts(6,12): error TS6133: 'ns2' is declared but its value is never read. +/b.ts(4,19): error TS6133: 'a2' is declared but its value is never read. +/b.ts(4,28): error TS6133: 'b2' is declared but its value is never read. +/b.ts(6,17): error TS6133: 'ns2' is declared but its value is never read. /b.ts(8,8): error TS6133: 'd5' is declared but its value is never read. @@ -20,13 +20,13 @@ !!! error TS6192: All imports in import declaration are unused. import d3, { a as a2, b as b2 } from "./a"; - ~~~~~~~ + ~~ !!! error TS6133: 'a2' is declared but its value is never read. - ~~~~~~~ + ~~ !!! error TS6133: 'b2' is declared but its value is never read. d3; import d4, * as ns2 from "./a"; - ~~~~~~~~ + ~~~ !!! error TS6133: 'ns2' is declared but its value is never read. d4; import d5, * as ns3 from "./a"; diff --git a/tests/baselines/reference/unusedInterfaceinNamespace1.errors.txt b/tests/baselines/reference/unusedInterfaceinNamespace1.errors.txt index 0fe77374c4de5..0c134508ea7b1 100644 --- a/tests/baselines/reference/unusedInterfaceinNamespace1.errors.txt +++ b/tests/baselines/reference/unusedInterfaceinNamespace1.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/unusedInterfaceinNamespace1.ts(2,5): error TS6196: 'i1' is declared but never used. +tests/cases/compiler/unusedInterfaceinNamespace1.ts(2,15): error TS6196: 'i1' is declared but never used. ==== tests/cases/compiler/unusedInterfaceinNamespace1.ts (1 errors) ==== namespace Validation { interface i1 { - ~~~~~~~~~~~~ + ~~ !!! error TS6196: 'i1' is declared but never used. } diff --git a/tests/baselines/reference/unusedInterfaceinNamespace2.errors.txt b/tests/baselines/reference/unusedInterfaceinNamespace2.errors.txt index 40e224358afbb..312e2db0aa203 100644 --- a/tests/baselines/reference/unusedInterfaceinNamespace2.errors.txt +++ b/tests/baselines/reference/unusedInterfaceinNamespace2.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/unusedInterfaceinNamespace2.ts(2,5): error TS6196: 'i1' is declared but never used. +tests/cases/compiler/unusedInterfaceinNamespace2.ts(2,15): error TS6196: 'i1' is declared but never used. ==== tests/cases/compiler/unusedInterfaceinNamespace2.ts (1 errors) ==== namespace Validation { interface i1 { - ~~~~~~~~~~~~ + ~~ !!! error TS6196: 'i1' is declared but never used. } diff --git a/tests/baselines/reference/unusedInterfaceinNamespace3.errors.txt b/tests/baselines/reference/unusedInterfaceinNamespace3.errors.txt index 206dd51c3e539..7647932305fb2 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,5): error TS6196: 'i3' is declared but never used. +tests/cases/compiler/unusedInterfaceinNamespace3.ts(10,15): error TS6196: 'i3' is declared but never used. ==== tests/cases/compiler/unusedInterfaceinNamespace3.ts (1 errors) ==== @@ -12,7 +12,7 @@ tests/cases/compiler/unusedInterfaceinNamespace3.ts(10,5): error TS6196: 'i3' is } interface i3 extends i1 { - ~~~~~~~~~~~~ + ~~ !!! error TS6196: 'i3' is declared but never used. } diff --git a/tests/baselines/reference/unusedLocalsAndObjectSpread2.errors.txt b/tests/baselines/reference/unusedLocalsAndObjectSpread2.errors.txt index 100f86468adcf..d675747fd0465 100644 --- a/tests/baselines/reference/unusedLocalsAndObjectSpread2.errors.txt +++ b/tests/baselines/reference/unusedLocalsAndObjectSpread2.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/unusedLocalsAndObjectSpread2.ts(5,6): error TS6133: 'rest' is declared but its value is never read. -tests/cases/compiler/unusedLocalsAndObjectSpread2.ts(8,1): error TS6133: 'foo' 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,12): error TS6133: 'rest' is declared but its value is never read. @@ -14,7 +14,7 @@ tests/cases/compiler/unusedLocalsAndObjectSpread2.ts(12,12): error TS6133: 'rest } = props; function foo() { - ~~~~~~~~~~~~ + ~~~ !!! error TS6133: 'foo' is declared but its value is never read. const { children, diff --git a/tests/baselines/reference/unusedLocalsAndParameters.errors.txt b/tests/baselines/reference/unusedLocalsAndParameters.errors.txt index e9656c6f6696c..2b07a5fac5242 100644 --- a/tests/baselines/reference/unusedLocalsAndParameters.errors.txt +++ b/tests/baselines/reference/unusedLocalsAndParameters.errors.txt @@ -2,7 +2,7 @@ tests/cases/compiler/unusedLocalsAndParameters.ts(4,12): error TS6133: 'a' is de 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,1): error TS6196: 'C' is declared but never used. +tests/cases/compiler/unusedLocalsAndParameters.ts(18,7): error TS6196: 'C' is declared but never used. 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 its value is never read. @@ -20,7 +20,7 @@ tests/cases/compiler/unusedLocalsAndParameters.ts(63,11): error TS6133: 'c' is d 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,1): error TS6133: 'N' 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. @@ -51,7 +51,7 @@ tests/cases/compiler/unusedLocalsAndParameters.ts(80,9): error TS6133: 'x' is de }; class C { - ~~~~~~~ + ~ !!! error TS6196: 'C' is declared but never used. // Method declaration paramter method(a) { @@ -148,7 +148,7 @@ tests/cases/compiler/unusedLocalsAndParameters.ts(80,9): error TS6133: 'x' is de // in a namespace namespace N { - ~~~~~~~~~~~ + ~ !!! error TS6133: 'N' is declared but its value is never read. var x; ~ diff --git a/tests/baselines/reference/unusedLocalsAndParametersTypeAliases2.errors.txt b/tests/baselines/reference/unusedLocalsAndParametersTypeAliases2.errors.txt index f86ec0d1cc789..de03f17fa46fc 100644 --- a/tests/baselines/reference/unusedLocalsAndParametersTypeAliases2.errors.txt +++ b/tests/baselines/reference/unusedLocalsAndParametersTypeAliases2.errors.txt @@ -1,20 +1,20 @@ -tests/cases/compiler/unusedLocalsAndParametersTypeAliases2.ts(2,1): error TS6196: 'handler1' is declared but never used. -tests/cases/compiler/unusedLocalsAndParametersTypeAliases2.ts(5,1): error TS6133: 'foo' is declared but its value is never read. -tests/cases/compiler/unusedLocalsAndParametersTypeAliases2.ts(6,5): error TS6196: 'handler2' is declared but never used. +tests/cases/compiler/unusedLocalsAndParametersTypeAliases2.ts(2,6): error TS6196: 'handler1' is declared but never used. +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 TS6196: 'handler2' is declared but never used. ==== tests/cases/compiler/unusedLocalsAndParametersTypeAliases2.ts (3 errors) ==== // unused type handler1 = () => void; - ~~~~~~~~~~~~~ + ~~~~~~~~ !!! error TS6196: 'handler1' is declared but never used. function foo() { - ~~~~~~~~~~~~ + ~~~ !!! error TS6133: 'foo' is declared but its value is never read. type handler2 = () => void; - ~~~~~~~~~~~~~ + ~~~~~~~~ !!! error TS6196: 'handler2' is declared but never used. foo(); } diff --git a/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration1.errors.txt b/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration1.errors.txt index ccfecf77634d0..da5bc7382e38e 100644 --- a/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration1.errors.txt +++ b/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration1.errors.txt @@ -1,7 +1,7 @@ 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,5): error TS6133: 'maker' 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. @@ -16,7 +16,7 @@ tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration1 ~~~~~~ !!! error TS6133: 'unused' is declared but its value is never read. function maker(child: string): void { - ~~~~~~~~~~~~~~ + ~~~~~ !!! error TS6133: 'maker' is declared but its value is never read. ~~~~~ !!! error TS6133: 'child' is declared but its value is never read. diff --git a/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration2.errors.txt b/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration2.errors.txt index dcd5b75ea8688..e5326d2c41fbe 100644 --- a/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration2.errors.txt +++ b/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration2.errors.txt @@ -1,6 +1,6 @@ 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,5): error TS6133: 'maker' 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. @@ -15,7 +15,7 @@ tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionDeclaration2 ~~~~~~ !!! error TS6133: 'unused' is declared but its value is never read. function maker(child: string): void { - ~~~~~~~~~~~~~~ + ~~~~~ !!! error TS6133: 'maker' is declared but its value is never read. ~~~~~ !!! error TS6133: 'child' is declared but its value is never read. diff --git a/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionExpression1.errors.txt b/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionExpression1.errors.txt index d8b92c7d71db3..ac9b5c8632c7b 100644 --- a/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionExpression1.errors.txt +++ b/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionExpression1.errors.txt @@ -1,7 +1,7 @@ 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,5): error TS6133: 'maker' 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. @@ -16,7 +16,7 @@ tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionExpression1. ~~~~~~ !!! error TS6133: 'unused' is declared but its value is never read. function maker(child: string): void { - ~~~~~~~~~~~~~~ + ~~~~~ !!! error TS6133: 'maker' is declared but its value is never read. ~~~~~ !!! error TS6133: 'child' is declared but its value is never read. diff --git a/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionExpression2.errors.txt b/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionExpression2.errors.txt index 4b5da962c002b..c709d189d1717 100644 --- a/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionExpression2.errors.txt +++ b/tests/baselines/reference/unusedLocalsOnFunctionDeclarationWithinFunctionExpression2.errors.txt @@ -1,6 +1,6 @@ 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,5): error TS6133: 'maker' 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. @@ -15,7 +15,7 @@ tests/cases/compiler/unusedLocalsOnFunctionDeclarationWithinFunctionExpression2. ~~~~~~ !!! error TS6133: 'unused' is declared but its value is never read. function maker(child: string): void { - ~~~~~~~~~~~~~~ + ~~~~~ !!! error TS6133: 'maker' is declared but its value is never read. ~~~~~ !!! error TS6133: 'child' is declared but its value is never read. diff --git a/tests/baselines/reference/unusedModuleInModule.errors.txt b/tests/baselines/reference/unusedModuleInModule.errors.txt index eb3aa9447977b..bd8040ce5903c 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,5): error TS6133: 'B' is declared but its value is never read. +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 its value is never read. } \ No newline at end of file diff --git a/tests/baselines/reference/unusedNamespaceInModule.errors.txt b/tests/baselines/reference/unusedNamespaceInModule.errors.txt index 9cce14e295a4e..afc118b094a41 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,5): error TS6133: 'B' is declared but its value is never read. +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 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 0988b749fd487..ff031f5af41d0 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,5): error TS6133: 'B' is declared but its value is never read. +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 its value is never read. export namespace C {} } \ No newline at end of file