-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unused identifiers compiler code (#9200)
* Code changes to update references of the Identifiers * Added code for handling function, method and coonstructor level local variables and parameters * Rebased with origin master * Code changes to handle unused private variables, private methods and typed parameters * Code changes to handle namespace level elements * Code changes to handle unimplemented interfaces * Code to optimize the d.ts check * Correct Code change to handle the parameters for methods inside interfaces * Fix for lint error * Remove Trailing whitespace * Code changes to handle interface implementations * Changes to display the error position correctly * Compiler Test Cases * Adding condition to ignore constructor parameters * Removing unnecessary tests * Additional changes for compiler code * Additional changes to handle constructor scenario * Fixing the consolidated case * Changed logic to search for private instead of public * Response to PR Comments * Changed the error code in test cases as result of merge with master * Adding the missing file * Adding the missing file II * Response to PR comments * Code changes for checking unused imports * Test Cases for Unused Imports * Response to PR comments * Code change specific to position of Import Declaration * Code change for handling the position for unused import * New scenarios for handling parameters in lambda function, type parameters in methods, etc. * Additional scenarios based on PR comments * Removing a redundant check * Added ambient check to imports and typeparatmeter reporting * Added one more scenario to handle type parameters * Added new scenario for TypeParameter on Interface * Refactoring the code * Added scenario to handle private class elements declared in constructor. * Minor change to erro reporting
- Loading branch information
1 parent
cca7000
commit a0a9666
Showing
324 changed files
with
5,641 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
tests/baselines/reference/unusedClassesinModule1.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
tests/cases/compiler/unusedClassesinModule1.ts(3,11): error TS6133: 'Calculator' is declared but never used. | ||
|
||
|
||
==== tests/cases/compiler/unusedClassesinModule1.ts (1 errors) ==== | ||
|
||
module A { | ||
class Calculator { | ||
~~~~~~~~~~ | ||
!!! error TS6133: 'Calculator' is declared but never used. | ||
public handelChar() { | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
//// [unusedClassesinModule1.ts] | ||
|
||
module A { | ||
class Calculator { | ||
public handelChar() { | ||
} | ||
} | ||
} | ||
|
||
//// [unusedClassesinModule1.js] | ||
var A; | ||
(function (A) { | ||
var Calculator = (function () { | ||
function Calculator() { | ||
} | ||
Calculator.prototype.handelChar = function () { | ||
}; | ||
return Calculator; | ||
}()); | ||
})(A || (A = {})); |
12 changes: 12 additions & 0 deletions
12
tests/baselines/reference/unusedClassesinNamespace1.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
tests/cases/compiler/unusedClassesinNamespace1.ts(3,11): error TS6133: 'c1' is declared but never used. | ||
|
||
|
||
==== tests/cases/compiler/unusedClassesinNamespace1.ts (1 errors) ==== | ||
|
||
namespace Validation { | ||
class c1 { | ||
~~ | ||
!!! error TS6133: 'c1' is declared but never used. | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//// [unusedClassesinNamespace1.ts] | ||
|
||
namespace Validation { | ||
class c1 { | ||
|
||
} | ||
} | ||
|
||
//// [unusedClassesinNamespace1.js] | ||
var Validation; | ||
(function (Validation) { | ||
var c1 = (function () { | ||
function c1() { | ||
} | ||
return c1; | ||
}()); | ||
})(Validation || (Validation = {})); |
16 changes: 16 additions & 0 deletions
16
tests/baselines/reference/unusedClassesinNamespace2.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
tests/cases/compiler/unusedClassesinNamespace2.ts(3,11): error TS6133: 'c1' is declared but never used. | ||
|
||
|
||
==== tests/cases/compiler/unusedClassesinNamespace2.ts (1 errors) ==== | ||
|
||
namespace Validation { | ||
class c1 { | ||
~~ | ||
!!! error TS6133: 'c1' is declared but never used. | ||
|
||
} | ||
|
||
export class c2 { | ||
|
||
} | ||
} |
Oops, something went wrong.