-
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 #32843 : evaluate right scope when checked if all type parameter …
…are unused for jsdoc `@template` (#33320) Co-authored-by: magierjones <simon.jaeger@magierjones.de>
- Loading branch information
Simon Jaeger
and
magierjones
authored
Mar 31, 2020
1 parent
4dc827e
commit 9c4cbd6
Showing
5 changed files
with
157 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
42 changes: 42 additions & 0 deletions
42
tests/baselines/reference/unusedTypeParameters_templateTag2.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,42 @@ | ||
/a.js(3,4): error TS6133: 'V' is declared but its value is never read. | ||
/a.js(13,4): error TS6205: All type parameters are unused | ||
/a.js(20,16): error TS6133: 'V' is declared but its value is never read. | ||
/a.js(20,18): error TS6133: 'X' is declared but its value is never read. | ||
|
||
|
||
==== /a.js (4 errors) ==== | ||
/** | ||
* @template T | ||
* @template V | ||
~~~~~~~~~~~ | ||
!!! error TS6133: 'V' is declared but its value is never read. | ||
*/ | ||
class C1 { | ||
constructor() { | ||
/** @type {T} */ | ||
this.p; | ||
} | ||
} | ||
|
||
/** | ||
* @template T,V | ||
~~~~~~~~~~~~~ | ||
!!! error TS6205: All type parameters are unused | ||
*/ | ||
class C2 { | ||
constructor() { } | ||
} | ||
|
||
/** | ||
* @template T,V,X | ||
~ | ||
!!! error TS6133: 'V' is declared but its value is never read. | ||
~ | ||
!!! error TS6133: 'X' is declared but its value is never read. | ||
*/ | ||
class C3 { | ||
constructor() { | ||
/** @type {T} */ | ||
this.p; | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
tests/baselines/reference/unusedTypeParameters_templateTag2.symbols
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,40 @@ | ||
=== /a.js === | ||
/** | ||
* @template T | ||
* @template V | ||
*/ | ||
class C1 { | ||
>C1 : Symbol(C1, Decl(a.js, 0, 0)) | ||
|
||
constructor() { | ||
/** @type {T} */ | ||
this.p; | ||
>this.p : Symbol(C1.p, Decl(a.js, 5, 19)) | ||
>this : Symbol(C1, Decl(a.js, 0, 0)) | ||
>p : Symbol(C1.p, Decl(a.js, 5, 19)) | ||
} | ||
} | ||
|
||
/** | ||
* @template T,V | ||
*/ | ||
class C2 { | ||
>C2 : Symbol(C2, Decl(a.js, 9, 1)) | ||
|
||
constructor() { } | ||
} | ||
|
||
/** | ||
* @template T,V,X | ||
*/ | ||
class C3 { | ||
>C3 : Symbol(C3, Decl(a.js, 16, 1)) | ||
|
||
constructor() { | ||
/** @type {T} */ | ||
this.p; | ||
>this.p : Symbol(C3.p, Decl(a.js, 22, 19)) | ||
>this : Symbol(C3, Decl(a.js, 16, 1)) | ||
>p : Symbol(C3.p, Decl(a.js, 22, 19)) | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
tests/baselines/reference/unusedTypeParameters_templateTag2.types
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,40 @@ | ||
=== /a.js === | ||
/** | ||
* @template T | ||
* @template V | ||
*/ | ||
class C1 { | ||
>C1 : C1<T, V> | ||
|
||
constructor() { | ||
/** @type {T} */ | ||
this.p; | ||
>this.p : T | ||
>this : this | ||
>p : T | ||
} | ||
} | ||
|
||
/** | ||
* @template T,V | ||
*/ | ||
class C2 { | ||
>C2 : C2<T, V> | ||
|
||
constructor() { } | ||
} | ||
|
||
/** | ||
* @template T,V,X | ||
*/ | ||
class C3 { | ||
>C3 : C3<T, V, X> | ||
|
||
constructor() { | ||
/** @type {T} */ | ||
this.p; | ||
>this.p : T | ||
>this : this | ||
>p : T | ||
} | ||
} |
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,34 @@ | ||
// @allowJs: true | ||
// @checkJs: true | ||
// @noEmit: true | ||
// @noUnusedParameters:true | ||
|
||
// @Filename: /a.js | ||
|
||
/** | ||
* @template T | ||
* @template V | ||
*/ | ||
class C1 { | ||
constructor() { | ||
/** @type {T} */ | ||
this.p; | ||
} | ||
} | ||
|
||
/** | ||
* @template T,V | ||
*/ | ||
class C2 { | ||
constructor() { } | ||
} | ||
|
||
/** | ||
* @template T,V,X | ||
*/ | ||
class C3 { | ||
constructor() { | ||
/** @type {T} */ | ||
this.p; | ||
} | ||
} |
9c4cbd6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great Job!