-
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.
Fix #9458: exclude parameters starting with underscore from unusedPar…
…amter checks
- Loading branch information
Showing
4 changed files
with
139 additions
and
1 deletion.
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
56 changes: 56 additions & 0 deletions
56
tests/baselines/reference/unusedParametersWithUnderscore.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,56 @@ | ||
tests/cases/compiler/unusedParametersWithUnderscore.ts(2,12): error TS6133: 'a' is declared but never used. | ||
tests/cases/compiler/unusedParametersWithUnderscore.ts(2,19): error TS6133: 'c' is declared but never used. | ||
tests/cases/compiler/unusedParametersWithUnderscore.ts(2,27): error TS6133: 'd' is declared but never used. | ||
tests/cases/compiler/unusedParametersWithUnderscore.ts(2,29): error TS6133: 'e___' is declared but never used. | ||
tests/cases/compiler/unusedParametersWithUnderscore.ts(6,14): error TS6133: '_a' is declared but never used. | ||
tests/cases/compiler/unusedParametersWithUnderscore.ts(6,18): error TS6133: '___b' is declared but never used. | ||
tests/cases/compiler/unusedParametersWithUnderscore.ts(9,14): error TS6133: '_a' is declared but never used. | ||
tests/cases/compiler/unusedParametersWithUnderscore.ts(9,19): error TS6133: '___b' is declared but never used. | ||
tests/cases/compiler/unusedParametersWithUnderscore.ts(12,16): error TS6133: 'arg' is declared but never used. | ||
tests/cases/compiler/unusedParametersWithUnderscore.ts(18,13): error TS6133: 'arg' is declared but never used. | ||
|
||
|
||
==== tests/cases/compiler/unusedParametersWithUnderscore.ts (10 errors) ==== | ||
|
||
function f(a, _b, c, ___, d,e___, _f) { | ||
~ | ||
!!! error TS6133: 'a' is declared but never used. | ||
~ | ||
!!! error TS6133: 'c' is declared but never used. | ||
~ | ||
!!! error TS6133: 'd' is declared but never used. | ||
~~~~ | ||
!!! error TS6133: 'e___' is declared but never used. | ||
} | ||
|
||
|
||
function f2({_a, __b}) { | ||
~~ | ||
!!! error TS6133: '_a' is declared but never used. | ||
~~~ | ||
!!! error TS6133: '___b' is declared but never used. | ||
} | ||
|
||
function f3([_a, ,__b]) { | ||
~~ | ||
!!! error TS6133: '_a' is declared but never used. | ||
~~~ | ||
!!! error TS6133: '___b' is declared but never used. | ||
} | ||
|
||
function f4(...arg) { | ||
~~~ | ||
!!! error TS6133: 'arg' is declared but never used. | ||
} | ||
|
||
function f5(..._arg) { | ||
} | ||
|
||
function f6(arg?, _arg?) { | ||
~~~ | ||
!!! error TS6133: 'arg' is declared but never used. | ||
} | ||
|
||
var f7 = _ => undefined; | ||
|
||
var f8 = function (_) { }; |
50 changes: 50 additions & 0 deletions
50
tests/baselines/reference/unusedParametersWithUnderscore.js
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,50 @@ | ||
//// [unusedParametersWithUnderscore.ts] | ||
|
||
function f(a, _b, c, ___, d,e___, _f) { | ||
} | ||
|
||
|
||
function f2({_a, __b}) { | ||
} | ||
|
||
function f3([_a, ,__b]) { | ||
} | ||
|
||
function f4(...arg) { | ||
} | ||
|
||
function f5(..._arg) { | ||
} | ||
|
||
function f6(arg?, _arg?) { | ||
} | ||
|
||
var f7 = _ => undefined; | ||
|
||
var f8 = function (_) { }; | ||
|
||
//// [unusedParametersWithUnderscore.js] | ||
function f(a, _b, c, ___, d, e___, _f) { | ||
} | ||
function f2(_c) { | ||
var _a = _c._a, __b = _c.__b; | ||
} | ||
function f3(_c) { | ||
var _a = _c[0], __b = _c[2]; | ||
} | ||
function f4() { | ||
var arg = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
arg[_i - 0] = arguments[_i]; | ||
} | ||
} | ||
function f5() { | ||
var _arg = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
_arg[_i - 0] = arguments[_i]; | ||
} | ||
} | ||
function f6(arg, _arg) { | ||
} | ||
var f7 = function (_) { return undefined; }; | ||
var f8 = function (_) { }; |
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,25 @@ | ||
//@noUnusedLocals:true | ||
//@noUnusedParameters:true | ||
|
||
function f(a, _b, c, ___, d,e___, _f) { | ||
} | ||
|
||
|
||
function f2({_a, __b}) { | ||
} | ||
|
||
function f3([_a, ,__b]) { | ||
} | ||
|
||
function f4(...arg) { | ||
} | ||
|
||
function f5(..._arg) { | ||
} | ||
|
||
function f6(arg?, _arg?) { | ||
} | ||
|
||
var f7 = _ => undefined; | ||
|
||
var f8 = function (_) { }; |