Test different parameters on classes and methods
This commit is contained in:
parent
01d7f0b699
commit
e08dce2c21
3 changed files with 64 additions and 0 deletions
|
@ -586,6 +586,20 @@ namespace A {
|
|||
testExtractMethod("extractMethod16",
|
||||
`function F<T>() {
|
||||
const array: T[] = [#|[]|];
|
||||
}`);
|
||||
// Class type parameter
|
||||
testExtractMethod("extractMethod17",
|
||||
`class C<T1, T2> {
|
||||
M(t1: T1, t2: T2) {
|
||||
[#|t1.toString()|];
|
||||
}
|
||||
}`);
|
||||
// Method type parameter
|
||||
testExtractMethod("extractMethod18",
|
||||
`class C {
|
||||
M<T1, T2>(t1: T1, t2: T2) {
|
||||
[#|t1.toString()|];
|
||||
}
|
||||
}`);
|
||||
});
|
||||
|
||||
|
|
25
tests/baselines/reference/extractMethod/extractMethod17.ts
Normal file
25
tests/baselines/reference/extractMethod/extractMethod17.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
// ==ORIGINAL==
|
||||
class C<T1, T2> {
|
||||
M(t1: T1, t2: T2) {
|
||||
t1.toString();
|
||||
}
|
||||
}
|
||||
// ==SCOPE::class 'C'==
|
||||
class C<T1, T2> {
|
||||
M(t1: T1, t2: T2) {
|
||||
this.newFunction(t1);
|
||||
}
|
||||
|
||||
private newFunction(t1: T1) {
|
||||
t1.toString();
|
||||
}
|
||||
}
|
||||
// ==SCOPE::global scope==
|
||||
class C<T1, T2> {
|
||||
M(t1: T1, t2: T2) {
|
||||
newFunction<T1>(t1);
|
||||
}
|
||||
}
|
||||
function newFunction<T1>(t1: T1) {
|
||||
t1.toString();
|
||||
}
|
25
tests/baselines/reference/extractMethod/extractMethod18.ts
Normal file
25
tests/baselines/reference/extractMethod/extractMethod18.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
// ==ORIGINAL==
|
||||
class C {
|
||||
M<T1, T2>(t1: T1, t2: T2) {
|
||||
t1.toString();
|
||||
}
|
||||
}
|
||||
// ==SCOPE::class 'C'==
|
||||
class C {
|
||||
M<T1, T2>(t1: T1, t2: T2) {
|
||||
this.newFunction<T1>(t1);
|
||||
}
|
||||
|
||||
private newFunction<T1>(t1: T1) {
|
||||
t1.toString();
|
||||
}
|
||||
}
|
||||
// ==SCOPE::global scope==
|
||||
class C {
|
||||
M<T1, T2>(t1: T1, t2: T2) {
|
||||
newFunction<T1>(t1);
|
||||
}
|
||||
}
|
||||
function newFunction<T1>(t1: T1) {
|
||||
t1.toString();
|
||||
}
|
Loading…
Reference in a new issue