-
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.
Don't count self-reference when setting
isReferenced
- Loading branch information
Andy Hanson
committed
Jul 28, 2017
1 parent
74e4903
commit da3ff37
Showing
6 changed files
with
100 additions
and
38 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
28 changes: 28 additions & 0 deletions
28
tests/baselines/reference/noUnusedLocals_selfReference.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,28 @@ | ||
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 errors) ==== | ||
export {}; // Make this a module scope, so these are local variables. | ||
|
||
function f() { f; } | ||
~ | ||
!!! error TS6133: 'f' is declared but never used. | ||
class C { | ||
~ | ||
!!! error TS6133: 'C' is declared but never used. | ||
m() { C; } | ||
} | ||
enum E { A = 0, B = E.A } | ||
~ | ||
!!! error TS6133: 'E' is declared but never used. | ||
|
||
// Does not detect mutual recursion. | ||
function g() { D; } | ||
class D { m() { g; } } | ||
|
||
// Does not work on private methods. | ||
class P { private m() { this.m; } } | ||
P; | ||
|
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,49 @@ | ||
//// [noUnusedLocals_selfReference.ts] | ||
export {}; // Make this a module scope, so these are local variables. | ||
|
||
function f() { f; } | ||
class C { | ||
m() { C; } | ||
} | ||
enum E { A = 0, B = E.A } | ||
|
||
// Does not detect mutual recursion. | ||
function g() { D; } | ||
class D { m() { g; } } | ||
|
||
// Does not work on private methods. | ||
class P { private m() { this.m; } } | ||
P; | ||
|
||
|
||
//// [noUnusedLocals_selfReference.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
function f() { f; } | ||
var C = (function () { | ||
function C() { | ||
} | ||
C.prototype.m = function () { C; }; | ||
return C; | ||
}()); | ||
var E; | ||
(function (E) { | ||
E[E["A"] = 0] = "A"; | ||
E[E["B"] = 0] = "B"; | ||
})(E || (E = {})); | ||
// Does not detect mutual recursion. | ||
function g() { D; } | ||
var D = (function () { | ||
function D() { | ||
} | ||
D.prototype.m = function () { g; }; | ||
return D; | ||
}()); | ||
// Does not work on private methods. | ||
var P = (function () { | ||
function P() { | ||
} | ||
P.prototype.m = function () { this.m; }; | ||
return P; | ||
}()); | ||
P; |
5 changes: 4 additions & 1 deletion
5
tests/baselines/reference/unusedLocalsAndParametersTypeAliases2.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
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 @@ | ||
// @noUnusedLocals: true | ||
|
||
export {}; // Make this a module scope, so these are local variables. | ||
|
||
function f() { f; } | ||
class C { | ||
m() { C; } | ||
} | ||
enum E { A = 0, B = E.A } | ||
|
||
// Does not detect mutual recursion. | ||
function g() { D; } | ||
class D { m() { g; } } | ||
|
||
// Does not work on private methods. | ||
class P { private m() { this.m; } } | ||
P; |
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