Skip to content

Commit fe015ef

Browse files
committed
Document failure to handle type parameter shadowing
1 parent b09d227 commit fe015ef

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

src/harness/unittests/extractMethods.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,15 @@ namespace A {
565565
}
566566
}
567567
}
568+
}`);
569+
// This test is descriptive, rather than normative. The current implementation
570+
// doesn't handle type parameter shadowing.
571+
testExtractMethod("extractMethod14",
572+
`function F<T>(t1: T) {
573+
function F<T>(t2: T) {
574+
[#|t1.toString();
575+
t2.toString();|]
576+
}
568577
}`);
569578
});
570579

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// ==ORIGINAL==
2+
function F<T>(t1: T) {
3+
function F<T>(t2: T) {
4+
t1.toString();
5+
t2.toString();
6+
}
7+
}
8+
// ==SCOPE::function 'F'==
9+
function F<T>(t1: T) {
10+
function F<T>(t2: T) {
11+
newFunction();
12+
13+
function newFunction() {
14+
t1.toString();
15+
t2.toString();
16+
}
17+
}
18+
}
19+
// ==SCOPE::function 'F'==
20+
function F<T>(t1: T) {
21+
function F<T>(t2: T) {
22+
newFunction<T>(t2);
23+
}
24+
25+
function newFunction<T>(t2: T) {
26+
t1.toString();
27+
t2.toString();
28+
}
29+
}
30+
// ==SCOPE::global scope==
31+
function F<T>(t1: T) {
32+
function F<T>(t2: T) {
33+
newFunction<T, T>(t1, t2);
34+
}
35+
}
36+
function newFunction<T, T>(t1: T, t2: T) {
37+
t1.toString();
38+
t2.toString();
39+
}

0 commit comments

Comments
 (0)